The autogenerated miranda method only happens if you are calling through an interface method that is provided by an embedded type. If you're doing something like
func log(...) { pc := runtime.Callers(1) // get the caller of log } It shouldn't be a problem. On Monday, 15 August 2016 14:42:14 UTC+10, Tim Hockin wrote: > > On Sun, Aug 14, 2016 at 8:31 PM, Ian Lance Taylor <ia...@golang.org > <javascript:>> wrote: > > On Sun, Aug 14, 2016 at 3:33 PM, Tim Hockin <tho...@google.com > <javascript:>> wrote: > >> Edit: It looks like this has more to do with being an interface > >> method than an embedded type. > >> > >> https://play.golang.org/p/I5XPdWR_O0 > > > > Hmmm, you're right. It only happens for a value method. > > Is this likely to change? I.e. can I hardcode "2" or should I actually > write the loop to climb frames? Is there a limit to the number of > frames I should inspect before I give up? Is the string > "<autogenerated>" stable? > > >> Is there a generic way to get the caller safely, or should I just > >> check for <autogenerated> and increment? > > > > I think that is what you should do here. > > > > Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.