Skip to content
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

builtin: documentation for recover does not match that of panic #63669

Closed
mitar opened this issue Oct 22, 2023 · 3 comments
Closed

builtin: documentation for recover does not match that of panic #63669

mitar opened this issue Oct 22, 2023 · 3 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Documentation NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mitar
Copy link
Contributor

mitar commented Oct 22, 2023

Recently panic has been change to better support panicking with nil (aa51c40) and its documentation in src/builtin/builtin.go has been updated by adding:

// Starting in Go 1.21, calling panic with a nil interface value or an
// untyped nil causes a run-time error (a different panic).
// The GODEBUG setting panicnil=1 disables the run-time error.

Sadly, recover documentation was not updated and it currently reads:

// ... In this case, or when the goroutine is not
// panicking, or if the argument supplied to panic was nil, recover returns
// nil. Thus the return value from recover reports whether the goroutine is
// panicking.

See "or if the argument supplied to panic was nil" part. That is not true anymore by my understanding.

cc @rsc

@gopherbot gopherbot added compiler/runtime Issues related to the Go compiler and/or runtime. Documentation labels Oct 22, 2023
@seankhliao seankhliao added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 22, 2023
@seankhliao seankhliao changed the title runtime: documentation for recover does not match that of panic builtin: documentation for recover does not match that of panic Oct 22, 2023
@go101

This comment was marked as off-topic.

@gopherbot
Copy link

Change https://go.dev/cl/536955 mentions this issue: builtin: update recover doc to refelect new panic behavior

@mknyszek mknyszek added this to the Backlog milestone Nov 1, 2023
@randall77
Copy link
Contributor

This doc has been changed to update that text. (As of CL 544975.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Documentation NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

7 participants