Open
Description
While GopherJS tends to name JS functions similar to the Go ones, the names in the stack trace don't match exactly, which tends to break code that expects particular formatting of the stack trace function names.
relevantCaller()
in net/http
package is the most recent example I came across:
// relevantCaller searches the call stack for the first function outside of net/http.
// The purpose of this function is to provide more helpful error messages.
func relevantCaller() runtime.Frame {
pc := make([]uintptr, 16)
n := runtime.Callers(1, pc)
frames := runtime.CallersFrames(pc[:n])
var frame runtime.Frame
for {
frame, more := frames.Next()
if !strings.HasPrefix(frame.Function, "net/http.") {
return frame
}
if !more {
break
}
}
return frame
}
There's also an obvious benefit to the debugging experience of being able to more easily identify functions in the call stack.