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 -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.