cli-plugins/manager: ListPlugins: pass context to error-group

This error-group was added in 89583b92b74ec3c2dfe770b0c01437b1e373c1aa, but
passed a context.TODO because the function didn't have a context as argument.

However, it does get the root-command passed, which holds the context, so
we can pass that.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2025-03-18 11:13:29 +01:00
parent 2d74733942
commit abd02b6a23
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -154,7 +154,12 @@ func ListPlugins(dockerCli config.Provider, rootcmd *cobra.Command) ([]Plugin, e
var plugins []Plugin
var mu sync.Mutex
eg, _ := errgroup.WithContext(context.TODO())
ctx := rootcmd.Context()
if ctx == nil {
// Fallback, mostly for tests that pass a bare cobra.command
ctx = context.Background()
}
eg, _ := errgroup.WithContext(ctx)
cmds := rootcmd.Commands()
for _, paths := range candidates {
func(paths []string) {