From e0b1ab68fe171306ee02854f04e1914050a26638 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 4 Nov 2025 13:56:23 +0100 Subject: [PATCH] cli/command/container: fix use of generics This was introduced in dad1d367c8fb0165d36bd2f2210d1ef0803f33d5, which did not add a `//go:build` constraint to enable the use of generics (`any`). Which causes an error when used; could not import github.com/docker/cli/cli/command/container (-: # github.com/docker/cli/cli/command/container /Users/thajeztah/go/pkg/mod/github.com/docker/cli@v29.0.0-rc.2+incompatible/cli/command/container/stats.go:148:39: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod) Signed-off-by: Sebastiaan van Stijn --- cli/command/container/stats.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cli/command/container/stats.go b/cli/command/container/stats.go index 39f7e87180..ae8cfb465f 100644 --- a/cli/command/container/stats.go +++ b/cli/command/container/stats.go @@ -145,7 +145,7 @@ func RunStats(ctx context.Context, dockerCLI command.Cli, options *StatsOptions) eh.setHandler(events.ActionCreate, func(e events.Message) { if s := NewStats(e.Actor.ID); cStats.add(s) { waitFirst.Add(1) - log.G(ctx).WithFields(map[string]any{ + log.G(ctx).WithFields(log.Fields{ "event": e.Action, "container": e.Actor.ID, }).Debug("collecting stats for container") @@ -157,7 +157,7 @@ func RunStats(ctx context.Context, dockerCLI command.Cli, options *StatsOptions) eh.setHandler(events.ActionStart, func(e events.Message) { if s := NewStats(e.Actor.ID); cStats.add(s) { waitFirst.Add(1) - log.G(ctx).WithFields(map[string]any{ + log.G(ctx).WithFields(log.Fields{ "event": e.Action, "container": e.Actor.ID, }).Debug("collecting stats for container") @@ -167,7 +167,7 @@ func RunStats(ctx context.Context, dockerCLI command.Cli, options *StatsOptions) if !options.All { eh.setHandler(events.ActionDie, func(e events.Message) { - log.G(ctx).WithFields(map[string]any{ + log.G(ctx).WithFields(log.Fields{ "event": e.Action, "container": e.Actor.ID, }).Debug("stop collecting stats for container") @@ -232,7 +232,7 @@ func RunStats(ctx context.Context, dockerCLI command.Cli, options *StatsOptions) for _, ctr := range cs.Items { if s := NewStats(ctr.ID); cStats.add(s) { waitFirst.Add(1) - log.G(ctx).WithFields(map[string]any{ + log.G(ctx).WithFields(log.Fields{ "container": ctr.ID, }).Debug("collecting stats for container") go collect(ctx, s, apiClient, !options.NoStream, waitFirst) @@ -255,7 +255,7 @@ func RunStats(ctx context.Context, dockerCLI command.Cli, options *StatsOptions) for _, ctr := range options.Containers { if s := NewStats(ctr); cStats.add(s) { waitFirst.Add(1) - log.G(ctx).WithFields(map[string]any{ + log.G(ctx).WithFields(log.Fields{ "container": ctr, }).Debug("collecting stats for container") go collect(ctx, s, apiClient, !options.NoStream, waitFirst)