File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,13 +2,12 @@ package volume
22
33import (
44 "context"
5+ "errors"
56 "fmt"
6- "strings"
77
88 "github.com/docker/cli/cli"
99 "github.com/docker/cli/cli/command"
1010 "github.com/docker/cli/cli/command/completion"
11- "github.com/pkg/errors"
1211 "github.com/spf13/cobra"
1312)
1413
@@ -43,18 +42,13 @@ func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
4342func runRemove (ctx context.Context , dockerCLI command.Cli , opts * removeOptions ) error {
4443 apiClient := dockerCLI .Client ()
4544
46- var errs []string
47-
45+ var errs []error
4846 for _ , name := range opts .volumes {
4947 if err := apiClient .VolumeRemove (ctx , name , opts .force ); err != nil {
50- errs = append (errs , err . Error () )
48+ errs = append (errs , err )
5149 continue
5250 }
5351 _ , _ = fmt .Fprintln (dockerCLI .Out (), name )
5452 }
55-
56- if len (errs ) > 0 {
57- return errors .Errorf ("%s" , strings .Join (errs , "\n " ))
58- }
59- return nil
53+ return errors .Join (errs ... )
6054}
You can’t perform that action at this time.
0 commit comments