1dev_build_version=$(shell git describe --tags --always --dirty) 2 3# TODO: run golint and errcheck, but only to catch *new* violations and 4# decide whether to change code or not (e.g. we need to be able to whitelist 5# violations already in the code). They can be useful to catch errors, but 6# they are just too noisy to be a requirement for a CI -- we don't even *want* 7# to fix some of the things they consider to be violations. 8.PHONY: ci 9ci: deps checkgofmt vet staticcheck ineffassign predeclared test 10 11.PHONY: deps 12deps: 13 go get -d -v -t ./... 14 15.PHONY: updatedeps 16updatedeps: 17 go get -d -v -t -u -f ./... 18 19.PHONY: install 20install: 21 go install -ldflags '-X "main.version=dev build $(dev_build_version)"' ./... 22 23.PHONY: release 24release: 25 @go install github.com/goreleaser/goreleaser@v0.134.0 26 goreleaser --rm-dist 27 28.PHONY: docker 29docker: 30 @echo $(dev_build_version) > VERSION 31 docker build -t fullstorydev/grpcurl:$(dev_build_version) . 32 @rm VERSION 33 34.PHONY: checkgofmt 35checkgofmt: 36 gofmt -s -l . 37 @if [ -n "$$(gofmt -s -l .)" ]; then \ 38 exit 1; \ 39 fi 40 41.PHONY: vet 42vet: 43 go vet ./... 44 45# This all works fine with Go modules, but without modules, 46# CI is just getting latest master for dependencies like grpc. 47.PHONY: staticcheck 48staticcheck: 49 @go install honnef.co/go/tools/cmd/staticcheck@v0.0.1-2020.1.4 50 staticcheck ./... 51 52.PHONY: ineffassign 53ineffassign: 54 @go install github.com/gordonklaus/ineffassign@7953dde2c7bf 55 ineffassign . 56 57.PHONY: predeclared 58predeclared: 59 @go install github.com/nishanths/predeclared@86fad755b4d3 60 predeclared . 61 62# Intentionally omitted from CI, but target here for ad-hoc reports. 63.PHONY: golint 64golint: 65 # TODO: pin version 66 @go install golang.org/x/lint/golint@latest 67 golint -min_confidence 0.9 -set_exit_status ./... 68 69# Intentionally omitted from CI, but target here for ad-hoc reports. 70.PHONY: errcheck 71errcheck: 72 # TODO: pin version 73 @go install github.com/kisielk/errcheck@latest 74 errcheck ./... 75 76.PHONY: test 77test: 78 go test -race ./... 79