matchLen returns the length of the longest prefix shared by x and y.
(x, y string)
| 535 | |
| 536 | // matchLen returns the length of the longest prefix shared by x and y. |
| 537 | func matchLen(x, y string) int { |
| 538 | i := 0 |
| 539 | for i < len(x) && i < len(y) && x[i] == y[i] { |
| 540 | i++ |
| 541 | } |
| 542 | return i |
| 543 | } |
| 544 | |
| 545 | // addImport adds the import path to the file f, if absent. |
| 546 | func addImport(f *ast.File, ipath string) (added bool) { |