all: apply go fix

Updates #cleanup

Signed-off-by: Adriano Sela Aviles <adriano@tailscale.com>
This commit is contained in:
Adriano Sela Aviles
2026-07-10 17:39:16 -07:00
committed by Adriano Sela Aviles
parent a5102d3fcb
commit d69bf2685a
26 changed files with 44 additions and 95 deletions
+1 -4
View File
@@ -553,10 +553,7 @@ func computePrefixSplit(a, b netip.Prefix) (lastCommon netip.Prefix, aStride, bS
panic("computePrefixSplit called with mismatched address families")
}
minPrefixLen := a.Bits()
if b.Bits() < minPrefixLen {
minPrefixLen = b.Bits()
}
minPrefixLen := min(b.Bits(), a.Bits())
commonBits := commonBits(a.Addr(), b.Addr(), minPrefixLen)
// We want to know how many 8-bit strides are shared between a and
+2 -8
View File
@@ -671,10 +671,7 @@ func makeResponseOfSize(tb testing.TB, domain string, targetSize int, includeOPT
if includeOPT {
baseSize += 11 // OPT record adds ~11 bytes
}
estimatedRecords := (targetSize - baseSize) / bytesPerRecord
if estimatedRecords < 1 {
estimatedRecords = 1
}
estimatedRecords := max((targetSize-baseSize)/bytesPerRecord, 1)
// Start with estimated records and adjust
txtLen := 200
@@ -741,10 +738,7 @@ func makeResponseOfSize(tb testing.TB, domain string, targetSize int, includeOPT
// If we need too many records, increase TXT length instead
txtLen = 255 // Max single TXT string length
bytesPerRecord = 280 // Adjusted estimate
estimatedRecords = (targetSize - baseSize) / bytesPerRecord
if estimatedRecords < 1 {
estimatedRecords = 1
}
estimatedRecords = max((targetSize-baseSize)/bytesPerRecord, 1)
}
}
+1 -4
View File
@@ -28,10 +28,7 @@ func maybeUnUTF16(bs []byte) []byte {
// Can't be complete UTF-16.
return bs
}
checkLen := 20
if len(bs) < checkLen {
checkLen = len(bs)
}
checkLen := min(len(bs), 20)
zeroOff := bytes.IndexByte(bs[:checkLen], 0)
if zeroOff == -1 {
return bs
+1 -1
View File
@@ -512,7 +512,7 @@ func TestRecentReportsRetainFullNetcheck(t *testing.T) {
const tick = time.Minute
start := time.Unix(1700000000, 0)
var lastFull time.Time // zero => first report is full, as in GetReport
for i := 0; i < 60; i++ {
for i := range 60 {
now = start.Add(time.Duration(i) * tick)
// Mirror GetReport's full-vs-incremental decision.