You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But the second point still holds: on error the number of written bytes is returned to the reader and not the number of read bytes. I think that should be fixed.
I would disagree. If reader wants to know where to resume reading after a failure, this is not possible. I think it is good that the error is returned, but n should be that of the read.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I was looking at the code of
TeeReader
'sRead
function and I saw:What did you expect to see?
That writes will always succeed fully or an error would be returned.
What did you see instead?
Write
is called only once, so ifWrite
writes less thann
bytes, some bytes are lost and not written out.Write
the number of bytes written is returned to the reader, not the bytes read.Possible solution
Maybe some logic to detect too many empty write attempts should be added there (so if
Write
keeps returning 0 form
).The text was updated successfully, but these errors were encountered: