Skip to content

cmd/gc: more meaningful names for closures #8943

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
dvyukov opened this issue Oct 16, 2014 · 2 comments
Closed

cmd/gc: more meaningful names for closures #8943

dvyukov opened this issue Oct 16, 2014 · 2 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Oct 16, 2014

Go users see function names in crash dumps, cpu/memory/goroutine profiles, nm, objdump,
etc.
Names like "net/http.(*persistConn).readLoop" are pretty much representative.
While closure names like "net/http.func·001" are not, you have no idea what
it is and how to identify it.

I propose to add outer function names to closures as:
net/http.(*persistConn).readLoop.func·001
Such names are much more informative that the current ones.

Closures created in global scope stay the same (but now you at least know that it's a
global closure):
net/http.func·001

Closures nested in other closures can be either:
net/http.(*persistConn).readLoop.func·001.func·002
or probably just flattened as:
net/http.(*persistConn).readLoop.func·002
@bradfitz
Copy link
Contributor

Comment 1:

Could the symbol include the code's initial line number?

@rsc
Copy link
Contributor

rsc commented Oct 16, 2014

Comment 2:

Status changed to Duplicate.

Merged into issue #8291.

@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
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

4 participants