From 9f7b532d0305b630e6afb21b15e4d1abc180883f Mon Sep 17 00:00:00 2001 From: Nevena Kotlaja Date: Wed, 22 Nov 2023 12:09:02 +0100 Subject: [PATCH 1/4] Bazel 5.4.0 supports toolchain's registration only as a String, not Label --- extras/gomock.bzl | 7 ++++--- go/private/common.bzl | 2 +- go/private/context.bzl | 2 +- go/private/rules/binary.bzl | 2 +- go/private/rules/go_bin_for_host.bzl | 2 +- go/private/rules/info.bzl | 2 +- go/private/rules/library.bzl | 4 ++-- go/private/rules/nogo.bzl | 2 +- go/private/rules/source.bzl | 2 +- go/private/rules/stdlib.bzl | 2 +- go/private/rules/test.bzl | 2 +- proto/compiler.bzl | 2 +- proto/def.bzl | 4 ++-- 13 files changed, 18 insertions(+), 17 deletions(-) diff --git a/extras/gomock.bzl b/extras/gomock.bzl index 3046c9f1d5..654d4b0d7d 100644 --- a/extras/gomock.bzl +++ b/extras/gomock.bzl @@ -79,6 +79,7 @@ def _gomock_source_impl(ctx): ctx.file.mockgen_tool, go_ctx.go, ], + toolchain = GO_TOOLCHAIN, command = """ export GOPATH=$(pwd)/{gopath} && {cmd} {args} > {out} @@ -147,7 +148,7 @@ _gomock_source = rule( default = "//:go_context_data", ), }, - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], ) def gomock(name, library, out, source = None, interfaces = [], package = "", self_package = "", aux_files = {}, mockgen_tool = _MOCKGEN_TOOL, imports = {}, copyright_file = None, mock_names = {}, **kwargs): @@ -278,7 +279,7 @@ _gomock_prog_gen = rule( default = "//:go_context_data", ), }, - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], ) def _gomock_prog_exec_impl(ctx): @@ -360,7 +361,7 @@ _gomock_prog_exec = rule( default = "//:go_context_data", ), }, - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], ) def _handle_shared_args(ctx, args): diff --git a/go/private/common.bzl b/go/private/common.bzl index db24c4aa54..0de94c3ab1 100644 --- a/go/private/common.bzl +++ b/go/private/common.bzl @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -GO_TOOLCHAIN = "@io_bazel_rules_go//go:toolchain" +GO_TOOLCHAIN = Label("@io_bazel_rules_go//go:toolchain") go_exts = [ ".go", diff --git a/go/private/context.bzl b/go/private/context.bzl index 83a6f556e6..f247728efd 100644 --- a/go/private/context.bzl +++ b/go/private/context.bzl @@ -601,7 +601,7 @@ go_context_data = rule( }, doc = """go_context_data gathers information about the build configuration. It is a common dependency of all Go targets.""", - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], cfg = request_nogo_transition, ) diff --git a/go/private/rules/binary.bzl b/go/private/rules/binary.bzl index 96db3ce130..a38b4b8cd1 100644 --- a/go/private/rules/binary.bzl +++ b/go/private/rules/binary.bzl @@ -411,7 +411,7 @@ _go_binary_kwargs = { default = "@bazel_tools//tools/allowlists/function_transition_allowlist", ), }, - "toolchains": [GO_TOOLCHAIN], + "toolchains": [str(GO_TOOLCHAIN)], "doc": """This builds an executable from a set of source files, which must all be in the `main` package. You can run the binary with `bazel run`, or you can build it with `bazel build` and run it directly.

diff --git a/go/private/rules/go_bin_for_host.bzl b/go/private/rules/go_bin_for_host.bzl index 97a7afbdf7..ce49a83ee9 100644 --- a/go/private/rules/go_bin_for_host.bzl +++ b/go/private/rules/go_bin_for_host.bzl @@ -42,7 +42,7 @@ def _go_bin_for_host_impl(ctx): go_bin_for_host = rule( implementation = _go_bin_for_host_impl, - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], # Resolve a toolchain that runs on the host platform. exec_compatible_with = HOST_CONSTRAINTS, ) diff --git a/go/private/rules/info.bzl b/go/private/rules/info.bzl index 40ef98473d..68c82dcd8a 100644 --- a/go/private/rules/info.bzl +++ b/go/private/rules/info.bzl @@ -50,7 +50,7 @@ _go_info = rule( default = "//:go_context_data", ), }, - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], ) def go_info(): diff --git a/go/private/rules/library.bzl b/go/private/rules/library.bzl index 88955fc14e..737a55aa59 100644 --- a/go/private/rules/library.bzl +++ b/go/private/rules/library.bzl @@ -180,7 +180,7 @@ go_library = rule( default = "@bazel_tools//tools/allowlists/function_transition_allowlist", ), }, - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], doc = """This builds a Go library from a set of source files that are all part of the same package.

***Note:*** For targets generated by Gazelle, `name` is typically the last component of the path, @@ -211,7 +211,7 @@ go_tool_library = rule( "_cgo_context_data": attr.label(default = "//:cgo_context_data_proxy"), "_stdlib": attr.label(default = "//:stdlib"), }, - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], ) # This is used instead of `go_library` for dependencies of the `nogo` rule and # packages that are depended on implicitly by code generated within the Go rules. diff --git a/go/private/rules/nogo.bzl b/go/private/rules/nogo.bzl index b411d7b189..4724cef1d7 100644 --- a/go/private/rules/nogo.bzl +++ b/go/private/rules/nogo.bzl @@ -106,7 +106,7 @@ _nogo = rule( default = "@bazel_tools//tools/allowlists/function_transition_allowlist", ), }, - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], cfg = go_tool_transition, ) diff --git a/go/private/rules/source.bzl b/go/private/rules/source.bzl index e6d8ab41f5..8e81591b78 100644 --- a/go/private/rules/source.bzl +++ b/go/private/rules/source.bzl @@ -82,7 +82,7 @@ go_source = rule( "_go_config": attr.label(default = "//:go_config"), "_cgo_context_data": attr.label(default = "//:cgo_context_data_proxy"), }, - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], doc = """This declares a set of source files and related dependencies that can be embedded into one of the other rules. This is used as a way of easily declaring a common set of sources re-used in multiple rules.

