refactor: use slices.Equal to simplify code

Signed-off-by: wellweek <xiezitai@outlook.com>
This commit is contained in:
wellweek 2025-03-21 15:32:38 +08:00 committed by Ayoub Mrini
parent 6566c5a2b3
commit 4e91f13db2

View File

@ -250,15 +250,7 @@ func (ls Labels) WithoutEmpty() Labels {
// Equal returns whether the two label sets are equal. // Equal returns whether the two label sets are equal.
func Equal(ls, o Labels) bool { func Equal(ls, o Labels) bool {
if len(ls) != len(o) { return slices.Equal(ls, o)
return false
}
for i, l := range ls {
if l != o[i] {
return false
}
}
return true
} }
// EmptyLabels returns n empty Labels value, for convenience. // EmptyLabels returns n empty Labels value, for convenience.