mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 03:40:49 +00:00
dont generate comment if router not found
This commit is contained in:
parent
4cba78afd9
commit
a1bc94e648
16
parser.go
16
parser.go
@ -118,13 +118,15 @@ func parserComments(f *ast.FuncDecl, controllerName, pkgpath string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
key := pkgpath + ":" + controllerName
|
||||
cc := ControllerComments{}
|
||||
cc.Method = f.Name.String()
|
||||
cc.Router = parsedComment.routerPath
|
||||
cc.AllowHTTPMethods = parsedComment.methods
|
||||
cc.MethodParams = buildMethodParams(f.Type.Params.List, parsedComment)
|
||||
genInfoList[key] = append(genInfoList[key], cc)
|
||||
if parsedComment.routerPath != "" {
|
||||
key := pkgpath + ":" + controllerName
|
||||
cc := ControllerComments{}
|
||||
cc.Method = f.Name.String()
|
||||
cc.Router = parsedComment.routerPath
|
||||
cc.AllowHTTPMethods = parsedComment.methods
|
||||
cc.MethodParams = buildMethodParams(f.Type.Params.List, parsedComment)
|
||||
genInfoList[key] = append(genInfoList[key], cc)
|
||||
}
|
||||
|
||||
}
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user