Skip to content

Commit 88c23de

Browse files
committed
Check go version when running govulncheck
govulncheck supports only go 1.18 or greater. Signed-off-by: Cosmin Cojocar <[email protected]>
1 parent 84f6424 commit 88c23de

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ GOBIN ?= $(GOPATH)/bin
1212
GOLINT ?= $(GOBIN)/golint
1313
GOSEC ?= $(GOBIN)/gosec
1414
GINKGO ?= $(GOBIN)/ginkgo
15+
GO_MINOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
16+
GOVULN_MIN_VERSION = 17
1517
GO_VERSION = 1.18
1618

1719
default:
@@ -50,7 +52,9 @@ sec:
5052

5153
govulncheck: install-govulncheck
5254
@echo "CHECKING VULNERABILITIES"
53-
govulncheck ./...
55+
@if [ $(GO_MINOR_VERSION) -gt $(GOVULN_MIN_VERSION) ]; then \
56+
govulncheck ./...; \
57+
fi
5458

5559
test-coverage: install-test-deps
5660
go test -race -v -count=1 -coverprofile=coverage.out ./...

0 commit comments

Comments
 (0)