We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d552283 commit a6af86bCopy full SHA for a6af86b
1 file changed
lang/golang/parser/ctx.go
@@ -142,6 +142,14 @@ func (ctx *fileContext) GetMod(impt string) (string, error) {
142
if isSysPkg(impt) {
143
return "", errSysImport
144
}
145
+
146
+ // fileContext 中的 import 信息只有**当前文件的引用路径**,但是存在一种场景就是实际调用的节点在另外的一个Package,导致漏解析
147
+ // 常见于"链式调用"、"另一个 pkg 的全局变量的类型在另外一个 pkg 下"
148
+ if ctx.module != nil && ctx.module.Packages != nil {
149
+ if _, exist := ctx.module.Packages[impt]; exist {
150
+ return ctx.module.Name, nil
151
+ }
152
153
for _, ims := range ctx.imports.ProjectImports {
154
if ims == impt {
155
return ctx.module.Name, nil
0 commit comments