From 05f7eeb5c9dcdd39bece012f1fc6438e924e3da1 Mon Sep 17 00:00:00 2001 From: wdvxdr Date: Tue, 28 Dec 2021 16:56:36 +0800 Subject: [PATCH] fix: fix api-generator panic --- cmd/api-generator/main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmd/api-generator/main.go b/cmd/api-generator/main.go index 3a6a73b..3e6c9b0 100644 --- a/cmd/api-generator/main.go +++ b/cmd/api-generator/main.go @@ -112,7 +112,7 @@ func main() { for _, decl := range file.Decls { switch decl := decl.(type) { case *ast.FuncDecl: - if decl.Recv == nil { + if !decl.Name.IsExported() || decl.Recv == nil { continue } if st, ok := decl.Recv.List[0].Type.(*ast.StarExpr); !ok || st.X.(*ast.Ident).Name != "CQBot" { @@ -137,8 +137,6 @@ func main() { for _, comment := range decl.Doc.List { annotation, args := match(comment.Text) switch annotation { - case "": - continue case "route": router.Path = args case "alias":