Created
October 4, 2014 03:18
-
-
Save caiguanhao/746baadbc26a57ea4b1d to your computer and use it in GitHub Desktop.
watch go (golang) file changes and restart it (esp. for server app)
This file contains hidden or 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
watchgo() { | |
eval "$@ &; lastpid=\$\!;"; \ | |
fswatch -0 *.go | while read -d ""; \ | |
do pkill -P $lastpid; \ | |
eval "$@ &; lastpid=\$\!;"; \ | |
done | |
} | |
# watchgo "go run *.go" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment