Skip to content

Commit

Permalink
Merge pull request #315 from yersan/issue-314
Browse files Browse the repository at this point in the history
[#314] Limit the higher Go version we can use
  • Loading branch information
yersan authored Oct 17, 2024
2 parents bdb7c36 + bfedbd0 commit fd76765
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 1.2.0

# The higher Go version expected to be used
REQUIRED_GO_MAJOR_VERSION := 1
REQUIRED_GO_MINOR_VERSION := 21
REQUIRED_GO_VERSION := $(REQUIRED_GO_MAJOR_VERSION).$(REQUIRED_GO_MINOR_VERSION)

# Check if Go is installed
ifeq (, $(shell which go))
$(error "Go is not installed. Please install Go $(REQUIRED_GO_VERSION).")
endif

CURRENT_GO_MAJOR_VERSION := $(shell go version | sed -n 's/^go version go\([0-9]*\).*/\1/p')
CURRENT_GO_MINOR_VERSION := $(shell go version | sed -n 's/^go version go$(CURRENT_GO_MAJOR_VERSION).\([0-9]*\).*/\1/p')
CURRENT_GO_VERSION := $(CURRENT_GO_MAJOR_VERSION).$(CURRENT_GO_MINOR_VERSION)
$(info Using Go version $(CURRENT_GO_VERSION))
ifeq ($(shell expr $(CURRENT_GO_MAJOR_VERSION) \> $(REQUIRED_GO_MAJOR_VERSION)), 1)
$(error "Go $(REQUIRED_GO_VERSION) or below is required. Current version is: $(CURRENT_GO_VERSION)")
endif
ifeq ($(shell expr $(CURRENT_GO_MINOR_VERSION) \> $(REQUIRED_GO_MINOR_VERSION)), 1)
$(error "Go $(REQUIRED_GO_VERSION) or below is required. Current version is: $(CURRENT_GO_VERSION)")
endif

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
Expand Down

0 comments on commit fd76765

Please sign in to comment.