From 239b727834e14d9ef39ed4ee90e9056fca8a3cb3 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 16 Jul 2025 13:37:21 +0200 Subject: [PATCH] cli/command/container: DiffFormatWrite: remove intermediate var Also rename "ctx" argument; we shouldn't use this as name for things that are not a context.Context. Signed-off-by: Sebastiaan van Stijn --- cli/command/container/formatter_diff.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cli/command/container/formatter_diff.go b/cli/command/container/formatter_diff.go index 1bf5e78f61..45c45da9b3 100644 --- a/cli/command/container/formatter_diff.go +++ b/cli/command/container/formatter_diff.go @@ -28,16 +28,15 @@ func newDiffFormat(source string) formatter.Format { } // DiffFormatWrite writes formatted diff using the Context -func DiffFormatWrite(ctx formatter.Context, changes []container.FilesystemChange) error { - render := func(format func(subContext formatter.SubContext) error) error { +func DiffFormatWrite(fmtCtx formatter.Context, changes []container.FilesystemChange) error { + return fmtCtx.Write(newDiffContext(), func(format func(subContext formatter.SubContext) error) error { for _, change := range changes { if err := format(&diffContext{c: change}); err != nil { return err } } return nil - } - return ctx.Write(newDiffContext(), render) + }) } type diffContext struct {