-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (42 loc) · 1.08 KB
/
Copy pathMakefile
File metadata and controls
55 lines (42 loc) · 1.08 KB
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
47
48
49
50
51
52
53
54
55
GO ?= go
.DEFAULT_GOAL := check
.PHONY: generate
generate:
go generate ./...
.PHONY: govulncheck
govulncheck:
go tool govulncheck ./...
.PHONY: tidy go-mod-tidy
tidy: go-mod-tidy
go-mod-tidy:
$(GO) mod tidy
.PHONY: golangci-lint golangci-lint-fix
golangci-lint-fix: ARGS=--fix
golangci-lint-fix: golangci-lint
golangci-lint:
go tool golangci-lint run $(ARGS)
.PHONY: junit
junit: | $(JUNIT)
mkdir -p ./test-results && $(GO) test -v 2>&1 ./... | go tool go-junit-report -set-exit-code > ./test-results/report.xml
.PHONY: coverage
coverage:
$(GO) test -v -coverprofile=coverage.out ./...
.PHONY: coverage-html
coverage-html: coverage
$(GO) tool cover -html=coverage.out -o coverage.html
.PHONY: coverage-func
coverage-func: coverage
$(GO) tool cover -func=coverage.out
.PHONY: lint
lint: go-mod-tidy golangci-lint
.PHONY: test test-race
test-race: ARGS=-race
test-race: test
test:
$(GO) test $(ARGS) ./...
.PHONY: check
check: generate go-mod-tidy golangci-lint test-race
.PHONY: git-hooks
git-hooks:
@echo '#!/bin/sh\nmake' > .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit