Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Commit 31aac83

Browse files
authored
travis: use Makefile (#181)
Add a bunch of useful makefile targets Signed-off-by: Dave Cheney <[email protected]>
1 parent 5ac96ae commit 31aac83

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ go:
1212
- tip
1313

1414
script:
15-
- go test -v ./...
15+
- make check

Makefile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
PKGS := github.com/pkg/errors
2+
SRCDIRS := $(shell go list -f '{{.Dir}}' $(PKGS))
3+
GO := go
4+
5+
check: test vet gofmt unused misspell unconvert gosimple ineffassign
6+
7+
test:
8+
$(GO) test $(PKGS)
9+
10+
vet: | test
11+
$(GO) vet $(PKGS)
12+
13+
staticcheck:
14+
$(GO) get honnef.co/go/tools/cmd/staticcheck
15+
staticcheck $(PKGS)
16+
17+
unused:
18+
$(GO) get honnef.co/go/tools/cmd/unused
19+
unused -exported $(PKGS)
20+
21+
misspell:
22+
$(GO) get github.com/client9/misspell/cmd/misspell
23+
misspell \
24+
-locale GB \
25+
-error \
26+
*.md *.go
27+
28+
unconvert:
29+
$(GO) get github.com/mdempsky/unconvert
30+
unconvert -v $(PKGS)
31+
32+
gosimple:
33+
$(GO) get honnef.co/go/tools/cmd/gosimple
34+
gosimple $(PKGS)
35+
36+
ineffassign:
37+
$(GO) get github.com/gordonklaus/ineffassign
38+
find $(SRCDIRS) -name '*.go' | xargs ineffassign
39+
40+
pedantic: check unparam errcheck staticcheck
41+
42+
unparam:
43+
$(GO) get mvdan.cc/unparam
44+
unparam ./...
45+
46+
errcheck:
47+
$(GO) get github.com/kisielk/errcheck
48+
errcheck $(PKGS)
49+
50+
gofmt:
51+
@echo Checking code is gofmted
52+
@test -z "$(shell gofmt -s -l -d -e $(SRCDIRS) | tee /dev/stderr)"

0 commit comments

Comments
 (0)