versionFromImport returns N if importPath ends with "pkg/config/vN". Re-uses [versionFromDir] for the vN suffix, so the two helpers cannot drift apart.
(importPath string)
| 29 | // Re-uses [versionFromDir] for the vN suffix, so the two helpers cannot |
| 30 | // drift apart. |
| 31 | func versionFromImport(importPath string) (int, bool) { |
| 32 | const marker = "pkg/config/" |
| 33 | idx := strings.LastIndex(importPath, marker) |
| 34 | if idx < 0 { |
| 35 | return 0, false |
| 36 | } |
| 37 | return versionFromDir(importPath[idx+len(marker):]) |
| 38 | } |
| 39 | |
| 40 | // highestSiblingVersion returns the largest N such that pkg/config/vN/ |
| 41 | // exists as a sibling of filename's directory. Result is cached per |
no test coverage detected