MCPcopy Create free account
hub / github.com/goadesign/goa / caller

Function caller

eval/eval.go:255–278  ·  view source on GitHub ↗

caller returns the name of calling function.

()

Source from the content-addressed store, hash-verified

253
254// caller returns the name of calling function.
255func caller() string {
256 var latest string
257 for skip := 2; skip <= 5; skip++ {
258 pc, _, _, ok := runtime.Caller(skip)
259 if !ok {
260 break
261 }
262 name := runtime.FuncForPC(pc).Name()
263 if !strings.HasPrefix(name, "goa.design/goa/v3/dsl.") {
264 break
265 }
266 caller := strings.Split(strings.TrimPrefix(name, "goa.design/goa/v3/dsl."), ".")[0]
267 for _, first := range caller {
268 if unicode.IsUpper(first) {
269 latest = caller
270 }
271 break
272 }
273 }
274 if latest != "" {
275 return latest
276 }
277 return "<unknown>"
278}

Callers 3

IncompatibleDSLFunction · 0.85
TooFewArgErrorFunction · 0.85
TooManyArgErrorFunction · 0.85

Calls 1

NameMethod · 0.65

Tested by

no test coverage detected