Skip to content

Instantly share code, notes, and snippets.

@brianknapp
Created September 15, 2013 14:31
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 brianknapp/6571242 to your computer and use it in GitHub Desktop.
Save brianknapp/6571242 to your computer and use it in GitHub Desktop.
Go project autoreload on OS X. Replace 'your_go_app' with whatever your app name is You run develop.sh to have it watch the project folder and run rebuild when files change.
#!/bin/bash
fswatch ./ ./rebuild.sh
#!/bin/bash
killall your_go_app
tput setaf 1 # set color red
go install
if [[ $? != 0 ]]; then
echo 'COMPILE ERROR'
else
tput setaf 2 # set color green
echo 'reloading'
gofmt -w *.go
PORT=5000 your_go_app &
fi
tput sgr0 # reset colors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment