Skip to content

Instantly share code, notes, and snippets.

@shutej
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shutej/ff2610b1b692c7726f7c to your computer and use it in GitHub Desktop.
Save shutej/ff2610b1b692c7726f7c to your computer and use it in GitHub Desktop.
Cross-compiling Go on Drone.io
sudo chown $USER /usr/local/go
rm -rf /usr/local/go/*
curl -L https://storage.googleapis.com/golang/go1.3.3.linux-amd64.tar.gz | tar -C /usr/local -xzf -
# Install dependencies...
go get github.com/tools/godep
godep restore
# Compile normally; this catches errors before cross-compiling.
go install ./...
# Cross-compile.
go get github.com/mitchellh/gox
gox --osarch="$GOX_OSARCH" --build-toolchain
gox --osarch="$GOX_OSARCH" --output="dist/{{.OS}}_{{.Arch}}/{{.Dir}}" ./...
GOPATH=$HOME
PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
GOX_OSARCH="darwin/amd64 linux/amd64 windows/amd64 linux/arm"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment