Skip to content

Commit

Permalink
fix: go version
Browse files Browse the repository at this point in the history
Signed-off-by: 熊鑫伟 Xinwei Xiong <[email protected]>
  • Loading branch information
cubxxw authored Oct 22, 2024
1 parent a6adcc1 commit e1f0b2c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ SPACE +=
# ==============================================================================
# Build definition

GO_SUPPORTED_VERSIONS ?= 1.18|1.19|1.20
GO_MINIMUM_VERSION ?= 1.19

GO_LDFLAGS += -X $(VERSION_PACKAGE).GitVersion=$(VERSION) \
-X $(VERSION_PACKAGE).GitCommit=$(GIT_COMMIT) \
-X $(VERSION_PACKAGE).GitTreeState=$(GIT_TREE_STATE) \
Expand Down Expand Up @@ -170,8 +171,8 @@ build.%:

.PHONY: go.build.verify
go.build.verify:
ifneq ($(shell $(GO) version | grep -q -E '\bgo($(GO_SUPPORTED_VERSIONS))\b' && echo 0 || echo 1), 0)
$(error unsupported go version. Please make install one of the following supported version: '$(GO_SUPPORTED_VERSIONS)')
ifneq ($(shell $(GO) version|awk -v min=$(GO_MINIMUM_VERSION) '{gsub(/go/,"",$$3);if($$3 >= min){print 0}else{print 1}}'), 0)
$(error unsupported go version. Please install a go version which is greater than or equal to '$(GO_MINIMUM_VERSION)')
endif

## go.build: Build the binary file of the specified platform.
Expand Down

0 comments on commit e1f0b2c

Please sign in to comment.