From 137f2df4bc383058d59cc0b283c41ef11a1eaebd Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Sun, 4 Feb 2018 22:05:29 +0100 Subject: add Makefile for running tests --- .gitignore | 3 +++ Makefile | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..60fe31d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# test artifacts +cover.out +cover.html diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..05fcf20 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +all: + @echo 'Available targets:' + @echo ' make test' + +test: static-tests cover.html + +static-tests: FORCE + @echo '>> gofmt...' + @if s="$$(gofmt -s -l $$(find -name \*.go) 2>/dev/null)" && test -n "$$s"; then echo "$$s"; false; fi + @echo '>> golint...' + @if s="$$(golint ./... 2>/dev/null)" && test -n "$$s"; then echo "$$s"; false; fi + @echo '>> govet...' + @go vet ./... + +cover.out: FORCE + @echo '>> go test...' + @go test -cover -coverprofile $@ +cover.html: cover.out + @echo '>> rendering cover.html...' + @go tool cover -html=$< -o $@ + +.PHONY: FORCE -- cgit v1.2.3