Skip to content

Commit 919bd6a

Browse files
authored
Merge pull request #5779 from thaJeztah/fix_plugin_multierr
cli/command/plugins: runRemove: fix incorrect use of errors.Join
2 parents ac13f50 + 37b25f2 commit 919bd6a

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

cli/command/plugin/remove.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
3636
return cmd
3737
}
3838

39-
func runRemove(ctx context.Context, dockerCli command.Cli, opts *rmOptions) error {
40-
var errs error
39+
func runRemove(ctx context.Context, dockerCLI command.Cli, opts *rmOptions) error {
40+
apiClient := dockerCLI.Client()
41+
42+
var errs []error
4143
for _, name := range opts.plugins {
42-
if err := dockerCli.Client().PluginRemove(ctx, name, types.PluginRemoveOptions{Force: opts.force}); err != nil {
43-
errs = errors.Join(errs, err)
44+
if err := apiClient.PluginRemove(ctx, name, types.PluginRemoveOptions{Force: opts.force}); err != nil {
45+
errs = append(errs, err)
4446
continue
4547
}
46-
_, _ = fmt.Fprintln(dockerCli.Out(), name)
48+
_, _ = fmt.Fprintln(dockerCLI.Out(), name)
4749
}
48-
return errs
50+
return errors.Join(errs...)
4951
}

0 commit comments

Comments
 (0)