From a252cb119748616ad5bf16d980155f49e64d9133 Mon Sep 17 00:00:00 2001 From: Silvin Lubecki Date: Wed, 30 May 2018 15:20:44 +0200 Subject: [PATCH] Fix outputting twice the docker stack rm error message Signed-off-by: Silvin Lubecki --- cli/command/stack/kubernetes/remove.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cli/command/stack/kubernetes/remove.go b/cli/command/stack/kubernetes/remove.go index af68db7f30..311c7597af 100644 --- a/cli/command/stack/kubernetes/remove.go +++ b/cli/command/stack/kubernetes/remove.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/docker/cli/cli/command/stack/options" + "github.com/pkg/errors" ) // RunRemove is the kubernetes implementation of docker stack remove @@ -18,10 +19,8 @@ func RunRemove(dockerCli *KubeCli, opts options.Remove) error { } for _, stack := range opts.Namespaces { fmt.Fprintf(dockerCli.Out(), "Removing stack: %s\n", stack) - err := stacks.Delete(stack) - if err != nil { - fmt.Fprintf(dockerCli.Out(), "Failed to remove stack %s: %s\n", stack, err) - return err + if err := stacks.Delete(stack); err != nil { + return errors.Wrapf(err, "Failed to remove stack %s", stack) } } return nil