Skip to content

Commit

Permalink
go_repository_cache: set GOTOOLCHAIN to 'local'
Browse files Browse the repository at this point in the history
Same fix than bazel-contrib/rules_go#3660 in
rules_go.
  • Loading branch information
PingWriter committed Aug 7, 2024
1 parent f2f9f4f commit 52c870b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/go_repository_cache.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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":
Expand Down

0 comments on commit 52c870b

Please sign in to comment.