bufio: Reader.Peek should return EOF when there's nothing more to read #50569
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What did you do?
In
Peek(n)
, if n is larger than len(b.buf), it will only return theErrBufferFull
error even if theb.err == EOF
.What did you expect to see?
In this
n is larger than len(b.buf)
situation. EOF error may be more precise when outer logical need judge whether to do next by the error returning fromPeek(n)
?mostly like:
but if only return
ErrBufferFull
error here, it leads a forever loop ..A POSSIPLE SOLUTION MAY:
The text was updated successfully, but these errors were encountered: