-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
28 lines (22 loc) · 806 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
.DEFAULT_GOAL := help
GOLANGCI_LINT_VERSION ?= v1.19.1
TEST_FLAGS ?= -race
PKGS ?= $(shell go list ./... | grep -v /vendor/)
.PHONY: help
help:
@grep -E '^[a-zA-Z0-9-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "[32m%-10s[0m %s\n", $$1, $$2}'
.PHONY: test
test: ## run tests
go test $(TEST_FLAGS) $(PKGS)
.PHONY: vet
vet: ## run go vet
go vet $(PKGS)
.PHONY: coverage
coverage: ## generate code coverage
go test $(TEST_FLAGS) -covermode=atomic -coverprofile=coverage.txt $(PKGS)
go tool cover -func=coverage.txt
.PHONY: lint
lint: ## run golangci-lint
command -v golangci-lint > /dev/null 2>&1 || \
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin $(GOLANGCI_LINT_VERSION)
golangci-lint run