github.com/jhump/protoreflect@v1.16.0/Makefile (about) 1 # TODO: run golint, errcheck 2 .PHONY: ci 3 # TODO: add staticcheck back ASAP; removed temporarily because it 4 # complains about a lot of APIs deprecated by protobuf 1.4 5 ci: deps checkgofmt vet ineffassign test test-nounsafe 6 7 .PHONY: deps 8 deps: 9 go get -d -v -t ./... 10 11 .PHONY: updatedeps 12 updatedeps: 13 go get -d -v -t -u -f ./... 14 15 .PHONY: install 16 install: 17 go install ./... 18 19 .PHONY: checkgofmt 20 checkgofmt: 21 @echo gofmt -s -l . 22 @output="$$(gofmt -s -l .)" ; \ 23 if [ -n "$$output" ]; then \ 24 echo "$$output"; \ 25 echo "Run gofmt on the above files!"; \ 26 exit 1; \ 27 fi 28 29 # workaround https://github.com/golang/protobuf/issues/214 until in master 30 .PHONY: vet 31 vet: 32 @echo go vet ./... --ignore internal/testprotos 33 @go vet $$(go list ./... | grep -v 'internal/testprotos') 34 35 # goyacc generates assignments where LHS is never used, so we need to run 36 # staticheck in a way that ignores the errors in that generated code 37 .PHONY: staticcheck 38 staticcheck: 39 @go install honnef.co/go/tools/cmd/staticcheck@v0.0.1-2020.1.4 40 staticcheck ./... 41 42 # same remarks as for staticcheck: we ignore errors in generated proto.y.go 43 .PHONY: ineffassign 44 ineffassign: 45 @go install github.com/gordonklaus/ineffassign@v0.0.0-20200309095847-7953dde2c7bf 46 @echo ineffassign . --ignore desc/protoparse/proto.y.go 47 @ineffassign -n $$(find . -type d | grep -v 'desc/protoparse') 48 @output="$$(ineffassign ./desc/protoparse | grep -v 'protoDollar' || true)" ; \ 49 if [ -n "$$output" ]; then \ 50 echo "$$output"; \ 51 exit 1; \ 52 fi 53 54 # Intentionally omitted from CI, but target here for ad-hoc reports. 55 .PHONY: golint 56 golint: 57 @go install golang.org/x/lint/golint 58 golint -min_confidence 0.9 -set_exit_status ./... 59 60 # Intentionally omitted from CI, but target here for ad-hoc reports. 61 .PHONY: errcheck 62 errcheck: 63 @go install github.com/kisielk/errcheck 64 errcheck ./... 65 66 .PHONY: test 67 test: generate 68 go test -cover -race ./... 69 ./desc/protoprint/testfiles/check-protos.sh > /dev/null 70 71 .PHONY: test-nounsafe 72 test-nounsafe: 73 go test -tags purego -cover -race ./... 74 75 .PHONY: generate 76 generate: 77 @go install golang.org/x/tools/cmd/goyacc@v0.0.0-20200717024301-6ddee64345a6 78 go generate ./... 79 80 .PHONY: testcover 81 testcover: 82 @echo go test -race -covermode=atomic ./... 83 @echo "mode: atomic" > coverage.out 84 @for dir in $$(go list ./...); do \ 85 go test -race -coverprofile profile.out -covermode=atomic $$dir ; \ 86 if [ -f profile.out ]; then \ 87 tail -n +2 profile.out >> coverage.out && rm profile.out ; \ 88 fi \ 89 done 90