Equal checks that attrs and attrs2 are equal Note, Attributes(nil) and Attributes{} are not Equal but Similar.
(attrs2 Attributes)
| 49 | // |
| 50 | // Note, Attributes(nil) and Attributes{} are not Equal but Similar. |
| 51 | func (attrs Attributes) Equal(attrs2 Attributes) bool { |
| 52 | if len(attrs) != len(attrs2) { |
| 53 | return false |
| 54 | } |
| 55 | |
| 56 | if (attrs == nil) != (attrs2 == nil) { |
| 57 | return false |
| 58 | } |
| 59 | |
| 60 | for i, attr := range attrs { |
| 61 | attr2 := attrs2[i] |
| 62 | if !attr.Equal(attr2) { |
| 63 | return false |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | return true |
| 68 | } |
| 69 | |
| 70 | // Similar checks that attrs and attrs2 are **logically** equal, |
| 71 | // which means the following: |