Skip to content

Instantly share code, notes, and snippets.

@olebedev
Last active June 8, 2023 07:46
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save olebedev/6d94df9d5d13ca23faea to your computer and use it in GitHub Desktop.
PID = /tmp/awesome-golang-project.pid
GO_FILES = $(wildcard *.go)
serve:
@make restart
@fswatch -o . | xargs -n1 -I{} make restart || make kill
kill:
@kill `cat $(PID)` || true
stuff:
@echo "actually do nothing"
restart:
@make kill
@make stuff
@go run $(GO_FILES) & echo $$! > $(PID)
.PHONY: serve restart kill stuff # 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