go build

The go subcommand that compiles a package and its dependencies into an executable file and prints nothing when it succeeds.

In more detail

With -o you choose the output file name, so go build -o probe . leaves a binary called probe in the current directory. Silence means success; any output is an error to read. The same compiler is used by go run and go install, and only where the result goes differs.

Examples

go build -o probe .
CGO_ENABLED=0 GOOS=linux go build -o healthcheck .

Related terms

Taught in

References