Make Close() on simpleReaderCloser actually close the reader
Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
parent
c0bd79f3f8
commit
83d0df9cdc
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