improved static check result readability

This commit is contained in:
Christian Mouchet
2022-05-19 14:42:24 +02:00
committed by Jean-Philippe Bossuat
parent b8f142e4bb
commit d6213c1771

View File

@@ -34,7 +34,16 @@ static_check: check_tools
echo $$FMTOUT;\ echo $$FMTOUT;\
false;\ false;\
fi fi
go vet ./...
@GOVETOUT=$$(go vet ./... 2>&1); \
if [ -z "$$GOVETOUT" ]; then\
echo "go vet: OK";\
else \
echo "go vet: problems in files:";\
echo "$$GOVETOUT";\
false;\
fi
@GOIMPORTSOUT=$$(goimports -l .); \ @GOIMPORTSOUT=$$(goimports -l .); \
if [ -z "$$GOIMPORTSOUT" ]; then\ if [ -z "$$GOIMPORTSOUT" ]; then\
echo "goimports: OK";\ echo "goimports: OK";\
@@ -43,7 +52,17 @@ static_check: check_tools
echo "$$GOIMPORTSOUT";\ echo "$$GOIMPORTSOUT";\
false;\ false;\
fi fi
staticcheck -go 1.17 -checks all ./...
@STATICCHECKOUT=$$(staticcheck -go 1.17 -checks all ./...); \
if [ -z "$$STATICCHECKOUT" ]; then\
echo "staticcheck: OK";\
else \
echo "staticcheck: problems in files:";\
echo "$$STATICCHECKOUT";\
false;\
fi
@echo Checking all local changes are committed
go mod tidy go mod tidy
out=`git status --porcelain`; echo "$$out"; [ -z "$$out" ] out=`git status --porcelain`; echo "$$out"; [ -z "$$out" ]
@@ -58,6 +77,7 @@ EXECUTABLES = goimports staticcheck
get_tools: get_tools:
go install golang.org/x/tools/cmd/goimports@latest go install golang.org/x/tools/cmd/goimports@latest
go install honnef.co/go/tools/cmd/staticcheck@2022.1.1 go install honnef.co/go/tools/cmd/staticcheck@2022.1.1
.PHONY: check_tools .PHONY: check_tools
check_tools: check_tools:
@$(foreach exec,$(EXECUTABLES),\ @$(foreach exec,$(EXECUTABLES),\