mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
slices: fix incorrect comment in slices.Insert function documentation
The comment previously stated that r[i+len(v)] would equal the value originally at r[i], but it should be the value originally at s[i]. Change-Id: I635ddbdd5dc4da9c06ed426d5542bf969b7fe6dd Reviewed-on: https://go-review.googlesource.com/c/go/+/722680 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
1993dca400
commit
437323ef7b
1 changed files with 1 additions and 1 deletions
|
|
@ -128,7 +128,7 @@ func ContainsFunc[S ~[]E, E any](s S, f func(E) bool) bool {
|
||||||
// returning the modified slice.
|
// returning the modified slice.
|
||||||
// The elements at s[i:] are shifted up to make room.
|
// The elements at s[i:] are shifted up to make room.
|
||||||
// In the returned slice r, r[i] == v[0],
|
// In the returned slice r, r[i] == v[0],
|
||||||
// and, if i < len(s), r[i+len(v)] == value originally at r[i].
|
// and, if i < len(s), r[i+len(v)] == value originally at s[i].
|
||||||
// Insert panics if i > len(s).
|
// Insert panics if i > len(s).
|
||||||
// This function is O(len(s) + len(v)).
|
// This function is O(len(s) + len(v)).
|
||||||
// If the result is empty, it has the same nilness as s.
|
// If the result is empty, it has the same nilness as s.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue