mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 12:40: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 (
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user