From 12476113a2458fdc1f646e44fef421e2f1c61075 Mon Sep 17 00:00:00 2001 From: Kamil Sambor Date: Wed, 18 Sep 2024 11:08:50 +0200 Subject: [PATCH] set GOTOOLCHAIN min version when init go.work When the golang version does not match the version used inside the build container, dowloading the modules can fail with: ~~~ go: go.work requires go >= 1.21.13 (running go 1.21.11; GOTOOLCHAIN=local) ~~~ This PR makes set the GOTOOLCHAIN to set 1.21.0 as the min required version and sets it in go.work file. --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cb5d53f..d4c65b9 100644 --- a/Makefile +++ b/Makefile @@ -68,6 +68,8 @@ endif SHELL = /usr/bin/env bash -o pipefail .SHELLFLAGS = -ec +GOTOOLCHAIN_VERSION ?= go1.21.0 + .PHONY: all all: build @@ -334,7 +336,7 @@ golint: get-ci-tools .PHONY: gowork gowork: ## Generate go.work file to support our multi module repository - test -f go.work || go work init + test -f go.work || GOTOOLCHAIN=$(GOTOOLCHAIN_VERSION) go work init go work use . go work use ./api go work sync