blob: 8c34d313a8878f7fce81f002c8791695c47c2336 [file] [log] [blame]
Zack Williamse940c7a2019-08-21 14:25:39 -07001dev_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 @GO111MODULE=off go get github.com/goreleaser/goreleaser
26 goreleaser --rm-dist
27
Scott Baker4a35a702019-11-26 08:17:33 -080028.PHONY: docker
29docker:
30 @echo $(dev_build_version) > VERSION
31 docker build -t fullstorydev/grpcurl:$(dev_build_version) .
32 @rm VERSION
33
Zack Williamse940c7a2019-08-21 14:25:39 -070034.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# TODO: remove the ignored check; need it for now because it
46# is complaining about a deprecated comment added to grpc,
47# but it's not yet released. Once the new (non-deprecated)
48# API is included in a release, we can move to that new
49# version and fix the call site to no longer use deprecated
50# method.
51# This all works fine with Go modules, but without modules,
52# CI is just getting latest master for dependencies like grpc.
53.PHONY: staticcheck
54staticcheck:
55 @go get honnef.co/go/tools/cmd/staticcheck
56 staticcheck ./...
57
58.PHONY: ineffassign
59ineffassign:
60 @go get github.com/gordonklaus/ineffassign
61 ineffassign .
62
63.PHONY: predeclared
64predeclared:
65 @go get github.com/nishanths/predeclared
66 predeclared .
67
68# Intentionally omitted from CI, but target here for ad-hoc reports.
69.PHONY: golint
70golint:
71 @go get golang.org/x/lint/golint
72 golint -min_confidence 0.9 -set_exit_status ./...
73
74# Intentionally omitted from CI, but target here for ad-hoc reports.
75.PHONY: errcheck
76errcheck:
77 @go get github.com/kisielk/errcheck
78 errcheck ./...
79
80.PHONY: test
81test:
82 go test -race ./...