From f3343bf846626c7113bac64b87d51c9fecff7eac Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 24 Jan 2026 17:14:33 +0100 Subject: [PATCH 1/4] api/types: gofumpt Signed-off-by: Sebastiaan van Stijn --- api/types/network/hwaddr.go | 8 +++++--- api/types/network/port_test.go | 7 ++++--- vendor/github.com/moby/moby/api/types/network/hwaddr.go | 8 +++++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/api/types/network/hwaddr.go b/api/types/network/hwaddr.go index 9d0c2b4b62..b2a4dfb1a1 100644 --- a/api/types/network/hwaddr.go +++ b/api/types/network/hwaddr.go @@ -11,9 +11,11 @@ import ( // in the absence of go.dev/issue/29678. type HardwareAddr net.HardwareAddr -var _ encoding.TextMarshaler = (HardwareAddr)(nil) -var _ encoding.TextUnmarshaler = (*HardwareAddr)(nil) -var _ fmt.Stringer = (HardwareAddr)(nil) +var ( + _ encoding.TextMarshaler = (HardwareAddr)(nil) + _ encoding.TextUnmarshaler = (*HardwareAddr)(nil) + _ fmt.Stringer = (HardwareAddr)(nil) +) func (m *HardwareAddr) UnmarshalText(text []byte) error { if len(text) == 0 { diff --git a/api/types/network/port_test.go b/api/types/network/port_test.go index 981e54558c..692480e35c 100644 --- a/api/types/network/port_test.go +++ b/api/types/network/port_test.go @@ -14,8 +14,10 @@ type TestRanger interface { Range() PortRange } -var _ TestRanger = Port{} -var _ TestRanger = PortRange{} +var ( + _ TestRanger = Port{} + _ TestRanger = PortRange{} +) func TestPort(t *testing.T) { t.Run("Zero Value", func(t *testing.T) { @@ -344,7 +346,6 @@ func TestPortRange(t *testing.T) { in string portRange PortRange // output of ParsePortRange() and Range() str string // output of String(). If "", use in. - }{ // Zero port { diff --git a/vendor/github.com/moby/moby/api/types/network/hwaddr.go b/vendor/github.com/moby/moby/api/types/network/hwaddr.go index 9d0c2b4b62..b2a4dfb1a1 100644 --- a/vendor/github.com/moby/moby/api/types/network/hwaddr.go +++ b/vendor/github.com/moby/moby/api/types/network/hwaddr.go @@ -11,9 +11,11 @@ import ( // in the absence of go.dev/issue/29678. type HardwareAddr net.HardwareAddr -var _ encoding.TextMarshaler = (HardwareAddr)(nil) -var _ encoding.TextUnmarshaler = (*HardwareAddr)(nil) -var _ fmt.Stringer = (HardwareAddr)(nil) +var ( + _ encoding.TextMarshaler = (HardwareAddr)(nil) + _ encoding.TextUnmarshaler = (*HardwareAddr)(nil) + _ fmt.Stringer = (HardwareAddr)(nil) +) func (m *HardwareAddr) UnmarshalText(text []byte) error { if len(text) == 0 { From 5bde1565a67a61dbddd91e743e5f9f1d0c695310 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 24 Jan 2026 17:15:23 +0100 Subject: [PATCH 2/4] client: gofumpt Signed-off-by: Sebastiaan van Stijn --- client/container_exec.go | 6 ++---- client/container_resize.go | 4 +--- vendor/github.com/moby/moby/client/container_exec.go | 6 ++---- vendor/github.com/moby/moby/client/container_resize.go | 4 +--- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/client/container_exec.go b/client/container_exec.go index 953836423a..c3bf328585 100644 --- a/client/container_exec.go +++ b/client/container_exec.go @@ -82,8 +82,7 @@ type ExecStartOptions struct { } // ExecStartResult holds the result of starting a container exec. -type ExecStartResult struct { -} +type ExecStartResult struct{} // ExecStart starts an exec process already created in the docker host. func (cli *Client) ExecStart(ctx context.Context, execID string, options ExecStartOptions) (ExecStartResult, error) { @@ -160,8 +159,7 @@ func getConsoleSize(hasTTY bool, consoleSize ConsoleSize) (*[2]uint, error) { } // ExecInspectOptions holds options for inspecting a container exec. -type ExecInspectOptions struct { -} +type ExecInspectOptions struct{} // ExecInspectResult holds the result of inspecting a container exec. // diff --git a/client/container_resize.go b/client/container_resize.go index 311a9dcf5a..8ce26fb585 100644 --- a/client/container_resize.go +++ b/client/container_resize.go @@ -42,8 +42,7 @@ func (cli *Client) ContainerResize(ctx context.Context, containerID string, opti type ExecResizeOptions ContainerResizeOptions // ExecResizeResult holds the result of resizing a container exec TTY. -type ExecResizeResult struct { -} +type ExecResizeResult struct{} // ExecResize changes the size of the tty for an exec process running inside a container. func (cli *Client) ExecResize(ctx context.Context, execID string, options ExecResizeOptions) (ExecResizeResult, error) { @@ -62,5 +61,4 @@ func (cli *Client) ExecResize(ctx context.Context, execID string, options ExecRe return ExecResizeResult{}, err } return ExecResizeResult{}, nil - } diff --git a/vendor/github.com/moby/moby/client/container_exec.go b/vendor/github.com/moby/moby/client/container_exec.go index 953836423a..c3bf328585 100644 --- a/vendor/github.com/moby/moby/client/container_exec.go +++ b/vendor/github.com/moby/moby/client/container_exec.go @@ -82,8 +82,7 @@ type ExecStartOptions struct { } // ExecStartResult holds the result of starting a container exec. -type ExecStartResult struct { -} +type ExecStartResult struct{} // ExecStart starts an exec process already created in the docker host. func (cli *Client) ExecStart(ctx context.Context, execID string, options ExecStartOptions) (ExecStartResult, error) { @@ -160,8 +159,7 @@ func getConsoleSize(hasTTY bool, consoleSize ConsoleSize) (*[2]uint, error) { } // ExecInspectOptions holds options for inspecting a container exec. -type ExecInspectOptions struct { -} +type ExecInspectOptions struct{} // ExecInspectResult holds the result of inspecting a container exec. // diff --git a/vendor/github.com/moby/moby/client/container_resize.go b/vendor/github.com/moby/moby/client/container_resize.go index 311a9dcf5a..8ce26fb585 100644 --- a/vendor/github.com/moby/moby/client/container_resize.go +++ b/vendor/github.com/moby/moby/client/container_resize.go @@ -42,8 +42,7 @@ func (cli *Client) ContainerResize(ctx context.Context, containerID string, opti type ExecResizeOptions ContainerResizeOptions // ExecResizeResult holds the result of resizing a container exec TTY. -type ExecResizeResult struct { -} +type ExecResizeResult struct{} // ExecResize changes the size of the tty for an exec process running inside a container. func (cli *Client) ExecResize(ctx context.Context, execID string, options ExecResizeOptions) (ExecResizeResult, error) { @@ -62,5 +61,4 @@ func (cli *Client) ExecResize(ctx context.Context, execID string, options ExecRe return ExecResizeResult{}, err } return ExecResizeResult{}, nil - } From 17de27ffc20546406e40b6977d273b13854d62d5 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 24 Jan 2026 17:16:05 +0100 Subject: [PATCH 3/4] daemon: gofumpt Signed-off-by: Sebastiaan van Stijn --- daemon/builder/remotecontext/remote_test.go | 2 +- daemon/containerd/image_history.go | 4 +--- daemon/containerd/image_pull.go | 1 + daemon/containerd/platform_matchers_test.go | 1 + daemon/daemon.go | 1 - daemon/internal/builder-next/exporter/exporter.go | 6 ++++-- daemon/libnetwork/drivers/ipvlan/ipvlan_network.go | 2 +- daemon/libnetwork/drivers/macvlan/macvlan_network.go | 2 +- daemon/libnetwork/networkdb/debug.go | 2 +- daemon/libnetwork/networkdb/networkdb_property_test.go | 4 ++-- daemon/libnetwork/service_linux.go | 3 --- daemon/stats_unix.go | 1 - 12 files changed, 13 insertions(+), 16 deletions(-) diff --git a/daemon/builder/remotecontext/remote_test.go b/daemon/builder/remotecontext/remote_test.go index ddb9253ce1..0c430f0404 100644 --- a/daemon/builder/remotecontext/remote_test.go +++ b/daemon/builder/remotecontext/remote_test.go @@ -173,7 +173,7 @@ func TestUnknownContentLength(t *testing.T) { func TestDownloadRemote(t *testing.T) { contextDir := t.TempDir() - createTestTempFile(t, contextDir, builder.DefaultDockerfileName, dockerfileContents, 0644) + createTestTempFile(t, contextDir, builder.DefaultDockerfileName, dockerfileContents, 0o644) mux := http.NewServeMux() server := httptest.NewServer(mux) diff --git a/daemon/containerd/image_history.go b/daemon/containerd/image_history.go index bf1f154946..d4e06d0abc 100644 --- a/daemon/containerd/image_history.go +++ b/daemon/containerd/image_history.go @@ -44,9 +44,7 @@ func (i *ImageService) ImageHistory(ctx context.Context, name string, platform * return nil, err } - var ( - history []*imagetype.HistoryResponseItem - ) + var history []*imagetype.HistoryResponseItem s := i.client.SnapshotService(i.snapshotter) diffIDs := ociImage.RootFS.DiffIDs diff --git a/daemon/containerd/image_pull.go b/daemon/containerd/image_pull.go index fcb740fdee..0456504912 100644 --- a/daemon/containerd/image_pull.go +++ b/daemon/containerd/image_pull.go @@ -399,6 +399,7 @@ func newReferrersList() *referrersList { m: make(map[digest.Digest][]ocispec.Descriptor), } } + func (rl *referrersList) Get(dgst digest.Digest) ([]ocispec.Descriptor, bool) { rl.mu.RLock() defer rl.mu.RUnlock() diff --git a/daemon/containerd/platform_matchers_test.go b/daemon/containerd/platform_matchers_test.go index 4f96812110..df41b1cf95 100644 --- a/daemon/containerd/platform_matchers_test.go +++ b/daemon/containerd/platform_matchers_test.go @@ -168,6 +168,7 @@ func testOnlyAndOnlyStrict(t *testing.T, daemonPlatform platforms.MatchComparer, } }) } + func TestPlatformsWithPreferenceMatcher(t *testing.T) { platformList := []ocispec.Platform{ pLinuxAmd64, diff --git a/daemon/daemon.go b/daemon/daemon.go index ccfb9fc91a..a5bd3c9f78 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -658,7 +658,6 @@ func (daemon *Daemon) restore(ctx context.Context, cfg *configStore, containers if err := daemon.containerRm(&cfg.Config, cid, &backend.ContainerRmConfig{ForceRemove: true, RemoveVolume: true}); err != nil { log.G(ctx).WithField("container", cid).WithError(err).Error("failed to remove container") } - }(id, c) } group.Wait() diff --git a/daemon/internal/builder-next/exporter/exporter.go b/daemon/internal/builder-next/exporter/exporter.go index 644597530d..ab4016abf2 100644 --- a/daemon/internal/builder-next/exporter/exporter.go +++ b/daemon/internal/builder-next/exporter/exporter.go @@ -2,8 +2,10 @@ package exporter import "time" -const Moby = "moby" -const BuildRefLabel = "moby/build.ref." +const ( + Moby = "moby" + BuildRefLabel = "moby/build.ref." +) type BuildRefLabelValue struct { CreatedAt *time.Time `json:"createdAt,omitempty"` diff --git a/daemon/libnetwork/drivers/ipvlan/ipvlan_network.go b/daemon/libnetwork/drivers/ipvlan/ipvlan_network.go index 9619ac940a..bb62ed849f 100644 --- a/daemon/libnetwork/drivers/ipvlan/ipvlan_network.go +++ b/daemon/libnetwork/drivers/ipvlan/ipvlan_network.go @@ -172,7 +172,7 @@ func (d *driver) DeleteNetwork(nid string) error { // parseNetworkOptions parses docker network options func parseNetworkOptions(id string, option options.Generic) (*configuration, error) { - var config = &configuration{} + config := &configuration{} // parse generic labels first if genData, ok := option[netlabel.GenericData]; ok && genData != nil { diff --git a/daemon/libnetwork/drivers/macvlan/macvlan_network.go b/daemon/libnetwork/drivers/macvlan/macvlan_network.go index 1e2379a78e..50dbc566db 100644 --- a/daemon/libnetwork/drivers/macvlan/macvlan_network.go +++ b/daemon/libnetwork/drivers/macvlan/macvlan_network.go @@ -198,7 +198,7 @@ func (d *driver) DeleteNetwork(nid string) error { // parseNetworkOptions parses docker network options func parseNetworkOptions(id string, option options.Generic) (*configuration, error) { - var config = &configuration{} + config := &configuration{} // parse generic labels first if genData, ok := option[netlabel.GenericData]; ok && genData != nil { diff --git a/daemon/libnetwork/networkdb/debug.go b/daemon/libnetwork/networkdb/debug.go index 17bc831217..0628d5e5de 100644 --- a/daemon/libnetwork/networkdb/debug.go +++ b/daemon/libnetwork/networkdb/debug.go @@ -22,7 +22,7 @@ func logEncKeys(ctx context.Context, keys ...[]byte) { "path": klpath, }).Error("could not write to NetworkDB encryption-key log") } - f, err := os.OpenFile(klpath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600) + f, err := os.OpenFile(klpath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o600) if err != nil { die(err) return diff --git a/daemon/libnetwork/networkdb/networkdb_property_test.go b/daemon/libnetwork/networkdb/networkdb_property_test.go index 6a21722a89..7e3015670f 100644 --- a/daemon/libnetwork/networkdb/networkdb_property_test.go +++ b/daemon/libnetwork/networkdb/networkdb_property_test.go @@ -110,11 +110,11 @@ func testConvergence(t *rapid.T) { // Log the convergence time to disk for later statistical analysis. - if err := os.Mkdir("testdata", 0755); err != nil && !os.IsExist(err) { + if err := os.Mkdir("testdata", 0o755); err != nil && !os.IsExist(err) { t.Logf("Could not log convergence time to disk: failed to create testdata directory: %v", err) return } - f, err := os.OpenFile("testdata/convergence_time.csv", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644) + f, err := os.OpenFile("testdata/convergence_time.csv", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o644) if err != nil { t.Logf("Could not log convergence time to disk: failed to open file: %v", err) return diff --git a/daemon/libnetwork/service_linux.go b/daemon/libnetwork/service_linux.go index c0567d1a27..5a830233cc 100644 --- a/daemon/libnetwork/service_linux.go +++ b/daemon/libnetwork/service_linux.go @@ -450,7 +450,6 @@ func generateIngressRules(port *PortConfig, destIP net.IP) []iptables.Rule { } func programIngressPortsRules(gwIP net.IP, filteredPorts []*PortConfig) (portErr error) { - rollbackRules := make([]iptables.Rule, 0, len(filteredPorts)*3) defer func() { if portErr != nil { @@ -463,7 +462,6 @@ func programIngressPortsRules(gwIP net.IP, filteredPorts []*PortConfig) (portErr }() for _, iPort := range filteredPorts { - for _, rule := range generateIngressRules(iPort, gwIP) { if portErr = rule.Insert(); portErr != nil { err := fmt.Errorf("set up rule failed, %v: %v", rule, portErr) @@ -477,7 +475,6 @@ func programIngressPortsRules(gwIP net.IP, filteredPorts []*PortConfig) (portErr } func deleteIngressPortsRules(gwIP net.IP, filteredPorts []*PortConfig) error { - var portErr error for _, iPort := range filteredPorts { diff --git a/daemon/stats_unix.go b/daemon/stats_unix.go index bceb6c7b7e..75e9e2b31a 100644 --- a/daemon/stats_unix.go +++ b/daemon/stats_unix.go @@ -336,7 +336,6 @@ func readSystemCPUUsage(r io.Reader) (cpuUsage uint64, cpuNum uint32, _ error) { for { data, isPartial, err := rdr.ReadLine() - if err != nil { return 0, 0, fmt.Errorf("error scanning /proc/stat file: %w", err) } From 7b38ece1081b19a67639fd98050e037551c2a684 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 24 Jan 2026 17:16:15 +0100 Subject: [PATCH 4/4] integration: gofumpt Signed-off-by: Sebastiaan van Stijn --- integration/container/stop_test.go | 1 - integration/image/import_test.go | 1 - 2 files changed, 2 deletions(-) diff --git a/integration/container/stop_test.go b/integration/container/stop_test.go index a25eed2b0e..834f4f6274 100644 --- a/integration/container/stop_test.go +++ b/integration/container/stop_test.go @@ -152,7 +152,6 @@ func TestContainerAPIPostContainerStop(t *testing.T) { for _, tc := range tests { t.Run(tc.testName, func(t *testing.T) { - res, _, err := request.Post(ctx, "/containers/"+tc.id+"/stop") assert.Equal(t, res.StatusCode, tc.expStatusCode) diff --git a/integration/image/import_test.go b/integration/image/import_test.go index 53c76400bc..dbab6633e4 100644 --- a/integration/image/import_test.go +++ b/integration/image/import_test.go @@ -242,5 +242,4 @@ func TestImageImportBadSrc(t *testing.T) { assert.Check(t, tc.expectErr(err)) }) } - }