Merge pull request #16570 from duglin/ReaderFix
Make Close() on simpleReaderCloser actually close the reader
This commit is contained in:
commit
92c1310f61
1 changed files with 5 additions and 2 deletions
|
@ -129,13 +129,16 @@ func TestBufReaderCloseWithNonReaderCloser(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// implements io.ReadCloser
|
// implements io.ReadCloser
|
||||||
type simpleReaderCloser struct{}
|
type simpleReaderCloser struct {
|
||||||
|
err error
|
||||||
|
}
|
||||||
|
|
||||||
func (r *simpleReaderCloser) Read(p []byte) (n int, err error) {
|
func (r *simpleReaderCloser) Read(p []byte) (n int, err error) {
|
||||||
return 0, nil
|
return 0, r.err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *simpleReaderCloser) Close() error {
|
func (r *simpleReaderCloser) Close() error {
|
||||||
|
r.err = io.EOF
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue