GOPATH
The Go setting that names a folder, by default go in your home folder, where downloaded modules are cached and installed tools are placed.
In more detail
go install writes binaries to the bin folder under GOPATH (or to GOBIN if set). Add that folder to your PATH once so installed tools run by name. With modules you no longer have to keep your own code inside GOPATH.
Example
export PATH="$PATH:$(go env GOPATH)/bin"Related terms
- go install — The go subcommand that compiles a program and places the binary in the bin folder under your Go path, so it works as a command anywhere.
- go env — The go subcommand that prints the settings the toolchain is using, such as GOPATH, GOOS and GOARCH.
- PATH — An environment variable holding a list of folders the shell searches, in order, to find the program for a command you type.
- environment variable — A named setting such as PORT=8000 that a program reads from its surroundings when it starts.
Taught in
- Your First Program and go run — Concurrent Systems Programming with Go