mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
pkg/ioutils: remove named err-returns
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user