Last active
July 3, 2020 23:36
-
-
Save Brethel/084db0eb01dacacedff8c0ca9ab82c0b to your computer and use it in GitHub Desktop.
This file contains 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
PID = /tmp/awesome-golang-project.pid | |
GO_FILES = $(wildcard *.go) | |
APP = ./app | |
serve: restart | |
@fswatch -o . | xargs -n1 -I{} make restart || make kill | |
kill: | |
@kill `cat $(PID)` || true | |
before: | |
@echo "actually do nothing" | |
$(APP): $(GO_FILES) | |
@go build $? -o $@ | |
restart: kill before $(APP) | |
@app & echo $$! > $(PID) | |
.PHONY: 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
$ brew install fswatch # if you don't have
$ make serve