_content/doc/go1.21.html: add note about panic nil behavior
For golang/go#25448. Change-Id: I775ad6d8d8952da8fa94c39c44a2420501b63b57 Reviewed-on: https://go-review.googlesource.com/c/website/+/517036 Run-TryBot: Michael Knyszek <mknyszek@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Родитель
958dd998bd
Коммит
cbd53f2c11
|
@ -143,6 +143,20 @@ Do not send CLs removing the interior tags from such phrases.
|
|||
For details about how to try that language change, see <a href="https://go.dev/wiki/LoopvarExperiment">the LoopvarExperiment wiki page</a>.
|
||||
</p>
|
||||
|
||||
<!-- https://go.dev/issue/25448 -->
|
||||
<p>
|
||||
Go 1.21 now defines that if a goroutine is panicking and recover was called directly by a deferred
|
||||
function, the return value of recover is guaranteed not to be nil. To ensure this, calling panic
|
||||
with a nil interface value (or an untyped nil) causes a run-time panic of type
|
||||
<a href="/runtime/#PanicNilError"><code>*runtime.PanicNilError</code></a>.
|
||||
</p>
|
||||
<p>
|
||||
To support programs written for older versions of Go, nil panics can be re-enabled by setting
|
||||
<code>GODEBUG=panicnil=1</code>.
|
||||
This setting is enabled automatically when compiling a program whose main package
|
||||
is in a module with that declares <code>go</code> <code>1.20</code> or earlier.
|
||||
</p>
|
||||
|
||||
<h2 id="tools">Tools</h2>
|
||||
<p>
|
||||
Go 1.21 adds improved support for backwards compatibility and forwards compatibility
|
||||
|
|
Загрузка…
Ссылка в новой задаче