go-build
Compile Go sources. tldr-pages
On several platforms
Several platforms
Compile a 'package main' file (output will be the filename without extension)
go build path/to/main.goIdentifyCompile, specifying the output filename
go build -o path/to/binary path/to/source.goIdentifyCompile a package
go build -o path/to/binary path/to/packageIdentifyCompile a main package into an executable, enabling data race detection
go build -race -o path/to/executable path/to/main_packageIdentify