]> Cypherpunks repositories - gostls13.git/commitdiff
reflect.DeepEqual: rewrite clarification about nil and empty slice.
authorRob Pike <r@golang.org>
Wed, 26 Sep 2012 10:46:49 +0000 (20:46 +1000)
committerRob Pike <r@golang.org>
Wed, 26 Sep 2012 10:46:49 +0000 (20:46 +1000)
The previous version was created by an idiot. This time, Rog Peppe
wrote the text. Thanks, Rog.
(== doesn't work on slices in general, so it makes no sense to
talk about in the context of DeepEqual.)

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6566054

src/pkg/reflect/deepequal.go

index 8ca20750a9443e4619a92deed2d121927b1b631c..cd364dd9fd90ddcffefb2e52b486f2a4346d7c4e 100644 (file)
@@ -125,7 +125,7 @@ func deepValueEqual(v1, v2 Value, visited map[uintptr]*visit, depth int) (b bool
 // 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.
-// Note: unlike regular ==, DeepEqual distinguishes an empty slice from a nil slice.
+// An empty slice is not equal to a nil slice.
 func DeepEqual(a1, a2 interface{}) bool {
        if a1 == nil || a2 == nil {
                return a1 == a2