Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Improve version warning log#206

Merged
cmoog merged 3 commits intomasterfromimprove-warning-error
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from1 commit
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
PrevPrevious commit
NextNext commit
fixup! fix: improve API version mismatch error and show after login
  • Loading branch information
@cmoog
cmoog committedDec 17, 2020
commitfc953d07636e3571425ddcc25f2012016ca98be0
16 changes: 10 additions & 6 deletionsinternal/cmd/auth.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,12 +54,7 @@ func newClient(ctx context.Context) (*coder.Client, error) {

apiVersion, err := c.APIVersion(ctx)
if apiVersion != "" && !version.VersionsMatch(apiVersion) {
clog.LogWarn(
"version mismatch detected",
fmt.Sprintf("Coder CLI version: %s", version.Version),
fmt.Sprintf("Coder API version: %s", apiVersion), clog.BlankLine,
clog.Tipf("download the appropriate version here: https://github.com/cdr/coder-cli/releases"),
)
logVersionMismatchError(apiVersion)
}
if err != nil {
var he *coder.HTTPError
Expand All@@ -73,3 +68,12 @@ func newClient(ctx context.Context) (*coder.Client, error) {

return c, nil
}

func logVersionMismatchError(apiVersion string) {
clog.LogWarn(
"version mismatch detected",
fmt.Sprintf("Coder CLI version: %s", version.Version),
fmt.Sprintf("Coder API version: %s", apiVersion), clog.BlankLine,
clog.Tipf("download the appropriate version here: https://github.com/cdr/coder-cli/releases"),
)
}
7 changes: 1 addition & 6 deletionsinternal/cmd/login.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,12 +67,7 @@ func pingAPI(ctx context.Context, envURL *url.URL, token string) error {
client := &coder.Client{BaseURL: envURL, Token: token}
if apiVersion, err := client.APIVersion(ctx); err == nil {
if apiVersion != "" && !version.VersionsMatch(apiVersion) {
clog.LogWarn(
"version mismatch detected",
fmt.Sprintf("Coder CLI version: %s", version.Version),
fmt.Sprintf("Coder API version: %s", apiVersion), clog.BlankLine,
clog.Tipf("download the appropriate version here: https://github.com/cdr/coder-cli/releases"),
)
logVersionMismatchError(apiVersion)
}
}
_, err := client.Me(ctx)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp