11package nmagent
22
3- // Equal compares two Interfaces objects for equality.
4- func (i Interfaces ) Equal (other Interfaces ) bool {
3+ // equalPtr compares two Interfaces objects for equality.
4+ func (i * Interfaces ) equalPtr (other * Interfaces ) bool {
55 if len (i .Entries ) != len (other .Entries ) {
66 return false
77 }
88 for idx , entry := range i .Entries {
9- if ! entry .Equal ( other .Entries [idx ]) {
9+ if ! entry .equalPtr ( & other .Entries [idx ]) {
1010 return false
1111 }
1212 }
1313 return true
1414}
1515
16- // Equal compares two Interface objects for equality.
17- func (i Interface ) Equal (other Interface ) bool {
16+ // Equal compares two Interfaces objects for equality.
17+ func (i Interfaces ) Equal (other Interfaces ) bool {
18+ return i .equalPtr (& other )
19+ }
20+
21+ // equalPtr compares two Interface objects for equality.
22+ func (i * Interface ) equalPtr (other * Interface ) bool {
1823 if len (i .InterfaceSubnets ) != len (other .InterfaceSubnets ) {
1924 return false
2025 }
2126 for idx , subnet := range i .InterfaceSubnets {
22- if ! subnet .Equal ( other .InterfaceSubnets [idx ]) {
27+ if ! subnet .equalPtr ( & other .InterfaceSubnets [idx ]) {
2328 return false
2429 }
2530 }
@@ -29,23 +34,38 @@ func (i Interface) Equal(other Interface) bool {
2934 return true
3035}
3136
32- // Equal compares two InterfaceSubnet objects for equality.
33- func (s InterfaceSubnet ) Equal (other InterfaceSubnet ) bool {
37+ // Equal compares two Interface objects for equality.
38+ func (i Interface ) Equal (other Interface ) bool {
39+ return i .equalPtr (& other )
40+ }
41+
42+ // equalPtr compares two InterfaceSubnet objects for equality.
43+ func (s * InterfaceSubnet ) equalPtr (other * InterfaceSubnet ) bool {
3444 if len (s .IPAddress ) != len (other .IPAddress ) {
3545 return false
3646 }
3747 if s .Prefix != other .Prefix {
3848 return false
3949 }
4050 for idx , ip := range s .IPAddress {
41- if ! ip .Equal ( other .IPAddress [idx ]) {
51+ if ! ip .equalPtr ( & other .IPAddress [idx ]) {
4252 return false
4353 }
4454 }
4555 return true
4656}
4757
58+ // Equal compares two InterfaceSubnet objects for equality.
59+ func (s InterfaceSubnet ) Equal (other InterfaceSubnet ) bool {
60+ return s .equalPtr (& other )
61+ }
62+
63+ // equalPtr compares two NodeIP objects for equality.
64+ func (ip * NodeIP ) equalPtr (other * NodeIP ) bool {
65+ return ip .IsPrimary == other .IsPrimary && ip .Address .Equal (other .Address )
66+ }
67+
4868// Equal compares two NodeIP objects for equality.
4969func (ip NodeIP ) Equal (other NodeIP ) bool {
50- return ip .IsPrimary == other . IsPrimary && ip . Address . Equal ( other . Address )
70+ return ip .equalPtr ( & other )
5171}
0 commit comments