-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile
43 lines (32 loc) · 1.2 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
LIST_ALL := $(shell go list ./... | grep -v /vendor/)
# Force using Go Modules and always read the dependencies from
# the `vendor` folder.
export GO111MODULE = on
#export GOFLAGS = -mod=vendor
all: lint test
.PHONY: install
install: ## Install the dependencies
@go mod vendor
.PHONY: update
update: ## Update the dependencies
@go mod tidy
.PHONY: clean
clean: ## Remove binaries and ZIP files based on directory `./cmd/`
@rm -rf "$(go env GOCACHE)"
@rm -f coverage.out
.PHONY: lint
lint: ## Lint all files (via golangci-lint)
@go fmt ${LIST_ALL}
@golangci-lint run
.PHONY: test
test: clean ## Run unit tests (incl. race and coverprofile)
@go test -race -cover -short -timeout=90s -coverprofile=coverage.out ${LIST_ALL}
.PHONY: coverage
coverage: test ## Generate coverage report
@go tool cover -func coverage.out
.PHONY: report
report: coverage ## Open the coverage report in browser
@go tool cover -html=coverage.out
# ----------------------------------------------------------------------------------------------------------------------
help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'