Skip to content

Commit

Permalink
lookup fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed May 12, 2022
1 parent df45523 commit 84e1995
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gopmod/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ func (p *Module) Lookup(pkgPath string) (pkg *Package, err error) {
case PkgtModule:
modPath := p.Path()
modDir := p.Root()
dir := modDir + pkgPath[:len(modPath)]
dir := modDir + pkgPath[len(modPath):]
pkg = &Package{Type: PkgtModule, ModPath: modPath, ModDir: modDir, Dir: dir}
case PkgtExtern:
if modPath, modVer, ok := p.LookupExternPkg(pkgPath); ok {
if modDir, e := modcache.Path(modVer); e == nil {
dir := modDir + pkgPath[:len(modPath)]
dir := modDir + pkgPath[len(modPath):]
pkg = &Package{Type: PkgtExtern, ModPath: modPath, ModDir: modDir, Dir: dir}
} else {
return nil, e
Expand Down

0 comments on commit 84e1995

Please sign in to comment.