Command Documentation

There is a suite of programs to build and process Go source code. Instead of being run directly, programs in the suite are usually invoked by the go program.

The most common way to run these programs is as a subcommand of the go program, for instance as go fmt. Run like this, the command operates on complete packages of Go source code, with the go program invoking the underlying binary with arguments appropriate to package-level processing.

The programs can also be run as stand-alone binaries, with unmodified arguments, using the go tool subcommand, such as go tool cgo. For most commands this is mainly useful for debugging. Some of the commands, such as pprof, are accessible only through the go tool subcommand.

The Go installation process also installs an executable called gofmt, equivalent to go fmt, because it is so often referenced.

Click on the links for more documentation, invocation methods, and usage details.

Name      Synopsis
go      The go program manages Go source code and runs the other commands listed here. See the command docs for usage details.
cgo      Cgo enables the creation of Go packages that call C code.
cover      Cover is a program for creating and analyzing the coverage profiles generated by "go test -coverprofile".
fix      Fix finds Go programs that use old features of the language and libraries and rewrites them to use newer ones.
fmt      Fmt formats Go packages, it is also available as an independent gofmt command with more general options.
doc      Doc extracts and generates documentation for Go packages.
vet      Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.

This is an abridged list. See the full command reference for documentation of the compilers and more.