Skip to content

Commit 5a08e2b

Browse files
heschigopherbot
authored andcommitted
maintner/maintnerd/maintapi/version: allow .0 suffixes
Happily, the return values for 1.21 and 1.21.0 are the same, so I see no reason to worry about further impact. Just need to disable the now-unnecessary validation. For golang/go#57631 Change-Id: Ice467f993c1e5d304bd5b24fbc21bf4fa66fb4a4 Reviewed-on: https://go-review.googlesource.com/c/build/+/479556 Reviewed-by: Carlos Amedee <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Run-TryBot: Heschi Kreinick <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Heschi Kreinick <[email protected]>
1 parent 7566446 commit 5a08e2b

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

maintner/maintnerd/maintapi/version/version.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ func ParseTag(tagName string) (major, minor, patch int, ok bool) {
2525
if !strings.HasPrefix(tagName, prefix) {
2626
return 0, 0, 0, false
2727
}
28-
if strings.HasSuffix(tagName, ".0") {
29-
// Trailing zero version components must be omitted in Go tags,
30-
// so reject if we see one.
31-
return 0, 0, 0, false
32-
}
3328
v := strings.SplitN(tagName[len(prefix):], ".", 4)
3429
if len(v) > 3 {
3530
return 0, 0, 0, false

maintner/maintnerd/maintapi/version/version_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ func TestParseTag(t *testing.T) {
1818
}{
1919
{"go1", 1, 0, 0, true},
2020
{"go1.2", 1, 2, 0, true},
21+
{"go1.2.0", 1, 2, 0, true},
2122
{"go1.2.3", 1, 2, 3, true},
2223
{"go23.45.67", 23, 45, 67, true},
2324
{"not-go", 0, 0, 0, false},
@@ -38,9 +39,6 @@ func TestParseTag(t *testing.T) {
3839
{"go01", 0, 0, 0, false},
3940
{"go001", 0, 0, 0, false},
4041
{"go1000", 0, 0, 0, false},
41-
{"go1.0", 0, 0, 0, false},
42-
{"go1.0.0", 0, 0, 0, false},
43-
{"go1.2.0", 0, 0, 0, false},
4442
{"go00", 0, 0, 0, false},
4543
{"go00.2", 0, 0, 0, false},
4644
{"go00.2.3", 0, 0, 0, false},

0 commit comments

Comments
 (0)