diff --git a/extras/gomock.bzl b/extras/gomock.bzl index 3046c9f1d5..98ea9a6a59 100644 --- a/extras/gomock.bzl +++ b/extras/gomock.bzl @@ -23,7 +23,7 @@ # DO NOT USE IT. load("//go/private:context.bzl", "go_context") -load("//go/private:common.bzl", "GO_TOOLCHAIN") +load("//go/private:common.bzl", "GO_TOOLCHAIN", "GO_TOOLCHAIN_LABEL") load("//go/private/rules:wrappers.bzl", go_binary = "go_binary_macro") load("//go/private:providers.bzl", "GoLibrary") load("@bazel_skylib//lib:paths.bzl", "paths") @@ -79,6 +79,7 @@ def _gomock_source_impl(ctx): ctx.file.mockgen_tool, go_ctx.go, ], + toolchain = GO_TOOLCHAIN_LABEL, command = """ export GOPATH=$(pwd)/{gopath} && {cmd} {args} > {out} diff --git a/go/private/actions/compilepkg.bzl b/go/private/actions/compilepkg.bzl index 03096a923f..0361d732ff 100644 --- a/go/private/actions/compilepkg.bzl +++ b/go/private/actions/compilepkg.bzl @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//go/private:common.bzl", "GO_TOOLCHAIN") +load("//go/private:common.bzl", "GO_TOOLCHAIN_LABEL") load( "//go/private:mode.bzl", "link_mode_args", @@ -163,5 +163,5 @@ def emit_compilepkg( executable = go.toolchain._builder, arguments = [args], env = go.env, - toolchain = GO_TOOLCHAIN, + toolchain = GO_TOOLCHAIN_LABEL, ) diff --git a/go/private/actions/link.bzl b/go/private/actions/link.bzl index bdd58553aa..3228641669 100644 --- a/go/private/actions/link.bzl +++ b/go/private/actions/link.bzl @@ -14,7 +14,7 @@ load( "//go/private:common.bzl", - "GO_TOOLCHAIN", + "GO_TOOLCHAIN_LABEL", "as_set", "count_group_matches", "has_shared_lib_extension", @@ -210,7 +210,7 @@ def emit_link( executable = go.toolchain._builder, arguments = [builder_args, "--", tool_args], env = go.env, - toolchain = GO_TOOLCHAIN, + toolchain = GO_TOOLCHAIN_LABEL, ) def _extract_extldflags(gc_linkopts, extldflags): diff --git a/go/private/actions/stdlib.bzl b/go/private/actions/stdlib.bzl index c7b889c083..ab69a6d69e 100644 --- a/go/private/actions/stdlib.bzl +++ b/go/private/actions/stdlib.bzl @@ -15,7 +15,7 @@ load( "//go/private:common.bzl", "COVERAGE_OPTIONS_DENYLIST", - "GO_TOOLCHAIN", + "GO_TOOLCHAIN_LABEL", ) load( "//go/private:providers.bzl", @@ -83,7 +83,7 @@ def _build_stdlib_list_json(go): executable = go.toolchain._builder, arguments = [args], env = _build_env(go), - toolchain = GO_TOOLCHAIN, + toolchain = GO_TOOLCHAIN_LABEL, ) return out @@ -151,7 +151,7 @@ def _build_stdlib(go): executable = go.toolchain._builder, arguments = [args], env = _build_env(go), - toolchain = GO_TOOLCHAIN, + toolchain = GO_TOOLCHAIN_LABEL, ) return GoStdLib( _list_json = _build_stdlib_list_json(go), diff --git a/go/private/common.bzl b/go/private/common.bzl index db24c4aa54..5e449d778a 100644 --- a/go/private/common.bzl +++ b/go/private/common.bzl @@ -13,6 +13,7 @@ # limitations under the License. GO_TOOLCHAIN = "@io_bazel_rules_go//go:toolchain" +GO_TOOLCHAIN_LABEL = Label(GO_TOOLCHAIN) go_exts = [ ".go", diff --git a/go/private/rules/test.bzl b/go/private/rules/test.bzl index 14cea78654..3bf7e2ef7a 100644 --- a/go/private/rules/test.bzl +++ b/go/private/rules/test.bzl @@ -19,6 +19,7 @@ load( load( "//go/private:common.bzl", "GO_TOOLCHAIN", + "GO_TOOLCHAIN_LABEL", "as_list", "asm_exts", "cgo_exts", @@ -118,7 +119,7 @@ def _go_test_impl(ctx): mnemonic = "GoTestGenTest", executable = go.toolchain._builder, arguments = [arguments], - toolchain = GO_TOOLCHAIN, + toolchain = GO_TOOLCHAIN_LABEL, ) test_gc_linkopts = gc_linkopts(ctx) diff --git a/proto/compiler.bzl b/proto/compiler.bzl index b39028ee0b..b51242271b 100644 --- a/proto/compiler.bzl +++ b/proto/compiler.bzl @@ -24,6 +24,7 @@ load( load( "//go/private:common.bzl", "GO_TOOLCHAIN", + "GO_TOOLCHAIN_LABEL", ) load( "//go/private/rules:transition.bzl", @@ -130,7 +131,7 @@ def go_proto_compile(go, compiler, protos, imports, importpath): progress_message = "Generating into %s" % go_srcs[0].dirname, mnemonic = "GoProtocGen", executable = compiler.internal.go_protoc, - toolchain = GO_TOOLCHAIN, + toolchain = GO_TOOLCHAIN_LABEL, arguments = [args], env = go.env, # We may need the shell environment (potentially augmented with --action_env)