aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcuishuang <imcusg@gmail.com>2025-11-21 10:47:06 +0800
committerSean Liao <sean@liao.dev>2025-11-23 03:35:46 -0800
commit437323ef7b933255c5c7fbb0775019e95f19b05e (patch)
tree8ea74e005f9b73d5e0634806e6f3b7ac693475de /src
parent1993dca4002267b772566d6c8055c6ace46dfd4f (diff)
downloadgo-437323ef7b933255c5c7fbb0775019e95f19b05e.tar.xz
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>
Diffstat (limited to 'src')
-rw-r--r--src/slices/slices.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/slices/slices.go b/src/slices/slices.go
index 30595793c9..c68962a9f6 100644
--- a/src/slices/slices.go
+++ b/src/slices/slices.go
@@ -128,7 +128,7 @@ func ContainsFunc[S ~[]E, E any](s S, f func(E) bool) bool {
// returning the modified slice.
// The elements at s[i:] are shifted up to make room.
// 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).
// This function is O(len(s) + len(v)).
// If the result is empty, it has the same nilness as s.