Merge pull request #5779 from thaJeztah/fix_plugin_multierr

cli/command/plugins: runRemove: fix incorrect use of errors.Join
This commit is contained in:
Sebastiaan van Stijn 2025-02-03 18:24:27 +01:00 committed by GitHub
commit 919bd6aff3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 6 deletions

View File

@ -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...)
}