-
Notifications
You must be signed in to change notification settings - Fork 175
/
Makefile
67 lines (55 loc) · 1.52 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.PHONY: ci
ci: deps checkgofmt checkgenerate errcheck golint vet staticcheck ineffassign test
.PHONY: deps
deps:
go get -d -v -t ./...
.PHONY: updatedeps
updatedeps:
go get -d -v -t -u -f ./...
.PHONY: install
install:
go install ./...
.PHONY: checkgofmt
checkgofmt:
@echo gofmt -s -l .
@output="$$(gofmt -s -l .)" ; \
if [ -n "$$output" ]; then \
echo "$$output"; \
echo "Run gofmt on the above files!"; \
exit 1; \
fi
# workaround https://github.com/golang/protobuf/issues/214 until in master
.PHONY: vet
vet:
go vet ./...
.PHONY: staticcheck
staticcheck:
@go install honnef.co/go/tools/cmd/[email protected]
staticcheck ./...
.PHONY: ineffassign
ineffassign:
@go install github.com/gordonklaus/[email protected]
ineffassign .
# Intentionally omitted from CI, but target here for ad-hoc reports.
.PHONY: golint
golint:
@go install golang.org/x/lint/[email protected]
golint -min_confidence 0.9 -set_exit_status ./...
.PHONY: errcheck
errcheck:
@go install github.com/kisielk/[email protected]
errcheck ./...
.PHONY: test
test: generate
go test -cover -race ./...
./protoprint/testfiles/check-protos.sh > /dev/null
.PHONY: generate
generate:
@go install golang.org/x/tools/cmd/[email protected]
go generate ./...
go generate ./internal/testprotos
goimports -w -local github.com/jhump/protoreflect/v2 .
.PHONY: checkgenerate
checkgenerate: generate
# Make sure generate target doesn't produce a diff
test -z "$$(git status --porcelain | tee /dev/stderr)"