mirror of
https://github.com/golang/go.git
synced 2025-12-07 13:50:04 +00:00
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 <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>
This commit is contained in:
parent
cdf64106f6
commit
5241d114f5
1 changed files with 3 additions and 3 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue