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

fix: conform to stricter printf usage in Go 1.24#16330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mafredri merged 1 commit intomainfrommafredri/fix-conform-to-go1-24-vet
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
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
2 changes: 1 addition & 1 deletionagent/agent_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -977,7 +977,7 @@ func TestAgent_FileTransferBlocked(t *testing.T) {
isErr := strings.Contains(errorMessage, agentssh.BlockedFileTransferErrorMessage) ||
strings.Contains(errorMessage, "EOF") ||
strings.Contains(errorMessage, "Process exited with status 65")
require.True(t, isErr,fmt.Sprintf("Message: "+errorMessage))
require.True(t, isErr, "Message: "+errorMessage)
}

t.Run("SFTP", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletioncli/gitssh.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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",
)
Expand Down
2 changes: 1 addition & 1 deletioncli/login.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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) {
Expand Down
2 changes: 1 addition & 1 deletioncli/logout.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
},
}
Expand Down
10 changes: 5 additions & 5 deletionscli/publickey.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
},
Expand Down
2 changes: 1 addition & 1 deletioncli/server.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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).
Expand Down
4 changes: 2 additions & 2 deletionscli/templateversionarchive.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
}
Expand All@@ -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())),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

OMG this is cursed.

mafredri reacted with laugh emoji
inv.Stdout, "Version "+pretty.Sprint(cliui.DefaultStyles.Keyword, version.Name)+" "+pastVerb+" at "+cliui.Timestamp(time.Now()),
)
}
return nil
Expand Down
4 changes: 2 additions & 2 deletionscoderd/healthcheck/workspaceproxy.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -100,9 +100,9 @@ func (r *WorkspaceProxyReport) Run(ctx context.Context, opts *WorkspaceProxyRepo
for _, err := range errs {
switch r.Severity {
case health.SeverityWarning, health.SeverityOK:
r.Warnings = append(r.Warnings, health.Messagef(health.CodeProxyUnhealthy, err))
r.Warnings = append(r.Warnings, health.Messagef(health.CodeProxyUnhealthy,"%s",err))
case health.SeverityError:
r.appendError(*health.Errorf(health.CodeProxyUnhealthy, err))
r.appendError(*health.Errorf(health.CodeProxyUnhealthy,"%s",err))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletionscoderd/httpapi/httpapi_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -143,15 +143,15 @@ func TestWebsocketCloseMsg(t *testing.T) {
t.Parallel()

msg := strings.Repeat("d", 255)
trunc := httpapi.WebsocketCloseSprintf(msg)
trunc := httpapi.WebsocketCloseSprintf("%s",msg)
assert.Equal(t, len(trunc), 123)
})

t.Run("TruncateMultiByteCharacters", func(t *testing.T) {
t.Parallel()

msg := strings.Repeat("こんにちは", 10)
trunc := httpapi.WebsocketCloseSprintf(msg)
trunc := httpapi.WebsocketCloseSprintf("%s",msg)
assert.Equal(t, len(trunc), 123)
})
}
2 changes: 1 addition & 1 deletionenterprise/cli/proxyserver.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -205,7 +205,7 @@ func (r *RootCmd) proxyServer() *serpent.Command {
httpClient.Transport = headerTransport

accessURL := cfg.AccessURL.String()
cliui.Infof(inv.Stdout, lipgloss.NewStyle().
cliui.Info(inv.Stdout, lipgloss.NewStyle().
Border(lipgloss.DoubleBorder()).
Align(lipgloss.Center).
Padding(0, 3).
Expand Down
7 changes: 3 additions & 4 deletionsprovisioner/terraform/provision.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -78,7 +78,7 @@ func (s *server) Plan(

e := s.executor(sess.WorkDirectory, database.ProvisionerJobTimingStagePlan)
if err := e.checkMinVersion(ctx); err != nil {
return provisionersdk.PlanErrorf(err.Error())
return provisionersdk.PlanErrorf("%s",err.Error())
}
logTerraformEnvVars(sess)

Expand DownExpand Up@@ -113,7 +113,6 @@ func (s *server) Plan(
initTimings.ingest(createInitTimingsEvent(timingInitStart))

err = e.init(ctx, killCtx, sess)

if err != nil {
initTimings.ingest(createInitTimingsEvent(timingInitErrored))

Expand DownExpand Up@@ -168,7 +167,7 @@ func (s *server) Plan(
request.Metadata.GetWorkspaceTransition() == proto.WorkspaceTransition_DESTROY,
)
if err != nil {
return provisionersdk.PlanErrorf(err.Error())
return provisionersdk.PlanErrorf("%s",err.Error())
}

// Prepend init timings since they occur prior to plan timings.
Expand All@@ -189,7 +188,7 @@ func (s *server) Apply(

e := s.executor(sess.WorkDirectory, database.ProvisionerJobTimingStageApply)
if err := e.checkMinVersion(ctx); err != nil {
return provisionersdk.ApplyErrorf(err.Error())
return provisionersdk.ApplyErrorf("%s",err.Error())
}
logTerraformEnvVars(sess)

Expand Down
1 change: 1 addition & 0 deletionspty/ptytest/ptytest.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -252,6 +252,7 @@ func (e *outExpecter) Peek(ctx context.Context, n int) []byte {
return slices.Clone(out)
}

//nolint:govet // We don't care about conforming to ReadRune() (rune, int, error).
func (e *outExpecter) ReadRune(ctx context.Context) rune {
e.t.Helper()

Expand Down
2 changes: 1 addition & 1 deletionvpn/tunnel.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -71,7 +71,7 @@ func NewTunnel(
return nil, err
}
t := &Tunnel{
//nolint:govet // safe to copy the locks here because we haven't started the speaker
//nolint:govet // safe to copy the locks here because we haven't started the speaker
speaker: *(s),
ctx: ctx,
logger: logger,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp