e1d7bc88 by 空见

remove space after int()& add sort for commentsRouter file

1 parent 499ee09d
...@@ -24,6 +24,7 @@ import ( ...@@ -24,6 +24,7 @@ import (
24 "io/ioutil" 24 "io/ioutil"
25 "os" 25 "os"
26 "path" 26 "path"
27 "sort"
27 "strings" 28 "strings"
28 29
29 "github.com/astaxie/beego/utils" 30 "github.com/astaxie/beego/utils"
...@@ -36,7 +37,7 @@ import ( ...@@ -36,7 +37,7 @@ import (
36 ) 37 )
37 38
38 func init() { 39 func init() {
39 {{.globalinfo}} 40 {{.globalinfo}}
40 } 41 }
41 ` 42 `
42 43
...@@ -129,7 +130,13 @@ func genRouterCode() { ...@@ -129,7 +130,13 @@ func genRouterCode() {
129 os.Mkdir(path.Join(workPath, "routers"), 0755) 130 os.Mkdir(path.Join(workPath, "routers"), 0755)
130 Info("generate router from comments") 131 Info("generate router from comments")
131 var globalinfo string 132 var globalinfo string
132 for k, cList := range genInfoList { 133 sortKey := make([]string, 0)
134 for k, _ := range genInfoList {
135 sortKey = append(sortKey, k)
136 }
137 sort.Strings(sortKey)
138 for _, k := range sortKey {
139 cList := genInfoList[k]
133 for _, c := range cList { 140 for _, c := range cList {
134 allmethod := "nil" 141 allmethod := "nil"
135 if len(c.AllowHTTPMethods) > 0 { 142 if len(c.AllowHTTPMethods) > 0 {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!