Skip to content

Commit

Permalink
slices: explicitly document nil and empty slice equality
Browse files Browse the repository at this point in the history
Fixes golang#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]>
  • Loading branch information
seankhliao authored and gopherbot committed Jul 22, 2024
1 parent f0de94f commit a799fa5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/slices/slices.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a799fa5

Please sign in to comment.