Check go version when running govulncheck

govulncheck supports only go 1.18 or greater.

Signed-off-by: Cosmin Cojocar <gcojocar@adobe.com>
This commit is contained in:
Cosmin Cojocar 2022-09-12 14:53:04 +02:00 committed by Cosmin Cojocar
parent 84f6424ac9
commit 88c23deb88

View file

@ -12,6 +12,8 @@ GOBIN ?= $(GOPATH)/bin
GOLINT ?= $(GOBIN)/golint GOLINT ?= $(GOBIN)/golint
GOSEC ?= $(GOBIN)/gosec GOSEC ?= $(GOBIN)/gosec
GINKGO ?= $(GOBIN)/ginkgo 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 GO_VERSION = 1.18
default: default:
@ -50,7 +52,9 @@ sec:
govulncheck: install-govulncheck govulncheck: install-govulncheck
@echo "CHECKING VULNERABILITIES" @echo "CHECKING VULNERABILITIES"
govulncheck ./... @if [ $(GO_MINOR_VERSION) -gt $(GOVULN_MIN_VERSION) ]; then \
govulncheck ./...; \
fi
test-coverage: install-test-deps test-coverage: install-test-deps
go test -race -v -count=1 -coverprofile=coverage.out ./... go test -race -v -count=1 -coverprofile=coverage.out ./...