go env

The go subcommand that prints the settings the toolchain is using, such as GOPATH, GOOS and GOARCH.

In more detail

go env shows each Go environment variable and its current value, whether you set it or it is a default. It is the first thing to check when a build behaves differently on two machines. go env -w can save a setting for your user.

Example

go env GOPATH GOOS GOARCH

Related terms

Taught in

References