15 lines
283 B
Go
15 lines
283 B
Go
|
package exerr
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"runtime"
|
||
|
)
|
||
|
|
||
|
func callername(skip int) string {
|
||
|
pc := make([]uintptr, 15)
|
||
|
n := runtime.Callers(skip+2, pc)
|
||
|
frames := runtime.CallersFrames(pc[:n])
|
||
|
frame, _ := frames.Next()
|
||
|
return fmt.Sprintf("%s:%d %s", frame.File, frame.Line, frame.Function)
|
||
|
}
|