blob: ce9d7cded649a1d1c40da875136344d2130f6bff [file] [log] [blame]
khenaidood948f772021-08-11 17:49:24 -04001PKGS := github.com/pkg/errors
2SRCDIRS := $(shell go list -f '{{.Dir}}' $(PKGS))
3GO := go
4
5check: test vet gofmt misspell unconvert staticcheck ineffassign unparam
6
7test:
8 $(GO) test $(PKGS)
9
10vet: | test
11 $(GO) vet $(PKGS)
12
13staticcheck:
14 $(GO) get honnef.co/go/tools/cmd/staticcheck
15 staticcheck -checks all $(PKGS)
16
17misspell:
18 $(GO) get github.com/client9/misspell/cmd/misspell
19 misspell \
20 -locale GB \
21 -error \
22 *.md *.go
23
24unconvert:
25 $(GO) get github.com/mdempsky/unconvert
26 unconvert -v $(PKGS)
27
28ineffassign:
29 $(GO) get github.com/gordonklaus/ineffassign
30 find $(SRCDIRS) -name '*.go' | xargs ineffassign
31
32pedantic: check errcheck
33
34unparam:
35 $(GO) get mvdan.cc/unparam
36 unparam ./...
37
38errcheck:
39 $(GO) get github.com/kisielk/errcheck
40 errcheck $(PKGS)
41
42gofmt:
43 @echo Checking code is gofmted
44 @test -z "$(shell gofmt -s -l -d -e $(SRCDIRS) | tee /dev/stderr)"