pkg/ioutils: remove named err-returns

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-01-03 00:33:06 +01:00
parent f193ff1317
commit d17a62592f
3 changed files with 5 additions and 5 deletions

View File

@@ -88,14 +88,14 @@ func NewCancelReadCloser(ctx context.Context, in io.ReadCloser) io.ReadCloser {
// Read wraps the Read method of the pipe that provides data from the wrapped
// ReadCloser.
func (p *cancelReadCloser) Read(buf []byte) (n int, err error) {
func (p *cancelReadCloser) Read(buf []byte) (int, error) {
return p.pR.Read(buf)
}
// closeWithError closes the wrapper and its underlying reader. It will
// cause future calls to Read to return err.
func (p *cancelReadCloser) closeWithError(err error) {
p.pW.CloseWithError(err)
_ = p.pW.CloseWithError(err)
p.cancel()
}

View File

@@ -32,7 +32,7 @@ func TestReadCloserWrapperClose(t *testing.T) {
type perpetualReader struct{}
func (p *perpetualReader) Read(buf []byte) (n int, err error) {
func (p *perpetualReader) Read(buf []byte) (int, error) {
for i := 0; i != len(buf); i++ {
buf[i] = 'a'
}

View File

@@ -21,14 +21,14 @@ type flusher interface {
Flush()
}
func (wf *WriteFlusher) Write(b []byte) (n int, err error) {
func (wf *WriteFlusher) Write(b []byte) (int, error) {
select {
case <-wf.closed:
return 0, io.EOF
default:
}
n, err = wf.w.Write(b)
n, err := wf.w.Write(b)
wf.Flush() // every write is a flush.
return n, err
}