From 52c870b3e033c862e4b40cbc5c2e5fbf68b8d6fb Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bronisz Date: Wed, 7 Aug 2024 17:37:36 +0200 Subject: [PATCH] go_repository_cache: set GOTOOLCHAIN to 'local' Same fix than https://github.com/bazelbuild/rules_go/pull/3660 in rules_go. --- internal/go_repository_cache.bzl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/go_repository_cache.bzl b/internal/go_repository_cache.bzl index fe8c33c6c..4273e8176 100644 --- a/internal/go_repository_cache.bzl +++ b/internal/go_repository_cache.bzl @@ -59,6 +59,12 @@ def _go_repository_cache_impl(ctx): cache_env = { "GOROOT": go_root, "GOCACHE": go_cache, + + # Since v1.21.0, set GOTOOLCHAIN to "local" to use the current toolchain + # and avoid downloading other toolchains. + # + # See https://go.dev/doc/toolchain for more info. + "GOTOOLCHAIN": "local", } if go_path: cache_env["GOPATH"] = go_path @@ -140,7 +146,7 @@ def _detect_host_platform(ctx): uname = res.stdout.strip() if uname == "arm64": host = "darwin_arm64" - + elif ctx.os.name.startswith("windows"): host = "windows_amd64" elif ctx.os.name == "freebsd":