diff --git a/go/private/BUILD.sdk.bazel b/go/private/BUILD.sdk.bazel index 8e56c855f0..ffaf4e53ca 100644 --- a/go/private/BUILD.sdk.bazel +++ b/go/private/BUILD.sdk.bazel @@ -109,7 +109,7 @@ package_list( declare_go_toolchains( builder = ":builder_reset", - host_goos = "{goos}", + exec_goos = "{goos}", pack = ":pack_reset", sdk = ":go_sdk", ) diff --git a/go/private/go_toolchain.bzl b/go/private/go_toolchain.bzl index 92489eb127..e5619f9ec4 100644 --- a/go/private/go_toolchain.bzl +++ b/go/private/go_toolchain.bzl @@ -96,7 +96,7 @@ go_toolchain = rule( provides = [platform_common.ToolchainInfo], ) -def declare_go_toolchains(host_goos, sdk, builder, pack): +def declare_go_toolchains(exec_goos, sdk, builder, pack): """Declares go_toolchain targets for each platform.""" for p in PLATFORMS: if p.cgo: @@ -107,9 +107,9 @@ def declare_go_toolchains(host_goos, sdk, builder, pack): link_flags = [] cgo_link_flags = [] - if host_goos == "darwin": + if exec_goos == "darwin": cgo_link_flags.extend(["-shared", "-Wl,-all_load"]) - if host_goos == "linux": + elif exec_goos == "linux": cgo_link_flags.append("-Wl,-whole-archive") go_toolchain( @@ -128,8 +128,8 @@ def declare_go_toolchains(host_goos, sdk, builder, pack): def declare_bazel_toolchains( *, go_toolchain_repo, - host_goarch, - host_goos, + exec_goarch, + exec_goos, major, minor, patch, @@ -260,8 +260,8 @@ def declare_bazel_toolchains( name = prefix + "go_" + p.name, toolchain_type = GO_TOOLCHAIN, exec_compatible_with = [ - "@io_bazel_rules_go//go/toolchain:" + host_goos, - "@io_bazel_rules_go//go/toolchain:" + host_goarch, + "@io_bazel_rules_go//go/toolchain:" + exec_goos, + "@io_bazel_rules_go//go/toolchain:" + exec_goarch, ], target_compatible_with = constraints, target_settings = [ diff --git a/go/private/sdk.bzl b/go/private/sdk.bzl index cda5d42cac..5200c4560e 100644 --- a/go/private/sdk.bzl +++ b/go/private/sdk.bzl @@ -211,8 +211,8 @@ def go_toolchains_single_definition(ctx, *, prefix, goos, goarch, sdk_repo, sdk_ chunks.append("""declare_bazel_toolchains( prefix = "{prefix}", go_toolchain_repo = "@{sdk_repo}", - host_goarch = "{goarch}", - host_goos = "{goos}", + exec_goarch = "{goarch}", + exec_goos = "{goos}", major = {identifier_prefix}MAJOR_VERSION, minor = {identifier_prefix}MINOR_VERSION, patch = {identifier_prefix}PATCH_VERSION, diff --git a/tests/core/starlark/sdk_tests.bzl b/tests/core/starlark/sdk_tests.bzl index fbc671dfe9..a68449cd79 100644 --- a/tests/core/starlark/sdk_tests.bzl +++ b/tests/core/starlark/sdk_tests.bzl @@ -24,8 +24,8 @@ _123_PREFIX_PRERELEASE_SUFFIX = "rc1" """declare_bazel_toolchains( prefix = "123_prefix_", go_toolchain_repo = "@sdk_repo", - host_goarch = "amd64", - host_goos = "linux", + exec_goarch = "amd64", + exec_goos = "linux", major = _123_PREFIX_MAJOR_VERSION, minor = _123_PREFIX_MINOR_VERSION, patch = _123_PREFIX_PATCH_VERSION, @@ -64,8 +64,8 @@ def _go_toolchains_single_definition_without_version_test(ctx): """declare_bazel_toolchains( prefix = "123_prefix_", go_toolchain_repo = "@sdk_repo", - host_goarch = "amd64", - host_goos = "linux", + exec_goarch = "amd64", + exec_goos = "linux", major = _123_PREFIX_MAJOR_VERSION, minor = _123_PREFIX_MINOR_VERSION, patch = _123_PREFIX_PATCH_VERSION,