@@ -572,7 +572,7 @@ func TestMarshalIllegalTime(t *testing.T) {
572572
573573func TestMarshalJSONPBMarshaler (t * testing.T ) {
574574 rawJson := `{ "foo": "bar", "baz": [0, 1, 2, 3] }`
575- msg := dynamicMessage {rawJson : rawJson }
575+ msg := dynamicMessage {RawJson : rawJson }
576576 str , err := new (Marshaler ).MarshalToString (& msg )
577577 if err != nil {
578578 t .Errorf ("an unexpected error occurred when marshalling JSONPBMarshaler: %v" , err )
@@ -583,7 +583,7 @@ func TestMarshalJSONPBMarshaler(t *testing.T) {
583583}
584584
585585func TestMarshalAnyJSONPBMarshaler (t * testing.T ) {
586- msg := dynamicMessage {rawJson : `{ "foo": "bar", "baz": [0, 1, 2, 3] }` }
586+ msg := dynamicMessage {RawJson : `{ "foo": "bar", "baz": [0, 1, 2, 3] }` }
587587 a , err := ptypes .MarshalAny (& msg )
588588 if err != nil {
589589 t .Errorf ("an unexpected error occurred when marshalling to Any: %v" , err )
@@ -601,7 +601,7 @@ func TestMarshalAnyJSONPBMarshaler(t *testing.T) {
601601}
602602
603603func TestMarshalWithCustomValidation (t * testing.T ) {
604- msg := dynamicMessage {rawJson : `{ "foo": "bar", "baz": [0, 1, 2, 3] }` , dummy : & dynamicMessage {}}
604+ msg := dynamicMessage {RawJson : `{ "foo": "bar", "baz": [0, 1, 2, 3] }` , Dummy : & dynamicMessage {}}
605605
606606 js , err := new (Marshaler ).MarshalToString (& msg )
607607 if err != nil {
@@ -1011,8 +1011,8 @@ func TestUnmarshalJSONPBUnmarshaler(t *testing.T) {
10111011 if err := Unmarshal (strings .NewReader (rawJson ), & msg ); err != nil {
10121012 t .Errorf ("an unexpected error occurred when parsing into JSONPBUnmarshaler: %v" , err )
10131013 }
1014- if msg .rawJson != rawJson {
1015- t .Errorf ("message contents not set correctly after unmarshalling JSON: got %s, wanted %s" , msg .rawJson , rawJson )
1014+ if msg .RawJson != rawJson {
1015+ t .Errorf ("message contents not set correctly after unmarshalling JSON: got %s, wanted %s" , msg .RawJson , rawJson )
10161016 }
10171017}
10181018
@@ -1036,7 +1036,7 @@ func TestUnmarshalAnyJSONPBUnmarshaler(t *testing.T) {
10361036 t .Errorf ("an unexpected error occurred when parsing into JSONPBUnmarshaler: %v" , err )
10371037 }
10381038
1039- dm := & dynamicMessage {rawJson : `{"baz":[0,1,2,3],"foo":"bar"}` }
1039+ dm := & dynamicMessage {RawJson : `{"baz":[0,1,2,3],"foo":"bar"}` }
10401040 var want anypb.Any
10411041 if b , err := proto .Marshal (dm ); err != nil {
10421042 t .Errorf ("an unexpected error occurred when marshaling message: %v" , err )
@@ -1097,30 +1097,30 @@ func (s *stringField) UnmarshalJSONPB(jum *Unmarshaler, js []byte) error {
10971097// dynamicMessage implements protobuf.Message but is not a normal generated message type.
10981098// It provides implementations of JSONPBMarshaler and JSONPBUnmarshaler for JSON support.
10991099type dynamicMessage struct {
1100- rawJson string `protobuf:"bytes,1,opt,name=rawJson"`
1100+ RawJson string `protobuf:"bytes,1,opt,name=rawJson"`
11011101
11021102 // an unexported nested message is present just to ensure that it
11031103 // won't result in a panic (see issue #509)
1104- dummy * dynamicMessage `protobuf:"bytes,2,opt,name=dummy"`
1104+ Dummy * dynamicMessage `protobuf:"bytes,2,opt,name=dummy"`
11051105}
11061106
11071107func (m * dynamicMessage ) Reset () {
1108- m .rawJson = "{}"
1108+ m .RawJson = "{}"
11091109}
11101110
11111111func (m * dynamicMessage ) String () string {
1112- return m .rawJson
1112+ return m .RawJson
11131113}
11141114
11151115func (m * dynamicMessage ) ProtoMessage () {
11161116}
11171117
11181118func (m * dynamicMessage ) MarshalJSONPB (jm * Marshaler ) ([]byte , error ) {
1119- return []byte (m .rawJson ), nil
1119+ return []byte (m .RawJson ), nil
11201120}
11211121
11221122func (m * dynamicMessage ) UnmarshalJSONPB (jum * Unmarshaler , js []byte ) error {
1123- m .rawJson = string (js )
1123+ m .RawJson = string (js )
11241124 return nil
11251125}
11261126
0 commit comments