Skip to content
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

runtime: regression where Func.Name panics on nil pointer #20872

dsnet opened this issue Jun 30, 2017 · 1 comment


None yet
2 participants
Copy link

commented Jun 30, 2017

On Go1.2 until Go1.8, the following would return an empty string:


But a regression on Go1.9 (0efc8b2) causes this to panic:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x43ab52]

goroutine 1 [running]:
	/tmp/sandbox221545061/main.go:7 +0x2a

It's probably worth keeping this behavior since a number of users blindly do runtime.FuncForPC(myPtr).Name() without checking that myPtr is non-nil.

\cc @aclements

@dsnet dsnet added the NeedsFix label Jun 30, 2017

@dsnet dsnet added this to the Go1.9 milestone Jun 30, 2017

@dsnet dsnet self-assigned this Jun 30, 2017


This comment has been minimized.

Copy link

commented Jun 30, 2017

CL mentions this issue.

@gopherbot gopherbot closed this in a776087 Jun 30, 2017

@dsnet dsnet changed the title runtime: Func.Name panics on nil pointer runtime: regression where Func.Name panics on nil pointer Jul 10, 2017

@golang golang locked and limited conversation to collaborators Jul 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.