Skip to content

Instantly share code, notes, and snippets.

@shutej

shutej/artifacts.sh

Last active Aug 29, 2015
Embed
What would you like to do?
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