Skip to content

Instantly share code, notes, and snippets.

@rms1000watt
Last active June 20, 2019 19:38
Show Gist options
  • Save rms1000watt/2a2857c8ad0a3941f2e03e4cfc2c0c5c to your computer and use it in GitHub Desktop.
Save rms1000watt/2a2857c8ad0a3941f2e03e4cfc2c0c5c to your computer and use it in GitHub Desktop.
Build go versions of your golang app
#!/usr/bin/env bash
set -e
rm -rf bin ||:
mkdir bin ||:
PROJECT=$(basename $(git rev-parse --show-toplevel))
VERSION=$(cat version.txt)
export CGO_ENABLED=0
for arch in amd64 386; do
export GOARCH=$arch
for os in darwin linux windows; do
export GOOS=$os
go build -o "bin/${PROJECT}-${VERSION}-${GOOS}-${GOARCH}"
echo "bin/${PROJECT}-${VERSION}-${GOOS}-${GOARCH}"
shasum -a 256 < "bin/${PROJECT}-${VERSION}-${GOOS}-${GOARCH}" | cut -d ' ' -f1
echo
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment