From f4d30802b21a43fc429662bc469b6df05070ec9e Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 3 Apr 2025 17:05:52 -0700 Subject: [PATCH] Makefile: add linting with --tests=false Sometimes running golangci-lint with --tests=false helps to uncover some unused code which was not removed because it has unit tests. Since everything is already cached, this additional run doesn't take much time. Signed-off-by: Kir Kolyshkin --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index d7da7f74..4f981948 100644 --- a/Makefile +++ b/Makefile @@ -238,6 +238,10 @@ validate-local: hack/validate-git-marks.sh hack/validate-gofmt.sh $(GOBIN)/golangci-lint run --build-tags "${BUILDTAGS}" + # An extra run with --tests=false allows detecting code unused outside of tests; + # ideally the linter should be able to find this automatically. + # Since everything is already cached, this additional run doesn't take much time. + $(GOBIN)/golangci-lint run --build-tags "${BUILDTAGS}" --tests=false BUILDTAGS="${BUILDTAGS}" hack/validate-vet.sh # This invokes bin/skopeo, hence cannot be run as part of validate-local