Set GOOS and GOARCH environment variables to appropriate values, during the build.
GOOS
GOARCH
To build on Mac for Linux:
export GOOS=linux export GOARCH=amd64