mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: conform to stricter printf usage in Go 1.24 (#16330)
This commit is contained in:
+1
-1
@@ -91,7 +91,7 @@ func (r *RootCmd) gitssh() *serpent.Command {
|
||||
if xerrors.As(err, &exitErr) && exitErr.ExitCode() == 255 {
|
||||
_, _ = fmt.Fprintln(inv.Stderr,
|
||||
"\n"+pretty.Sprintf(
|
||||
cliui.DefaultStyles.Wrap,
|
||||
cliui.DefaultStyles.Wrap, "%s",
|
||||
"Coder authenticates with "+pretty.Sprint(cliui.DefaultStyles.Field, "git")+
|
||||
" using the public key below. All clones with SSH are authenticated automatically 🪄.")+"\n",
|
||||
)
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ func (r *RootCmd) login() *serpent.Command {
|
||||
|
||||
// nolint: nestif
|
||||
if !hasFirstUser {
|
||||
_, _ = fmt.Fprintf(inv.Stdout, Caret+"Your Coder deployment hasn't been set up!\n")
|
||||
_, _ = fmt.Fprint(inv.Stdout, Caret+"Your Coder deployment hasn't been set up!\n")
|
||||
|
||||
if username == "" {
|
||||
if !isTTYIn(inv) {
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ func (r *RootCmd) logout() *serpent.Command {
|
||||
errorString := strings.TrimRight(errorStringBuilder.String(), "\n")
|
||||
return xerrors.New("Failed to log out.\n" + errorString)
|
||||
}
|
||||
_, _ = fmt.Fprintf(inv.Stdout, Caret+"You are no longer logged in. You can log in using 'coder login <url>'.\n")
|
||||
_, _ = fmt.Fprint(inv.Stdout, Caret+"You are no longer logged in. You can log in using 'coder login <url>'.\n")
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
+5
-5
@@ -45,14 +45,14 @@ func (r *RootCmd) publickey() *serpent.Command {
|
||||
return xerrors.Errorf("create codersdk client: %w", err)
|
||||
}
|
||||
|
||||
cliui.Infof(inv.Stdout,
|
||||
cliui.Info(inv.Stdout,
|
||||
"This is your public key for using "+pretty.Sprint(cliui.DefaultStyles.Field, "git")+" in "+
|
||||
"Coder. All clones with SSH will be authenticated automatically 🪄.",
|
||||
)
|
||||
cliui.Infof(inv.Stdout, pretty.Sprint(cliui.DefaultStyles.Code, strings.TrimSpace(key.PublicKey))+"\n")
|
||||
cliui.Infof(inv.Stdout, "Add to GitHub and GitLab:")
|
||||
cliui.Infof(inv.Stdout, "> https://github.com/settings/ssh/new")
|
||||
cliui.Infof(inv.Stdout, "> https://gitlab.com/-/profile/keys")
|
||||
cliui.Info(inv.Stdout, pretty.Sprint(cliui.DefaultStyles.Code, strings.TrimSpace(key.PublicKey))+"\n")
|
||||
cliui.Info(inv.Stdout, "Add to GitHub and GitLab:")
|
||||
cliui.Info(inv.Stdout, "> https://github.com/settings/ssh/new")
|
||||
cliui.Info(inv.Stdout, "> https://gitlab.com/-/profile/keys")
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
+1
-1
@@ -513,7 +513,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
|
||||
}
|
||||
|
||||
accessURL := vals.AccessURL.String()
|
||||
cliui.Infof(inv.Stdout, lipgloss.NewStyle().
|
||||
cliui.Info(inv.Stdout, lipgloss.NewStyle().
|
||||
Border(lipgloss.DoubleBorder()).
|
||||
Align(lipgloss.Center).
|
||||
Padding(0, 3).
|
||||
|
||||
@@ -76,7 +76,7 @@ func (r *RootCmd) setArchiveTemplateVersion(archive bool) *serpent.Command {
|
||||
for _, version := range versions {
|
||||
if version.Archived == archive {
|
||||
_, _ = fmt.Fprintln(
|
||||
inv.Stdout, fmt.Sprintf("Version "+pretty.Sprint(cliui.DefaultStyles.Keyword, version.Name)+" already "+pastVerb),
|
||||
inv.Stdout, "Version "+pretty.Sprint(cliui.DefaultStyles.Keyword, version.Name)+" already "+pastVerb,
|
||||
)
|
||||
continue
|
||||
}
|
||||
@@ -87,7 +87,7 @@ func (r *RootCmd) setArchiveTemplateVersion(archive bool) *serpent.Command {
|
||||
}
|
||||
|
||||
_, _ = fmt.Fprintln(
|
||||
inv.Stdout, fmt.Sprintf("Version "+pretty.Sprint(cliui.DefaultStyles.Keyword, version.Name)+" "+pastVerb+" at "+cliui.Timestamp(time.Now())),
|
||||
inv.Stdout, "Version "+pretty.Sprint(cliui.DefaultStyles.Keyword, version.Name)+" "+pastVerb+" at "+cliui.Timestamp(time.Now()),
|
||||
)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user