notFound is an error for a name that doesn't exist. It suggests close matches.
(msg, name string, candidates []string)
| 619 | // notFound is an error for a name that doesn't exist. It suggests close |
| 620 | // matches. |
| 621 | func notFound(msg, name string, candidates []string) error { |
| 622 | if matches := closeMatches(name, candidates, 5); len(matches) > 0 { |
| 623 | return fmt.Errorf("%s; did you mean %s?", msg, strings.Join(matches, ", ")) |
| 624 | } |
| 625 | return errors.New(msg) |
| 626 | } |
| 627 | |
| 628 | // closeMatches finds candidates that differ from name only in case, by a typo |
| 629 | // or two, or that contain it. |
no test coverage detected