Skip to content

Commit 9214edc

Browse files
authored
Remove usage of _flatten_possibly_transitioned_attr in common case (#4060)
**What type of PR is this?** Starlark cleanup **What does this PR do? Why is it needed?** Making the caller deal with a transitioned attribute is cleaner and will be necessary for proper starlark typing anyway **Which issues(s) does this PR fix?** Fixes # **Other notes for review**
1 parent 2941f53 commit 9214edc

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

go/private/context.bzl

+1-2
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,8 @@ def go_context(
410410
if hasattr(attr, "_go_config"):
411411
go_config_info = attr._go_config[GoConfigInfo]
412412
if hasattr(attr, "_stdlib"):
413-
stdlib = _flatten_possibly_transitioned_attr(attr._stdlib)[GoStdLib]
413+
stdlib = attr._stdlib[GoStdLib]
414414
else:
415-
go_context_data = _flatten_possibly_transitioned_attr(go_context_data)
416415
if CgoContextInfo in go_context_data:
417416
cgo_context_info = go_context_data[CgoContextInfo]
418417
go_config_info = go_context_data[GoConfigInfo]

go/private/rules/binary.bzl

+2-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ def _go_binary_impl(ctx):
120120
include_deprecated_properties = False,
121121
importpath = ctx.attr.importpath,
122122
embed = ctx.attr.embed,
123-
go_context_data = ctx.attr._go_context_data,
123+
# It's a list because it is transitioned.
124+
go_context_data = ctx.attr._go_context_data[0],
124125
)
125126

126127
is_main = go.mode.link not in (LINKMODE_SHARED, LINKMODE_PLUGIN)

go/private/rules/test.bzl

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ def _go_test_impl(ctx):
6161
include_deprecated_properties = False,
6262
importpath = ctx.attr.importpath,
6363
embed = ctx.attr.embed,
64-
go_context_data = ctx.attr._go_context_data,
64+
# It's a list because it is transitioned.
65+
go_context_data = ctx.attr._go_context_data[0],
6566
)
6667

6768
# Compile the library to test with internal white box tests

0 commit comments

Comments
 (0)