Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak how we pass GOEXPERIMENT to actions #4022

Merged
merged 1 commit into from
Aug 11, 2024
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 @@ -62,9 +62,9 @@ go_sdk(
go_tool_binary(
name = "builder",
srcs = ["@io_bazel_rules_go//go/tools/builders:builder_srcs"],
exec_compatible_with = {exec_compatible_with},
ldflags = "-X main.rulesGoStdlibPrefix={}".format(RULES_GO_STDLIB_PREFIX),
sdk = ":go_sdk",
exec_compatible_with = {exec_compatible_with},
)

non_go_reset_target(
Expand Down
4 changes: 2 additions & 2 deletions go/private/context.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def _collect_cc_infos(deps, cdeps):
def _check_binary_dep(go, dep, edge):
"""Checks that this rule doesn't depend on a go_binary or go_test.

go_binary and go_test may return provides with useful information for other
go_binary and go_test may return providers with useful information for other
rules (like go_path), but go_binary and go_test may not depend on other
go_binary and go_binary targets. Their dependencies may be built in
different modes, resulting in conflicts and opaque errors.
Expand Down Expand Up @@ -483,7 +483,7 @@ def go_context(ctx, attr = None):
env = {
"GOARCH": mode.goarch,
"GOOS": mode.goos,
"GOEXPERIMENT": ",".join(toolchain.sdk.experiments),
"GOEXPERIMENT": toolchain.sdk.experiments,
"GOROOT": goroot,
"GOROOT_FINAL": "GOROOT",
"CGO_ENABLED": "0" if mode.pure else "1",
Expand Down
2 changes: 1 addition & 1 deletion go/private/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ GoSDK = provider(
fields = {
"goos": "The host OS the SDK was built for.",
"goarch": "The host architecture the SDK was built for.",
"experiments": "Go experiments to enable via GOEXPERIMENT.",
"experiments": "Comma-separated Go experiments to enable via GOEXPERIMENT.",
"root_file": "A file in the SDK root directory",
"libs": ("Depset of pre-compiled .a files for the standard library " +
"built for the execution platform."),
Expand Down
4 changes: 2 additions & 2 deletions go/private/rules/sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ go_sdk = rule(
mandatory = True,
doc = "The host architecture the SDK was built for",
),
"experiments": attr.string_list(
"experiments": attr.string(
mandatory = False,
doc = "Go experiments to enable via GOEXPERIMENT",
doc = "Comma-separated Go experiments to enable via GOEXPERIMENT",
),
"root_file": attr.label(
mandatory = True,
Expand Down
2 changes: 1 addition & 1 deletion go/private/sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ def _sdk_build_file(ctx, platform, version, experiments):
"{goarch}": goarch,
"{exe}": ".exe" if goos == "windows" else "",
"{version}": version,
"{experiments}": repr(experiments),
"{experiments}": repr(",".join(experiments)),
"{exec_compatible_with}": repr([
GOARCH_CONSTRAINTS[goarch],
GOOS_CONSTRAINTS[goos],
Expand Down