diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fbc0af1c70..f745c9326e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,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)/: