encoding/textpb: ignore reserved field names during unmarshal
Do not treat reserved field names as unknown. Skip over these instead
of returning error for unknown field.
Change-Id: Iba9371fd901a0690e5b7329bccf261570352b55d
Reviewed-on: https://go-review.googlesource.com/c/154178
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/encoding/textpb/decode_test.go b/encoding/textpb/decode_test.go
index e501fe5..8b6025a 100644
--- a/encoding/textpb/decode_test.go
+++ b/encoding/textpb/decode_test.go
@@ -963,6 +963,11 @@
},
},
wantErr: true,
+ }, {
+ desc: "ignore reserved field",
+ inputMessage: &pb2.Nests{},
+ inputText: "reserved_field: 'ignore this'",
+ wantMessage: &pb2.Nests{},
}}
for _, tt := range tests {