GOPATH, GOROOT, GOBIN
suggest changeGOPATH
Modules allow source code to live outside GOPATH. When unset, GOPATH defaults to $HOME/go on Unix-like systems and %USERPROFILE%\go on Windows.
Current Go commands primarily use it for:
pkg/mod, the downloaded module cachebin, the default destination for installed commands whenGOBINis unset
Inspect the effective value with go env GOPATH. Most projects should not set it explicitly.
GOBIN
GOBIN optionally selects the directory where go install writes executable commands. When it is unset, Go uses the bin directory under the first GOPATH entry. Add that directory to the operating system's PATH if you want to invoke installed commands by name.
GOROOT
GOROOT is the Go toolchain installation directory and contains the standard library source and toolchain files. The Go distribution normally determines it automatically; users rarely need to set it.
See go env for the full environment.