Skip to content

Instantly share code, notes, and snippets.

@jmaitrehenry
Created October 2, 2017 20:08
Show Gist options
  • Save jmaitrehenry/5b66581295d2d4ca175e4f8f49b3dbaf to your computer and use it in GitHub Desktop.
Save jmaitrehenry/5b66581295d2d4ca175e4f8f49b3dbaf to your computer and use it in GitHub Desktop.
PID = ./app.pid
GO_FILES = $(wildcard *.go)
serve: start
@fswatch -x -o --event Created --event Updated --event Renamed -r -e '.*' -i '\.go$$' . | xargs -n1 -I{} make restart || make kill
kill:
@kill `cat $(PID)` || true
before:
@echo "actually do nothing"
build: $(GO_FILES)
@go build -o app
start:
@./app & echo $$! > $(PID)
restart: kill before build start
.PHONY: start serve restart kill before # let's go to reserve rules names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment