From ed8b7dedd35c479bd56ab4dd2dd2671727db464c Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 29 Nov 2017 21:15:31 +0000 Subject: [PATCH] bytes: mention strings.Builder in Buffer.String docs Fixes #22778 Change-Id: I37f7a59c15828aa720fe787fff42fb3ef17729c7 Reviewed-on: https://go-review.googlesource.com/80815 Reviewed-by: Ian Lance Taylor --- src/bytes/buffer.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bytes/buffer.go b/src/bytes/buffer.go index 67771846fc..dc9d5e95d3 100644 --- a/src/bytes/buffer.go +++ b/src/bytes/buffer.go @@ -56,6 +56,8 @@ func (b *Buffer) Bytes() []byte { return b.buf[b.off:] } // String returns the contents of the unread portion of the buffer // as a string. If the Buffer is a nil pointer, it returns "". +// +// To build strings more efficiently, see the strings.Builder type. func (b *Buffer) String() string { if b == nil { // Special case, useful in debugging. -- 2.50.0