refactor(ninja): use slices.Equal in mutateTags
This commit is contained in:
parent
03d32aba26
commit
e16655aed8
@ -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
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user