diff --git a/cli/command/image/prune.go b/cli/command/image/prune.go index 89e84b41f0..eec9b1c0ba 100644 --- a/cli/command/image/prune.go +++ b/cli/command/image/prune.go @@ -11,8 +11,7 @@ import ( "github.com/docker/cli/cli/command/completion" "github.com/docker/cli/internal/prompt" "github.com/docker/cli/opts" - "github.com/docker/docker/errdefs" - units "github.com/docker/go-units" + "github.com/docker/go-units" "github.com/pkg/errors" "github.com/spf13/cobra" ) @@ -76,7 +75,7 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions) return 0, "", err } if !r { - return 0, "", errdefs.Cancelled(errors.New("image prune has been cancelled")) + return 0, "", cancelledErr{errors.New("image prune has been cancelled")} } } @@ -106,6 +105,10 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions) return spaceReclaimed, output, nil } +type cancelledErr struct{ error } + +func (cancelledErr) Cancelled() {} + // RunPrune calls the Image Prune API // This returns the amount of space reclaimed and a detailed output string func RunPrune(ctx context.Context, dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error) {