godef: github.com/rogpeppe/godef Files | Directories

Command godef

Godef prints the source location of definitions in Go programs.


godef [-t] [-a] [-A] [-o offset] [-i] [-f file][-acme] [expr]

File specifies the source file in which to evaluate expr. Expr must be an identifier or a Go expression terminated with a field selector.

If expr is not given, then offset specifies a location within file, which should be within, or adjacent to an identifier or field selector.

If the -t flag is given, the type of the expression will also be printed. The -a flag causes all the public members (fields and methods) of the expression, and their location, to be printed also; the -A flag prints private members too.

If the -i flag is specified, the source is read from standard input, although file must still be specified so that other files in the same source package may be found.

If the -acme flag is given, the offset, file name and contents are read from the current acme window.


$ cd $GOROOT
$ godef -f src/pkg/xml/read.go 'NewParser().Skip'

Package Files

acme.go adapt.go doc.go godef.go packages.go


go/astPackage ast declares the types used to represent syntax trees for Go packages.
go/parserA parser for Go source files.
go/printerPackage printer implements printing of AST nodes.
go/scannerPackage scanner implements a scanner for Go source text.
go/symThe sym package provides a way to iterate over and change the symbols in Go source files.
go/tokenThis package defines constants representing the lexical tokens of the Go programming language and basic operations on tokens (printing, predicates).
go/typesTypes infers source locations and types from Go expressions.

Package main imports 34 packages (graph). Updated 2019-07-19. Refresh now. Tools for package owners.