fix relPath when there's replacement

This commit is contained in:
HuangYi 2022-05-20 17:41:10 +08:00
parent 7f6bfc93a3
commit d151d0b036
No known key found for this signature in database
GPG key ID: 58776091521E8B17

View file

@ -163,11 +163,11 @@ func fetchPackage(caches []map[string]*types.Package, importPath string, goPacka
rev = commitShaRev.FindAllStringSubmatch(rev, -1)[0][1]
}
goPackagePathPrefix, pathMajor, _ := module.SplitPathVersion(goPackagePath)
importPathPrefix, pathMajor, _ := module.SplitPathVersion(importPath)
// Relative path within the repo
relPath := strings.TrimPrefix(goPackagePathPrefix, repoRoot.Root+"/")
if relPath == goPackagePathPrefix {
relPath := strings.TrimPrefix(importPathPrefix, repoRoot.Root+"/")
if relPath == importPathPrefix {
relPath = ""
}