Skip to content

Commit 5533b10

Browse files
committed
fix: replace local dir
1 parent d4c14b3 commit 5533b10

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lang/golang/parser/parser.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,15 @@ func getDeps(dir string, goWork bool) (a map[string]string, hasGoWork bool, cgoP
223223
if len(mod.CgoFiles) > 0 {
224224
cgoPkgs[module.Path] = true
225225
}
226+
226227
if module.Replace != nil {
227-
deps[module.Path] = module.Replace.Path + "@" + module.Replace.Version
228+
if strings.HasPrefix(module.Replace.Path, "./") ||
229+
strings.HasPrefix(module.Replace.Path, "../") ||
230+
strings.HasPrefix(module.Replace.Path, "/") {
231+
// local replace
232+
deps[module.Path] = module.Path
233+
234+
}
228235
} else {
229236
if module.Version != "" {
230237
deps[module.Path] = module.Path + "@" + module.Version

0 commit comments

Comments
 (0)