MCPcopy Create free account
hub / github.com/egonelbre/exp / TranslatePath

Function TranslatePath

coverage_example/parse/main.go:45–53  ·  view source on GitHub ↗
(pkgpath string, modules []Module)

Source from the content-addressed store, hash-verified

43}
44
45func 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
55func main() {
56 modules := []Module{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected