Go
Environment Commands
Configure Go's build environment with GOPATH, GOROOT, GOPROXY, and other environment variables. Understand how Go resolves modules and where it stores downloaded packages.
6 commands
Pro Tips
Use 'go env GOPATH' to see where Go stores downloaded modules. Default: ~/go.
Set 'GOPROXY=https://proxy.golang.org,direct' for faster downloads and availability when repos go offline.
Use 'go env -w GOBIN=~/bin' to persist environment settings without modifying shell config.
Common Mistakes
GOPATH and module mode don't mix well. Use modules (go.mod) for all new projects — GOPATH mode is legacy.
Setting GONOSUMCHECK or GONOSUMDB disables integrity verification. Only use for private modules behind GOPRIVATE.