Skip to content

Commit 7a9d36b

Browse files
committed
fix: panic when left symbol more than right sybol
1 parent e7a1ef5 commit 7a9d36b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lang/golang/parser/file.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ func (p *GoParser) parseVar(ctx *fileContext, vspec *ast.ValueSpec, isConst bool
107107
// igore anonymous var
108108
continue
109109
}
110-
if vspec.Values != nil {
110+
// In this case: _, b, _, _ = runtime.Caller(0), vspec.Values only has one element
111+
if len(vspec.Values) == 1 {
112+
val = &vspec.Values[0]
113+
} else {
111114
val = &vspec.Values[i]
112115
}
113116
v = p.newVar(ctx.module.Name, ctx.pkgPath, name.Name, isConst)

0 commit comments

Comments
 (0)