tun: replace ErrorBatch() with errors.Join()

Reviewed-by: Maisem Ali <maisem@tailscale.com>
Signed-off-by: Jordan Whited <jordan@tailscale.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jordan Whited
2023-03-16 13:27:51 -07:00
committed by Jason A. Donenfeld
parent 7f511c3bb1
commit 1417a47c8f
2 changed files with 3 additions and 51 deletions

View File

@@ -338,7 +338,7 @@ func (tun *NativeTun) Write(bufs [][]byte, offset int) (int, error) {
tun.writeOpMu.Unlock()
}()
var (
errs []error
errs error
total int
)
tun.toWrite = tun.toWrite[:0]
@@ -359,12 +359,12 @@ func (tun *NativeTun) Write(bufs [][]byte, offset int) (int, error) {
return total, os.ErrClosed
}
if err != nil {
errs = append(errs, err)
errs = errors.Join(errs, err)
} else {
total += n
}
}
return total, ErrorBatch(errs)
return total, errs
}
// handleVirtioRead splits in into bufs, leaving offset bytes at the front of