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
11 changes: 9 additions & 2 deletions go/private/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,20 @@ Uses the same format as 'visibility', i.e., every entry must be a label that end
},
)

# string_keyed_label_dict was added in 8.0.0
_maybe_string_keyed_label_dict = getattr(
attr,
"string_keyed_label_dict",
attr.string_dict,
)

_wrap_tag = tag_class(
attrs = {
"root_file": attr.label(
mandatory = False,
doc = "A file in the SDK root directory. Use to determine GOROOT.",
),
"root_files": attr.string_dict(
"root_files": _maybe_string_keyed_label_dict(
mandatory = False,
doc = "A set of mappings from the host platform to a file in the SDK's root directory.",
),
Expand Down Expand Up @@ -234,7 +241,7 @@ def _go_sdk_impl(ctx):
if key not in ["go_mod"]
}
download_tag["version"] = version
additional_download_tags += [struct(**download_tag)]
additional_download_tags.append(struct(**download_tag))

for index, download_tag in enumerate(module.tags.download + additional_download_tags):
# SDKs without an explicit version are fetched even when not selected by toolchain
Expand Down
8 changes: 7 additions & 1 deletion go/private/sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,20 @@ def _go_wrap_sdk_impl(ctx):
_sdk_build_file(ctx, platform, version, ctx.attr.experiments)
_local_sdk(ctx, goroot)

# string_keyed_label_dict was added in 8.0.0
_maybe_string_keyed_label_dict = getattr(
attr,
"string_keyed_label_dict",
attr.string_dict,
)
go_wrap_sdk_rule = repository_rule(
implementation = _go_wrap_sdk_impl,
attrs = {
"root_file": attr.label(
mandatory = False,
doc = "A file in the SDK root direcotry. Used to determine GOROOT.",
),
"root_files": attr.string_dict(
"root_files": _maybe_string_keyed_label_dict(
mandatory = False,
doc = "A set of mappings from the host platform to a file in the SDK's root directory",
),
Expand Down