1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 21:01:31 +00:00

Merge pull request #1367 from dvwallin/develop

added a check to parser to not panic (in develop)
This commit is contained in:
astaxie 2015-09-17 23:41:59 +08:00
commit e665a7dd32

View File

@ -77,7 +77,10 @@ func parserPkg(pkgRealpath, pkgpath string) error {
switch specDecl := d.(type) {
case *ast.FuncDecl:
if specDecl.Recv != nil {
parserComments(specDecl.Doc, specDecl.Name.String(), fmt.Sprint(specDecl.Recv.List[0].Type.(*ast.StarExpr).X), pkgpath)
exp, ok := specDecl.Recv.List[0].Type.(*ast.StarExpr) // Check that the type is correct first beforing throwing to parser
if ok {
parserComments(specDecl.Doc, specDecl.Name.String(), fmt.Sprint(exp.X), pkgpath)
}
}
}
}