From fd580611bdf2e77f5861cb52c09ae6f051e85dc2 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 8 Apr 2025 15:11:23 -0700 Subject: [PATCH] ipn: use slices.Equal in another spot Updates #8632 Change-Id: I91edd800f97eb0bf9a00866a1e39effc5e4f4e94 Signed-off-by: Brad Fitzpatrick --- ipn/prefs.go | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/ipn/prefs.go b/ipn/prefs.go index 98f04dfa9..5b3e95b33 100644 --- a/ipn/prefs.go +++ b/ipn/prefs.go @@ -607,9 +607,9 @@ func (p *Prefs) Equals(p2 *Prefs) bool { p.OperatorUser == p2.OperatorUser && p.Hostname == p2.Hostname && p.ForceDaemon == p2.ForceDaemon && - compareIPNets(p.AdvertiseRoutes, p2.AdvertiseRoutes) && - compareStrings(p.AdvertiseTags, p2.AdvertiseTags) && - compareStrings(p.AdvertiseServices, p2.AdvertiseServices) && + slices.Equal(p.AdvertiseRoutes, p2.AdvertiseRoutes) && + slices.Equal(p.AdvertiseTags, p2.AdvertiseTags) && + slices.Equal(p.AdvertiseServices, p2.AdvertiseServices) && p.Persist.Equals(p2.Persist) && p.ProfileName == p2.ProfileName && p.AutoUpdate.Equals(p2.AutoUpdate) && @@ -636,30 +636,6 @@ func (ap AppConnectorPrefs) Pretty() string { return "" } -func compareIPNets(a, b []netip.Prefix) bool { - if len(a) != len(b) { - return false - } - for i := range a { - if a[i] != b[i] { - return false - } - } - return true -} - -func compareStrings(a, b []string) bool { - if len(a) != len(b) { - return false - } - for i := range a { - if a[i] != b[i] { - return false - } - } - return true -} - // NewPrefs returns the default preferences to use. func NewPrefs() *Prefs { // Provide default values for options which might be missing