mirror of https://github.com/docker/cli.git
Merge pull request #5779 from thaJeztah/fix_plugin_multierr
cli/command/plugins: runRemove: fix incorrect use of errors.Join
This commit is contained in:
commit
919bd6aff3
|
@ -36,14 +36,16 @@ func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
func runRemove(ctx context.Context, dockerCli command.Cli, opts *rmOptions) error {
|
||||
var errs error
|
||||
func runRemove(ctx context.Context, dockerCLI command.Cli, opts *rmOptions) error {
|
||||
apiClient := dockerCLI.Client()
|
||||
|
||||
var errs []error
|
||||
for _, name := range opts.plugins {
|
||||
if err := dockerCli.Client().PluginRemove(ctx, name, types.PluginRemoveOptions{Force: opts.force}); err != nil {
|
||||
errs = errors.Join(errs, err)
|
||||
if err := apiClient.PluginRemove(ctx, name, types.PluginRemoveOptions{Force: opts.force}); err != nil {
|
||||
errs = append(errs, err)
|
||||
continue
|
||||
}
|
||||
_, _ = fmt.Fprintln(dockerCli.Out(), name)
|
||||
_, _ = fmt.Fprintln(dockerCLI.Out(), name)
|
||||
}
|
||||
return errs
|
||||
return errors.Join(errs...)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue