proto: check for required fields in encoding/decoding

Change-Id: I0555a92e0399782f075b1dcd248e880dd48c7d6d
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/170579
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/encoding/textpb/decode.go b/encoding/textpb/decode.go
index 38b512e..731ee64 100644
--- a/encoding/textpb/decode.go
+++ b/encoding/textpb/decode.go
@@ -503,7 +503,10 @@
 		return err
 	}
 	// Serialize the embedded message and assign the resulting bytes to the value field.
-	b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m.Interface())
+	b, err := proto.MarshalOptions{
+		AllowPartial:  o.AllowPartial,
+		Deterministic: true,
+	}.Marshal(m.Interface())
 	if !nerr.Merge(err) {
 		return err
 	}