Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 416d237

Browse files
authored
Fix version warning parse logic (#172)
1 parent 6fd4ea9 commit 416d237

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

internal/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ func VersionsMatch(apiVersion string) bool {
1313
if len(withoutPatchRelease) < 3 {
1414
return false
1515
}
16-
majorMinor := strings.Join(withoutPatchRelease[:len(withoutPatchRelease)-1], ".")
16+
majorMinor := strings.Join(withoutPatchRelease[:2], ".")
1717
return strings.HasPrefix(strings.TrimPrefix(apiVersion, "v"), strings.TrimPrefix(majorMinor, "v"))
1818
}

internal/version/version_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ func TestVersion(t *testing.T) {
2626
Version = "1.15.4"
2727
match = VersionsMatch("v2.15.2")
2828
assert.True(t, "versions do not match", !match)
29+
30+
Version = "1.12.2+cli.rc1"
31+
match = VersionsMatch("v1.12.9")
32+
assert.True(t, "versions do match", match)
2933
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy