Skip to content

Commit a799fa5

Browse files
seankhliaogopherbot
authored andcommitted
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 <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent f0de94f commit a799fa5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/slices/slices.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
// elements equal. If the lengths are different, Equal returns false.
1616
// Otherwise, the elements are compared in increasing index order, and the
1717
// comparison stops at the first unequal pair.
18+
// Empty and nil slices are considered equal.
1819
// Floating point NaNs are not considered equal.
1920
func Equal[S ~[]E, E comparable](s1, s2 S) bool {
2021
if len(s1) != len(s2) {

0 commit comments

Comments
 (0)