diff --git a/go/private/rules/stdlib.bzl b/go/private/rules/stdlib.bzl index 60c856035b..67d5b0686b 100644 --- a/go/private/rules/stdlib.bzl +++ b/go/private/rules/stdlib.bzl @@ -49,5 +49,5 @@ stdlib = rule( }, doc = """stdlib builds the standard library for the target configuration or uses the precompiled standard library from the SDK if it is suitable.""", - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], ) diff --git a/go/private/rules/test.bzl b/go/private/rules/test.bzl index 14cea78654..2be0d076e7 100644 --- a/go/private/rules/test.bzl +++ b/go/private/rules/test.bzl @@ -441,7 +441,7 @@ _go_test_kwargs = { }, "executable": True, "test": True, - "toolchains": [GO_TOOLCHAIN], + "toolchains": [str(GO_TOOLCHAIN)], "doc": """This builds a set of tests that can be run with `bazel test`.

To run all tests in the workspace, and print output on failure (the equivalent of `go test ./...`), run
diff --git a/proto/compiler.bzl b/proto/compiler.bzl index b39028ee0b..77c2052efb 100644 --- a/proto/compiler.bzl +++ b/proto/compiler.bzl @@ -218,7 +218,7 @@ _go_proto_compiler = rule( default = "//:go_context_data", ), }, - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], ) def go_proto_compiler(name, **kwargs): diff --git a/proto/def.bzl b/proto/def.bzl index 93ce850915..c9f899dea7 100644 --- a/proto/def.bzl +++ b/proto/def.bzl @@ -77,7 +77,7 @@ _go_proto_aspect = aspect( "deps", "embed", ], - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], ) def _proto_library_to_source(_go, attr, source, merge): @@ -178,7 +178,7 @@ go_proto_library = rule( default = "@bazel_tools//tools/allowlists/function_transition_allowlist", ), }, - toolchains = [GO_TOOLCHAIN], + toolchains = [str(GO_TOOLCHAIN)], ) # go_proto_library is a rule that takes a proto_library (in the proto # attribute) and produces a go library for it. From 0f0062c89a3a8f12613bf245a7e7c7cb17e578e0 Mon Sep 17 00:00:00 2001 From: Nevena Kotlaja Date: Thu, 23 Nov 2023 17:06:48 +0100 Subject: [PATCH 2/4] Update GO_TOOLCHAIN string to Label and add toolchain param to one more action --- extras/gomock.bzl | 6 +++--- go/private/common.bzl | 2 +- go/private/context.bzl | 2 +- go/private/rules/binary.bzl | 2 +- go/private/rules/go_bin_for_host.bzl | 2 +- go/private/rules/info.bzl | 2 +- go/private/rules/library.bzl | 4 ++-- go/private/rules/nogo.bzl | 2 +- go/private/rules/source.bzl | 2 +- go/private/rules/stdlib.bzl | 2 +- go/private/rules/test.bzl | 2 +- proto/def.bzl | 4 ++-- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/extras/gomock.bzl b/extras/gomock.bzl index 654d4b0d7d..804b9bb9bf 100644 --- a/extras/gomock.bzl +++ b/extras/gomock.bzl @@ -148,7 +148,7 @@ _gomock_source = rule( default = "//:go_context_data", ), }, - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], ) def gomock(name, library, out, source = None, interfaces = [], package = "", self_package = "", aux_files = {}, mockgen_tool = _MOCKGEN_TOOL, imports = {}, copyright_file = None, mock_names = {}, **kwargs): @@ -279,7 +279,7 @@ _gomock_prog_gen = rule( default = "//:go_context_data", ), }, - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], ) def _gomock_prog_exec_impl(ctx): @@ -361,7 +361,7 @@ _gomock_prog_exec = rule( default = "//:go_context_data", ), }, - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], ) def _handle_shared_args(ctx, args): diff --git a/go/private/common.bzl b/go/private/common.bzl index 0de94c3ab1..a1b8c099f2 100644 --- a/go/private/common.bzl +++ b/go/private/common.bzl @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -GO_TOOLCHAIN = Label("@io_bazel_rules_go//go:toolchain") +GO_TOOLCHAIN = str(Label("@io_bazel_rules_go//go:toolchain")) go_exts = [ ".go", diff --git a/go/private/context.bzl b/go/private/context.bzl index f247728efd..83a6f556e6 100644 --- a/go/private/context.bzl +++ b/go/private/context.bzl @@ -601,7 +601,7 @@ go_context_data = rule( }, doc = """go_context_data gathers information about the build configuration. It is a common dependency of all Go targets.""", - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], cfg = request_nogo_transition, ) diff --git a/go/private/rules/binary.bzl b/go/private/rules/binary.bzl index a38b4b8cd1..96db3ce130 100644 --- a/go/private/rules/binary.bzl +++ b/go/private/rules/binary.bzl @@ -411,7 +411,7 @@ _go_binary_kwargs = { default = "@bazel_tools//tools/allowlists/function_transition_allowlist", ), }, - "toolchains": [str(GO_TOOLCHAIN)], + "toolchains": [GO_TOOLCHAIN], "doc": """This builds an executable from a set of source files, which must all be in the `main` package. You can run the binary with `bazel run`, or you can build it with `bazel build` and run it directly.

diff --git a/go/private/rules/go_bin_for_host.bzl b/go/private/rules/go_bin_for_host.bzl index ce49a83ee9..97a7afbdf7 100644 --- a/go/private/rules/go_bin_for_host.bzl +++ b/go/private/rules/go_bin_for_host.bzl @@ -42,7 +42,7 @@ def _go_bin_for_host_impl(ctx): go_bin_for_host = rule( implementation = _go_bin_for_host_impl, - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], # Resolve a toolchain that runs on the host platform. exec_compatible_with = HOST_CONSTRAINTS, ) diff --git a/go/private/rules/info.bzl b/go/private/rules/info.bzl index 68c82dcd8a..40ef98473d 100644 --- a/go/private/rules/info.bzl +++ b/go/private/rules/info.bzl @@ -50,7 +50,7 @@ _go_info = rule( default = "//:go_context_data", ), }, - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], ) def go_info(): diff --git a/go/private/rules/library.bzl b/go/private/rules/library.bzl index 737a55aa59..88955fc14e 100644 --- a/go/private/rules/library.bzl +++ b/go/private/rules/library.bzl @@ -180,7 +180,7 @@ go_library = rule( default = "@bazel_tools//tools/allowlists/function_transition_allowlist", ), }, - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], doc = """This builds a Go library from a set of source files that are all part of the same package.

