]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: document DeepEqual(nil map, empty non-nil map) behavior
authorRuss Cox <rsc@golang.org>
Tue, 18 Oct 2016 15:01:54 +0000 (11:01 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 19 Oct 2016 13:33:50 +0000 (13:33 +0000)
Fixes #16531.

Change-Id: I41ec8123f2d3fbe063fd3b09a9366e69722793e5
Reviewed-on: https://go-review.googlesource.com/31355
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/reflect/deepequal.go

index 9770358ae77d93ac05b3a7cf35f1e6bfe9bbb335..d33976885424c754897ba18c51a78639e84d9bf0 100644 (file)
@@ -142,8 +142,9 @@ func deepValueEqual(v1, v2 Value, visited map[visit]bool, depth int) bool {
 //
 // Interface values are deeply equal if they hold deeply equal concrete values.
 //
-// Map values are deeply equal if they are the same map object
-// or if they have the same length and their corresponding keys
+// Map values are deeply equal when all of the following are true:
+// they are both nil or both non-nil, they have the same length,
+// and either they are the same map object or their corresponding keys
 // (matched using Go equality) map to deeply equal values.
 //
 // Pointer values are deeply equal if they are equal using Go's == operator