mirror of https://github.com/coder/coder.git
21 lines
375 B
Go
21 lines
375 B
Go
package proto
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
gProto "google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
// Equal returns true if the nodes have the same contents
|
|
func (s *Node) Equal(o *Node) (bool, error) {
|
|
sBytes, err := gProto.Marshal(s)
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
oBytes, err := gProto.Marshal(o)
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
return bytes.Equal(sBytes, oBytes), nil
|
|
}
|