]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: improve documentation for DeepEqual regarding maps
authorRob Pike <r@golang.org>
Tue, 30 Oct 2012 21:42:47 +0000 (14:42 -0700)
committerRob Pike <r@golang.org>
Tue, 30 Oct 2012 21:42:47 +0000 (14:42 -0700)
Keys use ==; values use deep equality. Also remove the word 'member'.
Fixes #4258.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6812055

src/pkg/reflect/deepequal.go

index cd364dd9fd90ddcffefb2e52b486f2a4346d7c4e..db047963eb175c11f3bcae27ddb4246381763033 100644 (file)
@@ -122,9 +122,11 @@ func deepValueEqual(v1, v2 Value, visited map[uintptr]*visit, depth int) (b bool
        panic("Not reached")
 }
 
-// DeepEqual tests for deep equality. It uses normal == equality where possible
-// but will scan members of arrays, slices, maps, and fields of structs. It correctly
-// handles recursive types. Functions are equal only if they are both nil.
+// DeepEqual tests for deep equality. It uses normal == equality where
+// possible but will scan elements of arrays, slices, maps, and fields of
+// structs. In maps, keys are compared with == but elements use deep
+// equality. DeepEqual correctly handles recursive types. Functions are equal
+// only if they are both nil.
 // An empty slice is not equal to a nil slice.
 func DeepEqual(a1, a2 interface{}) bool {
        if a1 == nil || a2 == nil {