Commit 621c2539 authored by astaxie's avatar astaxie Committed by GitHub

Merge pull request #2766 from yangsf5/master

sort ControllerComments
parents 715ba918 fc86f642
......@@ -55,6 +55,12 @@ type ControllerComments struct {
MethodParams []*param.MethodParam
}
type ControllerCommentsSlice []ControllerComments
func (p ControllerCommentsSlice) Len() int { return len(p) }
func (p ControllerCommentsSlice) Less(i, j int) bool { return p[i].Router < p[j].Router }
func (p ControllerCommentsSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// Controller defines some basic http request handler operations, such as
// http context, template and view, session and xsrf.
type Controller struct {
......
......@@ -275,6 +275,7 @@ func genRouterCode(pkgRealpath string) {
sort.Strings(sortKey)
for _, k := range sortKey {
cList := genInfoList[k]
sort.Sort(ControllerCommentsSlice(cList))
for _, c := range cList {
allmethod := "nil"
if len(c.AllowHTTPMethods) > 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment