diff --git a/common/utils_test.go b/common/utils_test.go index b4d3a2332..e443e4315 100644 --- a/common/utils_test.go +++ b/common/utils_test.go @@ -12,9 +12,9 @@ func TestGo(t *testing.T) { paniced := false panicErr := "test panic" oldDefaultPanicFunc := defaultPanicFunc - defer func() { + t.Cleanup(func() { defaultPanicFunc = oldDefaultPanicFunc - }() + }) defaultPanicFunc = func(err any) { require.NotNil(t, err) paniced = true