Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion go/private/BUILD.sdk.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ package_list(

declare_go_toolchains(
builder = ":builder_reset",
host_goos = "{goos}",
exec_goos = "{goos}",
pack = ":pack_reset",
sdk = ":go_sdk",
)
Expand Down
14 changes: 7 additions & 7 deletions go/private/go_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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(
Expand All @@ -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,
Expand Down Expand Up @@ -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 = [
Expand Down
4 changes: 2 additions & 2 deletions go/private/sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions tests/core/starlark/sdk_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Loading