github.com/bakjos/protoreflect@v1.9.2/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 predeclared ineffassign test
     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  	@GO111MODULE=on go install honnef.co/go/tools/cmd/staticcheck
    40  	staticcheck ./...
    41  
    42  # same remarks as for staticcheck: we ignore errors in generated proto.y.go
    43  .PHONY: ineffassign
    44  ineffassign:
    45  	@GO111MODULE=on go install github.com/gordonklaus/ineffassign
    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  .PHONY: predeclared
    55  predeclared:
    56  	@GO111MODULE=on go install github.com/nishanths/predeclared
    57  	predeclared ./...
    58  
    59  # Intentionally omitted from CI, but target here for ad-hoc reports.
    60  .PHONY: golint
    61  golint:
    62  	@GO111MODULE=on go install golang.org/x/lint/golint
    63  	golint -min_confidence 0.9 -set_exit_status ./...
    64  
    65  # Intentionally omitted from CI, but target here for ad-hoc reports.
    66  .PHONY: errcheck
    67  errcheck:
    68  	@GO111MODULE=on go install github.com/kisielk/errcheck
    69  	errcheck ./...
    70  
    71  .PHONY: test
    72  test:
    73  	go test -cover -race ./...
    74  
    75  .PHONY: generate
    76  generate:
    77  	@GO111MODULE=on go install golang.org/x/tools/cmd/goyacc
    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