***Note:*** For targets generated by Gazelle, `name` is typically the last component of the path, @@ -211,7 +211,7 @@ go_tool_library = rule( "_cgo_context_data": attr.label(default = "//:cgo_context_data_proxy"), "_stdlib": attr.label(default = "//:stdlib"), }, - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], ) # This is used instead of `go_library` for dependencies of the `nogo` rule and # packages that are depended on implicitly by code generated within the Go rules. diff --git a/go/private/rules/nogo.bzl b/go/private/rules/nogo.bzl index 4724cef1d7..b411d7b189 100644 --- a/go/private/rules/nogo.bzl +++ b/go/private/rules/nogo.bzl @@ -106,7 +106,7 @@ _nogo = rule( default = "@bazel_tools//tools/allowlists/function_transition_allowlist", ), }, - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], cfg = go_tool_transition, ) diff --git a/go/private/rules/source.bzl b/go/private/rules/source.bzl index 8e81591b78..e6d8ab41f5 100644 --- a/go/private/rules/source.bzl +++ b/go/private/rules/source.bzl @@ -82,7 +82,7 @@ go_source = rule( "_go_config": attr.label(default = "//:go_config"), "_cgo_context_data": attr.label(default = "//:cgo_context_data_proxy"), }, - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], doc = """This declares a set of source files and related dependencies that can be embedded into one of the other rules. This is used as a way of easily declaring a common set of sources re-used in multiple rules.

diff --git a/go/private/rules/stdlib.bzl b/go/private/rules/stdlib.bzl index 67d5b0686b..60c856035b 100644 --- a/go/private/rules/stdlib.bzl +++ b/go/private/rules/stdlib.bzl @@ -49,5 +49,5 @@ stdlib = rule( }, doc = """stdlib builds the standard library for the target configuration or uses the precompiled standard library from the SDK if it is suitable.""", - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], ) diff --git a/go/private/rules/test.bzl b/go/private/rules/test.bzl index 2be0d076e7..14cea78654 100644 --- a/go/private/rules/test.bzl +++ b/go/private/rules/test.bzl @@ -441,7 +441,7 @@ _go_test_kwargs = { }, "executable": True, "test": True, - "toolchains": [str(GO_TOOLCHAIN)], + "toolchains": [GO_TOOLCHAIN], "doc": """This builds a set of tests that can be run with `bazel test`.

To run all tests in the workspace, and print output on failure (the equivalent of `go test ./...`), run
diff --git a/proto/def.bzl b/proto/def.bzl index c9f899dea7..93ce850915 100644 --- a/proto/def.bzl +++ b/proto/def.bzl @@ -77,7 +77,7 @@ _go_proto_aspect = aspect( "deps", "embed", ], - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], ) def _proto_library_to_source(_go, attr, source, merge): @@ -178,7 +178,7 @@ go_proto_library = rule( default = "@bazel_tools//tools/allowlists/function_transition_allowlist", ), }, - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], ) # go_proto_library is a rule that takes a proto_library (in the proto # attribute) and produces a go library for it. From c52e55dbbb78102034a772d26a9316c5c677b42f Mon Sep 17 00:00:00 2001 From: Nevena Kotlaja Date: Thu, 23 Nov 2023 17:07:47 +0100 Subject: [PATCH 3/4] Update GO_TOOLCHAIN string to Label and add toolchain param to one more action --- proto/compiler.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/compiler.bzl b/proto/compiler.bzl index 77c2052efb..b39028ee0b 100644 --- a/proto/compiler.bzl +++ b/proto/compiler.bzl @@ -218,7 +218,7 @@ _go_proto_compiler = rule( default = "//:go_context_data", ), }, - toolchains = [str(GO_TOOLCHAIN)], + toolchains = [GO_TOOLCHAIN], ) def go_proto_compiler(name, **kwargs): From b440f00f4dc29084ae24bd3a68e56e649d91d8d2 Mon Sep 17 00:00:00 2001 From: Nevena Kotlaja Date: Thu, 23 Nov 2023 19:04:54 +0100 Subject: [PATCH 4/4] Separate String and Label declaration of go toolchain --- extras/gomock.bzl | 4 ++-- go/private/actions/compilepkg.bzl | 4 ++-- go/private/actions/link.bzl | 4 ++-- go/private/actions/stdlib.bzl | 6 +++--- go/private/common.bzl | 3 ++- go/private/rules/test.bzl | 3 ++- proto/compiler.bzl | 3 ++- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/extras/gomock.bzl b/extras/gomock.bzl index 804b9bb9bf..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,7 +79,7 @@ def _gomock_source_impl(ctx): ctx.file.mockgen_tool, go_ctx.go, ], - toolchain = GO_TOOLCHAIN, + 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 a1b8c099f2..5e449d778a 100644 --- a/go/private/common.bzl +++ b/go/private/common.bzl @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -GO_TOOLCHAIN = str(Label("@io_bazel_rules_go//go:toolchain")) +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)