attributes: document that some value types (e.g. `map`s) must implement Equal (#5109)

This commit is contained in:
Menghan Li 2022-01-06 15:44:56 -08:00 committed by GitHub
parent 2fb1ac854b
commit 907a202a61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -69,7 +69,9 @@ func (a *Attributes) Value(key interface{}) interface{} {
// bool' is implemented for a value in the attributes, it is called to // bool' is implemented for a value in the attributes, it is called to
// determine if the value matches the one stored in the other attributes. If // determine if the value matches the one stored in the other attributes. If
// Equal is not implemented, standard equality is used to determine if the two // Equal is not implemented, standard equality is used to determine if the two
// values are equal. // values are equal. Note that some types (e.g. maps) aren't comparable by
// default, so they must be wrapped in a struct, or in an alias type, with Equal
// defined.
func (a *Attributes) Equal(o *Attributes) bool { func (a *Attributes) Equal(o *Attributes) bool {
if a == nil && o == nil { if a == nil && o == nil {
return true return true