gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/tools/rules_go_sdk.patch (about)

     1  diff --git a/go/private/sdk.bzl b/go/private/sdk.bzl
     2  --- a/go/private/sdk.bzl
     3  +++ b/go/private/sdk.bzl
     4  @@ -128,6 +128,8 @@ def _go_download_sdk_impl(ctx):
     5               "sdks": ctx.attr.sdks,
     6               "urls": ctx.attr.urls,
     7               "version": version,
     8  +            "patch": ctx.attr.patch,
     9  +            "patch_strip": ctx.attr.patch_strip,
    10               "strip_prefix": ctx.attr.strip_prefix,
    11           }
    12       return None
    13  @@ -143,6 +145,7 @@ go_download_sdk_rule = repository_rule(
    14           ),
    15           "urls": attr.string_list(default = ["https://dl.google.com/go/{}"]),
    16           "version": attr.string(),
    17  +        "patch": attr.label(default = None),
    18           "strip_prefix": attr.string(default = "go"),
    19           "patches": attr.label_list(
    20               doc = "A list of patches to apply to the SDK after downloading it",
    21  @@ -453,6 +456,8 @@ def _remote_sdk(ctx, urls, strip_prefix, sha256):
    22           res = ctx.execute(["tar", "-xf", "go_sdk.tar.gz", "--strip-components=1"])
    23           if res.return_code:
    24               fail("error extracting Go SDK:\n" + res.stdout + res.stderr)
    25  +        if ctx.attr.patch:
    26  +            ctx.patch(ctx.attr.patch, strip=ctx.attr.patch_strip)
    27           ctx.delete("go_sdk.tar.gz")
    28       elif (urls[0].endswith(".zip") and
    29             host_goos != "windows" and