blob: 3c2112ebf7334199ddba9562df50152048a65b18 [file] [log] [blame]
Robert Griesemer4a27ee32014-03-25 15:26:38 -07001// 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
5// The godex command prints (dumps) exported information of packages
6// or selected package objects.
7//
8// In contrast to godoc, godex extracts this information from compiled
9// object files. Hence the exported data is truly what a compiler will
10// see, at the cost of missing commentary.
11//
Robert Griesemer8b161c32014-03-26 14:47:52 -070012// Usage: godex [flags] {path[.name]}
Robert Griesemer4a27ee32014-03-25 15:26:38 -070013//
Robert Griesemer8b161c32014-03-26 14:47:52 -070014// Each argument must be a (possibly partial) package path, optionally
15// followed by a dot and the name of a package object:
16//
17// godex math
18// godex math.Sin
19// godex math.Sin fmt.Printf
Robert Griesemerfa0f6bd2014-04-07 13:49:05 -070020// godex go/types
Robert Griesemer8b161c32014-03-26 14:47:52 -070021//
Robert Griesemerfa0f6bd2014-04-07 13:49:05 -070022// godex automatically tries all possible package path prefixes if only a
23// partial package path is given. For instance, for the path "go/types",
Andrew Gerrand5ebbcd12014-11-10 08:50:40 +110024// godex prepends "golang.org/x/tools".
Robert Griesemer8b161c32014-03-26 14:47:52 -070025//
26// The prefixes are computed by searching the directories specified by
Robert Griesemerfa0f6bd2014-04-07 13:49:05 -070027// the GOROOT and GOPATH environment variables (and by excluding the
28// build OS- and architecture-specific directory names from the path).
29// The search order is depth-first and alphabetic; for a partial path
30// "foo", a package "a/foo" is found before "b/foo".
31//
32// Absolute and relative paths may be provided, which disable automatic
33// prefix generation:
34//
35// godex $GOROOT/pkg/darwin_amd64/sort
36// godex ./sort
37//
38// All but the last path element may contain dots; a dot in the last path
39// element separates the package path from the package object name. If the
40// last path element contains a dot, terminate the argument with another
41// dot (indicating an empty object name). For instance, the path for a
42// package foo.bar would be specified as in:
43//
44// godex foo.bar.
Robert Griesemer4a27ee32014-03-25 15:26:38 -070045//
46// The flags are:
47//
Robert Griesemer8b161c32014-03-26 14:47:52 -070048// -s=""
Robert Griesemer4a27ee32014-03-25 15:26:38 -070049// only consider packages from src, where src is one of the supported compilers
Robert Griesemer8b161c32014-03-26 14:47:52 -070050// -v=false
Robert Griesemer4a27ee32014-03-25 15:26:38 -070051// verbose mode
52//
Robert Griesemer8b161c32014-03-26 14:47:52 -070053// The following sources (-s arguments) are supported:
Robert Griesemer4a27ee32014-03-25 15:26:38 -070054//
55// gc
56// gc-generated object files
57// gccgo
58// gccgo-generated object files
59// gccgo-new
60// gccgo-generated object files using a condensed format (experimental)
61// source
62// (uncompiled) source code (not yet implemented)
63//
64// If no -s argument is provided, godex will try to find a matching source.
David Symonds24257c82014-12-09 15:00:58 +110065package main // import "golang.org/x/tools/cmd/godex"
Robert Griesemer8b161c32014-03-26 14:47:52 -070066
Robert Griesemerfa0f6bd2014-04-07 13:49:05 -070067// BUG(gri): support for -s=source is not yet implemented
68// BUG(gri): gccgo-importing appears to have occasional problems stalling godex; try -s=gc as work-around