]> Cypherpunks.ru repositories - gostls13.git/commit
bufio: make Reader.Peek invalidate Unreads
authorMartin Garton <garton@gmail.com>
Tue, 27 Jun 2017 17:02:23 +0000 (18:02 +0100)
committerRobert Griesemer <gri@golang.org>
Tue, 27 Jun 2017 19:51:54 +0000 (19:51 +0000)
commitae238688d2813e83f16050408487ea34ba1c2fff
treed7ce8e857fe000a7639805f65ebf6c0fb2ac254d
parent81ed9ca1d411f0bd8738ea60b3a8045446ad85fc
bufio: make Reader.Peek invalidate Unreads

Since Reader.Peek potentially reads from the underlying io.Reader,
discarding previous buffers, UnreadRune and UnreadByte cannot
necessarily work.  Change Peek to invalidate the unread buffers in all
cases (as allowed according to the documentation) and thus prevent
hiding bugs in the caller.

Fixes #18556

Change-Id: I8d836db7ce31c4aaecb4f61c24573b0332bbf30d
Reviewed-on: https://go-review.googlesource.com/46850
Reviewed-by: Robert Griesemer <gri@golang.org>
src/bufio/bufio.go
src/bufio/bufio_test.go