github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/amino/deep_equal.go (about)

     1  package amino
     2  
     3  import (
     4  	"bytes"
     5  	"reflect"
     6  )
     7  
     8  //----------------------------------------
     9  // DeepEqual
    10  
    11  // DeepEqual returns true if the types are the same and the
    12  // binary amino encoding would be the same.
    13  // TODO: optimize, and support genproto.
    14  func DeepEqual(a, b interface{}) bool {
    15  	if reflect.TypeOf(a) != reflect.TypeOf(b) {
    16  		return false
    17  	}
    18  	return bytes.Equal(
    19  		MustMarshal(a),
    20  		MustMarshal(b),
    21  	)
    22  }