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/other_test.go b/encoding/textpb/other_test.go
index e20e005..d9118a7 100644
--- a/encoding/textpb/other_test.go
+++ b/encoding/textpb/other_test.go
@@ -151,8 +151,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)
}
@@ -173,8 +172,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)
}
@@ -196,8 +194,7 @@
m1 := &pb2.Nested{
OptString: scalar.String("message inside Any of another Any field"),
}
- // TODO: Switch to V2 marshal when ready.
- b1, err := protoV1.Marshal(m1)
+ b1, err := proto.MarshalOptions{Deterministic: true}.Marshal(m1)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
@@ -205,8 +202,7 @@
TypeUrl: "pb2.Nested",
Value: b1,
}
- // TODO: Switch to V2 marshal when ready.
- b2, err := protoV1.Marshal(m2)
+ b2, err := proto.MarshalOptions{Deterministic: true}.Marshal(m2)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}