From 3baadbc533418c9f3d61f42cf49010e08a473a56 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 (cherry picked from commit f52cb5330776c42e92e72c81242da182da012ce3) --- CHANGELOG.md | 1 + Makefile | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8515189aad5..b4c7d03fbb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,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 8db01b1028b..8ded27938a7 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,9 @@ BUILDDIR ?= $(CURDIR)/build E2E_UPGRADE_VERSION := "v13" +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)/: