diff --git a/src/bufio/bufio.go b/src/bufio/bufio.go index f1a270336fc..da94a2503f0 100644 --- a/src/bufio/bufio.go +++ b/src/bufio/bufio.go @@ -125,9 +125,6 @@ func (b *Reader) Peek(n int) ([]byte, error) { return nil, ErrNegativeCount } - b.lastByte = -1 - b.lastRuneSize = -1 - for b.w-b.r < n && b.w-b.r < len(b.buf) && b.err == nil { b.fill() // b.w-b.r < len(b.buf) => buffer is not full } diff --git a/src/bufio/bufio_test.go b/src/bufio/bufio_test.go index 50f571c04f0..ef0f6c834e8 100644 --- a/src/bufio/bufio_test.go +++ b/src/bufio/bufio_test.go @@ -285,24 +285,6 @@ func TestUnreadRune(t *testing.T) { } } -func TestNoUnreadRuneAfterPeek(t *testing.T) { - br := NewReader(strings.NewReader("example")) - br.ReadRune() - br.Peek(1) - if err := br.UnreadRune(); err == nil { - t.Error("UnreadRune didn't fail after Peek") - } -} - -func TestNoUnreadByteAfterPeek(t *testing.T) { - br := NewReader(strings.NewReader("example")) - br.ReadByte() - br.Peek(1) - if err := br.UnreadByte(); err == nil { - t.Error("UnreadByte didn't fail after Peek") - } -} - func TestUnreadByte(t *testing.T) { segments := []string{"Hello, ", "world"} r := NewReader(&StringReader{data: segments})