Last active
August 29, 2015 14:10
-
-
Save shutej/ff2610b1b692c7726f7c to your computer and use it in GitHub Desktop.
Cross-compiling Go on Drone.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dist/*/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}}" ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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