Skip to content

Commit 8e702d8

Browse files
kylecarbsmafredri
andauthored
fix: improve the warning mismatch to display the release assets on windows (coder#5418)
* fix: improve the warning mismatch to display the release assets on windows Fixes coder#4226. * Update cli/root.go Co-authored-by: Mathias Fredriksson <mafredri@gmail.com> * Update cli/root.go Co-authored-by: Mathias Fredriksson <mafredri@gmail.com> Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
1 parent b103685 commit 8e702d8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cli/root.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"net/http"
99
"net/url"
1010
"os"
11+
"runtime"
1112
"strings"
1213
"text/template"
1314
"time"
@@ -583,12 +584,17 @@ func checkVersions(cmd *cobra.Command, client *codersdk.Client) error {
583584
}
584585

585586
fmtWarningText := `version mismatch: client %s, server %s
586-
download the server version with: 'curl -L https://coder.com/install.sh | sh -s -- --version %s'
587587
`
588+
// Our installation script doesn't work on Windows, so instead we direct the user
589+
// to the GitHub release page to download the latest installer.
590+
if runtime.GOOS == "windows" {
591+
fmtWarningText += `download the server version from: https://github.com/coder/coder/releases/v%s`
592+
} else {
593+
fmtWarningText += `download the server version with: 'curl -L https://coder.com/install.sh | sh -s -- --version %s'`
594+
}
588595

589596
if !buildinfo.VersionsMatch(clientVersion, info.Version) {
590597
warn := cliui.Styles.Warn.Copy().Align(lipgloss.Left)
591-
// Trim the leading 'v', our install.sh script does not handle this case well.
592598
_, _ = fmt.Fprintf(cmd.ErrOrStderr(), warn.Render(fmtWarningText), clientVersion, info.Version, strings.TrimPrefix(info.CanonicalVersion(), "v"))
593599
_, _ = fmt.Fprintln(cmd.ErrOrStderr())
594600
}

0 commit comments

Comments
 (0)