]> Cypherpunks.ru repositories - gostls13.git/commitdiff
builtin: mention PanicNilError in comments of recover
authorIrakli Safareli <i.safareli@gmail.com>
Mon, 18 Dec 2023 08:53:03 +0000 (08:53 +0000)
committerKeith Randall <khr@golang.org>
Mon, 18 Dec 2023 19:42:41 +0000 (19:42 +0000)
As of CL 461956 `recover` will not return `nil` if `panic` is called with `nil`. I have updated  comments of `recover` to account for this change.

Change-Id: Ibd0b27fe9b89fb29349b62ad34e762239a1d165b
GitHub-Last-Rev: c773abb75c8cd8e08c3470f064a3205573156fea
GitHub-Pull-Request: golang/go#64393
Reviewed-on: https://go-review.googlesource.com/c/go/+/544975
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
src/builtin/builtin.go

index da0ace1498504ecf29a2b9845feb4c6e93423fe7..668c799ca74c90f7ed2b94117562c2d3c3936564 100644 (file)
@@ -284,9 +284,10 @@ func panic(v any)
 // by restoring normal execution and retrieves the error value passed to the
 // call of panic. If recover is called outside the deferred function it will
 // not stop a panicking sequence. 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.
+// panicking, recover returns nil.
+//
+// Prior to Go 1.21, recover would also return nil if panic is called with
+// a nil argument. See [panic] for details.
 func recover() any
 
 // The print built-in function formats its arguments in an