goprotobuf: Equal and String support for RawMessage.
R=r
CC=golang-dev
http://codereview.appspot.com/5889043
diff --git a/proto/equal.go b/proto/equal.go
index 34e1ae2..40e40d4 100644
--- a/proto/equal.go
+++ b/proto/equal.go
@@ -30,7 +30,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Protocol buffer comparison.
-// TODO: MessageSet and RawMessage.
+// TODO: MessageSet.
package proto
@@ -95,6 +95,15 @@
// set/unset mismatch
return false
}
+ b1, ok := f1.Interface().(raw)
+ if ok {
+ b2 := f2.Interface().(raw)
+ // RawMessage
+ if !bytes.Equal(b1.Bytes(), b2.Bytes()) {
+ return false
+ }
+ continue
+ }
f1, f2 = f1.Elem(), f2.Elem()
}
if !equalAny(f1, f2) {