From c04c4eed18ad416c361640f47c8e075e0969e6a8 Mon Sep 17 00:00:00 2001 From: Matt Clarkson Date: Sat, 24 Feb 2024 19:45:28 +0000 Subject: [PATCH] Remove Latin-1 workaround on Bazel 6.4.0+ The fix for Latin-1 encoded files was landed in [6.4.0] after being landed on Bazel [master]. We can conditionally use the old, unhermetic, `tar` workaround on modern Bazel versions. [master]: https://github.com/bazelbuild/bazel/pull/18448 [6.4.0]: https://github.com/bazelbuild/bazel/pull/19765 --- go/private/sdk.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/go/private/sdk.bzl b/go/private/sdk.bzl index 308891af38..1294d62785 100644 --- a/go/private/sdk.bzl +++ b/go/private/sdk.bzl @@ -441,7 +441,10 @@ def _remote_sdk(ctx, urls, strip_prefix, sha256): # in Bazel 6.0.0+ (bazelbuild/bazel#16052). The only situation where # .zip files are needed seems to be a macOS host using a Windows toolchain # for remote execution. - if urls[0].endswith(".tar.gz"): + if (urls[0].endswith(".tar.gz") and + # Development versions of Bazel have an empty version string. We assume that they are + # more recent than the version that introduced the fix. + not versions.is_at_least("6.4.0", versions.get() or "6.4.0")): if strip_prefix != "go": fail("strip_prefix not supported") ctx.download(