Skip to content

Commit eb5b369

Browse files
committed
Support matching release candidate toolchain versions
Release candidate versions are of the format `X.YrcZ`. (ex: golang/go@30b6fd6) Unfortunately, this format doesn't get matched properly in `go_toolchain.bzl` so it's not possible to use rc versions without patching `VERSION`, or you'll run into the error, for e.g., with the added test case: ``` no matching toolchains found for types @io_bazel_rules_go//go:toolchain ``` This PR adds a way to match `rc` versions for the toolchain.
1 parent fb3afab commit eb5b369

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

go/private/go_toolchain.bzl

+9
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ def declare_bazel_toolchains(
170170
visibility = ["//visibility:private"],
171171
)
172172

173+
native.config_setting(
174+
name = prefix + "match_minor_release_candidate",
175+
flag_values = {
176+
sdk_version_label: major + "." + minor + prerelease,
177+
},
178+
visibility = ["//visibility:private"],
179+
)
180+
173181
native.config_setting(
174182
name = prefix + "match_sdk_type",
175183
flag_values = {
@@ -186,6 +194,7 @@ def declare_bazel_toolchains(
186194
":" + prefix + "match_major_minor_version",
187195
":" + prefix + "match_patch_version",
188196
":" + prefix + "match_prerelease_version",
197+
":" + prefix + "match_minor_release_candidate",
189198
":" + prefix + "match_sdk_type",
190199
],
191200
visibility = ["//visibility:private"],

tests/core/cross/sdk_version_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ var testCases = []testcase{
5353
SDKVersion: "1.17.1",
5454
expectedVersion: "go1.17.1",
5555
},
56+
{
57+
Name: "1_23_release_candidate",
58+
SDKVersion: "1.23rc1",
59+
expectedVersion: "go1.23rc1",
60+
},
5661
}
5762

5863
func TestMain(m *testing.M) {

0 commit comments

Comments
 (0)