MCPcopy Create free account
hub / github.com/kataras/iris / GetCaller

Function GetCaller

hero/dependency_source.go:70–95  ·  view source on GitHub ↗

https://golang.org/doc/go1.9#callersframes

()

Source from the content-addressed store, hash-verified

68
69// https://golang.org/doc/go1.9#callersframes
70func GetCaller() (string, int) {
71 var pcs [32]uintptr
72 n := runtime.Callers(4, pcs[:])
73 frames := runtime.CallersFrames(pcs[:n])
74
75 for {
76 frame, more := frames.Next()
77 file := frame.File
78
79 if strings.Contains(file, "go/src/runtime/") {
80 continue
81 }
82
83 // funcName is something like "github.com/kataras/iris.SomeFunc"
84 funcName := frame.Function
85 if !strings.HasPrefix(funcName, "github.com/kataras/iris/v12") {
86 return file, frame.Line
87 }
88
89 if !more {
90 break
91 }
92 }
93
94 return "???", 0
95}

Callers 3

createRoutesMethod · 0.92
newSourceFunction · 0.85
getSourceFunction · 0.85

Calls 2

NextMethod · 0.80
ContainsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…