From 0bcaa414997c7da975d0cb94fb12fd0a25d1d343 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Tue, 2 Dec 2025 16:30:31 +0000 Subject: [PATCH] test: Fix unreachable code warning in panic recovery test Refactor the test to avoid unreachable code after panic by checking a flag set before the panic instead of after. This resolves the go vet warning while maintaining test coverage. --- internal/monitoring/monitor_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/monitoring/monitor_test.go b/internal/monitoring/monitor_test.go index 39511be..c3b6e0e 100644 --- a/internal/monitoring/monitor_test.go +++ b/internal/monitoring/monitor_test.go @@ -686,14 +686,14 @@ func TestRecoverFromPanic(t *testing.T) { }) t.Run("code after panic is not executed", func(t *testing.T) { - afterPanicExecuted := false + panicReached := false func() { defer recoverFromPanic("test-goroutine") + panicReached = true panic("stop here") - afterPanicExecuted = true //nolint:govet // unreachable code is intentional for test }() - if afterPanicExecuted { - t.Error("expected code after panic to not execute") + if !panicReached { + t.Error("expected panic to be reached") } }) }