Skip to content

Commit aa7ab67

Browse files
committed
Fixed panic when parsing selector expressions containing composite literals
Signed-off-by: Joe Kralicky <[email protected]>
1 parent 99e7fbc commit aa7ab67

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pkg/loader/refs.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,14 @@ func (c *referenceCollector) Visit(node ast.Node) ast.Visitor {
133133
// local reference or dot-import, ignore
134134
return nil
135135
case *ast.SelectorExpr:
136-
pkgName := typedNode.X.(*ast.Ident).Name
137-
c.refs.external(pkgName)
138-
return nil
136+
switch x := typedNode.X.(type) {
137+
case *ast.Ident:
138+
pkgName := x.Name
139+
c.refs.external(pkgName)
140+
return nil
141+
default:
142+
return c
143+
}
139144
default:
140145
return c
141146
}

0 commit comments

Comments
 (0)