~ubuntu-branches/ubuntu/trusty/golang/trusty

« back to all changes in this revision

Viewing changes to src/pkg/reflect/deepequal.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
                // Normal equality suffices
119
119
                return valueInterface(v1, false) == valueInterface(v2, false)
120
120
        }
121
 
 
122
 
        panic("Not reached")
123
121
}
124
122
 
125
 
// DeepEqual tests for deep equality. It uses normal == equality where possible
126
 
// but will scan members of arrays, slices, maps, and fields of structs. It correctly
127
 
// handles recursive types. Functions are equal only if they are both nil.
 
123
// DeepEqual tests for deep equality. It uses normal == equality where
 
124
// possible but will scan elements of arrays, slices, maps, and fields of
 
125
// structs. In maps, keys are compared with == but elements use deep
 
126
// equality. DeepEqual correctly handles recursive types. Functions are equal
 
127
// only if they are both nil.
 
128
// An empty slice is not equal to a nil slice.
128
129
func DeepEqual(a1, a2 interface{}) bool {
129
130
        if a1 == nil || a2 == nil {
130
131
                return a1 == a2