From a314eea4ae173fdfec6e416cf06ccfea74a2200f Mon Sep 17 00:00:00 2001 From: Benjamin Elder Date: Wed, 22 Oct 2025 15:13:28 -0700 Subject: [PATCH] make setup-go.sh GOTOOLCHAIN aware TODO: deal with gimme is broken --- hack/build/setup-go.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/hack/build/setup-go.sh b/hack/build/setup-go.sh index e55f2da4..ee7f9159 100755 --- a/hack/build/setup-go.sh +++ b/hack/build/setup-go.sh @@ -29,12 +29,18 @@ export GIMME_ENV_PREFIX=./bin/.gimme/ export GIMME_SILENT_ENV=y # only setup go if we haven't set FORCE_HOST_GO, or `go version` doesn't match -# go version output looks like: -# go version go1.14.5 darwin/amd64 -if ! ([ -n "${FORCE_HOST_GO:-}" ] || \ - (command -v go >/dev/null && [ "$(go version | cut -d' ' -f3)" = "go${GO_VERSION}" ])); then +if [ -n "${FORCE_HOST_GO:-}" ]; then + GOTOOLCHAIN="${GOTOOLCHAIN:-local}" + export GOTOOLCHAIN +else + GOTOOLCHAIN="go${GO_VERSION}" + export GOTOOLCHAIN + # go version output looks like: + # go version go1.14.5 darwin/amd64 + if ! (command -v go >/dev/null && [ "$(go version | cut -d' ' -f3)" = "go${GO_VERSION}" ]); then # eval because the output of this is shell to set PATH etc. eval "$(hack/third_party/gimme/gimme "${GO_VERSION}")" + fi fi # force go modules