From e31c7b71a2b8f5a4d98162bade21fe4ed5e38e2a Mon Sep 17 00:00:00 2001 From: Marc Fielding Date: Fri, 8 Nov 2024 13:06:30 -0500 Subject: [PATCH] Fix ineffective break statement in context_test.go From https://staticcheck.dev/docs/checks#SA4011: SA4011 - Break statement with no effect. Did you mean to break out of an outer loop? In Go, the break statement only exits the innermost loop it's currently in. If you're seeing the "ineffective break statement" warning, it's likely because you have a break statement inside a nested loop, but you intended to exit the outer loop. Updating with a `return` to exit the goroutine entirely. The unit test itself isn't affected; it passes before and after this change. --- context_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context_test.go b/context_test.go index 0b49abf..117a73b 100644 --- a/context_test.go +++ b/context_test.go @@ -60,7 +60,7 @@ func TestSetValueConcurrency(t *testing.T) { _ = ctx.Value("foo") select { case <-ctx.Done(): - break + return default: } }