From a0e780b7ec5dad5b659b03964a3a69c20e85f10a Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Sat, 22 Sep 2012 05:54:27 +1000 Subject: [PATCH] [release-branch.go1] bufio: discourage use of ReadLine MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ««« backport 9e2011d9ed4b 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 »»» --- src/pkg/bufio/bufio.go | 3 +++ 1 file changed, 3 insertions(+) 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 -- 2.50.0