From f0f268573f03fcc7f5f9dfde601efee85d86210b Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Tue, 9 Jan 2024 10:34:38 +0000 Subject: [PATCH] Handle prerelease versions in polyfill (#3821) Currently this fails on versions like `8.0.0-pre.20231030.2`. --- go/private/polyfill_bazel_features.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/private/polyfill_bazel_features.bzl b/go/private/polyfill_bazel_features.bzl index ce67744743..9d3c9203aa 100644 --- a/go/private/polyfill_bazel_features.bzl +++ b/go/private/polyfill_bazel_features.bzl @@ -14,7 +14,7 @@ _POLYFILL_BAZEL_FEATURES = """bazel_features = struct( def _polyfill_bazel_features_impl(rctx): # An empty string is treated as a "dev version", which is greater than anything. bazel_version = native.bazel_version or "999999.999999.999999" - version_parts = bazel_version.split(".") + version_parts = bazel_version.split("-")[0].split(".") if len(version_parts) != 3: fail("invalid Bazel version '{}': got {} dot-separated segments, want 3".format(bazel_version, len(version_parts))) major_version_int = int(version_parts[0])