Andrey Meshkov b6a98906a5 Sync v2.0
2022-08-26 14:18:35 +03:00

20 lines
365 B
Go

package errcoll
import (
"fmt"
"runtime"
)
// Common Functionality
// caller returns the caller position using the appropriate depth.
func caller(depth int) (callerPos string) {
callerPos = "<position unknown>"
_, callerFile, callerLine, ok := runtime.Caller(depth)
if ok {
callerPos = fmt.Sprintf("%s:%d", callerFile, callerLine)
}
return callerPos
}