diff --git a/cli/command/container/diff.go b/cli/command/container/diff.go index 694df5ab35..2b90e08e0e 100644 --- a/cli/command/container/diff.go +++ b/cli/command/container/diff.go @@ -35,5 +35,5 @@ func runDiff(ctx context.Context, dockerCLI command.Cli, containerID string) err Output: dockerCLI.Out(), Format: newDiffFormat("{{.Type}} {{.Path}}"), } - return DiffFormatWrite(diffCtx, changes) + return diffFormatWrite(diffCtx, changes) } diff --git a/cli/command/container/formatter_diff.go b/cli/command/container/formatter_diff.go index 0d74e42607..32af3ed645 100644 --- a/cli/command/container/formatter_diff.go +++ b/cli/command/container/formatter_diff.go @@ -28,7 +28,14 @@ func newDiffFormat(source string) formatter.Format { } // DiffFormatWrite writes formatted diff using the Context +// +// Deprecated: this function was only used internally and will be removed in the next release. func DiffFormatWrite(fmtCtx formatter.Context, changes []container.FilesystemChange) error { + return diffFormatWrite(fmtCtx, changes) +} + +// diffFormatWrite writes formatted diff using the [formatter.Context]. +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 { diff --git a/cli/command/container/formatter_diff_test.go b/cli/command/container/formatter_diff_test.go index 0d9ba20d33..51ff9df666 100644 --- a/cli/command/container/formatter_diff_test.go +++ b/cli/command/container/formatter_diff_test.go @@ -50,7 +50,7 @@ D: /usr/app/old_app.js t.Run(string(tc.context.Format), func(t *testing.T) { out := bytes.NewBufferString("") tc.context.Output = out - err := DiffFormatWrite(tc.context, diffs) + err := diffFormatWrite(tc.context, diffs) if err != nil { assert.Error(t, err, tc.expected) } else {