Go version

go version go1.24.5 linux/arm64

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE='off'
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2811077875=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD=''
GOMODCACHE='/home/go_workpace/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/go_workpace'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.24.5'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

Run the test TestPanicNil in runtime/panicnil_test.go

What did you see happen?

=== RUN   TestPanicNil
=== RUN   TestPanicNil/default
(0x0,0x0) (0x46afa0,0x8b6200)
    panicnil_test.go:38: recover() = <nil>, want panic called with nil argument
--- FAIL: TestPanicNil (0.00s)
    --- FAIL: TestPanicNil/default (0.00s)
panic: nil [recovered]
    panic: nil [recovered]
    panic: test executed panic(nil) or runtime.Goexit

What did you expect to see?

Test passed.

Comment From: wingrez

The behavior is related to GO111MODULE. When I set GO111MODULE=on, panicnil is disabled.

Comment From: wingrez

The reason is that when GO111MODULE=off, the Go version number is set to 1.16 in MainModuleSet.GoVersion. And since the version number is less than 1.21, panicnil is set to 1 in godebugForGoVersion.

Comment From: seankhliao

as you've found, this is working as intended.