What changed, and why it matters
This commit only updates test code to satisfy a new Go linter rule. It replaces context.Background() with t.Context() inside four unit tests. There is no change to production code and no security relevance.
No security action needed. Treat as routine code hygiene / linter fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies discovery/gossiper_test.go only. It swaps context.Background() for t.Context() in four goroutine-based test helpers that call ctx.gossiper.finalizeGossipProcessing. The change is driven by the ‘usetesting’ linter, which prefers t.Context() in tests. No production logic, interfaces, or behavior are altered.
Changed components
discovery/gossiper_test.goInspect captured patch +4 / −4
diff --git a/discovery/gossiper_test.go b/discovery/gossiper_test.go
index b4898c0..3d114e3 100644
--- a/discovery/gossiper_test.go
+++ b/discovery/gossiper_test.go
@@ -5007,7 +5007,7 @@ func TestRecoverGossipPanic(t *testing.T) {
panicked := make(chan struct{})
go func() {
defer ctx.gossiper.finalizeGossipProcessing(
- context.Background(), "testing",
+ t.Context(), "testing",
nMsg, jobIDRef,
)
defer close(panicked)
@@ -5070,7 +5070,7 @@ func TestRecoverGossipPanicBlockedErrorChannel(t *testing.T) {
panicked := make(chan struct{})
go func() {
defer ctx.gossiper.finalizeGossipProcessing(
- context.Background(), "testing", nMsg, &jobID,
+ t.Context(), "testing", nMsg, &jobID,
)
defer close(panicked)
@@ -5142,7 +5142,7 @@ func TestRecoverGossipPanicSignalsDependents(t *testing.T) {
panicked := make(chan struct{})
go func() {
defer ctx.gossiper.finalizeGossipProcessing(
- context.Background(), "testing", nMsg, &parentJobID,
+ t.Context(), "testing", nMsg, &parentJobID,
)
defer close(panicked)
@@ -5212,7 +5212,7 @@ func TestRecoverGossipPanicNilJobID(t *testing.T) {
panicked := make(chan struct{})
go func() {
defer ctx.gossiper.finalizeGossipProcessing(
- context.Background(), "processing", nMsg, nil,
+ t.Context(), "processing", nMsg, nil,
)
defer close(panicked)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.