Update cri to 4ea022f82a55c449bf15bfc62ac8b0de968d81be.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
16
vendor/github.com/emicklei/go-restful/curly_route.go
generated
vendored
16
vendor/github.com/emicklei/go-restful/curly_route.go
generated
vendored
@@ -11,6 +11,7 @@ type curlyRoute struct {
|
||||
staticCount int
|
||||
}
|
||||
|
||||
// sortableCurlyRoutes orders by most parameters and path elements first.
|
||||
type sortableCurlyRoutes []curlyRoute
|
||||
|
||||
func (s *sortableCurlyRoutes) add(route curlyRoute) {
|
||||
@@ -18,6 +19,7 @@ func (s *sortableCurlyRoutes) add(route curlyRoute) {
|
||||
}
|
||||
|
||||
func (s sortableCurlyRoutes) routes() (routes []Route) {
|
||||
routes = make([]Route, 0, len(s))
|
||||
for _, each := range s {
|
||||
routes = append(routes, each.route) // TODO change return type
|
||||
}
|
||||
@@ -31,22 +33,22 @@ func (s sortableCurlyRoutes) Swap(i, j int) {
|
||||
s[i], s[j] = s[j], s[i]
|
||||
}
|
||||
func (s sortableCurlyRoutes) Less(i, j int) bool {
|
||||
ci := s[i]
|
||||
cj := s[j]
|
||||
a := s[j]
|
||||
b := s[i]
|
||||
|
||||
// primary key
|
||||
if ci.staticCount < cj.staticCount {
|
||||
if a.staticCount < b.staticCount {
|
||||
return true
|
||||
}
|
||||
if ci.staticCount > cj.staticCount {
|
||||
if a.staticCount > b.staticCount {
|
||||
return false
|
||||
}
|
||||
// secundary key
|
||||
if ci.paramCount < cj.paramCount {
|
||||
if a.paramCount < b.paramCount {
|
||||
return true
|
||||
}
|
||||
if ci.paramCount > cj.paramCount {
|
||||
if a.paramCount > b.paramCount {
|
||||
return false
|
||||
}
|
||||
return ci.route.Path < cj.route.Path
|
||||
return a.route.Path < b.route.Path
|
||||
}
|
||||
|
Reference in New Issue
Block a user