Go Environment Variables

From NovaOrdis Knowledge Base
Revision as of 20:41, 7 September 2023 by Ovidiu (talk | contribs) (Created page with "=External= * https://pkg.go.dev/cmd/go#hdr-Environment_variables =Internal= * Go_Development_and_Execution_Environment#Environment_Variables|Go Development and Execution Env...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

External

Internal

GOPATH

The GOPATH environment variable defines the workspace directory. Go tools assume that your code is under the path designated by GOPATH. Used to search for packages during compilation, when packages are being imported.

To display the value, as seen by the Go runtime, execute:

go env GOPATH

For documentation on GOPATH, execute:

go help gopath

GOROOT

Used to search for packages during compilation, when packages are being imported. To display the value, as seen by the Go runtime, execute:

go env GOROOT

GO111MODULE

https://go.dev/ref/mod#mod-commands

Controls whether the go tool runs in module-aware mode or GOPATH mode. May be "off", "on" or "auto".