go doc

The go subcommand that prints the documentation for a package, function or type from the toolchain you have installed.

In more detail

Documentation in Go is written as comments above each declaration, and go doc reads it back to you in the terminal. Because it reads your installed version, the answer always matches the code you are building against. The first lines show the package and the function signature.

Examples

go doc fmt.Println
go doc os.Getenv

Related terms

Taught in

References