util/cmpx: remove code that's in the stdlib now

The cmpx.Compare function (and associated interface) are now available
in the standard library as cmp.Compare. Remove our version of it and use
the version from the standard library.

Updates #cleanup

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I4be3ac63d466c05eb7a0babb25cb0d41816fbd53
This commit is contained in:
Andrew Dunham
2023-12-18 17:43:01 -05:00
parent 945cf836ee
commit a661287c4b
8 changed files with 15 additions and 51 deletions

View File

@@ -25,6 +25,7 @@
package main
import (
"cmp"
"encoding/base64"
"encoding/json"
"flag"
@@ -45,7 +46,6 @@ import (
"github.com/go-json-experiment/json/jsontext"
"tailscale.com/types/logid"
"tailscale.com/types/netlogtype"
"tailscale.com/util/cmpx"
"tailscale.com/util/must"
)
@@ -155,7 +155,7 @@ func printMessage(msg message) {
slices.SortFunc(traffic, func(x, y netlogtype.ConnectionCounts) int {
nx := x.TxPackets + x.TxBytes + x.RxPackets + x.RxBytes
ny := y.TxPackets + y.TxBytes + y.RxPackets + y.RxBytes
return cmpx.Compare(ny, nx)
return cmp.Compare(ny, nx)
})
var sum netlogtype.Counts
for _, cc := range traffic {