Skip to content

Commit

Permalink
[#845] Make: check for go version compatibility
Browse files Browse the repository at this point in the history
Building with golang 1.21 requires changes to the go.mod file. This is
most likely due to a change in behavior in golang's gomod (see
https://go.dev/doc/modules/gomod-ref).

Since the migration to the newer version of go hasn't yet been made, and
to help any user who might have a > 1.20 version of go on their system,
the Makefile now brings in a new check to verify that the go version
matches the one of the go.mod.
  • Loading branch information
lavocatt authored and brusdev committed Apr 3, 2024
1 parent 78f3771 commit fe5b444
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ GO_MODULE := github.com/artemiscloud/activemq-artemis-operator
OS := $(shell go env GOOS)
ARCH := $(shell go env GOARCH)

# Check that the system's go version is compatible with the one stored in the
# go.mod file.
RUNTIME_GO_VERSION := $(shell go version)
REQUIRED_GO_VERSION := $(subst go ,,$(shell grep -i -e '^go .*' go.mod))

ifeq (,$(findstring $(REQUIRED_GO_VERSION),$(RUNTIME_GO_VERSION)))
$(error The go version $(RUNTIME_GO_VERSION) the system is currently running is incompatible with the required one $(REQUIRED_GO_VERSION))
endif

# directory to hold static resources for deploying operator
DEPLOY := ./deploy
Expand Down

0 comments on commit fe5b444

Please sign in to comment.