Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Caller = func(skip int, fast bool) (file string, line int) { if !fast { _, file, line, _ = runtime.Caller(skip + 1) return } rpc := make([]uintptr, 1) n := runtime.Callers(skip+2, rpc[:]) if n < 1 { return } pc := rpc[0] if v, ok := frameMap.Load(pc); ok { e := v.(*runtime.Frame) return e.File, e.Line } frame, _ := runtime.CallersFrames(rpc).Next() frameMap.Store(pc, &frame) return frame.File, frame.Line }
Caller returns the file name and line number of the calling function. If 'fast' is true, it uses a cache to speed up the lookup.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.