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
+2 -6
View File
@@ -13,6 +13,7 @@ import (
"os"
"os/exec"
"path/filepath"
"slices"
"strings"
"sync"
"testing"
@@ -181,12 +182,7 @@ func (sl *serialLog) lastN(n int) []string {
func (sl *serialLog) findLine(pred func(string) bool) bool {
sl.mu.Lock()
defer sl.mu.Unlock()
for _, line := range sl.lines {
if pred(line) {
return true
}
}
return false
return slices.ContainsFunc(sl.lines, pred)
}
// TestBusyboxInTsapp boots the tsapp image in QEMU and verifies that
+2 -8
View File
@@ -144,10 +144,7 @@ func (m *memBackend) ReadAt(p []byte, off int64) (int, error) {
absOff := off + int64(total)
page := absOff / memPageSize
within := int(absOff % memPageSize)
room := memPageSize - within
if room > len(p)-total {
room = len(p) - total
}
room := min(memPageSize-within, len(p)-total)
if chunk, ok := m.pages[page]; ok {
copy(p[total:total+room], chunk[within:within+room])
}
@@ -183,10 +180,7 @@ func (m *memBackend) WriteAt(p []byte, off int64) (int, error) {
absOff := off + int64(total)
page := absOff / memPageSize
within := int(absOff % memPageSize)
room := memPageSize - within
if room > len(p)-total {
room = len(p) - total
}
room := min(memPageSize-within, len(p)-total)
chunk, ok := m.pages[page]
if !ok && isAllZero(p[total:total+room]) {
// Don't allocate a fresh zero page.