Skip to content

Commit e554010

Browse files
committed
fix(update): Improve version comparison logic in checkUpdate for dev channel
1 parent 3b5012c commit e554010

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/sling/sling_update.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,13 @@ func checkUpdate() {
223223
if time.Now().Second()%4 != 0 && len(respMap) > 0 {
224224
updateVersion = respMap["version_latest"]
225225
if isDevChannel {
226-
if core.Version != updateVersion && updateVersion != "" {
226+
// convert to slash version for comparison
227+
parts := strings.Split(strings.TrimSuffix(core.Version, ")"), " (")
228+
if len(parts) != 2 {
229+
return
230+
}
231+
slashVersion := parts[0] + "/" + parts[1]
232+
if slashVersion != updateVersion && updateVersion != "" {
227233
updateMessage = env.GreenString(g.F("FYI there is a new sling dev build released => %s. You can run `sling update` to download it.", updateVersion))
228234
}
229235
} else {

0 commit comments

Comments
 (0)