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

Commit 2002876

Browse files
committed
fixup! internal/cmd/update.go: validate we can exec new binary
1 parent bcaac7b commit 2002876

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

internal/cmd/update.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,9 @@ func (u *updater) Run(ctx context.Context, force bool, coderURLArg string, versi
131131
currentVersion, err := semver.StrictNewVersion(u.versionF())
132132
if err != nil {
133133
clog.LogWarn("failed to determine current version of coder-cli", clog.Causef(err.Error()))
134-
} else {
135-
if currentVersion.Compare(desiredVersion) == 0 {
136-
clog.LogInfo("Up to date!")
137-
return nil
138-
}
134+
} else if currentVersion.Compare(desiredVersion) == 0 {
135+
clog.LogInfo("Up to date!")
136+
return nil
139137
}
140138

141139
if !force {

internal/cmd/update_test.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@ import (
2222
)
2323

2424
const (
25-
fakeExePathLinux = "/home/user/bin/coder"
26-
fakeUpdatedExePathLinux = "/home/user/bin/coder.new"
27-
fakeExePathWindows = `C:\Users\user\bin\coder.exe`
28-
fakeCoderURL = "https://my.cdr.dev"
29-
fakeNewVersion = "1.23.4-rc.5+678-gabcdef-12345678"
30-
fakeOldVersion = "1.22.4-rc.5+678-gabcdef-12345678"
31-
fakeReleaseURLLinux = "https://github.com/cdr/coder-cli/releases/download/v1.23.4-rc.5/coder-cli-linux-amd64.tar.gz"
32-
fakeReleaseURLWindows = "https://github.com/cdr/coder-cli/releases/download/v1.23.4-rc.5/coder-cli-windows-amd64.zip"
33-
goosWindows = "windows"
34-
goosLinux = "linux"
25+
fakeExePathLinux = "/home/user/bin/coder"
26+
fakeExePathWindows = `C:\Users\user\bin\coder.exe`
27+
fakeCoderURL = "https://my.cdr.dev"
28+
fakeNewVersion = "1.23.4-rc.5+678-gabcdef-12345678"
29+
fakeOldVersion = "1.22.4-rc.5+678-gabcdef-12345678"
30+
fakeReleaseURLLinux = "https://github.com/cdr/coder-cli/releases/download/v1.23.4-rc.5/coder-cli-linux-amd64.tar.gz"
31+
fakeReleaseURLWindows = "https://github.com/cdr/coder-cli/releases/download/v1.23.4-rc.5/coder-cli-windows-amd64.zip"
32+
goosWindows = "windows"
33+
goosLinux = "linux"
3534
)
3635

3736
var (

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