Skip to content

Instantly share code, notes, and snippets.

@oozzal
Created September 5, 2014 09:01
Show Gist options
  • Save oozzal/053b6ad9c0c8ea24ff6d to your computer and use it in GitHub Desktop.
Save oozzal/053b6ad9c0c8ea24ff6d to your computer and use it in GitHub Desktop.
Cross Compiling Go Scripts.
# install go
go get github.com/laher/goxc
# build cross-compilers
goxc -t
# create a project in $GO_PATH/src/<project-dir>
# inside project-dir
# build binaries for different platforms
goxc
# or for a specific platform (intel-based linux in this case)
GOOS=linux GOARCH=386 CGO_ENABLED=0 go build -o test.linux test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment