var unexported … var matchCase … var chdir … var showAll … var showCmd … var showSrc … var short … // usage is a replacement usage function for the flags package. func usage() { … } func main() { … } // do is the workhorse, broken out of main to make testing easier. func do(writer io.Writer, flagSet *flag.FlagSet, args []string) (err error) { … } // failMessage creates a nicely formatted error message when there is no result to show. func failMessage(paths []string, symbol, method string) error { … } // parseArgs analyzes the arguments (if any) and returns the package // it represents, the part of the argument the user used to identify // the path (or "" if it's the current package) and the symbol // (possibly with a .method) within that package. // parseSymbol is used to analyze the symbol itself. // The boolean final argument reports whether it is possible that // there may be more directories worth looking at. It will only // be true if the package path is a partial match for some directory // and there may be more matches. For example, if the argument // is rand.Float64, we must scan both crypto/rand and math/rand // to find the symbol, and the first call will return crypto/rand, true. func parseArgs(args []string) (pkg *build.Package, path, symbol string, more bool) { … } var dotPaths … // isDotSlash reports whether the path begins with a reference // to the local . or .. directory. func isDotSlash(arg string) bool { … } // importDir is just an error-catching wrapper for build.ImportDir. func importDir(dir string) *build.Package { … } // parseSymbol breaks str apart into a symbol and method. // Both may be missing or the method may be missing. // If present, each must be a valid Go identifier. func parseSymbol(str string) (symbol, method string) { … } // isExported reports whether the name is an exported identifier. // If the unexported flag (-u) is true, isExported returns true because // it means that we treat the name as if it is exported. func isExported(name string) bool { … } // findNextPackage returns the next full file name path that matches the // (perhaps partial) package path pkg. The boolean reports if any match was found. func findNextPackage(pkg string) (string, bool) { … } var buildCtx … // splitGopath splits $GOPATH into a list of roots. func splitGopath() []string { … }