goprotobuf: Introduce new proto.Message type.

Every generated protocol buffer type now implements the proto.Message interface,
which means we can add some compile-time type safety throughout the API
as well as drop a bunch of error cases.

R=r, rsc
CC=golang-dev
http://codereview.appspot.com/6298073
diff --git a/proto/all_test.go b/proto/all_test.go
index 4a58ebe..3a291c0 100644
--- a/proto/all_test.go
+++ b/proto/all_test.go
@@ -1077,7 +1077,7 @@
 	}
 }
 
-func encodeDecode(t *testing.T, in, out interface{}, msg string) {
+func encodeDecode(t *testing.T, in, out Message, msg string) {
 	buf, err := Marshal(in)
 	if err != nil {
 		t.Fatalf("failed marshaling %v: %v", msg, err)
@@ -1183,6 +1183,10 @@
 	nni nonNillableInt
 }
 
+func (*NNIMessage) Reset()         {}
+func (*NNIMessage) String() string { return "" }
+func (*NNIMessage) ProtoMessage()  {}
+
 // A type that implements the Marshaler interface and is nillable.
 type nillableMessage struct {
 	x uint64
@@ -1196,6 +1200,10 @@
 	nm *nillableMessage
 }
 
+func (*NMMessage) Reset()         {}
+func (*NMMessage) String() string { return "" }
+func (*NMMessage) ProtoMessage()  {}
+
 // Verify a type that uses the Marshaler interface, but has a nil pointer.
 func TestNilMarshaler(t *testing.T) {
 	// Try a struct with a Marshaler field that is nil.
@@ -1214,22 +1222,6 @@
 	}
 }
 
-// Check that passing things other than pointer to struct to Marshal
-// returns a good error, rather than panicking.
-func TestStructTyping(t *testing.T) {
-	om := &OtherMessage{}
-	bad := [...]interface{}{*om, &om}
-	for _, pb := range bad {
-		_, err := Marshal(pb)
-		if err != ErrNotPtr {
-			t.Errorf("marshaling %T: got %v, expected %v", pb, err, ErrNotPtr)
-		}
-		if err := Unmarshal([]byte{}, pb); err != ErrNotPtr {
-			t.Errorf("unmarshaling %T: got %v, expected %v", pb, err, ErrNotPtr)
-		}
-	}
-}
-
 func TestAllSetDefaults(t *testing.T) {
 	// Exercise SetDefaults with all scalar field types.
 	m := &Defaults{