Skip to content

Commit 1cbfc09

Browse files
committed
Fix type assertion in parsePackage function to ensure proper handling of function declarations without receivers.
1 parent 11b2fea commit 1cbfc09

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/gen-func-wrappers/gen/parse.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ func parsePackage(pkgDir, excludeFilename string, onlyFuncs ...string) (pkg *ast
5151
// ast.Print(fileSet, obj)
5252
continue
5353
}
54-
funcDecl := obj.Decl.(*ast.FuncDecl)
55-
if funcDecl.Recv != nil {
54+
funcDecl, ok := obj.Decl.(*ast.FuncDecl)
55+
if !ok || funcDecl.Recv != nil {
5656
continue
5757
}
5858
if len(onlyFuncs) > 0 {

0 commit comments

Comments
 (0)