diff options
| author | Felix Hanley <felix@userspace.com.au> | 2019-05-02 05:30:21 +0000 |
|---|---|---|
| committer | Felix Hanley <felix@userspace.com.au> | 2019-05-02 05:30:21 +0000 |
| commit | 8ab19e560484637675425fc22d10307d7d9fca2b (patch) | |
| tree | 355191a78ae1bea068b9550e800d311a4bc0afff | |
| parent | d24043bcc553c8646af40d28cc8b5b9ba9a38f57 (diff) | |
| download | logger-8ab19e560484637675425fc22d10307d7d9fca2b.tar.gz logger-8ab19e560484637675425fc22d10307d7d9fca2b.tar.bz2 | |
Add Makefile and ignores
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3ea99d6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +coverage* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e99cc0a --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ + +GOPATH?= $(HOME)/go + +.PHONY: test +test: lint ## Run tests and create coverage report + go test -short -coverprofile=coverage.txt -covermode=atomic ./... + go tool cover -html=coverage.txt -o coverage.html + +.PHONY: lint +lint: $(GOPATH)/bin/golint ## Run the code linter + @for file in $$(find . -name 'vendor' -prune -o -type f -name '*.go'); do \ + golint $$file; done + +$(GOPATH)/bin/golint: + go get -u golang.org/x/lint/golint + +.PHONY: clean +clean: ## Clean up temp files and binaries + @rm -rf coverage* + +.PHONY: help +help: + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) |sort \ + |awk 'BEGIN{FS=":.*?## "};{printf "\033[36m%-30s\033[0m %s\n",$$1,$$2}' |
