]> Cypherpunks repositories - gostls13.git/commitdiff
io: document WriteString calls Write exactly once
authorDan Peterson <dpiddy@gmail.com>
Tue, 12 Apr 2016 00:47:37 +0000 (21:47 -0300)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 12 Apr 2016 01:03:51 +0000 (01:03 +0000)
Fixes #13849

Change-Id: Idd7f06b547a0179fe15571807a8c48b7c3b78d7c
Reviewed-on: https://go-review.googlesource.com/21852
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/io/io.go

index 023473c79bdb0a8d66b27b372b46c4b5e1d08831..c36ec2afbb0915ea28665cffc5d6c5b42f135369 100644 (file)
@@ -291,6 +291,7 @@ type stringWriter interface {
 
 // WriteString writes the contents of the string s to w, which accepts a slice of bytes.
 // If w implements a WriteString method, it is invoked directly.
+// Otherwise, w.Write is called exactly once.
 func WriteString(w Writer, s string) (n int, err error) {
        if sw, ok := w.(stringWriter); ok {
                return sw.WriteString(s)