Skip to content

Commit

Permalink
feat: Add go version check (#2095)
Browse files Browse the repository at this point in the history
* Add go version check

* Make requested changes

(cherry picked from commit c9650f8)
  • Loading branch information
glnro authored and mergify[bot] committed Jan 30, 2023
1 parent 2d4247f commit 5ad9b40
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ DOCKER := $(shell which docker)
BUILDDIR ?= $(CURDIR)/build
TEST_DOCKER_REPO=cosmos/contrib-gaiatest

GO_SYSTEM_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1-2)
REQUIRE_GO_VERSION = 1.18

export GO111MODULE = on

# process build tags
Expand Down Expand Up @@ -89,16 +92,22 @@ endif
include contrib/devtools/Makefile

###############################################################################
### Documentation ###
### Build ###
###############################################################################

check_version:
ifneq ($(GO_SYSTEM_VERSION), $(REQUIRE_GO_VERSION))
@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)/:
Expand Down

0 comments on commit 5ad9b40

Please sign in to comment.