From 59d7433ecfcf966f051635f9f5343df405a1baf9 Mon Sep 17 00:00:00 2001 From: go101 Date: Thu, 16 Nov 2023 00:54:22 +0800 Subject: [PATCH] impove the bound check line in Delete --- src/slices/slices.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slices/slices.go b/src/slices/slices.go index 4b905f22eca..38b0fc14ad4 100644 --- a/src/slices/slices.go +++ b/src/slices/slices.go @@ -217,7 +217,7 @@ func Insert[S ~[]E, E any](s S, i int, v ...E) S { // make a single call deleting them all together than to delete one at a time. // Delete zeroes the elements s[len(s)-(j-i):len(s)]. func Delete[S ~[]E, E any](s S, i, j int) S { - _ = s[i:j] // bounds check + _ = s[i:j:len(s)] // bounds check if i == j { return s