From e1d7bc88265bfae3b177fb28ccd77f14ad9255d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A9=BA=E8=A7=81?= Date: Mon, 8 Jun 2015 17:25:46 +0800 Subject: [PATCH] remove space after int()& add sort for commentsRouter file --- parser.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/parser.go b/parser.go index be91b4cb..cf8dee22 100644 --- a/parser.go +++ b/parser.go @@ -24,6 +24,7 @@ import ( "io/ioutil" "os" "path" + "sort" "strings" "github.com/astaxie/beego/utils" @@ -36,7 +37,7 @@ import ( ) func init() { - {{.globalinfo}} +{{.globalinfo}} } ` @@ -129,7 +130,13 @@ func genRouterCode() { os.Mkdir(path.Join(workPath, "routers"), 0755) Info("generate router from comments") var globalinfo string - for k, cList := range genInfoList { + sortKey := make([]string, 0) + for k, _ := range genInfoList { + sortKey = append(sortKey, k) + } + sort.Strings(sortKey) + for _, k := range sortKey { + cList := genInfoList[k] for _, c := range cList { allmethod := "nil" if len(c.AllowHTTPMethods) > 0 {