Skip to content

Instantly share code, notes, and snippets.

@vizee
Created October 13, 2017 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vizee/74e9fbb3e0ec8b33d1bc3e5f85432640 to your computer and use it in GitHub Desktop.
Save vizee/74e9fbb3e0ec8b33d1bc3e5f85432640 to your computer and use it in GitHub Desktop.
linux go build
#!/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