From d151d0b03652db166651ec1e5547dcbd14851f5b Mon Sep 17 00:00:00 2001 From: HuangYi Date: Fri, 20 May 2022 17:41:10 +0800 Subject: [PATCH] fix relPath when there's replacement --- fetch/fetch.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fetch/fetch.go b/fetch/fetch.go index d65cd9f..7c80313 100644 --- a/fetch/fetch.go +++ b/fetch/fetch.go @@ -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 = "" }