io: should ReadAtLeast's example return ErrUnexpectedEOF #30700
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
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 read the document of io.ReadAtLeast https://golang.org/pkg/io/#ReadAtLeast. It tells
If an EOF happens after reading fewer than min bytes, ReadAtLeast returns ErrUnexpectedEOF.
.The example code is
What did you expect to see?
The last case of example.
Should print
That is message from io.ErrUnexpectedEOF
What did you see instead?
Because the example use the same reader
r
thatio.EOF
from the first case.I think should reset or create new reader before use in the last case.
The text was updated successfully, but these errors were encountered: