-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (53 loc) · 1.48 KB
/
Copy pathMakefile
File metadata and controls
66 lines (53 loc) · 1.48 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
56
57
58
59
60
61
62
63
64
65
66
.PHONY: dev audit cover cover-html fmt lint pre-commit test tidy update-deps
.DEFAULT: help
help:
@echo "make dev"
@echo " setup development environment"
@echo "make audit"
@echo " conduct quality checks"
@echo "make cover"
@echo " generate coverage report"
@echo "make cover-html"
@echo " generate coverage HTML report"
@echo "make fmt"
@echo " fix code format issues"
@echo "make lint"
@echo " run lint checks"
@echo "make pre-commit"
@echo " run pre-commit hooks"
@echo "make test"
@echo " execute all tests"
@echo "make tidy"
@echo " clean and tidy dependencies"
@echo "make update-deps"
@echo " update dependencies"
GOTESTSUM := go run gotest.tools/gotestsum@latest -f testname -- ./... -race -count=1
TESTFLAGS := -shuffle=on
COVERFLAGS := -covermode=atomic
GOLANGCI_LINT := go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2
check-pre-commit:
ifeq (, $(shell which pre-commit))
$(error "pre-commit not in $(PATH), pre-commit (https://pre-commit.com) is required")
endif
dev: check-pre-commit
pre-commit install
audit:
go mod verify
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
cover:
$(GOTESTSUM) $(TESTFLAGS) $(COVERFLAGS)
cover-html:
$(GOTESTSUM) $(TESTFLAGS) $(COVERFLAGS) -coverprofile=coverage.out
go tool cover -html=coverage.out
fmt:
$(GOLANGCI_LINT) fmt
lint:
$(GOLANGCI_LINT) run
pre-commit: check-pre-commit
pre-commit run --all-files
test:
$(GOTESTSUM) $(TESTFLAGS)
tidy:
go mod tidy -v
update-deps: tidy
go get -u ./...