From cbd53f2c119805657255997af97bbb0e45cb619b Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Tue, 8 Aug 2023 15:34:41 +0000 Subject: [PATCH] _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 Reviewed-by: Russ Cox TryBot-Result: Gopher Robot Auto-Submit: Michael Knyszek --- _content/doc/go1.21.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/_content/doc/go1.21.html b/_content/doc/go1.21.html index 697b55cc..23cef053 100644 --- a/_content/doc/go1.21.html +++ b/_content/doc/go1.21.html @@ -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 the LoopvarExperiment wiki page.

+ +

+ 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 + *runtime.PanicNilError. +

+

+ To support programs written for older versions of Go, nil panics can be re-enabled by setting + GODEBUG=panicnil=1. + This setting is enabled automatically when compiling a program whose main package + is in a module with that declares go 1.20 or earlier. +

+

Tools

Go 1.21 adds improved support for backwards compatibility and forwards compatibility