diff --git a/go.mod b/go.mod index 6929d09..76a9623 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module crudgen +module git.gogacoder.ru/NTO/crudgen go 1.23 diff --git a/internal/writer.go b/internal/writer.go index 42fdcc6..4d80636 100644 --- a/internal/writer.go +++ b/internal/writer.go @@ -280,7 +280,20 @@ func ImplementMethod(file *ast.File, methodDecl *ast.FuncDecl, reimplement bool) } if reimplement || !methodImplemented { - file.Decls = append(decls, methodDecl) + file.Decls = append( + decls, + &ast.FuncDecl{ + Doc: methodDecl.Doc, + Recv: methodDecl.Recv, + Name: methodDecl.Name, + Type: methodDecl.Type, + Body: &ast.BlockStmt{ + Lbrace: token.NoPos, + List: methodDecl.Body.List, + Rbrace: token.NoPos, + }, + }, + ) } // Reload AST: fix issues with syntax 'hallucinations'