types: consistently name generated protos
Rename each generated protobuf package such that the base of the
Go package path is always equal to the Go package name to follow
proper Go package naming conventions.
The Go package name is derived from the .proto source file name by
replacing ".proto" with "pb" and stripping all underscores.
Change-Id: Iea05d1b5d94b1b2821ae10276ab771bb2df93c0e
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/177380
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/cmd/protoc-gen-go-grpc/internal_gengogrpc/grpc.go b/cmd/protoc-gen-go-grpc/internal_gengogrpc/grpc.go
index abc9d21..54048a3 100644
--- a/cmd/protoc-gen-go-grpc/internal_gengogrpc/grpc.go
+++ b/cmd/protoc-gen-go-grpc/internal_gengogrpc/grpc.go
@@ -12,7 +12,7 @@
"google.golang.org/protobuf/compiler/protogen"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
+ "google.golang.org/protobuf/types/descriptorpb"
)
const (
diff --git a/cmd/protoc-gen-go/annotation_test.go b/cmd/protoc-gen-go/annotation_test.go
index cc81d58..233163d 100644
--- a/cmd/protoc-gen-go/annotation_test.go
+++ b/cmd/protoc-gen-go/annotation_test.go
@@ -13,7 +13,7 @@
"google.golang.org/protobuf/internal/fieldnum"
"google.golang.org/protobuf/internal/scalar"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
+ "google.golang.org/protobuf/types/descriptorpb"
)
func TestAnnotations(t *testing.T) {
diff --git a/cmd/protoc-gen-go/internal_gengo/main.go b/cmd/protoc-gen-go/internal_gengo/main.go
index 37bdc3d..6a48126 100644
--- a/cmd/protoc-gen-go/internal_gengo/main.go
+++ b/cmd/protoc-gen-go/internal_gengo/main.go
@@ -21,7 +21,7 @@
"google.golang.org/protobuf/internal/fieldnum"
"google.golang.org/protobuf/reflect/protoreflect"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
+ "google.golang.org/protobuf/types/descriptorpb"
)
// minimumVersion is minimum version of the v2 proto package that is required.
diff --git a/cmd/protoc-gen-go/internal_gengo/reflect.go b/cmd/protoc-gen-go/internal_gengo/reflect.go
index d5a8a47..0ff2946 100644
--- a/cmd/protoc-gen-go/internal_gengo/reflect.go
+++ b/cmd/protoc-gen-go/internal_gengo/reflect.go
@@ -14,7 +14,7 @@
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
+ "google.golang.org/protobuf/types/descriptorpb"
)
// TODO: Add support for proto options.
diff --git a/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.pb.go b/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.pb.go
index 26be3f3..61fda36 100644
--- a/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.pb.go
+++ b/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.pb.go
@@ -8,7 +8,7 @@
protoregistry "google.golang.org/protobuf/reflect/protoregistry"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- descriptor "google.golang.org/protobuf/types/descriptor"
+ descriptorpb "google.golang.org/protobuf/types/descriptorpb"
sync "sync"
)
@@ -83,7 +83,7 @@
var file_extensions_proto3_ext3_proto_extDescs = []protoiface.ExtensionDescV1{
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*bool)(nil),
Field: 1001,
Name: "goproto.protoc.extension.proto3.extension_bool",
@@ -91,7 +91,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*Enum)(nil),
Field: 1002,
Name: "goproto.protoc.extension.proto3.extension_enum",
@@ -99,7 +99,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*int32)(nil),
Field: 1003,
Name: "goproto.protoc.extension.proto3.extension_int32",
@@ -107,7 +107,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*int32)(nil),
Field: 1004,
Name: "goproto.protoc.extension.proto3.extension_sint32",
@@ -115,7 +115,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*uint32)(nil),
Field: 1005,
Name: "goproto.protoc.extension.proto3.extension_uint32",
@@ -123,7 +123,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*int64)(nil),
Field: 1006,
Name: "goproto.protoc.extension.proto3.extension_int64",
@@ -131,7 +131,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*int64)(nil),
Field: 1007,
Name: "goproto.protoc.extension.proto3.extension_sint64",
@@ -139,7 +139,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*uint64)(nil),
Field: 1008,
Name: "goproto.protoc.extension.proto3.extension_uint64",
@@ -147,7 +147,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*int32)(nil),
Field: 1009,
Name: "goproto.protoc.extension.proto3.extension_sfixed32",
@@ -155,7 +155,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*uint32)(nil),
Field: 1010,
Name: "goproto.protoc.extension.proto3.extension_fixed32",
@@ -163,7 +163,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*float32)(nil),
Field: 1011,
Name: "goproto.protoc.extension.proto3.extension_float",
@@ -171,7 +171,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*int64)(nil),
Field: 1012,
Name: "goproto.protoc.extension.proto3.extension_sfixed64",
@@ -179,7 +179,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*uint64)(nil),
Field: 1013,
Name: "goproto.protoc.extension.proto3.extension_fixed64",
@@ -187,7 +187,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*float64)(nil),
Field: 1014,
Name: "goproto.protoc.extension.proto3.extension_double",
@@ -195,7 +195,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*string)(nil),
Field: 1015,
Name: "goproto.protoc.extension.proto3.extension_string",
@@ -203,7 +203,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]byte)(nil),
Field: 1016,
Name: "goproto.protoc.extension.proto3.extension_bytes",
@@ -211,7 +211,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*Message)(nil),
Field: 1017,
Name: "goproto.protoc.extension.proto3.extension_Message",
@@ -219,7 +219,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]bool)(nil),
Field: 2001,
Name: "goproto.protoc.extension.proto3.repeated_extension_bool",
@@ -227,7 +227,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]Enum)(nil),
Field: 2002,
Name: "goproto.protoc.extension.proto3.repeated_extension_enum",
@@ -235,7 +235,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]int32)(nil),
Field: 2003,
Name: "goproto.protoc.extension.proto3.repeated_extension_int32",
@@ -243,7 +243,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]int32)(nil),
Field: 2004,
Name: "goproto.protoc.extension.proto3.repeated_extension_sint32",
@@ -251,7 +251,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]uint32)(nil),
Field: 2005,
Name: "goproto.protoc.extension.proto3.repeated_extension_uint32",
@@ -259,7 +259,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]int64)(nil),
Field: 2006,
Name: "goproto.protoc.extension.proto3.repeated_extension_int64",
@@ -267,7 +267,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]int64)(nil),
Field: 2007,
Name: "goproto.protoc.extension.proto3.repeated_extension_sint64",
@@ -275,7 +275,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]uint64)(nil),
Field: 2008,
Name: "goproto.protoc.extension.proto3.repeated_extension_uint64",
@@ -283,7 +283,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]int32)(nil),
Field: 2009,
Name: "goproto.protoc.extension.proto3.repeated_extension_sfixed32",
@@ -291,7 +291,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]uint32)(nil),
Field: 2010,
Name: "goproto.protoc.extension.proto3.repeated_extension_fixed32",
@@ -299,7 +299,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]float32)(nil),
Field: 2011,
Name: "goproto.protoc.extension.proto3.repeated_extension_float",
@@ -307,7 +307,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]int64)(nil),
Field: 2012,
Name: "goproto.protoc.extension.proto3.repeated_extension_sfixed64",
@@ -315,7 +315,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]uint64)(nil),
Field: 2013,
Name: "goproto.protoc.extension.proto3.repeated_extension_fixed64",
@@ -323,7 +323,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]float64)(nil),
Field: 2014,
Name: "goproto.protoc.extension.proto3.repeated_extension_double",
@@ -331,7 +331,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]string)(nil),
Field: 2015,
Name: "goproto.protoc.extension.proto3.repeated_extension_string",
@@ -339,7 +339,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([][]byte)(nil),
Field: 2016,
Name: "goproto.protoc.extension.proto3.repeated_extension_bytes",
@@ -347,7 +347,7 @@
Filename: "extensions/proto3/ext3.proto",
},
{
- ExtendedType: (*descriptor.MessageOptions)(nil),
+ ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: ([]*Message)(nil),
Field: 2017,
Name: "goproto.protoc.extension.proto3.repeated_extension_Message",
@@ -683,9 +683,9 @@
var file_extensions_proto3_ext3_proto_enumTypes = make([]protoreflect.EnumType, 1)
var file_extensions_proto3_ext3_proto_msgTypes = make([]protoimpl.MessageType, 1)
var file_extensions_proto3_ext3_proto_goTypes = []interface{}{
- (Enum)(0), // 0: goproto.protoc.extension.proto3.Enum
- (*Message)(nil), // 1: goproto.protoc.extension.proto3.Message
- (*descriptor.MessageOptions)(nil), // 2: google.protobuf.MessageOptions
+ (Enum)(0), // 0: goproto.protoc.extension.proto3.Enum
+ (*Message)(nil), // 1: goproto.protoc.extension.proto3.Message
+ (*descriptorpb.MessageOptions)(nil), // 2: google.protobuf.MessageOptions
}
var file_extensions_proto3_ext3_proto_depIdxs = []int32{
2, // goproto.protoc.extension.proto3.extension_bool:extendee -> google.protobuf.MessageOptions
diff --git a/compiler/protogen/protogen.go b/compiler/protogen/protogen.go
index 41500e9..c534ba2 100644
--- a/compiler/protogen/protogen.go
+++ b/compiler/protogen/protogen.go
@@ -36,8 +36,8 @@
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
- pluginpb "google.golang.org/protobuf/types/plugin"
+ "google.golang.org/protobuf/types/descriptorpb"
+ "google.golang.org/protobuf/types/pluginpb"
)
// Run executes a function as a protoc plugin.
diff --git a/compiler/protogen/protogen_test.go b/compiler/protogen/protogen_test.go
index d4da172..2eb82ea 100644
--- a/compiler/protogen/protogen_test.go
+++ b/compiler/protogen/protogen_test.go
@@ -13,8 +13,8 @@
"google.golang.org/protobuf/internal/scalar"
"google.golang.org/protobuf/reflect/protoreflect"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
- pluginpb "google.golang.org/protobuf/types/plugin"
+ "google.golang.org/protobuf/types/descriptorpb"
+ "google.golang.org/protobuf/types/pluginpb"
)
func TestPluginParameters(t *testing.T) {
diff --git a/encoding/protojson/bench_test.go b/encoding/protojson/bench_test.go
index 70603af..8d5a0bb 100644
--- a/encoding/protojson/bench_test.go
+++ b/encoding/protojson/bench_test.go
@@ -8,14 +8,15 @@
"testing"
"google.golang.org/protobuf/encoding/protojson"
- knownpb "google.golang.org/protobuf/types/known"
+
+ "google.golang.org/protobuf/types/known/durationpb"
)
func BenchmarkUnmarshal_Duration(b *testing.B) {
input := []byte(`"-123456789.123456789s"`)
for i := 0; i < b.N; i++ {
- err := protojson.Unmarshal(input, &knownpb.Duration{})
+ err := protojson.Unmarshal(input, &durationpb.Duration{})
if err != nil {
b.Fatal(err)
}
diff --git a/encoding/protojson/decode_test.go b/encoding/protojson/decode_test.go
index ba8f10b..b713a38 100644
--- a/encoding/protojson/decode_test.go
+++ b/encoding/protojson/decode_test.go
@@ -19,7 +19,13 @@
preg "google.golang.org/protobuf/reflect/protoregistry"
"google.golang.org/protobuf/runtime/protoiface"
- knownpb "google.golang.org/protobuf/types/known"
+ "google.golang.org/protobuf/types/known/anypb"
+ "google.golang.org/protobuf/types/known/durationpb"
+ "google.golang.org/protobuf/types/known/emptypb"
+ "google.golang.org/protobuf/types/known/fieldmaskpb"
+ "google.golang.org/protobuf/types/known/structpb"
+ "google.golang.org/protobuf/types/known/timestamppb"
+ "google.golang.org/protobuf/types/known/wrapperspb"
)
func init() {
@@ -1429,101 +1435,101 @@
}(),
}, {
desc: "Empty",
- inputMessage: &knownpb.Empty{},
+ inputMessage: &emptypb.Empty{},
inputText: `{}`,
- wantMessage: &knownpb.Empty{},
+ wantMessage: &emptypb.Empty{},
}, {
desc: "Empty contains unknown",
- inputMessage: &knownpb.Empty{},
+ inputMessage: &emptypb.Empty{},
inputText: `{"unknown": null}`,
wantErr: true,
}, {
desc: "BoolValue false",
- inputMessage: &knownpb.BoolValue{},
+ inputMessage: &wrapperspb.BoolValue{},
inputText: `false`,
- wantMessage: &knownpb.BoolValue{},
+ wantMessage: &wrapperspb.BoolValue{},
}, {
desc: "BoolValue true",
- inputMessage: &knownpb.BoolValue{},
+ inputMessage: &wrapperspb.BoolValue{},
inputText: `true`,
- wantMessage: &knownpb.BoolValue{Value: true},
+ wantMessage: &wrapperspb.BoolValue{Value: true},
}, {
desc: "BoolValue invalid value",
- inputMessage: &knownpb.BoolValue{},
+ inputMessage: &wrapperspb.BoolValue{},
inputText: `{}`,
wantErr: true,
}, {
desc: "Int32Value",
- inputMessage: &knownpb.Int32Value{},
+ inputMessage: &wrapperspb.Int32Value{},
inputText: `42`,
- wantMessage: &knownpb.Int32Value{Value: 42},
+ wantMessage: &wrapperspb.Int32Value{Value: 42},
}, {
desc: "Int32Value in JSON string",
- inputMessage: &knownpb.Int32Value{},
+ inputMessage: &wrapperspb.Int32Value{},
inputText: `"1.23e3"`,
- wantMessage: &knownpb.Int32Value{Value: 1230},
+ wantMessage: &wrapperspb.Int32Value{Value: 1230},
}, {
desc: "Int64Value",
- inputMessage: &knownpb.Int64Value{},
+ inputMessage: &wrapperspb.Int64Value{},
inputText: `"42"`,
- wantMessage: &knownpb.Int64Value{Value: 42},
+ wantMessage: &wrapperspb.Int64Value{Value: 42},
}, {
desc: "UInt32Value",
- inputMessage: &knownpb.UInt32Value{},
+ inputMessage: &wrapperspb.UInt32Value{},
inputText: `42`,
- wantMessage: &knownpb.UInt32Value{Value: 42},
+ wantMessage: &wrapperspb.UInt32Value{Value: 42},
}, {
desc: "UInt64Value",
- inputMessage: &knownpb.UInt64Value{},
+ inputMessage: &wrapperspb.UInt64Value{},
inputText: `"42"`,
- wantMessage: &knownpb.UInt64Value{Value: 42},
+ wantMessage: &wrapperspb.UInt64Value{Value: 42},
}, {
desc: "FloatValue",
- inputMessage: &knownpb.FloatValue{},
+ inputMessage: &wrapperspb.FloatValue{},
inputText: `1.02`,
- wantMessage: &knownpb.FloatValue{Value: 1.02},
+ wantMessage: &wrapperspb.FloatValue{Value: 1.02},
}, {
desc: "FloatValue exceeds max limit",
- inputMessage: &knownpb.FloatValue{},
+ inputMessage: &wrapperspb.FloatValue{},
inputText: `1.23+40`,
wantErr: true,
}, {
desc: "FloatValue Infinity",
- inputMessage: &knownpb.FloatValue{},
+ inputMessage: &wrapperspb.FloatValue{},
inputText: `"-Infinity"`,
- wantMessage: &knownpb.FloatValue{Value: float32(math.Inf(-1))},
+ wantMessage: &wrapperspb.FloatValue{Value: float32(math.Inf(-1))},
}, {
desc: "DoubleValue",
- inputMessage: &knownpb.DoubleValue{},
+ inputMessage: &wrapperspb.DoubleValue{},
inputText: `1.02`,
- wantMessage: &knownpb.DoubleValue{Value: 1.02},
+ wantMessage: &wrapperspb.DoubleValue{Value: 1.02},
}, {
desc: "DoubleValue Infinity",
- inputMessage: &knownpb.DoubleValue{},
+ inputMessage: &wrapperspb.DoubleValue{},
inputText: `"Infinity"`,
- wantMessage: &knownpb.DoubleValue{Value: math.Inf(+1)},
+ wantMessage: &wrapperspb.DoubleValue{Value: math.Inf(+1)},
}, {
desc: "StringValue empty",
- inputMessage: &knownpb.StringValue{},
+ inputMessage: &wrapperspb.StringValue{},
inputText: `""`,
- wantMessage: &knownpb.StringValue{},
+ wantMessage: &wrapperspb.StringValue{},
}, {
desc: "StringValue",
- inputMessage: &knownpb.StringValue{},
+ inputMessage: &wrapperspb.StringValue{},
inputText: `"谷歌"`,
- wantMessage: &knownpb.StringValue{Value: "谷歌"},
+ wantMessage: &wrapperspb.StringValue{Value: "谷歌"},
}, {
desc: "StringValue with invalid UTF8 error",
- inputMessage: &knownpb.StringValue{},
+ inputMessage: &wrapperspb.StringValue{},
inputText: "\"abc\xff\"",
- wantMessage: &knownpb.StringValue{Value: "abc\xff"},
+ wantMessage: &wrapperspb.StringValue{Value: "abc\xff"},
wantErr: true,
}, {
desc: "StringValue field with invalid UTF8 error",
inputMessage: &pb2.KnownTypes{},
inputText: "{\n \"optString\": \"abc\xff\"\n}",
wantMessage: &pb2.KnownTypes{
- OptString: &knownpb.StringValue{Value: "abc\xff"},
+ OptString: &wrapperspb.StringValue{Value: "abc\xff"},
},
wantErr: true,
}, {
@@ -1532,24 +1538,24 @@
inputText: `{
"optNull": null
}`,
- wantMessage: &pb2.KnownTypes{OptNull: new(knownpb.NullValue)},
+ wantMessage: &pb2.KnownTypes{OptNull: new(structpb.NullValue)},
}, {
desc: "NullValue field with string",
inputMessage: &pb2.KnownTypes{},
inputText: `{
"optNull": "NULL_VALUE"
}`,
- wantMessage: &pb2.KnownTypes{OptNull: new(knownpb.NullValue)},
+ wantMessage: &pb2.KnownTypes{OptNull: new(structpb.NullValue)},
}, {
desc: "BytesValue",
- inputMessage: &knownpb.BytesValue{},
+ inputMessage: &wrapperspb.BytesValue{},
inputText: `"aGVsbG8="`,
- wantMessage: &knownpb.BytesValue{Value: []byte("hello")},
+ wantMessage: &wrapperspb.BytesValue{Value: []byte("hello")},
}, {
desc: "Value null",
- inputMessage: &knownpb.Value{},
+ inputMessage: &structpb.Value{},
inputText: `null`,
- wantMessage: &knownpb.Value{Kind: &knownpb.Value_NullValue{}},
+ wantMessage: &structpb.Value{Kind: &structpb.Value_NullValue{}},
}, {
desc: "Value field null",
inputMessage: &pb2.KnownTypes{},
@@ -1557,13 +1563,13 @@
"optValue": null
}`,
wantMessage: &pb2.KnownTypes{
- OptValue: &knownpb.Value{Kind: &knownpb.Value_NullValue{}},
+ OptValue: &structpb.Value{Kind: &structpb.Value_NullValue{}},
},
}, {
desc: "Value bool",
- inputMessage: &knownpb.Value{},
+ inputMessage: &structpb.Value{},
inputText: `false`,
- wantMessage: &knownpb.Value{Kind: &knownpb.Value_BoolValue{}},
+ wantMessage: &structpb.Value{Kind: &structpb.Value_BoolValue{}},
}, {
desc: "Value field bool",
inputMessage: &pb2.KnownTypes{},
@@ -1571,13 +1577,13 @@
"optValue": true
}`,
wantMessage: &pb2.KnownTypes{
- OptValue: &knownpb.Value{Kind: &knownpb.Value_BoolValue{true}},
+ OptValue: &structpb.Value{Kind: &structpb.Value_BoolValue{true}},
},
}, {
desc: "Value number",
- inputMessage: &knownpb.Value{},
+ inputMessage: &structpb.Value{},
inputText: `1.02`,
- wantMessage: &knownpb.Value{Kind: &knownpb.Value_NumberValue{1.02}},
+ wantMessage: &structpb.Value{Kind: &structpb.Value_NumberValue{1.02}},
}, {
desc: "Value field number",
inputMessage: &pb2.KnownTypes{},
@@ -1585,18 +1591,18 @@
"optValue": 1.02
}`,
wantMessage: &pb2.KnownTypes{
- OptValue: &knownpb.Value{Kind: &knownpb.Value_NumberValue{1.02}},
+ OptValue: &structpb.Value{Kind: &structpb.Value_NumberValue{1.02}},
},
}, {
desc: "Value string",
- inputMessage: &knownpb.Value{},
+ inputMessage: &structpb.Value{},
inputText: `"hello"`,
- wantMessage: &knownpb.Value{Kind: &knownpb.Value_StringValue{"hello"}},
+ wantMessage: &structpb.Value{Kind: &structpb.Value_StringValue{"hello"}},
}, {
desc: "Value string with invalid UTF8",
- inputMessage: &knownpb.Value{},
+ inputMessage: &structpb.Value{},
inputText: "\"\xff\"",
- wantMessage: &knownpb.Value{Kind: &knownpb.Value_StringValue{"\xff"}},
+ wantMessage: &structpb.Value{Kind: &structpb.Value_StringValue{"\xff"}},
wantErr: true,
}, {
desc: "Value field string",
@@ -1605,7 +1611,7 @@
"optValue": "NaN"
}`,
wantMessage: &pb2.KnownTypes{
- OptValue: &knownpb.Value{Kind: &knownpb.Value_StringValue{"NaN"}},
+ OptValue: &structpb.Value{Kind: &structpb.Value_StringValue{"NaN"}},
},
}, {
desc: "Value field string with invalid UTF8",
@@ -1614,21 +1620,21 @@
"optValue": "` + "\xff" + `"
}`,
wantMessage: &pb2.KnownTypes{
- OptValue: &knownpb.Value{Kind: &knownpb.Value_StringValue{"\xff"}},
+ OptValue: &structpb.Value{Kind: &structpb.Value_StringValue{"\xff"}},
},
wantErr: true,
}, {
desc: "Value empty struct",
- inputMessage: &knownpb.Value{},
+ inputMessage: &structpb.Value{},
inputText: `{}`,
- wantMessage: &knownpb.Value{
- Kind: &knownpb.Value_StructValue{
- &knownpb.Struct{Fields: map[string]*knownpb.Value{}},
+ wantMessage: &structpb.Value{
+ Kind: &structpb.Value_StructValue{
+ &structpb.Struct{Fields: map[string]*structpb.Value{}},
},
},
}, {
desc: "Value struct",
- inputMessage: &knownpb.Value{},
+ inputMessage: &structpb.Value{},
inputText: `{
"string": "hello",
"number": 123,
@@ -1639,25 +1645,25 @@
},
"list": []
}`,
- wantMessage: &knownpb.Value{
- Kind: &knownpb.Value_StructValue{
- &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "string": {Kind: &knownpb.Value_StringValue{"hello"}},
- "number": {Kind: &knownpb.Value_NumberValue{123}},
- "null": {Kind: &knownpb.Value_NullValue{}},
- "bool": {Kind: &knownpb.Value_BoolValue{false}},
+ wantMessage: &structpb.Value{
+ Kind: &structpb.Value_StructValue{
+ &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "string": {Kind: &structpb.Value_StringValue{"hello"}},
+ "number": {Kind: &structpb.Value_NumberValue{123}},
+ "null": {Kind: &structpb.Value_NullValue{}},
+ "bool": {Kind: &structpb.Value_BoolValue{false}},
"struct": {
- Kind: &knownpb.Value_StructValue{
- &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "string": {Kind: &knownpb.Value_StringValue{"world"}},
+ Kind: &structpb.Value_StructValue{
+ &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "string": {Kind: &structpb.Value_StringValue{"world"}},
},
},
},
},
"list": {
- Kind: &knownpb.Value_ListValue{&knownpb.ListValue{}},
+ Kind: &structpb.Value_ListValue{&structpb.ListValue{}},
},
},
},
@@ -1665,13 +1671,13 @@
},
}, {
desc: "Value struct with invalid UTF8 string",
- inputMessage: &knownpb.Value{},
+ inputMessage: &structpb.Value{},
inputText: "{\"string\": \"abc\xff\"}",
- wantMessage: &knownpb.Value{
- Kind: &knownpb.Value_StructValue{
- &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "string": {Kind: &knownpb.Value_StringValue{"abc\xff"}},
+ wantMessage: &structpb.Value{
+ Kind: &structpb.Value_StructValue{
+ &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "string": {Kind: &structpb.Value_StringValue{"abc\xff"}},
},
},
},
@@ -1686,11 +1692,11 @@
}
}`,
wantMessage: &pb2.KnownTypes{
- OptValue: &knownpb.Value{
- Kind: &knownpb.Value_StructValue{
- &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "string": {Kind: &knownpb.Value_StringValue{"hello"}},
+ OptValue: &structpb.Value{
+ Kind: &structpb.Value_StructValue{
+ &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "string": {Kind: &structpb.Value_StringValue{"hello"}},
},
},
},
@@ -1698,16 +1704,16 @@
},
}, {
desc: "Value empty list",
- inputMessage: &knownpb.Value{},
+ inputMessage: &structpb.Value{},
inputText: `[]`,
- wantMessage: &knownpb.Value{
- Kind: &knownpb.Value_ListValue{
- &knownpb.ListValue{Values: []*knownpb.Value{}},
+ wantMessage: &structpb.Value{
+ Kind: &structpb.Value_ListValue{
+ &structpb.ListValue{Values: []*structpb.Value{}},
},
},
}, {
desc: "Value list",
- inputMessage: &knownpb.Value{},
+ inputMessage: &structpb.Value{},
inputText: `[
"string",
123,
@@ -1721,23 +1727,23 @@
false
]
]`,
- wantMessage: &knownpb.Value{
- Kind: &knownpb.Value_ListValue{
- &knownpb.ListValue{
- Values: []*knownpb.Value{
- {Kind: &knownpb.Value_StringValue{"string"}},
- {Kind: &knownpb.Value_NumberValue{123}},
- {Kind: &knownpb.Value_NullValue{}},
- {Kind: &knownpb.Value_BoolValue{true}},
- {Kind: &knownpb.Value_StructValue{&knownpb.Struct{}}},
+ wantMessage: &structpb.Value{
+ Kind: &structpb.Value_ListValue{
+ &structpb.ListValue{
+ Values: []*structpb.Value{
+ {Kind: &structpb.Value_StringValue{"string"}},
+ {Kind: &structpb.Value_NumberValue{123}},
+ {Kind: &structpb.Value_NullValue{}},
+ {Kind: &structpb.Value_BoolValue{true}},
+ {Kind: &structpb.Value_StructValue{&structpb.Struct{}}},
{
- Kind: &knownpb.Value_ListValue{
- &knownpb.ListValue{
- Values: []*knownpb.Value{
- {Kind: &knownpb.Value_StringValue{"string"}},
- {Kind: &knownpb.Value_NumberValue{1.23}},
- {Kind: &knownpb.Value_NullValue{}},
- {Kind: &knownpb.Value_BoolValue{false}},
+ Kind: &structpb.Value_ListValue{
+ &structpb.ListValue{
+ Values: []*structpb.Value{
+ {Kind: &structpb.Value_StringValue{"string"}},
+ {Kind: &structpb.Value_NumberValue{1.23}},
+ {Kind: &structpb.Value_NullValue{}},
+ {Kind: &structpb.Value_BoolValue{false}},
},
},
},
@@ -1748,13 +1754,13 @@
},
}, {
desc: "Value list with invalid UTF8 string",
- inputMessage: &knownpb.Value{},
+ inputMessage: &structpb.Value{},
inputText: "[\"abc\xff\"]",
- wantMessage: &knownpb.Value{
- Kind: &knownpb.Value_ListValue{
- &knownpb.ListValue{
- Values: []*knownpb.Value{
- {Kind: &knownpb.Value_StringValue{"abc\xff"}},
+ wantMessage: &structpb.Value{
+ Kind: &structpb.Value_ListValue{
+ &structpb.ListValue{
+ Values: []*structpb.Value{
+ {Kind: &structpb.Value_StringValue{"abc\xff"}},
},
},
},
@@ -1767,11 +1773,11 @@
"optValue": [ "` + "abc\xff" + `"]
}`,
wantMessage: &pb2.KnownTypes{
- OptValue: &knownpb.Value{
- Kind: &knownpb.Value_ListValue{
- &knownpb.ListValue{
- Values: []*knownpb.Value{
- {Kind: &knownpb.Value_StringValue{"abc\xff"}},
+ OptValue: &structpb.Value{
+ Kind: &structpb.Value_ListValue{
+ &structpb.ListValue{
+ Values: []*structpb.Value{
+ {Kind: &structpb.Value_StringValue{"abc\xff"}},
},
},
},
@@ -1780,174 +1786,174 @@
wantErr: true,
}, {
desc: "Duration empty string",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `""`,
wantErr: true,
}, {
desc: "Duration with secs",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"3s"`,
- wantMessage: &knownpb.Duration{Seconds: 3},
+ wantMessage: &durationpb.Duration{Seconds: 3},
}, {
desc: "Duration with escaped unicode",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"\u0033s"`,
- wantMessage: &knownpb.Duration{Seconds: 3},
+ wantMessage: &durationpb.Duration{Seconds: 3},
}, {
desc: "Duration with -secs",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"-3s"`,
- wantMessage: &knownpb.Duration{Seconds: -3},
+ wantMessage: &durationpb.Duration{Seconds: -3},
}, {
desc: "Duration with plus sign",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"+3s"`,
- wantMessage: &knownpb.Duration{Seconds: 3},
+ wantMessage: &durationpb.Duration{Seconds: 3},
}, {
desc: "Duration with nanos",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"0.001s"`,
- wantMessage: &knownpb.Duration{Nanos: 1e6},
+ wantMessage: &durationpb.Duration{Nanos: 1e6},
}, {
desc: "Duration with -nanos",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"-0.001s"`,
- wantMessage: &knownpb.Duration{Nanos: -1e6},
+ wantMessage: &durationpb.Duration{Nanos: -1e6},
}, {
desc: "Duration with -nanos",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"-.001s"`,
- wantMessage: &knownpb.Duration{Nanos: -1e6},
+ wantMessage: &durationpb.Duration{Nanos: -1e6},
}, {
desc: "Duration with +nanos",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"+.001s"`,
- wantMessage: &knownpb.Duration{Nanos: 1e6},
+ wantMessage: &durationpb.Duration{Nanos: 1e6},
}, {
desc: "Duration with -secs -nanos",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"-123.000000450s"`,
- wantMessage: &knownpb.Duration{Seconds: -123, Nanos: -450},
+ wantMessage: &durationpb.Duration{Seconds: -123, Nanos: -450},
}, {
desc: "Duration with large secs",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"10000000000.000000001s"`,
- wantMessage: &knownpb.Duration{Seconds: 1e10, Nanos: 1},
+ wantMessage: &durationpb.Duration{Seconds: 1e10, Nanos: 1},
}, {
desc: "Duration with decimal without fractional",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"3.s"`,
- wantMessage: &knownpb.Duration{Seconds: 3},
+ wantMessage: &durationpb.Duration{Seconds: 3},
}, {
desc: "Duration with decimal without integer",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"0.5s"`,
- wantMessage: &knownpb.Duration{Nanos: 5e8},
+ wantMessage: &durationpb.Duration{Nanos: 5e8},
}, {
desc: "Duration max value",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"315576000000.999999999s"`,
- wantMessage: &knownpb.Duration{Seconds: 315576000000, Nanos: 999999999},
+ wantMessage: &durationpb.Duration{Seconds: 315576000000, Nanos: 999999999},
}, {
desc: "Duration min value",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"-315576000000.999999999s"`,
- wantMessage: &knownpb.Duration{Seconds: -315576000000, Nanos: -999999999},
+ wantMessage: &durationpb.Duration{Seconds: -315576000000, Nanos: -999999999},
}, {
desc: "Duration with +secs out of range",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"315576000001s"`,
wantErr: true,
}, {
desc: "Duration with -secs out of range",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"-315576000001s"`,
wantErr: true,
}, {
desc: "Duration with nanos beyond 9 digits",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"0.1000000000s"`,
wantErr: true,
}, {
desc: "Duration without suffix s",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"123"`,
wantErr: true,
}, {
desc: "Duration invalid signed fraction",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"123.+123s"`,
wantErr: true,
}, {
desc: "Duration invalid multiple .",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"123.123.s"`,
wantErr: true,
}, {
desc: "Duration invalid integer",
- inputMessage: &knownpb.Duration{},
+ inputMessage: &durationpb.Duration{},
inputText: `"01s"`,
wantErr: true,
}, {
desc: "Timestamp zero",
- inputMessage: &knownpb.Timestamp{},
+ inputMessage: ×tamppb.Timestamp{},
inputText: `"1970-01-01T00:00:00Z"`,
- wantMessage: &knownpb.Timestamp{},
+ wantMessage: ×tamppb.Timestamp{},
}, {
desc: "Timestamp with tz adjustment",
- inputMessage: &knownpb.Timestamp{},
+ inputMessage: ×tamppb.Timestamp{},
inputText: `"1970-01-01T00:00:00+01:00"`,
- wantMessage: &knownpb.Timestamp{Seconds: -3600},
+ wantMessage: ×tamppb.Timestamp{Seconds: -3600},
}, {
desc: "Timestamp UTC",
- inputMessage: &knownpb.Timestamp{},
+ inputMessage: ×tamppb.Timestamp{},
inputText: `"2019-03-19T23:03:21Z"`,
- wantMessage: &knownpb.Timestamp{Seconds: 1553036601},
+ wantMessage: ×tamppb.Timestamp{Seconds: 1553036601},
}, {
desc: "Timestamp with escaped unicode",
- inputMessage: &knownpb.Timestamp{},
+ inputMessage: ×tamppb.Timestamp{},
inputText: `"2019-0\u0033-19T23:03:21Z"`,
- wantMessage: &knownpb.Timestamp{Seconds: 1553036601},
+ wantMessage: ×tamppb.Timestamp{Seconds: 1553036601},
}, {
desc: "Timestamp with nanos",
- inputMessage: &knownpb.Timestamp{},
+ inputMessage: ×tamppb.Timestamp{},
inputText: `"2019-03-19T23:03:21.000000001Z"`,
- wantMessage: &knownpb.Timestamp{Seconds: 1553036601, Nanos: 1},
+ wantMessage: ×tamppb.Timestamp{Seconds: 1553036601, Nanos: 1},
}, {
desc: "Timestamp max value",
- inputMessage: &knownpb.Timestamp{},
+ inputMessage: ×tamppb.Timestamp{},
inputText: `"9999-12-31T23:59:59.999999999Z"`,
- wantMessage: &knownpb.Timestamp{Seconds: 253402300799, Nanos: 999999999},
+ wantMessage: ×tamppb.Timestamp{Seconds: 253402300799, Nanos: 999999999},
}, {
desc: "Timestamp above max value",
- inputMessage: &knownpb.Timestamp{},
+ inputMessage: ×tamppb.Timestamp{},
inputText: `"9999-12-31T23:59:59-01:00"`,
wantErr: true,
}, {
desc: "Timestamp min value",
- inputMessage: &knownpb.Timestamp{},
+ inputMessage: ×tamppb.Timestamp{},
inputText: `"0001-01-01T00:00:00Z"`,
- wantMessage: &knownpb.Timestamp{Seconds: -62135596800},
+ wantMessage: ×tamppb.Timestamp{Seconds: -62135596800},
}, {
desc: "Timestamp below min value",
- inputMessage: &knownpb.Timestamp{},
+ inputMessage: ×tamppb.Timestamp{},
inputText: `"0001-01-01T00:00:00+01:00"`,
wantErr: true,
}, {
desc: "Timestamp with nanos beyond 9 digits",
- inputMessage: &knownpb.Timestamp{},
+ inputMessage: ×tamppb.Timestamp{},
inputText: `"1970-01-01T00:00:00.0000000001Z"`,
wantErr: true,
}, {
desc: "FieldMask empty",
- inputMessage: &knownpb.FieldMask{},
+ inputMessage: &fieldmaskpb.FieldMask{},
inputText: `""`,
- wantMessage: &knownpb.FieldMask{Paths: []string{}},
+ wantMessage: &fieldmaskpb.FieldMask{Paths: []string{}},
}, {
desc: "FieldMask",
- inputMessage: &knownpb.FieldMask{},
+ inputMessage: &fieldmaskpb.FieldMask{},
inputText: `"foo,fooBar , foo.barQux ,Foo"`,
- wantMessage: &knownpb.FieldMask{
+ wantMessage: &fieldmaskpb.FieldMask{
Paths: []string{
"foo",
"foo_bar",
@@ -1962,7 +1968,7 @@
"optFieldmask": "foo, qux.fooBar"
}`,
wantMessage: &pb2.KnownTypes{
- OptFieldmask: &knownpb.FieldMask{
+ OptFieldmask: &fieldmaskpb.FieldMask{
Paths: []string{
"foo",
"qux.foo_bar",
@@ -1971,15 +1977,15 @@
},
}, {
desc: "Any empty",
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{}`,
- wantMessage: &knownpb.Any{},
+ wantMessage: &anypb.Any{},
}, {
desc: "Any with non-custom message",
umo: protojson.UnmarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "foo/pb2.Nested",
"optString": "embedded inside Any",
@@ -1998,7 +2004,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "foo/pb2.Nested",
Value: b,
}
@@ -2008,13 +2014,13 @@
umo: protojson.UnmarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{"@type": "foo/pb2.Nested"}`,
- wantMessage: &knownpb.Any{TypeUrl: "foo/pb2.Nested"},
+ wantMessage: &anypb.Any{TypeUrl: "foo/pb2.Nested"},
}, {
desc: "Any without registered type",
umo: protojson.UnmarshalOptions{Resolver: preg.NewTypes()},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{"@type": "foo/pb2.Nested"}`,
wantErr: true,
}, {
@@ -2022,7 +2028,7 @@
umo: protojson.UnmarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.PartialRequired{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "pb2.PartialRequired",
"optString": "embedded inside Any"
@@ -2038,7 +2044,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: string(m.ProtoReflect().Descriptor().FullName()),
Value: b,
}
@@ -2050,7 +2056,7 @@
AllowPartial: true,
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.PartialRequired{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "pb2.PartialRequired",
"optString": "embedded inside Any"
@@ -2066,7 +2072,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: string(m.ProtoReflect().Descriptor().FullName()),
Value: b,
}
@@ -2076,7 +2082,7 @@
umo: protojson.UnmarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"optString": "` + "abc\xff" + `",
"@type": "foo/pb2.Nested"
@@ -2089,7 +2095,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "foo/pb2.Nested",
Value: b,
}
@@ -2098,20 +2104,20 @@
}, {
desc: "Any with BoolValue",
umo: protojson.UnmarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.BoolValue{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&wrapperspb.BoolValue{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "type.googleapis.com/google.protobuf.BoolValue",
"value": true
}`,
wantMessage: func() proto.Message {
- m := &knownpb.BoolValue{Value: true}
+ m := &wrapperspb.BoolValue{Value: true}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "type.googleapis.com/google.protobuf.BoolValue",
Value: b,
}
@@ -2119,22 +2125,22 @@
}, {
desc: "Any with Empty",
umo: protojson.UnmarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Empty{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&emptypb.Empty{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"value": {},
"@type": "type.googleapis.com/google.protobuf.Empty"
}`,
- wantMessage: &knownpb.Any{
+ wantMessage: &anypb.Any{
TypeUrl: "type.googleapis.com/google.protobuf.Empty",
},
}, {
desc: "Any with missing Empty",
umo: protojson.UnmarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Empty{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&emptypb.Empty{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "type.googleapis.com/google.protobuf.Empty"
}`,
@@ -2142,20 +2148,20 @@
}, {
desc: "Any with StringValue containing invalid UTF8",
umo: protojson.UnmarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.StringValue{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&wrapperspb.StringValue{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "google.protobuf.StringValue",
"value": "` + "abc\xff" + `"
}`,
wantMessage: func() proto.Message {
- m := &knownpb.StringValue{Value: "abcd"}
+ m := &wrapperspb.StringValue{Value: "abcd"}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "google.protobuf.StringValue",
Value: bytes.Replace(b, []byte("abcd"), []byte("abc\xff"), -1),
}
@@ -2164,20 +2170,20 @@
}, {
desc: "Any with Int64Value",
umo: protojson.UnmarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Int64Value{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&wrapperspb.Int64Value{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "google.protobuf.Int64Value",
"value": "42"
}`,
wantMessage: func() proto.Message {
- m := &knownpb.Int64Value{Value: 42}
+ m := &wrapperspb.Int64Value{Value: 42}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "google.protobuf.Int64Value",
Value: b,
}
@@ -2185,9 +2191,9 @@
}, {
desc: "Any with invalid Int64Value",
umo: protojson.UnmarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Int64Value{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&wrapperspb.Int64Value{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "google.protobuf.Int64Value",
"value": "forty-two"
@@ -2196,9 +2202,9 @@
}, {
desc: "Any with invalid UInt64Value",
umo: protojson.UnmarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.UInt64Value{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&wrapperspb.UInt64Value{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "google.protobuf.UInt64Value",
"value": -42
@@ -2207,20 +2213,20 @@
}, {
desc: "Any with Duration",
umo: protojson.UnmarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Duration{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&durationpb.Duration{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "type.googleapis.com/google.protobuf.Duration",
"value": "0s"
}`,
wantMessage: func() proto.Message {
- m := &knownpb.Duration{}
+ m := &durationpb.Duration{}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "type.googleapis.com/google.protobuf.Duration",
Value: b,
}
@@ -2228,20 +2234,20 @@
}, {
desc: "Any with Value of StringValue",
umo: protojson.UnmarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Value{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&structpb.Value{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "google.protobuf.Value",
"value": "` + "abc\xff" + `"
}`,
wantMessage: func() proto.Message {
- m := &knownpb.Value{Kind: &knownpb.Value_StringValue{"abcd"}}
+ m := &structpb.Value{Kind: &structpb.Value_StringValue{"abcd"}}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "google.protobuf.Value",
Value: bytes.Replace(b, []byte("abcd"), []byte("abc\xff"), -1),
}
@@ -2250,20 +2256,20 @@
}, {
desc: "Any with Value of NullValue",
umo: protojson.UnmarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Value{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&structpb.Value{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "google.protobuf.Value",
"value": null
}`,
wantMessage: func() proto.Message {
- m := &knownpb.Value{Kind: &knownpb.Value_NullValue{}}
+ m := &structpb.Value{Kind: &structpb.Value_NullValue{}}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "google.protobuf.Value",
Value: b,
}
@@ -2272,14 +2278,14 @@
desc: "Any with Struct",
umo: protojson.UnmarshalOptions{
Resolver: preg.NewTypes(
- pimpl.Export{}.MessageTypeOf(&knownpb.Struct{}),
- pimpl.Export{}.MessageTypeOf(&knownpb.Value{}),
- pimpl.Export{}.MessageTypeOf(&knownpb.BoolValue{}),
- pimpl.Export{}.EnumTypeOf(knownpb.NullValue_NULL_VALUE),
- pimpl.Export{}.MessageTypeOf(&knownpb.StringValue{}),
+ pimpl.Export{}.MessageTypeOf(&structpb.Struct{}),
+ pimpl.Export{}.MessageTypeOf(&structpb.Value{}),
+ pimpl.Export{}.MessageTypeOf(&wrapperspb.BoolValue{}),
+ pimpl.Export{}.EnumTypeOf(structpb.NullValue_NULL_VALUE),
+ pimpl.Export{}.MessageTypeOf(&wrapperspb.StringValue{}),
),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "google.protobuf.Struct",
"value": {
@@ -2292,16 +2298,16 @@
}
}`,
wantMessage: func() proto.Message {
- m := &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "bool": {Kind: &knownpb.Value_BoolValue{true}},
- "null": {Kind: &knownpb.Value_NullValue{}},
- "string": {Kind: &knownpb.Value_StringValue{"hello"}},
+ m := &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "bool": {Kind: &structpb.Value_BoolValue{true}},
+ "null": {Kind: &structpb.Value_NullValue{}},
+ "string": {Kind: &structpb.Value_StringValue{"hello"}},
"struct": {
- Kind: &knownpb.Value_StructValue{
- &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "string": {Kind: &knownpb.Value_StringValue{"world"}},
+ Kind: &structpb.Value_StructValue{
+ &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "string": {Kind: &structpb.Value_StringValue{"world"}},
},
},
},
@@ -2312,7 +2318,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "google.protobuf.Struct",
Value: b,
}
@@ -2320,14 +2326,14 @@
}, {
desc: "Any with missing @type",
umo: protojson.UnmarshalOptions{},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"value": {}
}`,
wantErr: true,
}, {
desc: "Any with empty @type",
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": ""
}`,
@@ -2337,10 +2343,10 @@
umo: protojson.UnmarshalOptions{
Resolver: preg.NewTypes(
pimpl.Export{}.MessageTypeOf(&pb2.Nested{}),
- pimpl.Export{}.MessageTypeOf(&knownpb.StringValue{}),
+ pimpl.Export{}.MessageTypeOf(&wrapperspb.StringValue{}),
),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "google.protobuf.StringValue",
"value": "hello",
@@ -2350,9 +2356,9 @@
}, {
desc: "Any with duplicate value",
umo: protojson.UnmarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.StringValue{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&wrapperspb.StringValue{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "google.protobuf.StringValue",
"value": "hello",
@@ -2364,7 +2370,7 @@
umo: protojson.UnmarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "pb2.Nested",
"optString": "hello",
@@ -2376,11 +2382,11 @@
umo: protojson.UnmarshalOptions{
Resolver: preg.NewTypes(
pimpl.Export{}.MessageTypeOf(&pb2.KnownTypes{}),
- pimpl.Export{}.MessageTypeOf(&knownpb.Any{}),
- pimpl.Export{}.MessageTypeOf(&knownpb.StringValue{}),
+ pimpl.Export{}.MessageTypeOf(&anypb.Any{}),
+ pimpl.Export{}.MessageTypeOf(&wrapperspb.StringValue{}),
),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "pb2.KnownTypes",
"optAny": {
@@ -2389,12 +2395,12 @@
}
}`,
wantMessage: func() proto.Message {
- m1 := &knownpb.StringValue{Value: "abcd"}
+ m1 := &wrapperspb.StringValue{Value: "abcd"}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m1)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- m2 := &knownpb.Any{
+ m2 := &anypb.Any{
TypeUrl: "google.protobuf.StringValue",
Value: b,
}
@@ -2403,7 +2409,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "pb2.KnownTypes",
Value: bytes.Replace(b, []byte("abcd"), []byte("abc\xff"), -1),
}
@@ -2412,7 +2418,7 @@
}, {
desc: "well known types as field values",
umo: protojson.UnmarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Empty{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&emptypb.Empty{})),
},
inputMessage: &pb2.KnownTypes{},
inputText: `{
@@ -2445,46 +2451,46 @@
"optFieldmask": "fooBar,barFoo"
}`,
wantMessage: &pb2.KnownTypes{
- OptBool: &knownpb.BoolValue{Value: false},
- OptInt32: &knownpb.Int32Value{Value: 42},
- OptInt64: &knownpb.Int64Value{Value: 42},
- OptUint32: &knownpb.UInt32Value{Value: 42},
- OptUint64: &knownpb.UInt64Value{Value: 42},
- OptFloat: &knownpb.FloatValue{Value: 1.23},
- OptDouble: &knownpb.DoubleValue{Value: 3.1415},
- OptString: &knownpb.StringValue{Value: "hello"},
- OptBytes: &knownpb.BytesValue{Value: []byte("hello")},
- OptDuration: &knownpb.Duration{Seconds: 123},
- OptTimestamp: &knownpb.Timestamp{Seconds: 1553036601},
- OptStruct: &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "string": {Kind: &knownpb.Value_StringValue{"hello"}},
+ OptBool: &wrapperspb.BoolValue{Value: false},
+ OptInt32: &wrapperspb.Int32Value{Value: 42},
+ OptInt64: &wrapperspb.Int64Value{Value: 42},
+ OptUint32: &wrapperspb.UInt32Value{Value: 42},
+ OptUint64: &wrapperspb.UInt64Value{Value: 42},
+ OptFloat: &wrapperspb.FloatValue{Value: 1.23},
+ OptDouble: &wrapperspb.DoubleValue{Value: 3.1415},
+ OptString: &wrapperspb.StringValue{Value: "hello"},
+ OptBytes: &wrapperspb.BytesValue{Value: []byte("hello")},
+ OptDuration: &durationpb.Duration{Seconds: 123},
+ OptTimestamp: ×tamppb.Timestamp{Seconds: 1553036601},
+ OptStruct: &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "string": {Kind: &structpb.Value_StringValue{"hello"}},
},
},
- OptList: &knownpb.ListValue{
- Values: []*knownpb.Value{
- {Kind: &knownpb.Value_NullValue{}},
- {Kind: &knownpb.Value_StringValue{}},
+ OptList: &structpb.ListValue{
+ Values: []*structpb.Value{
+ {Kind: &structpb.Value_NullValue{}},
+ {Kind: &structpb.Value_StringValue{}},
{
- Kind: &knownpb.Value_StructValue{
- &knownpb.Struct{Fields: map[string]*knownpb.Value{}},
+ Kind: &structpb.Value_StructValue{
+ &structpb.Struct{Fields: map[string]*structpb.Value{}},
},
},
{
- Kind: &knownpb.Value_ListValue{
- &knownpb.ListValue{Values: []*knownpb.Value{}},
+ Kind: &structpb.Value_ListValue{
+ &structpb.ListValue{Values: []*structpb.Value{}},
},
},
},
},
- OptValue: &knownpb.Value{
- Kind: &knownpb.Value_StringValue{"world"},
+ OptValue: &structpb.Value{
+ Kind: &structpb.Value_StringValue{"world"},
},
- OptEmpty: &knownpb.Empty{},
- OptAny: &knownpb.Any{
+ OptEmpty: &emptypb.Empty{},
+ OptAny: &anypb.Any{
TypeUrl: "google.protobuf.Empty",
},
- OptFieldmask: &knownpb.FieldMask{
+ OptFieldmask: &fieldmaskpb.FieldMask{
Paths: []string{"foo_bar", "bar_foo"},
},
},
@@ -2551,44 +2557,44 @@
}, {
desc: "DiscardUnknown: Empty",
umo: protojson.UnmarshalOptions{DiscardUnknown: true},
- inputMessage: &knownpb.Empty{},
+ inputMessage: &emptypb.Empty{},
inputText: `{"unknown": "something"}`,
- wantMessage: &knownpb.Empty{},
+ wantMessage: &emptypb.Empty{},
}, {
desc: "DiscardUnknown: Any without type",
umo: protojson.UnmarshalOptions{DiscardUnknown: true},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"value": {"foo": "bar"},
"unknown": true
}`,
- wantMessage: &knownpb.Any{},
+ wantMessage: &anypb.Any{},
}, {
desc: "DiscardUnknown: Any",
umo: protojson.UnmarshalOptions{
DiscardUnknown: true,
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "foo/pb2.Nested",
"unknown": "none"
}`,
- wantMessage: &knownpb.Any{
+ wantMessage: &anypb.Any{
TypeUrl: "foo/pb2.Nested",
},
}, {
desc: "DiscardUnknown: Any with Empty",
umo: protojson.UnmarshalOptions{
DiscardUnknown: true,
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Empty{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&emptypb.Empty{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `{
"@type": "type.googleapis.com/google.protobuf.Empty",
"value": {"unknown": 47}
}`,
- wantMessage: &knownpb.Any{
+ wantMessage: &anypb.Any{
TypeUrl: "type.googleapis.com/google.protobuf.Empty",
},
}}
diff --git a/encoding/protojson/encode_test.go b/encoding/protojson/encode_test.go
index c652118..3483aed 100644
--- a/encoding/protojson/encode_test.go
+++ b/encoding/protojson/encode_test.go
@@ -24,7 +24,13 @@
"google.golang.org/protobuf/encoding/testprotos/pb2"
"google.golang.org/protobuf/encoding/testprotos/pb3"
- knownpb "google.golang.org/protobuf/types/known"
+ "google.golang.org/protobuf/types/known/anypb"
+ "google.golang.org/protobuf/types/known/durationpb"
+ "google.golang.org/protobuf/types/known/emptypb"
+ "google.golang.org/protobuf/types/known/fieldmaskpb"
+ "google.golang.org/protobuf/types/known/structpb"
+ "google.golang.org/protobuf/types/known/timestamppb"
+ "google.golang.org/protobuf/types/known/wrapperspb"
)
// splitLines is a cmpopts.Option for comparing strings with line breaks.
@@ -1105,125 +1111,125 @@
}`,
}, {
desc: "BoolValue empty",
- input: &knownpb.BoolValue{},
+ input: &wrapperspb.BoolValue{},
want: `false`,
}, {
desc: "BoolValue",
- input: &knownpb.BoolValue{Value: true},
+ input: &wrapperspb.BoolValue{Value: true},
want: `true`,
}, {
desc: "Int32Value empty",
- input: &knownpb.Int32Value{},
+ input: &wrapperspb.Int32Value{},
want: `0`,
}, {
desc: "Int32Value",
- input: &knownpb.Int32Value{Value: 42},
+ input: &wrapperspb.Int32Value{Value: 42},
want: `42`,
}, {
desc: "Int64Value",
- input: &knownpb.Int64Value{Value: 42},
+ input: &wrapperspb.Int64Value{Value: 42},
want: `"42"`,
}, {
desc: "UInt32Value",
- input: &knownpb.UInt32Value{Value: 42},
+ input: &wrapperspb.UInt32Value{Value: 42},
want: `42`,
}, {
desc: "UInt64Value",
- input: &knownpb.UInt64Value{Value: 42},
+ input: &wrapperspb.UInt64Value{Value: 42},
want: `"42"`,
}, {
desc: "FloatValue",
- input: &knownpb.FloatValue{Value: 1.02},
+ input: &wrapperspb.FloatValue{Value: 1.02},
want: `1.02`,
}, {
desc: "FloatValue Infinity",
- input: &knownpb.FloatValue{Value: float32(math.Inf(-1))},
+ input: &wrapperspb.FloatValue{Value: float32(math.Inf(-1))},
want: `"-Infinity"`,
}, {
desc: "DoubleValue",
- input: &knownpb.DoubleValue{Value: 1.02},
+ input: &wrapperspb.DoubleValue{Value: 1.02},
want: `1.02`,
}, {
desc: "DoubleValue NaN",
- input: &knownpb.DoubleValue{Value: math.NaN()},
+ input: &wrapperspb.DoubleValue{Value: math.NaN()},
want: `"NaN"`,
}, {
desc: "StringValue empty",
- input: &knownpb.StringValue{},
+ input: &wrapperspb.StringValue{},
want: `""`,
}, {
desc: "StringValue",
- input: &knownpb.StringValue{Value: "谷歌"},
+ input: &wrapperspb.StringValue{Value: "谷歌"},
want: `"谷歌"`,
}, {
desc: "StringValue with invalid UTF8 error",
- input: &knownpb.StringValue{Value: "abc\xff"},
+ input: &wrapperspb.StringValue{Value: "abc\xff"},
want: "\"abc\xff\"",
wantErr: true,
}, {
desc: "StringValue field with invalid UTF8 error",
input: &pb2.KnownTypes{
- OptString: &knownpb.StringValue{Value: "abc\xff"},
+ OptString: &wrapperspb.StringValue{Value: "abc\xff"},
},
want: "{\n \"optString\": \"abc\xff\"\n}",
wantErr: true,
}, {
desc: "BytesValue",
- input: &knownpb.BytesValue{Value: []byte("hello")},
+ input: &wrapperspb.BytesValue{Value: []byte("hello")},
want: `"aGVsbG8="`,
}, {
desc: "Empty",
- input: &knownpb.Empty{},
+ input: &emptypb.Empty{},
want: `{}`,
}, {
desc: "NullValue field",
- input: &pb2.KnownTypes{OptNull: new(knownpb.NullValue)},
+ input: &pb2.KnownTypes{OptNull: new(structpb.NullValue)},
want: `{
"optNull": null
}`,
}, {
desc: "Value empty",
- input: &knownpb.Value{},
+ input: &structpb.Value{},
wantErr: true,
}, {
desc: "Value empty field",
input: &pb2.KnownTypes{
- OptValue: &knownpb.Value{},
+ OptValue: &structpb.Value{},
},
wantErr: true,
}, {
desc: "Value contains NullValue",
- input: &knownpb.Value{Kind: &knownpb.Value_NullValue{}},
+ input: &structpb.Value{Kind: &structpb.Value_NullValue{}},
want: `null`,
}, {
desc: "Value contains BoolValue",
- input: &knownpb.Value{Kind: &knownpb.Value_BoolValue{}},
+ input: &structpb.Value{Kind: &structpb.Value_BoolValue{}},
want: `false`,
}, {
desc: "Value contains NumberValue",
- input: &knownpb.Value{Kind: &knownpb.Value_NumberValue{1.02}},
+ input: &structpb.Value{Kind: &structpb.Value_NumberValue{1.02}},
want: `1.02`,
}, {
desc: "Value contains StringValue",
- input: &knownpb.Value{Kind: &knownpb.Value_StringValue{"hello"}},
+ input: &structpb.Value{Kind: &structpb.Value_StringValue{"hello"}},
want: `"hello"`,
}, {
desc: "Value contains StringValue with invalid UTF8",
- input: &knownpb.Value{Kind: &knownpb.Value_StringValue{"\xff"}},
+ input: &structpb.Value{Kind: &structpb.Value_StringValue{"\xff"}},
want: "\"\xff\"",
wantErr: true,
}, {
desc: "Value contains Struct",
- input: &knownpb.Value{
- Kind: &knownpb.Value_StructValue{
- &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "null": {Kind: &knownpb.Value_NullValue{}},
- "number": {Kind: &knownpb.Value_NumberValue{}},
- "string": {Kind: &knownpb.Value_StringValue{}},
- "struct": {Kind: &knownpb.Value_StructValue{}},
- "list": {Kind: &knownpb.Value_ListValue{}},
- "bool": {Kind: &knownpb.Value_BoolValue{}},
+ input: &structpb.Value{
+ Kind: &structpb.Value_StructValue{
+ &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "null": {Kind: &structpb.Value_NullValue{}},
+ "number": {Kind: &structpb.Value_NumberValue{}},
+ "string": {Kind: &structpb.Value_StringValue{}},
+ "struct": {Kind: &structpb.Value_StructValue{}},
+ "list": {Kind: &structpb.Value_ListValue{}},
+ "bool": {Kind: &structpb.Value_BoolValue{}},
},
},
},
@@ -1238,16 +1244,16 @@
}`,
}, {
desc: "Value contains ListValue",
- input: &knownpb.Value{
- Kind: &knownpb.Value_ListValue{
- &knownpb.ListValue{
- Values: []*knownpb.Value{
- {Kind: &knownpb.Value_BoolValue{}},
- {Kind: &knownpb.Value_NullValue{}},
- {Kind: &knownpb.Value_NumberValue{}},
- {Kind: &knownpb.Value_StringValue{}},
- {Kind: &knownpb.Value_StructValue{}},
- {Kind: &knownpb.Value_ListValue{}},
+ input: &structpb.Value{
+ Kind: &structpb.Value_ListValue{
+ &structpb.ListValue{
+ Values: []*structpb.Value{
+ {Kind: &structpb.Value_BoolValue{}},
+ {Kind: &structpb.Value_NullValue{}},
+ {Kind: &structpb.Value_NumberValue{}},
+ {Kind: &structpb.Value_StringValue{}},
+ {Kind: &structpb.Value_StructValue{}},
+ {Kind: &structpb.Value_ListValue{}},
},
},
},
@@ -1262,38 +1268,38 @@
]`,
}, {
desc: "Struct with nil map",
- input: &knownpb.Struct{},
+ input: &structpb.Struct{},
want: `{}`,
}, {
desc: "Struct with empty map",
- input: &knownpb.Struct{
- Fields: map[string]*knownpb.Value{},
+ input: &structpb.Struct{
+ Fields: map[string]*structpb.Value{},
},
want: `{}`,
}, {
desc: "Struct",
- input: &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "bool": {Kind: &knownpb.Value_BoolValue{true}},
- "null": {Kind: &knownpb.Value_NullValue{}},
- "number": {Kind: &knownpb.Value_NumberValue{3.1415}},
- "string": {Kind: &knownpb.Value_StringValue{"hello"}},
+ input: &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "bool": {Kind: &structpb.Value_BoolValue{true}},
+ "null": {Kind: &structpb.Value_NullValue{}},
+ "number": {Kind: &structpb.Value_NumberValue{3.1415}},
+ "string": {Kind: &structpb.Value_StringValue{"hello"}},
"struct": {
- Kind: &knownpb.Value_StructValue{
- &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "string": {Kind: &knownpb.Value_StringValue{"world"}},
+ Kind: &structpb.Value_StructValue{
+ &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "string": {Kind: &structpb.Value_StringValue{"world"}},
},
},
},
},
"list": {
- Kind: &knownpb.Value_ListValue{
- &knownpb.ListValue{
- Values: []*knownpb.Value{
- {Kind: &knownpb.Value_BoolValue{}},
- {Kind: &knownpb.Value_NullValue{}},
- {Kind: &knownpb.Value_NumberValue{}},
+ Kind: &structpb.Value_ListValue{
+ &structpb.ListValue{
+ Values: []*structpb.Value{
+ {Kind: &structpb.Value_BoolValue{}},
+ {Kind: &structpb.Value_NullValue{}},
+ {Kind: &structpb.Value_NumberValue{}},
},
},
},
@@ -1316,47 +1322,47 @@
}`,
}, {
desc: "Struct message with invalid UTF8 string",
- input: &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "string": {Kind: &knownpb.Value_StringValue{"\xff"}},
+ input: &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "string": {Kind: &structpb.Value_StringValue{"\xff"}},
},
},
want: "{\n \"string\": \"\xff\"\n}",
wantErr: true,
}, {
desc: "ListValue with nil values",
- input: &knownpb.ListValue{},
+ input: &structpb.ListValue{},
want: `[]`,
}, {
desc: "ListValue with empty values",
- input: &knownpb.ListValue{
- Values: []*knownpb.Value{},
+ input: &structpb.ListValue{
+ Values: []*structpb.Value{},
},
want: `[]`,
}, {
desc: "ListValue",
- input: &knownpb.ListValue{
- Values: []*knownpb.Value{
- {Kind: &knownpb.Value_BoolValue{true}},
- {Kind: &knownpb.Value_NullValue{}},
- {Kind: &knownpb.Value_NumberValue{3.1415}},
- {Kind: &knownpb.Value_StringValue{"hello"}},
+ input: &structpb.ListValue{
+ Values: []*structpb.Value{
+ {Kind: &structpb.Value_BoolValue{true}},
+ {Kind: &structpb.Value_NullValue{}},
+ {Kind: &structpb.Value_NumberValue{3.1415}},
+ {Kind: &structpb.Value_StringValue{"hello"}},
{
- Kind: &knownpb.Value_ListValue{
- &knownpb.ListValue{
- Values: []*knownpb.Value{
- {Kind: &knownpb.Value_BoolValue{}},
- {Kind: &knownpb.Value_NullValue{}},
- {Kind: &knownpb.Value_NumberValue{}},
+ Kind: &structpb.Value_ListValue{
+ &structpb.ListValue{
+ Values: []*structpb.Value{
+ {Kind: &structpb.Value_BoolValue{}},
+ {Kind: &structpb.Value_NullValue{}},
+ {Kind: &structpb.Value_NumberValue{}},
},
},
},
},
{
- Kind: &knownpb.Value_StructValue{
- &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "string": {Kind: &knownpb.Value_StringValue{"world"}},
+ Kind: &structpb.Value_StructValue{
+ &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "string": {Kind: &structpb.Value_StringValue{"world"}},
},
},
},
@@ -1379,132 +1385,132 @@
]`,
}, {
desc: "ListValue with invalid UTF8 string",
- input: &knownpb.ListValue{
- Values: []*knownpb.Value{
- {Kind: &knownpb.Value_StringValue{"\xff"}},
+ input: &structpb.ListValue{
+ Values: []*structpb.Value{
+ {Kind: &structpb.Value_StringValue{"\xff"}},
},
},
want: "[\n \"\xff\"\n]",
wantErr: true,
}, {
desc: "Duration empty",
- input: &knownpb.Duration{},
+ input: &durationpb.Duration{},
want: `"0s"`,
}, {
desc: "Duration with secs",
- input: &knownpb.Duration{Seconds: 3},
+ input: &durationpb.Duration{Seconds: 3},
want: `"3s"`,
}, {
desc: "Duration with -secs",
- input: &knownpb.Duration{Seconds: -3},
+ input: &durationpb.Duration{Seconds: -3},
want: `"-3s"`,
}, {
desc: "Duration with nanos",
- input: &knownpb.Duration{Nanos: 1e6},
+ input: &durationpb.Duration{Nanos: 1e6},
want: `"0.001s"`,
}, {
desc: "Duration with -nanos",
- input: &knownpb.Duration{Nanos: -1e6},
+ input: &durationpb.Duration{Nanos: -1e6},
want: `"-0.001s"`,
}, {
desc: "Duration with large secs",
- input: &knownpb.Duration{Seconds: 1e10, Nanos: 1},
+ input: &durationpb.Duration{Seconds: 1e10, Nanos: 1},
want: `"10000000000.000000001s"`,
}, {
desc: "Duration with 6-digit nanos",
- input: &knownpb.Duration{Nanos: 1e4},
+ input: &durationpb.Duration{Nanos: 1e4},
want: `"0.000010s"`,
}, {
desc: "Duration with 3-digit nanos",
- input: &knownpb.Duration{Nanos: 1e6},
+ input: &durationpb.Duration{Nanos: 1e6},
want: `"0.001s"`,
}, {
desc: "Duration with -secs -nanos",
- input: &knownpb.Duration{Seconds: -123, Nanos: -450},
+ input: &durationpb.Duration{Seconds: -123, Nanos: -450},
want: `"-123.000000450s"`,
}, {
desc: "Duration max value",
- input: &knownpb.Duration{Seconds: 315576000000, Nanos: 999999999},
+ input: &durationpb.Duration{Seconds: 315576000000, Nanos: 999999999},
want: `"315576000000.999999999s"`,
}, {
desc: "Duration min value",
- input: &knownpb.Duration{Seconds: -315576000000, Nanos: -999999999},
+ input: &durationpb.Duration{Seconds: -315576000000, Nanos: -999999999},
want: `"-315576000000.999999999s"`,
}, {
desc: "Duration with +secs -nanos",
- input: &knownpb.Duration{Seconds: 1, Nanos: -1},
+ input: &durationpb.Duration{Seconds: 1, Nanos: -1},
wantErr: true,
}, {
desc: "Duration with -secs +nanos",
- input: &knownpb.Duration{Seconds: -1, Nanos: 1},
+ input: &durationpb.Duration{Seconds: -1, Nanos: 1},
wantErr: true,
}, {
desc: "Duration with +secs out of range",
- input: &knownpb.Duration{Seconds: 315576000001},
+ input: &durationpb.Duration{Seconds: 315576000001},
wantErr: true,
}, {
desc: "Duration with -secs out of range",
- input: &knownpb.Duration{Seconds: -315576000001},
+ input: &durationpb.Duration{Seconds: -315576000001},
wantErr: true,
}, {
desc: "Duration with +nanos out of range",
- input: &knownpb.Duration{Seconds: 0, Nanos: 1e9},
+ input: &durationpb.Duration{Seconds: 0, Nanos: 1e9},
wantErr: true,
}, {
desc: "Duration with -nanos out of range",
- input: &knownpb.Duration{Seconds: 0, Nanos: -1e9},
+ input: &durationpb.Duration{Seconds: 0, Nanos: -1e9},
wantErr: true,
}, {
desc: "Timestamp zero",
- input: &knownpb.Timestamp{},
+ input: ×tamppb.Timestamp{},
want: `"1970-01-01T00:00:00Z"`,
}, {
desc: "Timestamp",
- input: &knownpb.Timestamp{Seconds: 1553036601},
+ input: ×tamppb.Timestamp{Seconds: 1553036601},
want: `"2019-03-19T23:03:21Z"`,
}, {
desc: "Timestamp with nanos",
- input: &knownpb.Timestamp{Seconds: 1553036601, Nanos: 1},
+ input: ×tamppb.Timestamp{Seconds: 1553036601, Nanos: 1},
want: `"2019-03-19T23:03:21.000000001Z"`,
}, {
desc: "Timestamp with 6-digit nanos",
- input: &knownpb.Timestamp{Nanos: 1e3},
+ input: ×tamppb.Timestamp{Nanos: 1e3},
want: `"1970-01-01T00:00:00.000001Z"`,
}, {
desc: "Timestamp with 3-digit nanos",
- input: &knownpb.Timestamp{Nanos: 1e7},
+ input: ×tamppb.Timestamp{Nanos: 1e7},
want: `"1970-01-01T00:00:00.010Z"`,
}, {
desc: "Timestamp max value",
- input: &knownpb.Timestamp{Seconds: 253402300799, Nanos: 999999999},
+ input: ×tamppb.Timestamp{Seconds: 253402300799, Nanos: 999999999},
want: `"9999-12-31T23:59:59.999999999Z"`,
}, {
desc: "Timestamp min value",
- input: &knownpb.Timestamp{Seconds: -62135596800},
+ input: ×tamppb.Timestamp{Seconds: -62135596800},
want: `"0001-01-01T00:00:00Z"`,
}, {
desc: "Timestamp with +secs out of range",
- input: &knownpb.Timestamp{Seconds: 253402300800},
+ input: ×tamppb.Timestamp{Seconds: 253402300800},
wantErr: true,
}, {
desc: "Timestamp with -secs out of range",
- input: &knownpb.Timestamp{Seconds: -62135596801},
+ input: ×tamppb.Timestamp{Seconds: -62135596801},
wantErr: true,
}, {
desc: "Timestamp with -nanos",
- input: &knownpb.Timestamp{Nanos: -1},
+ input: ×tamppb.Timestamp{Nanos: -1},
wantErr: true,
}, {
desc: "Timestamp with +nanos out of range",
- input: &knownpb.Timestamp{Nanos: 1e9},
+ input: ×tamppb.Timestamp{Nanos: 1e9},
wantErr: true,
}, {
desc: "FieldMask empty",
- input: &knownpb.FieldMask{},
+ input: &fieldmaskpb.FieldMask{},
want: `""`,
}, {
desc: "FieldMask",
- input: &knownpb.FieldMask{
+ input: &fieldmaskpb.FieldMask{
Paths: []string{
"foo",
"foo_bar",
@@ -1515,19 +1521,19 @@
want: `"foo,fooBar,foo.barQux,Foo"`,
}, {
desc: "FieldMask error 1",
- input: &knownpb.FieldMask{
+ input: &fieldmaskpb.FieldMask{
Paths: []string{"foo_"},
},
wantErr: true,
}, {
desc: "FieldMask error 2",
- input: &knownpb.FieldMask{
+ input: &fieldmaskpb.FieldMask{
Paths: []string{"foo__bar"},
},
wantErr: true,
}, {
desc: "Any empty",
- input: &knownpb.Any{},
+ input: &anypb.Any{},
want: `{}`,
}, {
desc: "Any with non-custom message",
@@ -1545,7 +1551,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "foo/pb2.Nested",
Value: b,
}
@@ -1562,14 +1568,14 @@
mo: protojson.MarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
},
- input: &knownpb.Any{TypeUrl: "foo/pb2.Nested"},
+ input: &anypb.Any{TypeUrl: "foo/pb2.Nested"},
want: `{
"@type": "foo/pb2.Nested"
}`,
}, {
desc: "Any without registered type",
mo: protojson.MarshalOptions{Resolver: preg.NewTypes()},
- input: &knownpb.Any{TypeUrl: "foo/pb2.Nested"},
+ input: &anypb.Any{TypeUrl: "foo/pb2.Nested"},
wantErr: true,
}, {
desc: "Any with missing required error",
@@ -1587,7 +1593,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: string(m.ProtoReflect().Descriptor().FullName()),
Value: b,
}
@@ -1614,7 +1620,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: string(m.ProtoReflect().Descriptor().FullName()),
Value: b,
}
@@ -1636,7 +1642,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "foo/pb2.Nested",
Value: b,
}
@@ -1651,7 +1657,7 @@
mo: protojson.MarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
},
- input: &knownpb.Any{
+ input: &anypb.Any{
TypeUrl: "foo/pb2.Nested",
Value: dhex("80"),
},
@@ -1659,15 +1665,15 @@
}, {
desc: "Any with BoolValue",
mo: protojson.MarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.BoolValue{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&wrapperspb.BoolValue{})),
},
input: func() proto.Message {
- m := &knownpb.BoolValue{Value: true}
+ m := &wrapperspb.BoolValue{Value: true}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "type.googleapis.com/google.protobuf.BoolValue",
Value: b,
}
@@ -1679,15 +1685,15 @@
}, {
desc: "Any with Empty",
mo: protojson.MarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Empty{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&emptypb.Empty{})),
},
input: func() proto.Message {
- m := &knownpb.Empty{}
+ m := &emptypb.Empty{}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "type.googleapis.com/google.protobuf.Empty",
Value: b,
}
@@ -1699,15 +1705,15 @@
}, {
desc: "Any with StringValue containing invalid UTF8",
mo: protojson.MarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.StringValue{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&wrapperspb.StringValue{})),
},
input: func() proto.Message {
- m := &knownpb.StringValue{Value: "abcd"}
+ m := &wrapperspb.StringValue{Value: "abcd"}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "google.protobuf.StringValue",
Value: bytes.Replace(b, []byte("abcd"), []byte("abc\xff"), -1),
}
@@ -1720,15 +1726,15 @@
}, {
desc: "Any with Int64Value",
mo: protojson.MarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Int64Value{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&wrapperspb.Int64Value{})),
},
input: func() proto.Message {
- m := &knownpb.Int64Value{Value: 42}
+ m := &wrapperspb.Int64Value{Value: 42}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "google.protobuf.Int64Value",
Value: b,
}
@@ -1740,15 +1746,15 @@
}, {
desc: "Any with Duration",
mo: protojson.MarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Duration{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&durationpb.Duration{})),
},
input: func() proto.Message {
- m := &knownpb.Duration{}
+ m := &durationpb.Duration{}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "type.googleapis.com/google.protobuf.Duration",
Value: b,
}
@@ -1760,15 +1766,15 @@
}, {
desc: "Any with empty Value",
mo: protojson.MarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Value{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&structpb.Value{})),
},
input: func() proto.Message {
- m := &knownpb.Value{}
+ m := &structpb.Value{}
b, err := proto.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "type.googleapis.com/google.protobuf.Value",
Value: b,
}
@@ -1777,15 +1783,15 @@
}, {
desc: "Any with Value of StringValue",
mo: protojson.MarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Value{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&structpb.Value{})),
},
input: func() proto.Message {
- m := &knownpb.Value{Kind: &knownpb.Value_StringValue{"abcd"}}
+ m := &structpb.Value{Kind: &structpb.Value_StringValue{"abcd"}}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "type.googleapis.com/google.protobuf.Value",
Value: bytes.Replace(b, []byte("abcd"), []byte("abc\xff"), -1),
}
@@ -1798,15 +1804,15 @@
}, {
desc: "Any with Value of NullValue",
mo: protojson.MarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Value{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&structpb.Value{})),
},
input: func() proto.Message {
- m := &knownpb.Value{Kind: &knownpb.Value_NullValue{}}
+ m := &structpb.Value{Kind: &structpb.Value_NullValue{}}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "type.googleapis.com/google.protobuf.Value",
Value: b,
}
@@ -1819,24 +1825,24 @@
desc: "Any with Struct",
mo: protojson.MarshalOptions{
Resolver: preg.NewTypes(
- pimpl.Export{}.MessageTypeOf(&knownpb.Struct{}),
- pimpl.Export{}.MessageTypeOf(&knownpb.Value{}),
- pimpl.Export{}.MessageTypeOf(&knownpb.BoolValue{}),
- pimpl.Export{}.EnumTypeOf(knownpb.NullValue_NULL_VALUE),
- pimpl.Export{}.MessageTypeOf(&knownpb.StringValue{}),
+ pimpl.Export{}.MessageTypeOf(&structpb.Struct{}),
+ pimpl.Export{}.MessageTypeOf(&structpb.Value{}),
+ pimpl.Export{}.MessageTypeOf(&wrapperspb.BoolValue{}),
+ pimpl.Export{}.EnumTypeOf(structpb.NullValue_NULL_VALUE),
+ pimpl.Export{}.MessageTypeOf(&wrapperspb.StringValue{}),
),
},
input: func() proto.Message {
- m := &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "bool": {Kind: &knownpb.Value_BoolValue{true}},
- "null": {Kind: &knownpb.Value_NullValue{}},
- "string": {Kind: &knownpb.Value_StringValue{"hello"}},
+ m := &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "bool": {Kind: &structpb.Value_BoolValue{true}},
+ "null": {Kind: &structpb.Value_NullValue{}},
+ "string": {Kind: &structpb.Value_StringValue{"hello"}},
"struct": {
- Kind: &knownpb.Value_StructValue{
- &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "string": {Kind: &knownpb.Value_StringValue{"world"}},
+ Kind: &structpb.Value_StructValue{
+ &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "string": {Kind: &structpb.Value_StringValue{"world"}},
},
},
},
@@ -1847,7 +1853,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "google.protobuf.Struct",
Value: b,
}
@@ -1866,15 +1872,15 @@
}, {
desc: "Any with missing type_url",
mo: protojson.MarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.BoolValue{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&wrapperspb.BoolValue{})),
},
input: func() proto.Message {
- m := &knownpb.BoolValue{Value: true}
+ m := &wrapperspb.BoolValue{Value: true}
b, err := proto.MarshalOptions{Deterministic: true}.Marshal(m)
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
Value: b,
}
}(),
@@ -1882,41 +1888,41 @@
}, {
desc: "well known types as field values",
mo: protojson.MarshalOptions{
- Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&knownpb.Empty{})),
+ Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&emptypb.Empty{})),
},
input: &pb2.KnownTypes{
- OptBool: &knownpb.BoolValue{Value: false},
- OptInt32: &knownpb.Int32Value{Value: 42},
- OptInt64: &knownpb.Int64Value{Value: 42},
- OptUint32: &knownpb.UInt32Value{Value: 42},
- OptUint64: &knownpb.UInt64Value{Value: 42},
- OptFloat: &knownpb.FloatValue{Value: 1.23},
- OptDouble: &knownpb.DoubleValue{Value: 3.1415},
- OptString: &knownpb.StringValue{Value: "hello"},
- OptBytes: &knownpb.BytesValue{Value: []byte("hello")},
- OptDuration: &knownpb.Duration{Seconds: 123},
- OptTimestamp: &knownpb.Timestamp{Seconds: 1553036601},
- OptStruct: &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "string": {Kind: &knownpb.Value_StringValue{"hello"}},
+ OptBool: &wrapperspb.BoolValue{Value: false},
+ OptInt32: &wrapperspb.Int32Value{Value: 42},
+ OptInt64: &wrapperspb.Int64Value{Value: 42},
+ OptUint32: &wrapperspb.UInt32Value{Value: 42},
+ OptUint64: &wrapperspb.UInt64Value{Value: 42},
+ OptFloat: &wrapperspb.FloatValue{Value: 1.23},
+ OptDouble: &wrapperspb.DoubleValue{Value: 3.1415},
+ OptString: &wrapperspb.StringValue{Value: "hello"},
+ OptBytes: &wrapperspb.BytesValue{Value: []byte("hello")},
+ OptDuration: &durationpb.Duration{Seconds: 123},
+ OptTimestamp: ×tamppb.Timestamp{Seconds: 1553036601},
+ OptStruct: &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "string": {Kind: &structpb.Value_StringValue{"hello"}},
},
},
- OptList: &knownpb.ListValue{
- Values: []*knownpb.Value{
- {Kind: &knownpb.Value_NullValue{}},
- {Kind: &knownpb.Value_StringValue{}},
- {Kind: &knownpb.Value_StructValue{}},
- {Kind: &knownpb.Value_ListValue{}},
+ OptList: &structpb.ListValue{
+ Values: []*structpb.Value{
+ {Kind: &structpb.Value_NullValue{}},
+ {Kind: &structpb.Value_StringValue{}},
+ {Kind: &structpb.Value_StructValue{}},
+ {Kind: &structpb.Value_ListValue{}},
},
},
- OptValue: &knownpb.Value{
- Kind: &knownpb.Value_StringValue{"world"},
+ OptValue: &structpb.Value{
+ Kind: &structpb.Value_StringValue{"world"},
},
- OptEmpty: &knownpb.Empty{},
- OptAny: &knownpb.Any{
+ OptEmpty: &emptypb.Empty{},
+ OptAny: &anypb.Any{
TypeUrl: "google.protobuf.Empty",
},
- OptFieldmask: &knownpb.FieldMask{
+ OptFieldmask: &fieldmaskpb.FieldMask{
Paths: []string{"foo_bar", "bar_foo"},
},
},
diff --git a/encoding/prototext/decode_test.go b/encoding/prototext/decode_test.go
index 20fcc94..39d470a 100644
--- a/encoding/prototext/decode_test.go
+++ b/encoding/prototext/decode_test.go
@@ -18,7 +18,7 @@
"google.golang.org/protobuf/encoding/testprotos/pb2"
"google.golang.org/protobuf/encoding/testprotos/pb3"
- knownpb "google.golang.org/protobuf/types/known"
+ "google.golang.org/protobuf/types/known/anypb"
)
func TestUnmarshal(t *testing.T) {
@@ -1365,27 +1365,27 @@
}(),
}, {
desc: "Any not expanded",
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `
type_url: "pb2.Nested"
value: "some bytes"
`,
- wantMessage: &knownpb.Any{
+ wantMessage: &anypb.Any{
TypeUrl: "pb2.Nested",
Value: []byte("some bytes"),
},
}, {
desc: "Any not expanded missing value",
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `type_url: "pb2.Nested"`,
- wantMessage: &knownpb.Any{
+ wantMessage: &anypb.Any{
TypeUrl: "pb2.Nested",
},
}, {
desc: "Any not expanded missing type_url",
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `value: "some bytes"`,
- wantMessage: &knownpb.Any{
+ wantMessage: &anypb.Any{
Value: []byte("some bytes"),
},
}, {
@@ -1393,7 +1393,7 @@
umo: prototext.UnmarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `
[foobar/pb2.Nested]: {
opt_string: "embedded inside Any"
@@ -1413,7 +1413,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "foobar/pb2.Nested",
Value: b,
}
@@ -1423,9 +1423,9 @@
umo: prototext.UnmarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `[foo.com/pb2.Nested]: {}`,
- wantMessage: &knownpb.Any{
+ wantMessage: &anypb.Any{
TypeUrl: "foo.com/pb2.Nested",
},
}, {
@@ -1433,7 +1433,7 @@
umo: prototext.UnmarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.PartialRequired{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `
[pb2.PartialRequired]: {
opt_string: "embedded inside Any"
@@ -1450,7 +1450,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "pb2.PartialRequired",
Value: b,
}
@@ -1461,7 +1461,7 @@
umo: prototext.UnmarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb3.Nested{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `
[pb3.Nested]: {
s_string: "abc\xff"
@@ -1476,7 +1476,7 @@
if !nerr.Merge(err) {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: string(m.ProtoReflect().Descriptor().FullName()),
Value: b,
}
@@ -1485,7 +1485,7 @@
}, {
desc: "Any expanded with unregistered type",
umo: prototext.UnmarshalOptions{Resolver: preg.NewTypes()},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `[SomeMessage]: {}`,
wantErr: true,
}, {
@@ -1493,7 +1493,7 @@
umo: prototext.UnmarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `[pb2.Nested]: 123`,
wantErr: true,
}, {
@@ -1501,7 +1501,7 @@
umo: prototext.UnmarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `
[pb2.Nested]: {}
unknown: ""
@@ -1512,7 +1512,7 @@
umo: prototext.UnmarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
},
- inputMessage: &knownpb.Any{},
+ inputMessage: &anypb.Any{},
inputText: `
[pb2.Nested]: {}
type_url: "pb2.Nested"
diff --git a/encoding/prototext/encode_test.go b/encoding/prototext/encode_test.go
index b2fc57b..98732bc 100644
--- a/encoding/prototext/encode_test.go
+++ b/encoding/prototext/encode_test.go
@@ -25,7 +25,7 @@
"google.golang.org/protobuf/encoding/testprotos/pb2"
"google.golang.org/protobuf/encoding/testprotos/pb3"
- knownpb "google.golang.org/protobuf/types/known"
+ "google.golang.org/protobuf/types/known/anypb"
)
func init() {
@@ -1181,7 +1181,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "pb2.Nested",
Value: b,
}
@@ -1205,7 +1205,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: "foo/pb2.Nested",
Value: b,
}
@@ -1233,7 +1233,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: string(m.ProtoReflect().Descriptor().FullName()),
Value: b,
}
@@ -1256,7 +1256,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- return &knownpb.Any{
+ return &anypb.Any{
TypeUrl: string(m.ProtoReflect().Descriptor().FullName()),
Value: bytes.Replace(b, []byte("abcd"), []byte("abc\xff"), -1),
}
@@ -1271,7 +1271,7 @@
mo: prototext.MarshalOptions{
Resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
},
- input: &knownpb.Any{
+ input: &anypb.Any{
TypeUrl: "foo/pb2.Nested",
Value: dhex("80"),
},
diff --git a/encoding/prototext/other_test.go b/encoding/prototext/other_test.go
index 8262099..978a358 100644
--- a/encoding/prototext/other_test.go
+++ b/encoding/prototext/other_test.go
@@ -12,7 +12,12 @@
preg "google.golang.org/protobuf/reflect/protoregistry"
"google.golang.org/protobuf/encoding/testprotos/pb2"
- knownpb "google.golang.org/protobuf/types/known"
+ "google.golang.org/protobuf/types/known/anypb"
+ "google.golang.org/protobuf/types/known/durationpb"
+ "google.golang.org/protobuf/types/known/emptypb"
+ "google.golang.org/protobuf/types/known/structpb"
+ "google.golang.org/protobuf/types/known/timestamppb"
+ "google.golang.org/protobuf/types/known/wrapperspb"
)
func TestRoundTrip(t *testing.T) {
@@ -23,62 +28,62 @@
}{{
desc: "well-known type fields set to empty messages",
message: &pb2.KnownTypes{
- OptBool: &knownpb.BoolValue{},
- OptInt32: &knownpb.Int32Value{},
- OptInt64: &knownpb.Int64Value{},
- OptUint32: &knownpb.UInt32Value{},
- OptUint64: &knownpb.UInt64Value{},
- OptFloat: &knownpb.FloatValue{},
- OptDouble: &knownpb.DoubleValue{},
- OptString: &knownpb.StringValue{},
- OptBytes: &knownpb.BytesValue{},
- OptDuration: &knownpb.Duration{},
- OptTimestamp: &knownpb.Timestamp{},
- OptStruct: &knownpb.Struct{},
- OptList: &knownpb.ListValue{},
- OptValue: &knownpb.Value{},
- OptEmpty: &knownpb.Empty{},
- OptAny: &knownpb.Any{},
+ OptBool: &wrapperspb.BoolValue{},
+ OptInt32: &wrapperspb.Int32Value{},
+ OptInt64: &wrapperspb.Int64Value{},
+ OptUint32: &wrapperspb.UInt32Value{},
+ OptUint64: &wrapperspb.UInt64Value{},
+ OptFloat: &wrapperspb.FloatValue{},
+ OptDouble: &wrapperspb.DoubleValue{},
+ OptString: &wrapperspb.StringValue{},
+ OptBytes: &wrapperspb.BytesValue{},
+ OptDuration: &durationpb.Duration{},
+ OptTimestamp: ×tamppb.Timestamp{},
+ OptStruct: &structpb.Struct{},
+ OptList: &structpb.ListValue{},
+ OptValue: &structpb.Value{},
+ OptEmpty: &emptypb.Empty{},
+ OptAny: &anypb.Any{},
},
}, {
desc: "well-known type scalar fields",
message: &pb2.KnownTypes{
- OptBool: &knownpb.BoolValue{
+ OptBool: &wrapperspb.BoolValue{
Value: true,
},
- OptInt32: &knownpb.Int32Value{
+ OptInt32: &wrapperspb.Int32Value{
Value: -42,
},
- OptInt64: &knownpb.Int64Value{
+ OptInt64: &wrapperspb.Int64Value{
Value: -42,
},
- OptUint32: &knownpb.UInt32Value{
+ OptUint32: &wrapperspb.UInt32Value{
Value: 0xff,
},
- OptUint64: &knownpb.UInt64Value{
+ OptUint64: &wrapperspb.UInt64Value{
Value: 0xffff,
},
- OptFloat: &knownpb.FloatValue{
+ OptFloat: &wrapperspb.FloatValue{
Value: 1.234,
},
- OptDouble: &knownpb.DoubleValue{
+ OptDouble: &wrapperspb.DoubleValue{
Value: 1.23e308,
},
- OptString: &knownpb.StringValue{
+ OptString: &wrapperspb.StringValue{
Value: "谷歌",
},
- OptBytes: &knownpb.BytesValue{
+ OptBytes: &wrapperspb.BytesValue{
Value: []byte("\xe8\xb0\xb7\xe6\xad\x8c"),
},
},
}, {
desc: "well-known type time-related fields",
message: &pb2.KnownTypes{
- OptDuration: &knownpb.Duration{
+ OptDuration: &durationpb.Duration{
Seconds: -3600,
Nanos: -123,
},
- OptTimestamp: &knownpb.Timestamp{
+ OptTimestamp: ×tamppb.Timestamp{
Seconds: 1257894000,
Nanos: 123,
},
@@ -86,34 +91,34 @@
}, {
desc: "Struct field and different Value types",
message: &pb2.KnownTypes{
- OptStruct: &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "bool": &knownpb.Value{
- Kind: &knownpb.Value_BoolValue{
+ OptStruct: &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "bool": &structpb.Value{
+ Kind: &structpb.Value_BoolValue{
BoolValue: true,
},
},
- "double": &knownpb.Value{
- Kind: &knownpb.Value_NumberValue{
+ "double": &structpb.Value{
+ Kind: &structpb.Value_NumberValue{
NumberValue: 3.1415,
},
},
- "null": &knownpb.Value{
- Kind: &knownpb.Value_NullValue{
- NullValue: knownpb.NullValue_NULL_VALUE,
+ "null": &structpb.Value{
+ Kind: &structpb.Value_NullValue{
+ NullValue: structpb.NullValue_NULL_VALUE,
},
},
- "string": &knownpb.Value{
- Kind: &knownpb.Value_StringValue{
+ "string": &structpb.Value{
+ Kind: &structpb.Value_StringValue{
StringValue: "string",
},
},
- "struct": &knownpb.Value{
- Kind: &knownpb.Value_StructValue{
- StructValue: &knownpb.Struct{
- Fields: map[string]*knownpb.Value{
- "bool": &knownpb.Value{
- Kind: &knownpb.Value_BoolValue{
+ "struct": &structpb.Value{
+ Kind: &structpb.Value_StructValue{
+ StructValue: &structpb.Struct{
+ Fields: map[string]*structpb.Value{
+ "bool": &structpb.Value{
+ Kind: &structpb.Value_BoolValue{
BoolValue: false,
},
},
@@ -121,17 +126,17 @@
},
},
},
- "list": &knownpb.Value{
- Kind: &knownpb.Value_ListValue{
- ListValue: &knownpb.ListValue{
- Values: []*knownpb.Value{
+ "list": &structpb.Value{
+ Kind: &structpb.Value_ListValue{
+ ListValue: &structpb.ListValue{
+ Values: []*structpb.Value{
{
- Kind: &knownpb.Value_BoolValue{
+ Kind: &structpb.Value_BoolValue{
BoolValue: false,
},
},
{
- Kind: &knownpb.Value_StringValue{
+ Kind: &structpb.Value_StringValue{
StringValue: "hello",
},
},
@@ -157,7 +162,7 @@
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
return &pb2.KnownTypes{
- OptAny: &knownpb.Any{
+ OptAny: &anypb.Any{
TypeUrl: string(m.ProtoReflect().Descriptor().FullName()),
Value: b,
},
@@ -178,7 +183,7 @@
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
return &pb2.KnownTypes{
- OptAny: &knownpb.Any{
+ OptAny: &anypb.Any{
TypeUrl: string(m.ProtoReflect().Descriptor().FullName()),
Value: b,
},
@@ -188,7 +193,7 @@
desc: "Any field containing Any message",
resolver: func() *preg.Types {
mt1 := impl.Export{}.MessageTypeOf(&pb2.Nested{})
- mt2 := impl.Export{}.MessageTypeOf(&knownpb.Any{})
+ mt2 := impl.Export{}.MessageTypeOf(&anypb.Any{})
return preg.NewTypes(mt1, mt2)
}(),
message: func() *pb2.KnownTypes {
@@ -199,7 +204,7 @@
if err != nil {
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
- m2 := &knownpb.Any{
+ m2 := &anypb.Any{
TypeUrl: "pb2.Nested",
Value: b1,
}
@@ -208,7 +213,7 @@
t.Fatalf("error in binary marshaling message for Any.value: %v", err)
}
return &pb2.KnownTypes{
- OptAny: &knownpb.Any{
+ OptAny: &anypb.Any{
TypeUrl: "google.protobuf.Any",
Value: b2,
},
diff --git a/encoding/testprotos/pb2/test.pb.go b/encoding/testprotos/pb2/test.pb.go
index 80f90d0..bc90995 100644
--- a/encoding/testprotos/pb2/test.pb.go
+++ b/encoding/testprotos/pb2/test.pb.go
@@ -8,7 +8,13 @@
protoregistry "google.golang.org/protobuf/reflect/protoregistry"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- known "google.golang.org/protobuf/types/known"
+ anypb "google.golang.org/protobuf/types/known/anypb"
+ durationpb "google.golang.org/protobuf/types/known/durationpb"
+ emptypb "google.golang.org/protobuf/types/known/emptypb"
+ fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+ structpb "google.golang.org/protobuf/types/known/structpb"
+ timestamppb "google.golang.org/protobuf/types/known/timestamppb"
+ wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
sync "sync"
)
@@ -1050,24 +1056,24 @@
// Message contains well-known type fields.
type KnownTypes struct {
- OptBool *known.BoolValue `protobuf:"bytes,1,opt,name=opt_bool,json=optBool" json:"opt_bool,omitempty"`
- OptInt32 *known.Int32Value `protobuf:"bytes,2,opt,name=opt_int32,json=optInt32" json:"opt_int32,omitempty"`
- OptInt64 *known.Int64Value `protobuf:"bytes,3,opt,name=opt_int64,json=optInt64" json:"opt_int64,omitempty"`
- OptUint32 *known.UInt32Value `protobuf:"bytes,4,opt,name=opt_uint32,json=optUint32" json:"opt_uint32,omitempty"`
- OptUint64 *known.UInt64Value `protobuf:"bytes,5,opt,name=opt_uint64,json=optUint64" json:"opt_uint64,omitempty"`
- OptFloat *known.FloatValue `protobuf:"bytes,6,opt,name=opt_float,json=optFloat" json:"opt_float,omitempty"`
- OptDouble *known.DoubleValue `protobuf:"bytes,7,opt,name=opt_double,json=optDouble" json:"opt_double,omitempty"`
- OptString *known.StringValue `protobuf:"bytes,8,opt,name=opt_string,json=optString" json:"opt_string,omitempty"`
- OptBytes *known.BytesValue `protobuf:"bytes,9,opt,name=opt_bytes,json=optBytes" json:"opt_bytes,omitempty"`
- OptDuration *known.Duration `protobuf:"bytes,20,opt,name=opt_duration,json=optDuration" json:"opt_duration,omitempty"`
- OptTimestamp *known.Timestamp `protobuf:"bytes,21,opt,name=opt_timestamp,json=optTimestamp" json:"opt_timestamp,omitempty"`
- OptStruct *known.Struct `protobuf:"bytes,25,opt,name=opt_struct,json=optStruct" json:"opt_struct,omitempty"`
- OptList *known.ListValue `protobuf:"bytes,26,opt,name=opt_list,json=optList" json:"opt_list,omitempty"`
- OptValue *known.Value `protobuf:"bytes,27,opt,name=opt_value,json=optValue" json:"opt_value,omitempty"`
- OptNull *known.NullValue `protobuf:"varint,28,opt,name=opt_null,json=optNull,enum=google.protobuf.NullValue" json:"opt_null,omitempty"`
- OptEmpty *known.Empty `protobuf:"bytes,30,opt,name=opt_empty,json=optEmpty" json:"opt_empty,omitempty"`
- OptAny *known.Any `protobuf:"bytes,32,opt,name=opt_any,json=optAny" json:"opt_any,omitempty"`
- OptFieldmask *known.FieldMask `protobuf:"bytes,40,opt,name=opt_fieldmask,json=optFieldmask" json:"opt_fieldmask,omitempty"`
+ OptBool *wrapperspb.BoolValue `protobuf:"bytes,1,opt,name=opt_bool,json=optBool" json:"opt_bool,omitempty"`
+ OptInt32 *wrapperspb.Int32Value `protobuf:"bytes,2,opt,name=opt_int32,json=optInt32" json:"opt_int32,omitempty"`
+ OptInt64 *wrapperspb.Int64Value `protobuf:"bytes,3,opt,name=opt_int64,json=optInt64" json:"opt_int64,omitempty"`
+ OptUint32 *wrapperspb.UInt32Value `protobuf:"bytes,4,opt,name=opt_uint32,json=optUint32" json:"opt_uint32,omitempty"`
+ OptUint64 *wrapperspb.UInt64Value `protobuf:"bytes,5,opt,name=opt_uint64,json=optUint64" json:"opt_uint64,omitempty"`
+ OptFloat *wrapperspb.FloatValue `protobuf:"bytes,6,opt,name=opt_float,json=optFloat" json:"opt_float,omitempty"`
+ OptDouble *wrapperspb.DoubleValue `protobuf:"bytes,7,opt,name=opt_double,json=optDouble" json:"opt_double,omitempty"`
+ OptString *wrapperspb.StringValue `protobuf:"bytes,8,opt,name=opt_string,json=optString" json:"opt_string,omitempty"`
+ OptBytes *wrapperspb.BytesValue `protobuf:"bytes,9,opt,name=opt_bytes,json=optBytes" json:"opt_bytes,omitempty"`
+ OptDuration *durationpb.Duration `protobuf:"bytes,20,opt,name=opt_duration,json=optDuration" json:"opt_duration,omitempty"`
+ OptTimestamp *timestamppb.Timestamp `protobuf:"bytes,21,opt,name=opt_timestamp,json=optTimestamp" json:"opt_timestamp,omitempty"`
+ OptStruct *structpb.Struct `protobuf:"bytes,25,opt,name=opt_struct,json=optStruct" json:"opt_struct,omitempty"`
+ OptList *structpb.ListValue `protobuf:"bytes,26,opt,name=opt_list,json=optList" json:"opt_list,omitempty"`
+ OptValue *structpb.Value `protobuf:"bytes,27,opt,name=opt_value,json=optValue" json:"opt_value,omitempty"`
+ OptNull *structpb.NullValue `protobuf:"varint,28,opt,name=opt_null,json=optNull,enum=google.protobuf.NullValue" json:"opt_null,omitempty"`
+ OptEmpty *emptypb.Empty `protobuf:"bytes,30,opt,name=opt_empty,json=optEmpty" json:"opt_empty,omitempty"`
+ OptAny *anypb.Any `protobuf:"bytes,32,opt,name=opt_any,json=optAny" json:"opt_any,omitempty"`
+ OptFieldmask *fieldmaskpb.FieldMask `protobuf:"bytes,40,opt,name=opt_fieldmask,json=optFieldmask" json:"opt_fieldmask,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized protoimpl.UnknownFields `json:"-"`
XXX_sizecache protoimpl.SizeCache `json:"-"`
@@ -1096,126 +1102,126 @@
return file_pb2_test_proto_rawDescGZIP(), []int{15}
}
-func (x *KnownTypes) GetOptBool() *known.BoolValue {
+func (x *KnownTypes) GetOptBool() *wrapperspb.BoolValue {
if x != nil {
return x.OptBool
}
return nil
}
-func (x *KnownTypes) GetOptInt32() *known.Int32Value {
+func (x *KnownTypes) GetOptInt32() *wrapperspb.Int32Value {
if x != nil {
return x.OptInt32
}
return nil
}
-func (x *KnownTypes) GetOptInt64() *known.Int64Value {
+func (x *KnownTypes) GetOptInt64() *wrapperspb.Int64Value {
if x != nil {
return x.OptInt64
}
return nil
}
-func (x *KnownTypes) GetOptUint32() *known.UInt32Value {
+func (x *KnownTypes) GetOptUint32() *wrapperspb.UInt32Value {
if x != nil {
return x.OptUint32
}
return nil
}
-func (x *KnownTypes) GetOptUint64() *known.UInt64Value {
+func (x *KnownTypes) GetOptUint64() *wrapperspb.UInt64Value {
if x != nil {
return x.OptUint64
}
return nil
}
-func (x *KnownTypes) GetOptFloat() *known.FloatValue {
+func (x *KnownTypes) GetOptFloat() *wrapperspb.FloatValue {
if x != nil {
return x.OptFloat
}
return nil
}
-func (x *KnownTypes) GetOptDouble() *known.DoubleValue {
+func (x *KnownTypes) GetOptDouble() *wrapperspb.DoubleValue {
if x != nil {
return x.OptDouble
}
return nil
}
-func (x *KnownTypes) GetOptString() *known.StringValue {
+func (x *KnownTypes) GetOptString() *wrapperspb.StringValue {
if x != nil {
return x.OptString
}
return nil
}
-func (x *KnownTypes) GetOptBytes() *known.BytesValue {
+func (x *KnownTypes) GetOptBytes() *wrapperspb.BytesValue {
if x != nil {
return x.OptBytes
}
return nil
}
-func (x *KnownTypes) GetOptDuration() *known.Duration {
+func (x *KnownTypes) GetOptDuration() *durationpb.Duration {
if x != nil {
return x.OptDuration
}
return nil
}
-func (x *KnownTypes) GetOptTimestamp() *known.Timestamp {
+func (x *KnownTypes) GetOptTimestamp() *timestamppb.Timestamp {
if x != nil {
return x.OptTimestamp
}
return nil
}
-func (x *KnownTypes) GetOptStruct() *known.Struct {
+func (x *KnownTypes) GetOptStruct() *structpb.Struct {
if x != nil {
return x.OptStruct
}
return nil
}
-func (x *KnownTypes) GetOptList() *known.ListValue {
+func (x *KnownTypes) GetOptList() *structpb.ListValue {
if x != nil {
return x.OptList
}
return nil
}
-func (x *KnownTypes) GetOptValue() *known.Value {
+func (x *KnownTypes) GetOptValue() *structpb.Value {
if x != nil {
return x.OptValue
}
return nil
}
-func (x *KnownTypes) GetOptNull() known.NullValue {
+func (x *KnownTypes) GetOptNull() structpb.NullValue {
if x != nil && x.OptNull != nil {
return *x.OptNull
}
- return known.NullValue_NULL_VALUE
+ return structpb.NullValue_NULL_VALUE
}
-func (x *KnownTypes) GetOptEmpty() *known.Empty {
+func (x *KnownTypes) GetOptEmpty() *emptypb.Empty {
if x != nil {
return x.OptEmpty
}
return nil
}
-func (x *KnownTypes) GetOptAny() *known.Any {
+func (x *KnownTypes) GetOptAny() *anypb.Any {
if x != nil {
return x.OptAny
}
return nil
}
-func (x *KnownTypes) GetOptFieldmask() *known.FieldMask {
+func (x *KnownTypes) GetOptFieldmask() *fieldmaskpb.FieldMask {
if x != nil {
return x.OptFieldmask
}
@@ -1965,24 +1971,24 @@
(*Nests_RptGroup)(nil), // 19: pb2.Nests.RptGroup
(*Nests_OptGroup_OptNestedGroup)(nil), // 20: pb2.Nests.OptGroup.OptNestedGroup
nil, // 21: pb2.IndirectRequired.StrToNestedEntry
- (*known.BoolValue)(nil), // 22: google.protobuf.BoolValue
- (*known.Int32Value)(nil), // 23: google.protobuf.Int32Value
- (*known.Int64Value)(nil), // 24: google.protobuf.Int64Value
- (*known.UInt32Value)(nil), // 25: google.protobuf.UInt32Value
- (*known.UInt64Value)(nil), // 26: google.protobuf.UInt64Value
- (*known.FloatValue)(nil), // 27: google.protobuf.FloatValue
- (*known.DoubleValue)(nil), // 28: google.protobuf.DoubleValue
- (*known.StringValue)(nil), // 29: google.protobuf.StringValue
- (*known.BytesValue)(nil), // 30: google.protobuf.BytesValue
- (*known.Duration)(nil), // 31: google.protobuf.Duration
- (*known.Timestamp)(nil), // 32: google.protobuf.Timestamp
- (*known.Struct)(nil), // 33: google.protobuf.Struct
- (*known.ListValue)(nil), // 34: google.protobuf.ListValue
- (*known.Value)(nil), // 35: google.protobuf.Value
- (known.NullValue)(0), // 36: google.protobuf.NullValue
- (*known.Empty)(nil), // 37: google.protobuf.Empty
- (*known.Any)(nil), // 38: google.protobuf.Any
- (*known.FieldMask)(nil), // 39: google.protobuf.FieldMask
+ (*wrapperspb.BoolValue)(nil), // 22: google.protobuf.BoolValue
+ (*wrapperspb.Int32Value)(nil), // 23: google.protobuf.Int32Value
+ (*wrapperspb.Int64Value)(nil), // 24: google.protobuf.Int64Value
+ (*wrapperspb.UInt32Value)(nil), // 25: google.protobuf.UInt32Value
+ (*wrapperspb.UInt64Value)(nil), // 26: google.protobuf.UInt64Value
+ (*wrapperspb.FloatValue)(nil), // 27: google.protobuf.FloatValue
+ (*wrapperspb.DoubleValue)(nil), // 28: google.protobuf.DoubleValue
+ (*wrapperspb.StringValue)(nil), // 29: google.protobuf.StringValue
+ (*wrapperspb.BytesValue)(nil), // 30: google.protobuf.BytesValue
+ (*durationpb.Duration)(nil), // 31: google.protobuf.Duration
+ (*timestamppb.Timestamp)(nil), // 32: google.protobuf.Timestamp
+ (*structpb.Struct)(nil), // 33: google.protobuf.Struct
+ (*structpb.ListValue)(nil), // 34: google.protobuf.ListValue
+ (*structpb.Value)(nil), // 35: google.protobuf.Value
+ (structpb.NullValue)(0), // 36: google.protobuf.NullValue
+ (*emptypb.Empty)(nil), // 37: google.protobuf.Empty
+ (*anypb.Any)(nil), // 38: google.protobuf.Any
+ (*fieldmaskpb.FieldMask)(nil), // 39: google.protobuf.FieldMask
}
var file_pb2_test_proto_depIdxs = []int32{
11, // pb2.opt_ext_bool:extendee -> pb2.Extensions
diff --git a/integration_test.go b/integration_test.go
index a18c105..afda3b5 100644
--- a/integration_test.go
+++ b/integration_test.go
@@ -290,21 +290,21 @@
javaPackageRx := regexp.MustCompile(`^option\s+java_package\s*=\s*".*"\s*;\s*$`)
goPackageRx := regexp.MustCompile(`^option\s+go_package\s*=\s*".*"\s*;\s*$`)
files := map[string]string{
- "src/google/protobuf/any.proto": "google.golang.org/protobuf/types/known;known_proto",
- "src/google/protobuf/api.proto": "google.golang.org/protobuf/types/known;known_proto",
- "src/google/protobuf/duration.proto": "google.golang.org/protobuf/types/known;known_proto",
- "src/google/protobuf/empty.proto": "google.golang.org/protobuf/types/known;known_proto",
- "src/google/protobuf/field_mask.proto": "google.golang.org/protobuf/types/known;known_proto",
- "src/google/protobuf/source_context.proto": "google.golang.org/protobuf/types/known;known_proto",
- "src/google/protobuf/struct.proto": "google.golang.org/protobuf/types/known;known_proto",
- "src/google/protobuf/timestamp.proto": "google.golang.org/protobuf/types/known;known_proto",
- "src/google/protobuf/type.proto": "google.golang.org/protobuf/types/known;known_proto",
- "src/google/protobuf/wrappers.proto": "google.golang.org/protobuf/types/known;known_proto",
- "src/google/protobuf/descriptor.proto": "google.golang.org/protobuf/types/descriptor;descriptor_proto",
- "src/google/protobuf/compiler/plugin.proto": "google.golang.org/protobuf/types/plugin;plugin_proto",
- "conformance/conformance.proto": "google.golang.org/protobuf/internal/testprotos/conformance;conformance",
- "src/google/protobuf/test_messages_proto2.proto": "google.golang.org/protobuf/internal/testprotos/conformance;conformance",
- "src/google/protobuf/test_messages_proto3.proto": "google.golang.org/protobuf/internal/testprotos/conformance;conformance",
+ "src/google/protobuf/any.proto": "google.golang.org/protobuf/types/known/anypb",
+ "src/google/protobuf/api.proto": "google.golang.org/protobuf/types/known/apipb",
+ "src/google/protobuf/duration.proto": "google.golang.org/protobuf/types/known/durationpb",
+ "src/google/protobuf/empty.proto": "google.golang.org/protobuf/types/known/emptypb",
+ "src/google/protobuf/field_mask.proto": "google.golang.org/protobuf/types/known/fieldmaskpb",
+ "src/google/protobuf/source_context.proto": "google.golang.org/protobuf/types/known/sourcecontextpb",
+ "src/google/protobuf/struct.proto": "google.golang.org/protobuf/types/known/structpb",
+ "src/google/protobuf/timestamp.proto": "google.golang.org/protobuf/types/known/timestamppb",
+ "src/google/protobuf/type.proto": "google.golang.org/protobuf/types/known/typepb",
+ "src/google/protobuf/wrappers.proto": "google.golang.org/protobuf/types/known/wrapperspb",
+ "src/google/protobuf/descriptor.proto": "google.golang.org/protobuf/types/descriptorpb",
+ "src/google/protobuf/compiler/plugin.proto": "google.golang.org/protobuf/types/pluginpb",
+ "conformance/conformance.proto": "google.golang.org/protobuf/internal/testprotos/conformance",
+ "src/google/protobuf/test_messages_proto2.proto": "google.golang.org/protobuf/internal/testprotos/conformance",
+ "src/google/protobuf/test_messages_proto3.proto": "google.golang.org/protobuf/internal/testprotos/conformance",
}
for pbpath, gopath := range files {
b, err := ioutil.ReadFile(filepath.Join(repoRoot, pbpath))
diff --git a/internal/cmd/pbdump/pbdump.go b/internal/cmd/pbdump/pbdump.go
index a3ce569..7a7c3ce 100644
--- a/internal/cmd/pbdump/pbdump.go
+++ b/internal/cmd/pbdump/pbdump.go
@@ -23,7 +23,7 @@
"google.golang.org/protobuf/internal/scalar"
"google.golang.org/protobuf/reflect/protoreflect"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
+ "google.golang.org/protobuf/types/descriptorpb"
)
func main() {
diff --git a/internal/fileinit/fileinit_test.go b/internal/fileinit/fileinit_test.go
index c5c0dc5..4d4b1ad 100644
--- a/internal/fileinit/fileinit_test.go
+++ b/internal/fileinit/fileinit_test.go
@@ -7,10 +7,11 @@
"testing"
proto "github.com/golang/protobuf/proto"
- testpb "google.golang.org/protobuf/internal/testprotos/test"
"google.golang.org/protobuf/reflect/protodesc"
"google.golang.org/protobuf/reflect/protoreflect"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
+
+ testpb "google.golang.org/protobuf/internal/testprotos/test"
+ "google.golang.org/protobuf/types/descriptorpb"
)
func TestInit(t *testing.T) {
diff --git a/internal/impl/message_test.go b/internal/impl/message_test.go
index f2c8749..ba4aa51 100644
--- a/internal/impl/message_test.go
+++ b/internal/impl/message_test.go
@@ -20,12 +20,8 @@
pvalue "google.golang.org/protobuf/internal/value"
pref "google.golang.org/protobuf/reflect/protoreflect"
- // The legacy package must be imported prior to use of any legacy messages.
- // TODO: Remove this when protoV1 registers these hooks for you.
- _ "google.golang.org/protobuf/internal/legacy"
-
proto2_20180125 "google.golang.org/protobuf/internal/testprotos/legacy/proto2.v1.0.0-20180125-92554152"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
+ "google.golang.org/protobuf/types/descriptorpb"
)
// List of test operations to perform on messages, lists, or maps.
diff --git a/internal/legacy/file_test.go b/internal/legacy/file_test.go
index 268172c..ac1a7b0 100644
--- a/internal/legacy/file_test.go
+++ b/internal/legacy/file_test.go
@@ -17,7 +17,6 @@
"google.golang.org/protobuf/proto"
pdesc "google.golang.org/protobuf/reflect/protodesc"
pref "google.golang.org/protobuf/reflect/protoreflect"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
proto2_20160225 "google.golang.org/protobuf/internal/testprotos/legacy/proto2.v0.0.0-20160225-2fc053c5"
proto2_20160519 "google.golang.org/protobuf/internal/testprotos/legacy/proto2.v0.0.0-20160519-a4ab9ec5"
@@ -31,6 +30,7 @@
proto3_20180430 "google.golang.org/protobuf/internal/testprotos/legacy/proto3.v1.1.0-20180430-b4deda09"
proto3_20180814 "google.golang.org/protobuf/internal/testprotos/legacy/proto3.v1.2.0-20180814-aa810b61"
proto3_20181126 "google.golang.org/protobuf/internal/testprotos/legacy/proto3.v1.2.1-20181126-8d0c54c1"
+ "google.golang.org/protobuf/types/descriptorpb"
)
func mustLoadFileDesc(b []byte, _ []int) pref.FileDescriptor {
diff --git a/internal/prototype/type_test.go b/internal/prototype/type_test.go
index d62e699..fb7aed1 100644
--- a/internal/prototype/type_test.go
+++ b/internal/prototype/type_test.go
@@ -20,7 +20,7 @@
pdesc "google.golang.org/protobuf/reflect/protodesc"
pref "google.golang.org/protobuf/reflect/protoreflect"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
+ "google.golang.org/protobuf/types/descriptorpb"
)
func init() {
diff --git a/internal/testprotos/conformance/conformance.pb.go b/internal/testprotos/conformance/conformance.pb.go
index 4a34a12..0dc0735 100644
--- a/internal/testprotos/conformance/conformance.pb.go
+++ b/internal/testprotos/conformance/conformance.pb.go
@@ -632,15 +632,14 @@
0x52, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x50, 0x41, 0x52, 0x53, 0x49,
0x4e, 0x47, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x50,
0x42, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x10, 0x04, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x45, 0x58, 0x54,
- 0x5f, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x10, 0x05, 0x42, 0x69,
+ 0x5f, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x10, 0x05, 0x42, 0x5d,
0x0a, 0x1f, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63,
- 0x65, 0x5a, 0x46, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67,
+ 0x65, 0x5a, 0x3a, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67,
0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x69, 0x6e,
0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f,
- 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x3b, 0x63, 0x6f,
- 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
- 0x33,
+ 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x62, 0x06, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/internal/testprotos/conformance/test_messages_proto2.pb.go b/internal/testprotos/conformance/test_messages_proto2.pb.go
index 96b9e89..d9846da 100644
--- a/internal/testprotos/conformance/test_messages_proto2.pb.go
+++ b/internal/testprotos/conformance/test_messages_proto2.pb.go
@@ -1803,15 +1803,14 @@
0x65, 0x73, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x32, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x73,
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x18, 0x78, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x65, 0x78,
- 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x42, 0x77, 0x0a, 0x28,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x42, 0x6b, 0x0a, 0x28,
0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x75, 0x66, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
- 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x48, 0x01, 0x5a, 0x46, 0x67, 0x6f, 0x6f, 0x67,
+ 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x48, 0x01, 0x5a, 0x3a, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f,
0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x6f,
- 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x3b, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e,
- 0x63, 0x65, 0xf8, 0x01, 0x01,
+ 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0xf8, 0x01, 0x01,
}
var (
diff --git a/internal/testprotos/conformance/test_messages_proto3.pb.go b/internal/testprotos/conformance/test_messages_proto3.pb.go
index a7be64e..9cbfbe9 100644
--- a/internal/testprotos/conformance/test_messages_proto3.pb.go
+++ b/internal/testprotos/conformance/test_messages_proto3.pb.go
@@ -8,7 +8,12 @@
protoregistry "google.golang.org/protobuf/reflect/protoregistry"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- known "google.golang.org/protobuf/types/known"
+ anypb "google.golang.org/protobuf/types/known/anypb"
+ durationpb "google.golang.org/protobuf/types/known/durationpb"
+ fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+ structpb "google.golang.org/protobuf/types/known/structpb"
+ timestamppb "google.golang.org/protobuf/types/known/timestamppb"
+ wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
sync "sync"
)
@@ -244,37 +249,37 @@
// *TestAllTypesProto3_OneofEnum
OneofField isTestAllTypesProto3_OneofField `protobuf_oneof:"oneof_field"`
// Well-known types
- OptionalBoolWrapper *known.BoolValue `protobuf:"bytes,201,opt,name=optional_bool_wrapper,json=optionalBoolWrapper,proto3" json:"optional_bool_wrapper,omitempty"`
- OptionalInt32Wrapper *known.Int32Value `protobuf:"bytes,202,opt,name=optional_int32_wrapper,json=optionalInt32Wrapper,proto3" json:"optional_int32_wrapper,omitempty"`
- OptionalInt64Wrapper *known.Int64Value `protobuf:"bytes,203,opt,name=optional_int64_wrapper,json=optionalInt64Wrapper,proto3" json:"optional_int64_wrapper,omitempty"`
- OptionalUint32Wrapper *known.UInt32Value `protobuf:"bytes,204,opt,name=optional_uint32_wrapper,json=optionalUint32Wrapper,proto3" json:"optional_uint32_wrapper,omitempty"`
- OptionalUint64Wrapper *known.UInt64Value `protobuf:"bytes,205,opt,name=optional_uint64_wrapper,json=optionalUint64Wrapper,proto3" json:"optional_uint64_wrapper,omitempty"`
- OptionalFloatWrapper *known.FloatValue `protobuf:"bytes,206,opt,name=optional_float_wrapper,json=optionalFloatWrapper,proto3" json:"optional_float_wrapper,omitempty"`
- OptionalDoubleWrapper *known.DoubleValue `protobuf:"bytes,207,opt,name=optional_double_wrapper,json=optionalDoubleWrapper,proto3" json:"optional_double_wrapper,omitempty"`
- OptionalStringWrapper *known.StringValue `protobuf:"bytes,208,opt,name=optional_string_wrapper,json=optionalStringWrapper,proto3" json:"optional_string_wrapper,omitempty"`
- OptionalBytesWrapper *known.BytesValue `protobuf:"bytes,209,opt,name=optional_bytes_wrapper,json=optionalBytesWrapper,proto3" json:"optional_bytes_wrapper,omitempty"`
- RepeatedBoolWrapper []*known.BoolValue `protobuf:"bytes,211,rep,name=repeated_bool_wrapper,json=repeatedBoolWrapper,proto3" json:"repeated_bool_wrapper,omitempty"`
- RepeatedInt32Wrapper []*known.Int32Value `protobuf:"bytes,212,rep,name=repeated_int32_wrapper,json=repeatedInt32Wrapper,proto3" json:"repeated_int32_wrapper,omitempty"`
- RepeatedInt64Wrapper []*known.Int64Value `protobuf:"bytes,213,rep,name=repeated_int64_wrapper,json=repeatedInt64Wrapper,proto3" json:"repeated_int64_wrapper,omitempty"`
- RepeatedUint32Wrapper []*known.UInt32Value `protobuf:"bytes,214,rep,name=repeated_uint32_wrapper,json=repeatedUint32Wrapper,proto3" json:"repeated_uint32_wrapper,omitempty"`
- RepeatedUint64Wrapper []*known.UInt64Value `protobuf:"bytes,215,rep,name=repeated_uint64_wrapper,json=repeatedUint64Wrapper,proto3" json:"repeated_uint64_wrapper,omitempty"`
- RepeatedFloatWrapper []*known.FloatValue `protobuf:"bytes,216,rep,name=repeated_float_wrapper,json=repeatedFloatWrapper,proto3" json:"repeated_float_wrapper,omitempty"`
- RepeatedDoubleWrapper []*known.DoubleValue `protobuf:"bytes,217,rep,name=repeated_double_wrapper,json=repeatedDoubleWrapper,proto3" json:"repeated_double_wrapper,omitempty"`
- RepeatedStringWrapper []*known.StringValue `protobuf:"bytes,218,rep,name=repeated_string_wrapper,json=repeatedStringWrapper,proto3" json:"repeated_string_wrapper,omitempty"`
- RepeatedBytesWrapper []*known.BytesValue `protobuf:"bytes,219,rep,name=repeated_bytes_wrapper,json=repeatedBytesWrapper,proto3" json:"repeated_bytes_wrapper,omitempty"`
- OptionalDuration *known.Duration `protobuf:"bytes,301,opt,name=optional_duration,json=optionalDuration,proto3" json:"optional_duration,omitempty"`
- OptionalTimestamp *known.Timestamp `protobuf:"bytes,302,opt,name=optional_timestamp,json=optionalTimestamp,proto3" json:"optional_timestamp,omitempty"`
- OptionalFieldMask *known.FieldMask `protobuf:"bytes,303,opt,name=optional_field_mask,json=optionalFieldMask,proto3" json:"optional_field_mask,omitempty"`
- OptionalStruct *known.Struct `protobuf:"bytes,304,opt,name=optional_struct,json=optionalStruct,proto3" json:"optional_struct,omitempty"`
- OptionalAny *known.Any `protobuf:"bytes,305,opt,name=optional_any,json=optionalAny,proto3" json:"optional_any,omitempty"`
- OptionalValue *known.Value `protobuf:"bytes,306,opt,name=optional_value,json=optionalValue,proto3" json:"optional_value,omitempty"`
- RepeatedDuration []*known.Duration `protobuf:"bytes,311,rep,name=repeated_duration,json=repeatedDuration,proto3" json:"repeated_duration,omitempty"`
- RepeatedTimestamp []*known.Timestamp `protobuf:"bytes,312,rep,name=repeated_timestamp,json=repeatedTimestamp,proto3" json:"repeated_timestamp,omitempty"`
- RepeatedFieldmask []*known.FieldMask `protobuf:"bytes,313,rep,name=repeated_fieldmask,json=repeatedFieldmask,proto3" json:"repeated_fieldmask,omitempty"`
- RepeatedStruct []*known.Struct `protobuf:"bytes,324,rep,name=repeated_struct,json=repeatedStruct,proto3" json:"repeated_struct,omitempty"`
- RepeatedAny []*known.Any `protobuf:"bytes,315,rep,name=repeated_any,json=repeatedAny,proto3" json:"repeated_any,omitempty"`
- RepeatedValue []*known.Value `protobuf:"bytes,316,rep,name=repeated_value,json=repeatedValue,proto3" json:"repeated_value,omitempty"`
- RepeatedListValue []*known.ListValue `protobuf:"bytes,317,rep,name=repeated_list_value,json=repeatedListValue,proto3" json:"repeated_list_value,omitempty"`
+ OptionalBoolWrapper *wrapperspb.BoolValue `protobuf:"bytes,201,opt,name=optional_bool_wrapper,json=optionalBoolWrapper,proto3" json:"optional_bool_wrapper,omitempty"`
+ OptionalInt32Wrapper *wrapperspb.Int32Value `protobuf:"bytes,202,opt,name=optional_int32_wrapper,json=optionalInt32Wrapper,proto3" json:"optional_int32_wrapper,omitempty"`
+ OptionalInt64Wrapper *wrapperspb.Int64Value `protobuf:"bytes,203,opt,name=optional_int64_wrapper,json=optionalInt64Wrapper,proto3" json:"optional_int64_wrapper,omitempty"`
+ OptionalUint32Wrapper *wrapperspb.UInt32Value `protobuf:"bytes,204,opt,name=optional_uint32_wrapper,json=optionalUint32Wrapper,proto3" json:"optional_uint32_wrapper,omitempty"`
+ OptionalUint64Wrapper *wrapperspb.UInt64Value `protobuf:"bytes,205,opt,name=optional_uint64_wrapper,json=optionalUint64Wrapper,proto3" json:"optional_uint64_wrapper,omitempty"`
+ OptionalFloatWrapper *wrapperspb.FloatValue `protobuf:"bytes,206,opt,name=optional_float_wrapper,json=optionalFloatWrapper,proto3" json:"optional_float_wrapper,omitempty"`
+ OptionalDoubleWrapper *wrapperspb.DoubleValue `protobuf:"bytes,207,opt,name=optional_double_wrapper,json=optionalDoubleWrapper,proto3" json:"optional_double_wrapper,omitempty"`
+ OptionalStringWrapper *wrapperspb.StringValue `protobuf:"bytes,208,opt,name=optional_string_wrapper,json=optionalStringWrapper,proto3" json:"optional_string_wrapper,omitempty"`
+ OptionalBytesWrapper *wrapperspb.BytesValue `protobuf:"bytes,209,opt,name=optional_bytes_wrapper,json=optionalBytesWrapper,proto3" json:"optional_bytes_wrapper,omitempty"`
+ RepeatedBoolWrapper []*wrapperspb.BoolValue `protobuf:"bytes,211,rep,name=repeated_bool_wrapper,json=repeatedBoolWrapper,proto3" json:"repeated_bool_wrapper,omitempty"`
+ RepeatedInt32Wrapper []*wrapperspb.Int32Value `protobuf:"bytes,212,rep,name=repeated_int32_wrapper,json=repeatedInt32Wrapper,proto3" json:"repeated_int32_wrapper,omitempty"`
+ RepeatedInt64Wrapper []*wrapperspb.Int64Value `protobuf:"bytes,213,rep,name=repeated_int64_wrapper,json=repeatedInt64Wrapper,proto3" json:"repeated_int64_wrapper,omitempty"`
+ RepeatedUint32Wrapper []*wrapperspb.UInt32Value `protobuf:"bytes,214,rep,name=repeated_uint32_wrapper,json=repeatedUint32Wrapper,proto3" json:"repeated_uint32_wrapper,omitempty"`
+ RepeatedUint64Wrapper []*wrapperspb.UInt64Value `protobuf:"bytes,215,rep,name=repeated_uint64_wrapper,json=repeatedUint64Wrapper,proto3" json:"repeated_uint64_wrapper,omitempty"`
+ RepeatedFloatWrapper []*wrapperspb.FloatValue `protobuf:"bytes,216,rep,name=repeated_float_wrapper,json=repeatedFloatWrapper,proto3" json:"repeated_float_wrapper,omitempty"`
+ RepeatedDoubleWrapper []*wrapperspb.DoubleValue `protobuf:"bytes,217,rep,name=repeated_double_wrapper,json=repeatedDoubleWrapper,proto3" json:"repeated_double_wrapper,omitempty"`
+ RepeatedStringWrapper []*wrapperspb.StringValue `protobuf:"bytes,218,rep,name=repeated_string_wrapper,json=repeatedStringWrapper,proto3" json:"repeated_string_wrapper,omitempty"`
+ RepeatedBytesWrapper []*wrapperspb.BytesValue `protobuf:"bytes,219,rep,name=repeated_bytes_wrapper,json=repeatedBytesWrapper,proto3" json:"repeated_bytes_wrapper,omitempty"`
+ OptionalDuration *durationpb.Duration `protobuf:"bytes,301,opt,name=optional_duration,json=optionalDuration,proto3" json:"optional_duration,omitempty"`
+ OptionalTimestamp *timestamppb.Timestamp `protobuf:"bytes,302,opt,name=optional_timestamp,json=optionalTimestamp,proto3" json:"optional_timestamp,omitempty"`
+ OptionalFieldMask *fieldmaskpb.FieldMask `protobuf:"bytes,303,opt,name=optional_field_mask,json=optionalFieldMask,proto3" json:"optional_field_mask,omitempty"`
+ OptionalStruct *structpb.Struct `protobuf:"bytes,304,opt,name=optional_struct,json=optionalStruct,proto3" json:"optional_struct,omitempty"`
+ OptionalAny *anypb.Any `protobuf:"bytes,305,opt,name=optional_any,json=optionalAny,proto3" json:"optional_any,omitempty"`
+ OptionalValue *structpb.Value `protobuf:"bytes,306,opt,name=optional_value,json=optionalValue,proto3" json:"optional_value,omitempty"`
+ RepeatedDuration []*durationpb.Duration `protobuf:"bytes,311,rep,name=repeated_duration,json=repeatedDuration,proto3" json:"repeated_duration,omitempty"`
+ RepeatedTimestamp []*timestamppb.Timestamp `protobuf:"bytes,312,rep,name=repeated_timestamp,json=repeatedTimestamp,proto3" json:"repeated_timestamp,omitempty"`
+ RepeatedFieldmask []*fieldmaskpb.FieldMask `protobuf:"bytes,313,rep,name=repeated_fieldmask,json=repeatedFieldmask,proto3" json:"repeated_fieldmask,omitempty"`
+ RepeatedStruct []*structpb.Struct `protobuf:"bytes,324,rep,name=repeated_struct,json=repeatedStruct,proto3" json:"repeated_struct,omitempty"`
+ RepeatedAny []*anypb.Any `protobuf:"bytes,315,rep,name=repeated_any,json=repeatedAny,proto3" json:"repeated_any,omitempty"`
+ RepeatedValue []*structpb.Value `protobuf:"bytes,316,rep,name=repeated_value,json=repeatedValue,proto3" json:"repeated_value,omitempty"`
+ RepeatedListValue []*structpb.ListValue `protobuf:"bytes,317,rep,name=repeated_list_value,json=repeatedListValue,proto3" json:"repeated_list_value,omitempty"`
// Test field-name-to-JSON-name convention.
// (protobuf says names can be any valid C/C++ identifier.)
Fieldname1 int32 `protobuf:"varint,401,opt,name=fieldname1,proto3" json:"fieldname1,omitempty"`
@@ -834,217 +839,217 @@
return TestAllTypesProto3_FOO
}
-func (x *TestAllTypesProto3) GetOptionalBoolWrapper() *known.BoolValue {
+func (x *TestAllTypesProto3) GetOptionalBoolWrapper() *wrapperspb.BoolValue {
if x != nil {
return x.OptionalBoolWrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalInt32Wrapper() *known.Int32Value {
+func (x *TestAllTypesProto3) GetOptionalInt32Wrapper() *wrapperspb.Int32Value {
if x != nil {
return x.OptionalInt32Wrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalInt64Wrapper() *known.Int64Value {
+func (x *TestAllTypesProto3) GetOptionalInt64Wrapper() *wrapperspb.Int64Value {
if x != nil {
return x.OptionalInt64Wrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalUint32Wrapper() *known.UInt32Value {
+func (x *TestAllTypesProto3) GetOptionalUint32Wrapper() *wrapperspb.UInt32Value {
if x != nil {
return x.OptionalUint32Wrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalUint64Wrapper() *known.UInt64Value {
+func (x *TestAllTypesProto3) GetOptionalUint64Wrapper() *wrapperspb.UInt64Value {
if x != nil {
return x.OptionalUint64Wrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalFloatWrapper() *known.FloatValue {
+func (x *TestAllTypesProto3) GetOptionalFloatWrapper() *wrapperspb.FloatValue {
if x != nil {
return x.OptionalFloatWrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalDoubleWrapper() *known.DoubleValue {
+func (x *TestAllTypesProto3) GetOptionalDoubleWrapper() *wrapperspb.DoubleValue {
if x != nil {
return x.OptionalDoubleWrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalStringWrapper() *known.StringValue {
+func (x *TestAllTypesProto3) GetOptionalStringWrapper() *wrapperspb.StringValue {
if x != nil {
return x.OptionalStringWrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalBytesWrapper() *known.BytesValue {
+func (x *TestAllTypesProto3) GetOptionalBytesWrapper() *wrapperspb.BytesValue {
if x != nil {
return x.OptionalBytesWrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedBoolWrapper() []*known.BoolValue {
+func (x *TestAllTypesProto3) GetRepeatedBoolWrapper() []*wrapperspb.BoolValue {
if x != nil {
return x.RepeatedBoolWrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedInt32Wrapper() []*known.Int32Value {
+func (x *TestAllTypesProto3) GetRepeatedInt32Wrapper() []*wrapperspb.Int32Value {
if x != nil {
return x.RepeatedInt32Wrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedInt64Wrapper() []*known.Int64Value {
+func (x *TestAllTypesProto3) GetRepeatedInt64Wrapper() []*wrapperspb.Int64Value {
if x != nil {
return x.RepeatedInt64Wrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedUint32Wrapper() []*known.UInt32Value {
+func (x *TestAllTypesProto3) GetRepeatedUint32Wrapper() []*wrapperspb.UInt32Value {
if x != nil {
return x.RepeatedUint32Wrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedUint64Wrapper() []*known.UInt64Value {
+func (x *TestAllTypesProto3) GetRepeatedUint64Wrapper() []*wrapperspb.UInt64Value {
if x != nil {
return x.RepeatedUint64Wrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedFloatWrapper() []*known.FloatValue {
+func (x *TestAllTypesProto3) GetRepeatedFloatWrapper() []*wrapperspb.FloatValue {
if x != nil {
return x.RepeatedFloatWrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedDoubleWrapper() []*known.DoubleValue {
+func (x *TestAllTypesProto3) GetRepeatedDoubleWrapper() []*wrapperspb.DoubleValue {
if x != nil {
return x.RepeatedDoubleWrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedStringWrapper() []*known.StringValue {
+func (x *TestAllTypesProto3) GetRepeatedStringWrapper() []*wrapperspb.StringValue {
if x != nil {
return x.RepeatedStringWrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedBytesWrapper() []*known.BytesValue {
+func (x *TestAllTypesProto3) GetRepeatedBytesWrapper() []*wrapperspb.BytesValue {
if x != nil {
return x.RepeatedBytesWrapper
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalDuration() *known.Duration {
+func (x *TestAllTypesProto3) GetOptionalDuration() *durationpb.Duration {
if x != nil {
return x.OptionalDuration
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalTimestamp() *known.Timestamp {
+func (x *TestAllTypesProto3) GetOptionalTimestamp() *timestamppb.Timestamp {
if x != nil {
return x.OptionalTimestamp
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalFieldMask() *known.FieldMask {
+func (x *TestAllTypesProto3) GetOptionalFieldMask() *fieldmaskpb.FieldMask {
if x != nil {
return x.OptionalFieldMask
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalStruct() *known.Struct {
+func (x *TestAllTypesProto3) GetOptionalStruct() *structpb.Struct {
if x != nil {
return x.OptionalStruct
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalAny() *known.Any {
+func (x *TestAllTypesProto3) GetOptionalAny() *anypb.Any {
if x != nil {
return x.OptionalAny
}
return nil
}
-func (x *TestAllTypesProto3) GetOptionalValue() *known.Value {
+func (x *TestAllTypesProto3) GetOptionalValue() *structpb.Value {
if x != nil {
return x.OptionalValue
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedDuration() []*known.Duration {
+func (x *TestAllTypesProto3) GetRepeatedDuration() []*durationpb.Duration {
if x != nil {
return x.RepeatedDuration
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedTimestamp() []*known.Timestamp {
+func (x *TestAllTypesProto3) GetRepeatedTimestamp() []*timestamppb.Timestamp {
if x != nil {
return x.RepeatedTimestamp
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedFieldmask() []*known.FieldMask {
+func (x *TestAllTypesProto3) GetRepeatedFieldmask() []*fieldmaskpb.FieldMask {
if x != nil {
return x.RepeatedFieldmask
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedStruct() []*known.Struct {
+func (x *TestAllTypesProto3) GetRepeatedStruct() []*structpb.Struct {
if x != nil {
return x.RepeatedStruct
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedAny() []*known.Any {
+func (x *TestAllTypesProto3) GetRepeatedAny() []*anypb.Any {
if x != nil {
return x.RepeatedAny
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedValue() []*known.Value {
+func (x *TestAllTypesProto3) GetRepeatedValue() []*structpb.Value {
if x != nil {
return x.RepeatedValue
}
return nil
}
-func (x *TestAllTypesProto3) GetRepeatedListValue() []*known.ListValue {
+func (x *TestAllTypesProto3) GetRepeatedListValue() []*structpb.ListValue {
if x != nil {
return x.RepeatedListValue
}
@@ -1993,16 +1998,15 @@
0x69, 0x67, 0x6e, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x46, 0x4f, 0x52, 0x45, 0x49,
0x47, 0x4e, 0x5f, 0x46, 0x4f, 0x4f, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x46, 0x4f, 0x52, 0x45,
0x49, 0x47, 0x4e, 0x5f, 0x42, 0x41, 0x52, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x46, 0x4f, 0x52,
- 0x45, 0x49, 0x47, 0x4e, 0x5f, 0x42, 0x41, 0x5a, 0x10, 0x02, 0x42, 0x80, 0x01, 0x0a, 0x28, 0x63,
- 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
- 0x75, 0x66, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73,
- 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x48, 0x01, 0x5a, 0x46, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
- 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x74,
- 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72,
- 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x3b, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63,
- 0x65, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x06, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x62, 0x06, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x45, 0x49, 0x47, 0x4e, 0x5f, 0x42, 0x41, 0x5a, 0x10, 0x02, 0x42, 0x74, 0x0a, 0x28, 0x63, 0x6f,
+ 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
+ 0x66, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x48, 0x01, 0x5a, 0x3a, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65,
+ 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d,
+ 0x61, 0x6e, 0x63, 0x65, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x06, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -2045,22 +2049,22 @@
nil, // 22: protobuf_test_messages.proto3.TestAllTypesProto3.MapStringForeignMessageEntry
nil, // 23: protobuf_test_messages.proto3.TestAllTypesProto3.MapStringNestedEnumEntry
nil, // 24: protobuf_test_messages.proto3.TestAllTypesProto3.MapStringForeignEnumEntry
- (*known.BoolValue)(nil), // 25: google.protobuf.BoolValue
- (*known.Int32Value)(nil), // 26: google.protobuf.Int32Value
- (*known.Int64Value)(nil), // 27: google.protobuf.Int64Value
- (*known.UInt32Value)(nil), // 28: google.protobuf.UInt32Value
- (*known.UInt64Value)(nil), // 29: google.protobuf.UInt64Value
- (*known.FloatValue)(nil), // 30: google.protobuf.FloatValue
- (*known.DoubleValue)(nil), // 31: google.protobuf.DoubleValue
- (*known.StringValue)(nil), // 32: google.protobuf.StringValue
- (*known.BytesValue)(nil), // 33: google.protobuf.BytesValue
- (*known.Duration)(nil), // 34: google.protobuf.Duration
- (*known.Timestamp)(nil), // 35: google.protobuf.Timestamp
- (*known.FieldMask)(nil), // 36: google.protobuf.FieldMask
- (*known.Struct)(nil), // 37: google.protobuf.Struct
- (*known.Any)(nil), // 38: google.protobuf.Any
- (*known.Value)(nil), // 39: google.protobuf.Value
- (*known.ListValue)(nil), // 40: google.protobuf.ListValue
+ (*wrapperspb.BoolValue)(nil), // 25: google.protobuf.BoolValue
+ (*wrapperspb.Int32Value)(nil), // 26: google.protobuf.Int32Value
+ (*wrapperspb.Int64Value)(nil), // 27: google.protobuf.Int64Value
+ (*wrapperspb.UInt32Value)(nil), // 28: google.protobuf.UInt32Value
+ (*wrapperspb.UInt64Value)(nil), // 29: google.protobuf.UInt64Value
+ (*wrapperspb.FloatValue)(nil), // 30: google.protobuf.FloatValue
+ (*wrapperspb.DoubleValue)(nil), // 31: google.protobuf.DoubleValue
+ (*wrapperspb.StringValue)(nil), // 32: google.protobuf.StringValue
+ (*wrapperspb.BytesValue)(nil), // 33: google.protobuf.BytesValue
+ (*durationpb.Duration)(nil), // 34: google.protobuf.Duration
+ (*timestamppb.Timestamp)(nil), // 35: google.protobuf.Timestamp
+ (*fieldmaskpb.FieldMask)(nil), // 36: google.protobuf.FieldMask
+ (*structpb.Struct)(nil), // 37: google.protobuf.Struct
+ (*anypb.Any)(nil), // 38: google.protobuf.Any
+ (*structpb.Value)(nil), // 39: google.protobuf.Value
+ (*structpb.ListValue)(nil), // 40: google.protobuf.ListValue
}
var file_google_protobuf_test_messages_proto3_proto_depIdxs = []int32{
5, // protobuf_test_messages.proto3.TestAllTypesProto3.optional_nested_message:type_name -> protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage
diff --git a/reflect/protodesc/protodesc.go b/reflect/protodesc/protodesc.go
index 696f904..2ee40ca 100644
--- a/reflect/protodesc/protodesc.go
+++ b/reflect/protodesc/protodesc.go
@@ -15,7 +15,7 @@
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
+ "google.golang.org/protobuf/types/descriptorpb"
)
// TODO: Should we be responsible for validating other parts of the descriptor
diff --git a/reflect/protodesc/protodesc_test.go b/reflect/protodesc/protodesc_test.go
index bbaaef5..19c3ab3 100644
--- a/reflect/protodesc/protodesc_test.go
+++ b/reflect/protodesc/protodesc_test.go
@@ -7,7 +7,7 @@
"google.golang.org/protobuf/internal/scalar"
"google.golang.org/protobuf/reflect/protoregistry"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
+ "google.golang.org/protobuf/types/descriptorpb"
)
// Tests validation logic for malformed descriptors.
diff --git a/reflect/protodesc/toproto.go b/reflect/protodesc/toproto.go
index 695cc99..99bcaea 100644
--- a/reflect/protodesc/toproto.go
+++ b/reflect/protodesc/toproto.go
@@ -9,7 +9,8 @@
"google.golang.org/protobuf/internal/encoding/defval"
"google.golang.org/protobuf/internal/scalar"
"google.golang.org/protobuf/reflect/protoreflect"
- descriptorpb "google.golang.org/protobuf/types/descriptor"
+
+ "google.golang.org/protobuf/types/descriptorpb"
)
// ToFileDescriptorProto converts a FileDescriptor to a
diff --git a/types/descriptor/stub.go b/types/descriptor/stub.go
new file mode 100644
index 0000000..5695b62
--- /dev/null
+++ b/types/descriptor/stub.go
@@ -0,0 +1,121 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// TODO: This file exists to have the minimum number of forwarding declarations
+// to keep v1 working. This will be deleted in the near future.
+package descriptor_proto
+
+import "google.golang.org/protobuf/types/descriptorpb"
+
+type (
+ DescriptorProto = descriptorpb.DescriptorProto
+ DescriptorProto_ExtensionRange = descriptorpb.DescriptorProto_ExtensionRange
+ DescriptorProto_ReservedRange = descriptorpb.DescriptorProto_ReservedRange
+ EnumDescriptorProto = descriptorpb.EnumDescriptorProto
+ EnumDescriptorProto_EnumReservedRange = descriptorpb.EnumDescriptorProto_EnumReservedRange
+ EnumOptions = descriptorpb.EnumOptions
+ EnumValueDescriptorProto = descriptorpb.EnumValueDescriptorProto
+ EnumValueOptions = descriptorpb.EnumValueOptions
+ ExtensionRangeOptions = descriptorpb.ExtensionRangeOptions
+ FieldDescriptorProto = descriptorpb.FieldDescriptorProto
+ FieldDescriptorProto_Label = descriptorpb.FieldDescriptorProto_Label
+ FieldDescriptorProto_Type = descriptorpb.FieldDescriptorProto_Type
+ FieldOptions = descriptorpb.FieldOptions
+ FieldOptions_CType = descriptorpb.FieldOptions_CType
+ FieldOptions_JSType = descriptorpb.FieldOptions_JSType
+ FileDescriptorProto = descriptorpb.FileDescriptorProto
+ FileDescriptorSet = descriptorpb.FileDescriptorSet
+ FileOptions = descriptorpb.FileOptions
+ FileOptions_OptimizeMode = descriptorpb.FileOptions_OptimizeMode
+ GeneratedCodeInfo = descriptorpb.GeneratedCodeInfo
+ GeneratedCodeInfo_Annotation = descriptorpb.GeneratedCodeInfo_Annotation
+ MessageOptions = descriptorpb.MessageOptions
+ MethodDescriptorProto = descriptorpb.MethodDescriptorProto
+ MethodOptions = descriptorpb.MethodOptions
+ MethodOptions_IdempotencyLevel = descriptorpb.MethodOptions_IdempotencyLevel
+ OneofDescriptorProto = descriptorpb.OneofDescriptorProto
+ OneofOptions = descriptorpb.OneofOptions
+ ServiceDescriptorProto = descriptorpb.ServiceDescriptorProto
+ ServiceOptions = descriptorpb.ServiceOptions
+ SourceCodeInfo = descriptorpb.SourceCodeInfo
+ SourceCodeInfo_Location = descriptorpb.SourceCodeInfo_Location
+ UninterpretedOption = descriptorpb.UninterpretedOption
+ UninterpretedOption_NamePart = descriptorpb.UninterpretedOption_NamePart
+)
+
+const (
+ Default_EnumOptions_Deprecated = descriptorpb.Default_EnumOptions_Deprecated
+ Default_EnumValueOptions_Deprecated = descriptorpb.Default_EnumValueOptions_Deprecated
+ Default_FieldOptions_Ctype = descriptorpb.Default_FieldOptions_Ctype
+ Default_FieldOptions_Deprecated = descriptorpb.Default_FieldOptions_Deprecated
+ Default_FieldOptions_Jstype = descriptorpb.Default_FieldOptions_Jstype
+ Default_FieldOptions_Lazy = descriptorpb.Default_FieldOptions_Lazy
+ Default_FieldOptions_Weak = descriptorpb.Default_FieldOptions_Weak
+ Default_FileOptions_CcEnableArenas = descriptorpb.Default_FileOptions_CcEnableArenas
+ Default_FileOptions_CcGenericServices = descriptorpb.Default_FileOptions_CcGenericServices
+ Default_FileOptions_Deprecated = descriptorpb.Default_FileOptions_Deprecated
+ Default_FileOptions_JavaGenericServices = descriptorpb.Default_FileOptions_JavaGenericServices
+ Default_FileOptions_JavaMultipleFiles = descriptorpb.Default_FileOptions_JavaMultipleFiles
+ Default_FileOptions_JavaStringCheckUtf8 = descriptorpb.Default_FileOptions_JavaStringCheckUtf8
+ Default_FileOptions_OptimizeFor = descriptorpb.Default_FileOptions_OptimizeFor
+ Default_FileOptions_PhpGenericServices = descriptorpb.Default_FileOptions_PhpGenericServices
+ Default_FileOptions_PyGenericServices = descriptorpb.Default_FileOptions_PyGenericServices
+ Default_MessageOptions_Deprecated = descriptorpb.Default_MessageOptions_Deprecated
+ Default_MessageOptions_MessageSetWireFormat = descriptorpb.Default_MessageOptions_MessageSetWireFormat
+ Default_MessageOptions_NoStandardDescriptorAccessor = descriptorpb.Default_MessageOptions_NoStandardDescriptorAccessor
+ Default_MethodDescriptorProto_ClientStreaming = descriptorpb.Default_MethodDescriptorProto_ClientStreaming
+ Default_MethodDescriptorProto_ServerStreaming = descriptorpb.Default_MethodDescriptorProto_ServerStreaming
+ Default_MethodOptions_Deprecated = descriptorpb.Default_MethodOptions_Deprecated
+ Default_MethodOptions_IdempotencyLevel = descriptorpb.Default_MethodOptions_IdempotencyLevel
+ Default_ServiceOptions_Deprecated = descriptorpb.Default_ServiceOptions_Deprecated
+ FieldDescriptorProto_LABEL_OPTIONAL = descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL
+ FieldDescriptorProto_LABEL_REPEATED = descriptorpb.FieldDescriptorProto_LABEL_REPEATED
+ FieldDescriptorProto_LABEL_REQUIRED = descriptorpb.FieldDescriptorProto_LABEL_REQUIRED
+ FieldDescriptorProto_TYPE_BOOL = descriptorpb.FieldDescriptorProto_TYPE_BOOL
+ FieldDescriptorProto_TYPE_BYTES = descriptorpb.FieldDescriptorProto_TYPE_BYTES
+ FieldDescriptorProto_TYPE_DOUBLE = descriptorpb.FieldDescriptorProto_TYPE_DOUBLE
+ FieldDescriptorProto_TYPE_ENUM = descriptorpb.FieldDescriptorProto_TYPE_ENUM
+ FieldDescriptorProto_TYPE_FIXED32 = descriptorpb.FieldDescriptorProto_TYPE_FIXED32
+ FieldDescriptorProto_TYPE_FIXED64 = descriptorpb.FieldDescriptorProto_TYPE_FIXED64
+ FieldDescriptorProto_TYPE_FLOAT = descriptorpb.FieldDescriptorProto_TYPE_FLOAT
+ FieldDescriptorProto_TYPE_GROUP = descriptorpb.FieldDescriptorProto_TYPE_GROUP
+ FieldDescriptorProto_TYPE_INT32 = descriptorpb.FieldDescriptorProto_TYPE_INT32
+ FieldDescriptorProto_TYPE_INT64 = descriptorpb.FieldDescriptorProto_TYPE_INT64
+ FieldDescriptorProto_TYPE_MESSAGE = descriptorpb.FieldDescriptorProto_TYPE_MESSAGE
+ FieldDescriptorProto_TYPE_SFIXED32 = descriptorpb.FieldDescriptorProto_TYPE_SFIXED32
+ FieldDescriptorProto_TYPE_SFIXED64 = descriptorpb.FieldDescriptorProto_TYPE_SFIXED64
+ FieldDescriptorProto_TYPE_SINT32 = descriptorpb.FieldDescriptorProto_TYPE_SINT32
+ FieldDescriptorProto_TYPE_SINT64 = descriptorpb.FieldDescriptorProto_TYPE_SINT64
+ FieldDescriptorProto_TYPE_STRING = descriptorpb.FieldDescriptorProto_TYPE_STRING
+ FieldDescriptorProto_TYPE_UINT32 = descriptorpb.FieldDescriptorProto_TYPE_UINT32
+ FieldDescriptorProto_TYPE_UINT64 = descriptorpb.FieldDescriptorProto_TYPE_UINT64
+ FieldOptions_CORD = descriptorpb.FieldOptions_CORD
+ FieldOptions_JS_NORMAL = descriptorpb.FieldOptions_JS_NORMAL
+ FieldOptions_JS_NUMBER = descriptorpb.FieldOptions_JS_NUMBER
+ FieldOptions_JS_STRING = descriptorpb.FieldOptions_JS_STRING
+ FieldOptions_STRING = descriptorpb.FieldOptions_STRING
+ FieldOptions_STRING_PIECE = descriptorpb.FieldOptions_STRING_PIECE
+ FileOptions_CODE_SIZE = descriptorpb.FileOptions_CODE_SIZE
+ FileOptions_LITE_RUNTIME = descriptorpb.FileOptions_LITE_RUNTIME
+ FileOptions_SPEED = descriptorpb.FileOptions_SPEED
+ MethodOptions_IDEMPOTENCY_UNKNOWN = descriptorpb.MethodOptions_IDEMPOTENCY_UNKNOWN
+ MethodOptions_IDEMPOTENT = descriptorpb.MethodOptions_IDEMPOTENT
+ MethodOptions_NO_SIDE_EFFECTS = descriptorpb.MethodOptions_NO_SIDE_EFFECTS
+)
+
+var (
+ FieldDescriptorProto_Label_name = descriptorpb.FieldDescriptorProto_Label_name
+ FieldDescriptorProto_Label_value = descriptorpb.FieldDescriptorProto_Label_value
+ FieldDescriptorProto_Type_name = descriptorpb.FieldDescriptorProto_Type_name
+ FieldDescriptorProto_Type_value = descriptorpb.FieldDescriptorProto_Type_value
+ FieldOptions_CType_name = descriptorpb.FieldOptions_CType_name
+ FieldOptions_CType_value = descriptorpb.FieldOptions_CType_value
+ FieldOptions_JSType_name = descriptorpb.FieldOptions_JSType_name
+ FieldOptions_JSType_value = descriptorpb.FieldOptions_JSType_value
+ File_google_protobuf_descriptor_proto = descriptorpb.File_google_protobuf_descriptor_proto
+ FileOptions_OptimizeMode_name = descriptorpb.FileOptions_OptimizeMode_name
+ FileOptions_OptimizeMode_value = descriptorpb.FileOptions_OptimizeMode_value
+ MethodOptions_IdempotencyLevel_name = descriptorpb.MethodOptions_IdempotencyLevel_name
+ MethodOptions_IdempotencyLevel_value = descriptorpb.MethodOptions_IdempotencyLevel_value
+)
diff --git a/types/descriptor/descriptor.pb.go b/types/descriptorpb/descriptor.pb.go
similarity index 99%
rename from types/descriptor/descriptor.pb.go
rename to types/descriptorpb/descriptor.pb.go
index 585d46c..a954524 100644
--- a/types/descriptor/descriptor.pb.go
+++ b/types/descriptorpb/descriptor.pb.go
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/descriptor.proto
-package descriptor_proto
+package descriptorpb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@@ -3199,14 +3199,13 @@
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c,
0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,
0x52, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04,
- 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x42, 0x8d, 0x01, 0x0a, 0x13, 0x63, 0x6f,
- 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
- 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f,
- 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x3c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f,
- 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
- 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
- 0x6f, 0x72, 0x3b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1a, 0x47,
+ 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x42, 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d,
+ 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
+ 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74,
+ 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x2d, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c,
+ 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
+ 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f,
+ 0x72, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1a, 0x47,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52,
0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
}
diff --git a/types/known/any.pb.go b/types/known/anypb/any.pb.go
similarity index 93%
rename from types/known/any.pb.go
rename to types/known/anypb/any.pb.go
index 0fbafc2..bf1109a 100644
--- a/types/known/any.pb.go
+++ b/types/known/anypb/any.pb.go
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/any.proto
-package known_proto
+package anypb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@@ -178,15 +178,15 @@
0x41, 0x6e, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x14,
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76,
- 0x61, 0x6c, 0x75, 0x65, 0x42, 0x7c, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
+ 0x61, 0x6c, 0x75, 0x65, 0x42, 0x76, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x08, 0x41, 0x6e, 0x79,
- 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
+ 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
- 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x3b,
- 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xa2, 0x02, 0x03, 0x47, 0x50,
- 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f,
- 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70,
- 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f,
+ 0x61, 0x6e, 0x79, 0x70, 0x62, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f,
+ 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65,
+ 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/types/known/api.pb.go b/types/known/apipb/api.pb.go
similarity index 90%
rename from types/known/api.pb.go
rename to types/known/apipb/api.pb.go
index 30a4e1c..63da4b5 100644
--- a/types/known/api.pb.go
+++ b/types/known/apipb/api.pb.go
@@ -1,13 +1,15 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/api.proto
-package known_proto
+package apipb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoregistry "google.golang.org/protobuf/reflect/protoregistry"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ sourcecontextpb "google.golang.org/protobuf/types/known/sourcecontextpb"
+ typepb "google.golang.org/protobuf/types/known/typepb"
sync "sync"
)
@@ -29,7 +31,7 @@
// The methods of this interface, in unspecified order.
Methods []*Method `protobuf:"bytes,2,rep,name=methods,proto3" json:"methods,omitempty"`
// Any metadata attached to the interface.
- Options []*Option `protobuf:"bytes,3,rep,name=options,proto3" json:"options,omitempty"`
+ Options []*typepb.Option `protobuf:"bytes,3,rep,name=options,proto3" json:"options,omitempty"`
// A version string for this interface. If specified, must have the form
// `major-version.minor-version`, as in `1.10`. If the minor version is
// omitted, it defaults to zero. If the entire version field is empty, the
@@ -54,11 +56,11 @@
Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"`
// Source context for the protocol buffer service represented by this
// message.
- SourceContext *SourceContext `protobuf:"bytes,5,opt,name=source_context,json=sourceContext,proto3" json:"source_context,omitempty"`
+ SourceContext *sourcecontextpb.SourceContext `protobuf:"bytes,5,opt,name=source_context,json=sourceContext,proto3" json:"source_context,omitempty"`
// Included interfaces. See [Mixin][].
Mixins []*Mixin `protobuf:"bytes,6,rep,name=mixins,proto3" json:"mixins,omitempty"`
// The source syntax of the service.
- Syntax Syntax `protobuf:"varint,7,opt,name=syntax,proto3,enum=google.protobuf.Syntax" json:"syntax,omitempty"`
+ Syntax typepb.Syntax `protobuf:"varint,7,opt,name=syntax,proto3,enum=google.protobuf.Syntax" json:"syntax,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized protoimpl.UnknownFields `json:"-"`
XXX_sizecache protoimpl.SizeCache `json:"-"`
@@ -101,7 +103,7 @@
return nil
}
-func (x *Api) GetOptions() []*Option {
+func (x *Api) GetOptions() []*typepb.Option {
if x != nil {
return x.Options
}
@@ -115,7 +117,7 @@
return ""
}
-func (x *Api) GetSourceContext() *SourceContext {
+func (x *Api) GetSourceContext() *sourcecontextpb.SourceContext {
if x != nil {
return x.SourceContext
}
@@ -129,11 +131,11 @@
return nil
}
-func (x *Api) GetSyntax() Syntax {
+func (x *Api) GetSyntax() typepb.Syntax {
if x != nil {
return x.Syntax
}
- return Syntax_SYNTAX_PROTO2
+ return typepb.Syntax_SYNTAX_PROTO2
}
// Method represents a method of an API interface.
@@ -149,9 +151,9 @@
// If true, the response is streamed.
ResponseStreaming bool `protobuf:"varint,5,opt,name=response_streaming,json=responseStreaming,proto3" json:"response_streaming,omitempty"`
// Any metadata attached to the method.
- Options []*Option `protobuf:"bytes,6,rep,name=options,proto3" json:"options,omitempty"`
+ Options []*typepb.Option `protobuf:"bytes,6,rep,name=options,proto3" json:"options,omitempty"`
// The source syntax of this method.
- Syntax Syntax `protobuf:"varint,7,opt,name=syntax,proto3,enum=google.protobuf.Syntax" json:"syntax,omitempty"`
+ Syntax typepb.Syntax `protobuf:"varint,7,opt,name=syntax,proto3,enum=google.protobuf.Syntax" json:"syntax,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized protoimpl.UnknownFields `json:"-"`
XXX_sizecache protoimpl.SizeCache `json:"-"`
@@ -215,18 +217,18 @@
return false
}
-func (x *Method) GetOptions() []*Option {
+func (x *Method) GetOptions() []*typepb.Option {
if x != nil {
return x.Options
}
return nil
}
-func (x *Method) GetSyntax() Syntax {
+func (x *Method) GetSyntax() typepb.Syntax {
if x != nil {
return x.Syntax
}
- return Syntax_SYNTAX_PROTO2
+ return typepb.Syntax_SYNTAX_PROTO2
}
// Declares an API Interface to be included in this interface. The including
@@ -407,15 +409,15 @@
0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x22, 0x2f, 0x0a, 0x05, 0x4d, 0x69, 0x78, 0x69, 0x6e,
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01,
- 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x42, 0x7c, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e,
+ 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x42, 0x76, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42,
- 0x08, 0x41, 0x70, 0x69, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67, 0x6f, 0x6f,
+ 0x08, 0x41, 0x70, 0x69, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e,
- 0x6f, 0x77, 0x6e, 0x3b, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xa2,
- 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50,
- 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77,
- 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x6f, 0x77, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x70, 0x62, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa,
+ 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
+ 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73,
+ 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -432,12 +434,12 @@
var file_google_protobuf_api_proto_msgTypes = make([]protoimpl.MessageType, 3)
var file_google_protobuf_api_proto_goTypes = []interface{}{
- (*Api)(nil), // 0: google.protobuf.Api
- (*Method)(nil), // 1: google.protobuf.Method
- (*Mixin)(nil), // 2: google.protobuf.Mixin
- (*Option)(nil), // 3: google.protobuf.Option
- (*SourceContext)(nil), // 4: google.protobuf.SourceContext
- (Syntax)(0), // 5: google.protobuf.Syntax
+ (*Api)(nil), // 0: google.protobuf.Api
+ (*Method)(nil), // 1: google.protobuf.Method
+ (*Mixin)(nil), // 2: google.protobuf.Mixin
+ (*typepb.Option)(nil), // 3: google.protobuf.Option
+ (*sourcecontextpb.SourceContext)(nil), // 4: google.protobuf.SourceContext
+ (typepb.Syntax)(0), // 5: google.protobuf.Syntax
}
var file_google_protobuf_api_proto_depIdxs = []int32{
1, // google.protobuf.Api.methods:type_name -> google.protobuf.Method
@@ -454,8 +456,6 @@
if File_google_protobuf_api_proto != nil {
return
}
- file_google_protobuf_source_context_proto_init()
- file_google_protobuf_type_proto_init()
File_google_protobuf_api_proto = protoimpl.FileBuilder{
RawDescriptor: file_google_protobuf_api_proto_rawDesc,
GoTypes: file_google_protobuf_api_proto_goTypes,
diff --git a/types/known/duration.pb.go b/types/known/durationpb/duration.pb.go
similarity index 92%
rename from types/known/duration.pb.go
rename to types/known/durationpb/duration.pb.go
index 281a6c9..acd84b9 100644
--- a/types/known/duration.pb.go
+++ b/types/known/durationpb/duration.pb.go
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/duration.proto
-package known_proto
+package durationpb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@@ -138,16 +138,16 @@
0x66, 0x22, 0x3a, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a,
0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07,
0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73,
- 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, 0x84, 0x01,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, 0x83, 0x01,
0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0d, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50,
- 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67,
+ 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67,
0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
- 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x3b, 0x6b,
- 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03,
- 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f,
- 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54,
- 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x64,
+ 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47,
+ 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74,
+ 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79,
+ 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/types/known/empty.pb.go b/types/known/emptypb/empty.pb.go
similarity index 79%
rename from types/known/empty.pb.go
rename to types/known/emptypb/empty.pb.go
index e6fdc03..336bfb5 100644
--- a/types/known/empty.pb.go
+++ b/types/known/emptypb/empty.pb.go
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/empty.proto
-package known_proto
+package emptypb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@@ -59,16 +59,15 @@
0x0a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x07,
- 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x81, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e,
- 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42,
- 0x0a, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67,
- 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67,
- 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f,
- 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x3b, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f,
- 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c,
- 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x33,
+ 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x7d, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67,
+ 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0a,
+ 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x6f,
+ 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b,
+ 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2,
+ 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50,
+ 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77,
+ 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/types/known/field_mask.pb.go b/types/known/fieldmaskpb/field_mask.pb.go
similarity index 97%
rename from types/known/field_mask.pb.go
rename to types/known/fieldmaskpb/field_mask.pb.go
index e867db5..d7d18ac 100644
--- a/types/known/field_mask.pb.go
+++ b/types/known/fieldmaskpb/field_mask.pb.go
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/field_mask.proto
-package known_proto
+package fieldmaskpb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@@ -263,8 +263,8 @@
0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e,
0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70,
- 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x3b, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e,
+ 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x6d, 0x61,
+ 0x73, 0x6b, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e,
0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
diff --git a/types/known/source_context.pb.go b/types/known/sourcecontextpb/source_context.pb.go
similarity index 89%
rename from types/known/source_context.pb.go
rename to types/known/sourcecontextpb/source_context.pb.go
index b6e61dd..8fd0efe 100644
--- a/types/known/source_context.pb.go
+++ b/types/known/sourcecontextpb/source_context.pb.go
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/source_context.proto
-package known_proto
+package sourcecontextpb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@@ -63,16 +63,16 @@
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x2c, 0x0a, 0x0d, 0x53, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65,
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c,
- 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x86, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f,
+ 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x8a, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x12, 0x53,
0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x50, 0x72, 0x6f, 0x74,
- 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61,
+ 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61,
0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f,
- 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x3b, 0x6b, 0x6e, 0x6f, 0x77,
- 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e,
- 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
- 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06,
- 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x73, 0x6f, 0x75, 0x72,
+ 0x63, 0x65, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x70, 0x62, 0xa2, 0x02, 0x03, 0x47, 0x50,
+ 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f,
+ 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70,
+ 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/types/known/struct.pb.go b/types/known/structpb/struct.pb.go
similarity index 93%
rename from types/known/struct.pb.go
rename to types/known/structpb/struct.pb.go
index 1721cb0..08d31bf 100644
--- a/types/known/struct.pb.go
+++ b/types/known/structpb/struct.pb.go
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/struct.proto
-package known_proto
+package structpb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@@ -343,16 +343,16 @@
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56,
0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2a, 0x1b, 0x0a, 0x09,
0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x55, 0x4c,
- 0x4c, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x00, 0x42, 0x82, 0x01, 0x0a, 0x13, 0x63, 0x6f,
- 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
- 0x66, 0x42, 0x0b, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
- 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e,
- 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70,
- 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x3b, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e,
- 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
- 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06,
- 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x4c, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x00, 0x42, 0x7f, 0x0a, 0x13, 0x63, 0x6f, 0x6d,
+ 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
+ 0x42, 0x0b, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a,
+ 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f,
+ 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65,
+ 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x70, 0x62,
+ 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67,
+ 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c,
+ 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x33,
}
var (
diff --git a/types/known/stub.go b/types/known/stub.go
new file mode 100644
index 0000000..9e1b5e9
--- /dev/null
+++ b/types/known/stub.go
@@ -0,0 +1,58 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// TODO: This file exists to have the minimum number of forwarding declarations
+// to keep v1 working. This will be deleted in the near future.
+
+package known_proto
+
+import (
+ "google.golang.org/protobuf/types/known/anypb"
+ "google.golang.org/protobuf/types/known/durationpb"
+ "google.golang.org/protobuf/types/known/emptypb"
+ "google.golang.org/protobuf/types/known/structpb"
+ "google.golang.org/protobuf/types/known/timestamppb"
+ "google.golang.org/protobuf/types/known/wrapperspb"
+)
+
+type (
+ Any = anypb.Any
+ BoolValue = wrapperspb.BoolValue
+ BytesValue = wrapperspb.BytesValue
+ DoubleValue = wrapperspb.DoubleValue
+ Duration = durationpb.Duration
+ Empty = emptypb.Empty
+ FloatValue = wrapperspb.FloatValue
+ Int32Value = wrapperspb.Int32Value
+ Int64Value = wrapperspb.Int64Value
+ ListValue = structpb.ListValue
+ NullValue = structpb.NullValue
+ StringValue = wrapperspb.StringValue
+ Struct = structpb.Struct
+ Timestamp = timestamppb.Timestamp
+ UInt32Value = wrapperspb.UInt32Value
+ UInt64Value = wrapperspb.UInt64Value
+ Value = structpb.Value
+ Value_BoolValue = structpb.Value_BoolValue
+ Value_ListValue = structpb.Value_ListValue
+ Value_NullValue = structpb.Value_NullValue
+ Value_NumberValue = structpb.Value_NumberValue
+ Value_StringValue = structpb.Value_StringValue
+ Value_StructValue = structpb.Value_StructValue
+)
+
+const (
+ NullValue_NULL_VALUE = structpb.NullValue_NULL_VALUE
+)
+
+var (
+ File_google_protobuf_any_proto = anypb.File_google_protobuf_any_proto
+ File_google_protobuf_duration_proto = durationpb.File_google_protobuf_duration_proto
+ File_google_protobuf_empty_proto = emptypb.File_google_protobuf_empty_proto
+ File_google_protobuf_struct_proto = structpb.File_google_protobuf_struct_proto
+ File_google_protobuf_timestamp_proto = timestamppb.File_google_protobuf_timestamp_proto
+ File_google_protobuf_wrappers_proto = wrapperspb.File_google_protobuf_wrappers_proto
+ NullValue_name = structpb.NullValue_name
+ NullValue_value = structpb.NullValue_value
+)
diff --git a/types/known/timestamp.pb.go b/types/known/timestamppb/timestamp.pb.go
similarity index 98%
rename from types/known/timestamp.pb.go
rename to types/known/timestamppb/timestamp.pb.go
index 827d5fe..843d8a1 100644
--- a/types/known/timestamp.pb.go
+++ b/types/known/timestamppb/timestamp.pb.go
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/timestamp.proto
-package known_proto
+package timestamppb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@@ -164,7 +164,7 @@
0x6d, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77,
- 0x6e, 0x3b, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xf8, 0x01, 0x01,
+ 0x6e, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x70, 0x62, 0xf8, 0x01, 0x01,
0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f,
0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
diff --git a/types/known/type.pb.go b/types/known/typepb/type.pb.go
similarity index 92%
rename from types/known/type.pb.go
rename to types/known/typepb/type.pb.go
index f2588a7..6aabc9a 100644
--- a/types/known/type.pb.go
+++ b/types/known/typepb/type.pb.go
@@ -1,13 +1,15 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/type.proto
-package known_proto
+package typepb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoregistry "google.golang.org/protobuf/reflect/protoregistry"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ anypb "google.golang.org/protobuf/types/known/anypb"
+ sourcecontextpb "google.golang.org/protobuf/types/known/sourcecontextpb"
sync "sync"
)
@@ -232,7 +234,7 @@
// The protocol buffer options.
Options []*Option `protobuf:"bytes,4,rep,name=options,proto3" json:"options,omitempty"`
// The source context.
- SourceContext *SourceContext `protobuf:"bytes,5,opt,name=source_context,json=sourceContext,proto3" json:"source_context,omitempty"`
+ SourceContext *sourcecontextpb.SourceContext `protobuf:"bytes,5,opt,name=source_context,json=sourceContext,proto3" json:"source_context,omitempty"`
// The source syntax.
Syntax Syntax `protobuf:"varint,6,opt,name=syntax,proto3,enum=google.protobuf.Syntax" json:"syntax,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -291,7 +293,7 @@
return nil
}
-func (x *Type) GetSourceContext() *SourceContext {
+func (x *Type) GetSourceContext() *sourcecontextpb.SourceContext {
if x != nil {
return x.SourceContext
}
@@ -436,7 +438,7 @@
// Protocol buffer options.
Options []*Option `protobuf:"bytes,3,rep,name=options,proto3" json:"options,omitempty"`
// The source context.
- SourceContext *SourceContext `protobuf:"bytes,4,opt,name=source_context,json=sourceContext,proto3" json:"source_context,omitempty"`
+ SourceContext *sourcecontextpb.SourceContext `protobuf:"bytes,4,opt,name=source_context,json=sourceContext,proto3" json:"source_context,omitempty"`
// The source syntax.
Syntax Syntax `protobuf:"varint,5,opt,name=syntax,proto3,enum=google.protobuf.Syntax" json:"syntax,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -488,7 +490,7 @@
return nil
}
-func (x *Enum) GetSourceContext() *SourceContext {
+func (x *Enum) GetSourceContext() *sourcecontextpb.SourceContext {
if x != nil {
return x.SourceContext
}
@@ -571,7 +573,7 @@
// the corresponding wrapper type defined in google/protobuf/wrappers.proto
// should be used. If the value is an enum, it should be stored as an int32
// value using the google.protobuf.Int32Value type.
- Value *Any `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+ Value *anypb.Any `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized protoimpl.UnknownFields `json:"-"`
XXX_sizecache protoimpl.SizeCache `json:"-"`
@@ -607,7 +609,7 @@
return ""
}
-func (x *Option) GetValue() *Any {
+func (x *Option) GetValue() *anypb.Any {
if x != nil {
return x.Value
}
@@ -722,16 +724,16 @@
0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x2e, 0x0a,
0x06, 0x53, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x59, 0x4e, 0x54, 0x41,
0x58, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x32, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x59,
- 0x4e, 0x54, 0x41, 0x58, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x33, 0x10, 0x01, 0x42, 0x80, 0x01,
- 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x09, 0x54, 0x79, 0x70, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f,
- 0x50, 0x01, 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e,
- 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74,
- 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x3b, 0x6b, 0x6e, 0x6f, 0x77, 0x6e,
- 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa,
- 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
- 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73,
- 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x4e, 0x54, 0x41, 0x58, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x33, 0x10, 0x01, 0x42, 0x7b, 0x0a,
+ 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x62, 0x75, 0x66, 0x42, 0x09, 0x54, 0x79, 0x70, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50,
+ 0x01, 0x5a, 0x2d, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67,
+ 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79,
+ 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x70, 0x62,
+ 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67,
+ 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c,
+ 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x33,
}
var (
@@ -749,16 +751,16 @@
var file_google_protobuf_type_proto_enumTypes = make([]protoreflect.EnumType, 3)
var file_google_protobuf_type_proto_msgTypes = make([]protoimpl.MessageType, 5)
var file_google_protobuf_type_proto_goTypes = []interface{}{
- (Syntax)(0), // 0: google.protobuf.Syntax
- (Field_Kind)(0), // 1: google.protobuf.Field.Kind
- (Field_Cardinality)(0), // 2: google.protobuf.Field.Cardinality
- (*Type)(nil), // 3: google.protobuf.Type
- (*Field)(nil), // 4: google.protobuf.Field
- (*Enum)(nil), // 5: google.protobuf.Enum
- (*EnumValue)(nil), // 6: google.protobuf.EnumValue
- (*Option)(nil), // 7: google.protobuf.Option
- (*SourceContext)(nil), // 8: google.protobuf.SourceContext
- (*Any)(nil), // 9: google.protobuf.Any
+ (Syntax)(0), // 0: google.protobuf.Syntax
+ (Field_Kind)(0), // 1: google.protobuf.Field.Kind
+ (Field_Cardinality)(0), // 2: google.protobuf.Field.Cardinality
+ (*Type)(nil), // 3: google.protobuf.Type
+ (*Field)(nil), // 4: google.protobuf.Field
+ (*Enum)(nil), // 5: google.protobuf.Enum
+ (*EnumValue)(nil), // 6: google.protobuf.EnumValue
+ (*Option)(nil), // 7: google.protobuf.Option
+ (*sourcecontextpb.SourceContext)(nil), // 8: google.protobuf.SourceContext
+ (*anypb.Any)(nil), // 9: google.protobuf.Any
}
var file_google_protobuf_type_proto_depIdxs = []int32{
4, // google.protobuf.Type.fields:type_name -> google.protobuf.Field
@@ -781,8 +783,6 @@
if File_google_protobuf_type_proto != nil {
return
}
- file_google_protobuf_any_proto_init()
- file_google_protobuf_source_context_proto_init()
File_google_protobuf_type_proto = protoimpl.FileBuilder{
RawDescriptor: file_google_protobuf_type_proto_rawDesc,
GoTypes: file_google_protobuf_type_proto_goTypes,
diff --git a/types/known/wrappers.pb.go b/types/known/wrapperspb/wrappers.pb.go
similarity index 96%
rename from types/known/wrappers.pb.go
rename to types/known/wrapperspb/wrappers.pb.go
index 9cc022a..125b653 100644
--- a/types/known/wrappers.pb.go
+++ b/types/known/wrapperspb/wrappers.pb.go
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/wrappers.proto
-package known_proto
+package wrapperspb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@@ -426,16 +426,16 @@
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c,
0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
- 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x84, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d,
+ 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x83, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d,
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x42, 0x0d, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50,
- 0x01, 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67,
+ 0x01, 0x5a, 0x31, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67,
0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79,
- 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x3b, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f,
- 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02,
- 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
- 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62,
- 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65,
+ 0x72, 0x73, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e,
+ 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
+ 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/types/plugin/stub.go b/types/plugin/stub.go
new file mode 100644
index 0000000..f6d87c6
--- /dev/null
+++ b/types/plugin/stub.go
@@ -0,0 +1,21 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// TODO: This file exists to have the minimum number of forwarding declarations
+// to keep v1 working. This will be deleted in the near future.
+
+package plugin_proto
+
+import "google.golang.org/protobuf/types/pluginpb"
+
+type (
+ CodeGeneratorRequest = pluginpb.CodeGeneratorRequest
+ CodeGeneratorResponse = pluginpb.CodeGeneratorResponse
+ CodeGeneratorResponse_File = pluginpb.CodeGeneratorResponse_File
+ Version = pluginpb.Version
+)
+
+var (
+ File_google_protobuf_compiler_plugin_proto = pluginpb.File_google_protobuf_compiler_plugin_proto
+)
diff --git a/types/plugin/plugin.pb.go b/types/pluginpb/plugin.pb.go
similarity index 94%
rename from types/plugin/plugin.pb.go
rename to types/pluginpb/plugin.pb.go
index f968d59..1f422c4 100644
--- a/types/plugin/plugin.pb.go
+++ b/types/pluginpb/plugin.pb.go
@@ -1,14 +1,14 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/compiler/plugin.proto
-package plugin_proto
+package pluginpb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoregistry "google.golang.org/protobuf/reflect/protoregistry"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- descriptor "google.golang.org/protobuf/types/descriptor"
+ descriptorpb "google.golang.org/protobuf/types/descriptorpb"
sync "sync"
)
@@ -100,7 +100,7 @@
//
// Type names of fields and extensions in the FileDescriptorProto are always
// fully qualified.
- ProtoFile []*descriptor.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file,json=protoFile" json:"proto_file,omitempty"`
+ ProtoFile []*descriptorpb.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file,json=protoFile" json:"proto_file,omitempty"`
// The version number of protocol compiler.
CompilerVersion *Version `protobuf:"bytes,3,opt,name=compiler_version,json=compilerVersion" json:"compiler_version,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -145,7 +145,7 @@
return ""
}
-func (x *CodeGeneratorRequest) GetProtoFile() []*descriptor.FileDescriptorProto {
+func (x *CodeGeneratorRequest) GetProtoFile() []*descriptorpb.FileDescriptorProto {
if x != nil {
return x.ProtoFile
}
@@ -360,13 +360,12 @@
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x69, 0x6e, 0x73,
0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63,
0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f,
- 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x42, 0x62, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f,
+ 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x42, 0x57, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d,
0x70, 0x69, 0x6c, 0x65, 0x72, 0x42, 0x0c, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f,
- 0x74, 0x6f, 0x73, 0x5a, 0x34, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61,
+ 0x74, 0x6f, 0x73, 0x5a, 0x29, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61,
0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f,
- 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x3b, 0x70, 0x6c, 0x75,
- 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x70, 0x62,
}
var (
@@ -383,11 +382,11 @@
var file_google_protobuf_compiler_plugin_proto_msgTypes = make([]protoimpl.MessageType, 4)
var file_google_protobuf_compiler_plugin_proto_goTypes = []interface{}{
- (*Version)(nil), // 0: google.protobuf.compiler.Version
- (*CodeGeneratorRequest)(nil), // 1: google.protobuf.compiler.CodeGeneratorRequest
- (*CodeGeneratorResponse)(nil), // 2: google.protobuf.compiler.CodeGeneratorResponse
- (*CodeGeneratorResponse_File)(nil), // 3: google.protobuf.compiler.CodeGeneratorResponse.File
- (*descriptor.FileDescriptorProto)(nil), // 4: google.protobuf.FileDescriptorProto
+ (*Version)(nil), // 0: google.protobuf.compiler.Version
+ (*CodeGeneratorRequest)(nil), // 1: google.protobuf.compiler.CodeGeneratorRequest
+ (*CodeGeneratorResponse)(nil), // 2: google.protobuf.compiler.CodeGeneratorResponse
+ (*CodeGeneratorResponse_File)(nil), // 3: google.protobuf.compiler.CodeGeneratorResponse.File
+ (*descriptorpb.FileDescriptorProto)(nil), // 4: google.protobuf.FileDescriptorProto
}
var file_google_protobuf_compiler_plugin_proto_depIdxs = []int32{
4, // google.protobuf.compiler.CodeGeneratorRequest.proto_file:type_name -> google.protobuf.FileDescriptorProto