From 676471233317d6407b876a457e9f70ae467b3633 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Jun 2026 16:53:09 +0000 Subject: [PATCH 1/2] Initial plan From 15fd9038c3b2568e342047cac9f274340ae09665 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Jun 2026 16:54:44 +0000 Subject: [PATCH 2/2] fix: use runtime.PanicNilError type assertion instead of error string comparison The didPanic function previously checked for runtime.PanicNilError by comparing the Error() string "panic called with nil argument". This breaks in Go 1.27 where the error message changes. Use a direct type assertion for *runtime.PanicNilError instead, which is the stable API and works across all Go versions from 1.21 onward. Closes go-openapi/testify#123 Signed-off-by: GitHub Copilot --- internal/assertions/panic.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/assertions/panic.go b/internal/assertions/panic.go index abc549bcb..9d9e880cb 100644 --- a/internal/assertions/panic.go +++ b/internal/assertions/panic.go @@ -5,6 +5,7 @@ package assertions import ( "fmt" + "runtime" "runtime/debug" ) @@ -133,10 +134,8 @@ func didPanic(f func()) (didPanic bool, message any, stack string) { } // Go 1.21 introduces runtime.PanicNilError on panic(nil), // so maintain the same logic going forward (https://github.com/golang/go/issues/25448). - if err, ok := message.(error); ok { - if err.Error() == "panic called with nil argument" { - message = nil - } + if _, ok := message.(*runtime.PanicNilError); ok { + message = nil } }()