Skip to content

Commit 5241d11

Browse files
Robert Griesemergopherbot
authored andcommitted
spec: more precise prose for special case of append
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 <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Robert Griesemer <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent cdf6410 commit 5241d11

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/go_spec.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--{
22
"Title": "The Go Programming Language Specification",
3-
"Subtitle": "Language version go1.26 (Oct 1, 2025)",
3+
"Subtitle": "Language version go1.26 (Nov 9, 2025)",
44
"Path": "/ref/spec"
55
}-->
66

@@ -7383,8 +7383,8 @@ <h3 id="Appending_and_copying_slices">Appending to and copying slices</h3>
73837383
where <code>E</code> is the element type of <code>S</code>
73847384
and the respective <a href="#Passing_arguments_to_..._parameters">parameter
73857385
passing rules</a> apply.
7386-
As a special case, <code>append</code> also accepts a first argument assignable
7387-
to type <code>[]byte</code> with a second argument of string type followed by
7386+
As a special case, <code>append</code> also accepts a slice whose type is assignable to
7387+
type <code>[]byte</code> with a second argument of <code>string</code> type followed by
73887388
<code>...</code>.
73897389
This form appends the bytes of the string.
73907390
</p>

0 commit comments

Comments
 (0)