Skip to content

Commit 5a38118

Browse files
committed
cmd/docker: fix some minor linting issues
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 6bd8a4b commit 5a38118

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

cmd/docker/docker.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -339,19 +339,19 @@ func tryPluginRun(ctx context.Context, dockerCli command.Cli, cmd *cobra.Command
339339
// signals to the subprocess because the shared
340340
// pgid makes the TTY a controlling terminal.
341341
//
342-
// The plugin should have it's own copy of this
342+
// The plugin should have its own copy of this
343343
// termination logic, and exit after 3 retries
344-
// on it's own.
344+
// on its own.
345345
if dockerCli.Out().IsTerminal() {
346346
return
347347
}
348348

349-
// Terminate the plugin server, which will
350-
// close all connections with plugin
351-
// subprocesses, and signal them to exit.
349+
// Terminate the plugin server, which closes
350+
// all connections with plugin subprocesses,
351+
// and signal them to exit.
352352
//
353-
// Repeated invocations will result in EINVAL,
354-
// or EBADF; but that is fine for our purposes.
353+
// Repeated invocations result in EINVAL or EBADF,
354+
// but that is fine for our purposes.
355355
if srv != nil {
356356
_ = srv.Close()
357357
}
@@ -369,15 +369,15 @@ func tryPluginRun(ctx context.Context, dockerCli command.Cli, cmd *cobra.Command
369369

370370
go func() {
371371
retries := 0
372-
force := false
373372
// catch the first signal through context cancellation
374373
<-ctx.Done()
375-
tryTerminatePlugin(force)
374+
tryTerminatePlugin(false)
376375

377376
// register subsequent signals
378377
signals := make(chan os.Signal, exitLimit)
379378
signal.Notify(signals, platformsignals.TerminationSignals...)
380379

380+
force := false
381381
for range signals {
382382
retries++
383383
// If we're still running after 3 interruptions
@@ -458,7 +458,7 @@ func runDocker(ctx context.Context, dockerCli *command.DockerCli) error {
458458
}
459459
}()
460460
} else {
461-
fmt.Fprint(dockerCli.Err(), "Warning: Unexpected OTEL error, metrics may not be flushed")
461+
_, _ = fmt.Fprint(dockerCli.Err(), "Warning: Unexpected OTEL error, metrics may not be flushed")
462462
}
463463

464464
dockerCli.InstrumentCobraCommands(ctx, cmd)
@@ -473,8 +473,7 @@ func runDocker(ctx context.Context, dockerCli *command.DockerCli) error {
473473
// We add plugin command stubs early only for completion. We don't
474474
// want to add them for normal command execution as it would cause
475475
// a significant performance hit.
476-
err = pluginmanager.AddPluginCommandStubs(dockerCli, cmd)
477-
if err != nil {
476+
if err := pluginmanager.AddPluginCommandStubs(dockerCli, cmd); err != nil {
478477
return err
479478
}
480479
}

0 commit comments

Comments
 (0)