Skip to content

Commit

Permalink
fix changed slices.SortFunc signature
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
  • Loading branch information
inteon committed Aug 24, 2023
1 parent d8b3888 commit 6a159bb
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,12 @@ func EqualIPsUnsorted(s1, s2 []net.IP) bool {
s2_2[i] = s2[i].To16()
}

// TODO: the function signature will change to func(a net.IP, b net.IP) int when we upgrade to go 1.21
slices.SortFunc(s1_2, func(a net.IP, b net.IP) bool {
// TODO: this will just change to bytes.Compare (without the <= 0) after we upgrade to go 1.21
return bytes.Compare([]byte(a), []byte(b)) <= 0
slices.SortFunc(s1_2, func(a net.IP, b net.IP) int {
return bytes.Compare([]byte(a), []byte(b))
})

// TODO: the function signature will change to func(a net.IP, b net.IP) int when we upgrade to go 1.21
slices.SortFunc(s2_2, func(a net.IP, b net.IP) bool {
// TODO: this will just change to bytes.Compare (without the <= 0) after we upgrade to go 1.21
return bytes.Compare([]byte(a), []byte(b)) <= 0
slices.SortFunc(s2_2, func(a net.IP, b net.IP) int {
return bytes.Compare([]byte(a), []byte(b))
})

return slices.EqualFunc(s1_2, s2_2, func(a net.IP, b net.IP) bool {
Expand Down

0 comments on commit 6a159bb

Please sign in to comment.