1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 05:50:56 +00:00

make golint happy parser.go

This commit is contained in:
astaxie 2015-09-08 21:45:45 +08:00
parent 67b36d7c48
commit 21fffc446b

View File

@ -42,13 +42,13 @@ func init() {
`
var (
lastupdateFilename string = "lastupdate.tmp"
lastupdateFilename = "lastupdate.tmp"
commentFilename string
pkgLastupdate map[string]int64
genInfoList map[string][]ControllerComments
)
const COMMENTFL = "commentsRouter_"
const coomentPrefix = "commentsRouter_"
func init() {
pkgLastupdate = make(map[string]int64)
@ -56,7 +56,7 @@ func init() {
func parserPkg(pkgRealpath, pkgpath string) error {
rep := strings.NewReplacer("/", "_", ".", "_")
commentFilename = COMMENTFL + rep.Replace(pkgpath) + ".go"
commentFilename = coomentPrefix + rep.Replace(pkgpath) + ".go"
if !compareFile(pkgRealpath) {
Info(pkgRealpath + " has not changed, not reloading")
return nil
@ -129,9 +129,11 @@ func parserComments(comments *ast.CommentGroup, funcName, controllerName, pkgpat
func genRouterCode() {
os.Mkdir(path.Join(workPath, "routers"), 0755)
Info("generate router from comments")
var globalinfo string
sortKey := make([]string, 0)
for k, _ := range genInfoList {
var (
globalinfo string
sortKey []string
)
for k := range genInfoList {
sortKey = append(sortKey, k)
}
sort.Strings(sortKey)