From f52cb5330776c42e92e72c81242da182da012ce3 Mon Sep 17 00:00:00 2001 From: Dev Ojha Date: Mon, 5 Dec 2022 20:52:15 -0600 Subject: [PATCH] Ensure go v1.18 used in make build & make install (#3634) * Apply @jhernandez ' patch to Makefil * Add changelog --- CHANGELOG.md | 1 + Makefile | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f612dd62956..780046818ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Misc Improvements * [#3611](https://github.com/osmosis-labs/osmosis/pull/3611) Introduce osmocli, to automate thousands of lines of CLI boilerplate +* [#3634](https://github.com/osmosis-labs/osmosis/pull/3634) (Makefile) Ensure correct golang version in make build and make install. (Thank you @jhernandezb ) ## v13.0.0 diff --git a/Makefile b/Makefile index 0e52174bc3a..682f8489195 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,9 @@ BUILDDIR ?= $(CURDIR)/build E2E_UPGRADE_VERSION := "v14" +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 @@ -83,13 +86,19 @@ endif ### Build ### ############################################################################### +check_version: +ifneq ($(GO_MINOR_VERSION),18) + @echo "ERROR: Go version 1.18 is required for this version of Osmosis. Go 1.19 has changes that are believed to break consensus." + exit 1 +endif + all: install lint test 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)/: