Created
October 13, 2017 16:58
-
-
Save vizee/74e9fbb3e0ec8b33d1bc3e5f85432640 to your computer and use it in GitHub Desktop.
linux go build
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
#!/bin/bash | |
set -e | |
hook= | |
if [ "$1" == "-c" ]; then | |
hook=$2 | |
shift 2 | |
fi | |
gobuild() | |
{ | |
GOOS=linux go build -i -v | |
if [ ! -z "$hook" ]; then | |
name=$(basename $(pwd)) | |
if [ -f $name ]; then | |
echo $hook $name | |
$hook $name | |
fi | |
fi | |
} | |
if [ $# -eq 0 ]; then | |
gobuild | |
else | |
while [ $# -gt 0 ]; do | |
pushd $1 > /dev/null | |
gobuild | |
popd > /dev/null | |
shift 1 | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment