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@latest

Related terms

Taught in

References