From 010ee89512f6758bb1c0890a812a4d81c00323ba Mon Sep 17 00:00:00 2001 From: Cam Date: Mon, 1 Jun 2020 10:44:33 -0700 Subject: [PATCH] Add staticcheck unused code check to CI --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 74012544d51..05c15b301f3 100644 --- a/Makefile +++ b/Makefile @@ -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: @@ -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: @@ -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