From cfbfbdbcc66fc4566eaf401043619d560686ccd0 Mon Sep 17 00:00:00 2001 From: Marcel Edmund Franke Date: Sun, 4 Feb 2018 13:08:25 +0100 Subject: [PATCH] Makefile: added init version of makefile --- Makefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d4b1203 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +.PHONY: all +all: build test + +ALL_PACKAGES=$(shell go list ./... | grep -v "vendor") + +setup: + go get -u github.com/golang/lint/golint + +build: fmt vet lint + +fmt: + go fmt $(ALL_PACKAGES) + +vet: + go vet $(ALL_PACKAGES) + +lint: + @for p in $(ALL_PACKAGES); do \ + echo "==> Linting $$p"; \ + golint -set_exit_status $$p; \ + done + +test: fmt vet build + ENVIRONMENT=test go test $(ALL_PACKAGES) + +test-cover-html: + @echo "mode: count" > coverage-all.out + + $(foreach pkg, $(ALL_PACKAGES),\ + ENVIRONMENT=test go test -coverprofile=coverage.out -covermode=count $(pkg);\ + tail -n +2 coverage.out >> coverage-all.out;) + go tool cover -html=coverage-all.out -o out/coverage.html \ No newline at end of file