Skip to content

Panic when checking if receiver is nil for nested pointer #59008

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

Closed
noamlerner opened this issue Mar 13, 2023 · 1 comment
Closed

Panic when checking if receiver is nil for nested pointer #59008

noamlerner opened this issue Mar 13, 2023 · 1 comment

Comments

@noamlerner
Copy link

What version of Go are you using (go version)?

$ go 1.20

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="arm64"
GOOS="darwin"

What did you do?

https://go.dev/play/p/5Gf2pDNgCgS

What did you expect to see?

I expect to be able to check if a recieving pointer is nil.

What did you see instead?

panic: runtime error: invalid memory address or nil pointer dereference

@seankhliao
Copy link
Member

working as intended.
b.IsNil() is equivalent to Foo.IsNil(b.Foo), which is a nil pointer dereference

see also #18617

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2023
@golang golang locked and limited conversation to collaborators Mar 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants