]> Cypherpunks repositories - gostls13.git/commitdiff
spec: more precise prose for special case of append
authorRobert Griesemer <gri@google.com>
Sat, 8 Nov 2025 03:52:27 +0000 (19:52 -0800)
committerGopher Robot <gobot@golang.org>
Mon, 10 Nov 2025 20:48:05 +0000 (12:48 -0800)
As written, the special case for append may be interpreted
such that any first argument that is assignable to []byte
is permissible, including nil. This change makes makes it
clear that a slice argument is required.

Not a language change. The compiler always expected a slice
argument.

Fixes #76226.

Change-Id: I73a1725d10096690335d6edf5793beb5de73578f
Reviewed-on: https://go-review.googlesource.com/c/go/+/718880
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
doc/go_spec.html

index d6c7962a961b88878ca41e6bbd583573d5c40ad7..514f60007b64ef422a421be9819011d3c8a88082 100644 (file)
@@ -1,6 +1,6 @@
 <!--{
        "Title": "The Go Programming Language Specification",
-       "Subtitle": "Language version go1.26 (Oct 1, 2025)",
+       "Subtitle": "Language version go1.26 (Nov 9, 2025)",
        "Path": "/ref/spec"
 }-->
 
@@ -7383,8 +7383,8 @@ The values <code>x</code> are passed to a parameter of type <code>...E</code>
 where <code>E</code> is the element type of <code>S</code>
 and the respective <a href="#Passing_arguments_to_..._parameters">parameter
 passing rules</a> apply.
-As a special case, <code>append</code> also accepts a first argument assignable
-to type <code>[]byte</code> with a second argument of string type followed by
+As a special case, <code>append</code> also accepts a slice whose type is assignable to
+type <code>[]byte</code> with a second argument of <code>string</code> type followed by
 <code>...</code>.
 This form appends the bytes of the string.
 </p>