You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.4 KiB

  1. // Copyright 2014 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // The godex command prints (dumps) exported information of packages
  5. // or selected package objects.
  6. //
  7. // In contrast to godoc, godex extracts this information from compiled
  8. // object files. Hence the exported data is truly what a compiler will
  9. // see, at the cost of missing commentary.
  10. //
  11. // Usage: godex [flags] {path[.name]}
  12. //
  13. // Each argument must be a (possibly partial) package path, optionally
  14. // followed by a dot and the name of a package object:
  15. //
  16. // godex math
  17. // godex math.Sin
  18. // godex math.Sin fmt.Printf
  19. // godex go/types
  20. //
  21. // godex automatically tries all possible package path prefixes if only a
  22. // partial package path is given. For instance, for the path "go/types",
  23. // godex prepends "golang.org/x/tools".
  24. //
  25. // The prefixes are computed by searching the directories specified by
  26. // the GOROOT and GOPATH environment variables (and by excluding the
  27. // build OS- and architecture-specific directory names from the path).
  28. // The search order is depth-first and alphabetic; for a partial path
  29. // "foo", a package "a/foo" is found before "b/foo".
  30. //
  31. // Absolute and relative paths may be provided, which disable automatic
  32. // prefix generation:
  33. //
  34. // godex $GOROOT/pkg/darwin_amd64/sort
  35. // godex ./sort
  36. //
  37. // All but the last path element may contain dots; a dot in the last path
  38. // element separates the package path from the package object name. If the
  39. // last path element contains a dot, terminate the argument with another
  40. // dot (indicating an empty object name). For instance, the path for a
  41. // package foo.bar would be specified as in:
  42. //
  43. // godex foo.bar.
  44. //
  45. // The flags are:
  46. //
  47. // -s=""
  48. // only consider packages from src, where src is one of the supported compilers
  49. // -v=false
  50. // verbose mode
  51. //
  52. // The following sources (-s arguments) are supported:
  53. //
  54. // gc
  55. // gc-generated object files
  56. // gccgo
  57. // gccgo-generated object files
  58. // gccgo-new
  59. // gccgo-generated object files using a condensed format (experimental)
  60. // source
  61. // (uncompiled) source code (not yet implemented)
  62. //
  63. // If no -s argument is provided, godex will try to find a matching source.
  64. //
  65. package main // import "golang.org/x/tools/cmd/godex"
  66. // BUG(gri): support for -s=source is not yet implemented
  67. // BUG(gri): gccgo-importing appears to have occasional problems stalling godex; try -s=gc as work-around