]> Cypherpunks repositories - gostls13.git/commitdiff
builtin: document appending a string to a byte slice
authorRob Pike <r@golang.org>
Thu, 28 Feb 2013 00:11:17 +0000 (16:11 -0800)
committerRob Pike <r@golang.org>
Thu, 28 Feb 2013 00:11:17 +0000 (16:11 -0800)
Fixes #4873.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7421043

src/pkg/builtin/builtin.go

index 91d263a62343abf4f351f50d78c7f7bdd09bfa02..7b5e9ab1d6e50034b5d4fd503e7ece4df078a3c7 100644 (file)
@@ -114,6 +114,8 @@ type ComplexType complex64
 // result of append, often in the variable holding the slice itself:
 //     slice = append(slice, elem1, elem2)
 //     slice = append(slice, anotherSlice...)
+// As a special case, it is legal to append a string to a byte slice, like this:
+//     slice = append([]byte("hello "), "world"...)
 func append(slice []Type, elems ...Type) []Type
 
 // The copy built-in function copies elements from a source slice into a