Skip to content

Commit fddfe63

Browse files
committed
modernize: fmtappendf
go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest modernize -fmtappendf -fix ./... Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 6d4b3b5 commit fddfe63

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

cli/compose/types/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ func (u UnitBytes) MarshalYAML() (any, error) {
351351

352352
// MarshalJSON makes UnitBytes implement json.Marshaler
353353
func (u UnitBytes) MarshalJSON() ([]byte, error) {
354-
return []byte(fmt.Sprintf(`"%d"`, u)), nil
354+
return fmt.Appendf(nil, `"%d"`, u), nil
355355
}
356356

357357
// RestartPolicy the service restart policy
@@ -561,7 +561,7 @@ func (e External) MarshalJSON() ([]byte, error) {
561561
if e.Name == "" {
562562
return []byte(strconv.FormatBool(e.External)), nil
563563
}
564-
return []byte(fmt.Sprintf(`{"name": %q}`, e.Name)), nil
564+
return fmt.Appendf(nil, `{"name": %q}`, e.Name), nil
565565
}
566566

567567
// CredentialSpecConfig for credential spec on Windows

cli/config/credentials/native_store_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ func (m *mockCommand) Output() ([]byte, error) {
7373
return []byte("program failed"), errCommandExited
7474
}
7575
case "list":
76-
return []byte(fmt.Sprintf(`{"%s": "%s", "%s": "%s"}`, validServerAddress, "foo", validServerAddress2, "<token>")), nil
76+
return fmt.Appendf(nil, `{"%s": "%s", "%s": "%s"}`, validServerAddress, "foo", validServerAddress2, "<token>"), nil
7777
}
7878

79-
return []byte(fmt.Sprintf("unknown argument %q with %q", m.arg, inS)), errCommandExited
79+
return fmt.Appendf(nil, "unknown argument %q with %q", m.arg, inS), errCommandExited
8080
}
8181

8282
// Input sets the input to send to a remote credentials helper.

0 commit comments

Comments
 (0)