util/cmpx: delete now that we're using Go 1.22

Updates #11058

Change-Id: I09dea8e86f03ec148b715efca339eab8b1f0f644
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2024-02-07 14:27:29 -08:00
committed by Brad Fitzpatrick
parent 5ea071186e
commit 2bd3c1474b
24 changed files with 41 additions and 92 deletions

View File

@@ -4,6 +4,7 @@
package dnscache
import (
"cmp"
"encoding/binary"
"errors"
"fmt"
@@ -13,7 +14,6 @@ import (
"github.com/golang/groupcache/lru"
"golang.org/x/net/dns/dnsmessage"
"tailscale.com/util/cmpx"
)
// MessageCache is a cache that works at the DNS message layer,
@@ -60,7 +60,7 @@ func (c *MessageCache) Flush() {
// pruneLocked prunes down the cache size to the configured (or
// default) max size.
func (c *MessageCache) pruneLocked() {
max := cmpx.Or(c.cacheSizeSet, 500)
max := cmp.Or(c.cacheSizeSet, 500)
for c.cache.Len() > max {
c.cache.RemoveOldest()
}

View File

@@ -6,6 +6,7 @@ package netcheck
import (
"bufio"
"cmp"
"context"
"crypto/tls"
"errors"
@@ -41,7 +42,6 @@ import (
"tailscale.com/types/opt"
"tailscale.com/types/views"
"tailscale.com/util/clientmetric"
"tailscale.com/util/cmpx"
"tailscale.com/util/mak"
)
@@ -447,7 +447,7 @@ func makeProbePlan(dm *tailcfg.DERPMap, ifState *interfaces.State, last *Report)
do6 = false
}
n := reg.Nodes[try%len(reg.Nodes)]
prevLatency := cmpx.Or(
prevLatency := cmp.Or(
last.RegionLatency[reg.RegionID]*120/100,
defaultActiveRetransmitTime)
delay := time.Duration(try) * prevLatency
@@ -1602,7 +1602,7 @@ func (rs *reportState) runProbe(ctx context.Context, dm *tailcfg.DERPMap, probe
// proto is 4 or 6
// If it returns nil, the node is skipped.
func (c *Client) nodeAddr(ctx context.Context, n *tailcfg.DERPNode, proto probeProto) (ap netip.AddrPort) {
port := cmpx.Or(n.STUNPort, 3478)
port := cmp.Or(n.STUNPort, 3478)
if port < 0 || port > 1<<16-1 {
return
}