Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go_repository_cache: set GOTOOLCHAIN to 'local' #1859

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion internal/go_repository_cache.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ def _go_repository_cache_impl(ctx):
cache_env = {
"GOROOT": go_root,
"GOCACHE": go_cache,

# Since Go v1.21.0, set GOTOOLCHAIN to "local" to use the current toolchain
# of the Go SDK. This is required to avoid `go mod download` commands
# download and use another Go toolchain according to the user’s environment
# default file (GOENV, managed by `go env -w` and `go env -u`).
#
# See https://go.dev/doc/toolchain for more info.
#
# TODO(#1858): Find a way to retrieve this value when the host's Go SDK is used and avoid to override it.
"GOTOOLCHAIN": "local",
fmeum marked this conversation as resolved.
Show resolved Hide resolved
}
if go_path:
cache_env["GOPATH"] = go_path
Expand Down Expand Up @@ -140,7 +150,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