Skip to content

Instantly share code, notes, and snippets.

@nimezhu
Created November 15, 2016 15:46
Show Gist options
  • Save nimezhu/ef6781af51be79ff88112f766181ff32 to your computer and use it in GitHub Desktop.
Save nimezhu/ef6781af51be79ff88112f766181ff32 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
if [ "$#" -eq 1 ]; then
fn=$1
else
fn="${PWD##*/}"
fi
if [ ! -d dist ] ; then
mkdir dist
fi
if [ ! -d dist/linux ] ; then
mkdir dist/linux
fi
env GOARCH=amd64 GOOS=linux go build -o dist/linux/$fn
if [ ! -d dist/win64 ] ; then
mkdir dist/win64
fi
env GOARCH=amd64 GOOS=windows go build -o dist/win64/$fn.exe
if [ ! -d dist/win32 ] ; then
mkdir dist/win32
fi
env GOARCH=386 GOOS=windows go build -o dist/win32/$fn.exe
if [ ! -d dist/mac ] ; then
mkdir dist/mac
fi
env GOARCH=amd64 GOOS=darwin go build -o dist/mac/$fn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment