1
0
mirror of https://github.com/beego/bee.git synced 2024-11-26 06:21:34 +00:00

init the maps

This commit is contained in:
astaxie 2016-08-08 20:48:51 +08:00
parent d9f182c84f
commit 743348ae1e

View File

@ -213,6 +213,9 @@ func analisysNSInclude(baseurl string, ce *ast.CallExpr) string {
if item.Options != nil { if item.Options != nil {
item.Options.Tags = []string{tag} item.Options.Tags = []string{tag}
} }
if len(rootapi.Paths) == 0 {
rootapi.Paths = make(map[string]*swagger.Item)
}
rootapi.Paths[rt] = item rootapi.Paths[rt] = item
} }
} }
@ -320,7 +323,9 @@ func isSystemPackage(pkgpath string) bool {
func parserComments(comments *ast.CommentGroup, funcName, controllerName, pkgpath string) error { func parserComments(comments *ast.CommentGroup, funcName, controllerName, pkgpath string) error {
var routerPath string var routerPath string
var HTTPMethod string var HTTPMethod string
opts := swagger.Operation{} opts := swagger.Operation{
Responses: make(map[string]swagger.Response),
}
if comments != nil && comments.List != nil { if comments != nil && comments.List != nil {
for _, c := range comments.List { for _, c := range comments.List {
t := strings.TrimSpace(strings.TrimLeft(c.Text, "//")) t := strings.TrimSpace(strings.TrimLeft(c.Text, "//"))