-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
37 lines (25 loc) · 1.19 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
default: precommit
precommit: ensure format generate test check addlicense
@echo "ready to commit"
ensure:
go mod verify
go mod vendor
format:
find . -type f -name '*.go' -not -path './vendor/*' -exec gofmt -w "{}" +
find . -type f -name '*.go' -not -path './vendor/*' -exec go run -mod=vendor github.com/incu6us/goimports-reviser -project-name github.com/bborbe/git-sync -file-path "{}" \;
generate:
rm -rf mocks avro
go generate -mod=vendor ./...
test:
go test -mod=vendor -p=1 -cover -race $(shell go list -mod=vendor ./... | grep -v /vendor/)
check: lint vet errcheck vulncheck
lint:
go run -mod=vendor golang.org/x/lint/golint -min_confidence 1 $(shell go list -mod=vendor ./... | grep -v /vendor/)
vet:
go vet -mod=vendor $(shell go list -mod=vendor ./... | grep -v /vendor/)
errcheck:
go run -mod=vendor github.com/kisielk/errcheck -ignore '(Close|Write|Fprint)' $(shell go list -mod=vendor ./... | grep -v /vendor/)
addlicense:
go run -mod=vendor github.com/google/addlicense -c "Benjamin Borbe" -y $$(date +'%Y') -l bsd $$(find . -name "*.go" -not -path './vendor/*')
vulncheck:
go run -mod=vendor golang.org/x/vuln/cmd/govulncheck $(shell go list -mod=vendor ./... | grep -v /vendor/)