From: Sean Liao Date: Fri, 19 Jul 2024 22:34:02 +0000 (+0100) Subject: slices: explicitly document nil and empty slice equality X-Git-Tag: go1.23.0~7^2~1 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a799fa5189;p=gostls13.git slices: explicitly document nil and empty slice equality Fixes #68472 Change-Id: I21282621d679d9e2b032256b338c0b5ff107c8f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/599816 Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI --- diff --git a/src/slices/slices.go b/src/slices/slices.go index 857ab46314..b3cd4e2c05 100644 --- a/src/slices/slices.go +++ b/src/slices/slices.go @@ -15,6 +15,7 @@ import ( // elements equal. If the lengths are different, Equal returns false. // Otherwise, the elements are compared in increasing index order, and the // comparison stops at the first unequal pair. +// Empty and nil slices are considered equal. // Floating point NaNs are not considered equal. func Equal[S ~[]E, E comparable](s1, s2 S) bool { if len(s1) != len(s2) {