From: Ian Lance Taylor Date: Sun, 3 Mar 2024 02:48:26 +0000 (-0800) Subject: slices: document that Clone can return extra capacity X-Git-Tag: go1.23rc1~993 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9e3b1d53a012e98cfd02de2de8b1bd53522464d4;p=gostls13.git slices: document that Clone can return extra capacity Change-Id: I8b9aa1f36ce554d8855ee70e15f0dd0a8cf1097a Reviewed-on: https://go-review.googlesource.com/c/go/+/568342 Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall Reviewed-by: Keith Randall Auto-Submit: Ian Lance Taylor --- diff --git a/src/slices/slices.go b/src/slices/slices.go index 49a76dac7a..326584064c 100644 --- a/src/slices/slices.go +++ b/src/slices/slices.go @@ -342,6 +342,7 @@ func Replace[S ~[]E, E any](s S, i, j int, v ...E) S { // Clone returns a copy of the slice. // The elements are copied using assignment, so this is a shallow clone. +// The result may have additional unused capacity. func Clone[S ~[]E, E any](s S) S { // The s[:0:0] preserves nil in case it matters. return append(s[:0:0], s...)