MCPcopy Create free account
hub / github.com/chain/txvm / caller

Function caller

log/stack.go:50–62  ·  view source on GitHub ↗

caller returns a string containing filename and line number of the nearest function invocation on the calling goroutine's stack, after skipping functions marked as helper functions. If no stack information is available, it returns "?:?".

()

Source from the content-addressed store, hash-verified

48// after skipping functions marked as helper functions.
49// If no stack information is available, it returns "?:?".
50func caller() string {
51 for i := 1; ; i++ {
52 // NOTE(kr): This is quadratic in the number of frames we
53 // ultimately have to skip. Consider using Callers instead.
54 pc, file, line, ok := runtime.Caller(i)
55 if !ok {
56 return "?:?"
57 }
58 if !isHelper(runtime.FuncForPC(pc).Name()) {
59 return filepath.Base(file) + ":" + strconv.Itoa(line)
60 }
61 }
62}

Callers 1

PrintkvFunction · 0.85

Calls 1

isHelperFunction · 0.85

Tested by

no test coverage detected