From cf81e67b53dcc6c4317c057841f49a54a7b32463 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 28 Feb 2019 14:08:31 -0800 Subject: [PATCH] cmd/protoc-gen-go: use protoapi.CompressGZIP Calling a helper function directly should reduce binary bloat slightly. Change-Id: I6068dc4cd00c8d90d2e6e6d99633b81388bc8781 Reviewed-on: https://go-review.googlesource.com/c/164679 Reviewed-by: Damien Neil --- cmd/protoc-gen-go/internal_gengo/main.go | 16 +++------------- .../testdata/annotations/annotations.pb.go | 11 ++--------- .../testdata/comments/comments.pb.go | 11 ++--------- .../testdata/comments/deprecated.pb.go | 11 ++--------- .../testdata/extensions/base/base.pb.go | 11 ++--------- .../testdata/extensions/ext/ext.pb.go | 11 ++--------- .../testdata/extensions/extra/extra.pb.go | 11 ++--------- .../testdata/extensions/proto3/ext3.pb.go | 11 ++--------- .../testdata/fieldnames/fieldnames.pb.go | 11 ++--------- cmd/protoc-gen-go/testdata/import_public/a.pb.go | 11 ++--------- cmd/protoc-gen-go/testdata/import_public/b.pb.go | 11 ++--------- .../testdata/import_public/sub/a.pb.go | 11 ++--------- .../testdata/import_public/sub/b.pb.go | 11 ++--------- .../testdata/import_public/sub2/a.pb.go | 11 ++--------- cmd/protoc-gen-go/testdata/imports/fmt/m.pb.go | 11 ++--------- .../testdata/imports/test_a_1/m1.pb.go | 11 ++--------- .../testdata/imports/test_a_1/m2.pb.go | 11 ++--------- .../testdata/imports/test_a_2/m3.pb.go | 11 ++--------- .../testdata/imports/test_a_2/m4.pb.go | 11 ++--------- .../testdata/imports/test_b_1/m1.pb.go | 11 ++--------- .../testdata/imports/test_b_1/m2.pb.go | 11 ++--------- .../testdata/imports/test_import_a1m1.pb.go | 11 ++--------- .../testdata/imports/test_import_a1m2.pb.go | 11 ++--------- .../testdata/imports/test_import_all.pb.go | 11 ++--------- .../testdata/issue780_oneof_conflict/test.pb.go | 11 ++--------- .../testdata/nopackage/nopackage.pb.go | 11 ++--------- cmd/protoc-gen-go/testdata/proto2/enum.pb.go | 11 ++--------- cmd/protoc-gen-go/testdata/proto2/fields.pb.go | 11 ++--------- .../testdata/proto2/nested_messages.pb.go | 11 ++--------- cmd/protoc-gen-go/testdata/proto2/proto2.pb.go | 11 ++--------- cmd/protoc-gen-go/testdata/proto3/enum.pb.go | 11 ++--------- cmd/protoc-gen-go/testdata/proto3/fields.pb.go | 11 ++--------- encoding/testprotos/pb2/test.pb.go | 11 ++--------- encoding/testprotos/pb3/test.pb.go | 11 ++--------- go.mod | 2 +- go.sum | 4 ++-- internal/testprotos/test/test.pb.go | 11 ++--------- internal/testprotos/test/test_import.pb.go | 11 ++--------- internal/testprotos/test/test_public.pb.go | 11 ++--------- internal/testprotos/test/test_weak.pb.go | 11 ++--------- reflect/protoregistry/testprotos/test.pb.go | 11 ++--------- types/descriptor/descriptor.pb.go | 10 +--------- types/plugin/plugin.pb.go | 11 ++--------- 43 files changed, 85 insertions(+), 376 deletions(-) diff --git a/cmd/protoc-gen-go/internal_gengo/main.go b/cmd/protoc-gen-go/internal_gengo/main.go index e842e6ee..5357224c 100644 --- a/cmd/protoc-gen-go/internal_gengo/main.go +++ b/cmd/protoc-gen-go/internal_gengo/main.go @@ -34,8 +34,6 @@ import ( const generatedCodeVersion = 3 const ( - bytesPackage = protogen.GoImportPath("bytes") - gzipPackage = protogen.GoImportPath("compress/gzip") mathPackage = protogen.GoImportPath("math") protoPackage = protogen.GoImportPath("github.com/golang/protobuf/proto") protoapiPackage = protogen.GoImportPath("github.com/golang/protobuf/protoapi") @@ -279,17 +277,9 @@ func genFileDescriptor(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileI g.P("}") g.P() - // TODO: Add a helper function in protoapi or protoimpl? - // This function would probably encode the input lazily upon first use. - // Currently, the GZIPed form is used eagerly in v1 registration. - // See https://play.golang.org/p/_atJHs0izTH - g.P("var ", f.descriptorGzipVar, " = func() []byte {") - g.P("bb := new(", bytesPackage.Ident("Buffer"), ")") - g.P("zw, _ := ", gzipPackage.Ident("NewWriterLevel"), "(bb, ", gzipPackage.Ident("NoCompression"), ")") - g.P("zw.Write(", f.descriptorRawVar, ")") - g.P("zw.Close()") - g.P("return bb.Bytes()") - g.P("}()") + // TODO: Modify CompressGZIP to lazy encode? Currently, the GZIP'd form + // is eagerly registered in v1, preventing any benefit from lazy encoding. + g.P("var ", f.descriptorGzipVar, " = ", protoapiPackage.Ident("CompressGZIP"), "(", f.descriptorRawVar, ")") g.P() } diff --git a/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go b/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go index b5bc3277..4044ee7c 100644 --- a/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go +++ b/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go @@ -4,9 +4,8 @@ package annotations import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -131,13 +130,7 @@ var fileDescriptor_21dfaf6fd39fa3b7 = []byte{ 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, } -var fileDescriptor_21dfaf6fd39fa3b7_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_21dfaf6fd39fa3b7) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_21dfaf6fd39fa3b7_gzipped = protoapi.CompressGZIP(fileDescriptor_21dfaf6fd39fa3b7) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/comments/comments.pb.go b/cmd/protoc-gen-go/testdata/comments/comments.pb.go index 115866df..164fa39c 100644 --- a/cmd/protoc-gen-go/testdata/comments/comments.pb.go +++ b/cmd/protoc-gen-go/testdata/comments/comments.pb.go @@ -6,9 +6,8 @@ package comments import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -307,13 +306,7 @@ var fileDescriptor_885e8293f1fab554 = []byte{ 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, } -var fileDescriptor_885e8293f1fab554_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_885e8293f1fab554) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_885e8293f1fab554_gzipped = protoapi.CompressGZIP(fileDescriptor_885e8293f1fab554) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/comments/deprecated.pb.go b/cmd/protoc-gen-go/testdata/comments/deprecated.pb.go index 1169c3c9..6a662d90 100644 --- a/cmd/protoc-gen-go/testdata/comments/deprecated.pb.go +++ b/cmd/protoc-gen-go/testdata/comments/deprecated.pb.go @@ -4,9 +4,8 @@ package comments import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -116,13 +115,7 @@ var fileDescriptor_0336e614ee2de5f7 = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var fileDescriptor_0336e614ee2de5f7_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_0336e614ee2de5f7) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_0336e614ee2de5f7_gzipped = protoapi.CompressGZIP(fileDescriptor_0336e614ee2de5f7) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/extensions/base/base.pb.go b/cmd/protoc-gen-go/testdata/extensions/base/base.pb.go index f6f192ad..2fa4f037 100644 --- a/cmd/protoc-gen-go/testdata/extensions/base/base.pb.go +++ b/cmd/protoc-gen-go/testdata/extensions/base/base.pb.go @@ -4,9 +4,8 @@ package base import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -138,13 +137,7 @@ var fileDescriptor_aebb28f8d5a04466 = []byte{ 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, } -var fileDescriptor_aebb28f8d5a04466_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_aebb28f8d5a04466) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_aebb28f8d5a04466_gzipped = protoapi.CompressGZIP(fileDescriptor_aebb28f8d5a04466) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/extensions/ext/ext.pb.go b/cmd/protoc-gen-go/testdata/extensions/ext/ext.pb.go index 64cc3d27..a8f9c0d2 100644 --- a/cmd/protoc-gen-go/testdata/extensions/ext/ext.pb.go +++ b/cmd/protoc-gen-go/testdata/extensions/ext/ext.pb.go @@ -4,9 +4,8 @@ package ext import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" base "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/extensions/base" extra "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/extensions/extra" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" @@ -1146,13 +1145,7 @@ var fileDescriptor_bf470ef4907b23cb = []byte{ 0x2f, 0x65, 0x78, 0x74, } -var fileDescriptor_bf470ef4907b23cb_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_bf470ef4907b23cb) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_bf470ef4907b23cb_gzipped = protoapi.CompressGZIP(fileDescriptor_bf470ef4907b23cb) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/extensions/extra/extra.pb.go b/cmd/protoc-gen-go/testdata/extensions/extra/extra.pb.go index 239dcfa4..8394cc6c 100644 --- a/cmd/protoc-gen-go/testdata/extensions/extra/extra.pb.go +++ b/cmd/protoc-gen-go/testdata/extensions/extra/extra.pb.go @@ -4,9 +4,8 @@ package extra import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -80,13 +79,7 @@ var fileDescriptor_496c2a5e9c1e8739 = []byte{ 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x65, 0x78, 0x74, 0x72, 0x61, } -var fileDescriptor_496c2a5e9c1e8739_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_496c2a5e9c1e8739) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_496c2a5e9c1e8739_gzipped = protoapi.CompressGZIP(fileDescriptor_496c2a5e9c1e8739) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) 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 3af3513e..8a66c05b 100644 --- a/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.pb.go +++ b/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.pb.go @@ -4,9 +4,8 @@ package proto3 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" @@ -637,13 +636,7 @@ var fileDescriptor_3db31bb248c8865e = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var fileDescriptor_3db31bb248c8865e_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_3db31bb248c8865e) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_3db31bb248c8865e_gzipped = protoapi.CompressGZIP(fileDescriptor_3db31bb248c8865e) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.pb.go b/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.pb.go index aef8ce02..152119cb 100644 --- a/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.pb.go +++ b/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.pb.go @@ -4,9 +4,8 @@ package fieldnames import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -380,13 +379,7 @@ var fileDescriptor_6bbe3f70febb9403 = []byte{ 0x66, 0x69, 0x65, 0x6c, 0x64, 0x6e, 0x61, 0x6d, 0x65, 0x73, } -var fileDescriptor_6bbe3f70febb9403_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_6bbe3f70febb9403) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_6bbe3f70febb9403_gzipped = protoapi.CompressGZIP(fileDescriptor_6bbe3f70febb9403) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/import_public/a.pb.go b/cmd/protoc-gen-go/testdata/import_public/a.pb.go index 88c2a767..46a7c2bf 100644 --- a/cmd/protoc-gen-go/testdata/import_public/a.pb.go +++ b/cmd/protoc-gen-go/testdata/import_public/a.pb.go @@ -4,9 +4,8 @@ package import_public import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" sub "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub" sub2 "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub2" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" @@ -153,13 +152,7 @@ var fileDescriptor_73b7577c95fa6b70 = []byte{ 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x50, 0x00, 0x50, 0x01, 0x50, 0x02, } -var fileDescriptor_73b7577c95fa6b70_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_73b7577c95fa6b70) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_73b7577c95fa6b70_gzipped = protoapi.CompressGZIP(fileDescriptor_73b7577c95fa6b70) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/import_public/b.pb.go b/cmd/protoc-gen-go/testdata/import_public/b.pb.go index ce1027ac..6664f12d 100644 --- a/cmd/protoc-gen-go/testdata/import_public/b.pb.go +++ b/cmd/protoc-gen-go/testdata/import_public/b.pb.go @@ -4,9 +4,8 @@ package import_public import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" sub "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" @@ -95,13 +94,7 @@ var fileDescriptor_84995586b3d09710 = []byte{ 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, } -var fileDescriptor_84995586b3d09710_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_84995586b3d09710) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_84995586b3d09710_gzipped = protoapi.CompressGZIP(fileDescriptor_84995586b3d09710) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/import_public/sub/a.pb.go b/cmd/protoc-gen-go/testdata/import_public/sub/a.pb.go index 981bf902..40daaa96 100644 --- a/cmd/protoc-gen-go/testdata/import_public/sub/a.pb.go +++ b/cmd/protoc-gen-go/testdata/import_public/sub/a.pb.go @@ -4,9 +4,8 @@ package sub import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" sub2 "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub2" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" @@ -438,13 +437,7 @@ var fileDescriptor_382f7805394b5c4e = []byte{ 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x73, 0x75, 0x62, 0x50, 0x01, } -var fileDescriptor_382f7805394b5c4e_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_382f7805394b5c4e) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_382f7805394b5c4e_gzipped = protoapi.CompressGZIP(fileDescriptor_382f7805394b5c4e) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/import_public/sub/b.pb.go b/cmd/protoc-gen-go/testdata/import_public/sub/b.pb.go index 7a006090..5c375e01 100644 --- a/cmd/protoc-gen-go/testdata/import_public/sub/b.pb.go +++ b/cmd/protoc-gen-go/testdata/import_public/sub/b.pb.go @@ -4,9 +4,8 @@ package sub import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -71,13 +70,7 @@ var fileDescriptor_fc66afda3d7c2232 = []byte{ 0x62, } -var fileDescriptor_fc66afda3d7c2232_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_fc66afda3d7c2232) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_fc66afda3d7c2232_gzipped = protoapi.CompressGZIP(fileDescriptor_fc66afda3d7c2232) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/import_public/sub2/a.pb.go b/cmd/protoc-gen-go/testdata/import_public/sub2/a.pb.go index bd2e8223..ae05e825 100644 --- a/cmd/protoc-gen-go/testdata/import_public/sub2/a.pb.go +++ b/cmd/protoc-gen-go/testdata/import_public/sub2/a.pb.go @@ -4,9 +4,8 @@ package sub2 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -71,13 +70,7 @@ var fileDescriptor_7ac53d99328778ac = []byte{ 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x73, 0x75, 0x62, 0x32, } -var fileDescriptor_7ac53d99328778ac_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_7ac53d99328778ac) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_7ac53d99328778ac_gzipped = protoapi.CompressGZIP(fileDescriptor_7ac53d99328778ac) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/imports/fmt/m.pb.go b/cmd/protoc-gen-go/testdata/imports/fmt/m.pb.go index 62b60aef..184c3752 100644 --- a/cmd/protoc-gen-go/testdata/imports/fmt/m.pb.go +++ b/cmd/protoc-gen-go/testdata/imports/fmt/m.pb.go @@ -4,9 +4,8 @@ package fmt import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -68,13 +67,7 @@ var fileDescriptor_72c126fcd452e392 = []byte{ 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var fileDescriptor_72c126fcd452e392_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_72c126fcd452e392) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_72c126fcd452e392_gzipped = protoapi.CompressGZIP(fileDescriptor_72c126fcd452e392) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go b/cmd/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go index bdab9b34..a8e7e930 100644 --- a/cmd/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go +++ b/cmd/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go @@ -4,9 +4,8 @@ package test_a_1 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -145,13 +144,7 @@ var fileDescriptor_c1091de3fa870a14 = []byte{ 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var fileDescriptor_c1091de3fa870a14_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_c1091de3fa870a14) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_c1091de3fa870a14_gzipped = protoapi.CompressGZIP(fileDescriptor_c1091de3fa870a14) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go b/cmd/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go index e71523e6..318bffa5 100644 --- a/cmd/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go +++ b/cmd/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go @@ -4,9 +4,8 @@ package test_a_1 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -69,13 +68,7 @@ var fileDescriptor_20cf27515c0d621c = []byte{ 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var fileDescriptor_20cf27515c0d621c_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_20cf27515c0d621c) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_20cf27515c0d621c_gzipped = protoapi.CompressGZIP(fileDescriptor_20cf27515c0d621c) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go b/cmd/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go index 7280b96f..bedc1b36 100644 --- a/cmd/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go +++ b/cmd/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go @@ -4,9 +4,8 @@ package test_a_2 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -69,13 +68,7 @@ var fileDescriptor_ff9d8f834875c9c5 = []byte{ 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var fileDescriptor_ff9d8f834875c9c5_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_ff9d8f834875c9c5) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_ff9d8f834875c9c5_gzipped = protoapi.CompressGZIP(fileDescriptor_ff9d8f834875c9c5) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go b/cmd/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go index 6c7a8c0f..56078f0c 100644 --- a/cmd/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go +++ b/cmd/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go @@ -4,9 +4,8 @@ package test_a_2 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -69,13 +68,7 @@ var fileDescriptor_fdd24f82f6c5a786 = []byte{ 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var fileDescriptor_fdd24f82f6c5a786_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_fdd24f82f6c5a786) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_fdd24f82f6c5a786_gzipped = protoapi.CompressGZIP(fileDescriptor_fdd24f82f6c5a786) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go b/cmd/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go index 8237a77b..24d0065c 100644 --- a/cmd/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go +++ b/cmd/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go @@ -4,9 +4,8 @@ package beta import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -70,13 +69,7 @@ var fileDescriptor_7f49573d035512a8 = []byte{ 0x6f, 0x33, } -var fileDescriptor_7f49573d035512a8_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_7f49573d035512a8) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_7f49573d035512a8_gzipped = protoapi.CompressGZIP(fileDescriptor_7f49573d035512a8) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go b/cmd/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go index ddf57b19..82cc175f 100644 --- a/cmd/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go +++ b/cmd/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go @@ -4,9 +4,8 @@ package beta import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -70,13 +69,7 @@ var fileDescriptor_a1becddceeb586f2 = []byte{ 0x6f, 0x33, } -var fileDescriptor_a1becddceeb586f2_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_a1becddceeb586f2) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_a1becddceeb586f2_gzipped = protoapi.CompressGZIP(fileDescriptor_a1becddceeb586f2) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go b/cmd/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go index 84ed62df..0a18af38 100644 --- a/cmd/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go +++ b/cmd/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go @@ -4,9 +4,8 @@ package imports import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" test_a_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" @@ -81,13 +80,7 @@ var fileDescriptor_3b904a47327455f3 = []byte{ 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var fileDescriptor_3b904a47327455f3_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_3b904a47327455f3) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_3b904a47327455f3_gzipped = protoapi.CompressGZIP(fileDescriptor_3b904a47327455f3) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go b/cmd/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go index 162ffe56..194ebedf 100644 --- a/cmd/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go +++ b/cmd/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go @@ -4,9 +4,8 @@ package imports import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" test_a_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" @@ -81,13 +80,7 @@ var fileDescriptor_bdb27b114687957d = []byte{ 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var fileDescriptor_bdb27b114687957d_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_bdb27b114687957d) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_bdb27b114687957d_gzipped = protoapi.CompressGZIP(fileDescriptor_bdb27b114687957d) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/imports/test_import_all.pb.go b/cmd/protoc-gen-go/testdata/imports/test_import_all.pb.go index 2329bafb..5f1e9e4f 100644 --- a/cmd/protoc-gen-go/testdata/imports/test_import_all.pb.go +++ b/cmd/protoc-gen-go/testdata/imports/test_import_all.pb.go @@ -4,9 +4,8 @@ package imports import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" fmt "github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt" test_a_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" _ "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2" @@ -134,13 +133,7 @@ var fileDescriptor_324466f0afc16f77 = []byte{ 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var fileDescriptor_324466f0afc16f77_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_324466f0afc16f77) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_324466f0afc16f77_gzipped = protoapi.CompressGZIP(fileDescriptor_324466f0afc16f77) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/test.pb.go b/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/test.pb.go index 3ece6d1e..79572fab 100644 --- a/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/test.pb.go +++ b/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/test.pb.go @@ -4,9 +4,8 @@ package oneoftest import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -101,13 +100,7 @@ var fileDescriptor_48462cafc802a68e = []byte{ 0x72, 0x42, 0x05, 0x0a, 0x03, 0x62, 0x61, 0x72, } -var fileDescriptor_48462cafc802a68e_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_48462cafc802a68e) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_48462cafc802a68e_gzipped = protoapi.CompressGZIP(fileDescriptor_48462cafc802a68e) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/nopackage/nopackage.pb.go b/cmd/protoc-gen-go/testdata/nopackage/nopackage.pb.go index 6cfd5253..504be4bc 100644 --- a/cmd/protoc-gen-go/testdata/nopackage/nopackage.pb.go +++ b/cmd/protoc-gen-go/testdata/nopackage/nopackage.pb.go @@ -4,9 +4,8 @@ package nopackage import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -133,13 +132,7 @@ var fileDescriptor_f33a1d5d178c43c9 = []byte{ 0x04, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, } -var fileDescriptor_f33a1d5d178c43c9_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_f33a1d5d178c43c9) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_f33a1d5d178c43c9_gzipped = protoapi.CompressGZIP(fileDescriptor_f33a1d5d178c43c9) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/proto2/enum.pb.go b/cmd/protoc-gen-go/testdata/proto2/enum.pb.go index 02e8d3f4..50a943d0 100644 --- a/cmd/protoc-gen-go/testdata/proto2/enum.pb.go +++ b/cmd/protoc-gen-go/testdata/proto2/enum.pb.go @@ -4,9 +4,8 @@ package proto2 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -441,13 +440,7 @@ var fileDescriptor_de9f68860d540858 = []byte{ 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, } -var fileDescriptor_de9f68860d540858_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_de9f68860d540858) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_de9f68860d540858_gzipped = protoapi.CompressGZIP(fileDescriptor_de9f68860d540858) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/proto2/fields.pb.go b/cmd/protoc-gen-go/testdata/proto2/fields.pb.go index f381fc23..1bc1330c 100644 --- a/cmd/protoc-gen-go/testdata/proto2/fields.pb.go +++ b/cmd/protoc-gen-go/testdata/proto2/fields.pb.go @@ -4,9 +4,8 @@ package proto2 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" math "math" @@ -1713,13 +1712,7 @@ var fileDescriptor_fd8a9d72b841fd68 = []byte{ 0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, } -var fileDescriptor_fd8a9d72b841fd68_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_fd8a9d72b841fd68) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_fd8a9d72b841fd68_gzipped = protoapi.CompressGZIP(fileDescriptor_fd8a9d72b841fd68) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/proto2/nested_messages.pb.go b/cmd/protoc-gen-go/testdata/proto2/nested_messages.pb.go index 5c531f65..9f170cd4 100644 --- a/cmd/protoc-gen-go/testdata/proto2/nested_messages.pb.go +++ b/cmd/protoc-gen-go/testdata/proto2/nested_messages.pb.go @@ -4,9 +4,8 @@ package proto2 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -176,13 +175,7 @@ var fileDescriptor_7417ee157699d191 = []byte{ 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, } -var fileDescriptor_7417ee157699d191_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_7417ee157699d191) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_7417ee157699d191_gzipped = protoapi.CompressGZIP(fileDescriptor_7417ee157699d191) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/proto2/proto2.pb.go b/cmd/protoc-gen-go/testdata/proto2/proto2.pb.go index 5432599e..3f52ab4f 100644 --- a/cmd/protoc-gen-go/testdata/proto2/proto2.pb.go +++ b/cmd/protoc-gen-go/testdata/proto2/proto2.pb.go @@ -4,9 +4,8 @@ package proto2 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -89,13 +88,7 @@ var fileDescriptor_d756bbe8817c03c1 = []byte{ 0x61, 0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, } -var fileDescriptor_d756bbe8817c03c1_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_d756bbe8817c03c1) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_d756bbe8817c03c1_gzipped = protoapi.CompressGZIP(fileDescriptor_d756bbe8817c03c1) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/proto3/enum.pb.go b/cmd/protoc-gen-go/testdata/proto3/enum.pb.go index 2e4d8b86..6db834e6 100644 --- a/cmd/protoc-gen-go/testdata/proto3/enum.pb.go +++ b/cmd/protoc-gen-go/testdata/proto3/enum.pb.go @@ -4,9 +4,8 @@ package proto3 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" ) @@ -71,13 +70,7 @@ var fileDescriptor_b4b9b1e8d161a9a6 = []byte{ 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var fileDescriptor_b4b9b1e8d161a9a6_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_b4b9b1e8d161a9a6) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_b4b9b1e8d161a9a6_gzipped = protoapi.CompressGZIP(fileDescriptor_b4b9b1e8d161a9a6) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/cmd/protoc-gen-go/testdata/proto3/fields.pb.go b/cmd/protoc-gen-go/testdata/proto3/fields.pb.go index a922f167..b353dca2 100644 --- a/cmd/protoc-gen-go/testdata/proto3/fields.pb.go +++ b/cmd/protoc-gen-go/testdata/proto3/fields.pb.go @@ -4,9 +4,8 @@ package proto3 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -574,13 +573,7 @@ var fileDescriptor_f1e3ea068187307c = []byte{ 0x6f, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var fileDescriptor_f1e3ea068187307c_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_f1e3ea068187307c) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_f1e3ea068187307c_gzipped = protoapi.CompressGZIP(fileDescriptor_f1e3ea068187307c) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/encoding/testprotos/pb2/test.pb.go b/encoding/testprotos/pb2/test.pb.go index 39e628a1..2d4f269f 100644 --- a/encoding/testprotos/pb2/test.pb.go +++ b/encoding/testprotos/pb2/test.pb.go @@ -4,9 +4,8 @@ package pb2 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" any "github.com/golang/protobuf/ptypes/any" duration "github.com/golang/protobuf/ptypes/duration" empty "github.com/golang/protobuf/ptypes/empty" @@ -1957,13 +1956,7 @@ var fileDescriptor_72e37deb177b50f8 = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x70, 0x62, 0x32, } -var fileDescriptor_72e37deb177b50f8_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_72e37deb177b50f8) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_72e37deb177b50f8_gzipped = protoapi.CompressGZIP(fileDescriptor_72e37deb177b50f8) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/encoding/testprotos/pb3/test.pb.go b/encoding/testprotos/pb3/test.pb.go index d9bc4365..b67b65e5 100644 --- a/encoding/testprotos/pb3/test.pb.go +++ b/encoding/testprotos/pb3/test.pb.go @@ -4,9 +4,8 @@ package pb3 import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -742,13 +741,7 @@ var fileDescriptor_33e0a17922cde063 = []byte{ 0x6f, 0x33, } -var fileDescriptor_33e0a17922cde063_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_33e0a17922cde063) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_33e0a17922cde063_gzipped = protoapi.CompressGZIP(fileDescriptor_33e0a17922cde063) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/go.mod b/go.mod index d43698fe..061eaded 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/golang/protobuf/v2 require ( - github.com/golang/protobuf v1.2.1-0.20181205191652-7e65e513332f + github.com/golang/protobuf v1.2.1-0.20190228215449-22c36ed95480 github.com/google/go-cmp v0.2.1-0.20181101181452-745b8ec83783 golang.org/x/tools v0.0.0-20180928181343-b3c0be4c978b ) diff --git a/go.sum b/go.sum index 0cf2a8d1..9d391056 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/golang/protobuf v1.2.1-0.20181127190454-8d0c54c12466/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.2.1-0.20181205191652-7e65e513332f h1:jEoef3K+ZQwZ7UB1iGu6KhX8hS9cYw1aXR7djS3Vn10= -github.com/golang/protobuf v1.2.1-0.20181205191652-7e65e513332f/go.mod h1:asK8yRb/+zxJTE0SbTESCku/4OjiDfbPwk4rEyIatUA= +github.com/golang/protobuf v1.2.1-0.20190228215449-22c36ed95480 h1:K3kcmzT/cPx8K4eprFqWF4cLZIxiOLNm+vKmNqQFCBw= +github.com/golang/protobuf v1.2.1-0.20190228215449-22c36ed95480/go.mod h1:asK8yRb/+zxJTE0SbTESCku/4OjiDfbPwk4rEyIatUA= github.com/golang/protobuf/v2 v2.0.0-20181127193627-d7e97bc71bcb/go.mod h1:MgUD+N3FwzDmj2CdMsT5ap7K7jx+c9cQDQ7fVhmH+Xw= github.com/google/go-cmp v0.2.1-0.20181101181452-745b8ec83783 h1:wVZ6laEGf86tNDTpR5mxFyFIclJJiXCxuJhcQKnsOHk= github.com/google/go-cmp v0.2.1-0.20181101181452-745b8ec83783/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= diff --git a/internal/testprotos/test/test.pb.go b/internal/testprotos/test/test.pb.go index d039c074..0d354815 100644 --- a/internal/testprotos/test/test.pb.go +++ b/internal/testprotos/test/test.pb.go @@ -4,9 +4,8 @@ package test import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -2734,13 +2733,7 @@ var fileDescriptor_c161fcfdc0c3ff1e = []byte{ 0x73, 0x74, 0x50, 0x01, 0x58, 0x02, } -var fileDescriptor_c161fcfdc0c3ff1e_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_c161fcfdc0c3ff1e) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_c161fcfdc0c3ff1e_gzipped = protoapi.CompressGZIP(fileDescriptor_c161fcfdc0c3ff1e) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/internal/testprotos/test/test_import.pb.go b/internal/testprotos/test/test_import.pb.go index c896f845..c0f25b39 100644 --- a/internal/testprotos/test/test_import.pb.go +++ b/internal/testprotos/test/test_import.pb.go @@ -4,9 +4,8 @@ package test import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -116,13 +115,7 @@ var fileDescriptor_89be98e26346f54e = []byte{ 0x74, } -var fileDescriptor_89be98e26346f54e_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_89be98e26346f54e) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_89be98e26346f54e_gzipped = protoapi.CompressGZIP(fileDescriptor_89be98e26346f54e) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/internal/testprotos/test/test_public.pb.go b/internal/testprotos/test/test_public.pb.go index f4e78e01..c75905d6 100644 --- a/internal/testprotos/test/test_public.pb.go +++ b/internal/testprotos/test/test_public.pb.go @@ -4,9 +4,8 @@ package test import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -69,13 +68,7 @@ var fileDescriptor_36dd44afd5b47374 = []byte{ 0x74, 0x6f, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, } -var fileDescriptor_36dd44afd5b47374_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_36dd44afd5b47374) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_36dd44afd5b47374_gzipped = protoapi.CompressGZIP(fileDescriptor_36dd44afd5b47374) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/internal/testprotos/test/test_weak.pb.go b/internal/testprotos/test/test_weak.pb.go index 18149d6b..98632fc8 100644 --- a/internal/testprotos/test/test_weak.pb.go +++ b/internal/testprotos/test/test_weak.pb.go @@ -4,9 +4,8 @@ package test import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -69,13 +68,7 @@ var fileDescriptor_c2b8edfebc4f71b3 = []byte{ 0x74, 0x65, 0x73, 0x74, } -var fileDescriptor_c2b8edfebc4f71b3_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_c2b8edfebc4f71b3) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_c2b8edfebc4f71b3_gzipped = protoapi.CompressGZIP(fileDescriptor_c2b8edfebc4f71b3) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/reflect/protoregistry/testprotos/test.pb.go b/reflect/protoregistry/testprotos/test.pb.go index 2e8bbd34..ccd0c371 100644 --- a/reflect/protoregistry/testprotos/test.pb.go +++ b/reflect/protoregistry/testprotos/test.pb.go @@ -4,9 +4,8 @@ package testprotos import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" reflect "reflect" @@ -421,13 +420,7 @@ var fileDescriptor_3628d63611f7063d = []byte{ 0x74, 0x72, 0x79, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, } -var fileDescriptor_3628d63611f7063d_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_3628d63611f7063d) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_3628d63611f7063d_gzipped = protoapi.CompressGZIP(fileDescriptor_3628d63611f7063d) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/types/descriptor/descriptor.pb.go b/types/descriptor/descriptor.pb.go index 299cd816..f7c32fed 100644 --- a/types/descriptor/descriptor.pb.go +++ b/types/descriptor/descriptor.pb.go @@ -4,8 +4,6 @@ package descriptor_proto import ( - bytes "bytes" - gzip "compress/gzip" protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" prototype "github.com/golang/protobuf/v2/reflect/prototype" @@ -2827,13 +2825,7 @@ var fileDescriptor_e5baabe45344a177 = []byte{ 0x66, 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, } -var fileDescriptor_e5baabe45344a177_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_e5baabe45344a177) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_e5baabe45344a177_gzipped = protoapi.CompressGZIP(fileDescriptor_e5baabe45344a177) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) diff --git a/types/plugin/plugin.pb.go b/types/plugin/plugin.pb.go index 9db5c1d7..13f1832a 100644 --- a/types/plugin/plugin.pb.go +++ b/types/plugin/plugin.pb.go @@ -4,9 +4,8 @@ package plugin_proto import ( - bytes "bytes" - gzip "compress/gzip" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" descriptor "github.com/golang/protobuf/v2/types/descriptor" @@ -401,13 +400,7 @@ var fileDescriptor_3562add825dafed5 = []byte{ 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, } -var fileDescriptor_3562add825dafed5_gzipped = func() []byte { - bb := new(bytes.Buffer) - zw, _ := gzip.NewWriterLevel(bb, gzip.NoCompression) - zw.Write(fileDescriptor_3562add825dafed5) - zw.Close() - return bb.Bytes() -}() +var fileDescriptor_3562add825dafed5_gzipped = protoapi.CompressGZIP(fileDescriptor_3562add825dafed5) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)