From 5533b107bc16d5f15864e659c850b9959bdd5ef8 Mon Sep 17 00:00:00 2001 From: "yinxuran.lucky" Date: Sat, 27 Dec 2025 09:37:13 +0800 Subject: [PATCH] fix: replace local dir --- lang/golang/parser/parser.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lang/golang/parser/parser.go b/lang/golang/parser/parser.go index e45ff02..55301ab 100644 --- a/lang/golang/parser/parser.go +++ b/lang/golang/parser/parser.go @@ -223,8 +223,15 @@ func getDeps(dir string, goWork bool) (a map[string]string, hasGoWork bool, cgoP if len(mod.CgoFiles) > 0 { cgoPkgs[module.Path] = true } + if module.Replace != nil { - deps[module.Path] = module.Replace.Path + "@" + module.Replace.Version + if strings.HasPrefix(module.Replace.Path, "./") || + strings.HasPrefix(module.Replace.Path, "../") || + strings.HasPrefix(module.Replace.Path, "/") { + // local replace + deps[module.Path] = module.Path + + } } else { if module.Version != "" { deps[module.Path] = module.Path + "@" + module.Version