Skip to content

Commit

Permalink
fix: funcDeclaration body check (#1310)
Browse files Browse the repository at this point in the history
Signed-off-by: Eray Ates <eates23@gmail.com>
  • Loading branch information
rytsh committed Aug 26, 2022
1 parent a3935c5 commit 007219f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages.go
Expand Up @@ -164,7 +164,8 @@ func (pkgDefs *PackagesDefinitions) parseTypesFromFile(astFile *ast.File, packag

func (pkgDefs *PackagesDefinitions) parseFunctionScopedTypesFromFile(astFile *ast.File, packagePath string, parsedSchemas map[*TypeSpecDef]*Schema) {
for _, astDeclaration := range astFile.Decls {
if funcDeclaration, ok := astDeclaration.(*ast.FuncDecl); ok {
funcDeclaration, ok := astDeclaration.(*ast.FuncDecl)
if ok && funcDeclaration.Body != nil {
for _, stmt := range funcDeclaration.Body.List {
if declStmt, ok := (stmt).(*ast.DeclStmt); ok {
if genDecl, ok := (declStmt.Decl).(*ast.GenDecl); ok && genDecl.Tok == token.TYPE {
Expand Down

0 comments on commit 007219f

Please sign in to comment.