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

Reviewed-by: Maisem Ali <[email protected]>
Signed-off-by: Jordan Whited <[email protected]>
Signed-off-by: Jason A. Donenfeld <[email protected]>
This commit is contained in:
Jordan Whited
2023-03-17 15:18:04 +01:00
committed by Jason A. Donenfeld
parent 7f511c3bb1
commit 1417a47c8f
2 changed files with 3 additions and 51 deletions
+3 -3
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