This repository has been archived by the owner on Nov 9, 2023. It is now read-only.
forked from jhump/protoreflect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (79 loc) · 2.47 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# TODO: run golint, errcheck
.PHONY: ci
# TODO: add staticcheck back ASAP; removed temporarily because it
# complains about a lot of APIs deprecated by protobuf 1.4
ci: deps checkgofmt vet predeclared ineffassign test test-nounsafe
.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:
@echo go vet ./... --ignore internal/testprotos
@go vet $$(go list ./... | grep -v 'internal/testprotos')
# goyacc generates assignments where LHS is never used, so we need to run
# staticheck in a way that ignores the errors in that generated code
.PHONY: staticcheck
staticcheck:
@go install honnef.co/go/tools/cmd/[email protected]
staticcheck ./...
# same remarks as for staticcheck: we ignore errors in generated proto.y.go
.PHONY: ineffassign
ineffassign:
@go install github.com/gordonklaus/[email protected]
@echo ineffassign . --ignore desc/protoparse/proto.y.go
@ineffassign -n $$(find . -type d | grep -v 'desc/protoparse')
@output="$$(ineffassign ./desc/protoparse | grep -v 'protoDollar' || true)" ; \
if [ -n "$$output" ]; then \
echo "$$output"; \
exit 1; \
fi
.PHONY: predeclared
predeclared:
@go install github.com/nishanths/[email protected]
predeclared ./...
# Intentionally omitted from CI, but target here for ad-hoc reports.
.PHONY: golint
golint:
@go install golang.org/x/lint/golint
golint -min_confidence 0.9 -set_exit_status ./...
# Intentionally omitted from CI, but target here for ad-hoc reports.
.PHONY: errcheck
errcheck:
@go install github.com/kisielk/errcheck
errcheck ./...
.PHONY: test
test:
go test -cover -race ./...
.PHONY: test-nounsafe
test-nounsafe:
go test -tags purego -cover -race ./...
.PHONY: generate
generate:
@go install golang.org/x/tools/cmd/[email protected]
go generate ./...
.PHONY: testcover
testcover:
@echo go test -race -covermode=atomic ./...
@echo "mode: atomic" > coverage.out
@for dir in $$(go list ./...); do \
go test -race -coverprofile profile.out -covermode=atomic $$dir ; \
if [ -f profile.out ]; then \
tail -n +2 profile.out >> coverage.out && rm profile.out ; \
fi \
done