chore(update): also check for version string contains non-numeric characters
This commit is contained in:
+6
-2
@@ -131,8 +131,12 @@ func IsNewer(current, latest string) bool {
|
|||||||
|
|
||||||
// compare major.minor.patch
|
// compare major.minor.patch
|
||||||
for i := 0; i < len(cParts) && i < len(lParts); i++ {
|
for i := 0; i < len(cParts) && i < len(lParts); i++ {
|
||||||
cv, _ := strconv.Atoi(cParts[i])
|
// strip pre-release tags like -beta or -rc for numeric comparison
|
||||||
lv, _ := strconv.Atoi(lParts[i])
|
cClean := strings.Split(cParts[i], "-")[0]
|
||||||
|
lClean := strings.Split(lParts[i], "-")[0]
|
||||||
|
|
||||||
|
cv, _ := strconv.Atoi(cClean)
|
||||||
|
lv, _ := strconv.Atoi(lClean)
|
||||||
if lv > cv {
|
if lv > cv {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user