Skip to content

Instantly share code, notes, and snippets.

@lintianzhi
Created September 11, 2013 05:16
Show Gist options
  • Save lintianzhi/6519591 to your computer and use it in GitHub Desktop.
Save lintianzhi/6519591 to your computer and use it in GitHub Desktop.
go build different os arch
#!/bin/bash
if [ $# -lt 1 ]; then
echo xxx
exit 0
fi
GOOS=windows
GOARCH=386
go build
mv $1.exe $1_win_32.exe
GOOS=windows
GOARCH=amd64
go build
mv $1.exe $1_win_64.exe
GOOS=linux
GOARCH=amd64
go build
mv $1 $1_linux_32
GOOS=linux
GOARCH=amd64
go build
mv $1 $1_linux_64
GOOS=darwin
GOARCH=386
go build
mv $1 $1_darwin_32
GOOS=darwin
GOARCH=amd64
go build
mv $1 $1_darwin_64
tar cf $1.tar $1_*_*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment