Skip to content

Commit

Permalink
Compare also by host
Browse files Browse the repository at this point in the history
  • Loading branch information
alt-dima committed Apr 26, 2024
1 parent 62710e0 commit 91f88e3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ func main() {
result := false

client1RoutePaths := slicePointersToValues(client1Route.Paths)
client1RouteHosts := slicePointersToValues(client1Route.Hosts)
strClient1RoutePaths := fmt.Sprint(client1RoutePaths)

for _, client2Route := range allRoutesClient2 {

if slices.Equal(client1RoutePaths, slicePointersToValues(client2Route.Paths)) {
if slices.Equal(client1RoutePaths, slicePointersToValues(client2Route.Paths)) && slices.Equal(client1RouteHosts, slicePointersToValues(client2Route.Hosts)) {
result = true
//checking route parameters
if *client1Route.PreserveHost != *client2Route.PreserveHost {
Expand All @@ -76,9 +77,9 @@ func main() {
if !slices.Equal(slicePointersToValues(client1Route.Methods), slicePointersToValues(client2Route.Methods)) {
log.Printf("Route %v Methods not equals \n", strClient1RoutePaths)
}
if !slices.Equal(slicePointersToValues(client1Route.Hosts), slicePointersToValues(client2Route.Hosts)) {
log.Printf("Route %v Hosts not equals \n", strClient1RoutePaths)
}
// if !slices.Equal(slicePointersToValues(client1Route.Hosts), slicePointersToValues(client2Route.Hosts)) {
// log.Printf("Route %v Hosts not equals \n", strClient1RoutePaths)
// }
if !slices.Equal(slicePointersToValues(client1Route.Protocols), slicePointersToValues(client2Route.Protocols)) {
log.Printf("Route %v Protocols not equals \n", strClient1RoutePaths)
}
Expand Down

0 comments on commit 91f88e3

Please sign in to comment.