Skip to content

Commit db1c90d

Browse files
committed
Create a logging context outside of a loop
The "performance" preset of golangci-lint detected this. Add that preset to the linter report in GitHub workflows.
1 parent f48ee3c commit db1c90d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

.golangci.next.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ linters:
2424
- thelper
2525
- tparallel
2626
- wastedassign
27+
presets:
28+
- performance
2729

2830
issues:
2931
exclude-rules:

internal/controller/postgrescluster/postgres.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -644,11 +644,11 @@ func (r *Reconciler) reconcilePostgresUsersInPostgreSQL(
644644
running, known := instance.IsRunning(container)
645645
if running && known && len(instance.Pods) > 0 {
646646
pod := instance.Pods[0]
647-
ctx = logging.NewContext(ctx, logging.FromContext(ctx).WithValues("pod", pod.Name))
648647

649648
podExecutor = func(
650649
ctx context.Context, stdin io.Reader, stdout, stderr io.Writer, command ...string,
651650
) error {
651+
ctx = logging.NewContext(ctx, logging.FromContext(ctx).WithValues("pod", pod.Name))
652652
return r.PodExec(ctx, pod.Namespace, pod.Name, container, stdin, stdout, stderr, command...)
653653
}
654654
break

0 commit comments

Comments
 (0)