code: func MostlyDeterministicMarshal(msg proto.Message) ([]byte, error) {
  	buffer := proto.NewBuffer(make([]byte, 0))
  	buffer.SetDeterministic(true)
  	if err := buffer.Marshal(msg); err != nil {
  		return nil, err
  	}
  	return buffer.Bytes(), nil
  }
docs: // MostlyDeterministicMarshal is _NOT_ the function you are looking for.
  // It causes protobuf serialization consistent within a single build.  It
  // does not guarantee that the serialization is deterministic across proto
  // versions or proto implementations.  It is useful for situations where
  // the same process wants to compare binary messages for equality without
  // needing to unmarshal first, but should not be used generally.