mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 11:50:55 +00:00
make golint happy parser.go
This commit is contained in:
parent
67b36d7c48
commit
21fffc446b
14
parser.go
14
parser.go
@ -42,13 +42,13 @@ func init() {
|
|||||||
`
|
`
|
||||||
|
|
||||||
var (
|
var (
|
||||||
lastupdateFilename string = "lastupdate.tmp"
|
lastupdateFilename = "lastupdate.tmp"
|
||||||
commentFilename string
|
commentFilename string
|
||||||
pkgLastupdate map[string]int64
|
pkgLastupdate map[string]int64
|
||||||
genInfoList map[string][]ControllerComments
|
genInfoList map[string][]ControllerComments
|
||||||
)
|
)
|
||||||
|
|
||||||
const COMMENTFL = "commentsRouter_"
|
const coomentPrefix = "commentsRouter_"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
pkgLastupdate = make(map[string]int64)
|
pkgLastupdate = make(map[string]int64)
|
||||||
@ -56,7 +56,7 @@ func init() {
|
|||||||
|
|
||||||
func parserPkg(pkgRealpath, pkgpath string) error {
|
func parserPkg(pkgRealpath, pkgpath string) error {
|
||||||
rep := strings.NewReplacer("/", "_", ".", "_")
|
rep := strings.NewReplacer("/", "_", ".", "_")
|
||||||
commentFilename = COMMENTFL + rep.Replace(pkgpath) + ".go"
|
commentFilename = coomentPrefix + rep.Replace(pkgpath) + ".go"
|
||||||
if !compareFile(pkgRealpath) {
|
if !compareFile(pkgRealpath) {
|
||||||
Info(pkgRealpath + " has not changed, not reloading")
|
Info(pkgRealpath + " has not changed, not reloading")
|
||||||
return nil
|
return nil
|
||||||
@ -129,9 +129,11 @@ func parserComments(comments *ast.CommentGroup, funcName, controllerName, pkgpat
|
|||||||
func genRouterCode() {
|
func genRouterCode() {
|
||||||
os.Mkdir(path.Join(workPath, "routers"), 0755)
|
os.Mkdir(path.Join(workPath, "routers"), 0755)
|
||||||
Info("generate router from comments")
|
Info("generate router from comments")
|
||||||
var globalinfo string
|
var (
|
||||||
sortKey := make([]string, 0)
|
globalinfo string
|
||||||
for k, _ := range genInfoList {
|
sortKey []string
|
||||||
|
)
|
||||||
|
for k := range genInfoList {
|
||||||
sortKey = append(sortKey, k)
|
sortKey = append(sortKey, k)
|
||||||
}
|
}
|
||||||
sort.Strings(sortKey)
|
sort.Strings(sortKey)
|
||||||
|
Loading…
Reference in New Issue
Block a user