Skip to content

Commit cca5336

Browse files
authored
feat: optimize go version auto set (#2182)
1 parent 4f40022 commit cca5336

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/make-rules/golang.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#
1818

1919
GO := go
20-
GO_SUPPORTED_VERSIONS ?= 1.19|1.20|1.21|1.22|1.23
20+
GO_MINIMUM_VERSION ?= 1.19
2121

2222
GO_LDFLAGS += -X $(VERSION_PACKAGE).gitVersion=$(GIT_TAG) \
2323
-X $(VERSION_PACKAGE).gitCommit=$(GIT_COMMIT) \
@@ -132,8 +132,8 @@ go.versionchecker:
132132
## go.build.verify: Verify that a suitable version of Go exists
133133
.PHONY: go.build.verify
134134
go.build.verify:
135-
ifneq ($(shell $(GO) version | grep -q -E '\bgo($(GO_SUPPORTED_VERSIONS))\b' && echo 0 || echo 1), 0)
136-
$(error unsupported go version. Please make install one of the following supported version: '$(GO_SUPPORTED_VERSIONS)')
135+
ifneq ($(shell $(GO) version|awk -v min=$(GO_MINIMUM_VERSION) '{gsub(/go/,"",$$3);if($$3 >= min){print 0}else{print 1}}'), 0)
136+
$(error unsupported go version. Please install a go version which is greater than or equal to '$(GO_MINIMUM_VERSION)')
137137
endif
138138

139139
## go.build.%: Build binaries for a specific platform

0 commit comments

Comments
 (0)