Skip to content

Instantly share code, notes, and snippets.

@pandemicsyn
Created November 4, 2013 19:30
Show Gist options
  • Select an option

  • Save pandemicsyn/7307914 to your computer and use it in GitHub Desktop.

Select an option

Save pandemicsyn/7307914 to your computer and use it in GitHub Desktop.
#!/bin/bash
TARGET="$GOPATH/src/github.com/pandemicsyn/$1/*"
INSTALL_ARG="github.com/pandemicsyn/$1"
md5sum_now=`md5 $TARGET`
md5sum_last=`md5 $TARGET`
echo "Attempting build/install of $TARGET"
go tool vet $TARGET
go install $INSTALL_ARG
echo "Monitoring $TARGET for changes.."
while :
do
md5sum_now=`md5 $TARGET`
if [ "$md5sum_last" != "$md5sum_now" ]; then
echo "Rebuilding [`date`]"
go tool vet $TARGET
go install $INSTALL_ARG
echo ""
md5sum_last=`md5 $TARGET`
if [ $? -eq 0 ]; then
sleep 3
else
sleep 2
fi
else
sleep 2
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment