New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtime: PanicNilError error string should have "runtime error: " prefix #63813
Comments
This is also confirmed by the Go specification:
This behavior was introduced in CL 461956 |
@gopherbot please open a backport issue for Go 1.21. Errors that implement |
Backport issue(s) opened: #63815 (for 1.21). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Looks like |
Errors that implement runtime.Error should have a "runtime error: " prefix, with the solo exception of runtime.plainError (on purpose). Calling panic(nil) results in a PanicNilError that violates this constraint. This CL changes the error from panic(nil) from: panic called with nil argument to runtime error: panic called with nil argument Fixes golang#63813
Change https://go.dev/cl/538496 mentions this issue: |
I think it is past time to update @rsc Do we want to fix |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Since Panic error is a different runtime error as mentioned in the documentation - https://pkg.go.dev/builtin#panic and it has implementation of method - RuntimeError
// RuntimeError is a no-op function but // serves to distinguish types that are run time // errors from ordinary errors: a type is a // run time error if it has a RuntimeError method. RuntimeError()
I would like to see the error message like other runtime errors - "runtime error:" as mentioned in the above example
What did you see instead?
I rather the see the error message as - panic called with nil argument
The text was updated successfully, but these errors were encountered: