Improve error message when text unmarshaling a nested message with a required field.
Signed-off-by: David Symonds <dsymonds@golang.org>
diff --git a/proto/text_parser_test.go b/proto/text_parser_test.go
index d2e4cca..32c4117 100644
--- a/proto/text_parser_test.go
+++ b/proto/text_parser_test.go
@@ -336,6 +336,16 @@
},
},
+ // Missing required field in a required submessage
+ {
+ in: `count: 42 we_must_go_deeper < leo_finally_won_an_oscar <> >`,
+ err: `proto: required field "testdata.InnerMessage.host" not set`,
+ out: &MyMessage{
+ Count: Int32(42),
+ WeMustGoDeeper: &RequiredInnerMessage{LeoFinallyWonAnOscar: &InnerMessage{}},
+ },
+ },
+
// Repeated non-repeated field
{
in: `name: "Rob" name: "Russ"`,