Skip to content

Commit

Permalink
Add staticcheck unused code check to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sparrc committed Jun 1, 2020
1 parent 82be53f commit 010ee89
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ gocyclo:
# Run gocyclo over all .go files
gocyclo -over 15 ${GOFILES}

.PHONY: staticcheck
staticcheck:
# check for unused code using staticcheck binary
# https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck
staticcheck -tests=false -checks "U1000" ./agent/...

# same as gofiles above, but without the `-f`
.PHONY: govet
govet:
Expand All @@ -276,7 +282,7 @@ importcheck:
@if [ -n "$(DIFFS)" ]; then echo "Files incorrectly formatted. Fix formatting by running goimports:"; echo "$(DIFFS)"; exit 1; fi

.PHONY: static-check
static-check: gocyclo govet importcheck
static-check: gocyclo govet importcheck staticcheck

.PHONY: goimports
goimports:
Expand All @@ -287,6 +293,7 @@ goimports:
go get github.com/golang/mock/mockgen
go get golang.org/x/tools/cmd/goimports
go get github.com/fzipp/gocyclo
go get honnef.co/go/tools/cmd/staticcheck
touch .get-deps-stamp

get-deps: .get-deps-stamp
Expand Down

0 comments on commit 010ee89

Please sign in to comment.