functionCompleter replaces provided substring with a function name retrieved from a profile if a single match exists. Otherwise, it returns unchanged substring. It defaults to no-op if the profile is not specified.
(substring string, fns []string)
| 398 | // it returns unchanged substring. It defaults to no-op if the profile |
| 399 | // is not specified. |
| 400 | func functionCompleter(substring string, fns []string) string { |
| 401 | found := "" |
| 402 | for _, fName := range fns { |
| 403 | if strings.Contains(fName, substring) { |
| 404 | if found != "" { |
| 405 | return substring |
| 406 | } |
| 407 | found = fName |
| 408 | } |
| 409 | } |
| 410 | if found != "" { |
| 411 | return found |
| 412 | } |
| 413 | return substring |
| 414 | } |
| 415 | |
| 416 | func functionNames(p *profile.Profile) []string { |
| 417 | var fns []string |
no outgoing calls
no test coverage detected
searching dependent graphs…