(pkgpath string, modules []Module)
| 43 | } |
| 44 | |
| 45 | func TranslatePath(pkgpath string, modules []Module) (path string, found bool) { |
| 46 | for _, module := range modules { |
| 47 | if strings.HasPrefix(pkgpath, module.Prefix) { |
| 48 | f := filepath.Join(module.Dir, strings.TrimPrefix(pkgpath, module.Prefix)) |
| 49 | return f, true |
| 50 | } |
| 51 | } |
| 52 | return pkgpath, false |
| 53 | } |
| 54 | |
| 55 | func main() { |
| 56 | modules := []Module{ |