Compiling Go Binaries

Go produces statically linked binaries, making deployment easy. You can compile using:

go build main.go
  • To cross-compile for other OS/architectures, use environment variables:
    GOOS=linux GOARCH=amd64 go build
  • Use go install to build and install binaries into your Go bin path.
← PrevNext →