1
0
mirror of https://github.com/docker/cli.git synced 2026-10-31 11:35:26 +03:00

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>
This commit is contained in:
Sebastiaan van Stijn
2026-02-11 13:38:38 +01:00
parent 6d4b3b5f66
commit fddfe63ef9
2 changed files with 4 additions and 4 deletions

View File

@@ -351,7 +351,7 @@ func (u UnitBytes) MarshalYAML() (any, error) {
// MarshalJSON makes UnitBytes implement json.Marshaler
func (u UnitBytes) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%d"`, u)), nil
return fmt.Appendf(nil, `"%d"`, u), nil
}
// RestartPolicy the service restart policy
@@ -561,7 +561,7 @@ func (e External) MarshalJSON() ([]byte, error) {
if e.Name == "" {
return []byte(strconv.FormatBool(e.External)), nil
}
return []byte(fmt.Sprintf(`{"name": %q}`, e.Name)), nil
return fmt.Appendf(nil, `{"name": %q}`, e.Name), nil
}
// CredentialSpecConfig for credential spec on Windows

View File

@@ -73,10 +73,10 @@ func (m *mockCommand) Output() ([]byte, error) {
return []byte("program failed"), errCommandExited
}
case "list":
return []byte(fmt.Sprintf(`{"%s": "%s", "%s": "%s"}`, validServerAddress, "foo", validServerAddress2, "<token>")), nil
return fmt.Appendf(nil, `{"%s": "%s", "%s": "%s"}`, validServerAddress, "foo", validServerAddress2, "<token>"), nil
}
return []byte(fmt.Sprintf("unknown argument %q with %q", m.arg, inS)), errCommandExited
return fmt.Appendf(nil, "unknown argument %q with %q", m.arg, inS), errCommandExited
}
// Input sets the input to send to a remote credentials helper.