-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (37 loc) · 1.15 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
44
45
46
.PHONY: all
all: lint cover
.PHONY: lint
lint: golint
.PHONY: golint
golint: $(GOLANGLINTCI)
# golint -set_exit_status ./...
golangci-lint run -v ./...
.PHONY: fmt
fmt: ## Run formatting code
@echo "Fix formatting"
@gofmt -w ${GO_FMT_FLAGS} $$(go list -f "{{ .Dir }}" ./...); if [ "$${errors}" != "" ]; then echo "$${errors}"; fi
.PHONY: test
test: ## Run unit tests
go test -v -tags ${APP_TAGS} -race ./...
.PHONY: tidy
tidy: ## Run go mod tidy
go mod tidy
.PHONY: cover
cover: ## Run coverage tests
@mkdir -p $(TMP_ETC)
@rm -f $(TMP_ETC)/coverage.txt $(TMP_ETC)/coverage.html
go test -race -coverprofile=$(TMP_ETC)/coverage.txt -coverpkg=./... ./...
@go tool cover -html=$(TMP_ETC)/coverage.txt -o $(TMP_ETC)/coverage.html
@echo
@go tool cover -func=$(TMP_ETC)/coverage.txt | grep total
@echo
@echo Open the coverage report:
@echo open $(TMP_ETC)/coverage.html
.PHONY: generate-code
generate-code: ## Run codegeneration procedure
@echo "Generate code"
@go generate ./...
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help