Skip to content

Commit 437323e

Browse files
cuishuangseankhliao
authored andcommitted
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 <[email protected]> Reviewed-by: Mark Freeman <[email protected]> Reviewed-by: Junyang Shao <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 1993dca commit 437323e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/slices/slices.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func ContainsFunc[S ~[]E, E any](s S, f func(E) bool) bool {
128128
// returning the modified slice.
129129
// The elements at s[i:] are shifted up to make room.
130130
// In the returned slice r, r[i] == v[0],
131-
// and, if i < len(s), r[i+len(v)] == value originally at r[i].
131+
// and, if i < len(s), r[i+len(v)] == value originally at s[i].
132132
// Insert panics if i > len(s).
133133
// This function is O(len(s) + len(v)).
134134
// If the result is empty, it has the same nilness as s.

0 commit comments

Comments
 (0)