fix formatting strings for go1.26

These started producing an error with go1.26;

    daemon/builder/dockerfile/dispatchers.go:478:65: fmt.Sprintf format %q has arg runConfig.Healthcheck of wrong type *github.com/moby/moby/api/types/container.HealthConfig
    daemon/daemon_test.go:291:23: (*testing.common).Fatalf format %q has arg 0 of wrong type int
    daemon/internal/streamformatter/streamformatter.go:97:44: non-constant format string in call to (github.com/moby/moby/v2/daemon/internal/streamformatter.formatProgress).formatStatus
    internal/testutil/daemon/daemon.go:814:128: (github.com/moby/moby/v2/internal/testutil/daemon.LogT).Logf format %d reads arg #3, but call has 2 args

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn committed 2026-04-21 15:59:27 +02:00
1 parent 8f8a089714
commit 5d143db66b
4 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -471,11 +471,11 @@ func dispatchHealthcheck(ctx context.Context, d dispatchRequest, c *instructions
if runConfig.Healthcheck != nil {
oldCmd := runConfig.Healthcheck.Test
if len(oldCmd) > 0 && oldCmd[0] != "NONE" {
fmt.Fprintf(d.builder.Stdout, "Note: overriding previous HEALTHCHECK: %v\n", oldCmd)
fmt.Fprintf(d.builder.Stdout, "Note: overriding previous HEALTHCHECK: %+v\n", oldCmd)
}
}
runConfig.Healthcheck = c.Health
return d.builder.commit(ctx, d.state, fmt.Sprintf("HEALTHCHECK %q", runConfig.Healthcheck))
return d.builder.commit(ctx, d.state, fmt.Sprintf("HEALTHCHECK %+v", runConfig.Healthcheck))
}
// ENTRYPOINT /usr/sbin/nginx
+1 -1
View File
@@ -288,7 +288,7 @@ func TestMerge(t *testing.T) {
}
for portSpecs := range configUser.ExposedPorts {
if portSpecs.Num() != 0 && portSpecs.Num() != 1111 && portSpecs.Num() != 2222 && portSpecs.Num() != 3333 {
t.Fatalf("Expected %q or %q or %q or %q, found %s", 0, 1111, 2222, 3333, portSpecs)
t.Fatalf("Expected %d or %d or %d or %d, found %d", 0, 1111, 2222, 3333, portSpecs)
}
}
}
@@ -94,7 +94,7 @@ type progressOutput struct {
func (out *progressOutput) WriteProgress(prog progress.Progress) error {
var formatted []byte
if prog.Message != "" {
formatted = out.sf.formatStatus(prog.ID, prog.Message)
formatted = out.sf.formatStatus(prog.ID, "%s", prog.Message)
} else {
jsonProgress := jsonstream.Progress{
Current: prog.Current,
+1 -1
View File
@@ -811,7 +811,7 @@ out2:
d.log.Logf("[%s] tried to interrupt daemon for %d times, now try to kill it", d.id, i)
break out2
}
d.log.Logf("[%d] attempt #%d/5: daemon is still running with pid %d", i, d.cmd.Process.Pid)
d.log.Logf("[%s] attempt #%d/5: daemon is still running with pid %d", d.id, i, d.cmd.Process.Pid)
if err := d.cmd.Process.Signal(os.Interrupt); err != nil {
return errors.Wrapf(err, "[%s] attempt #%d/5 could not send signal", d.id, i)
}