mirror of https://github.com/docker/cli.git
cli-plugins: RunPlugin(): rename error-variable that's possibly shadowed
The logic in this function is confusing; let's start make it obvious where the error that is returned is produced, Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
350a0b68a9
commit
b7695d6c79
|
@ -35,7 +35,7 @@ func RunPlugin(dockerCli *command.DockerCli, plugin *cobra.Command, meta manager
|
|||
|
||||
var persistentPreRunOnce sync.Once
|
||||
PersistentPreRunE = func(cmd *cobra.Command, _ []string) error {
|
||||
var err error
|
||||
var retErr error
|
||||
persistentPreRunOnce.Do(func() {
|
||||
ctx, cancel := context.WithCancel(cmd.Context())
|
||||
cmd.SetContext(ctx)
|
||||
|
@ -47,7 +47,7 @@ func RunPlugin(dockerCli *command.DockerCli, plugin *cobra.Command, meta manager
|
|||
opts = append(opts, withPluginClientConn(plugin.Name()))
|
||||
}
|
||||
opts = append(opts, command.WithEnableGlobalMeterProvider(), command.WithEnableGlobalTracerProvider())
|
||||
err = tcmd.Initialize(opts...)
|
||||
retErr = tcmd.Initialize(opts...)
|
||||
ogRunE := cmd.RunE
|
||||
if ogRunE == nil {
|
||||
ogRun := cmd.Run
|
||||
|
@ -67,7 +67,7 @@ func RunPlugin(dockerCli *command.DockerCli, plugin *cobra.Command, meta manager
|
|||
return err
|
||||
}
|
||||
})
|
||||
return err
|
||||
return retErr
|
||||
}
|
||||
|
||||
cmd, args, err := tcmd.HandleGlobalFlags()
|
||||
|
|
Loading…
Reference in New Issue