Merge pull request #1394 from aledbf/improve-equals

Improve equals
This commit is contained in:
Manuel Alejandro de Brito Fontes 2017-09-19 18:49:33 -07:00 committed by GitHub
commit f553e49988
2 changed files with 198 additions and 210 deletions

View file

@ -70,15 +70,9 @@ func (c1 *Configuration) Equal(c2 *Configuration) bool {
return false
}
for _, c1s := range c1.Servers {
found := false
for _, c2s := range c2.Servers {
if c1s.Equal(c2s) {
found = true
break
}
}
if !found {
// Servers are sorted
for idx, c1s := range c1.Servers {
if !c1s.Equal(c2.Servers[idx]) {
return false
}
}
@ -306,15 +300,9 @@ func (s1 *Server) Equal(s2 *Server) bool {
return false
}
for _, s1l := range s1.Locations {
found := false
for _, sl2 := range s2.Locations {
if s1l.Equal(sl2) {
found = true
break
}
}
if !found {
// Location are sorted
for idx, s1l := range s1.Locations {
if !s1l.Equal(s2.Locations[idx]) {
return false
}
}