Created
August 22, 2017 09:21
-
-
Save antfroger/6f117db70c0b3d511501dfbb0dfab858 to your computer and use it in GitHub Desktop.
Go makefile
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
IGNORED_PACKAGES := /vendor/ | |
PACKAGES := $(shell ( go list ./... | grep -v -e "^$$" $(addprefix -e ,$(IGNORED_PACKAGES)) )) | |
DIRS := $(shell ( go list -f '{{.Dir}}' ./... | grep -v -e "^$$" $(addprefix -e ,$(IGNORED_PACKAGES)) )) | |
.PHONY: test | |
test: | |
go test $(PACKAGES) | |
.PHONY: fmt | |
# Run gofmt on all source files | |
fmt: ; $(info $(M) running gofmt…) @ | |
@ret=0 && for d in $(DIRS); do \ | |
gofmt -l -w $$d/*.go || ret=$$? ; \ | |
done ; exit $$ret | |
.PHONY: vet | |
# Run govet on all source files | |
vet: ; $(info $(M) running govet…) @ | |
@ret=0 && for d in $(DIRS); do \ | |
go tool vet $$d/*.go || ret=$$? ; \ | |
done ; exit $$ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment