~tsileo/blobfs

ff3999d930e541ea8d4c0cde00abb3b6f4b430ad — Thomas Sileo 6 months ago 059cad4
Upgrade deps
157 files changed, 30971 insertions(+), 11504 deletions(-)

M go.mod
M go.sum
M internal/fs/fs.go
M vendor/bazil.org/fuse/fs/serve.go
M vendor/bazil.org/fuse/fuse.go
M vendor/bazil.org/fuse/fuse_kernel.go
M vendor/bazil.org/fuse/options.go
M vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go
M vendor/github.com/aws/aws-sdk-go/aws/version.go
A vendor/github.com/golang/protobuf/proto/buffer.go
D vendor/github.com/golang/protobuf/proto/clone.go
D vendor/github.com/golang/protobuf/proto/decode.go
A vendor/github.com/golang/protobuf/proto/defaults.go
M vendor/github.com/golang/protobuf/proto/deprecated.go
M vendor/github.com/golang/protobuf/proto/discard.go
D vendor/github.com/golang/protobuf/proto/encode.go
D vendor/github.com/golang/protobuf/proto/equal.go
M vendor/github.com/golang/protobuf/proto/extensions.go
D vendor/github.com/golang/protobuf/proto/lib.go
D vendor/github.com/golang/protobuf/proto/message_set.go
D vendor/github.com/golang/protobuf/proto/pointer_reflect.go
D vendor/github.com/golang/protobuf/proto/pointer_unsafe.go
M vendor/github.com/golang/protobuf/proto/properties.go
A vendor/github.com/golang/protobuf/proto/proto.go
A vendor/github.com/golang/protobuf/proto/registry.go
D vendor/github.com/golang/protobuf/proto/table_marshal.go
D vendor/github.com/golang/protobuf/proto/table_merge.go
D vendor/github.com/golang/protobuf/proto/table_unmarshal.go
D vendor/github.com/golang/protobuf/proto/text.go
R vendor/github.com/golang/protobuf/proto/{text_parser.go => text_decode.go}
A vendor/github.com/golang/protobuf/proto/text_encode.go
A vendor/github.com/golang/protobuf/proto/wire.go
A vendor/github.com/golang/protobuf/proto/wrappers.go
M vendor/golang.org/x/sys/unix/syscall_linux.go
M vendor/golang.org/x/sys/unix/zsyscall_linux.go
M vendor/golang.org/x/sys/unix/ztypes_linux.go
A vendor/google.golang.org/protobuf/AUTHORS
A vendor/google.golang.org/protobuf/CONTRIBUTORS
A vendor/google.golang.org/protobuf/LICENSE
A vendor/google.golang.org/protobuf/PATENTS
A vendor/google.golang.org/protobuf/encoding/prototext/decode.go
A vendor/google.golang.org/protobuf/encoding/prototext/doc.go
A vendor/google.golang.org/protobuf/encoding/prototext/encode.go
A vendor/google.golang.org/protobuf/encoding/protowire/wire.go
A vendor/google.golang.org/protobuf/internal/descfmt/stringer.go
A vendor/google.golang.org/protobuf/internal/descopts/options.go
A vendor/google.golang.org/protobuf/internal/detrand/rand.go
A vendor/google.golang.org/protobuf/internal/encoding/defval/default.go
A vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go
A vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go
A vendor/google.golang.org/protobuf/internal/encoding/text/decode.go
A vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go
A vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go
A vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go
A vendor/google.golang.org/protobuf/internal/encoding/text/doc.go
A vendor/google.golang.org/protobuf/internal/encoding/text/encode.go
A vendor/google.golang.org/protobuf/internal/errors/errors.go
A vendor/google.golang.org/protobuf/internal/errors/is_go112.go
A vendor/google.golang.org/protobuf/internal/errors/is_go113.go
A vendor/google.golang.org/protobuf/internal/fieldnum/any_gen.go
A vendor/google.golang.org/protobuf/internal/fieldnum/api_gen.go
A vendor/google.golang.org/protobuf/internal/fieldnum/descriptor_gen.go
A vendor/google.golang.org/protobuf/internal/fieldnum/doc.go
A vendor/google.golang.org/protobuf/internal/fieldnum/duration_gen.go
A vendor/google.golang.org/protobuf/internal/fieldnum/empty_gen.go
A vendor/google.golang.org/protobuf/internal/fieldnum/field_mask_gen.go
A vendor/google.golang.org/protobuf/internal/fieldnum/source_context_gen.go
A vendor/google.golang.org/protobuf/internal/fieldnum/struct_gen.go
A vendor/google.golang.org/protobuf/internal/fieldnum/timestamp_gen.go
A vendor/google.golang.org/protobuf/internal/fieldnum/type_gen.go
A vendor/google.golang.org/protobuf/internal/fieldnum/wrappers_gen.go
A vendor/google.golang.org/protobuf/internal/fieldsort/fieldsort.go
A vendor/google.golang.org/protobuf/internal/filedesc/build.go
A vendor/google.golang.org/protobuf/internal/filedesc/desc.go
A vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
A vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
A vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go
A vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go
A vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go
A vendor/google.golang.org/protobuf/internal/filetype/build.go
A vendor/google.golang.org/protobuf/internal/flags/flags.go
A vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go
A vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go
A vendor/google.golang.org/protobuf/internal/genname/name.go
A vendor/google.golang.org/protobuf/internal/impl/api_export.go
A vendor/google.golang.org/protobuf/internal/impl/checkinit.go
A vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
A vendor/google.golang.org/protobuf/internal/impl/codec_field.go
A vendor/google.golang.org/protobuf/internal/impl/codec_gen.go
A vendor/google.golang.org/protobuf/internal/impl/codec_map.go
A vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go
A vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go
A vendor/google.golang.org/protobuf/internal/impl/codec_message.go
A vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go
A vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go
A vendor/google.golang.org/protobuf/internal/impl/codec_tables.go
A vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go
A vendor/google.golang.org/protobuf/internal/impl/convert.go
A vendor/google.golang.org/protobuf/internal/impl/convert_list.go
A vendor/google.golang.org/protobuf/internal/impl/convert_map.go
A vendor/google.golang.org/protobuf/internal/impl/decode.go
A vendor/google.golang.org/protobuf/internal/impl/encode.go
A vendor/google.golang.org/protobuf/internal/impl/enum.go
A vendor/google.golang.org/protobuf/internal/impl/extension.go
A vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go
A vendor/google.golang.org/protobuf/internal/impl/legacy_export.go
A vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go
A vendor/google.golang.org/protobuf/internal/impl/legacy_file.go
A vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
A vendor/google.golang.org/protobuf/internal/impl/merge.go
A vendor/google.golang.org/protobuf/internal/impl/merge_gen.go
A vendor/google.golang.org/protobuf/internal/impl/message.go
A vendor/google.golang.org/protobuf/internal/impl/message_reflect.go
A vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go
A vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go
A vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go
A vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go
A vendor/google.golang.org/protobuf/internal/impl/validate.go
A vendor/google.golang.org/protobuf/internal/impl/weak.go
A vendor/google.golang.org/protobuf/internal/mapsort/mapsort.go
A vendor/google.golang.org/protobuf/internal/pragma/pragma.go
A vendor/google.golang.org/protobuf/internal/set/ints.go
A vendor/google.golang.org/protobuf/internal/strs/strings.go
A vendor/google.golang.org/protobuf/internal/strs/strings_pure.go
A vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go
A vendor/google.golang.org/protobuf/internal/version/version.go
A vendor/google.golang.org/protobuf/proto/checkinit.go
A vendor/google.golang.org/protobuf/proto/decode.go
A vendor/google.golang.org/protobuf/proto/decode_gen.go
A vendor/google.golang.org/protobuf/proto/doc.go
A vendor/google.golang.org/protobuf/proto/encode.go
A vendor/google.golang.org/protobuf/proto/encode_gen.go
A vendor/google.golang.org/protobuf/proto/equal.go
A vendor/google.golang.org/protobuf/proto/extension.go
A vendor/google.golang.org/protobuf/proto/merge.go
A vendor/google.golang.org/protobuf/proto/messageset.go
A vendor/google.golang.org/protobuf/proto/proto.go
A vendor/google.golang.org/protobuf/proto/proto_methods.go
A vendor/google.golang.org/protobuf/proto/proto_reflect.go
A vendor/google.golang.org/protobuf/proto/reset.go
A vendor/google.golang.org/protobuf/proto/size.go
A vendor/google.golang.org/protobuf/proto/size_gen.go
A vendor/google.golang.org/protobuf/proto/wrappers.go
A vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go
A vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
A vendor/google.golang.org/protobuf/reflect/protoreflect/source.go
A vendor/google.golang.org/protobuf/reflect/protoreflect/type.go
A vendor/google.golang.org/protobuf/reflect/protoreflect/value.go
A vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go
A vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go
A vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go
A vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
A vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go
A vendor/google.golang.org/protobuf/runtime/protoiface/methods.go
A vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go
A vendor/google.golang.org/protobuf/runtime/protoimpl/version.go
M vendor/modules.txt
M go.mod => go.mod +3 -3
@@ 3,9 3,9 @@ module a4.io/blobfs
go 1.14

require (
	a4.io/blobstash v0.0.0-20200413155548-757285a31107
	bazil.org/fuse v0.0.0-20200415052832-70bd89b671a2
	github.com/aws/aws-sdk-go v1.30.7
	a4.io/blobstash v0.0.0-20200419074707-d6248c401ca3
	bazil.org/fuse v0.0.0-20200416020106-1af1d1f56f46
	github.com/aws/aws-sdk-go v1.30.9
	github.com/hashicorp/golang-lru v0.5.4
	github.com/mitchellh/go-ps v1.0.0
	golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e

M go.sum => go.sum +25 -0
@@ 12,6 12,8 @@ a4.io/blobstash v0.0.0-20200221185322-50bf3c15ebe0/go.mod h1:6zWY2+AG69x/Ijl4B+g
a4.io/blobstash v0.0.0-20200311204339-04f83bc3d616/go.mod h1:XwNV/qV4/yuXdjfQgBqDLTCK4i2mlmvfI9UrkCPrt2M=
a4.io/blobstash v0.0.0-20200413155548-757285a31107 h1:TQf7MWRSX/5NnXg+Q4qUtN30KVWQfFs3Yozz4ksyM68=
a4.io/blobstash v0.0.0-20200413155548-757285a31107/go.mod h1:yPbAsXhi160IiVyGJBnI6NTgYAnRiB7kz6HHo0FgCHU=
a4.io/blobstash v0.0.0-20200419074707-d6248c401ca3 h1:Jdjq6Ui8/Pq+G21J8EeyBk3tloF5W3yxRCjqAIPxiwo=
a4.io/blobstash v0.0.0-20200419074707-d6248c401ca3/go.mod h1:HNy1GwuwC2MECEdCEcb8tzBWHmjxthROhh9Lg7WzysM=
a4.io/gluapp v0.0.0-20181203183836-c136dc4e9123/go.mod h1:rK/CQwI+tDICKCR1szNtBP0rJdH1LCrO/ZnculcIjWI=
a4.io/gluapp v0.0.0-20181217122610-c6ba9b02f21b/go.mod h1:hDz8O30eiYv+1bAFzssTvbRaLy27xwk7pdR7v2md7Ew=
a4.io/gluapp v0.0.0-20181218195258-2be1706b2908/go.mod h1:hDz8O30eiYv+1bAFzssTvbRaLy27xwk7pdR7v2md7Ew=


@@ 30,6 32,8 @@ bazil.org/fuse v0.0.0-20180421153158-65cc252bf669/go.mod h1:Xbm+BRKSBEpa4q4hTSxo
bazil.org/fuse v0.0.0-20200117225306-7b5117fecadc/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM=
bazil.org/fuse v0.0.0-20200415052832-70bd89b671a2 h1:BSFd7txKmf/El2sF/nCZvaNNm8/6FRF/tZtoTXWmv3Q=
bazil.org/fuse v0.0.0-20200415052832-70bd89b671a2/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM=
bazil.org/fuse v0.0.0-20200416020106-1af1d1f56f46 h1:ox1mVHIEzbuEzYwcrE+fM7ENuwFY4rcbYK6e4IJNlkA=
bazil.org/fuse v0.0.0-20200416020106-1af1d1f56f46/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM=
github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0=
github.com/GeertJohan/go.rice v1.0.0/go.mod h1:eH6gbSOAUv07dQuZVnBmoDP8mgsM1rtixis4Tib9if0=
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=


@@ 55,6 59,8 @@ github.com/aws/aws-sdk-go v1.29.7/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTga
github.com/aws/aws-sdk-go v1.29.22/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTgahTma5Xg=
github.com/aws/aws-sdk-go v1.30.7 h1:IaXfqtioP6p9SFAnNfsqdNczbR5UNbYqvcZUSsCAdTY=
github.com/aws/aws-sdk-go v1.30.7/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.30.9 h1:DntpBUKkchINPDbhEzDRin1eEn1TG9TZFlzWPf0i8to=
github.com/aws/aws-sdk-go v1.30.9/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/blevesearch/segment v0.0.0-20160915185041-762005e7a34f/go.mod h1:IInt5XRvpiGE09KOk9mmCMLjHhydIhNPKPPFLFBB7L8=
github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ=
github.com/carbocation/handlers v0.0.0-20140528190747-c939c6d9ef31/go.mod h1:iGISoFvZYz358DFlmHvYFlh4CgRdzPLXB2NJE48x6lY=


@@ 107,6 113,12 @@ github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaW
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.5 h1:F768QJ1E9tib+q5Sc8MkdJi1RxLTbRcTf8LJV56aRls=
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=


@@ 116,6 128,7 @@ github.com/goods/httpbuf v0.0.0-20120503183857-5709e9bb814c/go.mod h1:cHMBumiwaa
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/csrf v1.6.0/go.mod h1:7tSf8kmjNYr7IWDCYhd3U8Ck34iQ/Yw5CJu7bAkHEGI=


@@ 250,6 263,7 @@ github.com/yuin/goldmark v1.1.22/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.23/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.28/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.30/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark-highlighting v0.0.0-20191202084645-78f32c8dd6d5/go.mod h1:4QGn5rJFOASBa2uK4Q2h3BRTyJqRfsAucPFIipSTcaM=
github.com/yuin/goldmark-highlighting v0.0.0-20200218065240-d1af22c1126f/go.mod h1:9yW2CHuRSORvHgw7YfybB09PqUZTbzERyW3QFvd8+0Q=
github.com/yuin/goldmark-highlighting v0.0.0-20200307114337-60d527fdb691/go.mod h1:YLF3kDffRfUH/bTxOxHhV6lxwIB3Vfj91rEwNMS9MXo=


@@ 271,6 285,8 @@ golang.org/x/crypto v0.0.0-20200221170553-0f24fbd83dfb/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200406173513-056763e48d71 h1:DOmugCavvUtnUD114C1Wh+UgTgQZ4pMLzXxi1pSt+/Y=
golang.org/x/crypto v0.0.0-20200406173513-056763e48d71/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904 h1:bXoxMPcSLOq08zI3/c5dEBT6lE4eh+jOh886GHrn6V8=
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181213202711-891ebc4b82d6/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=


@@ 317,13 333,22 @@ golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200409092240-59c9f1ba88fa h1:mQTN3ECqfsViCNBgq+A40vdwhkGykrrQlYe3mPj6BoU=
golang.org/x/sys v0.0.0-20200409092240-59c9f1ba88fa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HXxFpW2sdCiP8MJSKLQY=
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zimw=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

M internal/fs/fs.go => internal/fs/fs.go +4 -27
@@ 320,35 320,12 @@ func (fs *FS) GC() error {
		return nil
	}

	gcScript := fmt.Sprintf(`
local kvstore = require('kvstore')
-- FS vkv ref
local key = "_filetree:fs:%s"

-- Do the "premark" step, to tell the GC which blobs are already in the root blobstore
local last_sync_version = "%d"
if last_sync_version ~= "0" then
  local _, last_ref, _ = kvstore.get(key, last_sync_version)
  premark_kv(key, last_sync_version)
  premark_filetree_node(last_ref)
end

-- Now, do the actual GC mark (and premarked blobs will be skipped)
local version = "%d"
local _, ref, _ = kvstore.get(key, version)

-- mark the actual KV entry
mark_kv(key, version)

-- mark the whole tree
mark_filetree_node(ref)
`, fs.ref, fs.lastSyncRev, fs.lastRevision)

	// FIXME(tsileo): make the stash name configurable
	resp, err := fs.clientUtil.PostMsgpack(
		fmt.Sprintf("/api/stash/rwfs-%s/_gc", fs.ref),
	resp, err := fs.clientUtil.PostJSON(
		fmt.Sprintf("/api/stash/rwfs-%s/_merge_filetree_version", fs.ref),
		map[string]interface{}{
			"script": gcScript,
			"ref":     fs.ref,
			"version": fs.lastRevision,
		},
	)
	if err != nil {

M vendor/bazil.org/fuse/fs/serve.go => vendor/bazil.org/fuse/fs/serve.go +199 -11
@@ 6,6 6,7 @@ import (
	"bytes"
	"context"
	"encoding/binary"
	"errors"
	"fmt"
	"hash/fnv"
	"io"


@@ 347,6 348,7 @@ func New(conn *fuse.Conn, config *Config) *Server {
		conn:         conn,
		req:          map[fuse.RequestID]*serveRequest{},
		nodeRef:      map[Node]fuse.NodeID{},
		notifyWait:   map[fuse.RequestID]chan<- *fuse.NotifyReply{},
		dynamicInode: GenerateDynamicInode,
	}
	if config != nil {


@@ 379,6 381,11 @@ type Server struct {
	freeHandle []fuse.HandleID
	nodeGen    uint64

	// pending notify upcalls to kernel
	notifyMu   sync.Mutex
	notifySeq  fuse.RequestID
	notifyWait map[fuse.RequestID]chan<- *fuse.NotifyReply

	// Used to ensure worker goroutines finish before Serve returns
	wg sync.WaitGroup
}


@@ 584,9 591,7 @@ func (c *Server) getHandle(id fuse.HandleID) (shandle *serveHandle) {
}

type request struct {
	Op      string
	Request *fuse.Header
	In      interface{} `json:",omitempty"`
	In interface{} `json:",omitempty"`
}

func (r request) String() string {


@@ 668,6 673,57 @@ func (n notification) String() string {
	return buf.String()
}

type notificationRequest struct {
	ID   fuse.RequestID
	Op   string
	Node fuse.NodeID
	Out  interface{} `json:",omitempty"`
}

func (n notificationRequest) String() string {
	var buf bytes.Buffer
	fmt.Fprintf(&buf, ">> %s [ID=%d] %v", n.Op, n.ID, n.Node)
	if n.Out != nil {
		// make sure (seemingly) empty values are readable
		switch n.Out.(type) {
		case string:
			fmt.Fprintf(&buf, " %q", n.Out)
		case []byte:
			fmt.Fprintf(&buf, " [% x]", n.Out)
		default:
			fmt.Fprintf(&buf, " %s", n.Out)
		}
	}
	return buf.String()
}

type notificationResponse struct {
	ID  fuse.RequestID
	Op  string
	In  interface{} `json:",omitempty"`
	Err string      `json:",omitempty"`
}

func (n notificationResponse) String() string {
	var buf bytes.Buffer
	fmt.Fprintf(&buf, "<< [ID=%d] %s", n.ID, n.Op)
	if n.In != nil {
		// make sure (seemingly) empty values are readable
		switch n.In.(type) {
		case string:
			fmt.Fprintf(&buf, " %q", n.In)
		case []byte:
			fmt.Fprintf(&buf, " [% x]", n.In)
		default:
			fmt.Fprintf(&buf, " %s", n.In)
		}
	}
	if n.Err != "" {
		fmt.Fprintf(&buf, " Err:%v", n.Err)
	}
	return buf.String()
}

type logMissingNode struct {
	MaxNode fuse.NodeID
}


@@ 775,11 831,15 @@ func (c *Server) serve(r fuse.Request) {

	req := &serveRequest{Request: r, cancel: cancel}

	c.debug(request{
		Op:      opName(r),
		Request: r.Hdr(),
		In:      r,
	})
	switch r.(type) {
	case *fuse.NotifyReply:
		// don't log NotifyReply here, they're logged by the recipient
		// as soon as we have decoded them to the right types
	default:
		c.debug(request{
			In: r,
		})
	}
	var node Node
	var snode *serveNode
	c.meta.Lock()


@@ 1376,6 1436,24 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode,
		r.Respond()
		return nil

	case *fuse.NotifyReply:
		c.notifyMu.Lock()
		w, ok := c.notifyWait[r.Hdr().ID]
		if ok {
			delete(c.notifyWait, r.Hdr().ID)
		}
		c.notifyMu.Unlock()
		if !ok {
			c.debug(notificationResponse{
				ID:  r.Hdr().ID,
				Op:  "NotifyReply",
				Err: "unknown ID",
			})
			return nil
		}
		w <- r
		return nil

		/*	case *FsyncdirRequest:
				return ENOSYS



@@ 1384,9 1462,6 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode,

			case *BmapRequest:
				return ENOSYS

			case *SetvolnameRequest, *GetxtimesRequest, *ExchangeRequest:
				return ENOSYS
		*/
	}



@@ 1522,6 1597,119 @@ func (s *Server) InvalidateEntry(parent Node, name string) error {
	return err
}

type notifyStoreRetrieveDetail struct {
	Off  uint64
	Size uint64
}

func (i notifyStoreRetrieveDetail) String() string {
	return fmt.Sprintf("Off:%d Size:%d", i.Off, i.Size)
}

type notifyRetrieveReplyDetail struct {
	Size uint64
}

func (i notifyRetrieveReplyDetail) String() string {
	return fmt.Sprintf("Size:%d", i.Size)
}

// NotifyStore puts data into the kernel page cache.
//
// Returns fuse.ErrNotCached if the kernel is not currently caching
// the node.
func (s *Server) NotifyStore(node Node, offset uint64, data []byte) error {
	s.meta.Lock()
	id, ok := s.nodeRef[node]
	if ok {
		snode := s.node[id]
		snode.wg.Add(1)
		defer snode.wg.Done()
	}
	s.meta.Unlock()
	if !ok {
		// This is what the kernel would have said, if we had been
		// able to send this message; it's not cached.
		return fuse.ErrNotCached
	}
	// Delay logging until after we can record the error too. We
	// consider a /dev/fuse write to be instantaneous enough to not
	// need separate before and after messages.
	err := s.conn.NotifyStore(id, offset, data)
	s.debug(notification{
		Op:   "NotifyStore",
		Node: id,
		Out: notifyStoreRetrieveDetail{
			Off:  offset,
			Size: uint64(len(data)),
		},
		Err: errstr(err),
	})
	return err
}

// NotifyRetrieve gets data from the kernel page cache.
//
// Returns fuse.ErrNotCached if the kernel is not currently caching
// the node.
func (s *Server) NotifyRetrieve(node Node, offset uint64, size uint32) ([]byte, error) {
	s.meta.Lock()
	id, ok := s.nodeRef[node]
	if ok {
		snode := s.node[id]
		snode.wg.Add(1)
		defer snode.wg.Done()
	}
	s.meta.Unlock()
	if !ok {
		// This is what the kernel would have said, if we had been
		// able to send this message; it's not cached.
		return nil, fuse.ErrNotCached
	}

	ch := make(chan *fuse.NotifyReply, 1)
	s.notifyMu.Lock()
	const wraparoundThreshold = 1 << 63
	if s.notifySeq > wraparoundThreshold {
		s.notifyMu.Unlock()
		return nil, errors.New("running out of notify sequence numbers")
	}
	s.notifySeq++
	seq := s.notifySeq
	s.notifyWait[seq] = ch
	s.notifyMu.Unlock()

	s.debug(notificationRequest{
		ID:   seq,
		Op:   "NotifyRetrieve",
		Node: id,
		Out: notifyStoreRetrieveDetail{
			Off:  offset,
			Size: uint64(size),
		},
	})
	retrieval, err := s.conn.NotifyRetrieve(seq, id, offset, size)
	if err != nil {
		s.debug(notificationResponse{
			ID:  seq,
			Op:  "NotifyRetrieve",
			Err: errstr(err),
		})
		return nil, err
	}

	reply := <-ch
	data := retrieval.Finish(reply)
	s.debug(notificationResponse{
		ID: seq,
		Op: "NotifyRetrieve",
		In: notifyRetrieveReplyDetail{
			Size: uint64(len(data)),
		},
	})
	return data, nil
}

// DataHandle returns a read-only Handle that satisfies reads
// using the given data.
func DataHandle(data []byte) Handle {

M vendor/bazil.org/fuse/fuse.go => vendor/bazil.org/fuse/fuse.go +96 -9
@@ 224,10 224,12 @@ func initMount(c *Conn, conf *mountConfig) error {
	c.proto = proto

	s := &initResponse{
		Library:      proto,
		MaxReadahead: conf.maxReadahead,
		MaxWrite:     maxWrite,
		Flags:        InitBigWrites | conf.initFlags,
		Library:             proto,
		MaxReadahead:        conf.maxReadahead,
		Flags:               InitBigWrites | conf.initFlags,
		MaxBackground:       conf.maxBackground,
		CongestionThreshold: conf.congestionThreshold,
		MaxWrite:            maxWrite,
	}
	r.Respond(s)
	return nil


@@ 1013,6 1015,12 @@ func (c *Conn) ReadRequest() (Request, error) {
		req = &DestroyRequest{
			Header: m.Header(),
		}

	case opNotifyReply:
		req = &NotifyReply{
			Header: m.Header(),
			msg:    m,
		}
	}

	return req, nil


@@ 1102,10 1110,10 @@ var (
	ErrNotCached = notCachedError{}
)

// sendInvalidate sends an invalidate notification to kernel.
// sendNotify sends a notification to kernel.
//
// A returned ENOENT is translated to a friendlier error.
func (c *Conn) sendInvalidate(msg []byte) error {
func (c *Conn) sendNotify(msg []byte) error {
	switch err := c.writeToKernel(msg); err {
	case syscall.ENOENT:
		return ErrNotCached


@@ 1131,7 1139,7 @@ func (c *Conn) InvalidateNode(nodeID NodeID, off int64, size int64) error {
	out.Ino = uint64(nodeID)
	out.Off = off
	out.Len = size
	return c.sendInvalidate(buf)
	return c.sendNotify(buf)
}

// InvalidateEntry invalidates the kernel cache of the directory entry


@@ 1159,7 1167,67 @@ func (c *Conn) InvalidateEntry(parent NodeID, name string) error {
	out.Namelen = uint32(len(name))
	buf = append(buf, name...)
	buf = append(buf, '\x00')
	return c.sendInvalidate(buf)
	return c.sendNotify(buf)
}

func (c *Conn) NotifyStore(nodeID NodeID, offset uint64, data []byte) error {
	buf := newBuffer(unsafe.Sizeof(notifyStoreOut{}) + uintptr(len(data)))
	h := (*outHeader)(unsafe.Pointer(&buf[0]))
	// h.Unique is 0
	h.Error = notifyCodeStore
	out := (*notifyStoreOut)(buf.alloc(unsafe.Sizeof(notifyStoreOut{})))
	out.Nodeid = uint64(nodeID)
	out.Offset = offset
	out.Size = uint32(len(data))
	buf = append(buf, data...)
	return c.sendNotify(buf)
}

type NotifyRetrieval struct {
	// we may want fields later, so don't let callers know it's the
	// empty struct
	_ struct{}
}

func (n *NotifyRetrieval) Finish(r *NotifyReply) []byte {
	m := r.msg
	defer putMessage(m)
	in := (*notifyRetrieveIn)(m.data())
	if m.len() < unsafe.Sizeof(*in) {
		Debug(malformedMessage{})
		return nil
	}
	m.off += int(unsafe.Sizeof(*in))
	buf := m.bytes()
	if uint32(len(buf)) < in.Size {
		Debug(malformedMessage{})
		return nil
	}

	data := make([]byte, in.Size)
	copy(data, buf)
	return data
}

func (c *Conn) NotifyRetrieve(notificationID RequestID, nodeID NodeID, offset uint64, size uint32) (*NotifyRetrieval, error) {
	// notificationID may collide with kernel-chosen requestIDs, it's
	// up to the caller to branch based on the opCode.

	buf := newBuffer(unsafe.Sizeof(notifyRetrieveOut{}))
	h := (*outHeader)(unsafe.Pointer(&buf[0]))
	// h.Unique is 0
	h.Error = notifyCodeRetrieve
	out := (*notifyRetrieveOut)(buf.alloc(unsafe.Sizeof(notifyRetrieveOut{})))
	out.NotifyUnique = uint64(notificationID)
	out.Nodeid = uint64(nodeID)
	out.Offset = offset
	// kernel constrains size to maxWrite for us
	out.Size = size
	if err := c.sendNotify(buf); err != nil {
		return nil, err
	}
	r := &NotifyRetrieval{}
	return r, nil
}

// An initRequest is the first request sent on a FUSE file system.


@@ 1184,13 1252,17 @@ type initResponse struct {
	// greater than initRequest.MaxReadahead.
	MaxReadahead uint32
	Flags        InitFlags
	// Maximum number of outstanding background requests
	MaxBackground uint16
	// Number of background requests at which congestion starts
	CongestionThreshold uint16
	// Maximum size of a single write operation.
	// Linux enforces a minimum of 4 KiB.
	MaxWrite uint32
}

func (r *initResponse) String() string {
	return fmt.Sprintf("Init %v ra=%d fl=%v w=%d", r.Library, r.MaxReadahead, r.Flags, r.MaxWrite)
	return fmt.Sprintf("Init %v ra=%d fl=%v maxbg=%d cg=%d w=%d", r.Library, r.MaxReadahead, r.Flags, r.MaxBackground, r.CongestionThreshold, r.MaxWrite)
}

// Respond replies to the request with the given response.


@@ 1201,6 1273,8 @@ func (r *initRequest) Respond(resp *initResponse) {
	out.Minor = resp.Library.Minor
	out.MaxReadahead = resp.MaxReadahead
	out.Flags = uint32(resp.Flags)
	out.MaxBackground = resp.MaxBackground
	out.CongestionThreshold = resp.CongestionThreshold
	out.MaxWrite = resp.MaxWrite

	// MaxWrite larger than our receive buffer would just lead to


@@ 2255,3 2329,16 @@ func (r *ExchangeDataRequest) Respond() {
	buf := newBuffer(0)
	r.respond(buf)
}

// NotifyReply is a response to an earlier notification. It behaves
// like a Request, but is not really a request expecting a response.
type NotifyReply struct {
	Header `json:"-"`
	msg    *message
}

var _ = Request(&NotifyReply{})

func (r *NotifyReply) String() string {
	return fmt.Sprintf("NotifyReply [%s]", &r.Header)
}

M vendor/bazil.org/fuse/fuse_kernel.go => vendor/bazil.org/fuse/fuse_kernel.go +47 -19
@@ 44,9 44,9 @@ import (
// The FUSE version implemented by the package.
const (
	protoVersionMinMajor = 7
	protoVersionMinMinor = 8
	protoVersionMinMinor = 15
	protoVersionMaxMajor = 7
	protoVersionMaxMinor = 12
	protoVersionMaxMinor = 15
)

const (


@@ 113,15 113,13 @@ func (fl GetattrFlags) String() string {
type SetattrValid uint32

const (
	SetattrMode   SetattrValid = 1 << 0
	SetattrUid    SetattrValid = 1 << 1
	SetattrGid    SetattrValid = 1 << 2
	SetattrSize   SetattrValid = 1 << 3
	SetattrAtime  SetattrValid = 1 << 4
	SetattrMtime  SetattrValid = 1 << 5
	SetattrHandle SetattrValid = 1 << 6

	// Linux only(?)
	SetattrMode      SetattrValid = 1 << 0
	SetattrUid       SetattrValid = 1 << 1
	SetattrGid       SetattrValid = 1 << 2
	SetattrSize      SetattrValid = 1 << 3
	SetattrAtime     SetattrValid = 1 << 4
	SetattrMtime     SetattrValid = 1 << 5
	SetattrHandle    SetattrValid = 1 << 6
	SetattrAtimeNow  SetattrValid = 1 << 7
	SetattrMtimeNow  SetattrValid = 1 << 8
	SetattrLockOwner SetattrValid = 1 << 9 // http://www.mail-archive.com/git-commits-head@vger.kernel.org/msg27852.html


@@ 410,8 408,9 @@ const (
	opInterrupt   = 36
	opBmap        = 37
	opDestroy     = 38
	opIoctl       = 39 // Linux?
	opPoll        = 40 // Linux?
	opIoctl       = 39
	opPoll        = 40
	opNotifyReply = 41
)

type entryOut struct {


@@ 698,12 697,13 @@ type initIn struct {
const initInSize = int(unsafe.Sizeof(initIn{}))

type initOut struct {
	Major        uint32
	Minor        uint32
	MaxReadahead uint32
	Flags        uint32
	Unused       uint32
	MaxWrite     uint32
	Major               uint32
	Minor               uint32
	MaxReadahead        uint32
	Flags               uint32
	MaxBackground       uint16
	CongestionThreshold uint16
	MaxWrite            uint32
}

type interruptIn struct {


@@ 752,6 752,8 @@ const (
	notifyCodePoll       int32 = 1
	notifyCodeInvalInode int32 = 2
	notifyCodeInvalEntry int32 = 3
	notifyCodeStore      int32 = 4
	notifyCodeRetrieve   int32 = 5
)

type notifyInvalInodeOut struct {


@@ 765,3 767,29 @@ type notifyInvalEntryOut struct {
	Namelen uint32
	_       uint32
}

type notifyStoreOut struct {
	Nodeid uint64
	Offset uint64
	Size   uint32
	_      uint32
}

type notifyRetrieveOut struct {
	NotifyUnique uint64
	Nodeid       uint64
	Offset       uint64
	Size         uint32
	_            uint32
}

type notifyRetrieveIn struct {
	// matches writeIn

	_      uint64
	Offset uint64
	Size   uint32
	_      uint32
	_      uint64
	_      uint64
}

M vendor/bazil.org/fuse/options.go => vendor/bazil.org/fuse/options.go +33 -3
@@ 11,9 11,11 @@ func dummyOption(conf *mountConfig) error {
// mountConfig holds the configuration for a mount operation.
// Use it by passing MountOption values to Mount.
type mountConfig struct {
	options      map[string]string
	maxReadahead uint32
	initFlags    InitFlags
	options             map[string]string
	maxReadahead        uint32
	initFlags           InitFlags
	maxBackground       uint16
	congestionThreshold uint16
}

func escapeComma(s string) string {


@@ 233,3 235,31 @@ func AllowNonEmptyMount() MountOption {
		return nil
	}
}

// MaxBackground sets the maximum number of FUSE requests the kernel
// will submit in the background. Background requests are used when an
// immediate answer is not needed. This may help with request latency.
//
// On Linux, this can be adjusted on the fly with
// /sys/fs/fuse/connections/CONN/max_background
func MaxBackground(n uint16) MountOption {
	return func(conf *mountConfig) error {
		conf.maxBackground = n
		return nil
	}
}

// CongestionThreshold sets the number of outstanding background FUSE
// requests beyond which the kernel considers the filesystem
// congested. This may help with request latency.
//
// On Linux, this can be adjusted on the fly with
// /sys/fs/fuse/connections/CONN/congestion_threshold
func CongestionThreshold(n uint16) MountOption {
	// TODO to test this, we'd have to figure out our connection id
	// and read /sys
	return func(conf *mountConfig) error {
		conf.congestionThreshold = n
		return nil
	}
}

M vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go => vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +267 -32
@@ 724,32 724,26 @@ var awsPartition = partition{
				"eu-west-1":      endpoint{},
				"eu-west-2":      endpoint{},
				"eu-west-3":      endpoint{},
				"fips-ca-central-1": endpoint{
					Hostname: "batch-fips.ca-central-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "ca-central-1",
					},
				},
				"fips-us-east-1": endpoint{
					Hostname: "batch-fips.us-east-1.amazonaws.com",
					Hostname: "fips.batch.us-east-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-east-1",
					},
				},
				"fips-us-east-2": endpoint{
					Hostname: "batch-fips.us-east-2.amazonaws.com",
					Hostname: "fips.batch.us-east-2.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-east-2",
					},
				},
				"fips-us-west-1": endpoint{
					Hostname: "batch-fips.us-west-1.amazonaws.com",
					Hostname: "fips.batch.us-west-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-west-1",
					},
				},
				"fips-us-west-2": endpoint{
					Hostname: "batch-fips.us-west-2.amazonaws.com",
					Hostname: "fips.batch.us-west-2.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-west-2",
					},


@@ 1400,6 1394,7 @@ var awsPartition = partition{
				"eu-central-1":   endpoint{},
				"eu-north-1":     endpoint{},
				"eu-west-1":      endpoint{},
				"eu-west-2":      endpoint{},
				"us-east-1":      endpoint{},
				"us-west-2":      endpoint{},
			},


@@ 1776,12 1771,42 @@ var awsPartition = partition{
				"eu-west-1":      endpoint{},
				"eu-west-2":      endpoint{},
				"eu-west-3":      endpoint{},
				"me-south-1":     endpoint{},
				"sa-east-1":      endpoint{},
				"us-east-1":      endpoint{},
				"us-east-2":      endpoint{},
				"us-west-1":      endpoint{},
				"us-west-2":      endpoint{},
				"fips-ca-central-1": endpoint{
					Hostname: "ec2-fips.ca-central-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "ca-central-1",
					},
				},
				"fips-us-east-1": endpoint{
					Hostname: "ec2-fips.us-east-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-east-1",
					},
				},
				"fips-us-east-2": endpoint{
					Hostname: "ec2-fips.us-east-2.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-east-2",
					},
				},
				"fips-us-west-1": endpoint{
					Hostname: "ec2-fips.us-west-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-west-1",
					},
				},
				"fips-us-west-2": endpoint{
					Hostname: "ec2-fips.us-west-2.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-west-2",
					},
				},
				"me-south-1": endpoint{},
				"sa-east-1":  endpoint{},
				"us-east-1":  endpoint{},
				"us-east-2":  endpoint{},
				"us-west-1":  endpoint{},
				"us-west-2":  endpoint{},
			},
		},
		"ec2metadata": service{


@@ 1956,12 1981,120 @@ var awsPartition = partition{
				"eu-west-1":      endpoint{},
				"eu-west-2":      endpoint{},
				"eu-west-3":      endpoint{},
				"me-south-1":     endpoint{},
				"sa-east-1":      endpoint{},
				"us-east-1":      endpoint{},
				"us-east-2":      endpoint{},
				"us-west-1":      endpoint{},
				"us-west-2":      endpoint{},
				"fips-ap-east-1": endpoint{
					Hostname: "elasticfilesystem-fips.ap-east-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "ap-east-1",
					},
				},
				"fips-ap-northeast-1": endpoint{
					Hostname: "elasticfilesystem-fips.ap-northeast-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "ap-northeast-1",
					},
				},
				"fips-ap-northeast-2": endpoint{
					Hostname: "elasticfilesystem-fips.ap-northeast-2.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "ap-northeast-2",
					},
				},
				"fips-ap-south-1": endpoint{
					Hostname: "elasticfilesystem-fips.ap-south-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "ap-south-1",
					},
				},
				"fips-ap-southeast-1": endpoint{
					Hostname: "elasticfilesystem-fips.ap-southeast-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "ap-southeast-1",
					},
				},
				"fips-ap-southeast-2": endpoint{
					Hostname: "elasticfilesystem-fips.ap-southeast-2.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "ap-southeast-2",
					},
				},
				"fips-ca-central-1": endpoint{
					Hostname: "elasticfilesystem-fips.ca-central-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "ca-central-1",
					},
				},
				"fips-eu-central-1": endpoint{
					Hostname: "elasticfilesystem-fips.eu-central-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "eu-central-1",
					},
				},
				"fips-eu-north-1": endpoint{
					Hostname: "elasticfilesystem-fips.eu-north-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "eu-north-1",
					},
				},
				"fips-eu-west-1": endpoint{
					Hostname: "elasticfilesystem-fips.eu-west-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "eu-west-1",
					},
				},
				"fips-eu-west-2": endpoint{
					Hostname: "elasticfilesystem-fips.eu-west-2.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "eu-west-2",
					},
				},
				"fips-eu-west-3": endpoint{
					Hostname: "elasticfilesystem-fips.eu-west-3.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "eu-west-3",
					},
				},
				"fips-me-south-1": endpoint{
					Hostname: "elasticfilesystem-fips.me-south-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "me-south-1",
					},
				},
				"fips-sa-east-1": endpoint{
					Hostname: "elasticfilesystem-fips.sa-east-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "sa-east-1",
					},
				},
				"fips-us-east-1": endpoint{
					Hostname: "elasticfilesystem-fips.us-east-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-east-1",
					},
				},
				"fips-us-east-2": endpoint{
					Hostname: "elasticfilesystem-fips.us-east-2.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-east-2",
					},
				},
				"fips-us-west-1": endpoint{
					Hostname: "elasticfilesystem-fips.us-west-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-west-1",
					},
				},
				"fips-us-west-2": endpoint{
					Hostname: "elasticfilesystem-fips.us-west-2.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-west-2",
					},
				},
				"me-south-1": endpoint{},
				"sa-east-1":  endpoint{},
				"us-east-1":  endpoint{},
				"us-east-2":  endpoint{},
				"us-west-1":  endpoint{},
				"us-west-2":  endpoint{},
			},
		},
		"elasticloadbalancing": service{


@@ 2995,12 3128,36 @@ var awsPartition = partition{
				"eu-west-1":      endpoint{},
				"eu-west-2":      endpoint{},
				"eu-west-3":      endpoint{},
				"me-south-1":     endpoint{},
				"sa-east-1":      endpoint{},
				"us-east-1":      endpoint{},
				"us-east-2":      endpoint{},
				"us-west-1":      endpoint{},
				"us-west-2":      endpoint{},
				"fips-us-east-1": endpoint{
					Hostname: "lambda-fips.us-east-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-east-1",
					},
				},
				"fips-us-east-2": endpoint{
					Hostname: "lambda-fips.us-east-2.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-east-2",
					},
				},
				"fips-us-west-1": endpoint{
					Hostname: "lambda-fips.us-west-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-west-1",
					},
				},
				"fips-us-west-2": endpoint{
					Hostname: "lambda-fips.us-west-2.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-west-2",
					},
				},
				"me-south-1": endpoint{},
				"sa-east-1":  endpoint{},
				"us-east-1":  endpoint{},
				"us-east-2":  endpoint{},
				"us-west-1":  endpoint{},
				"us-west-2":  endpoint{},
			},
		},
		"license-manager": service{


@@ 3201,6 3358,7 @@ var awsPartition = partition{
				"eu-central-1":   endpoint{},
				"eu-north-1":     endpoint{},
				"eu-west-1":      endpoint{},
				"eu-west-2":      endpoint{},
				"us-east-1":      endpoint{},
				"us-west-2":      endpoint{},
			},


@@ 3564,6 3722,12 @@ var awsPartition = partition{
						Region: "us-east-1",
					},
				},
				"fips-aws-global": endpoint{
					Hostname: "organizations-fips.us-east-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-east-1",
					},
				},
			},
		},
		"outposts": service{


@@ 5622,6 5786,13 @@ var awscnPartition = partition{
				},
			},
		},
		"api.sagemaker": service{

			Endpoints: endpoints{
				"cn-north-1":     endpoint{},
				"cn-northwest-1": endpoint{},
			},
		},
		"apigateway": service{

			Endpoints: endpoints{


@@ 5647,6 5818,7 @@ var awscnPartition = partition{
		"athena": service{

			Endpoints: endpoints{
				"cn-north-1":     endpoint{},
				"cn-northwest-1": endpoint{},
			},
		},


@@ 5810,6 5982,18 @@ var awscnPartition = partition{
			Endpoints: endpoints{
				"cn-north-1":     endpoint{},
				"cn-northwest-1": endpoint{},
				"fips-cn-north-1": endpoint{
					Hostname: "elasticfilesystem-fips.cn-north-1.amazonaws.com.cn",
					CredentialScope: credentialScope{
						Region: "cn-north-1",
					},
				},
				"fips-cn-northwest-1": endpoint{
					Hostname: "elasticfilesystem-fips.cn-northwest-1.amazonaws.com.cn",
					CredentialScope: credentialScope{
						Region: "cn-northwest-1",
					},
				},
			},
		},
		"elasticloadbalancing": service{


@@ 5869,6 6053,7 @@ var awscnPartition = partition{
		"glue": service{

			Endpoints: endpoints{
				"cn-north-1":     endpoint{},
				"cn-northwest-1": endpoint{},
			},
		},


@@ 5919,6 6104,13 @@ var awscnPartition = partition{
				"cn-northwest-1": endpoint{},
			},
		},
		"kafka": service{

			Endpoints: endpoints{
				"cn-north-1":     endpoint{},
				"cn-northwest-1": endpoint{},
			},
		},
		"kinesis": service{

			Endpoints: endpoints{


@@ 6005,6 6197,13 @@ var awscnPartition = partition{
				"cn-northwest-1": endpoint{},
			},
		},
		"runtime.sagemaker": service{

			Endpoints: endpoints{
				"cn-north-1":     endpoint{},
				"cn-northwest-1": endpoint{},
			},
		},
		"s3": service{
			Defaults: endpoint{
				Protocols:         []string{"http", "https"},


@@ 6360,18 6559,20 @@ var awsusgovPartition = partition{
		"batch": service{

			Endpoints: endpoints{
				"us-gov-east-1": endpoint{
				"fips-us-gov-east-1": endpoint{
					Hostname: "batch.us-gov-east-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-gov-east-1",
					},
				},
				"us-gov-west-1": endpoint{
				"fips-us-gov-west-1": endpoint{
					Hostname: "batch.us-gov-west-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-gov-west-1",
					},
				},
				"us-gov-east-1": endpoint{},
				"us-gov-west-1": endpoint{},
			},
		},
		"clouddirectory": service{


@@ 6579,8 6780,18 @@ var awsusgovPartition = partition{
		"ec2": service{

			Endpoints: endpoints{
				"us-gov-east-1": endpoint{},
				"us-gov-west-1": endpoint{},
				"us-gov-east-1": endpoint{
					Hostname: "ec2.us-gov-east-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-gov-east-1",
					},
				},
				"us-gov-west-1": endpoint{
					Hostname: "ec2.us-gov-west-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-gov-west-1",
					},
				},
			},
		},
		"ec2metadata": service{


@@ 6646,6 6857,18 @@ var awsusgovPartition = partition{
		"elasticfilesystem": service{

			Endpoints: endpoints{
				"fips-us-gov-east-1": endpoint{
					Hostname: "elasticfilesystem-fips.us-gov-east-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-gov-east-1",
					},
				},
				"fips-us-gov-west-1": endpoint{
					Hostname: "elasticfilesystem-fips.us-gov-west-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-gov-west-1",
					},
				},
				"us-gov-east-1": endpoint{},
				"us-gov-west-1": endpoint{},
			},


@@ 6839,6 7062,18 @@ var awsusgovPartition = partition{
		"lambda": service{

			Endpoints: endpoints{
				"fips-us-gov-east-1": endpoint{
					Hostname: "lambda-fips.us-gov-east-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-gov-east-1",
					},
				},
				"fips-us-gov-west-1": endpoint{
					Hostname: "lambda-fips.us-gov-west-1.amazonaws.com",
					CredentialScope: credentialScope{
						Region: "us-gov-west-1",
					},
				},
				"us-gov-east-1": endpoint{},
				"us-gov-west-1": endpoint{},
			},

M vendor/github.com/aws/aws-sdk-go/aws/version.go => vendor/github.com/aws/aws-sdk-go/aws/version.go +1 -1
@@ 5,4 5,4 @@ package aws
const SDKName = "aws-sdk-go"

// SDKVersion is the version of this SDK
const SDKVersion = "1.30.7"
const SDKVersion = "1.30.9"

A vendor/github.com/golang/protobuf/proto/buffer.go => vendor/github.com/golang/protobuf/proto/buffer.go +324 -0
@@ 0,0 1,324 @@
// 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.

package proto

import (
	"errors"
	"fmt"

	"google.golang.org/protobuf/encoding/prototext"
	"google.golang.org/protobuf/encoding/protowire"
	"google.golang.org/protobuf/runtime/protoimpl"
)

const (
	WireVarint     = 0
	WireFixed32    = 5
	WireFixed64    = 1
	WireBytes      = 2
	WireStartGroup = 3
	WireEndGroup   = 4
)

// EncodeVarint returns the varint encoded bytes of v.
func EncodeVarint(v uint64) []byte {
	return protowire.AppendVarint(nil, v)
}

// SizeVarint returns the length of the varint encoded bytes of v.
// This is equal to len(EncodeVarint(v)).
func SizeVarint(v uint64) int {
	return protowire.SizeVarint(v)
}

// DecodeVarint parses a varint encoded integer from b, returning the
// integer value and the length of the varint.
// It returns (0, 0) if there is a parse error.
func DecodeVarint(b []byte) (uint64, int) {
	v, n := protowire.ConsumeVarint(b)
	if n < 0 {
		return 0, 0
	}
	return v, n
}

// Buffer is a buffer for encoding and decoding the protobuf wire format.
// It may be reused between invocations to reduce memory usage.
type Buffer struct {
	buf           []byte
	idx           int
	deterministic bool
}

// NewBuffer allocates a new Buffer initialized with buf,
// where the contents of buf are considered the unread portion of the buffer.
func NewBuffer(buf []byte) *Buffer {
	return &Buffer{buf: buf}
}

// SetDeterministic specifies whether to use deterministic serialization.
//
// Deterministic serialization guarantees that for a given binary, equal
// messages will always be serialized to the same bytes. This implies:
//
//   - Repeated serialization of a message will return the same bytes.
//   - Different processes of the same binary (which may be executing on
//     different machines) will serialize equal messages to the same bytes.
//
// Note that the deterministic serialization is NOT canonical across
// languages. It is not guaranteed to remain stable over time. It is unstable
// across different builds with schema changes due to unknown fields.
// Users who need canonical serialization (e.g., persistent storage in a
// canonical form, fingerprinting, etc.) should define their own
// canonicalization specification and implement their own serializer rather
// than relying on this API.
//
// If deterministic serialization is requested, map entries will be sorted
// by keys in lexographical order. This is an implementation detail and
// subject to change.
func (b *Buffer) SetDeterministic(deterministic bool) {
	b.deterministic = deterministic
}

// SetBuf sets buf as the internal buffer,
// where the contents of buf are considered the unread portion of the buffer.
func (b *Buffer) SetBuf(buf []byte) {
	b.buf = buf
	b.idx = 0
}

// Reset clears the internal buffer of all written and unread data.
func (b *Buffer) Reset() {
	b.buf = b.buf[:0]
	b.idx = 0
}

// Bytes returns the internal buffer.
func (b *Buffer) Bytes() []byte {
	return b.buf
}

// Unread returns the unread portion of the buffer.
func (b *Buffer) Unread() []byte {
	return b.buf[b.idx:]
}

// Marshal appends the wire-format encoding of m to the buffer.
func (b *Buffer) Marshal(m Message) error {
	var err error
	b.buf, err = marshalAppend(b.buf, m, b.deterministic)
	return err
}

// Unmarshal parses the wire-format message in the buffer and places the decoded results in m.
//
// Unlike proto.Unmarshal, this does not reset the message before starting to unmarshal.
func (b *Buffer) Unmarshal(m Message) error {
	err := UnmarshalMerge(b.Unread(), m)
	b.idx = len(b.buf)
	return err
}

type unknownFields struct{ XXX_unrecognized protoimpl.UnknownFields }

func (m *unknownFields) String() string { panic("not implemented") }
func (m *unknownFields) Reset()         { panic("not implemented") }
func (m *unknownFields) ProtoMessage()  { panic("not implemented") }

// DebugPrint dumps the encoded bytes of b with a header and footer including s
// to stdout. This is only intended for debugging.
func (*Buffer) DebugPrint(s string, b []byte) {
	m := MessageReflect(new(unknownFields))
	m.SetUnknown(b)
	b, _ = prototext.MarshalOptions{AllowPartial: true, Indent: "\t"}.Marshal(m.Interface())
	fmt.Printf("==== %s ====\n%s==== %s ====\n", s, b, s)
}

// EncodeVarint appends an unsigned varint encoding to the buffer.
func (b *Buffer) EncodeVarint(v uint64) error {
	b.buf = protowire.AppendVarint(b.buf, v)
	return nil
}

// EncodeZigzag32 appends a 32-bit zig-zag varint encoding to the buffer.
func (b *Buffer) EncodeZigzag32(v uint64) error {
	return b.EncodeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31))))
}

// EncodeZigzag64 appends a 64-bit zig-zag varint encoding to the buffer.
func (b *Buffer) EncodeZigzag64(v uint64) error {
	return b.EncodeVarint(uint64((uint64(v) << 1) ^ uint64((int64(v) >> 63))))
}

// EncodeFixed32 appends a 32-bit little-endian integer to the buffer.
func (b *Buffer) EncodeFixed32(v uint64) error {
	b.buf = protowire.AppendFixed32(b.buf, uint32(v))
	return nil
}

// EncodeFixed64 appends a 64-bit little-endian integer to the buffer.
func (b *Buffer) EncodeFixed64(v uint64) error {
	b.buf = protowire.AppendFixed64(b.buf, uint64(v))
	return nil
}

// EncodeRawBytes appends a length-prefixed raw bytes to the buffer.
func (b *Buffer) EncodeRawBytes(v []byte) error {
	b.buf = protowire.AppendBytes(b.buf, v)
	return nil
}

// EncodeStringBytes appends a length-prefixed raw bytes to the buffer.
// It does not validate whether v contains valid UTF-8.
func (b *Buffer) EncodeStringBytes(v string) error {
	b.buf = protowire.AppendString(b.buf, v)
	return nil
}

// EncodeMessage appends a length-prefixed encoded message to the buffer.
func (b *Buffer) EncodeMessage(m Message) error {
	var err error
	b.buf = protowire.AppendVarint(b.buf, uint64(Size(m)))
	b.buf, err = marshalAppend(b.buf, m, b.deterministic)
	return err
}

// DecodeVarint consumes an encoded unsigned varint from the buffer.
func (b *Buffer) DecodeVarint() (uint64, error) {
	v, n := protowire.ConsumeVarint(b.buf[b.idx:])
	if n < 0 {
		return 0, protowire.ParseError(n)
	}
	b.idx += n
	return uint64(v), nil
}

// DecodeZigzag32 consumes an encoded 32-bit zig-zag varint from the buffer.
func (b *Buffer) DecodeZigzag32() (uint64, error) {
	v, err := b.DecodeVarint()
	if err != nil {
		return 0, err
	}
	return uint64((uint32(v) >> 1) ^ uint32((int32(v&1)<<31)>>31)), nil
}

// DecodeZigzag64 consumes an encoded 64-bit zig-zag varint from the buffer.
func (b *Buffer) DecodeZigzag64() (uint64, error) {
	v, err := b.DecodeVarint()
	if err != nil {
		return 0, err
	}
	return uint64((uint64(v) >> 1) ^ uint64((int64(v&1)<<63)>>63)), nil
}

// DecodeFixed32 consumes a 32-bit little-endian integer from the buffer.
func (b *Buffer) DecodeFixed32() (uint64, error) {
	v, n := protowire.ConsumeFixed32(b.buf[b.idx:])
	if n < 0 {
		return 0, protowire.ParseError(n)
	}
	b.idx += n
	return uint64(v), nil
}

// DecodeFixed64 consumes a 64-bit little-endian integer from the buffer.
func (b *Buffer) DecodeFixed64() (uint64, error) {
	v, n := protowire.ConsumeFixed64(b.buf[b.idx:])
	if n < 0 {
		return 0, protowire.ParseError(n)
	}
	b.idx += n
	return uint64(v), nil
}

// DecodeRawBytes consumes a length-prefixed raw bytes from the buffer.
// If alloc is specified, it returns a copy the raw bytes
// rather than a sub-slice of the buffer.
func (b *Buffer) DecodeRawBytes(alloc bool) ([]byte, error) {
	v, n := protowire.ConsumeBytes(b.buf[b.idx:])
	if n < 0 {
		return nil, protowire.ParseError(n)
	}
	b.idx += n
	if alloc {
		v = append([]byte(nil), v...)
	}
	return v, nil
}

// DecodeStringBytes consumes a length-prefixed raw bytes from the buffer.
// It does not validate whether the raw bytes contain valid UTF-8.
func (b *Buffer) DecodeStringBytes() (string, error) {
	v, n := protowire.ConsumeString(b.buf[b.idx:])
	if n < 0 {
		return "", protowire.ParseError(n)
	}
	b.idx += n
	return v, nil
}

// DecodeMessage consumes a length-prefixed message from the buffer.
// It does not reset m.
func (b *Buffer) DecodeMessage(m Message) error {
	v, err := b.DecodeRawBytes(false)
	if err != nil {
		return err
	}
	return UnmarshalMerge(v, m)
}

// DecodeGroup consumes a message group from the buffer.
// It assumes that the start group marker has already been consumed and
// consumes all bytes until (and including the end group marker).
// It does not reset m.
func (b *Buffer) DecodeGroup(m Message) error {
	v, n, err := consumeGroup(b.buf[b.idx:])
	if err != nil {
		return err
	}
	b.idx += n
	return UnmarshalMerge(v, m)
}

// consumeGroup parses b until it finds an end group marker, returning
// the raw bytes of the message (excluding the end group marker) and the
// the total length of the message (including the end group marker).
func consumeGroup(b []byte) ([]byte, int, error) {
	b0 := b
	depth := 1 // assume this follows a start group marker
	for {
		_, wtyp, tagLen := protowire.ConsumeTag(b)
		if tagLen < 0 {
			return nil, 0, protowire.ParseError(tagLen)
		}
		b = b[tagLen:]

		var valLen int
		switch wtyp {
		case protowire.VarintType:
			_, valLen = protowire.ConsumeVarint(b)
		case protowire.Fixed32Type:
			_, valLen = protowire.ConsumeFixed32(b)
		case protowire.Fixed64Type:
			_, valLen = protowire.ConsumeFixed64(b)
		case protowire.BytesType:
			_, valLen = protowire.ConsumeBytes(b)
		case protowire.StartGroupType:
			depth++
		case protowire.EndGroupType:
			depth--
		default:
			return nil, 0, errors.New("proto: cannot parse reserved wire type")
		}
		if valLen < 0 {
			return nil, 0, protowire.ParseError(valLen)
		}
		b = b[valLen:]

		if depth == 0 {
			return b0[:len(b0)-len(b)-tagLen], len(b0) - len(b), nil
		}
	}
}

D vendor/github.com/golang/protobuf/proto/clone.go => vendor/github.com/golang/protobuf/proto/clone.go +0 -253
@@ 1,253 0,0 @@
// Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2011 The Go Authors.  All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// Protocol buffer deep copy and merge.
// TODO: RawMessage.

package proto

import (
	"fmt"
	"log"
	"reflect"
	"strings"
)

// Clone returns a deep copy of a protocol buffer.
func Clone(src Message) Message {
	in := reflect.ValueOf(src)
	if in.IsNil() {
		return src
	}
	out := reflect.New(in.Type().Elem())
	dst := out.Interface().(Message)
	Merge(dst, src)
	return dst
}

// Merger is the interface representing objects that can merge messages of the same type.
type Merger interface {
	// Merge merges src into this message.
	// Required and optional fields that are set in src will be set to that value in dst.
	// Elements of repeated fields will be appended.
	//
	// Merge may panic if called with a different argument type than the receiver.
	Merge(src Message)
}

// generatedMerger is the custom merge method that generated protos will have.
// We must add this method since a generate Merge method will conflict with
// many existing protos that have a Merge data field already defined.
type generatedMerger interface {
	XXX_Merge(src Message)
}

// Merge merges src into dst.
// Required and optional fields that are set in src will be set to that value in dst.
// Elements of repeated fields will be appended.
// Merge panics if src and dst are not the same type, or if dst is nil.
func Merge(dst, src Message) {
	if m, ok := dst.(Merger); ok {
		m.Merge(src)
		return
	}

	in := reflect.ValueOf(src)
	out := reflect.ValueOf(dst)
	if out.IsNil() {
		panic("proto: nil destination")
	}
	if in.Type() != out.Type() {
		panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src))
	}
	if in.IsNil() {
		return // Merge from nil src is a noop
	}
	if m, ok := dst.(generatedMerger); ok {
		m.XXX_Merge(src)
		return
	}
	mergeStruct(out.Elem(), in.Elem())
}

func mergeStruct(out, in reflect.Value) {
	sprop := GetProperties(in.Type())
	for i := 0; i < in.NumField(); i++ {
		f := in.Type().Field(i)
		if strings.HasPrefix(f.Name, "XXX_") {
			continue
		}
		mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i])
	}

	if emIn, err := extendable(in.Addr().Interface()); err == nil {
		emOut, _ := extendable(out.Addr().Interface())
		mIn, muIn := emIn.extensionsRead()
		if mIn != nil {
			mOut := emOut.extensionsWrite()
			muIn.Lock()
			mergeExtension(mOut, mIn)
			muIn.Unlock()
		}
	}

	uf := in.FieldByName("XXX_unrecognized")
	if !uf.IsValid() {
		return
	}
	uin := uf.Bytes()
	if len(uin) > 0 {
		out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...))
	}
}

// mergeAny performs a merge between two values of the same type.
// viaPtr indicates whether the values were indirected through a pointer (implying proto2).
// prop is set if this is a struct field (it may be nil).
func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) {
	if in.Type() == protoMessageType {
		if !in.IsNil() {
			if out.IsNil() {
				out.Set(reflect.ValueOf(Clone(in.Interface().(Message))))
			} else {
				Merge(out.Interface().(Message), in.Interface().(Message))
			}
		}
		return
	}
	switch in.Kind() {
	case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,
		reflect.String, reflect.Uint32, reflect.Uint64:
		if !viaPtr && isProto3Zero(in) {
			return
		}
		out.Set(in)
	case reflect.Interface:
		// Probably a oneof field; copy non-nil values.
		if in.IsNil() {
			return
		}
		// Allocate destination if it is not set, or set to a different type.
		// Otherwise we will merge as normal.
		if out.IsNil() || out.Elem().Type() != in.Elem().Type() {
			out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T)
		}
		mergeAny(out.Elem(), in.Elem(), false, nil)
	case reflect.Map:
		if in.Len() == 0 {
			return
		}
		if out.IsNil() {
			out.Set(reflect.MakeMap(in.Type()))
		}
		// For maps with value types of *T or []byte we need to deep copy each value.
		elemKind := in.Type().Elem().Kind()
		for _, key := range in.MapKeys() {
			var val reflect.Value
			switch elemKind {
			case reflect.Ptr:
				val = reflect.New(in.Type().Elem().Elem())
				mergeAny(val, in.MapIndex(key), false, nil)
			case reflect.Slice:
				val = in.MapIndex(key)
				val = reflect.ValueOf(append([]byte{}, val.Bytes()...))
			default:
				val = in.MapIndex(key)
			}
			out.SetMapIndex(key, val)
		}
	case reflect.Ptr:
		if in.IsNil() {
			return
		}
		if out.IsNil() {
			out.Set(reflect.New(in.Elem().Type()))
		}
		mergeAny(out.Elem(), in.Elem(), true, nil)
	case reflect.Slice:
		if in.IsNil() {
			return
		}
		if in.Type().Elem().Kind() == reflect.Uint8 {
			// []byte is a scalar bytes field, not a repeated field.

			// Edge case: if this is in a proto3 message, a zero length
			// bytes field is considered the zero value, and should not
			// be merged.
			if prop != nil && prop.proto3 && in.Len() == 0 {
				return
			}

			// Make a deep copy.
			// Append to []byte{} instead of []byte(nil) so that we never end up
			// with a nil result.
			out.SetBytes(append([]byte{}, in.Bytes()...))
			return
		}
		n := in.Len()
		if out.IsNil() {
			out.Set(reflect.MakeSlice(in.Type(), 0, n))
		}
		switch in.Type().Elem().Kind() {
		case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,
			reflect.String, reflect.Uint32, reflect.Uint64:
			out.Set(reflect.AppendSlice(out, in))
		default:
			for i := 0; i < n; i++ {
				x := reflect.Indirect(reflect.New(in.Type().Elem()))
				mergeAny(x, in.Index(i), false, nil)
				out.Set(reflect.Append(out, x))
			}
		}
	case reflect.Struct:
		mergeStruct(out, in)
	default:
		// unknown type, so not a protocol buffer
		log.Printf("proto: don't know how to copy %v", in)
	}
}

func mergeExtension(out, in map[int32]Extension) {
	for extNum, eIn := range in {
		eOut := Extension{desc: eIn.desc}
		if eIn.value != nil {
			v := reflect.New(reflect.TypeOf(eIn.value)).Elem()
			mergeAny(v, reflect.ValueOf(eIn.value), false, nil)
			eOut.value = v.Interface()
		}
		if eIn.enc != nil {
			eOut.enc = make([]byte, len(eIn.enc))
			copy(eOut.enc, eIn.enc)
		}

		out[extNum] = eOut
	}
}

D vendor/github.com/golang/protobuf/proto/decode.go => vendor/github.com/golang/protobuf/proto/decode.go +0 -427
@@ 1,427 0,0 @@
// Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2010 The Go Authors.  All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

package proto

/*
 * Routines for decoding protocol buffer data to construct in-memory representations.
 */

import (
	"errors"
	"fmt"
	"io"
)

// errOverflow is returned when an integer is too large to be represented.
var errOverflow = errors.New("proto: integer overflow")

// ErrInternalBadWireType is returned by generated code when an incorrect
// wire type is encountered. It does not get returned to user code.
var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof")

// DecodeVarint reads a varint-encoded integer from the slice.
// It returns the integer and the number of bytes consumed, or
// zero if there is not enough.
// This is the format for the
// int32, int64, uint32, uint64, bool, and enum
// protocol buffer types.
func DecodeVarint(buf []byte) (x uint64, n int) {
	for shift := uint(0); shift < 64; shift += 7 {
		if n >= len(buf) {
			return 0, 0
		}
		b := uint64(buf[n])
		n++
		x |= (b & 0x7F) << shift
		if (b & 0x80) == 0 {
			return x, n
		}
	}

	// The number is too large to represent in a 64-bit value.
	return 0, 0
}

func (p *Buffer) decodeVarintSlow() (x uint64, err error) {
	i := p.index
	l := len(p.buf)

	for shift := uint(0); shift < 64; shift += 7 {
		if i >= l {
			err = io.ErrUnexpectedEOF
			return
		}
		b := p.buf[i]
		i++
		x |= (uint64(b) & 0x7F) << shift
		if b < 0x80 {
			p.index = i
			return
		}
	}

	// The number is too large to represent in a 64-bit value.
	err = errOverflow
	return
}

// DecodeVarint reads a varint-encoded integer from the Buffer.
// This is the format for the
// int32, int64, uint32, uint64, bool, and enum
// protocol buffer types.
func (p *Buffer) DecodeVarint() (x uint64, err error) {
	i := p.index
	buf := p.buf

	if i >= len(buf) {
		return 0, io.ErrUnexpectedEOF
	} else if buf[i] < 0x80 {
		p.index++
		return uint64(buf[i]), nil
	} else if len(buf)-i < 10 {
		return p.decodeVarintSlow()
	}

	var b uint64
	// we already checked the first byte
	x = uint64(buf[i]) - 0x80
	i++

	b = uint64(buf[i])
	i++
	x += b << 7
	if b&0x80 == 0 {
		goto done
	}
	x -= 0x80 << 7

	b = uint64(buf[i])
	i++
	x += b << 14
	if b&0x80 == 0 {
		goto done
	}
	x -= 0x80 << 14

	b = uint64(buf[i])
	i++
	x += b << 21
	if b&0x80 == 0 {
		goto done
	}
	x -= 0x80 << 21

	b = uint64(buf[i])
	i++
	x += b << 28
	if b&0x80 == 0 {
		goto done
	}
	x -= 0x80 << 28

	b = uint64(buf[i])
	i++
	x += b << 35
	if b&0x80 == 0 {
		goto done
	}
	x -= 0x80 << 35

	b = uint64(buf[i])
	i++
	x += b << 42
	if b&0x80 == 0 {
		goto done
	}
	x -= 0x80 << 42

	b = uint64(buf[i])
	i++
	x += b << 49
	if b&0x80 == 0 {
		goto done
	}
	x -= 0x80 << 49

	b = uint64(buf[i])
	i++
	x += b << 56
	if b&0x80 == 0 {
		goto done
	}
	x -= 0x80 << 56

	b = uint64(buf[i])
	i++
	x += b << 63
	if b&0x80 == 0 {
		goto done
	}

	return 0, errOverflow

done:
	p.index = i
	return x, nil
}

// DecodeFixed64 reads a 64-bit integer from the Buffer.
// This is the format for the
// fixed64, sfixed64, and double protocol buffer types.
func (p *Buffer) DecodeFixed64() (x uint64, err error) {
	// x, err already 0
	i := p.index + 8
	if i < 0 || i > len(p.buf) {
		err = io.ErrUnexpectedEOF
		return
	}
	p.index = i

	x = uint64(p.buf[i-8])
	x |= uint64(p.buf[i-7]) << 8
	x |= uint64(p.buf[i-6]) << 16
	x |= uint64(p.buf[i-5]) << 24
	x |= uint64(p.buf[i-4]) << 32
	x |= uint64(p.buf[i-3]) << 40
	x |= uint64(p.buf[i-2]) << 48
	x |= uint64(p.buf[i-1]) << 56
	return
}

// DecodeFixed32 reads a 32-bit integer from the Buffer.
// This is the format for the
// fixed32, sfixed32, and float protocol buffer types.
func (p *Buffer) DecodeFixed32() (x uint64, err error) {
	// x, err already 0
	i := p.index + 4
	if i < 0 || i > len(p.buf) {
		err = io.ErrUnexpectedEOF
		return
	}
	p.index = i

	x = uint64(p.buf[i-4])
	x |= uint64(p.buf[i-3]) << 8
	x |= uint64(p.buf[i-2]) << 16
	x |= uint64(p.buf[i-1]) << 24
	return
}

// DecodeZigzag64 reads a zigzag-encoded 64-bit integer
// from the Buffer.
// This is the format used for the sint64 protocol buffer type.
func (p *Buffer) DecodeZigzag64() (x uint64, err error) {
	x, err = p.DecodeVarint()
	if err != nil {
		return
	}
	x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63)
	return
}

// DecodeZigzag32 reads a zigzag-encoded 32-bit integer
// from  the Buffer.
// This is the format used for the sint32 protocol buffer type.
func (p *Buffer) DecodeZigzag32() (x uint64, err error) {
	x, err = p.DecodeVarint()
	if err != nil {
		return
	}
	x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31))
	return
}

// DecodeRawBytes reads a count-delimited byte buffer from the Buffer.
// This is the format used for the bytes protocol buffer
// type and for embedded messages.
func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) {
	n, err := p.DecodeVarint()
	if err != nil {
		return nil, err
	}

	nb := int(n)
	if nb < 0 {
		return nil, fmt.Errorf("proto: bad byte length %d", nb)
	}
	end := p.index + nb
	if end < p.index || end > len(p.buf) {
		return nil, io.ErrUnexpectedEOF
	}

	if !alloc {
		// todo: check if can get more uses of alloc=false
		buf = p.buf[p.index:end]
		p.index += nb
		return
	}

	buf = make([]byte, nb)
	copy(buf, p.buf[p.index:])
	p.index += nb
	return
}

// DecodeStringBytes reads an encoded string from the Buffer.
// This is the format used for the proto2 string type.
func (p *Buffer) DecodeStringBytes() (s string, err error) {
	buf, err := p.DecodeRawBytes(false)
	if err != nil {
		return
	}
	return string(buf), nil
}

// Unmarshaler is the interface representing objects that can
// unmarshal themselves.  The argument points to data that may be
// overwritten, so implementations should not keep references to the
// buffer.
// Unmarshal implementations should not clear the receiver.
// Any unmarshaled data should be merged into the receiver.
// Callers of Unmarshal that do not want to retain existing data
// should Reset the receiver before calling Unmarshal.
type Unmarshaler interface {
	Unmarshal([]byte) error
}

// newUnmarshaler is the interface representing objects that can
// unmarshal themselves. The semantics are identical to Unmarshaler.
//
// This exists to support protoc-gen-go generated messages.
// The proto package will stop type-asserting to this interface in the future.
//
// DO NOT DEPEND ON THIS.
type newUnmarshaler interface {
	XXX_Unmarshal([]byte) error
}

// Unmarshal parses the protocol buffer representation in buf and places the
// decoded result in pb.  If the struct underlying pb does not match
// the data in buf, the results can be unpredictable.
//
// Unmarshal resets pb before starting to unmarshal, so any
// existing data in pb is always removed. Use UnmarshalMerge
// to preserve and append to existing data.
func Unmarshal(buf []byte, pb Message) error {
	pb.Reset()
	if u, ok := pb.(newUnmarshaler); ok {
		return u.XXX_Unmarshal(buf)
	}
	if u, ok := pb.(Unmarshaler); ok {
		return u.Unmarshal(buf)
	}
	return NewBuffer(buf).Unmarshal(pb)
}

// UnmarshalMerge parses the protocol buffer representation in buf and
// writes the decoded result to pb.  If the struct underlying pb does not match
// the data in buf, the results can be unpredictable.
//
// UnmarshalMerge merges into existing data in pb.
// Most code should use Unmarshal instead.
func UnmarshalMerge(buf []byte, pb Message) error {
	if u, ok := pb.(newUnmarshaler); ok {
		return u.XXX_Unmarshal(buf)
	}
	if u, ok := pb.(Unmarshaler); ok {
		// NOTE: The history of proto have unfortunately been inconsistent
		// whether Unmarshaler should or should not implicitly clear itself.
		// Some implementations do, most do not.
		// Thus, calling this here may or may not do what people want.
		//
		// See https://github.com/golang/protobuf/issues/424
		return u.Unmarshal(buf)
	}
	return NewBuffer(buf).Unmarshal(pb)
}

// DecodeMessage reads a count-delimited message from the Buffer.
func (p *Buffer) DecodeMessage(pb Message) error {
	enc, err := p.DecodeRawBytes(false)
	if err != nil {
		return err
	}
	return NewBuffer(enc).Unmarshal(pb)
}

// DecodeGroup reads a tag-delimited group from the Buffer.
// StartGroup tag is already consumed. This function consumes
// EndGroup tag.
func (p *Buffer) DecodeGroup(pb Message) error {
	b := p.buf[p.index:]
	x, y := findEndGroup(b)
	if x < 0 {
		return io.ErrUnexpectedEOF
	}
	err := Unmarshal(b[:x], pb)
	p.index += y
	return err
}

// Unmarshal parses the protocol buffer representation in the
// Buffer and places the decoded result in pb.  If the struct
// underlying pb does not match the data in the buffer, the results can be
// unpredictable.
//
// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal.
func (p *Buffer) Unmarshal(pb Message) error {
	// If the object can unmarshal itself, let it.
	if u, ok := pb.(newUnmarshaler); ok {
		err := u.XXX_Unmarshal(p.buf[p.index:])
		p.index = len(p.buf)
		return err
	}
	if u, ok := pb.(Unmarshaler); ok {
		// NOTE: The history of proto have unfortunately been inconsistent
		// whether Unmarshaler should or should not implicitly clear itself.
		// Some implementations do, most do not.
		// Thus, calling this here may or may not do what people want.
		//
		// See https://github.com/golang/protobuf/issues/424
		err := u.Unmarshal(p.buf[p.index:])
		p.index = len(p.buf)
		return err
	}

	// Slow workaround for messages that aren't Unmarshalers.
	// This includes some hand-coded .pb.go files and
	// bootstrap protos.
	// TODO: fix all of those and then add Unmarshal to
	// the Message interface. Then:
	// The cast above and code below can be deleted.
	// The old unmarshaler can be deleted.
	// Clients can call Unmarshal directly (can already do that, actually).
	var info InternalMessageInfo
	err := info.Unmarshal(pb, p.buf[p.index:])
	p.index = len(p.buf)
	return err
}

A vendor/github.com/golang/protobuf/proto/defaults.go => vendor/github.com/golang/protobuf/proto/defaults.go +63 -0
@@ 0,0 1,63 @@
// 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.

package proto

import (
	"google.golang.org/protobuf/reflect/protoreflect"
)

// SetDefaults sets unpopulated scalar fields to their default values.
// Fields within a oneof are not set even if they have a default value.
// SetDefaults is recursively called upon any populated message fields.
func SetDefaults(m Message) {
	if m != nil {
		setDefaults(MessageReflect(m))
	}
}

func setDefaults(m protoreflect.Message) {
	fds := m.Descriptor().Fields()
	for i := 0; i < fds.Len(); i++ {
		fd := fds.Get(i)
		if !m.Has(fd) {
			if fd.HasDefault() && fd.ContainingOneof() == nil {
				v := fd.Default()
				if fd.Kind() == protoreflect.BytesKind {
					v = protoreflect.ValueOf(append([]byte(nil), v.Bytes()...)) // copy the default bytes
				}
				m.Set(fd, v)
			}
			continue
		}
	}

	m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
		switch {
		// Handle singular message.
		case fd.Cardinality() != protoreflect.Repeated:
			if fd.Message() != nil {
				setDefaults(m.Get(fd).Message())
			}
		// Handle list of messages.
		case fd.IsList():
			if fd.Message() != nil {
				ls := m.Get(fd).List()
				for i := 0; i < ls.Len(); i++ {
					setDefaults(ls.Get(i).Message())
				}
			}
		// Handle map of messages.
		case fd.IsMap():
			if fd.MapValue().Message() != nil {
				ms := m.Get(fd).Map()
				ms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool {
					setDefaults(v.Message())
					return true
				})
			}
		}
		return true
	})
}

M vendor/github.com/golang/protobuf/proto/deprecated.go => vendor/github.com/golang/protobuf/proto/deprecated.go +67 -38
@@ 1,63 1,92 @@
// Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2018 The Go Authors.  All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Copyright 2018 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.

package proto

import "errors"
import (
	"encoding/json"
	"errors"
	"fmt"
	"strconv"
)

// Deprecated: do not use.
var (
	// Deprecated: No longer returned.
	ErrNil = errors.New("proto: Marshal called with nil")

	// Deprecated: No longer returned.
	ErrTooLarge = errors.New("proto: message encodes to over 2 GB")

	// Deprecated: No longer returned.
	ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof")
)

// Deprecated: Do not use.
type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 }

// Deprecated: do not use.
// Deprecated: Do not use.
func GetStats() Stats { return Stats{} }

// Deprecated: do not use.
// Deprecated: Do not use.
func MarshalMessageSet(interface{}) ([]byte, error) {
	return nil, errors.New("proto: not implemented")
}

// Deprecated: do not use.
// Deprecated: Do not use.
func UnmarshalMessageSet([]byte, interface{}) error {
	return errors.New("proto: not implemented")
}

// Deprecated: do not use.
// Deprecated: Do not use.
func MarshalMessageSetJSON(interface{}) ([]byte, error) {
	return nil, errors.New("proto: not implemented")
}

// Deprecated: do not use.
// Deprecated: Do not use.
func UnmarshalMessageSetJSON([]byte, interface{}) error {
	return errors.New("proto: not implemented")
}

// Deprecated: do not use.
// Deprecated: Do not use.
func RegisterMessageSetType(Message, int32, string) {}

// Deprecated: Do not use.
func EnumName(m map[int32]string, v int32) string {
	s, ok := m[v]
	if ok {
		return s
	}
	return strconv.Itoa(int(v))
}

// Deprecated: Do not use.
func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) {
	if data[0] == '"' {
		// New style: enums are strings.
		var repr string
		if err := json.Unmarshal(data, &repr); err != nil {
			return -1, err
		}
		val, ok := m[repr]
		if !ok {
			return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr)
		}
		return val, nil
	}
	// Old style: enums are ints.
	var val int32
	if err := json.Unmarshal(data, &val); err != nil {
		return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName)
	}
	return val, nil
}

// Deprecated: Do not use.
type InternalMessageInfo struct{}

func (*InternalMessageInfo) DiscardUnknown(Message)                        { panic("not implemented") }
func (*InternalMessageInfo) Marshal([]byte, Message, bool) ([]byte, error) { panic("not implemented") }
func (*InternalMessageInfo) Merge(Message, Message)                        { panic("not implemented") }
func (*InternalMessageInfo) Size(Message) int                              { panic("not implemented") }
func (*InternalMessageInfo) Unmarshal(Message, []byte) error               { panic("not implemented") }

M vendor/github.com/golang/protobuf/proto/discard.go => vendor/github.com/golang/protobuf/proto/discard.go +32 -324
@@ 1,48 1,13 @@
// Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2017 The Go Authors.  All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// 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.

package proto

import (
	"fmt"
	"reflect"
	"strings"
	"sync"
	"sync/atomic"
	"google.golang.org/protobuf/reflect/protoreflect"
)

type generatedDiscarder interface {
	XXX_DiscardUnknown()
}

// DiscardUnknown recursively discards all unknown fields from this message
// and all embedded messages.
//


@@ 51,300 16,43 @@ type generatedDiscarder interface {
// marshal to be able to produce a message that continues to have those
// unrecognized fields. To avoid this, DiscardUnknown is used to
// explicitly clear the unknown fields after unmarshaling.
//
// For proto2 messages, the unknown fields of message extensions are only
// discarded from messages that have been accessed via GetExtension.
func DiscardUnknown(m Message) {
	if m, ok := m.(generatedDiscarder); ok {
		m.XXX_DiscardUnknown()
		return
	}
	// TODO: Dynamically populate a InternalMessageInfo for legacy messages,
	// but the master branch has no implementation for InternalMessageInfo,
	// so it would be more work to replicate that approach.
	discardLegacy(m)
}

// DiscardUnknown recursively discards all unknown fields.
func (a *InternalMessageInfo) DiscardUnknown(m Message) {
	di := atomicLoadDiscardInfo(&a.discard)
	if di == nil {
		di = getDiscardInfo(reflect.TypeOf(m).Elem())
		atomicStoreDiscardInfo(&a.discard, di)
	}
	di.discard(toPointer(&m))
}

type discardInfo struct {
	typ reflect.Type

	initialized int32 // 0: only typ is valid, 1: everything is valid
	lock        sync.Mutex

	fields       []discardFieldInfo
	unrecognized field
}

type discardFieldInfo struct {
	field   field // Offset of field, guaranteed to be valid
	discard func(src pointer)
}

var (
	discardInfoMap  = map[reflect.Type]*discardInfo{}
	discardInfoLock sync.Mutex
)

func getDiscardInfo(t reflect.Type) *discardInfo {
	discardInfoLock.Lock()
	defer discardInfoLock.Unlock()
	di := discardInfoMap[t]
	if di == nil {
		di = &discardInfo{typ: t}
		discardInfoMap[t] = di
	if m != nil {
		discardUnknown(MessageReflect(m))
	}
	return di
}

func (di *discardInfo) discard(src pointer) {
	if src.isNil() {
		return // Nothing to do.
	}

	if atomic.LoadInt32(&di.initialized) == 0 {
		di.computeDiscardInfo()
	}

	for _, fi := range di.fields {
		sfp := src.offset(fi.field)
		fi.discard(sfp)
	}

	// For proto2 messages, only discard unknown fields in message extensions
	// that have been accessed via GetExtension.
	if em, err := extendable(src.asPointerTo(di.typ).Interface()); err == nil {
		// Ignore lock since DiscardUnknown is not concurrency safe.
		emm, _ := em.extensionsRead()
		for _, mx := range emm {
			if m, ok := mx.value.(Message); ok {
				DiscardUnknown(m)
func discardUnknown(m protoreflect.Message) {
	m.Range(func(fd protoreflect.FieldDescriptor, val protoreflect.Value) bool {
		switch {
		// Handle singular message.
		case fd.Cardinality() != protoreflect.Repeated:
			if fd.Message() != nil {
				discardUnknown(m.Get(fd).Message())
			}
		}
	}

	if di.unrecognized.IsValid() {
		*src.offset(di.unrecognized).toBytes() = nil
	}
}

func (di *discardInfo) computeDiscardInfo() {
	di.lock.Lock()
	defer di.lock.Unlock()
	if di.initialized != 0 {
		return
	}
	t := di.typ
	n := t.NumField()

	for i := 0; i < n; i++ {
		f := t.Field(i)
		if strings.HasPrefix(f.Name, "XXX_") {
			continue
		}

		dfi := discardFieldInfo{field: toField(&f)}
		tf := f.Type

		// Unwrap tf to get its most basic type.
		var isPointer, isSlice bool
		if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 {
			isSlice = true
			tf = tf.Elem()
		}
		if tf.Kind() == reflect.Ptr {
			isPointer = true
			tf = tf.Elem()
		}
		if isPointer && isSlice && tf.Kind() != reflect.Struct {
			panic(fmt.Sprintf("%v.%s cannot be a slice of pointers to primitive types", t, f.Name))
		}

		switch tf.Kind() {
		case reflect.Struct:
			switch {
			case !isPointer:
				panic(fmt.Sprintf("%v.%s cannot be a direct struct value", t, f.Name))
			case isSlice: // E.g., []*pb.T
				di := getDiscardInfo(tf)
				dfi.discard = func(src pointer) {
					sps := src.getPointerSlice()
					for _, sp := range sps {
						if !sp.isNil() {
							di.discard(sp)
						}
					}
				}
			default: // E.g., *pb.T
				di := getDiscardInfo(tf)
				dfi.discard = func(src pointer) {
					sp := src.getPointer()
					if !sp.isNil() {
						di.discard(sp)
					}
		// Handle list of messages.
		case fd.IsList():
			if fd.Message() != nil {
				ls := m.Get(fd).List()
				for i := 0; i < ls.Len(); i++ {
					discardUnknown(ls.Get(i).Message())
				}
			}
		case reflect.Map:
			switch {
			case isPointer || isSlice:
				panic(fmt.Sprintf("%v.%s cannot be a pointer to a map or a slice of map values", t, f.Name))
			default: // E.g., map[K]V
				if tf.Elem().Kind() == reflect.Ptr { // Proto struct (e.g., *T)
					dfi.discard = func(src pointer) {
						sm := src.asPointerTo(tf).Elem()
						if sm.Len() == 0 {
							return
						}
						for _, key := range sm.MapKeys() {
							val := sm.MapIndex(key)
							DiscardUnknown(val.Interface().(Message))
						}
					}
				} else {
					dfi.discard = func(pointer) {} // Noop
				}
			}
		case reflect.Interface:
			// Must be oneof field.
			switch {
			case isPointer || isSlice:
				panic(fmt.Sprintf("%v.%s cannot be a pointer to a interface or a slice of interface values", t, f.Name))
			default: // E.g., interface{}
				// TODO: Make this faster?
				dfi.discard = func(src pointer) {
					su := src.asPointerTo(tf).Elem()
					if !su.IsNil() {
						sv := su.Elem().Elem().Field(0)
						if sv.Kind() == reflect.Ptr && sv.IsNil() {
							return
						}
						switch sv.Type().Kind() {
						case reflect.Ptr: // Proto struct (e.g., *T)
							DiscardUnknown(sv.Interface().(Message))
						}
					}
				}
		// Handle map of messages.
		case fd.IsMap():
			if fd.MapValue().Message() != nil {
				ms := m.Get(fd).Map()
				ms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool {
					discardUnknown(v.Message())
					return true
				})
			}
		default:
			continue
		}
		di.fields = append(di.fields, dfi)
	}

	di.unrecognized = invalidField
	if f, ok := t.FieldByName("XXX_unrecognized"); ok {
		if f.Type != reflect.TypeOf([]byte{}) {
			panic("expected XXX_unrecognized to be of type []byte")
		}
		di.unrecognized = toField(&f)
	}

	atomic.StoreInt32(&di.initialized, 1)
}

func discardLegacy(m Message) {
	v := reflect.ValueOf(m)
	if v.Kind() != reflect.Ptr || v.IsNil() {
		return
	}
	v = v.Elem()
	if v.Kind() != reflect.Struct {
		return
	}
	t := v.Type()

	for i := 0; i < v.NumField(); i++ {
		f := t.Field(i)
		if strings.HasPrefix(f.Name, "XXX_") {
			continue
		}
		vf := v.Field(i)
		tf := f.Type
		return true
	})

		// Unwrap tf to get its most basic type.
		var isPointer, isSlice bool
		if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 {
			isSlice = true
			tf = tf.Elem()
		}
		if tf.Kind() == reflect.Ptr {
			isPointer = true
			tf = tf.Elem()
		}
		if isPointer && isSlice && tf.Kind() != reflect.Struct {
			panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name))
		}

		switch tf.Kind() {
		case reflect.Struct:
			switch {
			case !isPointer:
				panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name))
			case isSlice: // E.g., []*pb.T
				for j := 0; j < vf.Len(); j++ {
					discardLegacy(vf.Index(j).Interface().(Message))
				}
			default: // E.g., *pb.T
				discardLegacy(vf.Interface().(Message))
			}
		case reflect.Map:
			switch {
			case isPointer || isSlice:
				panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name))
			default: // E.g., map[K]V
				tv := vf.Type().Elem()
				if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T)
					for _, key := range vf.MapKeys() {
						val := vf.MapIndex(key)
						discardLegacy(val.Interface().(Message))
					}
				}
			}
		case reflect.Interface:
			// Must be oneof field.
			switch {
			case isPointer || isSlice:
				panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name))
			default: // E.g., test_proto.isCommunique_Union interface
				if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" {
					vf = vf.Elem() // E.g., *test_proto.Communique_Msg
					if !vf.IsNil() {
						vf = vf.Elem()   // E.g., test_proto.Communique_Msg
						vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value
						if vf.Kind() == reflect.Ptr {
							discardLegacy(vf.Interface().(Message))
						}
					}
				}
			}
		}
	}

	if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() {
		if vf.Type() != reflect.TypeOf([]byte{}) {
			panic("expected XXX_unrecognized to be of type []byte")
		}
		vf.Set(reflect.ValueOf([]byte(nil)))
	}

	// For proto2 messages, only discard unknown fields in message extensions
	// that have been accessed via GetExtension.
	if em, err := extendable(m); err == nil {
		// Ignore lock since discardLegacy is not concurrency safe.
		emm, _ := em.extensionsRead()
		for _, mx := range emm {
			if m, ok := mx.value.(Message); ok {
				discardLegacy(m)
			}
		}
	// Discard unknown fields.
	if len(m.GetUnknown()) > 0 {
		m.SetUnknown(nil)
	}
}

D vendor/github.com/golang/protobuf/proto/encode.go => vendor/github.com/golang/protobuf/proto/encode.go +0 -203
@@ 1,203 0,0 @@
// Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2010 The Go Authors.  All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

package proto

/*
 * Routines for encoding data into the wire format for protocol buffers.
 */

import (
	"errors"
	"reflect"
)

var (
	// errRepeatedHasNil is the error returned if Marshal is called with
	// a struct with a repeated field containing a nil element.
	errRepeatedHasNil = errors.New("proto: repeated field has nil element")

	// errOneofHasNil is the error returned if Marshal is called with
	// a struct with a oneof field containing a nil element.
	errOneofHasNil = errors.New("proto: oneof field has nil value")

	// ErrNil is the error returned if Marshal is called with nil.
	ErrNil = errors.New("proto: Marshal called with nil")

	// ErrTooLarge is the error returned if Marshal is called with a
	// message that encodes to >2GB.
	ErrTooLarge = errors.New("proto: message encodes to over 2 GB")
)

// The fundamental encoders that put bytes on the wire.
// Those that take integer types all accept uint64 and are
// therefore of type valueEncoder.

const maxVarintBytes = 10 // maximum length of a varint

// EncodeVarint returns the varint encoding of x.
// This is the format for the
// int32, int64, uint32, uint64, bool, and enum
// protocol buffer types.
// Not used by the package itself, but helpful to clients
// wishing to use the same encoding.
func EncodeVarint(x uint64) []byte {
	var buf [maxVarintBytes]byte
	var n int
	for n = 0; x > 127; n++ {
		buf[n] = 0x80 | uint8(x&0x7F)
		x >>= 7
	}
	buf[n] = uint8(x)
	n++
	return buf[0:n]
}

// EncodeVarint writes a varint-encoded integer to the Buffer.
// This is the format for the
// int32, int64, uint32, uint64, bool, and enum
// protocol buffer types.
func (p *Buffer) EncodeVarint(x uint64) error {
	for x >= 1<<7 {
		p.buf = append(p.buf, uint8(x&0x7f|0x80))
		x >>= 7
	}
	p.buf = append(p.buf, uint8(x))
	return nil
}

// SizeVarint returns the varint encoding size of an integer.
func SizeVarint(x uint64) int {
	switch {
	case x < 1<<7:
		return 1
	case x < 1<<14:
		return 2
	case x < 1<<21:
		return 3
	case x < 1<<28:
		return 4
	case x < 1<<35:
		return 5
	case x < 1<<42:
		return 6
	case x < 1<<49:
		return 7
	case x < 1<<56:
		return 8
	case x < 1<<63:
		return 9
	}
	return 10
}

// EncodeFixed64 writes a 64-bit integer to the Buffer.
// This is the format for the
// fixed64, sfixed64, and double protocol buffer types.
func (p *Buffer) EncodeFixed64(x uint64) error {
	p.buf = append(p.buf,
		uint8(x),
		uint8(x>>8),
		uint8(x>>16),
		uint8(x>>24),
		uint8(x>>32),
		uint8(x>>40),
		uint8(x>>48),
		uint8(x>>56))
	return nil
}

// EncodeFixed32 writes a 32-bit integer to the Buffer.
// This is the format for the
// fixed32, sfixed32, and float protocol buffer types.
func (p *Buffer) EncodeFixed32(x uint64) error {
	p.buf = append(p.buf,
		uint8(x),
		uint8(x>>8),
		uint8(x>>16),
		uint8(x>>24))
	return nil
}

// EncodeZigzag64 writes a zigzag-encoded 64-bit integer
// to the Buffer.
// This is the format used for the sint64 protocol buffer type.
func (p *Buffer) EncodeZigzag64(x uint64) error {
	// use signed number to get arithmetic right shift.
	return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}

// EncodeZigzag32 writes a zigzag-encoded 32-bit integer
// to the Buffer.
// This is the format used for the sint32 protocol buffer type.
func (p *Buffer) EncodeZigzag32(x uint64) error {
	// use signed number to get arithmetic right shift.
	return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31))))
}

// EncodeRawBytes writes a count-delimited byte buffer to the Buffer.
// This is the format used for the bytes protocol buffer
// type and for embedded messages.
func (p *Buffer) EncodeRawBytes(b []byte) error {
	p.EncodeVarint(uint64(len(b)))
	p.buf = append(p.buf, b...)
	return nil
}

// EncodeStringBytes writes an encoded string to the Buffer.
// This is the format used for the proto2 string type.
func (p *Buffer) EncodeStringBytes(s string) error {
	p.EncodeVarint(uint64(len(s)))
	p.buf = append(p.buf, s...)
	return nil
}

// Marshaler is the interface representing objects that can marshal themselves.
type Marshaler interface {
	Marshal() ([]byte, error)
}

// EncodeMessage writes the protocol buffer to the Buffer,
// prefixed by a varint-encoded length.
func (p *Buffer) EncodeMessage(pb Message) error {
	siz := Size(pb)
	p.EncodeVarint(uint64(siz))
	return p.Marshal(pb)
}

// All protocol buffer fields are nillable, but be careful.
func isNil(v reflect.Value) bool {
	switch v.Kind() {
	case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
		return v.IsNil()
	}
	return false
}

D vendor/github.com/golang/protobuf/proto/equal.go => vendor/github.com/golang/protobuf/proto/equal.go +0 -301
@@ 1,301 0,0 @@
// Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2011 The Go Authors.  All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// Protocol buffer comparison.

package proto

import (
	"bytes"
	"log"
	"reflect"
	"strings"
)

/*
Equal returns true iff protocol buffers a and b are equal.
The arguments must both be pointers to protocol buffer structs.

Equality is defined in this way:
  - Two messages are equal iff they are the same type,
    corresponding fields are equal, unknown field sets
    are equal, and extensions sets are equal.
  - Two set scalar fields are equal iff their values are equal.
    If the fields are of a floating-point type, remember that
    NaN != x for all x, including NaN. If the message is defined
    in a proto3 .proto file, fields are not "set"; specifically,
    zero length proto3 "bytes" fields are equal (nil == {}).
  - Two repeated fields are equal iff their lengths are the same,
    and their corresponding elements are equal. Note a "bytes" field,
    although represented by []byte, is not a repeated field and the
    rule for the scalar fields described above applies.
  - Two unset fields are equal.
  - Two unknown field sets are equal if their current
    encoded state is equal.
  - Two extension sets are equal iff they have corresponding
    elements that are pairwise equal.
  - Two map fields are equal iff their lengths are the same,
    and they contain the same set of elements. Zero-length map
    fields are equal.
  - Every other combination of things are not equal.

The return value is undefined if a and b are not protocol buffers.
*/
func Equal(a, b Message) bool {
	if a == nil || b == nil {
		return a == b
	}
	v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b)
	if v1.Type() != v2.Type() {
		return false
	}
	if v1.Kind() == reflect.Ptr {
		if v1.IsNil() {
			return v2.IsNil()
		}
		if v2.IsNil() {
			return false
		}
		v1, v2 = v1.Elem(), v2.Elem()
	}
	if v1.Kind() != reflect.Struct {
		return false
	}
	return equalStruct(v1, v2)
}

// v1 and v2 are known to have the same type.
func equalStruct(v1, v2 reflect.Value) bool {
	sprop := GetProperties(v1.Type())
	for i := 0; i < v1.NumField(); i++ {
		f := v1.Type().Field(i)
		if strings.HasPrefix(f.Name, "XXX_") {
			continue
		}
		f1, f2 := v1.Field(i), v2.Field(i)
		if f.Type.Kind() == reflect.Ptr {
			if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 {
				// both unset
				continue
			} else if n1 != n2 {
				// set/unset mismatch
				return false
			}
			f1, f2 = f1.Elem(), f2.Elem()
		}
		if !equalAny(f1, f2, sprop.Prop[i]) {
			return false
		}
	}

	if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() {
		em2 := v2.FieldByName("XXX_InternalExtensions")
		if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) {
			return false
		}
	}

	if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() {
		em2 := v2.FieldByName("XXX_extensions")
		if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) {
			return false
		}
	}

	uf := v1.FieldByName("XXX_unrecognized")
	if !uf.IsValid() {
		return true
	}

	u1 := uf.Bytes()
	u2 := v2.FieldByName("XXX_unrecognized").Bytes()
	return bytes.Equal(u1, u2)
}

// v1 and v2 are known to have the same type.
// prop may be nil.
func equalAny(v1, v2 reflect.Value, prop *Properties) bool {
	if v1.Type() == protoMessageType {
		m1, _ := v1.Interface().(Message)
		m2, _ := v2.Interface().(Message)
		return Equal(m1, m2)
	}
	switch v1.Kind() {
	case reflect.Bool:
		return v1.Bool() == v2.Bool()
	case reflect.Float32, reflect.Float64:
		return v1.Float() == v2.Float()
	case reflect.Int32, reflect.Int64:
		return v1.Int() == v2.Int()
	case reflect.Interface:
		// Probably a oneof field; compare the inner values.
		n1, n2 := v1.IsNil(), v2.IsNil()
		if n1 || n2 {
			return n1 == n2
		}
		e1, e2 := v1.Elem(), v2.Elem()
		if e1.Type() != e2.Type() {
			return false
		}
		return equalAny(e1, e2, nil)
	case reflect.Map:
		if v1.Len() != v2.Len() {
			return false
		}
		for _, key := range v1.MapKeys() {
			val2 := v2.MapIndex(key)
			if !val2.IsValid() {
				// This key was not found in the second map.
				return false
			}
			if !equalAny(v1.MapIndex(key), val2, nil) {
				return false
			}
		}
		return true
	case reflect.Ptr:
		// Maps may have nil values in them, so check for nil.
		if v1.IsNil() && v2.IsNil() {
			return true
		}
		if v1.IsNil() != v2.IsNil() {
			return false
		}
		return equalAny(v1.Elem(), v2.Elem(), prop)
	case reflect.Slice:
		if v1.Type().Elem().Kind() == reflect.Uint8 {
			// short circuit: []byte

			// Edge case: if this is in a proto3 message, a zero length
			// bytes field is considered the zero value.
			if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 {
				return true
			}
			if v1.IsNil() != v2.IsNil() {
				return false
			}
			return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte))
		}

		if v1.Len() != v2.Len() {
			return false
		}
		for i := 0; i < v1.Len(); i++ {
			if !equalAny(v1.Index(i), v2.Index(i), prop) {
				return false
			}
		}
		return true
	case reflect.String:
		return v1.Interface().(string) == v2.Interface().(string)
	case reflect.Struct:
		return equalStruct(v1, v2)
	case reflect.Uint32, reflect.Uint64:
		return v1.Uint() == v2.Uint()
	}

	// unknown type, so not a protocol buffer
	log.Printf("proto: don't know how to compare %v", v1)
	return false
}

// base is the struct type that the extensions are based on.
// x1 and x2 are InternalExtensions.
func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool {
	em1, _ := x1.extensionsRead()
	em2, _ := x2.extensionsRead()
	return equalExtMap(base, em1, em2)
}

func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool {
	if len(em1) != len(em2) {
		return false
	}

	for extNum, e1 := range em1 {
		e2, ok := em2[extNum]
		if !ok {
			return false
		}

		m1 := extensionAsLegacyType(e1.value)
		m2 := extensionAsLegacyType(e2.value)

		if m1 == nil && m2 == nil {
			// Both have only encoded form.
			if bytes.Equal(e1.enc, e2.enc) {
				continue
			}
			// The bytes are different, but the extensions might still be
			// equal. We need to decode them to compare.
		}

		if m1 != nil && m2 != nil {
			// Both are unencoded.
			if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {
				return false
			}
			continue
		}

		// At least one is encoded. To do a semantically correct comparison
		// we need to unmarshal them first.
		var desc *ExtensionDesc
		if m := extensionMaps[base]; m != nil {
			desc = m[extNum]
		}
		if desc == nil {
			// If both have only encoded form and the bytes are the same,
			// it is handled above. We get here when the bytes are different.
			// We don't know how to decode it, so just compare them as byte
			// slices.
			log.Printf("proto: don't know how to compare extension %d of %v", extNum, base)
			return false
		}
		var err error
		if m1 == nil {
			m1, err = decodeExtension(e1.enc, desc)
		}
		if m2 == nil && err == nil {
			m2, err = decodeExtension(e2.enc, desc)
		}
		if err != nil {
			// The encoded form is invalid.
			log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err)
			return false
		}
		if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {
			return false
		}
	}

	return true
}

M vendor/github.com/golang/protobuf/proto/extensions.go => vendor/github.com/golang/protobuf/proto/extensions.go +259 -510
@@ 1,310 1,111 @@
// Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2010 The Go Authors.  All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Copyright 2010 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.

package proto

/*
 * Types and routines for supporting protocol buffer extensions.
 */

import (
	"errors"
	"fmt"
	"io"
	"reflect"
	"strconv"
	"sync"
)

// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message.
var ErrMissingExtension = errors.New("proto: missing extension")

// ExtensionRange represents a range of message extensions for a protocol buffer.
// Used in code generated by the protocol compiler.
type ExtensionRange struct {
	Start, End int32 // both inclusive
}

// extendableProto is an interface implemented by any protocol buffer generated by the current
// proto compiler that may be extended.
type extendableProto interface {
	Message
	ExtensionRangeArray() []ExtensionRange
	extensionsWrite() map[int32]Extension
	extensionsRead() (map[int32]Extension, sync.Locker)
}

// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous
// version of the proto compiler that may be extended.
type extendableProtoV1 interface {
	Message
	ExtensionRangeArray() []ExtensionRange
	ExtensionMap() map[int32]Extension
}

// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto.
type extensionAdapter struct {
	extendableProtoV1
}
	"google.golang.org/protobuf/encoding/protowire"
	"google.golang.org/protobuf/proto"
	"google.golang.org/protobuf/reflect/protoreflect"
	"google.golang.org/protobuf/reflect/protoregistry"
	"google.golang.org/protobuf/runtime/protoiface"
	"google.golang.org/protobuf/runtime/protoimpl"
)

func (e extensionAdapter) extensionsWrite() map[int32]Extension {
	return e.ExtensionMap()
}
type (
	// ExtensionDesc represents an extension descriptor and
	// is used to interact with an extension field in a message.
	//
	// Variables of this type are generated in code by protoc-gen-go.
	ExtensionDesc = protoimpl.ExtensionInfo

func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) {
	return e.ExtensionMap(), notLocker{}
}
	// ExtensionRange represents a range of message extensions.
	// Used in code generated by protoc-gen-go.
	ExtensionRange = protoiface.ExtensionRangeV1

// notLocker is a sync.Locker whose Lock and Unlock methods are nops.
type notLocker struct{}
	// Deprecated: Do not use; this is an internal type.
	Extension = protoimpl.ExtensionFieldV1

func (n notLocker) Lock()   {}
func (n notLocker) Unlock() {}
	// Deprecated: Do not use; this is an internal type.
	XXX_InternalExtensions = protoimpl.ExtensionFields
)

// extendable returns the extendableProto interface for the given generated proto message.
// If the proto message has the old extension format, it returns a wrapper that implements
// the extendableProto interface.
func extendable(p interface{}) (extendableProto, error) {
	switch p := p.(type) {
	case extendableProto:
		if isNilPtr(p) {
			return nil, fmt.Errorf("proto: nil %T is not extendable", p)
		}
		return p, nil
	case extendableProtoV1:
		if isNilPtr(p) {
			return nil, fmt.Errorf("proto: nil %T is not extendable", p)
		}
		return extensionAdapter{p}, nil
	}
	// Don't allocate a specific error containing %T:
	// this is the hot path for Clone and MarshalText.
	return nil, errNotExtendable
}
// ErrMissingExtension reports whether the extension was not present.
var ErrMissingExtension = errors.New("proto: missing extension")

var errNotExtendable = errors.New("proto: not an extendable proto.Message")

func isNilPtr(x interface{}) bool {
	v := reflect.ValueOf(x)
	return v.Kind() == reflect.Ptr && v.IsNil()
}

// XXX_InternalExtensions is an internal representation of proto extensions.
//
// Each generated message struct type embeds an anonymous XXX_InternalExtensions field,
// thus gaining the unexported 'extensions' method, which can be called only from the proto package.
//
// The methods of XXX_InternalExtensions are not concurrency safe in general,
// but calls to logically read-only methods such as has and get may be executed concurrently.
type XXX_InternalExtensions struct {
	// The struct must be indirect so that if a user inadvertently copies a
	// generated message and its embedded XXX_InternalExtensions, they
	// avoid the mayhem of a copied mutex.
	//
	// The mutex serializes all logically read-only operations to p.extensionMap.
	// It is up to the client to ensure that write operations to p.extensionMap are
	// mutually exclusive with other accesses.
	p *struct {
		mu           sync.Mutex
		extensionMap map[int32]Extension
// HasExtension reports whether the extension field is present in m
// either as an explicitly populated field or as an unknown field.
func HasExtension(m Message, xt *ExtensionDesc) (has bool) {
	mr := MessageReflect(m)
	if mr == nil || !mr.IsValid() {
		return false
	}
}

// extensionsWrite returns the extension map, creating it on first use.
func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension {
	if e.p == nil {
		e.p = new(struct {
			mu           sync.Mutex
			extensionMap map[int32]Extension
	// Check whether any populated known field matches the field number.
	xtd := xt.TypeDescriptor()
	if isValidExtension(mr.Descriptor(), xtd) {
		has = mr.Has(xtd)
	} else {
		mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {
			has = int32(fd.Number()) == xt.Field
			return !has
		})
		e.p.extensionMap = make(map[int32]Extension)
	}
	return e.p.extensionMap
}

// extensionsRead returns the extensions map for read-only use.  It may be nil.
// The caller must hold the returned mutex's lock when accessing Elements within the map.
func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) {
	if e.p == nil {
		return nil, nil
	// Check whether any unknown field matches the field number.
	for b := mr.GetUnknown(); !has && len(b) > 0; {
		num, _, n := protowire.ConsumeField(b)
		has = int32(num) == xt.Field
		b = b[n:]
	}
	return e.p.extensionMap, &e.p.mu
}

// ExtensionDesc represents an extension specification.
// Used in generated code from the protocol compiler.
type ExtensionDesc struct {
	ExtendedType  Message     // nil pointer to the type that is being extended
	ExtensionType interface{} // nil pointer to the extension type
	Field         int32       // field number
	Name          string      // fully-qualified name of extension, for text formatting
	Tag           string      // protobuf tag style
	Filename      string      // name of the file in which the extension is defined
}

func (ed *ExtensionDesc) repeated() bool {
	t := reflect.TypeOf(ed.ExtensionType)
	return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
}

// Extension represents an extension in a message.
type Extension struct {
	// When an extension is stored in a message using SetExtension
	// only desc and value are set. When the message is marshaled
	// enc will be set to the encoded form of the message.
	//
	// When a message is unmarshaled and contains extensions, each
	// extension will have only enc set. When such an extension is
	// accessed using GetExtension (or GetExtensions) desc and value
	// will be set.
	desc *ExtensionDesc

	// value is a concrete value for the extension field. Let the type of
	// desc.ExtensionType be the "API type" and the type of Extension.value
	// be the "storage type". The API type and storage type are the same except:
	//	* For scalars (except []byte), the API type uses *T,
	//	while the storage type uses T.
	//	* For repeated fields, the API type uses []T, while the storage type
	//	uses *[]T.
	//
	// The reason for the divergence is so that the storage type more naturally
	// matches what is expected of when retrieving the values through the
	// protobuf reflection APIs.
	//
	// The value may only be populated if desc is also populated.
	value interface{}

	// enc is the raw bytes for the extension field.
	enc []byte
	return has
}

// SetRawExtension is for testing only.
func SetRawExtension(base Message, id int32, b []byte) {
	epb, err := extendable(base)
	if err != nil {
// ClearExtension removes the the exntesion field from m
// either as an explicitly populated field or as an unknown field.
func ClearExtension(m Message, xt *ExtensionDesc) {
	mr := MessageReflect(m)
	if mr == nil || !mr.IsValid() {
		return
	}
	extmap := epb.extensionsWrite()
	extmap[id] = Extension{enc: b}
}

// isExtensionField returns true iff the given field number is in an extension range.
func isExtensionField(pb extendableProto, field int32) bool {
	for _, er := range pb.ExtensionRangeArray() {
		if er.Start <= field && field <= er.End {
	xtd := xt.TypeDescriptor()
	if isValidExtension(mr.Descriptor(), xtd) {
		mr.Clear(xtd)
	} else {
		mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {
			if int32(fd.Number()) == xt.Field {
				mr.Clear(fd)
				return false
			}
			return true
		}
	}
	return false
}

// checkExtensionTypes checks that the given extension is valid for pb.
func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error {
	var pbi interface{} = pb
	// Check the extended type.
	if ea, ok := pbi.(extensionAdapter); ok {
		pbi = ea.extendableProtoV1
	}
	if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b {
		return fmt.Errorf("proto: bad extended type; %v does not extend %v", b, a)
	}
	// Check the range.
	if !isExtensionField(pb, extension.Field) {
		return errors.New("proto: bad extension number; not in declared ranges")
	}
	return nil
}

// extPropKey is sufficient to uniquely identify an extension.
type extPropKey struct {
	base  reflect.Type
	field int32
}

var extProp = struct {
	sync.RWMutex
	m map[extPropKey]*Properties
}{
	m: make(map[extPropKey]*Properties),
}

func extensionProperties(ed *ExtensionDesc) *Properties {
	key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field}

	extProp.RLock()
	if prop, ok := extProp.m[key]; ok {
		extProp.RUnlock()
		return prop
	}
	extProp.RUnlock()

	extProp.Lock()
	defer extProp.Unlock()
	// Check again.
	if prop, ok := extProp.m[key]; ok {
		return prop
	}

	prop := new(Properties)
	prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil)
	extProp.m[key] = prop
	return prop
}

// HasExtension returns whether the given extension is present in pb.
func HasExtension(pb Message, extension *ExtensionDesc) bool {
	// TODO: Check types, field numbers, etc.?
	epb, err := extendable(pb)
	if err != nil {
		return false
	}
	extmap, mu := epb.extensionsRead()
	if extmap == nil {
		return false
		})
	}
	mu.Lock()
	_, ok := extmap[extension.Field]
	mu.Unlock()
	return ok
	clearUnknown(mr, fieldNum(xt.Field))
}

// ClearExtension removes the given extension from pb.
func ClearExtension(pb Message, extension *ExtensionDesc) {
	epb, err := extendable(pb)
	if err != nil {
// ClearAllExtensions clears all extensions from m.
// This includes populated fields and unknown fields in the extension range.
func ClearAllExtensions(m Message) {
	mr := MessageReflect(m)
	if mr == nil || !mr.IsValid() {
		return
	}
	// TODO: Check types, field numbers, etc.?
	extmap := epb.extensionsWrite()
	delete(extmap, extension.Field)

	mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {
		if fd.IsExtension() {
			mr.Clear(fd)
		}
		return true
	})
	clearUnknown(mr, mr.Descriptor().ExtensionRanges())
}

// GetExtension retrieves a proto2 extended field from pb.


@@ 314,294 115,242 @@ func ClearExtension(pb Message, extension *ExtensionDesc) {
// If the field is not present, then the default value is returned (if one is specified),
// otherwise ErrMissingExtension is reported.
//
// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil),
// then GetExtension returns the raw encoded bytes of the field extension.
func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) {
	epb, err := extendable(pb)
	if err != nil {
		return nil, err
	}

	if extension.ExtendedType != nil {
		// can only check type if this is a complete descriptor
		if err := checkExtensionTypes(epb, extension); err != nil {
			return nil, err
// If the descriptor is type incomplete (i.e., ExtensionDesc.ExtensionType is nil),
// then GetExtension returns the raw encoded bytes for the extension field.
func GetExtension(m Message, xt *ExtensionDesc) (interface{}, error) {
	mr := MessageReflect(m)
	if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 {
		return nil, errNotExtendable
	}

	// Retrieve the unknown fields for this extension field.
	var bo protoreflect.RawFields
	for bi := mr.GetUnknown(); len(bi) > 0; {
		num, _, n := protowire.ConsumeField(bi)
		if int32(num) == xt.Field {
			bo = append(bo, bi[:n]...)
		}
		bi = bi[n:]
	}

	emap, mu := epb.extensionsRead()
	if emap == nil {
		return defaultExtensionValue(extension)
	}
	mu.Lock()
	defer mu.Unlock()
	e, ok := emap[extension.Field]
	if !ok {
		// defaultExtensionValue returns the default value or
		// ErrMissingExtension if there is no default.
		return defaultExtensionValue(extension)
	}

	if e.value != nil {
		// Already decoded. Check the descriptor, though.
		if e.desc != extension {
			// This shouldn't happen. If it does, it means that
			// GetExtension was called twice with two different
			// descriptors with the same field number.
			return nil, errors.New("proto: descriptor conflict")
		}
		return extensionAsLegacyType(e.value), nil
	// For type incomplete descriptors, only retrieve the unknown fields.
	if xt.ExtensionType == nil {