From: Russ Cox Date: Sun, 5 Aug 2012 18:32:09 +0000 (-0400) Subject: bufio: discourage use of ReadLine X-Git-Tag: go1.1rc2~2701 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ea392b8849e886e2548246666026db5dfca929f7;p=gostls13.git bufio: discourage use of ReadLine Too many people use it without reading what it does. Those people want ReadBytes or ReadString. Fixes #3906. R=golang-dev, iant, r CC=golang-dev https://golang.org/cl/6442087 --- diff --git a/src/pkg/bufio/bufio.go b/src/pkg/bufio/bufio.go index b44d0e7d16..0e284825bd 100644 --- a/src/pkg/bufio/bufio.go +++ b/src/pkg/bufio/bufio.go @@ -272,6 +272,9 @@ func (b *Reader) ReadSlice(delim byte) (line []byte, err error) { panic("not reached") } +// ReadLine is a low-level line-reading primitive. Most callers should use +// ReadBytes('\n') or ReadString('\n') instead. +// // ReadLine tries to return a single line, not including the end-of-line bytes. // If the line was too long for the buffer then isPrefix is set and the // beginning of the line is returned. The rest of the line will be returned