Skip to content

Commit

Permalink
code style fixes.
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Cottin <stephane.cottin@vixns.com>
  • Loading branch information
vixns committed Apr 4, 2024
1 parent 1b015df commit 2d4a4da
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions internal/gatewayapi/sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ func (x XdsIRRoutes) Less(i, j int) bool {
// Exact > RegularExpression > PathPrefix
if x[i].PathMatch != nil && x[i].PathMatch.Exact != nil {
if x[j].PathMatch != nil {
if x[j].PathMatch.Prefix != nil || x[j].PathMatch.SafeRegex != nil {
if x[j].PathMatch.SafeRegex != nil {
return false
}
}
}
if x[i].PathMatch != nil && x[i].PathMatch.Prefix != nil {
if x[j].PathMatch != nil {
if x[j].PathMatch.Exact != nil || x[j].PathMatch.SafeRegex != nil {
return true
if x[j].PathMatch.Prefix != nil {
return false
}
}
}
Expand All @@ -43,6 +39,15 @@ func (x XdsIRRoutes) Less(i, j int) bool {
}
}
}
if x[i].PathMatch != nil && x[i].PathMatch.Prefix != nil {
if x[j].PathMatch != nil {
if x[j].PathMatch.Exact != nil {
return true
}
if x[j].PathMatch.SafeRegex != nil {
return true
}
}
// Equal case

// 2. Sort based on characters in a matching path.
Expand Down

0 comments on commit 2d4a4da

Please sign in to comment.