2017-03-24 22:08:19 +02:00
|
|
|
SOURCE_FILES?=$$(go list ./... | grep -v /vendor/)
|
2017-01-02 12:23:28 +02:00
|
|
|
TEST_PATTERN?=.
|
|
|
|
TEST_OPTIONS?=
|
|
|
|
|
|
|
|
setup: ## Install all the build and lint dependencies
|
2017-01-15 13:11:37 +02:00
|
|
|
go get -u github.com/alecthomas/gometalinter
|
2017-03-09 19:20:59 +02:00
|
|
|
go get -u github.com/golang/dep/...
|
2017-02-07 21:00:46 +02:00
|
|
|
go get -u github.com/pierrre/gotestcover
|
|
|
|
go get -u golang.org/x/tools/cmd/cover
|
2017-03-26 02:00:03 +02:00
|
|
|
dep ensure
|
2017-01-15 13:11:37 +02:00
|
|
|
gometalinter --install
|
2017-01-02 12:23:28 +02:00
|
|
|
|
|
|
|
test: ## Run all the tests
|
2017-05-11 05:05:51 +02:00
|
|
|
gotestcover $(TEST_OPTIONS) -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m
|
2017-01-15 13:11:37 +02:00
|
|
|
|
2017-04-21 17:07:08 +02:00
|
|
|
cover: test ## Run all the tests and opens the coverage report
|
2017-04-22 02:22:11 +02:00
|
|
|
go tool cover -html=coverage.txt
|
2017-04-14 20:39:32 +02:00
|
|
|
|
2017-01-15 13:11:37 +02:00
|
|
|
fmt: ## gofmt and goimports all go files
|
2017-01-30 18:24:32 +02:00
|
|
|
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
|
2017-01-02 12:23:28 +02:00
|
|
|
|
|
|
|
lint: ## Run all the linters
|
2017-01-15 13:11:37 +02:00
|
|
|
gometalinter --vendor --disable-all \
|
2017-01-02 17:57:36 +02:00
|
|
|
--enable=deadcode \
|
|
|
|
--enable=ineffassign \
|
|
|
|
--enable=gosimple \
|
|
|
|
--enable=staticcheck \
|
|
|
|
--enable=gofmt \
|
|
|
|
--enable=goimports \
|
|
|
|
--enable=dupl \
|
|
|
|
--enable=misspell \
|
|
|
|
--enable=errcheck \
|
2017-01-02 18:09:38 +02:00
|
|
|
--enable=vet \
|
|
|
|
--enable=vetshadow \
|
2017-03-23 01:04:58 +02:00
|
|
|
--deadline=10m \
|
2017-01-02 17:57:36 +02:00
|
|
|
./...
|
2017-01-02 12:23:28 +02:00
|
|
|
|
|
|
|
ci: lint test ## Run all the tests and code checks
|
|
|
|
|
2017-04-23 13:22:12 +02:00
|
|
|
build: ## Build a beta version of goreleaser
|
|
|
|
go build
|
2017-01-02 12:23:28 +02:00
|
|
|
|
|
|
|
# Absolutely awesome: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
|
|
|
help:
|
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
|
|
|
2017-01-02 17:57:36 +02:00
|
|
|
.DEFAULT_GOAL := build
|