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

+1-1
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

+4
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)