mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-06-10 10:15:57 +00:00
vendor: Update vendor logic
This commit is contained in:
parent
c6ac5cbc87
commit
4ca64b85f0
1540 changed files with 265304 additions and 91616 deletions
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue