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.
In more detail
Add that bin folder to your shell PATH once and every tool you install becomes available by name. Adding an @version suffix, such as @latest, makes go install download, build and install a published tool in one step. This is how many Go-based tools reach developers.
Example
go install golang.org/x/tools/cmd/stringer@latestRelated terms
- 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.
- go build — The go subcommand that compiles a package and its dependencies into an executable file and prints nothing when it succeeds.
- PATH — An environment variable holding a list of folders the shell searches, in order, to find the program for a command you type.
Taught in
- Your First Program and go run — Concurrent Systems Programming with Go