Beego/parser.go

47 lines
1.1 KiB
Go
Raw Normal View History

2014-06-08 12:24:01 +00:00
// Beego (http://beego.me/)
// @description beego is an open-source, high-performance web framework for the Go programming language.
// @link http://github.com/astaxie/beego for the canonical source repository
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// @authors astaxie
package beego
2014-06-09 02:11:37 +00:00
import (
"os"
"path/filepath"
)
var globalControllerRouter = `package routers
import (
"github.com/astaxie/beego"
)
func init() {
{{.globalinfo}}
}
`
func parserPkg(pkgpath string) error {
err := filepath.Walk(pkgpath, func(path string, info os.FileInfo, err error) error {
if err != nil {
Error("error scan app Controller source:", err)
return err
}
//if is normal file or name is temp skip
//directory is needed
if !info.IsDir() || info.Name() == "tmp" {
return nil
}
//fileSet := token.NewFileSet()
//astPkgs, err := parser.ParseDir(fileSet, path, func(info os.FileInfo) bool {
// name := info.Name()
// return !info.IsDir() && !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".go")
//}, parser.ParseComments)
return nil
})
return err
}