From 88c23deb88838ea5a8e463fc74225145e0d0780e Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Mon, 12 Sep 2022 14:53:04 +0200 Subject: [PATCH] Check go version when running govulncheck govulncheck supports only go 1.18 or greater. Signed-off-by: Cosmin Cojocar --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 52467b0..b38b2db 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ GOBIN ?= $(GOPATH)/bin GOLINT ?= $(GOBIN)/golint GOSEC ?= $(GOBIN)/gosec GINKGO ?= $(GOBIN)/ginkgo +GO_MINOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2) +GOVULN_MIN_VERSION = 17 GO_VERSION = 1.18 default: @@ -50,7 +52,9 @@ sec: govulncheck: install-govulncheck @echo "CHECKING VULNERABILITIES" - govulncheck ./... + @if [ $(GO_MINOR_VERSION) -gt $(GOVULN_MIN_VERSION) ]; then \ + govulncheck ./...; \ + fi test-coverage: install-test-deps go test -race -v -count=1 -coverprofile=coverage.out ./...