From 2c2b075eaa254687c80978bc3cf54494a00ae643 Mon Sep 17 00:00:00 2001 From: houpo-bob Date: Tue, 29 Jul 2025 03:04:53 +0800 Subject: [PATCH] refactor: use slices.Equal to simplify code (#7426) --- plugin/pkg/fall/fall.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/plugin/pkg/fall/fall.go b/plugin/pkg/fall/fall.go index 898c8db76..b4b9329f2 100644 --- a/plugin/pkg/fall/fall.go +++ b/plugin/pkg/fall/fall.go @@ -13,6 +13,8 @@ package fall import ( + "slices" + "github.com/coredns/coredns/plugin" ) @@ -48,15 +50,7 @@ func (f *F) SetZonesFromArgs(zones []string) { // Equal returns true if f and g are equal. func (f *F) Equal(g F) bool { - if len(f.Zones) != len(g.Zones) { - return false - } - for i := range f.Zones { - if f.Zones[i] != g.Zones[i] { - return false - } - } - return true + return slices.Equal(f.Zones, g.Zones) } // Zero returns a zero valued F.