1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-11 16:51:01 +00:00

beego: router change to method Tree

This commit is contained in:
astaxie
2014-06-09 10:11:37 +08:00
parent e00eab7f49
commit 6c8a7f1382
5 changed files with 179 additions and 43 deletions

View File

@ -4,3 +4,43 @@
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// @authors astaxie
package beego
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
}