/ go Public
io: should TeeReader return an io.ReadCloser? #27617
Feedback is required from experts, contributors, and/or the community before a change can be made.
A language change or incompatible library change
io.TeeReader can't be used to wrap an io.ReadCloser as that strips the io.Closer part.
io.TeeReader could return an io.ReadCloser though as it could implement the Close method by calling the Close method of the given reader if it is an io.ReadCloser. The question is just what should happen if the given reader is just an io.Reader. In that case I would propose to just do nothing on Close method call as the wrapped io.Reader doesn't need to be closed.
IMHO this shouldn't violate the Go 1 compatibility as io.ReadCloser includes io.Reader and so all existing code should continue to work.
Thoughts? I'm happy to send a pull request.
The text was updated successfully, but these errors were encountered: