From b49bc62287ce93535b893f67a6c3972bb8257296 Mon Sep 17 00:00:00 2001 From: lg Date: Sun, 29 Jan 2023 16:22:22 +0100 Subject: [PATCH 1/2] Add go version check --- Makefile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 46b482e0a5b..398ddafd20d 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,9 @@ DOCKER := $(shell which docker) BUILDDIR ?= $(CURDIR)/build TEST_DOCKER_REPO=cosmos/contrib-gaiatest +GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1) +GO_MINOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2) + export GO111MODULE = on # process build tags @@ -89,16 +92,22 @@ endif include contrib/devtools/Makefile ############################################################################### -### Documentation ### +### Build ### ############################################################################### +check_version: +ifneq ($(GO_MINOR_VERSION),18) + @echo "ERROR: Go version 1.18 is required for $(VERSION) of Gaia." + exit 1 +endif + all: install lint run-tests test-e2e vulncheck BUILD_TARGETS := build install build: BUILD_ARGS=-o $(BUILDDIR)/ -$(BUILD_TARGETS): go.sum $(BUILDDIR)/ +$(BUILD_TARGETS): check_version go.sum $(BUILDDIR)/ go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./... $(BUILDDIR)/: From a97fd8c597f75680b7a28be3355ee0b4a0386af9 Mon Sep 17 00:00:00 2001 From: lg Date: Mon, 30 Jan 2023 15:43:12 +0100 Subject: [PATCH 2/2] Make requested changes --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 398ddafd20d..46967152919 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,8 @@ DOCKER := $(shell which docker) BUILDDIR ?= $(CURDIR)/build TEST_DOCKER_REPO=cosmos/contrib-gaiatest -GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1) -GO_MINOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2) +GO_SYSTEM_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1-2) +REQUIRE_GO_VERSION = 1.18 export GO111MODULE = on @@ -96,7 +96,7 @@ include contrib/devtools/Makefile ############################################################################### check_version: -ifneq ($(GO_MINOR_VERSION),18) +ifneq ($(GO_SYSTEM_VERSION), $(REQUIRE_GO_VERSION)) @echo "ERROR: Go version 1.18 is required for $(VERSION) of Gaia." exit 1 endif