Skip to content

Instantly share code, notes, and snippets.

@shanemhansen
Created August 19, 2016 16:03
Show Gist options
  • Save shanemhansen/128f5a3ea3acd5cf18c7a8a14261ed68 to your computer and use it in GitHub Desktop.
Save shanemhansen/128f5a3ea3acd5cf18c7a8a14261ed68 to your computer and use it in GitHub Desktop.
#!/bin/bash
PKG="$1"
BIN="$2"
shift;shift
go install "$BIN"
$GOPATH/bin/$(basename $BIN) $@ &
while true; do
inotifywait -r -e modify -e move -e create "$PKG"
if go install -x -n "$BIN" && make build; then
kill %1
wait
echo "reloading"
$GOPATH/bin/$(basename $BIN) $@ &
else
echo "INFO: project not rebuildable"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment