From e16655aed8bfd9b74d2400c0fd247c3287059208 Mon Sep 17 00:00:00 2001 From: Alex Dunmow Date: Sun, 7 Jun 2026 15:33:38 +0800 Subject: [PATCH] refactor(ninja): use slices.Equal in mutateTags --- cmd/ninja/cmd/plugin_tags.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/cmd/ninja/cmd/plugin_tags.go b/cmd/ninja/cmd/plugin_tags.go index bc84f08..4690ac1 100644 --- a/cmd/ninja/cmd/plugin_tags.go +++ b/cmd/ninja/cmd/plugin_tags.go @@ -3,6 +3,7 @@ package cmd import ( "fmt" "os" + "slices" "sort" "strings" @@ -133,7 +134,7 @@ func mutateTags(op string, args []string) error { sort.Strings(sortedBefore) sort.Strings(sortedAfter) fmt.Printf("Tags: [%s] → [%s]\n", strings.Join(sortedBefore, ", "), strings.Join(sortedAfter, ", ")) - if !equalStringSlices(sortedBefore, sortedAfter) { + if !slices.Equal(sortedBefore, sortedAfter) { fmt.Println("Run 'ninja plugin publish' to push to the registry.") } return nil @@ -166,14 +167,3 @@ func writeLocalModTags(mod *core.ModFile, tags []string) error { ) } -func equalStringSlices(a, b []string) bool { - if len(a) != len(b) { - return false - } - for i := range a { - if a[i] != b[i] { - return false - } - } - return true -}