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