-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (42 loc) · 1.03 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
47
48
49
50
51
52
.PHONY: dev test cover cover-html tidy fmt pre-commit
.DEFAULT: help
help:
@echo "make dev"
@echo " setup development environment"
@echo "make test"
@echo " run go test"
@echo "make cover"
@echo " run go test with -cover"
@echo "make cover-html"
@echo " run go test with -cover and show HTML"
@echo "make tidy"
@echo " run go mod tidy"
@echo "make fmt"
@echo " run gofumpt"
@echo "make pre-commit"
@echo " run pre-commit hooks"
check-gofumpt:
@echo
ifeq (, $(shell which gofumpt))
$(error "No gofumpt in $(PATH), gofumpt (https://pkg.go.dev/mvdan.cc/gofumpt) is required")
endif
check-pre-commit:
@echo
ifeq (, $(shell which pre-commit))
$(error "No pre-commit in $(PATH), pre-commit (https://pre-commit.com) is required")
endif
dev: check-pre-commit check-gofumpt
pre-commit install
test:
go test -v ./...
cover:
go test -cover -v ./...
cover-html:
go test -v -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
tidy:
go mod tidy
fmt: check-gofumpt
gofumpt -l -w .
pre-commit: check-pre-commit
pre-commit