Skip to content

Commit

Permalink
go_context: set GOTOOLCHAIN to 'local'
Browse files Browse the repository at this point in the history
Enforce usage of the current toolchain and avoid downloading new
toolchains during build.
  • Loading branch information
sluongng committed Aug 15, 2023
1 parent f5ae196 commit afdd765
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions go/private/context.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,7 @@ def _infer_importpath(ctx):
attr_importmap = getattr(ctx.attr, "importmap", "")
embed_importpath = ""
embed_importmap = ""
for embed in getattr(ctx.attr, "embed", []):
if GoLibrary not in embed:
for embed in getattr(ctx.attr, "embed", []): if GoLibrary not in embed:
continue
lib = embed[GoLibrary]
if lib.pathtype == EXPLICIT_PATH:
Expand Down Expand Up @@ -446,6 +445,12 @@ def go_context(ctx, attr = None):
# Explicitly clear this environment variable to ensure that doesn't
# happen. See #2291 for more information.
"GOPATH": "",

# 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",
}

# The level of support is determined by the platform constraints in
Expand Down

0 comments on commit afdd765

Please sign in to comment.