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:
parent
2d74733942
commit
abd02b6a23
@ -154,7 +154,12 @@ func ListPlugins(dockerCli config.Provider, rootcmd *cobra.Command) ([]Plugin, e
|
|||||||
|
|
||||||
var plugins []Plugin
|
var plugins []Plugin
|
||||||
var mu sync.Mutex
|
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()
|
cmds := rootcmd.Commands()
|
||||||
for _, paths := range candidates {
|
for _, paths := range candidates {
|
||||||
func(paths []string) {
|
func(paths []string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user