Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Migrate runtime.Callers/2 #107

Closed
djui opened this issue Mar 7, 2017 · 8 comments
Closed

Migrate runtime.Callers/2 #107

djui opened this issue Mar 7, 2017 · 8 comments

Comments

@djui
Copy link
Contributor

djui commented Mar 7, 2017

Given Slide 25 from talk: Mid-stack inlining in the Go compiler (external) it seems like errors.callers should migrate.

Basically: "Avoid FuncForPC, use CallersFrames".

@alfred-landrum
Copy link

alfred-landrum commented Mar 8, 2017

Here's a related golang issue, including the documentation change that recommends using CallersFrames:
golang/go#19426

Here's a closed experimental PR that uses CallersFrames, ignoring backwards compatibility, but passing for 1.7 and tip:
#108

@davecheney
Copy link
Member

davecheney commented Mar 8, 2017 via email

@ChrisHines
Copy link
Contributor

We are exploring a similar migration over at go-stack/stack#13. Important links for reference:

@davecheney
Copy link
Member

Is there anything to do here, the method is depreciated, but it won't be going away any time soon.

@ChrisHines
Copy link
Contributor

It will probably be worth doing something for Go 1.9. From the draft release notes:

Tracebacks generated by the runtime and recorded in profiles are now accurate in the presence of inlining. To retrieve tracebacks programmatically, applications should use runtime.CallersFrames rather than directly iterating over the results of runtime.Callers.

Switching to runtime.CallersFrames will become critical once Go has mid-stack inlining, which seems likely in one of the next few releases. The proposal has been accepted.

@davecheney
Copy link
Member

davecheney commented Jun 17, 2017 via email

@agnivade
Copy link

agnivade commented Aug 2, 2017

Hi everyone,

Just saw the 1.9 release notes and thought to check on this library (I use it regularly and its awesome).
Mid-stack inlining has landed in 1.9. https://tip.golang.org/doc/go1.9#callersframes.

I believe this would be a good time to make the shift to runtime.CallersFrames.

@alfred-landrum
Copy link

@davecheney - given the above rationale, would you be ready to consider a more polished version of my early PR, #108 ?

davecheney added a commit that referenced this issue Jan 5, 2019
Fixes #160
Fixes #107

Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney added a commit that referenced this issue Jan 5, 2019
Fixes #160
Fixes #107

Signed-off-by: Dave Cheney <dave@cheney.net>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants