encoding/textpb: reduce dependency on proto v1 package
Substitute protoV1.Marshal calls to use proto v2.
A few tests still need to use v1 due to missing required field checks in
v2.
Change-Id: I97ee208b81afc85c81142e70c1d7bdc47db76ce4
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167774
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/encoding/textpb/encode_test.go b/encoding/textpb/encode_test.go
index 3430fc5..6a6cd7a 100644
--- a/encoding/textpb/encode_test.go
+++ b/encoding/textpb/encode_test.go
@@ -1029,8 +1029,7 @@
OptString: scalar.String("inception"),
},
}
- // TODO: Switch to V2 marshal when ready.
- b, err := protoV1.Marshal(m)
+ b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
@@ -1054,8 +1053,7 @@
OptString: scalar.String("inception"),
},
}
- // TODO: Switch to V2 marshal when ready.
- b, err := protoV1.Marshal(m)
+ b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}