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,12 +2,11 @@ package service
22
33import (
44 "context"
5+ "errors"
56 "fmt"
6- "strings"
77
88 "github.com/docker/cli/cli"
99 "github.com/docker/cli/cli/command"
10- "github.com/pkg/errors"
1110 "github.com/spf13/cobra"
1211)
1312
@@ -32,17 +31,13 @@ func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
3231func runRemove (ctx context.Context , dockerCLI command.Cli , serviceIDs []string ) error {
3332 apiClient := dockerCLI .Client ()
3433
35- var errs []string
34+ var errs []error
3635 for _ , id := range serviceIDs {
37- err := apiClient .ServiceRemove (ctx , id )
38- if err != nil {
39- errs = append (errs , err .Error ())
36+ if err := apiClient .ServiceRemove (ctx , id ); err != nil {
37+ errs = append (errs , err )
4038 continue
4139 }
4240 _ , _ = fmt .Fprintln (dockerCLI .Out (), id )
4341 }
44- if len (errs ) > 0 {
45- return errors .New (strings .Join (errs , "\n " ))
46- }
47- return nil
42+ return errors .Join (errs ... )
4843}
You can’t perform that action at this time.
0 commit comments