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

Fix version warning parse logic #172

Merged
merged 3 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ func VersionsMatch(apiVersion string) bool {
if len(withoutPatchRelease) < 3 {
return false
}
majorMinor := strings.Join(withoutPatchRelease[:len(withoutPatchRelease)-1], ".")
majorMinor := strings.Join(withoutPatchRelease[:2], ".")
return strings.HasPrefix(strings.TrimPrefix(apiVersion, "v"), strings.TrimPrefix(majorMinor, "v"))
}
4 changes: 4 additions & 0 deletions internal/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ func TestVersion(t *testing.T) {
Version = "1.15.4"
match = VersionsMatch("v2.15.2")
assert.True(t, "versions do not match", !match)

Version = "1.12.2+cli.rc1"
match = VersionsMatch("v1.12.9")
assert.True(t, "versions do match", match)
}