From 419ede8f8c033af7124351f0d87b53cf25d3ff9c Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 20 Sep 2018 11:20:11 -0700 Subject: [PATCH 001/133] go.mod: hardcode a local checkout of the v2 API Add a test.bash script based on the v2 test script that ensures the local checkout is in the same location and that it is up-to-date. Change-Id: Ia452b9cb272d2e3ecc5f57d68d1dd0e08142316d Reviewed-on: https://go-review.googlesource.com/136537 Reviewed-by: Damien Neil --- .gitignore | 3 ++ go.mod | 3 ++ go.sum | 4 ++ proto/lib.go | 4 ++ test.bash | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+) create mode 100755 test.bash diff --git a/.gitignore b/.gitignore index c7dd40587c..3113235f96 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +.cache +vendor + .DS_Store *.[568ao] *.ao diff --git a/go.mod b/go.mod index 3942d6e0ca..84baffce95 100644 --- a/go.mod +++ b/go.mod @@ -4,4 +4,7 @@ require ( golang.org/x/net v0.0.0-20180906233101-161cd47e91fd // indirect golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f google.golang.org/genproto v0.0.0-20180831171423-11092d34479b + google.golang.org/proto v0.0.0 ) + +replace google.golang.org/proto => ./.cache/go-protobuf-v2 diff --git a/go.sum b/go.sum index 72fb985259..61955b2cf5 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,10 @@ +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +golang.org/x/net v0.0.0-20180821023952-922f4815f713/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/tools v0.0.0-20180904205237-0aa4b8830f48/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b h1:lohp5blsw53GBXtLyLNaTXPXS9pJ1tiTw61ZHUoE9Qw= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= diff --git a/proto/lib.go b/proto/lib.go index c076dbdb91..aaa2cfa645 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -271,6 +271,10 @@ import ( "sort" "strconv" "sync" + + // Add a bogus dependency on the v2 API to ensure the Go toolchain does not + // remove our dependency from the go.mod file. + _ "google.golang.org/proto/reflect/protoreflect" ) // RequiredNotSetError is an error type returned by either Marshal or Unmarshal. diff --git a/test.bash b/test.bash new file mode 100755 index 0000000000..338078c8f1 --- /dev/null +++ b/test.bash @@ -0,0 +1,103 @@ +#!/bin/bash +# 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. + +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +function print() { echo -e "\x1b[1m> $@\x1b[0m"; } + +# The test directory contains the Go and protobuf toolchains used for testing. +# The bin directory contains symlinks to each tool by version. +# It is safe to delete this directory and run the test script from scratch. +TEST_DIR=$REPO_ROOT/.cache +mkdir -p $TEST_DIR/bin +function register_binary() { + rm -f $TEST_DIR/bin/$1 # best-effort delete + ln -s $TEST_DIR/$2 $TEST_DIR/bin/$1 +} +export PATH=$TEST_DIR/bin:$PATH +cd $TEST_DIR # install toolchains relative to test directory + +# Download and build the protobuf toolchain. +# We avoid downloading the pre-compiled binaries since they do not contain +# the conformance test runner. +PROTOBUF_VERSION=3.6.1 +PROTOBUF_DIR="protobuf-$PROTOBUF_VERSION" +if [ ! -d $PROTOBUF_DIR ]; then + print "download and build $PROTOBUF_DIR" + (curl -s -L https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/protobuf-all-$PROTOBUF_VERSION.tar.gz | tar -zxf -) || exit 1 + (cd $PROTOBUF_DIR && ./configure && make && cd conformance && make) || exit 1 +fi +register_binary conformance-test-runner $PROTOBUF_DIR/conformance/conformance-test-runner +register_binary protoc $PROTOBUF_DIR/src/protoc + +# Download and update the v2 golang/protobuf code. +if [ ! -d go-protobuf-v2 ]; then + print "download v2 golang/protobuf" + git clone https://go.googlesource.com/protobuf go-protobuf-v2 +fi +print "update v2 golang/protobuf" +(cd go-protobuf-v2 && git fetch && git pull) + +# Download the Go toolchain. +GO_VERSION=go1.11 +if [ ! -d $GO_VERSION ]; then + print "download $GO_VERSION" + GOOS=$(uname | tr '[:upper:]' '[:lower:]') + (mkdir $GO_VERSION && curl -s -L https://dl.google.com/go/$GO_VERSION.$GOOS-amd64.tar.gz | tar -zxf - -C $GO_VERSION --strip-components 1) || exit 1 +fi +register_binary go $GO_VERSION/bin/go +register_binary gofmt $GO_VERSION/bin/gofmt + +# Travis-CI sets GOROOT, which confuses later invocations of the Go toolchains. +# Explicitly clear GOROOT, so each toolchain uses their default GOROOT. +unset GOROOT + +# Setup GOPATH for pre-module support. +MODULE_PATH=$(cd $REPO_ROOT && go list -m -f "{{.Path}}") +rm -f gopath/src/$MODULE_PATH # best-effort delete +mkdir -p gopath/src/$(dirname $MODULE_PATH) +(cd gopath/src/$(dirname $MODULE_PATH) && ln -s $REPO_ROOT $(basename $MODULE_PATH)) +export GOPATH=$TEST_DIR/gopath + +# Download dependencies using modules. +# For pre-module support, dump the dependencies in a vendor directory. +(cd $REPO_ROOT && go mod tidy && go mod vendor) || exit 1 + +# Build and run all targets +RET=0 +function go() { + print "$GO_VERSION $@" + # Use a per-version Go cache to work around bugs in Go build caching. + # See https://golang.org/issue/26883 + GO_CACHE="$TEST_DIR/cache.$GO_VERSION" + (cd $GOPATH/src/$MODULE_PATH && GOCACHE=$GO_CACHE $GO_VERSION "$@") || RET=1 +} +go build ./... +go test ./... + +# Run commands that produce output when there is a failure. +function check() { + OUT=$(cd $REPO_ROOT && "$@" 2>&1) + if [ ! -z "$OUT" ]; then + print "$@" + echo "$OUT" + RET=1 + fi +} + +# Check for stale or unformatted source files. +check gofmt -d $(cd $REPO_ROOT && git ls-files '*.go') + +# Check for changed or untracked files. +check git diff --no-prefix HEAD +check git ls-files --others --exclude-standard + +# Print termination status. +if [ $RET -eq 0 ]; then + echo -e "\x1b[32;1mPASS\x1b[0m" +else + echo -e "\x1b[31;1mFAIL\x1b[0m" +fi +exit $RET From a4da01d008d8b6b778c2766d7ae1c04843898bc6 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 21 Sep 2018 18:07:44 -0700 Subject: [PATCH 002/133] go.mod: rely on go get support for modules instead of local paths In CL 136736, we renamed the import path as github.com/golang/protobuf/v2 so that it can be fetched as a module with "go get". Use that mechanism to introduce the dependency on v2 instead of using the replace feature to point at a local checkout. While we are at it, also fix Travis: * The test.bash script is now an exact copy of the one in v2, except that we do not run "./internal/cmd/generate-types". * The .travis.yml config is now an exact copy of the one in the v2 where it simply delegates dependency management and testing to test.bash. The v2 dependency can be updated to use the latest by running: go get github.com/golang/protobuf/v2@api-v2 Change-Id: I2284d0bae82afc5306c91977aa44d09f7e5a41cc Reviewed-on: https://go-review.googlesource.com/136737 Reviewed-by: Damien Neil --- .travis.yml | 34 +++------------------ go.mod | 4 +-- go.sum | 2 ++ proto/lib.go | 2 +- test.bash | 83 ++++++++++++++++++++++++++++++++++------------------ 5 files changed, 62 insertions(+), 63 deletions(-) diff --git a/.travis.yml b/.travis.yml index 78949c886c..0aec6a31bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,31 +1,5 @@ -sudo: false -language: go -go: -- 1.6.x -- 1.10.x -- 1.x - -install: - - go get -v -d google.golang.org/grpc - - go get -v -d -t github.com/golang/protobuf/... - - curl -L https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip -o /tmp/protoc.zip - - unzip /tmp/protoc.zip -d "$HOME"/protoc - - mkdir -p "$HOME"/src && ln -s "$HOME"/protoc "$HOME"/src/protobuf - -env: - - PATH=$HOME/protoc/bin:$PATH - script: - - make all - - make regenerate - # TODO(tamird): When https://github.com/travis-ci/gimme/pull/130 is - # released, make this look for "1.x". - - if [[ "$TRAVIS_GO_VERSION" == 1.10* ]]; then - if [[ "$(git status --porcelain 2>&1)" != "" ]]; then - git status >&2; - git diff -a >&2; - exit 1; - fi; - echo "git status is clean."; - fi; - - make test + - ./test.bash +cache: + directories: + - .cache diff --git a/go.mod b/go.mod index 84baffce95..20e67a0a20 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,8 @@ module github.com/golang/protobuf require ( + github.com/golang/protobuf/v2 v2.0.0-20180924161150-01ab29648ebc golang.org/x/net v0.0.0-20180906233101-161cd47e91fd // indirect golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f google.golang.org/genproto v0.0.0-20180831171423-11092d34479b - google.golang.org/proto v0.0.0 ) - -replace google.golang.org/proto => ./.cache/go-protobuf-v2 diff --git a/go.sum b/go.sum index 61955b2cf5..c5d7b190bf 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,6 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf/v2 v2.0.0-20180924161150-01ab29648ebc h1:F2G3fOGA3Jscrr7lwzx8EbcX/KKvPHDWUL1LQO+EsXE= +github.com/golang/protobuf/v2 v2.0.0-20180924161150-01ab29648ebc/go.mod h1:pUFc/zvPj/qlI5nj8gEgsCPCTpICLT32W2c/kQ1v5HU= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= golang.org/x/net v0.0.0-20180821023952-922f4815f713/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= diff --git a/proto/lib.go b/proto/lib.go index aaa2cfa645..e66cbf76cf 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -274,7 +274,7 @@ import ( // Add a bogus dependency on the v2 API to ensure the Go toolchain does not // remove our dependency from the go.mod file. - _ "google.golang.org/proto/reflect/protoreflect" + _ "github.com/golang/protobuf/v2/reflect/protoreflect" ) // RequiredNotSetError is an error type returned by either Marshal or Unmarshal. diff --git a/test.bash b/test.bash index 338078c8f1..75022abe4e 100755 --- a/test.bash +++ b/test.bash @@ -31,51 +31,76 @@ if [ ! -d $PROTOBUF_DIR ]; then fi register_binary conformance-test-runner $PROTOBUF_DIR/conformance/conformance-test-runner register_binary protoc $PROTOBUF_DIR/src/protoc +# Allow protoc to find google/protobuf/*.proto. +rm -rf $PROTOBUF_DIR/src/include +mkdir -p $PROTOBUF_DIR/src/include +ln -s ../google $PROTOBUF_DIR/src/include/google -# Download and update the v2 golang/protobuf code. -if [ ! -d go-protobuf-v2 ]; then - print "download v2 golang/protobuf" - git clone https://go.googlesource.com/protobuf go-protobuf-v2 -fi -print "update v2 golang/protobuf" -(cd go-protobuf-v2 && git fetch && git pull) - -# Download the Go toolchain. -GO_VERSION=go1.11 -if [ ! -d $GO_VERSION ]; then - print "download $GO_VERSION" - GOOS=$(uname | tr '[:upper:]' '[:lower:]') - (mkdir $GO_VERSION && curl -s -L https://dl.google.com/go/$GO_VERSION.$GOOS-amd64.tar.gz | tar -zxf - -C $GO_VERSION --strip-components 1) || exit 1 -fi -register_binary go $GO_VERSION/bin/go -register_binary gofmt $GO_VERSION/bin/gofmt +# Download each Go toolchain version. +GO_LATEST=go1.11 +GO_VERSIONS=(go1.9.7 go1.10.3 $GO_LATEST) +for GO_VERSION in ${GO_VERSIONS[@]}; do + if [ ! -d $GO_VERSION ]; then + print "download $GO_VERSION" + GOOS=$(uname | tr '[:upper:]' '[:lower:]') + (mkdir $GO_VERSION && curl -s -L https://dl.google.com/go/$GO_VERSION.$GOOS-amd64.tar.gz | tar -zxf - -C $GO_VERSION --strip-components 1) || exit 1 + fi + register_binary $GO_VERSION $GO_VERSION/bin/go +done +register_binary go $GO_LATEST/bin/go +register_binary gofmt $GO_LATEST/bin/gofmt # Travis-CI sets GOROOT, which confuses later invocations of the Go toolchains. # Explicitly clear GOROOT, so each toolchain uses their default GOROOT. unset GOROOT # Setup GOPATH for pre-module support. +export GOPATH=$TEST_DIR/gopath MODULE_PATH=$(cd $REPO_ROOT && go list -m -f "{{.Path}}") -rm -f gopath/src/$MODULE_PATH # best-effort delete +rm -rf gopath/src # best-effort delete mkdir -p gopath/src/$(dirname $MODULE_PATH) (cd gopath/src/$(dirname $MODULE_PATH) && ln -s $REPO_ROOT $(basename $MODULE_PATH)) -export GOPATH=$TEST_DIR/gopath # Download dependencies using modules. # For pre-module support, dump the dependencies in a vendor directory. (cd $REPO_ROOT && go mod tidy && go mod vendor) || exit 1 -# Build and run all targets +# Run tests across every supported version of Go. +LABELS=() +PIDS=() +OUTS=() +function cleanup() { for OUT in ${OUTS[@]}; do rm $OUT; done; } +trap cleanup EXIT +for GO_VERSION in ${GO_VERSIONS[@]}; do + # Run the go command in a background process. + function go() { + # Use a per-version Go cache to work around bugs in Go build caching. + # See https://golang.org/issue/26883 + GO_CACHE="$TEST_DIR/cache.$GO_VERSION" + LABELS+=("$(echo "$GO_VERSION $@")") + OUT=$(mktemp) + (cd $GOPATH/src/$MODULE_PATH && GOCACHE=$GO_CACHE $GO_VERSION "$@" &> $OUT) & + PIDS+=($!) + OUTS+=($OUT) + } + + go build ./... + go test -race ./... + go test -race -tags purego ./... + go test -race -tags proto1_legacy ./... + + unset go # to avoid confusing later invocations of "go" +done + +# Wait for all processes to finish. RET=0 -function go() { - print "$GO_VERSION $@" - # Use a per-version Go cache to work around bugs in Go build caching. - # See https://golang.org/issue/26883 - GO_CACHE="$TEST_DIR/cache.$GO_VERSION" - (cd $GOPATH/src/$MODULE_PATH && GOCACHE=$GO_CACHE $GO_VERSION "$@") || RET=1 -} -go build ./... -go test ./... +for I in ${!PIDS[@]}; do + print "${LABELS[$I]}" + if ! wait ${PIDS[$I]}; then + cat ${OUTS[$I]} # only output upon error + RET=1 + fi +done # Run commands that produce output when there is a failure. function check() { From aaf9c3b54ff2d3e40f85540b0c98b0d2f5fbaf34 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Fri, 28 Sep 2018 12:50:57 -0700 Subject: [PATCH 003/133] protoc-gen-go: implement as wrapper of v2 protoc-gen-go The protoc-gen-go here is almost identical to the one in the v2 repository, but with support for inline grpc generation (plugins=grpc) and import_prefix. Updated golden .pb.go files with the latest versions from github.com/golang/protobuf. All tests still pass. This protoc-gen-go is generating identical output to the previous one for all test inputs. Change-Id: Ifac42d0980838989c4b5e52a928b7a14aeb3adf8 Reviewed-on: https://go-review.googlesource.com/c/138521 Reviewed-by: Joe Tsai --- go.mod | 5 +- go.sum | 11 ++- protoc-gen-go/generator/generator.go | 11 +-- protoc-gen-go/grpc/grpc.go | 9 +- protoc-gen-go/link_grpc.go | 34 -------- protoc-gen-go/main.go | 87 ++++++++++--------- .../testdata/deprecated/deprecated.pb.go | 49 +++++------ protoc-gen-go/testdata/grpc/grpc.pb.go | 49 +++++------ 8 files changed, 115 insertions(+), 140 deletions(-) delete mode 100644 protoc-gen-go/link_grpc.go diff --git a/go.mod b/go.mod index 20e67a0a20..465a928a85 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,9 @@ module github.com/golang/protobuf require ( - github.com/golang/protobuf/v2 v2.0.0-20180924161150-01ab29648ebc - golang.org/x/net v0.0.0-20180906233101-161cd47e91fd // indirect + github.com/golang/protobuf/v2 v2.0.0-20180928215628-ccf3fa6cad50 + golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 // indirect golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f + golang.org/x/tools v0.0.0-20180928181343-b3c0be4c978b // indirect google.golang.org/genproto v0.0.0-20180831171423-11092d34479b ) diff --git a/go.sum b/go.sum index c5d7b190bf..00d3daddf6 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,15 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf/v2 v2.0.0-20180924161150-01ab29648ebc h1:F2G3fOGA3Jscrr7lwzx8EbcX/KKvPHDWUL1LQO+EsXE= -github.com/golang/protobuf/v2 v2.0.0-20180924161150-01ab29648ebc/go.mod h1:pUFc/zvPj/qlI5nj8gEgsCPCTpICLT32W2c/kQ1v5HU= +github.com/golang/protobuf/v2 v2.0.0-20180928215628-ccf3fa6cad50 h1:gM4MP5Fi9r5FbsQY7aYxj/GBqNZUZiKjgYdAoQu129M= +github.com/golang/protobuf/v2 v2.0.0-20180928215628-ccf3fa6cad50/go.mod h1:pUFc/zvPj/qlI5nj8gEgsCPCTpICLT32W2c/kQ1v5HU= +github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= golang.org/x/net v0.0.0-20180821023952-922f4815f713/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 h1:dgd4x4kJt7G4k4m93AYLzM8Ni6h2qLTfh9n9vXJT3/0= +golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/tools v0.0.0-20180904205237-0aa4b8830f48/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180928181343-b3c0be4c978b h1:hjfKpJoTfQ2QXKPX9eCDFBZ0t9sDrZL/viAgrN962TQ= +golang.org/x/tools v0.0.0-20180928181343-b3c0be4c978b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b h1:lohp5blsw53GBXtLyLNaTXPXS9pJ1tiTw61ZHUoE9Qw= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 825381c6e0..f42f391df6 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -29,11 +29,12 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -/* - The code generator for the plugin for the Google protocol buffer compiler. - It generates Go code from the protocol buffer description files read by the - main routine. -*/ +// Package generator is deprecated. +// +// This package is excluded from the Go protocol buffer compatibility guarantee +// and may be deleted at some point in the future. +// +// Deprecated: Do not use. package generator import ( diff --git a/protoc-gen-go/grpc/grpc.go b/protoc-gen-go/grpc/grpc.go index faef1abb70..4e36b548a7 100644 --- a/protoc-gen-go/grpc/grpc.go +++ b/protoc-gen-go/grpc/grpc.go @@ -29,9 +29,12 @@ // (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 grpc outputs gRPC service descriptions in Go code. -// It runs as a plugin for the Go protocol buffer compiler plugin. -// It is linked in to protoc-gen-go. +// Package grpc is deprecated. +// +// This package is excluded from the Go protocol buffer compatibility guarantee +// and may be deleted at some point in the future. +// +// Deprecated: Do not use. package grpc import ( diff --git a/protoc-gen-go/link_grpc.go b/protoc-gen-go/link_grpc.go deleted file mode 100644 index 532a550050..0000000000 --- a/protoc-gen-go/link_grpc.go +++ /dev/null @@ -1,34 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2015 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 main - -import _ "github.com/golang/protobuf/protoc-gen-go/grpc" diff --git a/protoc-gen-go/main.go b/protoc-gen-go/main.go index 8e2486de0b..d9aef43d48 100644 --- a/protoc-gen-go/main.go +++ b/protoc-gen-go/main.go @@ -49,50 +49,57 @@ package main import ( - "io/ioutil" - "os" + "flag" + "fmt" + "strings" - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/protoc-gen-go/generator" + gengogrpc "github.com/golang/protobuf/v2/cmd/protoc-gen-go-grpc/internal_gengogrpc" + gengo "github.com/golang/protobuf/v2/cmd/protoc-gen-go/internal_gengo" + "github.com/golang/protobuf/v2/protogen" ) func main() { - // Begin by allocating a generator. The request and response structures are stored there - // so we can do error handling easily - the response structure contains the field to - // report failure. - g := generator.New() - - data, err := ioutil.ReadAll(os.Stdin) - if err != nil { - g.Error(err, "reading input") - } - - if err := proto.Unmarshal(data, g.Request); err != nil { - g.Error(err, "parsing input proto") - } - - if len(g.Request.FileToGenerate) == 0 { - g.Fail("no files to generate") - } - - g.CommandLineParameters(g.Request.GetParameter()) - - // Create a wrapped version of the Descriptors and EnumDescriptors that - // point to the file that defines them. - g.WrapTypes() - - g.SetPackageNames() - g.BuildTypeNameMap() - - g.GenerateAllFiles() - - // Send back the results. - data, err = proto.Marshal(g.Response) - if err != nil { - g.Error(err, "failed to marshal output proto") + var ( + flags flag.FlagSet + plugins = flags.String("plugins", "", "list of plugins to enable (supported values: grpc)") + importPrefix = flags.String("import_prefix", "", "prefix to prepend to import paths") + ) + importRewriteFunc := func(importPath protogen.GoImportPath) protogen.GoImportPath { + switch importPath { + case "context", "fmt", "math": + return importPath + } + if *importPrefix != "" { + return protogen.GoImportPath(*importPrefix) + importPath + } + return importPath } - _, err = os.Stdout.Write(data) - if err != nil { - g.Error(err, "failed to write output proto") + opts := &protogen.Options{ + ParamFunc: flags.Set, + ImportRewriteFunc: importRewriteFunc, } + protogen.Run(opts, func(gen *protogen.Plugin) error { + grpc := false + for _, plugin := range strings.Split(*plugins, ",") { + switch plugin { + case "grpc": + grpc = true + case "": + default: + return fmt.Errorf("protoc-gen-go: unknown plugin %q", plugin) + } + } + for _, f := range gen.Files { + if !f.Generate { + continue + } + filename := f.GeneratedFilenamePrefix + ".pb.go" + g := gen.NewGeneratedFile(filename, f.GoImportPath) + gengo.GenerateFile(gen, f, g) + if grpc { + gengogrpc.GenerateFileContent(gen, f, g) + } + } + return nil + }) } diff --git a/protoc-gen-go/testdata/deprecated/deprecated.pb.go b/protoc-gen-go/testdata/deprecated/deprecated.pb.go index bd5678a182..fed0a2416c 100644 --- a/protoc-gen-go/testdata/deprecated/deprecated.pb.go +++ b/protoc-gen-go/testdata/deprecated/deprecated.pb.go @@ -8,12 +8,9 @@ package deprecated import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" -) - -import ( context "golang.org/x/net/context" grpc "google.golang.org/grpc" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -132,6 +129,28 @@ func init() { proto.RegisterType((*DeprecatedResponse)(nil), "deprecated.DeprecatedResponse") } +func init() { proto.RegisterFile("deprecated/deprecated.proto", fileDescriptor_f64ba265cd7eae3f) } + +var fileDescriptor_f64ba265cd7eae3f = []byte{ + // 248 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0x49, 0x2d, 0x28, + 0x4a, 0x4d, 0x4e, 0x2c, 0x49, 0x4d, 0xd1, 0x47, 0x30, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, + 0xb8, 0x10, 0x22, 0x4a, 0xe2, 0x5c, 0x82, 0x2e, 0x70, 0x5e, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, + 0x89, 0x15, 0x93, 0x04, 0xa3, 0x52, 0x32, 0x97, 0x10, 0xb2, 0x44, 0x71, 0x41, 0x7e, 0x5e, 0x71, + 0xaa, 0x90, 0x27, 0x97, 0x00, 0x42, 0x73, 0x7c, 0x5a, 0x66, 0x6a, 0x4e, 0x8a, 0x04, 0xa3, 0x02, + 0xa3, 0x06, 0x9f, 0x91, 0x94, 0x1e, 0x92, 0x3d, 0x08, 0x9d, 0xae, 0x79, 0xa5, 0xb9, 0x4e, 0x4c, + 0x12, 0x8c, 0x41, 0xfc, 0x08, 0x69, 0x37, 0x90, 0x36, 0x90, 0x25, 0x5a, 0x1a, 0x5c, 0x7c, 0xa8, + 0x4a, 0x85, 0x84, 0xb8, 0xb8, 0x5c, 0x5c, 0x03, 0x82, 0x5c, 0x9d, 0x1d, 0x43, 0x5c, 0x5d, 0x04, + 0x18, 0xa4, 0x98, 0x38, 0x18, 0xa5, 0x98, 0x24, 0x18, 0x8d, 0xf2, 0x90, 0xdd, 0x19, 0x9c, 0x5a, + 0x54, 0x96, 0x99, 0x9c, 0x2a, 0x14, 0x82, 0xac, 0xdd, 0x39, 0x31, 0x27, 0x47, 0x48, 0x16, 0xbb, + 0x2b, 0xa0, 0x1e, 0x93, 0x92, 0xc3, 0x25, 0x0d, 0xf1, 0x9e, 0x12, 0x73, 0x07, 0x13, 0xa3, 0x14, + 0x88, 0x70, 0x72, 0x8c, 0xb2, 0x49, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, + 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x07, 0x07, 0x5f, 0x52, 0x69, 0x1a, 0x84, 0x91, 0xac, + 0x9b, 0x9e, 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x5f, 0x92, 0x5a, 0x5c, 0x92, 0x92, 0x58, 0x92, 0x88, + 0x14, 0xd2, 0x3b, 0x18, 0x19, 0x93, 0xd8, 0xc0, 0xaa, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x0e, 0xf5, 0x6c, 0x87, 0x8c, 0x01, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -212,25 +231,3 @@ var _DeprecatedService_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "deprecated/deprecated.proto", } - -func init() { proto.RegisterFile("deprecated/deprecated.proto", fileDescriptor_f64ba265cd7eae3f) } - -var fileDescriptor_f64ba265cd7eae3f = []byte{ - // 248 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0x49, 0x2d, 0x28, - 0x4a, 0x4d, 0x4e, 0x2c, 0x49, 0x4d, 0xd1, 0x47, 0x30, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, - 0xb8, 0x10, 0x22, 0x4a, 0xe2, 0x5c, 0x82, 0x2e, 0x70, 0x5e, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, - 0x89, 0x15, 0x93, 0x04, 0xa3, 0x52, 0x32, 0x97, 0x10, 0xb2, 0x44, 0x71, 0x41, 0x7e, 0x5e, 0x71, - 0xaa, 0x90, 0x27, 0x97, 0x00, 0x42, 0x73, 0x7c, 0x5a, 0x66, 0x6a, 0x4e, 0x8a, 0x04, 0xa3, 0x02, - 0xa3, 0x06, 0x9f, 0x91, 0x94, 0x1e, 0x92, 0x3d, 0x08, 0x9d, 0xae, 0x79, 0xa5, 0xb9, 0x4e, 0x4c, - 0x12, 0x8c, 0x41, 0xfc, 0x08, 0x69, 0x37, 0x90, 0x36, 0x90, 0x25, 0x5a, 0x1a, 0x5c, 0x7c, 0xa8, - 0x4a, 0x85, 0x84, 0xb8, 0xb8, 0x5c, 0x5c, 0x03, 0x82, 0x5c, 0x9d, 0x1d, 0x43, 0x5c, 0x5d, 0x04, - 0x18, 0xa4, 0x98, 0x38, 0x18, 0xa5, 0x98, 0x24, 0x18, 0x8d, 0xf2, 0x90, 0xdd, 0x19, 0x9c, 0x5a, - 0x54, 0x96, 0x99, 0x9c, 0x2a, 0x14, 0x82, 0xac, 0xdd, 0x39, 0x31, 0x27, 0x47, 0x48, 0x16, 0xbb, - 0x2b, 0xa0, 0x1e, 0x93, 0x92, 0xc3, 0x25, 0x0d, 0xf1, 0x9e, 0x12, 0x73, 0x07, 0x13, 0xa3, 0x14, - 0x88, 0x70, 0x72, 0x8c, 0xb2, 0x49, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, - 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x07, 0x07, 0x5f, 0x52, 0x69, 0x1a, 0x84, 0x91, 0xac, - 0x9b, 0x9e, 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x5f, 0x92, 0x5a, 0x5c, 0x92, 0x92, 0x58, 0x92, 0x88, - 0x14, 0xd2, 0x3b, 0x18, 0x19, 0x93, 0xd8, 0xc0, 0xaa, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x0e, 0xf5, 0x6c, 0x87, 0x8c, 0x01, 0x00, 0x00, -} diff --git a/protoc-gen-go/testdata/grpc/grpc.pb.go b/protoc-gen-go/testdata/grpc/grpc.pb.go index 91338dc502..79ab362285 100644 --- a/protoc-gen-go/testdata/grpc/grpc.pb.go +++ b/protoc-gen-go/testdata/grpc/grpc.pb.go @@ -6,12 +6,9 @@ package testing import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" -) - -import ( context "golang.org/x/net/context" grpc "google.golang.org/grpc" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -156,6 +153,28 @@ func init() { proto.RegisterType((*StreamMsg2)(nil), "grpc.testing.StreamMsg2") } +func init() { proto.RegisterFile("grpc/grpc.proto", fileDescriptor_81ea47a3f88c2082) } + +var fileDescriptor_81ea47a3f88c2082 = []byte{ + // 244 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0x2f, 0x2a, 0x48, + 0xd6, 0x07, 0x11, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x3c, 0x60, 0x76, 0x49, 0x6a, 0x71, + 0x49, 0x66, 0x5e, 0xba, 0x12, 0x3f, 0x17, 0x6f, 0x70, 0x66, 0x6e, 0x41, 0x4e, 0x6a, 0x50, 0x6a, + 0x61, 0x69, 0x6a, 0x71, 0x89, 0x92, 0x00, 0x17, 0x1f, 0x4c, 0xa0, 0xb8, 0x20, 0x3f, 0xaf, 0x38, + 0x55, 0x89, 0x9b, 0x8b, 0x33, 0xb8, 0xa4, 0x28, 0x35, 0x31, 0xd7, 0xb7, 0x38, 0x5d, 0x89, 0x87, + 0x8b, 0x0b, 0xce, 0x31, 0x32, 0x9a, 0xc1, 0xc4, 0xc5, 0x12, 0x92, 0x5a, 0x5c, 0x22, 0xe4, 0xc6, + 0xc5, 0x19, 0x9a, 0x97, 0x58, 0x54, 0xe9, 0x9c, 0x98, 0x93, 0x23, 0x24, 0xad, 0x87, 0x6c, 0x85, + 0x1e, 0x8a, 0xf9, 0x52, 0x32, 0xd8, 0x25, 0x21, 0x76, 0x09, 0xb9, 0x70, 0x71, 0xb9, 0xe4, 0x97, + 0xe7, 0x15, 0x83, 0xad, 0xc0, 0x6f, 0x90, 0x38, 0x9a, 0x24, 0xcc, 0x55, 0x06, 0x8c, 0x42, 0xce, + 0x5c, 0x1c, 0xa1, 0x05, 0x50, 0x33, 0x70, 0x29, 0xc3, 0xef, 0x10, 0x0d, 0x46, 0x21, 0x5b, 0x2e, + 0x16, 0xa7, 0xcc, 0x94, 0x4c, 0xdc, 0x06, 0x48, 0xe0, 0x90, 0x30, 0xd2, 0x60, 0x34, 0x60, 0x74, + 0x72, 0x88, 0xb2, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, + 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x07, 0xc7, 0x40, 0x52, 0x69, 0x1a, 0x84, 0x91, 0xac, 0x9b, 0x9e, + 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x0f, 0x32, 0x22, 0x25, 0xb1, 0x24, 0x11, 0x1c, 0x4d, 0xd6, 0x50, + 0x03, 0x93, 0xd8, 0xc0, 0x8a, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x90, 0xb9, 0x95, 0x42, + 0xc2, 0x01, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -426,25 +445,3 @@ var _Test_serviceDesc = grpc.ServiceDesc{ }, Metadata: "grpc/grpc.proto", } - -func init() { proto.RegisterFile("grpc/grpc.proto", fileDescriptor_81ea47a3f88c2082) } - -var fileDescriptor_81ea47a3f88c2082 = []byte{ - // 244 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0x2f, 0x2a, 0x48, - 0xd6, 0x07, 0x11, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x3c, 0x60, 0x76, 0x49, 0x6a, 0x71, - 0x49, 0x66, 0x5e, 0xba, 0x12, 0x3f, 0x17, 0x6f, 0x70, 0x66, 0x6e, 0x41, 0x4e, 0x6a, 0x50, 0x6a, - 0x61, 0x69, 0x6a, 0x71, 0x89, 0x92, 0x00, 0x17, 0x1f, 0x4c, 0xa0, 0xb8, 0x20, 0x3f, 0xaf, 0x38, - 0x55, 0x89, 0x9b, 0x8b, 0x33, 0xb8, 0xa4, 0x28, 0x35, 0x31, 0xd7, 0xb7, 0x38, 0x5d, 0x89, 0x87, - 0x8b, 0x0b, 0xce, 0x31, 0x32, 0x9a, 0xc1, 0xc4, 0xc5, 0x12, 0x92, 0x5a, 0x5c, 0x22, 0xe4, 0xc6, - 0xc5, 0x19, 0x9a, 0x97, 0x58, 0x54, 0xe9, 0x9c, 0x98, 0x93, 0x23, 0x24, 0xad, 0x87, 0x6c, 0x85, - 0x1e, 0x8a, 0xf9, 0x52, 0x32, 0xd8, 0x25, 0x21, 0x76, 0x09, 0xb9, 0x70, 0x71, 0xb9, 0xe4, 0x97, - 0xe7, 0x15, 0x83, 0xad, 0xc0, 0x6f, 0x90, 0x38, 0x9a, 0x24, 0xcc, 0x55, 0x06, 0x8c, 0x42, 0xce, - 0x5c, 0x1c, 0xa1, 0x05, 0x50, 0x33, 0x70, 0x29, 0xc3, 0xef, 0x10, 0x0d, 0x46, 0x21, 0x5b, 0x2e, - 0x16, 0xa7, 0xcc, 0x94, 0x4c, 0xdc, 0x06, 0x48, 0xe0, 0x90, 0x30, 0xd2, 0x60, 0x34, 0x60, 0x74, - 0x72, 0x88, 0xb2, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, - 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x07, 0xc7, 0x40, 0x52, 0x69, 0x1a, 0x84, 0x91, 0xac, 0x9b, 0x9e, - 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x0f, 0x32, 0x22, 0x25, 0xb1, 0x24, 0x11, 0x1c, 0x4d, 0xd6, 0x50, - 0x03, 0x93, 0xd8, 0xc0, 0x8a, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x90, 0xb9, 0x95, 0x42, - 0xc2, 0x01, 0x00, 0x00, -} From 3e154b76849432992ef98da119e15fc45c629fba Mon Sep 17 00:00:00 2001 From: Herbie Ong Date: Mon, 29 Oct 2018 14:25:33 -0700 Subject: [PATCH 004/133] test.bash: update to go1.10.4 and go1.11.1 for v1 branch Change-Id: I48f723a41c9d452167509a0d7be42ba72c8e3ac8 Reviewed-on: https://go-review.googlesource.com/c/145659 Reviewed-by: Joe Tsai --- test.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test.bash b/test.bash index 75022abe4e..02f6273f3a 100755 --- a/test.bash +++ b/test.bash @@ -37,8 +37,8 @@ mkdir -p $PROTOBUF_DIR/src/include ln -s ../google $PROTOBUF_DIR/src/include/google # Download each Go toolchain version. -GO_LATEST=go1.11 -GO_VERSIONS=(go1.9.7 go1.10.3 $GO_LATEST) +GO_LATEST=go1.11.1 +GO_VERSIONS=(go1.9.7 go1.10.4 $GO_LATEST) for GO_VERSION in ${GO_VERSIONS[@]}; do if [ ! -d $GO_VERSION ]; then print "download $GO_VERSION" From 85533b89e7477bd626c208d64698d8af6429a6b9 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 19 Nov 2018 07:30:53 -0800 Subject: [PATCH 005/133] test.bash: update to go1.10.5 and go1.11.2 Change-Id: I3cff81f564b7cd9b86b23b98ef6467eca3d51283 Reviewed-on: https://go-review.googlesource.com/c/150237 Reviewed-by: Andrew Bonventre --- test.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test.bash b/test.bash index 02f6273f3a..718cc39870 100755 --- a/test.bash +++ b/test.bash @@ -37,8 +37,8 @@ mkdir -p $PROTOBUF_DIR/src/include ln -s ../google $PROTOBUF_DIR/src/include/google # Download each Go toolchain version. -GO_LATEST=go1.11.1 -GO_VERSIONS=(go1.9.7 go1.10.4 $GO_LATEST) +GO_LATEST=go1.11.2 +GO_VERSIONS=(go1.9.7 go1.10.5 $GO_LATEST) for GO_VERSION in ${GO_VERSIONS[@]}; do if [ ! -d $GO_VERSION ]; then print "download $GO_VERSION" From 821b54d53fc63736469a73ef740ac259807179a9 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 00:02:02 -0800 Subject: [PATCH 006/133] protoc-gen-go: generate descriptor before plugins (#718) Avoid interleaving plugin output with the rest of the generated code. No functional change, but simplifies keeping the v1 and v2 generator output identical. Change-Id: I2e64eaa06146ba86711c67e2700e3ed8e8977826 Cherry-Pick: github.com/golang/protobuf@c8b73fbfc08a20631e50a2f3823970e1a7885cb1 Original-Author: Damien Neil Reviewed-on: https://go-review.googlesource.com/c/151398 Reviewed-by: Damien Neil --- proto/test_proto/test.pb.go | 2 +- protoc-gen-go/generator/generator.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/proto/test_proto/test.pb.go b/proto/test_proto/test.pb.go index 3b9012ad9f..1cd6b5b9ea 100644 --- a/proto/test_proto/test.pb.go +++ b/proto/test_proto/test.pb.go @@ -3701,7 +3701,7 @@ func _Oneof_OneofSizer(msg proto.Message) (n int) { n += proto.Size(x.FGroup) n += 2 // tag and wire case *Oneof_F_Largest_Tag: - n += 5 // tag and wire + n += 10 // tag and wire n += proto.SizeVarint(uint64(x.F_Largest_Tag)) case nil: default: diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index f42f391df6..f924994a77 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -1138,12 +1138,11 @@ func (g *Generator) generate(file *FileDescriptor) { g.generateExtension(ext) } g.generateInitFunction() + g.generateFileDescriptor(file) // Run the plugins before the imports so we know which imports are necessary. g.runPlugins(file) - g.generateFileDescriptor(file) - // Generate header and imports last, though they appear first in the output. rem := g.Buffer remAnno := g.annotations From 73b300ec3b55245e9cecbce0edb48d6bdf5d4b2d Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:05:26 +0000 Subject: [PATCH 007/133] protoc-gen-go: more standard import organization (#719) Split imports into standard library and third-party imports. Decide between the two based on the presence of a ".", which is the same heuristic used by goimports. Allow plugins to register packages to import, so gRPC imports don't sit awkwardly in a separate import () block. Change-Id: I89d150500354368eba8c848514abb1d2c78b036a Cherry-Pick: github.com/golang/protobuf@7b180878bfea63ff6c2fa26da7209afc79335a08 Original-Author: Damien Neil Reviewed-on: https://go-review.googlesource.com/c/151420 Reviewed-by: Damien Neil --- protoc-gen-go/generator/generator.go | 47 +++++++++++++++++++++------- protoc-gen-go/grpc/grpc.go | 14 ++------- 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index f924994a77..ac35f01552 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -421,6 +421,7 @@ type Generator struct { packageNames map[GoImportPath]GoPackageName // Imported package names in the current file. usedPackages map[GoImportPath]bool // Packages used in current file. usedPackageNames map[GoPackageName]bool // Package names used in the current file. + addedImports map[GoImportPath]bool // Additional imports to emit. typeNameToObject map[string]Object // Key is a fully-qualified name in input syntax. init []string // Lines to emit in the init function. indent string @@ -543,6 +544,13 @@ func (g *Generator) GoPackageName(importPath GoImportPath) GoPackageName { return name } +// AddImport adds a package to the generated file's import section. +// It returns the name used for the package. +func (g *Generator) AddImport(importPath GoImportPath) GoPackageName { + g.addedImports[importPath] = true + return g.GoPackageName(importPath) +} + var globalPackageNames = map[GoPackageName]bool{ "fmt": true, "math": true, @@ -1110,6 +1118,7 @@ func (g *Generator) generate(file *FileDescriptor) { g.usedPackages = make(map[GoImportPath]bool) g.packageNames = make(map[GoImportPath]GoPackageName) g.usedPackageNames = make(map[GoPackageName]bool) + g.addedImports = make(map[GoImportPath]bool) for name := range globalPackageNames { g.usedPackageNames[name] = true } @@ -1267,14 +1276,7 @@ func (g *Generator) weak(i int32) bool { // Generate the imports func (g *Generator) generateImports() { - g.P("import (") - // We almost always need a proto import. Rather than computing when we - // do, which is tricky when there's a plugin, just import it and - // reference it later. The same argument applies to the fmt and math packages. - g.P(g.Pkg["proto"]+" ", GoImportPath(g.ImportPrefix)+"github.com/golang/protobuf/proto") - g.P(g.Pkg["fmt"] + ` "fmt"`) - g.P(g.Pkg["math"] + ` "math"`) - imports := make(map[GoImportPath]bool) + imports := make(map[GoImportPath]GoPackageName) for i, s := range g.file.Dependency { fd := g.fileByName(s) importPath := fd.importPath @@ -1287,10 +1289,9 @@ func (g *Generator) generateImports() { continue } // Do not import a package twice. - if imports[importPath] { + if _, ok := imports[importPath]; ok { continue } - imports[importPath] = true // We need to import all the dependencies, even if we don't reference them, // because other code and tools depend on having the full transitive closure // of protocol buffer types in the binary. @@ -1298,7 +1299,31 @@ func (g *Generator) generateImports() { if _, ok := g.usedPackages[importPath]; !ok { packageName = "_" } - g.P(packageName, " ", GoImportPath(g.ImportPrefix)+importPath) + imports[importPath] = packageName + } + for importPath := range g.addedImports { + imports[importPath] = g.GoPackageName(importPath) + } + g.P("import (") + // Standard library imports. + g.P(g.Pkg["fmt"] + ` "fmt"`) + g.P(g.Pkg["math"] + ` "math"`) + for importPath, packageName := range imports { + if !strings.Contains(string(importPath), ".") { + g.P(packageName, " ", GoImportPath(g.ImportPrefix)+importPath) + } + } + g.P() + // Third-party imports. + // + // We almost always need a proto import. Rather than computing when we + // do, which is tricky when there's a plugin, just import it and + // reference it later. The same argument applies to the fmt and math packages. + g.P(g.Pkg["proto"]+" ", GoImportPath(g.ImportPrefix)+"github.com/golang/protobuf/proto") + for importPath, packageName := range imports { + if strings.Contains(string(importPath), ".") { + g.P(packageName, " ", GoImportPath(g.ImportPrefix)+importPath) + } } g.P(")") g.P() diff --git a/protoc-gen-go/grpc/grpc.go b/protoc-gen-go/grpc/grpc.go index 4e36b548a7..63748356ca 100644 --- a/protoc-gen-go/grpc/grpc.go +++ b/protoc-gen-go/grpc/grpc.go @@ -39,7 +39,6 @@ package grpc import ( "fmt" - "path" "strconv" "strings" @@ -86,8 +85,6 @@ var ( // Init initializes the plugin. func (g *grpc) Init(gen *generator.Generator) { g.gen = gen - contextPkg = generator.RegisterUniquePackageName("context", nil) - grpcPkg = generator.RegisterUniquePackageName("grpc", nil) } // Given a type name defined in a .proto, return its object. @@ -111,6 +108,9 @@ func (g *grpc) Generate(file *generator.FileDescriptor) { return } + contextPkg = string(g.gen.AddImport(contextPkgPath)) + grpcPkg = string(g.gen.AddImport(grpcPkgPath)) + g.P("// Reference imports to suppress errors if they are not otherwise used.") g.P("var _ ", contextPkg, ".Context") g.P("var _ ", grpcPkg, ".ClientConn") @@ -129,14 +129,6 @@ func (g *grpc) Generate(file *generator.FileDescriptor) { // GenerateImports generates the import declaration for this file. func (g *grpc) GenerateImports(file *generator.FileDescriptor) { - if len(file.FileDescriptorProto.Service) == 0 { - return - } - g.P("import (") - g.P(contextPkg, " ", generator.GoImportPath(path.Join(string(g.gen.ImportPrefix), contextPkgPath))) - g.P(grpcPkg, " ", generator.GoImportPath(path.Join(string(g.gen.ImportPrefix), grpcPkgPath))) - g.P(")") - g.P() } // reservedClientName records whether a client name is reserved on the client side. From 6aa1dc76230b8e2d8baf1eb1cb98aa32fa42a705 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:10:04 +0000 Subject: [PATCH 008/133] protoc-gen-go: put all imports in one section (#720) Keep plugin imports and non-plugin imports in the same section, but don't try to split stdlib and non-stdlib imports into different sections. Consistent with using astutil to insert all imports from a blank slate. Change-Id: Iede57a803c4a20baa1f903504df89f02b8b951c0 Cherry-Pick: github.com/golang/protobuf@7011d38ac0d201eeddff4a4085a657c3da322d75 Original-Author: Damien Neil Reviewed-on: https://go-review.googlesource.com/c/151421 Reviewed-by: Damien Neil --- protoc-gen-go/generator/generator.go | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index ac35f01552..8cd2d53f53 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -1304,26 +1304,15 @@ func (g *Generator) generateImports() { for importPath := range g.addedImports { imports[importPath] = g.GoPackageName(importPath) } - g.P("import (") - // Standard library imports. - g.P(g.Pkg["fmt"] + ` "fmt"`) - g.P(g.Pkg["math"] + ` "math"`) - for importPath, packageName := range imports { - if !strings.Contains(string(importPath), ".") { - g.P(packageName, " ", GoImportPath(g.ImportPrefix)+importPath) - } - } - g.P() - // Third-party imports. - // // We almost always need a proto import. Rather than computing when we // do, which is tricky when there's a plugin, just import it and // reference it later. The same argument applies to the fmt and math packages. + g.P("import (") + g.P(g.Pkg["fmt"] + ` "fmt"`) + g.P(g.Pkg["math"] + ` "math"`) g.P(g.Pkg["proto"]+" ", GoImportPath(g.ImportPrefix)+"github.com/golang/protobuf/proto") for importPath, packageName := range imports { - if strings.Contains(string(importPath), ".") { - g.P(packageName, " ", GoImportPath(g.ImportPrefix)+importPath) - } + g.P(packageName, " ", GoImportPath(g.ImportPrefix)+importPath) } g.P(")") g.P() From e52a20120932c5633ca3e5935dd3afb756710fca Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:24:48 +0000 Subject: [PATCH 009/133] protoc-gen-go: predeclared identifiers in cleanPackageName (#722) Don't generate identifiers that conflict with predeclared identifiers, prepend with "_" instead. Change-Id: I85e29d1861bc225df29949b26f4ae4a740bb4a66 Cherry-Pick: github.com/golang/protobuf@31e0d063dd98c052257e5b69eeb006818133f45c Original-Author: Sam Smith Reviewed-on: https://go-review.googlesource.com/c/151423 Reviewed-by: Damien Neil --- protoc-gen-go/generator/generator.go | 48 ++++++++++++++++++++++++++-- protoc-gen-go/generator/name_test.go | 1 + 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 8cd2d53f53..75f5a8fa8b 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -568,7 +568,8 @@ func RegisterUniquePackageName(pkg string, f *FileDescriptor) string { return string(name) } -var isGoKeyword = map[string]bool{ +var isGoKeywordOrPredeclaredIdentifier = map[string]bool{ + // Keywords "break": true, "case": true, "chan": true, @@ -594,12 +595,53 @@ var isGoKeyword = map[string]bool{ "switch": true, "type": true, "var": true, + + // Predeclared Identifiers + "append": true, + "bool": true, + "byte": true, + "cap": true, + "close": true, + "complex": true, + "complex128": true, + "complex64": true, + "copy": true, + "delete": true, + "error": true, + "false": true, + "float32": true, + "float64": true, + "imag": true, + "int": true, + "int16": true, + "int32": true, + "int64": true, + "int8": true, + "iota": true, + "len": true, + "make": true, + "new": true, + "nil": true, + "panic": true, + "print": true, + "println": true, + "real": true, + "recover": true, + "rune": true, + "string": true, + "true": true, + "uint": true, + "uint16": true, + "uint32": true, + "uint64": true, + "uint8": true, + "uintptr": true, } func cleanPackageName(name string) GoPackageName { name = strings.Map(badToUnderscore, name) - // Identifier must not be keyword: insert _. - if isGoKeyword[name] { + // Identifier must not be keyword or predeclared identifier: insert _. + if isGoKeywordOrPredeclaredIdentifier[name] { name = "_" + name } // Identifier must not begin with digit: insert _. diff --git a/protoc-gen-go/generator/name_test.go b/protoc-gen-go/generator/name_test.go index 571147cfc0..b853c17aff 100644 --- a/protoc-gen-go/generator/name_test.go +++ b/protoc-gen-go/generator/name_test.go @@ -68,6 +68,7 @@ func TestGoPackageOption(t *testing.T) { {"foo", "", "foo", true}, {"github.com/golang/bar", "github.com/golang/bar", "bar", true}, {"github.com/golang/bar;baz", "github.com/golang/bar", "baz", true}, + {"github.com/golang/string", "github.com/golang/string", "_string", true}, } for _, tc := range tests { d := &FileDescriptor{ From b409ead3073840474946bc7b7f8b032a55c436d9 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:28:04 +0000 Subject: [PATCH 010/133] protoc-gen-go: only disambiguate predefined idents for local package names (#724) Permit creating a generated package named e.g., "string". Apply disambiguation to prevent creating a local import name that conflicts with predefined identifiers; importing package "string" will be done as: import string1 "string" Change-Id: I2e73d047e94c38ec562712587a026de567ab2a64 Cherry-Pick: github.com/golang/protobuf@ddf22928ea3c56eb4292a0adbbf5001b1e8e7d0d Original-Author: Damien Neil Reviewed-on: https://go-review.googlesource.com/c/151424 Reviewed-by: Damien Neil --- protoc-gen-go/generator/generator.go | 10 +++++----- protoc-gen-go/generator/name_test.go | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 75f5a8fa8b..440d310432 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -536,7 +536,7 @@ func (g *Generator) GoPackageName(importPath GoImportPath) GoPackageName { return name } name := cleanPackageName(baseName(string(importPath))) - for i, orig := 1, name; g.usedPackageNames[name]; i++ { + for i, orig := 1, name; g.usedPackageNames[name] || isGoPredeclaredIdentifier[string(name)]; i++ { name = orig + GoPackageName(strconv.Itoa(i)) } g.packageNames[importPath] = name @@ -568,8 +568,7 @@ func RegisterUniquePackageName(pkg string, f *FileDescriptor) string { return string(name) } -var isGoKeywordOrPredeclaredIdentifier = map[string]bool{ - // Keywords +var isGoKeyword = map[string]bool{ "break": true, "case": true, "chan": true, @@ -595,8 +594,9 @@ var isGoKeywordOrPredeclaredIdentifier = map[string]bool{ "switch": true, "type": true, "var": true, +} - // Predeclared Identifiers +var isGoPredeclaredIdentifier = map[string]bool{ "append": true, "bool": true, "byte": true, @@ -641,7 +641,7 @@ var isGoKeywordOrPredeclaredIdentifier = map[string]bool{ func cleanPackageName(name string) GoPackageName { name = strings.Map(badToUnderscore, name) // Identifier must not be keyword or predeclared identifier: insert _. - if isGoKeywordOrPredeclaredIdentifier[name] { + if isGoKeyword[name] { name = "_" + name } // Identifier must not begin with digit: insert _. diff --git a/protoc-gen-go/generator/name_test.go b/protoc-gen-go/generator/name_test.go index b853c17aff..e4a119d6fb 100644 --- a/protoc-gen-go/generator/name_test.go +++ b/protoc-gen-go/generator/name_test.go @@ -68,7 +68,7 @@ func TestGoPackageOption(t *testing.T) { {"foo", "", "foo", true}, {"github.com/golang/bar", "github.com/golang/bar", "bar", true}, {"github.com/golang/bar;baz", "github.com/golang/bar", "baz", true}, - {"github.com/golang/string", "github.com/golang/string", "_string", true}, + {"github.com/golang/string", "github.com/golang/string", "string", true}, } for _, tc := range tests { d := &FileDescriptor{ @@ -86,6 +86,25 @@ func TestGoPackageOption(t *testing.T) { } } +func TestPackageNames(t *testing.T) { + g := New() + g.packageNames = make(map[GoImportPath]GoPackageName) + g.usedPackageNames = make(map[GoPackageName]bool) + for _, test := range []struct { + importPath GoImportPath + want GoPackageName + }{ + {"github.com/golang/foo", "foo"}, + {"github.com/golang/second/package/named/foo", "foo1"}, + {"github.com/golang/third/package/named/foo", "foo2"}, + {"github.com/golang/conflicts/with/predeclared/ident/string", "string1"}, + } { + if got := g.GoPackageName(test.importPath); got != test.want { + t.Errorf("GoPackageName(%v) = %v, want %v", test.importPath, got, test.want) + } + } +} + func TestUnescape(t *testing.T) { tests := []struct { in string From 81a81aa2986c5e01097015c0fccb4864d681e397 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:30:03 +0000 Subject: [PATCH 011/133] protoc-gen-go/generator: fix misspelling (#732) Change-Id: I908a183499bc539b722f7f32ae83f6662ea729aa Cherry-Pick: github.com/golang/protobuf@7be3631955993a734965532f776bad7093f6fc9d Original-Author: Cyrille Hemidy Reviewed-on: https://go-review.googlesource.com/c/151425 Reviewed-by: Damien Neil --- protoc-gen-go/generator/generator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 440d310432..99df80402e 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -1782,7 +1782,7 @@ func (g *Generator) defaultConstantName(goMessageType, protoFieldName string) st // oneofField - field containing list of subfields: // - oneofSubField - a field within the oneof -// msgCtx contais the context for the generator functions. +// msgCtx contains the context for the generator functions. type msgCtx struct { goName string // Go struct name of the message, e.g. MessageName message *Descriptor // The descriptor for the message From 072d074d187ee3670877bf99c5df4a1c041e4c4e Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:34:00 +0000 Subject: [PATCH 012/133] protoc-gen-go: don't force space after "//" in comments (#725) Avoid turning comments like "//////" into "// ////". Change-Id: I88a2d0eef01c0b577a2da392fd81df202db13258 Cherry-Pick: github.com/golang/protobuf@d7fc20193620986259ffb1f9b9da752114ee14a4 Original-Author: Damien Neil Reviewed-on: https://go-review.googlesource.com/c/151426 Reviewed-by: Damien Neil --- protoc-gen-go/generator/generator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 99df80402e..8c1e5d2798 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -1296,7 +1296,7 @@ func (g *Generator) makeComments(path string) (string, bool) { w := new(bytes.Buffer) nl := "" for _, line := range strings.Split(strings.TrimSuffix(loc.GetLeadingComments(), "\n"), "\n") { - fmt.Fprintf(w, "%s// %s", nl, strings.TrimPrefix(line, " ")) + fmt.Fprintf(w, "%s//%s", nl, line) nl = "\n" } return w.String(), true From 04a0f2451d7df03c54629125820352992aeef108 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:36:10 +0000 Subject: [PATCH 013/133] protoc-gen-go: add test case for deprecated oneof field Change-Id: I444147547ccfcedce722ccccd9fb229aa8aa1128 Cherry-Pick: github.com/golang/protobuf@3ed0fc6514d1378a29be51817ec3a195b5e25864 Original-Author: Damien Neil Reviewed-on: https://go-review.googlesource.com/c/151427 Reviewed-by: Damien Neil --- .../testdata/deprecated/deprecated.pb.go | 125 +++++++++++++++--- .../testdata/deprecated/deprecated.proto | 5 + 2 files changed, 109 insertions(+), 21 deletions(-) diff --git a/protoc-gen-go/testdata/deprecated/deprecated.pb.go b/protoc-gen-go/testdata/deprecated/deprecated.pb.go index fed0a2416c..3d943cbfe3 100644 --- a/protoc-gen-go/testdata/deprecated/deprecated.pb.go +++ b/protoc-gen-go/testdata/deprecated/deprecated.pb.go @@ -84,10 +84,15 @@ var xxx_messageInfo_DeprecatedRequest proto.InternalMessageInfo // Deprecated: Do not use. type DeprecatedResponse struct { // DeprecatedField contains a DeprecatedEnum. - DeprecatedField DeprecatedEnum `protobuf:"varint,1,opt,name=deprecated_field,json=deprecatedField,proto3,enum=deprecated.DeprecatedEnum" json:"deprecated_field,omitempty"` // Deprecated: Do not use. - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + DeprecatedField DeprecatedEnum `protobuf:"varint,1,opt,name=deprecated_field,json=deprecatedField,proto3,enum=deprecated.DeprecatedEnum" json:"deprecated_field,omitempty"` // Deprecated: Do not use. + // DeprecatedOneof contains a deprecated field. + // + // Types that are valid to be assigned to DeprecatedOneof: + // *DeprecatedResponse_DeprecatedOneofField + DeprecatedOneof isDeprecatedResponse_DeprecatedOneof `protobuf_oneof:"deprecated_oneof"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeprecatedResponse) Reset() { *m = DeprecatedResponse{} } @@ -123,6 +128,82 @@ func (m *DeprecatedResponse) GetDeprecatedField() DeprecatedEnum { return DeprecatedEnum_DEPRECATED } +type isDeprecatedResponse_DeprecatedOneof interface { + isDeprecatedResponse_DeprecatedOneof() +} + +type DeprecatedResponse_DeprecatedOneofField struct { + DeprecatedOneofField string `protobuf:"bytes,2,opt,name=deprecated_oneof_field,json=deprecatedOneofField,proto3,oneof"` +} + +func (*DeprecatedResponse_DeprecatedOneofField) isDeprecatedResponse_DeprecatedOneof() {} + +func (m *DeprecatedResponse) GetDeprecatedOneof() isDeprecatedResponse_DeprecatedOneof { + if m != nil { + return m.DeprecatedOneof + } + return nil +} + +// Deprecated: Do not use. +func (m *DeprecatedResponse) GetDeprecatedOneofField() string { + if x, ok := m.GetDeprecatedOneof().(*DeprecatedResponse_DeprecatedOneofField); ok { + return x.DeprecatedOneofField + } + return "" +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*DeprecatedResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _DeprecatedResponse_OneofMarshaler, _DeprecatedResponse_OneofUnmarshaler, _DeprecatedResponse_OneofSizer, []interface{}{ + (*DeprecatedResponse_DeprecatedOneofField)(nil), + } +} + +func _DeprecatedResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*DeprecatedResponse) + // deprecated_oneof + switch x := m.DeprecatedOneof.(type) { + case *DeprecatedResponse_DeprecatedOneofField: + b.EncodeVarint(2<<3 | proto.WireBytes) + b.EncodeStringBytes(x.DeprecatedOneofField) + case nil: + default: + return fmt.Errorf("DeprecatedResponse.DeprecatedOneof has unexpected type %T", x) + } + return nil +} + +func _DeprecatedResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*DeprecatedResponse) + switch tag { + case 2: // deprecated_oneof.deprecated_oneof_field + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.DeprecatedOneof = &DeprecatedResponse_DeprecatedOneofField{x} + return true, err + default: + return false, nil + } +} + +func _DeprecatedResponse_OneofSizer(msg proto.Message) (n int) { + m := msg.(*DeprecatedResponse) + // deprecated_oneof + switch x := m.DeprecatedOneof.(type) { + case *DeprecatedResponse_DeprecatedOneofField: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.DeprecatedOneofField))) + n += len(x.DeprecatedOneofField) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + func init() { proto.RegisterEnum("deprecated.DeprecatedEnum", DeprecatedEnum_name, DeprecatedEnum_value) proto.RegisterType((*DeprecatedRequest)(nil), "deprecated.DeprecatedRequest") @@ -132,23 +213,25 @@ func init() { func init() { proto.RegisterFile("deprecated/deprecated.proto", fileDescriptor_f64ba265cd7eae3f) } var fileDescriptor_f64ba265cd7eae3f = []byte{ - // 248 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0x49, 0x2d, 0x28, - 0x4a, 0x4d, 0x4e, 0x2c, 0x49, 0x4d, 0xd1, 0x47, 0x30, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, - 0xb8, 0x10, 0x22, 0x4a, 0xe2, 0x5c, 0x82, 0x2e, 0x70, 0x5e, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, - 0x89, 0x15, 0x93, 0x04, 0xa3, 0x52, 0x32, 0x97, 0x10, 0xb2, 0x44, 0x71, 0x41, 0x7e, 0x5e, 0x71, - 0xaa, 0x90, 0x27, 0x97, 0x00, 0x42, 0x73, 0x7c, 0x5a, 0x66, 0x6a, 0x4e, 0x8a, 0x04, 0xa3, 0x02, - 0xa3, 0x06, 0x9f, 0x91, 0x94, 0x1e, 0x92, 0x3d, 0x08, 0x9d, 0xae, 0x79, 0xa5, 0xb9, 0x4e, 0x4c, - 0x12, 0x8c, 0x41, 0xfc, 0x08, 0x69, 0x37, 0x90, 0x36, 0x90, 0x25, 0x5a, 0x1a, 0x5c, 0x7c, 0xa8, - 0x4a, 0x85, 0x84, 0xb8, 0xb8, 0x5c, 0x5c, 0x03, 0x82, 0x5c, 0x9d, 0x1d, 0x43, 0x5c, 0x5d, 0x04, - 0x18, 0xa4, 0x98, 0x38, 0x18, 0xa5, 0x98, 0x24, 0x18, 0x8d, 0xf2, 0x90, 0xdd, 0x19, 0x9c, 0x5a, - 0x54, 0x96, 0x99, 0x9c, 0x2a, 0x14, 0x82, 0xac, 0xdd, 0x39, 0x31, 0x27, 0x47, 0x48, 0x16, 0xbb, - 0x2b, 0xa0, 0x1e, 0x93, 0x92, 0xc3, 0x25, 0x0d, 0xf1, 0x9e, 0x12, 0x73, 0x07, 0x13, 0xa3, 0x14, - 0x88, 0x70, 0x72, 0x8c, 0xb2, 0x49, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, - 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x07, 0x07, 0x5f, 0x52, 0x69, 0x1a, 0x84, 0x91, 0xac, - 0x9b, 0x9e, 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x5f, 0x92, 0x5a, 0x5c, 0x92, 0x92, 0x58, 0x92, 0x88, - 0x14, 0xd2, 0x3b, 0x18, 0x19, 0x93, 0xd8, 0xc0, 0xaa, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x0e, 0xf5, 0x6c, 0x87, 0x8c, 0x01, 0x00, 0x00, + // 287 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xcd, 0x4a, 0xf3, 0x40, + 0x14, 0x86, 0x7b, 0xe6, 0x83, 0x0f, 0x9d, 0x45, 0xad, 0x83, 0x68, 0x88, 0x28, 0x25, 0xab, 0x20, + 0x34, 0x81, 0xba, 0x2b, 0x6e, 0x9a, 0x26, 0xa2, 0x2b, 0x25, 0x76, 0xe5, 0x46, 0xf2, 0x73, 0x12, + 0x03, 0xe9, 0x4c, 0x4c, 0x26, 0x5e, 0x83, 0xf7, 0xe3, 0xc6, 0xcb, 0x93, 0x49, 0x8b, 0x33, 0x05, + 0xdd, 0x84, 0x93, 0x79, 0xdf, 0xe7, 0xfc, 0xd2, 0xf3, 0x1c, 0x9b, 0x16, 0xb3, 0x44, 0x62, 0xee, + 0xeb, 0xd0, 0x6b, 0x5a, 0x21, 0x05, 0xa3, 0xfa, 0xc5, 0x39, 0xa3, 0xc7, 0xe1, 0xcf, 0x5f, 0x8c, + 0x6f, 0x3d, 0x76, 0x72, 0x41, 0x2c, 0x70, 0x3e, 0x81, 0x32, 0x53, 0xe9, 0x1a, 0xc1, 0x3b, 0x64, + 0xf7, 0x74, 0xa2, 0xe9, 0x97, 0xa2, 0xc2, 0x3a, 0xb7, 0x60, 0x0a, 0xee, 0x78, 0x6e, 0x7b, 0x46, + 0x21, 0x4d, 0x46, 0xbc, 0xdf, 0x04, 0xc4, 0x82, 0xf8, 0x48, 0xcb, 0xb7, 0x0a, 0x63, 0x0b, 0x7a, + 0x6a, 0xa4, 0x12, 0x1c, 0x45, 0xb1, 0x4b, 0x48, 0xa6, 0xe0, 0x1e, 0x2a, 0xe8, 0x6e, 0x14, 0x9f, + 0x68, 0xcf, 0x83, 0xb2, 0x0c, 0xac, 0xea, 0x30, 0x60, 0x7b, 0xad, 0x0c, 0xfc, 0x95, 0x4b, 0xc7, + 0xfb, 0xa5, 0x19, 0xa3, 0x34, 0x8c, 0x1e, 0xe3, 0x68, 0xb5, 0x5c, 0x47, 0xe1, 0x64, 0x64, 0x93, + 0x03, 0xb0, 0x89, 0x05, 0x73, 0x6e, 0x0e, 0xfe, 0x84, 0xed, 0x7b, 0x95, 0x21, 0x5b, 0x9b, 0xf8, + 0x2a, 0xa9, 0x6b, 0x76, 0xf1, 0xfb, 0x54, 0xbb, 0x4d, 0xd9, 0x97, 0x7f, 0xc9, 0xdb, 0x75, 0x39, + 0xff, 0x3e, 0x08, 0xd8, 0xea, 0x13, 0x2c, 0x9f, 0x6f, 0xca, 0x4a, 0xbe, 0xf6, 0xa9, 0x97, 0x89, + 0x8d, 0x5f, 0x8a, 0x3a, 0xe1, 0xa5, 0x3f, 0xdc, 0x23, 0xed, 0x8b, 0x6d, 0x90, 0xcd, 0x4a, 0xe4, + 0xb3, 0x52, 0xf8, 0x12, 0x3b, 0x99, 0x27, 0x32, 0x31, 0x4e, 0xf7, 0x05, 0x90, 0xfe, 0x1f, 0x5c, + 0xd7, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x08, 0xd5, 0xa0, 0x89, 0xdd, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/protoc-gen-go/testdata/deprecated/deprecated.proto b/protoc-gen-go/testdata/deprecated/deprecated.proto index b314166d2b..192b15822a 100644 --- a/protoc-gen-go/testdata/deprecated/deprecated.proto +++ b/protoc-gen-go/testdata/deprecated/deprecated.proto @@ -49,6 +49,11 @@ message DeprecatedResponse { option deprecated = true; // DeprecatedField contains a DeprecatedEnum. DeprecatedEnum deprecated_field = 1 [deprecated=true]; + // DeprecatedOneof contains a deprecated field. + oneof deprecated_oneof { + // DeprecatedOneofField is a deprecated field. + string deprecated_oneof_field = 2 [deprecated=true]; + } } // DeprecatedEnum contains deprecated values. From b4468deb98da01daad9905eeffe43eaeef8fcfa1 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:38:27 +0000 Subject: [PATCH 014/133] protoc-gen-go: generate deprecation comments for oneof fields Change-Id: Ia16dd78f37407be7fef6127a751bfd95015b35e4 Cherry-Pick: github.com/golang/protobuf@5e0eda4b6dc0f7e3c4ed8b94d87f7f7186b20c9c Original-Author: Damien Neil Reviewed-on: https://go-review.googlesource.com/c/151428 Reviewed-by: Damien Neil --- protoc-gen-go/generator/generator.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 8c1e5d2798..531470e1a0 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -1886,6 +1886,7 @@ type oneofSubField struct { fieldNumber int // Actual field number, as defined in proto, e.g. 12 getterDef string // Default for getters, e.g. "nil", `""` or "Default_MessageType_FieldName" protoDef string // Default value as defined in the proto file, e.g "yoshi" or "5" + deprecated string // Deprecation comment, if any. } // wireTypeName returns a textual wire type, needed for oneof sub fields in generated code. @@ -2155,6 +2156,9 @@ func (f *oneofField) getter(g *Generator, mc *msgCtx) { g.P() // Getters for each oneof for _, sf := range f.subFields { + if sf.deprecated != "" { + g.P(sf.deprecated) + } g.P("func (m *", mc.goName, ") ", Annotate(mc.message.file, sf.fullPath, sf.getterName), "() "+sf.goType+" {") g.P("if x, ok := m.", f.getterName, "().(*", sf.oneofTypeName, "); ok {") g.P("return x.", sf.goName) @@ -2584,6 +2588,11 @@ func (g *Generator) generateMessage(message *Descriptor) { } } + fieldDeprecated := "" + if field.GetOptions().GetDeprecated() { + fieldDeprecated = deprecationComment + } + dvalue := g.getterDefault(field, goTypeName) if oneof { tname := goTypeName + "_" + fieldName @@ -2627,17 +2636,13 @@ func (g *Generator) generateMessage(message *Descriptor) { getterDef: dvalue, protoDef: field.GetDefaultValue(), oneofTypeName: tname, + deprecated: fieldDeprecated, } oneofField.subFields = append(oneofField.subFields, &sf) g.RecordTypeUse(field.GetTypeName()) continue } - fieldDeprecated := "" - if field.GetOptions().GetDeprecated() { - fieldDeprecated = deprecationComment - } - fieldFullPath := fmt.Sprintf("%s,%d,%d", message.path, messageFieldPath, i) c, ok := g.makeComments(fieldFullPath) if ok { From 4e2754b1c657f9f9be02d6c355d96e747533b137 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:41:34 +0000 Subject: [PATCH 015/133] protoc-gen-go: normalize floating-point default values (#737) Parse floating-point default values and format them with fmt.Sprint. Eliminates a minor point of inconsistency with the v2 generator. Change-Id: I153318f1760bac878cb0303301bed7e4bafe3431 Cherry-Pick: github.com/golang/protobuf@d3de96c4c28ef8af3aa1a892fc481e0f103c01ff Original-Author: Damien Neil Reviewed-on: https://go-review.googlesource.com/c/151429 Reviewed-by: Damien Neil --- protoc-gen-go/generator/generator.go | 20 +++ protoc-gen-go/testdata/my_test/test.pb.go | 196 ++++++++++++++-------- protoc-gen-go/testdata/my_test/test.proto | 7 + 3 files changed, 157 insertions(+), 66 deletions(-) diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 531470e1a0..473ffad540 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -1537,6 +1537,18 @@ func (g *Generator) goTag(message *Descriptor, field *descriptor.FieldDescriptor g.Fail("unknown enum type", CamelCaseSlice(obj.TypeName())) } defaultValue = enum.integerValueAsString(defaultValue) + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + if def := defaultValue; def != "inf" && def != "-inf" && def != "nan" { + if f, err := strconv.ParseFloat(defaultValue, 32); err == nil { + defaultValue = fmt.Sprint(float32(f)) + } + } + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + if def := defaultValue; def != "inf" && def != "-inf" && def != "nan" { + if f, err := strconv.ParseFloat(defaultValue, 64); err == nil { + defaultValue = fmt.Sprint(f) + } + } } defaultValue = ",def=" + defaultValue } @@ -2236,6 +2248,14 @@ func (g *Generator) generateDefaultConstants(mc *msgCtx, topLevelFields []topLev def = "float32(" + def + ")" } kind = "var " + case df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_FLOAT: + if f, err := strconv.ParseFloat(def, 32); err == nil { + def = fmt.Sprint(float32(f)) + } + case df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_DOUBLE: + if f, err := strconv.ParseFloat(def, 64); err == nil { + def = fmt.Sprint(f) + } case df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_ENUM: // Must be an enum. Need to construct the prefixed name. obj := g.ObjectNamed(df.getProtoTypeName()) diff --git a/protoc-gen-go/testdata/my_test/test.pb.go b/protoc-gen-go/testdata/my_test/test.pb.go index b241933f2a..066e33e8d6 100644 --- a/protoc-gen-go/testdata/my_test/test.pb.go +++ b/protoc-gen-go/testdata/my_test/test.pb.go @@ -207,6 +207,12 @@ type Request struct { Reset_ *int32 `protobuf:"varint,12,opt,name=reset" json:"reset,omitempty"` // This field should not conflict with any getters. GetKey_ *string `protobuf:"bytes,16,opt,name=get_key,json=getKey" json:"get_key,omitempty"` + FloatNinf *float32 `protobuf:"fixed32,20,opt,name=float_ninf,json=floatNinf,def=-inf" json:"float_ninf,omitempty"` + FloatPinf *float32 `protobuf:"fixed32,21,opt,name=float_pinf,json=floatPinf,def=inf" json:"float_pinf,omitempty"` + FloatExp *float32 `protobuf:"fixed32,22,opt,name=float_exp,json=floatExp,def=1e+09" json:"float_exp,omitempty"` + DoubleNinf *float64 `protobuf:"fixed64,23,opt,name=double_ninf,json=doubleNinf,def=-inf" json:"double_ninf,omitempty"` + DoublePinf *float64 `protobuf:"fixed64,24,opt,name=double_pinf,json=doublePinf,def=inf" json:"double_pinf,omitempty"` + DoubleExp *float64 `protobuf:"fixed64,25,opt,name=double_exp,json=doubleExp,def=1e+09" json:"double_exp,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -240,6 +246,15 @@ var xxx_messageInfo_Request proto.InternalMessageInfo const Default_Request_Hat HatType = HatType_FEDORA var Default_Request_Deadline float32 = float32(math.Inf(1)) +var Default_Request_FloatNinf float32 = float32(math.Inf(-1)) +var Default_Request_FloatPinf float32 = float32(math.Inf(1)) + +const Default_Request_FloatExp float32 = 1e+09 + +var Default_Request_DoubleNinf float64 = math.Inf(-1) +var Default_Request_DoublePinf float64 = math.Inf(1) + +const Default_Request_DoubleExp float64 = 1e+09 func (m *Request) GetKey() []int64 { if m != nil { @@ -304,6 +319,48 @@ func (m *Request) GetGetKey_() string { return "" } +func (m *Request) GetFloatNinf() float32 { + if m != nil && m.FloatNinf != nil { + return *m.FloatNinf + } + return Default_Request_FloatNinf +} + +func (m *Request) GetFloatPinf() float32 { + if m != nil && m.FloatPinf != nil { + return *m.FloatPinf + } + return Default_Request_FloatPinf +} + +func (m *Request) GetFloatExp() float32 { + if m != nil && m.FloatExp != nil { + return *m.FloatExp + } + return Default_Request_FloatExp +} + +func (m *Request) GetDoubleNinf() float64 { + if m != nil && m.DoubleNinf != nil { + return *m.DoubleNinf + } + return Default_Request_DoubleNinf +} + +func (m *Request) GetDoublePinf() float64 { + if m != nil && m.DoublePinf != nil { + return *m.DoublePinf + } + return Default_Request_DoublePinf +} + +func (m *Request) GetDoubleExp() float64 { + if m != nil && m.DoubleExp != nil { + return *m.DoubleExp + } + return Default_Request_DoubleExp +} + type Request_SomeGroup struct { GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1150,70 +1207,77 @@ func init() { func init() { proto.RegisterFile("my_test/test.proto", fileDescriptor_2c9b60a40d5131b9) } var fileDescriptor_2c9b60a40d5131b9 = []byte{ - // 1033 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0xdd, 0x6e, 0xe3, 0x44, - 0x14, 0xce, 0xd8, 0x71, 0x7e, 0x4e, 0x42, 0x6b, 0x46, 0x55, 0x6b, 0x05, 0xed, 0xd6, 0x04, 0x8a, - 0x4c, 0xc5, 0xa6, 0xda, 0x80, 0xc4, 0x2a, 0x88, 0xd5, 0x36, 0x3f, 0x6d, 0xaa, 0x6d, 0x12, 0x69, - 0xda, 0x5e, 0xb0, 0x37, 0xd6, 0x34, 0x9e, 0x3a, 0xa6, 0x19, 0x3b, 0x6b, 0x8f, 0x11, 0xbe, 0xeb, - 0x53, 0xc0, 0x6b, 0x70, 0xcf, 0x0b, 0xf1, 0x16, 0x45, 0x33, 0x0e, 0x49, 0xda, 0xa0, 0xbd, 0xb1, - 0x7c, 0xce, 0xf9, 0xce, 0xe7, 0x39, 0x3f, 0xfe, 0x06, 0x30, 0xcf, 0x5c, 0xc1, 0x12, 0x71, 0x22, - 0x1f, 0xad, 0x45, 0x1c, 0x89, 0x08, 0x97, 0x79, 0xd6, 0x92, 0x66, 0x03, 0xf3, 0x74, 0x2e, 0x82, - 0x13, 0xf5, 0x7c, 0x9d, 0x07, 0x9b, 0xff, 0x14, 0xa1, 0x4c, 0xd8, 0xc7, 0x94, 0x25, 0x02, 0x9b, - 0xa0, 0xdf, 0xb3, 0xcc, 0x42, 0xb6, 0xee, 0xe8, 0x44, 0xbe, 0x62, 0x07, 0xf4, 0x59, 0xca, 0x2c, - 0xdd, 0x46, 0xce, 0x4e, 0x7b, 0xbf, 0xb5, 0x24, 0x6a, 0x2d, 0x13, 0x5a, 0xbd, 0x68, 0x1e, 0xc5, - 0x44, 0x42, 0xf0, 0x31, 0xe8, 0x33, 0x2a, 0xac, 0xa2, 0x42, 0x9a, 0x2b, 0xe4, 0x90, 0x8a, 0xeb, - 0x6c, 0xc1, 0x3a, 0xa5, 0xb3, 0x41, 0x7f, 0x42, 0x4e, 0x89, 0x04, 0xe1, 0x43, 0xa8, 0x78, 0x8c, - 0x7a, 0xf3, 0x20, 0x64, 0x56, 0xd9, 0x46, 0x8e, 0xd6, 0xd1, 0x83, 0xf0, 0x8e, 0xac, 0x9c, 0xf8, - 0x0d, 0x54, 0x93, 0x88, 0x33, 0x3f, 0x8e, 0xd2, 0x85, 0x55, 0xb1, 0x91, 0x03, 0xed, 0xc6, 0xd6, - 0xc7, 0xaf, 0x22, 0xce, 0xce, 0x25, 0x82, 0xac, 0xc1, 0xb8, 0x0f, 0xf5, 0x90, 0x72, 0xe6, 0x72, - 0xba, 0x58, 0x04, 0xa1, 0x6f, 0xed, 0xd8, 0xba, 0x53, 0x6b, 0x7f, 0xb9, 0x95, 0x3c, 0xa6, 0x9c, - 0x8d, 0x72, 0xcc, 0x20, 0x14, 0x71, 0x46, 0x6a, 0xe1, 0xda, 0x83, 0x4f, 0xa1, 0xc6, 0x13, 0x7f, - 0x45, 0xb2, 0xab, 0x48, 0xec, 0x2d, 0x92, 0x51, 0xe2, 0x3f, 0xe1, 0x00, 0xbe, 0x72, 0xe0, 0x3d, - 0x30, 0x62, 0x96, 0x30, 0x61, 0xd5, 0x6d, 0xe4, 0x18, 0x24, 0x37, 0xf0, 0x01, 0x94, 0x7d, 0x26, - 0x5c, 0xd9, 0x65, 0xd3, 0x46, 0x4e, 0x95, 0x94, 0x7c, 0x26, 0xde, 0xb3, 0xac, 0xf1, 0x1d, 0x54, - 0x57, 0xf5, 0xe0, 0x43, 0xa8, 0xa9, 0x6a, 0xdc, 0xbb, 0x80, 0xcd, 0x3d, 0xab, 0xaa, 0x18, 0x40, - 0xb9, 0xce, 0xa4, 0xa7, 0xf1, 0x16, 0xcc, 0xe7, 0x05, 0xac, 0x87, 0x27, 0xc1, 0x6a, 0x78, 0x7b, - 0x60, 0xfc, 0x46, 0xe7, 0x29, 0xb3, 0x34, 0xf5, 0xa9, 0xdc, 0xe8, 0x68, 0x6f, 0x50, 0x63, 0x04, - 0xbb, 0xcf, 0xce, 0xbe, 0x99, 0x8e, 0xf3, 0xf4, 0xaf, 0x37, 0xd3, 0x6b, 0xed, 0x9d, 0x8d, 0xf2, - 0x17, 0xf3, 0x6c, 0x83, 0xae, 0x79, 0x04, 0x86, 0xda, 0x04, 0x5c, 0x06, 0x9d, 0x0c, 0xfa, 0x66, - 0x01, 0x57, 0xc1, 0x38, 0x27, 0x83, 0xc1, 0xd8, 0x44, 0xb8, 0x02, 0xc5, 0xee, 0xe5, 0xcd, 0xc0, - 0xd4, 0x9a, 0x7f, 0x6a, 0x60, 0xa8, 0x5c, 0x7c, 0x0c, 0xc6, 0x5d, 0x94, 0x86, 0x9e, 0x5a, 0xb5, - 0x5a, 0x7b, 0xef, 0x29, 0x75, 0x2b, 0xef, 0x66, 0x0e, 0xc1, 0x47, 0x50, 0x9f, 0x46, 0x7c, 0x41, - 0xa7, 0xaa, 0x6d, 0x89, 0xa5, 0xd9, 0xba, 0x63, 0x74, 0x35, 0x13, 0x91, 0xda, 0xd2, 0xff, 0x9e, - 0x65, 0x49, 0xe3, 0x2f, 0x04, 0x46, 0x5e, 0x49, 0x1f, 0x0e, 0xef, 0x59, 0xe6, 0x8a, 0x19, 0x15, - 0x6e, 0xc8, 0x98, 0x97, 0xb8, 0xaf, 0xdb, 0xdf, 0xff, 0x30, 0xa5, 0x9c, 0xcd, 0xdd, 0x1e, 0x4d, - 0x2e, 0x42, 0xdf, 0x42, 0xb6, 0xe6, 0xe8, 0xe4, 0x8b, 0x7b, 0x96, 0x5d, 0xcf, 0xa8, 0x18, 0x4b, - 0xd0, 0x0a, 0x93, 0x43, 0xf0, 0xc1, 0x66, 0xf5, 0x7a, 0x07, 0xfd, 0xb8, 0x2c, 0x18, 0x7f, 0x03, - 0xa6, 0xcb, 0xb3, 0x7c, 0x34, 0xae, 0xda, 0xb5, 0xb6, 0xfa, 0x3f, 0x74, 0x52, 0x1f, 0x65, 0x6a, - 0x3c, 0x72, 0x34, 0xed, 0xa6, 0x0d, 0xc5, 0x73, 0xca, 0x19, 0xae, 0x43, 0xe5, 0x6c, 0x32, 0xb9, - 0xee, 0x9e, 0x5e, 0x5e, 0x9a, 0x08, 0x03, 0x94, 0xae, 0x07, 0xe3, 0xf1, 0xc5, 0x95, 0xa9, 0x1d, - 0x57, 0x2a, 0x9e, 0xf9, 0xf0, 0xf0, 0xf0, 0xa0, 0x35, 0xbf, 0x85, 0xea, 0x44, 0xcc, 0x58, 0xdc, - 0xa5, 0x09, 0xc3, 0x18, 0x8a, 0x92, 0x56, 0x8d, 0xa2, 0x4a, 0xd4, 0xfb, 0x06, 0xf4, 0x6f, 0x04, - 0xbb, 0xaa, 0x4b, 0x83, 0xdf, 0x05, 0x0b, 0x93, 0x20, 0x0a, 0x93, 0x76, 0x13, 0x8a, 0x22, 0xe0, - 0x0c, 0x3f, 0x1b, 0x91, 0xc5, 0x6c, 0xe4, 0x20, 0xa2, 0x62, 0xed, 0x77, 0x50, 0x9a, 0xd2, 0x38, - 0x8e, 0xc4, 0x16, 0x2a, 0x50, 0xe3, 0xb5, 0x9e, 0x7a, 0xd7, 0xec, 0x64, 0x99, 0xd7, 0xee, 0x82, - 0xe1, 0x45, 0x61, 0x2a, 0x30, 0x5e, 0x41, 0x57, 0x87, 0x56, 0x9f, 0xfa, 0x14, 0x49, 0x9e, 0xda, - 0x74, 0x60, 0x4f, 0xe5, 0x3c, 0x0b, 0x6f, 0x2f, 0x6f, 0xd3, 0x82, 0xca, 0x64, 0xee, 0x29, 0x9c, - 0xaa, 0xfe, 0xf1, 0xf1, 0xf1, 0xb1, 0xdc, 0xd1, 0x2a, 0xa8, 0xf9, 0x87, 0x0e, 0xd0, 0x8b, 0x38, - 0x4f, 0xc3, 0xe0, 0x63, 0xca, 0xf0, 0x4b, 0xa8, 0x71, 0x7a, 0xcf, 0x5c, 0xce, 0xdc, 0x69, 0x9c, - 0x53, 0x54, 0x48, 0x55, 0xba, 0x46, 0xac, 0x17, 0x67, 0xd8, 0x82, 0x52, 0x98, 0xf2, 0x5b, 0x16, - 0x5b, 0x86, 0x64, 0x1f, 0x16, 0xc8, 0xd2, 0xc6, 0x7b, 0xcb, 0x46, 0x97, 0x64, 0xa3, 0x87, 0x85, - 0xbc, 0xd5, 0xd2, 0xeb, 0x51, 0x41, 0x95, 0x30, 0xd5, 0xa5, 0x57, 0x5a, 0xf8, 0x00, 0x4a, 0x82, - 0xf1, 0x85, 0x3b, 0x55, 0x72, 0x84, 0x86, 0x05, 0x62, 0x48, 0xbb, 0x27, 0xe9, 0x67, 0x2c, 0xf0, - 0x67, 0x42, 0xfd, 0xa6, 0x9a, 0xa4, 0xcf, 0x6d, 0x7c, 0x04, 0x86, 0x88, 0x3c, 0x9a, 0x59, 0xa0, - 0x34, 0xf1, 0xb3, 0x55, 0x6f, 0xfa, 0x34, 0x4b, 0x14, 0x81, 0x8c, 0xe2, 0x7d, 0x30, 0x38, 0xcd, - 0x6e, 0x99, 0x55, 0x93, 0x27, 0x97, 0x7e, 0x65, 0x4a, 0xbf, 0xc7, 0xe6, 0x82, 0x2a, 0x01, 0xf9, - 0x5c, 0xfa, 0x95, 0x89, 0x9b, 0xa0, 0xf3, 0xc4, 0x57, 0xf2, 0xb1, 0xf5, 0x53, 0x0e, 0x0b, 0x44, - 0x06, 0xf1, 0xcf, 0x9b, 0xfa, 0xb9, 0xa3, 0xf4, 0xf3, 0xc5, 0x0a, 0xb9, 0xee, 0xdd, 0x5a, 0x42, - 0x87, 0x85, 0x0d, 0x11, 0x6d, 0x7c, 0xb5, 0x29, 0x46, 0xfb, 0x50, 0xe2, 0x4c, 0xf5, 0x6f, 0x37, - 0x57, 0xac, 0xdc, 0x6a, 0x94, 0xc1, 0xe8, 0xcb, 0x03, 0x75, 0xcb, 0x60, 0xa4, 0x61, 0x10, 0x85, - 0xc7, 0x2f, 0xa1, 0xbc, 0x94, 0x7b, 0xb9, 0xe6, 0xb9, 0xe0, 0x9b, 0x48, 0x8a, 0xc2, 0xd9, 0xe0, - 0x83, 0xa9, 0x1d, 0xb7, 0xa0, 0x28, 0x4b, 0x97, 0xc1, 0xd1, 0x64, 0xdc, 0x3f, 0xfd, 0xc5, 0x44, - 0xb8, 0x06, 0xe5, 0xeb, 0x9b, 0xc1, 0x95, 0x34, 0x34, 0xa9, 0x1a, 0x97, 0x37, 0xe3, 0xfe, 0x85, - 0x89, 0x1a, 0x9a, 0x89, 0x3a, 0x36, 0xe8, 0x82, 0xfa, 0x5b, 0xfb, 0xea, 0xab, 0x63, 0xc8, 0x50, - 0xa7, 0xf7, 0xdf, 0x4a, 0x3e, 0xc7, 0xfc, 0xaa, 0xba, 0xf3, 0xe2, 0xe9, 0xa2, 0xfe, 0xff, 0x4e, - 0x76, 0xdf, 0x7d, 0x78, 0xeb, 0x07, 0x62, 0x96, 0xde, 0xb6, 0xa6, 0x11, 0x3f, 0xf1, 0xa3, 0x39, - 0x0d, 0xfd, 0x13, 0x75, 0x39, 0xde, 0xa6, 0x77, 0xf9, 0xcb, 0xf4, 0x95, 0xcf, 0xc2, 0x57, 0x7e, - 0xa4, 0x6e, 0x55, 0xb9, 0x0f, 0x27, 0xcb, 0x6b, 0xf6, 0x27, 0xf9, 0xf8, 0x37, 0x00, 0x00, 0xff, - 0xff, 0x12, 0xd5, 0x46, 0x00, 0x75, 0x07, 0x00, 0x00, + // 1148 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x56, 0xcf, 0x6e, 0xdb, 0x46, + 0x13, 0x37, 0x49, 0x51, 0x7f, 0x46, 0xfe, 0x6c, 0x7e, 0x0b, 0xd7, 0x66, 0x55, 0x24, 0x61, 0x95, + 0xb8, 0x50, 0xdc, 0x46, 0x8e, 0xd5, 0x02, 0x4d, 0x55, 0x34, 0x88, 0x65, 0xc9, 0x71, 0x10, 0x5b, + 0x2e, 0x36, 0xce, 0xa1, 0xb9, 0x10, 0x6b, 0x69, 0x45, 0xb1, 0xd6, 0x92, 0x8c, 0xb8, 0x2c, 0xcc, + 0x9b, 0x9f, 0xa2, 0x7d, 0x8d, 0xde, 0xfb, 0x0c, 0x7d, 0x26, 0x17, 0x3b, 0xab, 0x48, 0xb2, 0x55, + 0x94, 0x07, 0x82, 0x33, 0xf3, 0x9b, 0xdf, 0xec, 0xce, 0xcc, 0xce, 0x12, 0x88, 0xc8, 0x7d, 0xc9, + 0x53, 0xb9, 0xaf, 0x5e, 0xcd, 0x64, 0x1a, 0xcb, 0x98, 0x94, 0x44, 0xde, 0x54, 0x62, 0x8d, 0x88, + 0x6c, 0x22, 0xc3, 0x7d, 0x7c, 0x1f, 0x68, 0x63, 0xfd, 0xef, 0x22, 0x94, 0x28, 0xff, 0x98, 0xf1, + 0x54, 0x12, 0x07, 0xac, 0x2b, 0x9e, 0xbb, 0x86, 0x67, 0x35, 0x2c, 0xaa, 0x3e, 0x49, 0x03, 0xac, + 0x71, 0xc6, 0x5d, 0xcb, 0x33, 0x1a, 0x1b, 0xad, 0xed, 0xe6, 0x8c, 0xa8, 0x39, 0x73, 0x68, 0x1e, + 0xc5, 0x93, 0x78, 0x4a, 0x15, 0x84, 0xec, 0x81, 0x35, 0x66, 0xd2, 0x2d, 0x20, 0xd2, 0x99, 0x23, + 0x4f, 0x98, 0xbc, 0xc8, 0x13, 0xde, 0x2e, 0x1e, 0xf7, 0xba, 0xe7, 0xf4, 0x90, 0x2a, 0x10, 0x79, + 0x04, 0xe5, 0x21, 0x67, 0xc3, 0x49, 0x18, 0x71, 0xb7, 0xe4, 0x19, 0x0d, 0xb3, 0x6d, 0x85, 0xd1, + 0x88, 0xce, 0x95, 0xe4, 0x05, 0x54, 0xd2, 0x58, 0xf0, 0x60, 0x1a, 0x67, 0x89, 0x5b, 0xf6, 0x8c, + 0x06, 0xb4, 0x6a, 0x2b, 0xc1, 0xdf, 0xc5, 0x82, 0xbf, 0x56, 0x08, 0xba, 0x00, 0x93, 0x2e, 0xac, + 0x47, 0x4c, 0x70, 0x5f, 0xb0, 0x24, 0x09, 0xa3, 0xc0, 0xdd, 0xf0, 0xac, 0x46, 0xb5, 0xf5, 0xe5, + 0x8a, 0x73, 0x9f, 0x09, 0x7e, 0xa6, 0x31, 0xbd, 0x48, 0x4e, 0x73, 0x5a, 0x8d, 0x16, 0x1a, 0x72, + 0x08, 0x55, 0x91, 0x06, 0x73, 0x92, 0x4d, 0x24, 0xf1, 0x56, 0x48, 0xce, 0xd2, 0xe0, 0x0e, 0x07, + 0x88, 0xb9, 0x82, 0x6c, 0x81, 0x3d, 0xe5, 0x29, 0x97, 0xee, 0xba, 0x67, 0x34, 0x6c, 0xaa, 0x05, + 0xb2, 0x03, 0xa5, 0x80, 0x4b, 0x5f, 0x65, 0xd9, 0xf1, 0x8c, 0x46, 0x85, 0x16, 0x03, 0x2e, 0xdf, + 0xf2, 0x9c, 0x3c, 0x06, 0x18, 0x4d, 0x62, 0x26, 0xfd, 0x28, 0x8c, 0x46, 0xee, 0x16, 0x26, 0xa5, + 0xf0, 0x4c, 0x65, 0xa5, 0x82, 0xfa, 0x7e, 0x18, 0x8d, 0x48, 0xfd, 0x13, 0x28, 0x51, 0xa0, 0xcf, + 0x16, 0x99, 0xd3, 0x98, 0x9f, 0x35, 0x46, 0x0b, 0x3e, 0xbf, 0x4e, 0xdc, 0x6d, 0x84, 0xd8, 0x07, + 0xfc, 0xeb, 0xe7, 0x3f, 0xd0, 0x32, 0xea, 0x7b, 0xd7, 0x09, 0xd9, 0x85, 0xea, 0x30, 0xce, 0x2e, + 0x27, 0x5c, 0x47, 0xdb, 0xf1, 0x8c, 0x86, 0x31, 0x8b, 0x06, 0xda, 0x80, 0xe1, 0x9e, 0xcc, 0x61, + 0x18, 0xcf, 0x45, 0x98, 0xb5, 0x84, 0xc2, 0x80, 0x4f, 0x61, 0x26, 0x61, 0xc4, 0xcf, 0x11, 0x04, + 0x07, 0xcf, 0x3f, 0x3d, 0xb4, 0xa2, 0xad, 0xbd, 0xeb, 0xa4, 0xf6, 0x0d, 0x54, 0xe6, 0x45, 0x23, + 0x8f, 0xa0, 0x8a, 0x25, 0xf3, 0x47, 0x21, 0x9f, 0x0c, 0xdd, 0x0a, 0xa6, 0x09, 0x50, 0x75, 0xac, + 0x34, 0xb5, 0x97, 0xe0, 0xdc, 0xaf, 0xd2, 0xa2, 0x43, 0x15, 0x18, 0x3b, 0x74, 0x0b, 0xec, 0xdf, + 0xd8, 0x24, 0xe3, 0xae, 0x89, 0xf9, 0xd4, 0x42, 0xdb, 0x7c, 0x61, 0xd4, 0xce, 0x60, 0xf3, 0x5e, + 0x81, 0x96, 0xdd, 0x89, 0x76, 0x7f, 0xb2, 0xec, 0x5e, 0x6d, 0x6d, 0x2c, 0xd5, 0x38, 0x99, 0xe4, + 0x4b, 0x74, 0xf5, 0x5d, 0xb0, 0xb1, 0xdd, 0x49, 0x09, 0x2c, 0xda, 0xeb, 0x3a, 0x6b, 0xa4, 0x02, + 0xf6, 0x6b, 0xda, 0xeb, 0xf5, 0x1d, 0x83, 0x94, 0xa1, 0xd0, 0x39, 0x7d, 0xdf, 0x73, 0xcc, 0xfa, + 0x1f, 0x26, 0xd8, 0xe8, 0x4b, 0xf6, 0xc0, 0x1e, 0xc5, 0x59, 0x34, 0xc4, 0xf3, 0x54, 0x6d, 0x6d, + 0xdd, 0xa5, 0x6e, 0xea, 0x96, 0xd1, 0x10, 0xb2, 0x0b, 0xeb, 0x83, 0x58, 0x24, 0x6c, 0x80, 0xbd, + 0x91, 0xba, 0xa6, 0x67, 0x35, 0xec, 0x8e, 0xe9, 0x18, 0xb4, 0x3a, 0xd3, 0xbf, 0xe5, 0x79, 0x5a, + 0xfb, 0xd3, 0x00, 0x5b, 0xef, 0xa4, 0x0b, 0x8f, 0xae, 0x78, 0xee, 0xcb, 0xb1, 0x6a, 0x19, 0xce, + 0x87, 0xa9, 0x7f, 0xd0, 0xfa, 0xf6, 0xbb, 0x01, 0x13, 0x7c, 0xe2, 0x1f, 0xb1, 0xf4, 0x4d, 0x14, + 0xb8, 0x86, 0x67, 0x36, 0x2c, 0xfa, 0xc5, 0x15, 0xcf, 0x2f, 0xc6, 0x4c, 0xf6, 0x15, 0x68, 0x8e, + 0xd1, 0x10, 0xb2, 0xb3, 0xbc, 0x7b, 0xab, 0x6d, 0x7c, 0x3f, 0xdb, 0x30, 0xf9, 0x0a, 0x1c, 0x5f, + 0xe4, 0xba, 0x34, 0x3e, 0x1e, 0xa8, 0x16, 0x0e, 0x01, 0x8b, 0xae, 0x9f, 0xe5, 0x58, 0x1e, 0x55, + 0x9a, 0x56, 0xdd, 0x83, 0xc2, 0x6b, 0x26, 0x38, 0x59, 0x87, 0xf2, 0xf1, 0xf9, 0xf9, 0x45, 0xe7, + 0xf0, 0xf4, 0xd4, 0x31, 0x08, 0x40, 0xf1, 0xa2, 0xd7, 0xef, 0xbf, 0x79, 0xe7, 0x98, 0x7b, 0xe5, + 0xf2, 0xd0, 0xb9, 0xb9, 0xb9, 0xb9, 0x31, 0xeb, 0x4f, 0xa1, 0x72, 0x2e, 0xc7, 0x7c, 0xda, 0x61, + 0x29, 0x27, 0x04, 0x0a, 0x8a, 0x16, 0x4b, 0x51, 0xa1, 0xf8, 0xbd, 0x04, 0xfd, 0xcb, 0x80, 0x4d, + 0xcc, 0x52, 0xef, 0x5a, 0xf2, 0x28, 0x0d, 0xe3, 0x28, 0x6d, 0xd5, 0xa1, 0x20, 0x43, 0xc1, 0xc9, + 0xbd, 0x12, 0xb9, 0x5c, 0x75, 0x1c, 0x45, 0x5b, 0xeb, 0x15, 0x14, 0x07, 0x6c, 0x3a, 0x8d, 0xe5, + 0x0a, 0x2a, 0xc4, 0xf2, 0xba, 0x77, 0xb5, 0x0b, 0x76, 0x3a, 0xf3, 0x6b, 0x75, 0xc0, 0x1e, 0xc6, + 0x51, 0x26, 0x09, 0x99, 0x43, 0xe7, 0x8b, 0xc6, 0x50, 0xff, 0x45, 0xa2, 0x5d, 0xeb, 0x0d, 0xd8, + 0x42, 0x9f, 0x7b, 0xe6, 0xd5, 0xe6, 0xad, 0xbb, 0x50, 0x3e, 0x9f, 0x0c, 0x11, 0x87, 0xbb, 0xbf, + 0xbd, 0xbd, 0xbd, 0x2d, 0xb5, 0xcd, 0xb2, 0x51, 0xff, 0xdd, 0x02, 0x38, 0x8a, 0x85, 0xc8, 0xa2, + 0xf0, 0x63, 0xc6, 0xc9, 0x43, 0xa8, 0x0a, 0x76, 0xc5, 0x7d, 0xc1, 0xfd, 0xc1, 0x54, 0x53, 0x94, + 0x69, 0x45, 0xa9, 0xce, 0xf8, 0xd1, 0x34, 0x27, 0x2e, 0x14, 0xa3, 0x4c, 0x5c, 0xf2, 0xa9, 0x6b, + 0x2b, 0xf6, 0x93, 0x35, 0x3a, 0x93, 0xc9, 0xd6, 0x2c, 0xd1, 0x45, 0x95, 0xe8, 0x93, 0x35, 0x9d, + 0x6a, 0xa5, 0x1d, 0x32, 0xc9, 0x70, 0xfa, 0xae, 0x2b, 0xad, 0x92, 0xc8, 0x0e, 0x14, 0x25, 0x17, + 0x89, 0x3f, 0xc0, 0x99, 0x6b, 0x9c, 0xac, 0x51, 0x5b, 0xc9, 0x47, 0x8a, 0x7e, 0xcc, 0xc3, 0x60, + 0x2c, 0xf1, 0x98, 0x9a, 0x8a, 0x5e, 0xcb, 0x64, 0x17, 0x6c, 0x19, 0x0f, 0x59, 0xee, 0x02, 0x0e, + 0xfe, 0xff, 0xcd, 0x73, 0xd3, 0x65, 0x79, 0x8a, 0x04, 0xca, 0x4a, 0xb6, 0xc1, 0x16, 0x2c, 0xbf, + 0xe4, 0x6e, 0x55, 0xad, 0x5c, 0xe9, 0x51, 0x54, 0xfa, 0x21, 0x9f, 0x48, 0x86, 0x53, 0xf2, 0xff, + 0x4a, 0x8f, 0x22, 0xa9, 0x83, 0x25, 0xd2, 0x00, 0x67, 0xe4, 0xca, 0xa1, 0x3c, 0x59, 0xa3, 0xca, + 0x48, 0x7e, 0x5a, 0xbe, 0x24, 0x36, 0xf0, 0x92, 0x78, 0x30, 0x47, 0x2e, 0x72, 0xb7, 0xb8, 0x27, + 0x4e, 0xd6, 0x96, 0x6e, 0x8a, 0xda, 0xe3, 0xe5, 0x61, 0xb4, 0x0d, 0x45, 0xc1, 0x31, 0x7f, 0x9b, + 0x7a, 0x2c, 0x6b, 0xa9, 0x56, 0x02, 0xbb, 0xab, 0x16, 0xd4, 0x29, 0x81, 0x9d, 0x45, 0x61, 0x1c, + 0xed, 0x3d, 0x84, 0xd2, 0xec, 0x4e, 0x53, 0x6d, 0xae, 0x6f, 0x35, 0xc7, 0x50, 0x43, 0xe1, 0xb8, + 0xf7, 0xc1, 0x31, 0xf7, 0x9a, 0x50, 0x50, 0x5b, 0x57, 0xc6, 0xb3, 0xf3, 0x7e, 0xf7, 0xf0, 0x17, + 0xc7, 0x20, 0x55, 0x28, 0x5d, 0xbc, 0xef, 0xbd, 0x53, 0x82, 0xa9, 0xa6, 0xc6, 0xe9, 0xfb, 0x7e, + 0xf7, 0x8d, 0x63, 0xd4, 0x4c, 0xc7, 0x68, 0x7b, 0x60, 0x49, 0x16, 0xac, 0xf4, 0x6b, 0x80, 0xcb, + 0x50, 0xa6, 0xf6, 0xd1, 0xa7, 0x96, 0xbc, 0x8f, 0xf9, 0x15, 0xb3, 0xf3, 0xe0, 0x6e, 0xa3, 0xfe, + 0x7b, 0x4f, 0x76, 0x5e, 0x7d, 0x78, 0x19, 0x84, 0x72, 0x9c, 0x5d, 0x36, 0x07, 0xb1, 0xd8, 0x0f, + 0xe2, 0x09, 0x8b, 0x82, 0x7d, 0xfc, 0x03, 0xb8, 0xcc, 0x46, 0xfa, 0x63, 0xf0, 0x2c, 0xe0, 0xd1, + 0xb3, 0x20, 0xc6, 0x5f, 0x07, 0xd5, 0x0f, 0xfb, 0xb3, 0x7f, 0x89, 0x1f, 0xd5, 0xeb, 0x9f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x31, 0xff, 0x4e, 0x30, 0x5a, 0x08, 0x00, 0x00, } diff --git a/protoc-gen-go/testdata/my_test/test.proto b/protoc-gen-go/testdata/my_test/test.proto index 1ef3fd0291..64fcdca391 100644 --- a/protoc-gen-go/testdata/my_test/test.proto +++ b/protoc-gen-go/testdata/my_test/test.proto @@ -85,6 +85,13 @@ message Request { optional int32 reset = 12; // This field should not conflict with any getters. optional string get_key = 16; + + optional float float_ninf = 20 [default=-inf]; + optional float float_pinf = 21 [default=inf]; + optional float float_exp = 22 [default=1e9]; + optional double double_ninf = 23 [default=-inf]; + optional double double_pinf = 24 [default=inf]; + optional double double_exp = 25 [default=1e9]; } message Reply { From f27b90d3902a4722cc2c6e43a002dc6e0acfca1d Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:45:36 +0000 Subject: [PATCH 016/133] protoc-gen-go: expand import_public test files Convert all the import_public protos to proto2 to allow testing more features. Add usage of groups, extensions, and default values. Change-Id: I5b65caa94fad13a34e63568f5fad6a6510a5fbc7 Cherry-Pick: github.com/golang/protobuf@d18af0db6e2578f79abd903de10223e411a6479d Original-Author: Damien Neil Reviewed-on: https://go-review.googlesource.com/c/151430 Reviewed-by: Damien Neil --- protoc-gen-go/testdata/import_public/a.pb.go | 19 +- protoc-gen-go/testdata/import_public/a.proto | 8 +- protoc-gen-go/testdata/import_public/b.pb.go | 14 +- protoc-gen-go/testdata/import_public/b.proto | 6 +- .../testdata/import_public/sub/a.pb.go | 175 +++++++++++++++--- .../testdata/import_public/sub/a.proto | 14 +- .../testdata/import_public/sub/b.pb.go | 28 ++- .../testdata/import_public/sub/b.proto | 3 +- protoc-gen-go/testdata/import_public_test.go | 8 +- 9 files changed, 209 insertions(+), 66 deletions(-) diff --git a/protoc-gen-go/testdata/import_public/a.pb.go b/protoc-gen-go/testdata/import_public/a.pb.go index e769183c4c..0c23c06bcf 100644 --- a/protoc-gen-go/testdata/import_public/a.pb.go +++ b/protoc-gen-go/testdata/import_public/a.pb.go @@ -26,6 +26,9 @@ type M = sub.M type M_OneofInt32 = sub.M_OneofInt32 type M_OneofInt64 = sub.M_OneofInt64 +// M_Grouping from public import import_public/sub/a.proto +type M_Grouping = sub.M_Grouping + // M_Submessage from public import import_public/sub/a.proto type M_Submessage = sub.M_Submessage type M_Submessage_SubmessageOneofInt32 = sub.M_Submessage_SubmessageOneofInt32 @@ -56,9 +59,9 @@ var M_Submessage_Submessage_Subenum_value = sub.M_Submessage_Submessage_Subenum_ const M_Submessage_M_SUBMESSAGE_ZERO = M_Submessage_Submessage_Subenum(sub.M_Submessage_M_SUBMESSAGE_ZERO) type Public struct { - M *sub.M `protobuf:"bytes,1,opt,name=m,proto3" json:"m,omitempty"` - E sub.E `protobuf:"varint,2,opt,name=e,proto3,enum=goproto.test.import_public.sub.E" json:"e,omitempty"` - Local *Local `protobuf:"bytes,3,opt,name=local,proto3" json:"local,omitempty"` + M *sub.M `protobuf:"bytes,1,opt,name=m" json:"m,omitempty"` + E *sub.E `protobuf:"varint,2,opt,name=e,enum=goproto.test.import_public.sub.E" json:"e,omitempty"` + Local *Local `protobuf:"bytes,3,opt,name=local" json:"local,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -97,8 +100,8 @@ func (m *Public) GetM() *sub.M { } func (m *Public) GetE() sub.E { - if m != nil { - return m.E + if m != nil && m.E != nil { + return *m.E } return sub.E_ZERO } @@ -117,7 +120,7 @@ func init() { func init() { proto.RegisterFile("import_public/a.proto", fileDescriptor_73b7577c95fa6b70) } var fileDescriptor_73b7577c95fa6b70 = []byte{ - // 200 bytes of a gzipped FileDescriptorProto + // 195 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcd, 0xcc, 0x2d, 0xc8, 0x2f, 0x2a, 0x89, 0x2f, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xd6, 0x4f, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x4a, 0xcf, 0x07, 0x33, 0xf4, 0x4a, 0x52, 0x8b, 0x4b, 0xf4, 0x50, 0xd4, 0x48, @@ -129,6 +132,6 @@ var fileDescriptor_73b7577c95fa6b70 = []byte{ 0x04, 0x51, 0xef, 0xe4, 0x18, 0x65, 0x9f, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f, 0x9e, 0x9f, 0x93, 0x98, 0x97, 0xae, 0x0f, 0xd6, 0x9a, 0x54, 0x9a, 0x06, 0x61, 0x24, 0xeb, 0xa6, 0xa7, 0xe6, 0xe9, 0xa6, 0xe7, 0xeb, 0x83, 0xcc, 0x4a, 0x49, 0x2c, 0x49, 0xd4, 0x47, - 0x31, 0x2f, 0x80, 0x21, 0x80, 0x31, 0x89, 0x0d, 0xac, 0xd2, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, - 0x70, 0xc5, 0xc3, 0x79, 0x5a, 0x01, 0x00, 0x00, + 0x31, 0x2f, 0x80, 0x21, 0x80, 0x11, 0x10, 0x00, 0x00, 0xff, 0xff, 0x17, 0x83, 0x2d, 0xd4, 0x52, + 0x01, 0x00, 0x00, } diff --git a/protoc-gen-go/testdata/import_public/a.proto b/protoc-gen-go/testdata/import_public/a.proto index 957ad89711..9a4e7c0234 100644 --- a/protoc-gen-go/testdata/import_public/a.proto +++ b/protoc-gen-go/testdata/import_public/a.proto @@ -29,7 +29,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -syntax = "proto3"; +syntax = "proto2"; package goproto.test.import_public; @@ -39,7 +39,7 @@ import public "import_public/sub/a.proto"; // Different Go package. import public "import_public/b.proto"; // Same Go package. message Public { - goproto.test.import_public.sub.M m = 1; - goproto.test.import_public.sub.E e = 2; - Local local = 3; + optional goproto.test.import_public.sub.M m = 1; + optional goproto.test.import_public.sub.E e = 2; + optional Local local = 3; } diff --git a/protoc-gen-go/testdata/import_public/b.pb.go b/protoc-gen-go/testdata/import_public/b.pb.go index 6de228a9cd..74f327f850 100644 --- a/protoc-gen-go/testdata/import_public/b.pb.go +++ b/protoc-gen-go/testdata/import_public/b.pb.go @@ -22,8 +22,8 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type Local struct { - M *sub.M `protobuf:"bytes,1,opt,name=m,proto3" json:"m,omitempty"` - E sub.E `protobuf:"varint,2,opt,name=e,proto3,enum=goproto.test.import_public.sub.E" json:"e,omitempty"` + M *sub.M `protobuf:"bytes,1,opt,name=m" json:"m,omitempty"` + E *sub.E `protobuf:"varint,2,opt,name=e,enum=goproto.test.import_public.sub.E" json:"e,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -62,8 +62,8 @@ func (m *Local) GetM() *sub.M { } func (m *Local) GetE() sub.E { - if m != nil { - return m.E + if m != nil && m.E != nil { + return *m.E } return sub.E_ZERO } @@ -75,7 +75,7 @@ func init() { func init() { proto.RegisterFile("import_public/b.proto", fileDescriptor_84995586b3d09710) } var fileDescriptor_84995586b3d09710 = []byte{ - // 174 bytes of a gzipped FileDescriptorProto + // 169 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcd, 0xcc, 0x2d, 0xc8, 0x2f, 0x2a, 0x89, 0x2f, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xd6, 0x4f, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x4a, 0xcf, 0x07, 0x33, 0xf4, 0x4a, 0x52, 0x8b, 0x4b, 0xf4, 0x50, 0xd4, 0x48, @@ -85,6 +85,6 @@ var fileDescriptor_84995586b3d09710 = []byte{ 0x04, 0x93, 0x02, 0xa3, 0x06, 0x1f, 0x61, 0x0d, 0xae, 0x41, 0x8c, 0xa9, 0x4e, 0x8e, 0x51, 0xf6, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0x39, 0x89, 0x79, 0xe9, 0xfa, 0x60, 0x6d, 0x49, 0xa5, 0x69, 0x10, 0x46, 0xb2, 0x6e, 0x7a, 0x6a, 0x9e, 0x6e, 0x7a, - 0xbe, 0x3e, 0xc8, 0x9c, 0x94, 0xc4, 0x92, 0x44, 0x7d, 0x14, 0xb3, 0x92, 0xd8, 0xc0, 0xaa, 0x8c, - 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd6, 0x2b, 0x5f, 0x8e, 0x04, 0x01, 0x00, 0x00, + 0xbe, 0x3e, 0xc8, 0x9c, 0x94, 0xc4, 0x92, 0x44, 0x7d, 0x14, 0xb3, 0x00, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x35, 0x0e, 0x6a, 0x82, 0xfc, 0x00, 0x00, 0x00, } diff --git a/protoc-gen-go/testdata/import_public/b.proto b/protoc-gen-go/testdata/import_public/b.proto index 1dbca3e496..424306ebd6 100644 --- a/protoc-gen-go/testdata/import_public/b.proto +++ b/protoc-gen-go/testdata/import_public/b.proto @@ -29,7 +29,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -syntax = "proto3"; +syntax = "proto2"; package goproto.test.import_public; @@ -38,6 +38,6 @@ option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/import_pu import "import_public/sub/a.proto"; message Local { - goproto.test.import_public.sub.M m = 1; - goproto.test.import_public.sub.E e = 2; + optional goproto.test.import_public.sub.M m = 1; + optional goproto.test.import_public.sub.E e = 2; } diff --git a/protoc-gen-go/testdata/import_public/sub/a.pb.go b/protoc-gen-go/testdata/import_public/sub/a.pb.go index 990b01f7c8..9b66282913 100644 --- a/protoc-gen-go/testdata/import_public/sub/a.pb.go +++ b/protoc-gen-go/testdata/import_public/sub/a.pb.go @@ -34,10 +34,25 @@ var E_value = map[string]int32{ "ZERO": 0, } +func (x E) Enum() *E { + p := new(E) + *p = x + return p +} + func (x E) String() string { return proto.EnumName(E_name, int32(x)) } +func (x *E) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(E_value, data, "E") + if err != nil { + return err + } + *x = E(value) + return nil +} + func (E) EnumDescriptor() ([]byte, []int) { return fileDescriptor_382f7805394b5c4e, []int{0} } @@ -56,10 +71,25 @@ var M_Subenum_value = map[string]int32{ "M_ZERO": 0, } +func (x M_Subenum) Enum() *M_Subenum { + p := new(M_Subenum) + *p = x + return p +} + func (x M_Subenum) String() string { return proto.EnumName(M_Subenum_name, int32(x)) } +func (x *M_Subenum) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(M_Subenum_value, data, "M_Subenum") + if err != nil { + return err + } + *x = M_Subenum(value) + return nil +} + func (M_Subenum) EnumDescriptor() ([]byte, []int) { return fileDescriptor_382f7805394b5c4e, []int{0, 0} } @@ -78,21 +108,38 @@ var M_Submessage_Submessage_Subenum_value = map[string]int32{ "M_SUBMESSAGE_ZERO": 0, } +func (x M_Submessage_Submessage_Subenum) Enum() *M_Submessage_Submessage_Subenum { + p := new(M_Submessage_Submessage_Subenum) + *p = x + return p +} + func (x M_Submessage_Submessage_Subenum) String() string { return proto.EnumName(M_Submessage_Submessage_Subenum_name, int32(x)) } +func (x *M_Submessage_Submessage_Subenum) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(M_Submessage_Submessage_Subenum_value, data, "M_Submessage_Submessage_Subenum") + if err != nil { + return err + } + *x = M_Submessage_Submessage_Subenum(value) + return nil +} + func (M_Submessage_Submessage_Subenum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_382f7805394b5c4e, []int{0, 0, 0} + return fileDescriptor_382f7805394b5c4e, []int{0, 1, 0} } type M struct { // Field using a type in the same Go package, but a different source file. - M2 *M2 `protobuf:"bytes,1,opt,name=m2,proto3" json:"m2,omitempty"` + M2 *M2 `protobuf:"bytes,1,opt,name=m2" json:"m2,omitempty"` // Types that are valid to be assigned to OneofField: // *M_OneofInt32 // *M_OneofInt64 OneofField isM_OneofField `protobuf_oneof:"oneof_field"` + Grouping *M_Grouping `protobuf:"group,4,opt,name=Grouping,json=grouping" json:"grouping,omitempty"` + DefaultField *string `protobuf:"bytes,6,opt,name=default_field,json=defaultField,def=def" json:"default_field,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -123,6 +170,8 @@ func (m *M) XXX_DiscardUnknown() { var xxx_messageInfo_M proto.InternalMessageInfo +const Default_M_DefaultField string = "def" + func (m *M) GetM2() *M2 { if m != nil { return m.M2 @@ -135,11 +184,11 @@ type isM_OneofField interface { } type M_OneofInt32 struct { - OneofInt32 int32 `protobuf:"varint,2,opt,name=oneof_int32,json=oneofInt32,proto3,oneof"` + OneofInt32 int32 `protobuf:"varint,2,opt,name=oneof_int32,json=oneofInt32,oneof"` } type M_OneofInt64 struct { - OneofInt64 int64 `protobuf:"varint,3,opt,name=oneof_int64,json=oneofInt64,proto3,oneof"` + OneofInt64 int64 `protobuf:"varint,3,opt,name=oneof_int64,json=oneofInt64,oneof"` } func (*M_OneofInt32) isM_OneofField() {} @@ -167,6 +216,20 @@ func (m *M) GetOneofInt64() int64 { return 0 } +func (m *M) GetGrouping() *M_Grouping { + if m != nil { + return m.Grouping + } + return nil +} + +func (m *M) GetDefaultField() string { + if m != nil && m.DefaultField != nil { + return *m.DefaultField + } + return Default_M_DefaultField +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*M) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _M_OneofMarshaler, _M_OneofUnmarshaler, _M_OneofSizer, []interface{}{ @@ -231,6 +294,45 @@ func _M_OneofSizer(msg proto.Message) (n int) { return n } +type M_Grouping struct { + GroupField *string `protobuf:"bytes,5,opt,name=group_field,json=groupField" json:"group_field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *M_Grouping) Reset() { *m = M_Grouping{} } +func (m *M_Grouping) String() string { return proto.CompactTextString(m) } +func (*M_Grouping) ProtoMessage() {} +func (*M_Grouping) Descriptor() ([]byte, []int) { + return fileDescriptor_382f7805394b5c4e, []int{0, 0} +} + +func (m *M_Grouping) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_M_Grouping.Unmarshal(m, b) +} +func (m *M_Grouping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_M_Grouping.Marshal(b, m, deterministic) +} +func (m *M_Grouping) XXX_Merge(src proto.Message) { + xxx_messageInfo_M_Grouping.Merge(m, src) +} +func (m *M_Grouping) XXX_Size() int { + return xxx_messageInfo_M_Grouping.Size(m) +} +func (m *M_Grouping) XXX_DiscardUnknown() { + xxx_messageInfo_M_Grouping.DiscardUnknown(m) +} + +var xxx_messageInfo_M_Grouping proto.InternalMessageInfo + +func (m *M_Grouping) GetGroupField() string { + if m != nil && m.GroupField != nil { + return *m.GroupField + } + return "" +} + type M_Submessage struct { // Types that are valid to be assigned to SubmessageOneofField: // *M_Submessage_SubmessageOneofInt32 @@ -245,7 +347,7 @@ func (m *M_Submessage) Reset() { *m = M_Submessage{} } func (m *M_Submessage) String() string { return proto.CompactTextString(m) } func (*M_Submessage) ProtoMessage() {} func (*M_Submessage) Descriptor() ([]byte, []int) { - return fileDescriptor_382f7805394b5c4e, []int{0, 0} + return fileDescriptor_382f7805394b5c4e, []int{0, 1} } func (m *M_Submessage) XXX_Unmarshal(b []byte) error { @@ -271,11 +373,11 @@ type isM_Submessage_SubmessageOneofField interface { } type M_Submessage_SubmessageOneofInt32 struct { - SubmessageOneofInt32 int32 `protobuf:"varint,1,opt,name=submessage_oneof_int32,json=submessageOneofInt32,proto3,oneof"` + SubmessageOneofInt32 int32 `protobuf:"varint,1,opt,name=submessage_oneof_int32,json=submessageOneofInt32,oneof"` } type M_Submessage_SubmessageOneofInt64 struct { - SubmessageOneofInt64 int64 `protobuf:"varint,2,opt,name=submessage_oneof_int64,json=submessageOneofInt64,proto3,oneof"` + SubmessageOneofInt64 int64 `protobuf:"varint,2,opt,name=submessage_oneof_int64,json=submessageOneofInt64,oneof"` } func (*M_Submessage_SubmessageOneofInt32) isM_Submessage_SubmessageOneofField() {} @@ -367,36 +469,53 @@ func _M_Submessage_OneofSizer(msg proto.Message) (n int) { return n } +var E_ExtensionField = &proto.ExtensionDesc{ + ExtendedType: (*M2)(nil), + ExtensionType: (*string)(nil), + Field: 1, + Name: "goproto.test.import_public.sub.extension_field", + Tag: "bytes,1,opt,name=extension_field", + Filename: "import_public/sub/a.proto", +} + func init() { proto.RegisterEnum("goproto.test.import_public.sub.E", E_name, E_value) proto.RegisterEnum("goproto.test.import_public.sub.M_Subenum", M_Subenum_name, M_Subenum_value) proto.RegisterEnum("goproto.test.import_public.sub.M_Submessage_Submessage_Subenum", M_Submessage_Submessage_Subenum_name, M_Submessage_Submessage_Subenum_value) proto.RegisterType((*M)(nil), "goproto.test.import_public.sub.M") + proto.RegisterType((*M_Grouping)(nil), "goproto.test.import_public.sub.M.Grouping") proto.RegisterType((*M_Submessage)(nil), "goproto.test.import_public.sub.M.Submessage") + proto.RegisterExtension(E_ExtensionField) } func init() { proto.RegisterFile("import_public/sub/a.proto", fileDescriptor_382f7805394b5c4e) } var fileDescriptor_382f7805394b5c4e = []byte{ - // 314 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xd1, 0x4e, 0xfa, 0x30, - 0x14, 0xc6, 0xe9, 0xf8, 0xff, 0xd1, 0x1c, 0x42, 0xa2, 0x8d, 0x98, 0xc9, 0x85, 0xc1, 0x5d, 0x11, - 0x0d, 0x5d, 0x32, 0x96, 0xdd, 0x8b, 0x59, 0xd4, 0x8b, 0x85, 0x84, 0xc5, 0x1b, 0x6e, 0x9a, 0x15, - 0x4a, 0x5d, 0x42, 0x57, 0x42, 0xdb, 0x27, 0xf4, 0x69, 0x7c, 0x0b, 0x43, 0x01, 0x81, 0x88, 0xde, - 0x9d, 0x9e, 0xf3, 0xfd, 0xbe, 0xaf, 0xed, 0x81, 0x9b, 0x52, 0x2e, 0xd5, 0xca, 0xd0, 0xa5, 0x65, - 0x8b, 0x72, 0x1a, 0x6a, 0xcb, 0xc2, 0x82, 0x2c, 0x57, 0xca, 0x28, 0x7c, 0x2b, 0x94, 0x2b, 0x88, - 0xe1, 0xda, 0x90, 0x23, 0x1d, 0xd1, 0x96, 0x75, 0x4e, 0xa0, 0x6c, 0x83, 0x06, 0x9f, 0x1e, 0xa0, - 0x0c, 0x47, 0xe0, 0xc9, 0xc8, 0x47, 0x5d, 0xd4, 0x6b, 0x46, 0x01, 0xf9, 0xdb, 0x8d, 0x64, 0xd1, - 0xd8, 0x93, 0x11, 0xbe, 0x83, 0xa6, 0xaa, 0xb8, 0x9a, 0xd3, 0xb2, 0x32, 0x83, 0xc8, 0xf7, 0xba, - 0xa8, 0xf7, 0xff, 0xa5, 0x36, 0x06, 0xd7, 0x7c, 0x5d, 0xf7, 0x8e, 0x24, 0x49, 0xec, 0xd7, 0xbb, - 0xa8, 0x57, 0x3f, 0x94, 0x24, 0x71, 0xe7, 0x03, 0x01, 0xe4, 0x96, 0x49, 0xae, 0x75, 0x21, 0x38, - 0x4e, 0xe0, 0x5a, 0x7f, 0x9f, 0xe8, 0xa1, 0x3f, 0xda, 0xfa, 0x5f, 0xed, 0xe7, 0xa3, 0x7d, 0xd2, - 0x2f, 0x5c, 0x12, 0xbb, 0x7b, 0xd5, 0x4f, 0x73, 0x49, 0x1c, 0x3c, 0x00, 0xde, 0xa7, 0xd3, 0xdc, - 0x32, 0x5e, 0x59, 0x89, 0xdb, 0x70, 0x99, 0xd1, 0xfc, 0x6d, 0x98, 0xa5, 0x79, 0xfe, 0xf8, 0x9c, - 0xd2, 0x49, 0x3a, 0x1e, 0x5d, 0xd4, 0x86, 0xfe, 0x89, 0x90, 0x79, 0xc9, 0x17, 0xb3, 0xa0, 0x0d, - 0x67, 0x3b, 0x16, 0xa0, 0x91, 0xed, 0x80, 0xd6, 0xee, 0xfd, 0x4e, 0x75, 0xdf, 0x02, 0x94, 0xe2, - 0x73, 0xf8, 0xb7, 0x9d, 0xa6, 0x93, 0x27, 0x51, 0x9a, 0x77, 0xcb, 0xc8, 0x54, 0xc9, 0x50, 0xa8, - 0x45, 0x51, 0x89, 0xd0, 0xfd, 0x3c, 0xb3, 0xf3, 0x4d, 0x31, 0xed, 0x0b, 0x5e, 0xf5, 0x85, 0x0a, - 0xd7, 0xab, 0x98, 0x15, 0xa6, 0x08, 0x7f, 0x6c, 0x92, 0x35, 0x9c, 0x72, 0xf0, 0x15, 0x00, 0x00, - 0xff, 0xff, 0xe0, 0xdc, 0x9c, 0xbe, 0x20, 0x02, 0x00, 0x00, + // 410 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xbb, 0x49, 0x5a, 0xd2, 0x09, 0xe1, 0xcf, 0x8a, 0x22, 0xd3, 0x03, 0x98, 0x9c, 0xac, + 0x56, 0x5d, 0x4b, 0x26, 0xf2, 0xa1, 0x37, 0x82, 0xdc, 0x82, 0x90, 0x55, 0xc9, 0x16, 0x97, 0x5e, + 0x2c, 0x6f, 0xbc, 0x5e, 0x2c, 0xd9, 0xbb, 0x56, 0xbc, 0x2b, 0xf1, 0x08, 0xbc, 0x17, 0x2f, 0x86, + 0xbc, 0xb6, 0x93, 0x46, 0x04, 0xe8, 0x6d, 0x3d, 0xf3, 0xfd, 0xbe, 0xd1, 0x7c, 0x1e, 0x78, 0x53, + 0x54, 0xb5, 0xdc, 0xa8, 0xa4, 0xd6, 0xb4, 0x2c, 0xd6, 0x6e, 0xa3, 0xa9, 0x9b, 0x92, 0x7a, 0x23, + 0x95, 0xc4, 0x6f, 0xb9, 0x34, 0x0f, 0xa2, 0x58, 0xa3, 0xc8, 0x9e, 0x8e, 0x34, 0x9a, 0x9e, 0x1f, + 0x40, 0x69, 0x87, 0x2e, 0x7e, 0x4e, 0x00, 0x85, 0xd8, 0x83, 0x51, 0xe5, 0x59, 0xc8, 0x46, 0xce, + 0xcc, 0x5b, 0x90, 0x7f, 0xbb, 0x91, 0xd0, 0x8b, 0x46, 0x95, 0x87, 0xdf, 0xc3, 0x4c, 0x0a, 0x26, + 0xf3, 0xa4, 0x10, 0xea, 0x83, 0x67, 0x8d, 0x6c, 0xe4, 0x1c, 0x7f, 0x3e, 0x8a, 0xc0, 0x14, 0xbf, + 0xb4, 0xb5, 0x3d, 0x89, 0xbf, 0xb4, 0xc6, 0x36, 0x72, 0xc6, 0x0f, 0x25, 0xfe, 0x12, 0xdf, 0xc0, + 0x94, 0x6f, 0xa4, 0xae, 0x0b, 0xc1, 0xad, 0x89, 0x8d, 0x1c, 0xf0, 0x2e, 0xfe, 0x3b, 0x9f, 0xdc, + 0xf6, 0x44, 0xb4, 0x65, 0xb1, 0x03, 0xf3, 0x8c, 0xe5, 0xa9, 0x2e, 0x55, 0x92, 0x17, 0xac, 0xcc, + 0xac, 0x13, 0x1b, 0x39, 0xa7, 0xd7, 0xe3, 0x8c, 0xe5, 0xd1, 0xd3, 0xbe, 0x73, 0xd3, 0x36, 0xce, + 0x2f, 0x61, 0x3a, 0xf0, 0xf8, 0x1d, 0xcc, 0x8c, 0x43, 0xcf, 0x1c, 0xb7, 0x4c, 0x04, 0xa6, 0xd4, + 0x89, 0x7f, 0x21, 0x80, 0x58, 0xd3, 0x8a, 0x35, 0x4d, 0xca, 0x19, 0xf6, 0xe1, 0x75, 0xb3, 0xfd, + 0x4a, 0x1e, 0xae, 0x8f, 0xfa, 0xf5, 0x5f, 0xed, 0xfa, 0x77, 0xbb, 0x20, 0xfe, 0xc2, 0xf9, 0x4b, + 0x13, 0xdb, 0xf8, 0x30, 0xe7, 0x2f, 0x17, 0x97, 0x80, 0x77, 0xd3, 0x93, 0x58, 0x53, 0x26, 0x74, + 0x85, 0xcf, 0xe0, 0x65, 0x98, 0xc4, 0xdf, 0x56, 0x61, 0x10, 0xc7, 0x1f, 0x6f, 0x83, 0xe4, 0x3e, + 0x88, 0xee, 0x5e, 0x1c, 0xad, 0xac, 0x03, 0x43, 0xcc, 0x5e, 0x8b, 0x33, 0x78, 0x32, 0xb0, 0x00, + 0x27, 0xe1, 0x00, 0xcc, 0x87, 0xdf, 0x63, 0x54, 0x17, 0x73, 0x40, 0x01, 0x9e, 0xc2, 0xa4, 0xeb, + 0x5e, 0x7f, 0x85, 0xe7, 0xec, 0x87, 0x62, 0xa2, 0x29, 0xa4, 0xe8, 0x14, 0xf8, 0x11, 0xa7, 0x61, + 0x82, 0x38, 0x8d, 0x9e, 0x6d, 0x51, 0x93, 0xe3, 0x2a, 0xb8, 0xff, 0xc4, 0x0b, 0xf5, 0x5d, 0x53, + 0xb2, 0x96, 0x95, 0xcb, 0x65, 0x99, 0x0a, 0xee, 0x1a, 0x2b, 0xaa, 0xf3, 0xee, 0xb1, 0xbe, 0xe2, + 0x4c, 0x5c, 0x71, 0xe9, 0xb6, 0xde, 0x59, 0xaa, 0x52, 0xf7, 0x8f, 0xab, 0xfd, 0x1d, 0x00, 0x00, + 0xff, 0xff, 0x13, 0x4f, 0x31, 0x07, 0x04, 0x03, 0x00, 0x00, } diff --git a/protoc-gen-go/testdata/import_public/sub/a.proto b/protoc-gen-go/testdata/import_public/sub/a.proto index d6ec97a774..8f8895b2be 100644 --- a/protoc-gen-go/testdata/import_public/sub/a.proto +++ b/protoc-gen-go/testdata/import_public/sub/a.proto @@ -29,7 +29,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -syntax = "proto3"; +syntax = "proto2"; package goproto.test.import_public.sub; @@ -39,13 +39,19 @@ import "import_public/sub/b.proto"; message M { // Field using a type in the same Go package, but a different source file. - M2 m2 = 1; + optional M2 m2 = 1; oneof oneof_field { int32 oneof_int32 = 2; int64 oneof_int64 = 3; } + optional group Grouping = 4 { + optional string group_field = 5; + } + + optional string default_field = 6 [default="def"]; + message Submessage { enum Submessage_Subenum { M_SUBMESSAGE_ZERO = 0; @@ -65,3 +71,7 @@ message M { enum E { ZERO = 0; } + +extend M2 { + optional string extension_field = 1; +} diff --git a/protoc-gen-go/testdata/import_public/sub/b.pb.go b/protoc-gen-go/testdata/import_public/sub/b.pb.go index ea7169da58..1f3c4cbc61 100644 --- a/protoc-gen-go/testdata/import_public/sub/b.pb.go +++ b/protoc-gen-go/testdata/import_public/sub/b.pb.go @@ -21,9 +21,10 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type M2 struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *M2) Reset() { *m = M2{} } @@ -33,6 +34,14 @@ func (*M2) Descriptor() ([]byte, []int) { return fileDescriptor_fc66afda3d7c2232, []int{0} } +var extRange_M2 = []proto.ExtensionRange{ + {Start: 1, End: 536870911}, +} + +func (*M2) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_M2 +} + func (m *M2) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_M2.Unmarshal(m, b) } @@ -58,13 +67,14 @@ func init() { func init() { proto.RegisterFile("import_public/sub/b.proto", fileDescriptor_fc66afda3d7c2232) } var fileDescriptor_fc66afda3d7c2232 = []byte{ - // 127 bytes of a gzipped FileDescriptorProto + // 132 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, 0x2f, 0x2a, 0x89, 0x2f, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xd6, 0x2f, 0x2e, 0x4d, 0xd2, 0x4f, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x4b, 0xcf, 0x07, 0x33, 0xf4, 0x4a, 0x52, 0x8b, 0x4b, - 0xf4, 0x50, 0xd4, 0xe9, 0x15, 0x97, 0x26, 0x29, 0xb1, 0x70, 0x31, 0xf9, 0x1a, 0x39, 0xb9, 0x46, - 0x39, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, - 0xe6, 0xa5, 0xeb, 0x83, 0xf5, 0x25, 0x95, 0xa6, 0x41, 0x18, 0xc9, 0xba, 0xe9, 0xa9, 0x79, 0xba, - 0xe9, 0xf9, 0xfa, 0x20, 0x83, 0x52, 0x12, 0x4b, 0x12, 0xf5, 0x31, 0x2c, 0x4d, 0x62, 0x03, 0xab, - 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x64, 0x42, 0xe4, 0xa8, 0x90, 0x00, 0x00, 0x00, + 0xf4, 0x50, 0xd4, 0xe9, 0x15, 0x97, 0x26, 0x29, 0xf1, 0x71, 0x31, 0xf9, 0x1a, 0x69, 0x71, 0x70, + 0x30, 0x0a, 0x34, 0x34, 0x34, 0x34, 0x30, 0x39, 0xb9, 0x46, 0x39, 0xa7, 0x67, 0x96, 0x64, 0x94, + 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0x4d, 0x48, + 0x2a, 0x4d, 0x83, 0x30, 0x92, 0x75, 0xd3, 0x53, 0xf3, 0x74, 0xd3, 0xf3, 0xf5, 0x41, 0x46, 0xa6, + 0x24, 0x96, 0x24, 0xea, 0x63, 0x58, 0x0f, 0x08, 0x00, 0x00, 0xff, 0xff, 0x87, 0x44, 0x22, 0x2d, + 0x92, 0x00, 0x00, 0x00, } diff --git a/protoc-gen-go/testdata/import_public/sub/b.proto b/protoc-gen-go/testdata/import_public/sub/b.proto index c7299e0f29..0b1b27cff8 100644 --- a/protoc-gen-go/testdata/import_public/sub/b.proto +++ b/protoc-gen-go/testdata/import_public/sub/b.proto @@ -29,11 +29,12 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -syntax = "proto3"; +syntax = "proto2"; package goproto.test.import_public.sub; option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub"; message M2 { + extensions 1 to max; } diff --git a/protoc-gen-go/testdata/import_public_test.go b/protoc-gen-go/testdata/import_public_test.go index 7ef776bf78..e3cbc89201 100644 --- a/protoc-gen-go/testdata/import_public_test.go +++ b/protoc-gen-go/testdata/import_public_test.go @@ -46,18 +46,18 @@ func TestImportPublicLink(t *testing.T) { var _ mainpb.E = subpb.E(0) _ = &mainpb.Public{ M: &mainpb.M{}, - E: mainpb.E_ZERO, + E: mainpb.E_ZERO.Enum(), Local: &mainpb.Local{ M: &mainpb.M{}, - E: mainpb.E_ZERO, + E: mainpb.E_ZERO.Enum(), }, } _ = &mainpb.Public{ M: &subpb.M{}, - E: subpb.E_ZERO, + E: subpb.E_ZERO.Enum(), Local: &mainpb.Local{ M: &subpb.M{}, - E: subpb.E_ZERO, + E: subpb.E_ZERO.Enum(), }, } _ = &mainpb.M{ From 160af8e4456ede65434c49d59be35c0bd95f2f02 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:48:10 +0000 Subject: [PATCH 017/133] protoc-gen-go: include groups in public import forwarders Groups were being excluded from the set of messages we generate forwarding declarations for. Include them. Change-Id: Idb20c671ac610ada5fc357949f86a3053d16dfc6 Cherry-Pick: github.com/golang/protobuf@0382e7636b97e3f60fb188fef87a8d2c42c51ba9 Original-Author: Damien Neil Reviewed-on: https://go-review.googlesource.com/c/151431 Reviewed-by: Damien Neil --- protoc-gen-go/generator/generator.go | 29 +++++++++++++--------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 473ffad540..4bc06598c6 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -2708,26 +2708,23 @@ func (g *Generator) generateMessage(message *Descriptor) { g.generateOneofFuncs(mc, topLevelFields) g.P() - if !message.group { - - var oneofTypes []string - for _, f := range topLevelFields { - if of, ok := f.(*oneofField); ok { - for _, osf := range of.subFields { - oneofTypes = append(oneofTypes, osf.oneofTypeName) - } + var oneofTypes []string + for _, f := range topLevelFields { + if of, ok := f.(*oneofField); ok { + for _, osf := range of.subFields { + oneofTypes = append(oneofTypes, osf.oneofTypeName) } } + } - opts := message.Options - ms := &messageSymbol{ - sym: goTypeName, - hasExtensions: len(message.ExtensionRange) > 0, - isMessageSet: opts != nil && opts.GetMessageSetWireFormat(), - oneofTypes: oneofTypes, - } - g.file.addExport(message, ms) + opts := message.Options + ms := &messageSymbol{ + sym: goTypeName, + hasExtensions: len(message.ExtensionRange) > 0, + isMessageSet: opts != nil && opts.GetMessageSetWireFormat(), + oneofTypes: oneofTypes, } + g.file.addExport(message, ms) for _, ext := range message.ext { g.generateExtension(ext) From 95590b61ba72a67414992fa1ddb619ae4f589322 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:51:19 +0000 Subject: [PATCH 018/133] protoc-gen-go: add test for use of publicly imported symbol Test the following case: File 1 defines a symbol S. File 2 publicly imports file 1. File 3 imports file 2 and uses S. All files in different Go packages: P1, P2, P3. Note that the .pb.go for file 3 could import P1 or P2, since the symbol is defined in both. Change-Id: I1f1d21dcb7b19a348859531a283e0adcb1619796 Cherry-Pick: github.com/golang/protobuf@9a73c7ffd8c7ee685c98283cda9c46d4f28f6d19 Original-Author: Damien Neil Reviewed-on: https://go-review.googlesource.com/c/151432 Reviewed-by: Damien Neil --- .../import_public/importing/importing.pb.go | 85 +++++++++++++++++++ .../import_public/importing/importing.proto | 43 ++++++++++ 2 files changed, 128 insertions(+) create mode 100644 protoc-gen-go/testdata/import_public/importing/importing.pb.go create mode 100644 protoc-gen-go/testdata/import_public/importing/importing.proto diff --git a/protoc-gen-go/testdata/import_public/importing/importing.pb.go b/protoc-gen-go/testdata/import_public/importing/importing.pb.go new file mode 100644 index 0000000000..afc323e199 --- /dev/null +++ b/protoc-gen-go/testdata/import_public/importing/importing.pb.go @@ -0,0 +1,85 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: import_public/importing/importing.proto + +package importing + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + _ "github.com/golang/protobuf/protoc-gen-go/testdata/import_public" + sub "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type M struct { + // Message type defined in a file publicly imported by a file we import. + M *sub.M `protobuf:"bytes,1,opt,name=m" json:"m,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *M) Reset() { *m = M{} } +func (m *M) String() string { return proto.CompactTextString(m) } +func (*M) ProtoMessage() {} +func (*M) Descriptor() ([]byte, []int) { + return fileDescriptor_36b835b3b8f6171a, []int{0} +} + +func (m *M) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_M.Unmarshal(m, b) +} +func (m *M) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_M.Marshal(b, m, deterministic) +} +func (m *M) XXX_Merge(src proto.Message) { + xxx_messageInfo_M.Merge(m, src) +} +func (m *M) XXX_Size() int { + return xxx_messageInfo_M.Size(m) +} +func (m *M) XXX_DiscardUnknown() { + xxx_messageInfo_M.DiscardUnknown(m) +} + +var xxx_messageInfo_M proto.InternalMessageInfo + +func (m *M) GetM() *sub.M { + if m != nil { + return m.M + } + return nil +} + +func init() { + proto.RegisterType((*M)(nil), "goproto.test.import_public.importing.M") +} + +func init() { + proto.RegisterFile("import_public/importing/importing.proto", fileDescriptor_36b835b3b8f6171a) +} + +var fileDescriptor_36b835b3b8f6171a = []byte{ + // 153 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcf, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x89, 0x2f, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xd6, 0x87, 0xf0, 0x32, 0xf3, 0xd2, 0x11, + 0x2c, 0xbd, 0x82, 0xa2, 0xfc, 0x92, 0x7c, 0x21, 0x95, 0xf4, 0x7c, 0x30, 0x43, 0xaf, 0x24, 0xb5, + 0xb8, 0x44, 0x0f, 0x45, 0x97, 0x1e, 0x5c, 0xad, 0x94, 0x28, 0xaa, 0x71, 0x89, 0x10, 0xcd, 0x4a, + 0x26, 0x5c, 0x8c, 0xbe, 0x42, 0xfa, 0x5c, 0x8c, 0xb9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, + 0x8a, 0x7a, 0x78, 0x4c, 0x2b, 0x2e, 0x4d, 0xd2, 0xf3, 0x0d, 0x62, 0xcc, 0x75, 0xf2, 0x8e, 0xf2, + 0x4c, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, + 0x4b, 0xd7, 0x07, 0x6b, 0x4b, 0x2a, 0x4d, 0x83, 0x30, 0x92, 0x75, 0xd3, 0x53, 0xf3, 0x74, 0xd3, + 0xf3, 0xf5, 0x41, 0xe6, 0xa4, 0x24, 0x96, 0x24, 0xea, 0xe3, 0xf0, 0x0f, 0x20, 0x00, 0x00, 0xff, + 0xff, 0xd8, 0x7e, 0x58, 0x1c, 0xe9, 0x00, 0x00, 0x00, +} diff --git a/protoc-gen-go/testdata/import_public/importing/importing.proto b/protoc-gen-go/testdata/import_public/importing/importing.proto new file mode 100644 index 0000000000..fc78f5f100 --- /dev/null +++ b/protoc-gen-go/testdata/import_public/importing/importing.proto @@ -0,0 +1,43 @@ +// 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. + +syntax = "proto2"; + +package goproto.test.import_public.importing; + +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/importing"; + +import "import_public/a.proto"; + +message M { + // Message type defined in a file publicly imported by a file we import. + optional goproto.test.import_public.sub.M m = 1; +} From 1362c40e136825b19c9e1bc459f9a7e0a9a3fbc5 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:53:50 +0000 Subject: [PATCH 019/133] protoc-gen-go: reference publicly imported symbols directly Consider this case: File 1 defines M. File 2 publicly imports file 1. File 3 imports file 2, and references M. Each file is in a different Go package: P1, P2, P3. Should the generated Go code for file 3 reference P1.M, or P2.M? The two should be equivalent, since file 2 will contain a forwarding declaration such as "type M = P1.M". Historically, we've gone with the latter (P2.M). This does make sense: A generated file only imports the packages of the files that it directly imports. However, this does have some mildly surprising effects. If File 3 imports files 2a and 2b, each of which publicly imports file 1, we need to arbitrarily pick one of P2a.M or P2b.M. (Admittedly an obscure case.) Simplify the generator a little bit (and, more importantly, make it consistent with the v2 generator) and change to referencing public imports directly. Change-Id: I7770279762c06fc1cc31b5206c5edf1f02114804 Cherry-Pick: github.com/golang/protobuf@1918e1ff6ffd2be7bed0553df8650672c3bfe80d Original-Author: Damien Neil Reviewed-on: https://go-review.googlesource.com/c/151433 Reviewed-by: Damien Neil --- protoc-gen-go/generator/generator.go | 46 ++++++---------------------- 1 file changed, 9 insertions(+), 37 deletions(-) diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 4bc06598c6..19e59065cd 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -974,39 +974,6 @@ func (g *Generator) ObjectNamed(typeName string) Object { if !ok { g.Fail("can't find object with type", typeName) } - - // If the file of this object isn't a direct dependency of the current file, - // or in the current file, then this object has been publicly imported into - // a dependency of the current file. - // We should return the ImportedDescriptor object for it instead. - direct := *o.File().Name == *g.file.Name - if !direct { - for _, dep := range g.file.Dependency { - if *g.fileByName(dep).Name == *o.File().Name { - direct = true - break - } - } - } - if !direct { - found := false - Loop: - for _, dep := range g.file.Dependency { - df := g.fileByName(*g.fileByName(dep).Name) - for _, td := range df.imp { - if td.o == o { - // Found it! - o = td - found = true - break Loop - } - } - } - if !found { - log.Printf("protoc-gen-go: WARNING: failed finding publicly imported dependency for %v, used in %v", typeName, *g.file.Name) - } - } - return o } @@ -1690,11 +1657,16 @@ func (g *Generator) GoType(message *Descriptor, field *descriptor.FieldDescripto } func (g *Generator) RecordTypeUse(t string) { - if _, ok := g.typeNameToObject[t]; ok { - // Call ObjectNamed to get the true object to record the use. - obj := g.ObjectNamed(t) - g.usedPackages[obj.GoImportPath()] = true + if _, ok := g.typeNameToObject[t]; !ok { + return + } + importPath := g.ObjectNamed(t).GoImportPath() + if importPath == g.outputImportPath { + // Don't record use of objects in our package. + return } + g.AddImport(importPath) + g.usedPackages[importPath] = true } // Method names that may be generated. Fields with these names get an From 5b218a2ddfe307a0a5922452b5a3bd1d0d8eb369 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:56:59 +0000 Subject: [PATCH 020/133] all: increase minimum supported version to go1.9 (#742) Change-Id: I2a4b279bd969483f4136d02b1e224ee342726b35 Cherry-Pick: github.com/golang/protobuf@75dceb112b174be156fa9952e66d3e99945572b4 Original-Author: Joe Tsai Reviewed-on: https://go-review.googlesource.com/c/151434 Reviewed-by: Damien Neil --- README.md | 2 +- protoc-gen-go/grpc/grpc.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 61820bed62..09e07728e2 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Google's data interchange format. Copyright 2010 The Go Authors. https://github.com/golang/protobuf -This package and the code it generates requires at least Go 1.6. +This package and the code it generates requires at least Go 1.9. This software implements Go bindings for protocol buffers. For information about protocol buffers themselves, see diff --git a/protoc-gen-go/grpc/grpc.go b/protoc-gen-go/grpc/grpc.go index 63748356ca..e6db758c70 100644 --- a/protoc-gen-go/grpc/grpc.go +++ b/protoc-gen-go/grpc/grpc.go @@ -55,7 +55,7 @@ const generatedCodeVersion = 4 // Paths for packages used by code generated in this file, // relative to the import_prefix of the generator.Generator. const ( - contextPkgPath = "golang.org/x/net/context" + contextPkgPath = "context" grpcPkgPath = "google.golang.org/grpc" ) From 1864a4d78e8becd3dd282257aa7fcc475e920968 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 08:58:43 +0000 Subject: [PATCH 021/133] proto: deprecate {Unm,M}arshalMessageSet{JSON} (#741) Despite the naming, these are "internal-only" functions that are intended to only be called from generated code for MessageSets. Furthermore, MessageSets are themselves a deprecated feature from proto1 days, such that descriptor.proto even warns against their use since the initial open-source release of protocol buffers in 2008. Within Google, there are no direct usages of these functions, and all existing usages of MessageSets go through the new table-driven implementation. In addition to deprecating the {Unm,M}arshalMessageSet{JSON} top-level functions, also modify the generator to stop emitting MarshalJSON and UnmarshalJSON methods for messages sets. The UnmarshalJSON method is not implemented and the MarshalJSON method does not seem to be called anywhere in Google (verified by making the method panic and doing a global test). The jsonpb package continues to work with MessageSets. I should note that when the table-driven implementation was open sourced in late 2017 (see 8cc9e46429bfb16289d40d30b2ee3f4923b47345), it accidentally removed generation of the Marshal and Unmarshal method. However, no one seemed to have noticed that those methods were no longer generated. Change-Id: I5fa3ddc452ff1906a4d7c31c6e0a2902702784ca Cherry-Pick: github.com/golang/protobuf@951a149f90371fb8858c6c979d03bb2583611052 Original-Author: Joe Tsai Reviewed-on: https://go-review.googlesource.com/c/151435 Reviewed-by: Damien Neil --- proto/deprecated.go | 25 +++++ proto/message_set.go | 137 +-------------------------- proto/message_set_test.go | 77 ++++++++------- proto/table_unmarshal.go | 2 +- protoc-gen-go/generator/generator.go | 17 ---- 5 files changed, 72 insertions(+), 186 deletions(-) diff --git a/proto/deprecated.go b/proto/deprecated.go index 69de0ea0ef..35b882c09a 100644 --- a/proto/deprecated.go +++ b/proto/deprecated.go @@ -31,8 +31,33 @@ package proto +import "errors" + // Deprecated: do not use. type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } // Deprecated: do not use. func GetStats() Stats { return Stats{} } + +// Deprecated: do not use. +func MarshalMessageSet(interface{}) ([]byte, error) { + return nil, errors.New("proto: not implemented") +} + +// Deprecated: do not use. +func UnmarshalMessageSet([]byte, interface{}) error { + return errors.New("proto: not implemented") +} + +// Deprecated: do not use. +func MarshalMessageSetJSON(interface{}) ([]byte, error) { + return nil, errors.New("proto: not implemented") +} + +// Deprecated: do not use. +func UnmarshalMessageSetJSON([]byte, interface{}) error { + return errors.New("proto: not implemented") +} + +// Deprecated: do not use. +func RegisterMessageSetType(Message, int32, string) {} diff --git a/proto/message_set.go b/proto/message_set.go index 3b6ca41d5e..f48a756761 100644 --- a/proto/message_set.go +++ b/proto/message_set.go @@ -36,13 +36,7 @@ package proto */ import ( - "bytes" - "encoding/json" "errors" - "fmt" - "reflect" - "sort" - "sync" ) // errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. @@ -145,46 +139,9 @@ func skipVarint(buf []byte) []byte { return buf[i+1:] } -// MarshalMessageSet encodes the extension map represented by m in the message set wire format. -// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option. -func MarshalMessageSet(exts interface{}) ([]byte, error) { - return marshalMessageSet(exts, false) -} - -// marshaMessageSet implements above function, with the opt to turn on / off deterministic during Marshal. -func marshalMessageSet(exts interface{}, deterministic bool) ([]byte, error) { - switch exts := exts.(type) { - case *XXX_InternalExtensions: - var u marshalInfo - siz := u.sizeMessageSet(exts) - b := make([]byte, 0, siz) - return u.appendMessageSet(b, exts, deterministic) - - case map[int32]Extension: - // This is an old-style extension map. - // Wrap it in a new-style XXX_InternalExtensions. - ie := XXX_InternalExtensions{ - p: &struct { - mu sync.Mutex - extensionMap map[int32]Extension - }{ - extensionMap: exts, - }, - } - - var u marshalInfo - siz := u.sizeMessageSet(&ie) - b := make([]byte, 0, siz) - return u.appendMessageSet(b, &ie, deterministic) - - default: - return nil, errors.New("proto: not an extension map") - } -} - -// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. +// unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. // It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. -func UnmarshalMessageSet(buf []byte, exts interface{}) error { +func unmarshalMessageSet(buf []byte, exts interface{}) error { var m map[int32]Extension switch exts := exts.(type) { case *XXX_InternalExtensions: @@ -222,93 +179,3 @@ func UnmarshalMessageSet(buf []byte, exts interface{}) error { } return nil } - -// MarshalMessageSetJSON encodes the extension map represented by m in JSON format. -// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option. -func MarshalMessageSetJSON(exts interface{}) ([]byte, error) { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - var mu sync.Locker - m, mu = exts.extensionsRead() - if m != nil { - // Keep the extensions map locked until we're done marshaling to prevent - // races between marshaling and unmarshaling the lazily-{en,de}coded - // values. - mu.Lock() - defer mu.Unlock() - } - case map[int32]Extension: - m = exts - default: - return nil, errors.New("proto: not an extension map") - } - var b bytes.Buffer - b.WriteByte('{') - - // Process the map in key order for deterministic output. - ids := make([]int32, 0, len(m)) - for id := range m { - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) // int32Slice defined in text.go - - for i, id := range ids { - ext := m[id] - msd, ok := messageSetMap[id] - if !ok { - // Unknown type; we can't render it, so skip it. - continue - } - - if i > 0 && b.Len() > 1 { - b.WriteByte(',') - } - - fmt.Fprintf(&b, `"[%s]":`, msd.name) - - x := ext.value - if x == nil { - x = reflect.New(msd.t.Elem()).Interface() - if err := Unmarshal(ext.enc, x.(Message)); err != nil { - return nil, err - } - } - d, err := json.Marshal(x) - if err != nil { - return nil, err - } - b.Write(d) - } - b.WriteByte('}') - return b.Bytes(), nil -} - -// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format. -// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option. -func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error { - // Common-case fast path. - if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) { - return nil - } - - // This is fairly tricky, and it's not clear that it is needed. - return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented") -} - -// A global registry of types that can be used in a MessageSet. - -var messageSetMap = make(map[int32]messageSetDesc) - -type messageSetDesc struct { - t reflect.Type // pointer to struct - name string -} - -// RegisterMessageSetType is called from the generated code. -func RegisterMessageSetType(m Message, fieldNum int32, name string) { - messageSetMap[fieldNum] = messageSetDesc{ - t: reflect.TypeOf(m), - name: name, - } -} diff --git a/proto/message_set_test.go b/proto/message_set_test.go index 2c170c5f2a..1bd11aaec1 100644 --- a/proto/message_set_test.go +++ b/proto/message_set_test.go @@ -29,49 +29,60 @@ // (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 +package proto_test import ( "bytes" + "fmt" "testing" + + "github.com/golang/protobuf/proto" + . "github.com/golang/protobuf/proto/test_proto" ) func TestUnmarshalMessageSetWithDuplicate(t *testing.T) { - // Check that a repeated message set entry will be concatenated. - in := &messageSet{ - Item: []*_MessageSet_Item{ - {TypeId: Int32(12345), Message: []byte("hoo")}, - {TypeId: Int32(12345), Message: []byte("hah")}, - }, - } - b, err := Marshal(in) - if err != nil { - t.Fatalf("Marshal: %v", err) - } - t.Logf("Marshaled bytes: %q", b) + /* + Message{ + Tag{1, StartGroup}, + Message{ + Tag{2, Varint}, Uvarint(12345), + Tag{3, Bytes}, Bytes("hoo"), + }, + Tag{1, EndGroup}, + Tag{1, StartGroup}, + Message{ + Tag{2, Varint}, Uvarint(12345), + Tag{3, Bytes}, Bytes("hah"), + }, + Tag{1, EndGroup}, + } + */ + var in []byte + fmt.Sscanf("0b10b9601a03686f6f0c0b10b9601a036861680c", "%x", &in) - var extensions XXX_InternalExtensions - if err := UnmarshalMessageSet(b, &extensions); err != nil { - t.Fatalf("UnmarshalMessageSet: %v", err) - } - ext, ok := extensions.p.extensionMap[12345] - if !ok { - t.Fatalf("Didn't retrieve extension 12345; map is %v", extensions.p.extensionMap) - } - // Skip wire type/field number and length varints. - got := skipVarint(skipVarint(ext.enc)) - if want := []byte("hoohah"); !bytes.Equal(got, want) { - t.Errorf("Combined extension is %q, want %q", got, want) - } -} + /* + Message{ + Tag{1, StartGroup}, + Message{ + Tag{2, Varint}, Uvarint(12345), + Tag{3, Bytes}, Bytes("hoohah"), + }, + Tag{1, EndGroup}, + } + */ + var want []byte + fmt.Sscanf("0b10b9601a06686f6f6861680c", "%x", &want) -func TestMarshalMessageSetJSON_UnknownType(t *testing.T) { - extMap := map[int32]Extension{12345: Extension{}} - got, err := MarshalMessageSetJSON(extMap) + var m MyMessageSet + if err := proto.Unmarshal(in, &m); err != nil { + t.Fatalf("unexpected Unmarshal error: %v", err) + } + got, err := proto.Marshal(&m) if err != nil { - t.Fatalf("MarshalMessageSetJSON: %v", err) + t.Fatalf("unexpected Marshal error: %v", err) } - if want := []byte("{}"); !bytes.Equal(got, want) { - t.Errorf("MarshalMessageSetJSON(%v) = %q, want %q", extMap, got, want) + + if !bytes.Equal(got, want) { + t.Errorf("output mismatch:\ngot %x\nwant %x", got, want) } } diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index fd4afec8d2..5da26ed523 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -136,7 +136,7 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { u.computeUnmarshalInfo() } if u.isMessageSet { - return UnmarshalMessageSet(b, m.offset(u.extensions).toExtensions()) + return unmarshalMessageSet(b, m.offset(u.extensions).toExtensions()) } var reqMask uint64 // bitmask of required fields we've seen. var errLater error diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 19e59065cd..3cc2091730 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -2409,17 +2409,6 @@ func (g *Generator) generateCommonMethods(mc *msgCtx) { // Extension support methods if len(mc.message.ExtensionRange) > 0 { - // message_set_wire_format only makes sense when extensions are defined. - if opts := mc.message.Options; opts != nil && opts.GetMessageSetWireFormat() { - g.P() - g.P("func (m *", mc.goName, ") MarshalJSON() ([]byte, error) {") - g.P("return ", g.Pkg["proto"], ".MarshalMessageSetJSON(&m.XXX_InternalExtensions)") - g.P("}") - g.P("func (m *", mc.goName, ") UnmarshalJSON(buf []byte) error {") - g.P("return ", g.Pkg["proto"], ".UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions)") - g.P("}") - } - g.P() g.P("var extRange_", mc.goName, " = []", g.Pkg["proto"], ".ExtensionRange{") for _, r := range mc.message.ExtensionRange { @@ -2825,10 +2814,8 @@ func (g *Generator) generateExtension(ext *ExtensionDescriptor) { // In addition, the situation for when to apply this special case is implemented // differently in other languages: // https://github.com/google/protobuf/blob/aff10976/src/google/protobuf/text_format.cc#L1560 - mset := false if extDesc.GetOptions().GetMessageSetWireFormat() && typeName[len(typeName)-1] == "message_set_extension" { typeName = typeName[:len(typeName)-1] - mset = true } // For text formatting, the package must be exactly what the .proto file declares, @@ -2850,10 +2837,6 @@ func (g *Generator) generateExtension(ext *ExtensionDescriptor) { g.P() g.addInitf("%s.RegisterExtension(%s)", g.Pkg["proto"], ext.DescName()) - if mset { - // Generate a bit more code to register with message_set.go. - g.addInitf("%s.RegisterMessageSetType((%s)(nil), %d, %q)", g.Pkg["proto"], fieldType, *field.Number, extName) - } g.file.addExport(ext, constOrVarSymbol{ccTypeName, "var", ""}) } From d6f7ca2ac0e59a7f5aaf5c0e6603e1dc8f8b8baf Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 09:01:16 +0000 Subject: [PATCH 022/133] proto: store extension values according to protobuf data model (#746) The current API represents scalar extension fields as *T and repeated extension fields as []T. However, this is not an accurate reflection of the protobuf data model. For scalars, pointers are usually used to represent nullability. However, in the case of extension scalars, there is no need to do so since presence information is captured by checking whether the field is in the extension map. For this reason, presence on extension scalars is not determined by checking whether the returned pointer is nil, but whether HasExtension reports true. For repeated fields, using []T means that the returned value is only a partially mutable value. You can swap out elements, but you cannot change the length of the original field value. On the other hand, the reflective API provides methods on repeated field values that permit operations that do change the length. Thus, using *[]T is a closer match to the protobuf data model. This CL changes the implementation of extension fields to always store T for scalars, and *[]T for repeated fields. However, for backwards compatibility, the API continues to provide *T and []T. In theory, this could break anyone that relies on memory aliasing for *T. However, this is unlikely since: * use of extensions themselves are relatively rare * if extensions are used, it is recommended practice to use a message as the field extension and not a scalar * relying on memory aliasing is generally not a good idiom to follow. The expected pattern is to call SetExtension to make it explicit that a mutation is happening on the message. * analysis within Google demonstrates that no one is relying on this behavior. Change-Id: Ieec4c3ba8176aabe7c3139d12741c7fcc46ba83d Cherry-Pick: github.com/golang/protobuf@52132540909e117f2b98b0694383dc0ab1e1deca Original-Author: Joe Tsai Reviewed-on: https://go-review.googlesource.com/c/151436 Reviewed-by: Damien Neil --- proto/clone_test.go | 50 +++++++++++++++++--------- proto/equal.go | 3 +- proto/extensions.go | 76 ++++++++++++++++++++++++++++++++++++---- proto/pointer_reflect.go | 5 ++- proto/pointer_unsafe.go | 15 +++++--- proto/table_marshal.go | 34 +++++++++++------- 6 files changed, 141 insertions(+), 42 deletions(-) diff --git a/proto/clone_test.go b/proto/clone_test.go index 0d3b127371..b04989e27d 100644 --- a/proto/clone_test.go +++ b/proto/clone_test.go @@ -67,34 +67,50 @@ func init() { if err := proto.SetExtension(cloneTestMessage, pb.E_Ext_More, ext); err != nil { panic("SetExtension: " + err.Error()) } + if err := proto.SetExtension(cloneTestMessage, pb.E_Ext_Text, proto.String("hello")); err != nil { + panic("SetExtension: " + err.Error()) + } + if err := proto.SetExtension(cloneTestMessage, pb.E_Greeting, []string{"one", "two"}); err != nil { + panic("SetExtension: " + err.Error()) + } } func TestClone(t *testing.T) { + // Create a clone using a marshal/unmarshal roundtrip. + vanilla := new(pb.MyMessage) + b, err := proto.Marshal(cloneTestMessage) + if err != nil { + t.Errorf("unexpected Marshal error: %v", err) + } + if err := proto.Unmarshal(b, vanilla); err != nil { + t.Errorf("unexpected Unarshal error: %v", err) + } + + // Create a clone using Clone and verify that it is equal to the original. m := proto.Clone(cloneTestMessage).(*pb.MyMessage) if !proto.Equal(m, cloneTestMessage) { t.Fatalf("Clone(%v) = %v", cloneTestMessage, m) } - // Verify it was a deep copy. - *m.Inner.Port++ - if proto.Equal(m, cloneTestMessage) { - t.Error("Mutating clone changed the original") - } - // Byte fields and repeated fields should be copied. - if &m.Pet[0] == &cloneTestMessage.Pet[0] { - t.Error("Pet: repeated field not copied") + // Mutate the clone, which should not affect the original. + x1, err := proto.GetExtension(m, pb.E_Ext_More) + if err != nil { + t.Errorf("unexpected GetExtension(%v) error: %v", pb.E_Ext_More.Name, err) } - if &m.Others[0] == &cloneTestMessage.Others[0] { - t.Error("Others: repeated field not copied") + x2, err := proto.GetExtension(m, pb.E_Ext_Text) + if err != nil { + t.Errorf("unexpected GetExtension(%v) error: %v", pb.E_Ext_Text.Name, err) } - if &m.Others[0].Value[0] == &cloneTestMessage.Others[0].Value[0] { - t.Error("Others[0].Value: bytes field not copied") + x3, err := proto.GetExtension(m, pb.E_Greeting) + if err != nil { + t.Errorf("unexpected GetExtension(%v) error: %v", pb.E_Greeting.Name, err) } - if &m.RepBytes[0] == &cloneTestMessage.RepBytes[0] { - t.Error("RepBytes: repeated field not copied") - } - if &m.RepBytes[0][0] == &cloneTestMessage.RepBytes[0][0] { - t.Error("RepBytes[0]: bytes field not copied") + *m.Inner.Port++ + *(x1.(*pb.Ext)).Data = "blah blah" + *(x2.(*string)) = "goodbye" + x3.([]string)[0] = "zero" + if !proto.Equal(cloneTestMessage, vanilla) { + t.Fatalf("mutation on original detected:\ngot %v\nwant %v", cloneTestMessage, vanilla) } } diff --git a/proto/equal.go b/proto/equal.go index d4db5a1c14..f9b6e41b3c 100644 --- a/proto/equal.go +++ b/proto/equal.go @@ -246,7 +246,8 @@ func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { return false } - m1, m2 := e1.value, e2.value + m1 := extensionAsLegacyType(e1.value) + m2 := extensionAsLegacyType(e2.value) if m1 == nil && m2 == nil { // Both have only encoded form. diff --git a/proto/extensions.go b/proto/extensions.go index dacdd22d2a..fa88add30a 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -185,9 +185,25 @@ type Extension struct { // extension will have only enc set. When such an extension is // accessed using GetExtension (or GetExtensions) desc and value // will be set. - desc *ExtensionDesc + 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 []byte + + // enc is the raw bytes for the extension field. + enc []byte } // SetRawExtension is for testing only. @@ -334,7 +350,7 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { // descriptors with the same field number. return nil, errors.New("proto: descriptor conflict") } - return e.value, nil + return extensionAsLegacyType(e.value), nil } if extension.ExtensionType == nil { @@ -349,11 +365,11 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { // Remember the decoded version and drop the encoded version. // That way it is safe to mutate what we return. - e.value = v + e.value = extensionAsStorageType(v) e.desc = extension e.enc = nil emap[extension.Field] = e - return e.value, nil + return extensionAsLegacyType(e.value), nil } // defaultExtensionValue returns the default value for extension. @@ -500,7 +516,7 @@ func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error } extmap := epb.extensionsWrite() - extmap[extension.Field] = Extension{desc: extension, value: value} + extmap[extension.Field] = Extension{desc: extension, value: extensionAsStorageType(value)} return nil } @@ -541,3 +557,51 @@ func RegisterExtension(desc *ExtensionDesc) { func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { return extensionMaps[reflect.TypeOf(pb).Elem()] } + +// extensionAsLegacyType converts an value in the storage type as the API type. +// See Extension.value. +func extensionAsLegacyType(v interface{}) interface{} { + switch rv := reflect.ValueOf(v); rv.Kind() { + case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: + // Represent primitive types as a pointer to the value. + rv2 := reflect.New(rv.Type()) + rv2.Elem().Set(rv) + v = rv2.Interface() + case reflect.Ptr: + // Represent slice types as the value itself. + switch rv.Type().Elem().Kind() { + case reflect.Slice: + if rv.IsNil() { + v = reflect.Zero(rv.Type().Elem()).Interface() + } else { + v = rv.Elem().Interface() + } + } + } + return v +} + +// extensionAsStorageType converts an value in the API type as the storage type. +// See Extension.value. +func extensionAsStorageType(v interface{}) interface{} { + switch rv := reflect.ValueOf(v); rv.Kind() { + case reflect.Ptr: + // Represent slice types as the value itself. + switch rv.Type().Elem().Kind() { + case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: + if rv.IsNil() { + v = reflect.Zero(rv.Type().Elem()).Interface() + } else { + v = rv.Elem().Interface() + } + } + case reflect.Slice: + // Represent slice types as a pointer to the value. + if rv.Type().Elem().Kind() != reflect.Uint8 { + rv2 := reflect.New(rv.Type()) + rv2.Elem().Set(rv) + v = rv2.Interface() + } + } + return v +} diff --git a/proto/pointer_reflect.go b/proto/pointer_reflect.go index b6cad90834..94fa9194a8 100644 --- a/proto/pointer_reflect.go +++ b/proto/pointer_reflect.go @@ -79,10 +79,13 @@ func toPointer(i *Message) pointer { // toAddrPointer converts an interface to a pointer that points to // the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { +func toAddrPointer(i *interface{}, isptr, deref bool) pointer { v := reflect.ValueOf(*i) u := reflect.New(v.Type()) u.Elem().Set(v) + if deref { + u = u.Elem() + } return pointer{v: u} } diff --git a/proto/pointer_unsafe.go b/proto/pointer_unsafe.go index d55a335d94..dbfffe071b 100644 --- a/proto/pointer_unsafe.go +++ b/proto/pointer_unsafe.go @@ -85,16 +85,21 @@ func toPointer(i *Message) pointer { // toAddrPointer converts an interface to a pointer that points to // the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { +func toAddrPointer(i *interface{}, isptr, deref bool) (p pointer) { // Super-tricky - read or get the address of data word of interface value. if isptr { // The interface is of pointer type, thus it is a direct interface. // The data word is the pointer data itself. We take its address. - return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} + p = pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} + } else { + // The interface is not of pointer type. The data word is the pointer + // to the data. + p = pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} } - // The interface is not of pointer type. The data word is the pointer - // to the data. - return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} + if deref { + p.p = *(*unsafe.Pointer)(p.p) + } + return p } // valToPointer converts v to a pointer. v must be of pointer type. diff --git a/proto/table_marshal.go b/proto/table_marshal.go index f3a2d16a42..ad747bfa1d 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -87,6 +87,7 @@ type marshalElemInfo struct { sizer sizer marshaler marshaler isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only) + deref bool // dereference the pointer before operating on it; implies isptr } var ( @@ -407,13 +408,22 @@ func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo { panic("tag is not an integer") } wt := wiretype(tags[0]) + if t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct { + t = t.Elem() + } sizer, marshaler := typeMarshaler(t, tags, false, false) + var deref bool + if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { + t = reflect.PtrTo(t) + deref = true + } e = &marshalElemInfo{ wiretag: uint64(tag)<<3 | wt, tagsize: SizeVarint(uint64(tag) << 3), sizer: sizer, marshaler: marshaler, isptr: t.Kind() == reflect.Ptr, + deref: deref, } // update cache @@ -2310,8 +2320,8 @@ func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { for _, k := range m.MapKeys() { ki := k.Interface() vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value + kaddr := toAddrPointer(&ki, false, false) // pointer to key + vaddr := toAddrPointer(&vi, valIsPtr, false) // pointer to value siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) n += siz + SizeVarint(uint64(siz)) + tagsize } @@ -2329,8 +2339,8 @@ func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { for _, k := range keys { ki := k.Interface() vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value + kaddr := toAddrPointer(&ki, false, false) // pointer to key + vaddr := toAddrPointer(&vi, valIsPtr, false) // pointer to value b = appendVarint(b, tag) siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) b = appendVarint(b, uint64(siz)) @@ -2399,7 +2409,7 @@ func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { // the last time this function was called. ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, ei.tagsize) } mu.Unlock() @@ -2434,7 +2444,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { return b, err @@ -2465,7 +2475,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { return b, err @@ -2510,7 +2520,7 @@ func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, 1) // message, tag = 3 (size=1) } mu.Unlock() @@ -2553,7 +2563,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) if !nerr.Merge(err) { return b, err @@ -2591,7 +2601,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) b = append(b, 1<<3|WireEndGroup) if !nerr.Merge(err) { @@ -2621,7 +2631,7 @@ func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, ei.tagsize) } return n @@ -2656,7 +2666,7 @@ func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, determ ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { return b, err From e21ef87307a5e9a76e70662530224ac8d30d90b2 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 09:03:32 +0000 Subject: [PATCH 023/133] all: update to v3.6.1 (#757) Update all proto files that is obtained from the upstream repository to v3.6.1. Change-Id: I18110fc1f20792b8258126eb91e8345d566211d8 Cherry-Pick: github.com/golang/protobuf@882cf97a83ad205fd22af574246a3bc647d7a7d2 Original-Author: Joe Tsai Reviewed-on: https://go-review.googlesource.com/c/151457 Reviewed-by: Damien Neil --- protoc-gen-go/descriptor/descriptor.pb.go | 346 ++++++++++++---------- protoc-gen-go/descriptor/descriptor.proto | 11 + ptypes/any/any.pb.go | 21 +- ptypes/any/any.proto | 21 +- ptypes/timestamp/timestamp.pb.go | 8 +- ptypes/timestamp/timestamp.proto | 8 +- 6 files changed, 232 insertions(+), 183 deletions(-) diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index a560e9e91b..3ec5f43e1b 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -1375,6 +1375,14 @@ type FileOptions struct { // is empty. When this option is empty, the package name will be used for // determining the namespace. PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"` + // Use this option to change the namespace of php generated metadata classes. + // Default is empty. When this option is empty, the proto file name will be used + // for determining the namespace. + PhpMetadataNamespace *string `protobuf:"bytes,44,opt,name=php_metadata_namespace,json=phpMetadataNamespace" json:"php_metadata_namespace,omitempty"` + // Use this option to change the package of ruby generated classes. Default + // is empty. When this option is not set, the package name will be used for + // determining the ruby package. + RubyPackage *string `protobuf:"bytes,45,opt,name=ruby_package,json=rubyPackage" json:"ruby_package,omitempty"` // The parser stores options it doesn't recognize here. // See the documentation for the "Options" section above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` @@ -1554,6 +1562,20 @@ func (m *FileOptions) GetPhpNamespace() string { return "" } +func (m *FileOptions) GetPhpMetadataNamespace() string { + if m != nil && m.PhpMetadataNamespace != nil { + return *m.PhpMetadataNamespace + } + return "" +} + +func (m *FileOptions) GetRubyPackage() string { + if m != nil && m.RubyPackage != nil { + return *m.RubyPackage + } + return "" +} + func (m *FileOptions) GetUninterpretedOption() []*UninterpretedOption { if m != nil { return m.UninterpretedOption @@ -2699,165 +2721,167 @@ func init() { func init() { proto.RegisterFile("google/protobuf/descriptor.proto", fileDescriptor_e5baabe45344a177) } var fileDescriptor_e5baabe45344a177 = []byte{ - // 2555 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xdd, 0x6e, 0x1b, 0xc7, - 0xf5, 0xcf, 0xf2, 0x4b, 0xe4, 0x21, 0x45, 0x8d, 0x46, 0x8a, 0xbd, 0x56, 0x3e, 0x2c, 0x33, 0x1f, - 0x96, 0x9d, 0x7f, 0xa8, 0xc0, 0xb1, 0x1d, 0x47, 0xfe, 0x23, 0x2d, 0x45, 0xae, 0x15, 0xaa, 0x12, - 0xc9, 0x2e, 0xa9, 0xe6, 0x03, 0x28, 0x16, 0xa3, 0xdd, 0x21, 0xb9, 0xf6, 0x72, 0x77, 0xb3, 0xbb, - 0xb4, 0xad, 0xa0, 0x17, 0x06, 0x7a, 0xd5, 0xab, 0xde, 0x16, 0x45, 0xd1, 0x8b, 0xde, 0x04, 0xe8, - 0x03, 0x14, 0xc8, 0x5d, 0x9f, 0xa0, 0x40, 0xde, 0xa0, 0x68, 0x0b, 0xb4, 0x8f, 0xd0, 0xcb, 0x62, - 0x66, 0x76, 0x97, 0xbb, 0x24, 0x15, 0x2b, 0x01, 0xe2, 0x5c, 0x91, 0xf3, 0x9b, 0xdf, 0x39, 0x73, - 0xe6, 0xcc, 0x99, 0x33, 0x67, 0x66, 0x61, 0x7b, 0xe4, 0x38, 0x23, 0x8b, 0xee, 0xba, 0x9e, 0x13, - 0x38, 0xa7, 0xd3, 0xe1, 0xae, 0x41, 0x7d, 0xdd, 0x33, 0xdd, 0xc0, 0xf1, 0xea, 0x1c, 0xc3, 0x6b, - 0x82, 0x51, 0x8f, 0x18, 0xb5, 0x63, 0x58, 0x7f, 0x60, 0x5a, 0xb4, 0x15, 0x13, 0xfb, 0x34, 0xc0, - 0xf7, 0x20, 0x37, 0x34, 0x2d, 0x2a, 0x4b, 0xdb, 0xd9, 0x9d, 0xf2, 0xad, 0x37, 0xeb, 0x73, 0x42, - 0xf5, 0xb4, 0x44, 0x8f, 0xc1, 0x2a, 0x97, 0xa8, 0xfd, 0x2b, 0x07, 0x1b, 0x4b, 0x7a, 0x31, 0x86, - 0x9c, 0x4d, 0x26, 0x4c, 0xa3, 0xb4, 0x53, 0x52, 0xf9, 0x7f, 0x2c, 0xc3, 0x8a, 0x4b, 0xf4, 0x47, - 0x64, 0x44, 0xe5, 0x0c, 0x87, 0xa3, 0x26, 0x7e, 0x1d, 0xc0, 0xa0, 0x2e, 0xb5, 0x0d, 0x6a, 0xeb, - 0x67, 0x72, 0x76, 0x3b, 0xbb, 0x53, 0x52, 0x13, 0x08, 0x7e, 0x07, 0xd6, 0xdd, 0xe9, 0xa9, 0x65, - 0xea, 0x5a, 0x82, 0x06, 0xdb, 0xd9, 0x9d, 0xbc, 0x8a, 0x44, 0x47, 0x6b, 0x46, 0xbe, 0x0e, 0x6b, - 0x4f, 0x28, 0x79, 0x94, 0xa4, 0x96, 0x39, 0xb5, 0xca, 0xe0, 0x04, 0xb1, 0x09, 0x95, 0x09, 0xf5, - 0x7d, 0x32, 0xa2, 0x5a, 0x70, 0xe6, 0x52, 0x39, 0xc7, 0x67, 0xbf, 0xbd, 0x30, 0xfb, 0xf9, 0x99, - 0x97, 0x43, 0xa9, 0xc1, 0x99, 0x4b, 0x71, 0x03, 0x4a, 0xd4, 0x9e, 0x4e, 0x84, 0x86, 0xfc, 0x39, - 0xfe, 0x53, 0xec, 0xe9, 0x64, 0x5e, 0x4b, 0x91, 0x89, 0x85, 0x2a, 0x56, 0x7c, 0xea, 0x3d, 0x36, - 0x75, 0x2a, 0x17, 0xb8, 0x82, 0xeb, 0x0b, 0x0a, 0xfa, 0xa2, 0x7f, 0x5e, 0x47, 0x24, 0x87, 0x9b, - 0x50, 0xa2, 0x4f, 0x03, 0x6a, 0xfb, 0xa6, 0x63, 0xcb, 0x2b, 0x5c, 0xc9, 0x5b, 0x4b, 0x56, 0x91, - 0x5a, 0xc6, 0xbc, 0x8a, 0x99, 0x1c, 0xbe, 0x0b, 0x2b, 0x8e, 0x1b, 0x98, 0x8e, 0xed, 0xcb, 0xc5, - 0x6d, 0x69, 0xa7, 0x7c, 0xeb, 0xd5, 0xa5, 0x81, 0xd0, 0x15, 0x1c, 0x35, 0x22, 0xe3, 0x36, 0x20, - 0xdf, 0x99, 0x7a, 0x3a, 0xd5, 0x74, 0xc7, 0xa0, 0x9a, 0x69, 0x0f, 0x1d, 0xb9, 0xc4, 0x15, 0x5c, - 0x5d, 0x9c, 0x08, 0x27, 0x36, 0x1d, 0x83, 0xb6, 0xed, 0xa1, 0xa3, 0x56, 0xfd, 0x54, 0x1b, 0x5f, - 0x82, 0x82, 0x7f, 0x66, 0x07, 0xe4, 0xa9, 0x5c, 0xe1, 0x11, 0x12, 0xb6, 0x6a, 0x5f, 0x17, 0x60, - 0xed, 0x22, 0x21, 0x76, 0x1f, 0xf2, 0x43, 0x36, 0x4b, 0x39, 0xf3, 0x5d, 0x7c, 0x20, 0x64, 0xd2, - 0x4e, 0x2c, 0x7c, 0x4f, 0x27, 0x36, 0xa0, 0x6c, 0x53, 0x3f, 0xa0, 0x86, 0x88, 0x88, 0xec, 0x05, - 0x63, 0x0a, 0x84, 0xd0, 0x62, 0x48, 0xe5, 0xbe, 0x57, 0x48, 0x7d, 0x0a, 0x6b, 0xb1, 0x49, 0x9a, - 0x47, 0xec, 0x51, 0x14, 0x9b, 0xbb, 0xcf, 0xb3, 0xa4, 0xae, 0x44, 0x72, 0x2a, 0x13, 0x53, 0xab, - 0x34, 0xd5, 0xc6, 0x2d, 0x00, 0xc7, 0xa6, 0xce, 0x50, 0x33, 0xa8, 0x6e, 0xc9, 0xc5, 0x73, 0xbc, - 0xd4, 0x65, 0x94, 0x05, 0x2f, 0x39, 0x02, 0xd5, 0x2d, 0xfc, 0xe1, 0x2c, 0xd4, 0x56, 0xce, 0x89, - 0x94, 0x63, 0xb1, 0xc9, 0x16, 0xa2, 0xed, 0x04, 0xaa, 0x1e, 0x65, 0x71, 0x4f, 0x8d, 0x70, 0x66, - 0x25, 0x6e, 0x44, 0xfd, 0xb9, 0x33, 0x53, 0x43, 0x31, 0x31, 0xb1, 0x55, 0x2f, 0xd9, 0xc4, 0x6f, - 0x40, 0x0c, 0x68, 0x3c, 0xac, 0x80, 0x67, 0xa1, 0x4a, 0x04, 0x76, 0xc8, 0x84, 0x6e, 0x7d, 0x09, - 0xd5, 0xb4, 0x7b, 0xf0, 0x26, 0xe4, 0xfd, 0x80, 0x78, 0x01, 0x8f, 0xc2, 0xbc, 0x2a, 0x1a, 0x18, - 0x41, 0x96, 0xda, 0x06, 0xcf, 0x72, 0x79, 0x95, 0xfd, 0xc5, 0x3f, 0x9d, 0x4d, 0x38, 0xcb, 0x27, - 0xfc, 0xf6, 0xe2, 0x8a, 0xa6, 0x34, 0xcf, 0xcf, 0x7b, 0xeb, 0x03, 0x58, 0x4d, 0x4d, 0xe0, 0xa2, - 0x43, 0xd7, 0x7e, 0x05, 0x2f, 0x2f, 0x55, 0x8d, 0x3f, 0x85, 0xcd, 0xa9, 0x6d, 0xda, 0x01, 0xf5, - 0x5c, 0x8f, 0xb2, 0x88, 0x15, 0x43, 0xc9, 0xff, 0x5e, 0x39, 0x27, 0xe6, 0x4e, 0x92, 0x6c, 0xa1, - 0x45, 0xdd, 0x98, 0x2e, 0x82, 0x37, 0x4b, 0xc5, 0xff, 0xac, 0xa0, 0x67, 0xcf, 0x9e, 0x3d, 0xcb, - 0xd4, 0x7e, 0x57, 0x80, 0xcd, 0x65, 0x7b, 0x66, 0xe9, 0xf6, 0xbd, 0x04, 0x05, 0x7b, 0x3a, 0x39, - 0xa5, 0x1e, 0x77, 0x52, 0x5e, 0x0d, 0x5b, 0xb8, 0x01, 0x79, 0x8b, 0x9c, 0x52, 0x4b, 0xce, 0x6d, - 0x4b, 0x3b, 0xd5, 0x5b, 0xef, 0x5c, 0x68, 0x57, 0xd6, 0x8f, 0x98, 0x88, 0x2a, 0x24, 0xf1, 0x47, - 0x90, 0x0b, 0x53, 0x34, 0xd3, 0x70, 0xf3, 0x62, 0x1a, 0xd8, 0x5e, 0x52, 0xb9, 0x1c, 0x7e, 0x05, - 0x4a, 0xec, 0x57, 0xc4, 0x46, 0x81, 0xdb, 0x5c, 0x64, 0x00, 0x8b, 0x0b, 0xbc, 0x05, 0x45, 0xbe, - 0x4d, 0x0c, 0x1a, 0x1d, 0x6d, 0x71, 0x9b, 0x05, 0x96, 0x41, 0x87, 0x64, 0x6a, 0x05, 0xda, 0x63, - 0x62, 0x4d, 0x29, 0x0f, 0xf8, 0x92, 0x5a, 0x09, 0xc1, 0x5f, 0x30, 0x0c, 0x5f, 0x85, 0xb2, 0xd8, - 0x55, 0xa6, 0x6d, 0xd0, 0xa7, 0x3c, 0x7b, 0xe6, 0x55, 0xb1, 0xd1, 0xda, 0x0c, 0x61, 0xc3, 0x3f, - 0xf4, 0x1d, 0x3b, 0x0a, 0x4d, 0x3e, 0x04, 0x03, 0xf8, 0xf0, 0x1f, 0xcc, 0x27, 0xee, 0xd7, 0x96, - 0x4f, 0x6f, 0x3e, 0xa6, 0x6a, 0x7f, 0xc9, 0x40, 0x8e, 0xe7, 0x8b, 0x35, 0x28, 0x0f, 0x3e, 0xeb, - 0x29, 0x5a, 0xab, 0x7b, 0xb2, 0x7f, 0xa4, 0x20, 0x09, 0x57, 0x01, 0x38, 0xf0, 0xe0, 0xa8, 0xdb, - 0x18, 0xa0, 0x4c, 0xdc, 0x6e, 0x77, 0x06, 0x77, 0x6f, 0xa3, 0x6c, 0x2c, 0x70, 0x22, 0x80, 0x5c, - 0x92, 0xf0, 0xfe, 0x2d, 0x94, 0xc7, 0x08, 0x2a, 0x42, 0x41, 0xfb, 0x53, 0xa5, 0x75, 0xf7, 0x36, - 0x2a, 0xa4, 0x91, 0xf7, 0x6f, 0xa1, 0x15, 0xbc, 0x0a, 0x25, 0x8e, 0xec, 0x77, 0xbb, 0x47, 0xa8, - 0x18, 0xeb, 0xec, 0x0f, 0xd4, 0x76, 0xe7, 0x00, 0x95, 0x62, 0x9d, 0x07, 0x6a, 0xf7, 0xa4, 0x87, - 0x20, 0xd6, 0x70, 0xac, 0xf4, 0xfb, 0x8d, 0x03, 0x05, 0x95, 0x63, 0xc6, 0xfe, 0x67, 0x03, 0xa5, - 0x8f, 0x2a, 0x29, 0xb3, 0xde, 0xbf, 0x85, 0x56, 0xe3, 0x21, 0x94, 0xce, 0xc9, 0x31, 0xaa, 0xe2, - 0x75, 0x58, 0x15, 0x43, 0x44, 0x46, 0xac, 0xcd, 0x41, 0x77, 0x6f, 0x23, 0x34, 0x33, 0x44, 0x68, - 0x59, 0x4f, 0x01, 0x77, 0x6f, 0x23, 0x5c, 0x6b, 0x42, 0x9e, 0x47, 0x17, 0xc6, 0x50, 0x3d, 0x6a, - 0xec, 0x2b, 0x47, 0x5a, 0xb7, 0x37, 0x68, 0x77, 0x3b, 0x8d, 0x23, 0x24, 0xcd, 0x30, 0x55, 0xf9, - 0xf9, 0x49, 0x5b, 0x55, 0x5a, 0x28, 0x93, 0xc4, 0x7a, 0x4a, 0x63, 0xa0, 0xb4, 0x50, 0xb6, 0xa6, - 0xc3, 0xe6, 0xb2, 0x3c, 0xb9, 0x74, 0x67, 0x24, 0x96, 0x38, 0x73, 0xce, 0x12, 0x73, 0x5d, 0x0b, - 0x4b, 0xfc, 0xcf, 0x0c, 0x6c, 0x2c, 0x39, 0x2b, 0x96, 0x0e, 0xf2, 0x13, 0xc8, 0x8b, 0x10, 0x15, - 0xa7, 0xe7, 0x8d, 0xa5, 0x87, 0x0e, 0x0f, 0xd8, 0x85, 0x13, 0x94, 0xcb, 0x25, 0x2b, 0x88, 0xec, - 0x39, 0x15, 0x04, 0x53, 0xb1, 0x90, 0xd3, 0x7f, 0xb9, 0x90, 0xd3, 0xc5, 0xb1, 0x77, 0xf7, 0x22, - 0xc7, 0x1e, 0xc7, 0xbe, 0x5b, 0x6e, 0xcf, 0x2f, 0xc9, 0xed, 0xf7, 0x61, 0x7d, 0x41, 0xd1, 0x85, - 0x73, 0xec, 0xaf, 0x25, 0x90, 0xcf, 0x73, 0xce, 0x73, 0x32, 0x5d, 0x26, 0x95, 0xe9, 0xee, 0xcf, - 0x7b, 0xf0, 0xda, 0xf9, 0x8b, 0xb0, 0xb0, 0xd6, 0x5f, 0x49, 0x70, 0x69, 0x79, 0xa5, 0xb8, 0xd4, - 0x86, 0x8f, 0xa0, 0x30, 0xa1, 0xc1, 0xd8, 0x89, 0xaa, 0xa5, 0xb7, 0x97, 0x9c, 0xc1, 0xac, 0x7b, - 0x7e, 0xb1, 0x43, 0xa9, 0xe4, 0x21, 0x9e, 0x3d, 0xaf, 0xdc, 0x13, 0xd6, 0x2c, 0x58, 0xfa, 0x9b, - 0x0c, 0xbc, 0xbc, 0x54, 0xf9, 0x52, 0x43, 0x5f, 0x03, 0x30, 0x6d, 0x77, 0x1a, 0x88, 0x8a, 0x48, - 0x24, 0xd8, 0x12, 0x47, 0x78, 0xf2, 0x62, 0xc9, 0x73, 0x1a, 0xc4, 0xfd, 0x59, 0xde, 0x0f, 0x02, - 0xe2, 0x84, 0x7b, 0x33, 0x43, 0x73, 0xdc, 0xd0, 0xd7, 0xcf, 0x99, 0xe9, 0x42, 0x60, 0xbe, 0x07, - 0x48, 0xb7, 0x4c, 0x6a, 0x07, 0x9a, 0x1f, 0x78, 0x94, 0x4c, 0x4c, 0x7b, 0xc4, 0x4f, 0x90, 0xe2, - 0x5e, 0x7e, 0x48, 0x2c, 0x9f, 0xaa, 0x6b, 0xa2, 0xbb, 0x1f, 0xf5, 0x32, 0x09, 0x1e, 0x40, 0x5e, - 0x42, 0xa2, 0x90, 0x92, 0x10, 0xdd, 0xb1, 0x44, 0xed, 0xeb, 0x22, 0x94, 0x13, 0x75, 0x35, 0xbe, - 0x06, 0x95, 0x87, 0xe4, 0x31, 0xd1, 0xa2, 0xbb, 0x92, 0xf0, 0x44, 0x99, 0x61, 0xbd, 0xf0, 0xbe, - 0xf4, 0x1e, 0x6c, 0x72, 0x8a, 0x33, 0x0d, 0xa8, 0xa7, 0xe9, 0x16, 0xf1, 0x7d, 0xee, 0xb4, 0x22, - 0xa7, 0x62, 0xd6, 0xd7, 0x65, 0x5d, 0xcd, 0xa8, 0x07, 0xdf, 0x81, 0x0d, 0x2e, 0x31, 0x99, 0x5a, - 0x81, 0xe9, 0x5a, 0x54, 0x63, 0xb7, 0x37, 0x9f, 0x9f, 0x24, 0xb1, 0x65, 0xeb, 0x8c, 0x71, 0x1c, - 0x12, 0x98, 0x45, 0x3e, 0x6e, 0xc1, 0x6b, 0x5c, 0x6c, 0x44, 0x6d, 0xea, 0x91, 0x80, 0x6a, 0xf4, - 0x8b, 0x29, 0xb1, 0x7c, 0x8d, 0xd8, 0x86, 0x36, 0x26, 0xfe, 0x58, 0xde, 0x64, 0x0a, 0xf6, 0x33, - 0xb2, 0xa4, 0x5e, 0x61, 0xc4, 0x83, 0x90, 0xa7, 0x70, 0x5a, 0xc3, 0x36, 0x3e, 0x26, 0xfe, 0x18, - 0xef, 0xc1, 0x25, 0xae, 0xc5, 0x0f, 0x3c, 0xd3, 0x1e, 0x69, 0xfa, 0x98, 0xea, 0x8f, 0xb4, 0x69, - 0x30, 0xbc, 0x27, 0xbf, 0x92, 0x1c, 0x9f, 0x5b, 0xd8, 0xe7, 0x9c, 0x26, 0xa3, 0x9c, 0x04, 0xc3, - 0x7b, 0xb8, 0x0f, 0x15, 0xb6, 0x18, 0x13, 0xf3, 0x4b, 0xaa, 0x0d, 0x1d, 0x8f, 0x1f, 0x8d, 0xd5, - 0x25, 0xa9, 0x29, 0xe1, 0xc1, 0x7a, 0x37, 0x14, 0x38, 0x76, 0x0c, 0xba, 0x97, 0xef, 0xf7, 0x14, - 0xa5, 0xa5, 0x96, 0x23, 0x2d, 0x0f, 0x1c, 0x8f, 0x05, 0xd4, 0xc8, 0x89, 0x1d, 0x5c, 0x16, 0x01, - 0x35, 0x72, 0x22, 0xf7, 0xde, 0x81, 0x0d, 0x5d, 0x17, 0x73, 0x36, 0x75, 0x2d, 0xbc, 0x63, 0xf9, - 0x32, 0x4a, 0x39, 0x4b, 0xd7, 0x0f, 0x04, 0x21, 0x8c, 0x71, 0x1f, 0x7f, 0x08, 0x2f, 0xcf, 0x9c, - 0x95, 0x14, 0x5c, 0x5f, 0x98, 0xe5, 0xbc, 0xe8, 0x1d, 0xd8, 0x70, 0xcf, 0x16, 0x05, 0x71, 0x6a, - 0x44, 0xf7, 0x6c, 0x5e, 0xec, 0x03, 0xd8, 0x74, 0xc7, 0xee, 0xa2, 0xdc, 0xcd, 0xa4, 0x1c, 0x76, - 0xc7, 0xee, 0xbc, 0xe0, 0x5b, 0xfc, 0xc2, 0xed, 0x51, 0x9d, 0x04, 0xd4, 0x90, 0x2f, 0x27, 0xe9, - 0x89, 0x0e, 0xbc, 0x0b, 0x48, 0xd7, 0x35, 0x6a, 0x93, 0x53, 0x8b, 0x6a, 0xc4, 0xa3, 0x36, 0xf1, - 0xe5, 0xab, 0x49, 0x72, 0x55, 0xd7, 0x15, 0xde, 0xdb, 0xe0, 0x9d, 0xf8, 0x26, 0xac, 0x3b, 0xa7, - 0x0f, 0x75, 0x11, 0x92, 0x9a, 0xeb, 0xd1, 0xa1, 0xf9, 0x54, 0x7e, 0x93, 0xfb, 0x77, 0x8d, 0x75, - 0xf0, 0x80, 0xec, 0x71, 0x18, 0xdf, 0x00, 0xa4, 0xfb, 0x63, 0xe2, 0xb9, 0x3c, 0x27, 0xfb, 0x2e, - 0xd1, 0xa9, 0xfc, 0x96, 0xa0, 0x0a, 0xbc, 0x13, 0xc1, 0x6c, 0x4b, 0xf8, 0x4f, 0xcc, 0x61, 0x10, - 0x69, 0xbc, 0x2e, 0xb6, 0x04, 0xc7, 0x42, 0x6d, 0x3b, 0x80, 0x98, 0x2b, 0x52, 0x03, 0xef, 0x70, - 0x5a, 0xd5, 0x1d, 0xbb, 0xc9, 0x71, 0xdf, 0x80, 0x55, 0xc6, 0x9c, 0x0d, 0x7a, 0x43, 0x14, 0x64, - 0xee, 0x38, 0x31, 0xe2, 0x0f, 0x56, 0x1b, 0xd7, 0xf6, 0xa0, 0x92, 0x8c, 0x4f, 0x5c, 0x02, 0x11, - 0xa1, 0x48, 0x62, 0xc5, 0x4a, 0xb3, 0xdb, 0x62, 0x65, 0xc6, 0xe7, 0x0a, 0xca, 0xb0, 0x72, 0xe7, - 0xa8, 0x3d, 0x50, 0x34, 0xf5, 0xa4, 0x33, 0x68, 0x1f, 0x2b, 0x28, 0x9b, 0xa8, 0xab, 0x0f, 0x73, - 0xc5, 0xb7, 0xd1, 0xf5, 0xda, 0x37, 0x19, 0xa8, 0xa6, 0x2f, 0x4a, 0xf8, 0xff, 0xe1, 0x72, 0xf4, - 0xaa, 0xe1, 0xd3, 0x40, 0x7b, 0x62, 0x7a, 0x7c, 0xe3, 0x4c, 0x88, 0x38, 0xc4, 0xe2, 0xa5, 0xdb, - 0x0c, 0x59, 0x7d, 0x1a, 0x7c, 0x62, 0x7a, 0x6c, 0x5b, 0x4c, 0x48, 0x80, 0x8f, 0xe0, 0xaa, 0xed, - 0x68, 0x7e, 0x40, 0x6c, 0x83, 0x78, 0x86, 0x36, 0x7b, 0x4f, 0xd2, 0x88, 0xae, 0x53, 0xdf, 0x77, - 0xc4, 0x81, 0x15, 0x6b, 0x79, 0xd5, 0x76, 0xfa, 0x21, 0x79, 0x96, 0xc9, 0x1b, 0x21, 0x75, 0x2e, - 0xcc, 0xb2, 0xe7, 0x85, 0xd9, 0x2b, 0x50, 0x9a, 0x10, 0x57, 0xa3, 0x76, 0xe0, 0x9d, 0xf1, 0xf2, - 0xb8, 0xa8, 0x16, 0x27, 0xc4, 0x55, 0x58, 0xfb, 0x85, 0xdc, 0x52, 0x0e, 0x73, 0xc5, 0x22, 0x2a, - 0x1d, 0xe6, 0x8a, 0x25, 0x04, 0xb5, 0x7f, 0x64, 0xa1, 0x92, 0x2c, 0x97, 0xd9, 0xed, 0x43, 0xe7, - 0x27, 0x8b, 0xc4, 0x73, 0xcf, 0x1b, 0xdf, 0x5a, 0x5c, 0xd7, 0x9b, 0xec, 0xc8, 0xd9, 0x2b, 0x88, - 0x22, 0x56, 0x15, 0x92, 0xec, 0xb8, 0x67, 0xd9, 0x86, 0x8a, 0xa2, 0xa1, 0xa8, 0x86, 0x2d, 0x7c, - 0x00, 0x85, 0x87, 0x3e, 0xd7, 0x5d, 0xe0, 0xba, 0xdf, 0xfc, 0x76, 0xdd, 0x87, 0x7d, 0xae, 0xbc, - 0x74, 0xd8, 0xd7, 0x3a, 0x5d, 0xf5, 0xb8, 0x71, 0xa4, 0x86, 0xe2, 0xf8, 0x0a, 0xe4, 0x2c, 0xf2, - 0xe5, 0x59, 0xfa, 0x70, 0xe2, 0xd0, 0x45, 0x17, 0xe1, 0x0a, 0xe4, 0x9e, 0x50, 0xf2, 0x28, 0x7d, - 0x24, 0x70, 0xe8, 0x07, 0xdc, 0x0c, 0xbb, 0x90, 0xe7, 0xfe, 0xc2, 0x00, 0xa1, 0xc7, 0xd0, 0x4b, - 0xb8, 0x08, 0xb9, 0x66, 0x57, 0x65, 0x1b, 0x02, 0x41, 0x45, 0xa0, 0x5a, 0xaf, 0xad, 0x34, 0x15, - 0x94, 0xa9, 0xdd, 0x81, 0x82, 0x70, 0x02, 0xdb, 0x2c, 0xb1, 0x1b, 0xd0, 0x4b, 0x61, 0x33, 0xd4, - 0x21, 0x45, 0xbd, 0x27, 0xc7, 0xfb, 0x8a, 0x8a, 0x32, 0xe9, 0xa5, 0xce, 0xa1, 0x7c, 0xcd, 0x87, - 0x4a, 0xb2, 0x5e, 0x7e, 0x31, 0x77, 0xe1, 0xbf, 0x4a, 0x50, 0x4e, 0xd4, 0xbf, 0xac, 0x70, 0x21, - 0x96, 0xe5, 0x3c, 0xd1, 0x88, 0x65, 0x12, 0x3f, 0x0c, 0x0d, 0xe0, 0x50, 0x83, 0x21, 0x17, 0x5d, - 0xba, 0x17, 0xb4, 0x45, 0xf2, 0xa8, 0x50, 0xfb, 0xa3, 0x04, 0x68, 0xbe, 0x00, 0x9d, 0x33, 0x53, - 0xfa, 0x31, 0xcd, 0xac, 0xfd, 0x41, 0x82, 0x6a, 0xba, 0xea, 0x9c, 0x33, 0xef, 0xda, 0x8f, 0x6a, - 0xde, 0xdf, 0x33, 0xb0, 0x9a, 0xaa, 0x35, 0x2f, 0x6a, 0xdd, 0x17, 0xb0, 0x6e, 0x1a, 0x74, 0xe2, - 0x3a, 0x01, 0xb5, 0xf5, 0x33, 0xcd, 0xa2, 0x8f, 0xa9, 0x25, 0xd7, 0x78, 0xd2, 0xd8, 0xfd, 0xf6, - 0x6a, 0xb6, 0xde, 0x9e, 0xc9, 0x1d, 0x31, 0xb1, 0xbd, 0x8d, 0x76, 0x4b, 0x39, 0xee, 0x75, 0x07, - 0x4a, 0xa7, 0xf9, 0x99, 0x76, 0xd2, 0xf9, 0x59, 0xa7, 0xfb, 0x49, 0x47, 0x45, 0xe6, 0x1c, 0xed, - 0x07, 0xdc, 0xf6, 0x3d, 0x40, 0xf3, 0x46, 0xe1, 0xcb, 0xb0, 0xcc, 0x2c, 0xf4, 0x12, 0xde, 0x80, - 0xb5, 0x4e, 0x57, 0xeb, 0xb7, 0x5b, 0x8a, 0xa6, 0x3c, 0x78, 0xa0, 0x34, 0x07, 0x7d, 0xf1, 0x3e, - 0x11, 0xb3, 0x07, 0xa9, 0x0d, 0x5e, 0xfb, 0x7d, 0x16, 0x36, 0x96, 0x58, 0x82, 0x1b, 0xe1, 0xcd, - 0x42, 0x5c, 0x76, 0xde, 0xbd, 0x88, 0xf5, 0x75, 0x56, 0x10, 0xf4, 0x88, 0x17, 0x84, 0x17, 0x91, - 0x1b, 0xc0, 0xbc, 0x64, 0x07, 0xe6, 0xd0, 0xa4, 0x5e, 0xf8, 0x9c, 0x23, 0xae, 0x1b, 0x6b, 0x33, - 0x5c, 0xbc, 0xe8, 0xfc, 0x1f, 0x60, 0xd7, 0xf1, 0xcd, 0xc0, 0x7c, 0x4c, 0x35, 0xd3, 0x8e, 0xde, - 0x7e, 0xd8, 0xf5, 0x23, 0xa7, 0xa2, 0xa8, 0xa7, 0x6d, 0x07, 0x31, 0xdb, 0xa6, 0x23, 0x32, 0xc7, - 0x66, 0xc9, 0x3c, 0xab, 0xa2, 0xa8, 0x27, 0x66, 0x5f, 0x83, 0x8a, 0xe1, 0x4c, 0x59, 0x4d, 0x26, - 0x78, 0xec, 0xec, 0x90, 0xd4, 0xb2, 0xc0, 0x62, 0x4a, 0x58, 0x6d, 0xcf, 0x1e, 0x9d, 0x2a, 0x6a, - 0x59, 0x60, 0x82, 0x72, 0x1d, 0xd6, 0xc8, 0x68, 0xe4, 0x31, 0xe5, 0x91, 0x22, 0x71, 0x7f, 0xa8, - 0xc6, 0x30, 0x27, 0x6e, 0x1d, 0x42, 0x31, 0xf2, 0x03, 0x3b, 0xaa, 0x99, 0x27, 0x34, 0x57, 0x5c, - 0x8a, 0x33, 0x3b, 0x25, 0xb5, 0x68, 0x47, 0x9d, 0xd7, 0xa0, 0x62, 0xfa, 0xda, 0xec, 0x0d, 0x3d, - 0xb3, 0x9d, 0xd9, 0x29, 0xaa, 0x65, 0xd3, 0x8f, 0xdf, 0x1f, 0x6b, 0x5f, 0x65, 0xa0, 0x9a, 0xfe, - 0x06, 0x80, 0x5b, 0x50, 0xb4, 0x1c, 0x9d, 0xf0, 0xd0, 0x12, 0x1f, 0xa0, 0x76, 0x9e, 0xf3, 0xd9, - 0xa0, 0x7e, 0x14, 0xf2, 0xd5, 0x58, 0x72, 0xeb, 0x6f, 0x12, 0x14, 0x23, 0x18, 0x5f, 0x82, 0x9c, - 0x4b, 0x82, 0x31, 0x57, 0x97, 0xdf, 0xcf, 0x20, 0x49, 0xe5, 0x6d, 0x86, 0xfb, 0x2e, 0xb1, 0x79, - 0x08, 0x84, 0x38, 0x6b, 0xb3, 0x75, 0xb5, 0x28, 0x31, 0xf8, 0xe5, 0xc4, 0x99, 0x4c, 0xa8, 0x1d, - 0xf8, 0xd1, 0xba, 0x86, 0x78, 0x33, 0x84, 0xf1, 0x3b, 0xb0, 0x1e, 0x78, 0xc4, 0xb4, 0x52, 0xdc, - 0x1c, 0xe7, 0xa2, 0xa8, 0x23, 0x26, 0xef, 0xc1, 0x95, 0x48, 0xaf, 0x41, 0x03, 0xa2, 0x8f, 0xa9, - 0x31, 0x13, 0x2a, 0xf0, 0x47, 0x88, 0xcb, 0x21, 0xa1, 0x15, 0xf6, 0x47, 0xb2, 0xb5, 0x6f, 0x24, - 0x58, 0x8f, 0xae, 0x53, 0x46, 0xec, 0xac, 0x63, 0x00, 0x62, 0xdb, 0x4e, 0x90, 0x74, 0xd7, 0x62, - 0x28, 0x2f, 0xc8, 0xd5, 0x1b, 0xb1, 0x90, 0x9a, 0x50, 0xb0, 0x35, 0x01, 0x98, 0xf5, 0x9c, 0xeb, - 0xb6, 0xab, 0x50, 0x0e, 0x3f, 0xf0, 0xf0, 0xaf, 0x84, 0xe2, 0x02, 0x0e, 0x02, 0x62, 0xf7, 0x2e, - 0xbc, 0x09, 0xf9, 0x53, 0x3a, 0x32, 0xed, 0xf0, 0xd9, 0x56, 0x34, 0xa2, 0x67, 0x92, 0x5c, 0xfc, - 0x4c, 0xb2, 0xff, 0x5b, 0x09, 0x36, 0x74, 0x67, 0x32, 0x6f, 0xef, 0x3e, 0x9a, 0x7b, 0x05, 0xf0, - 0x3f, 0x96, 0x3e, 0xff, 0x68, 0x64, 0x06, 0xe3, 0xe9, 0x69, 0x5d, 0x77, 0x26, 0xbb, 0x23, 0xc7, - 0x22, 0xf6, 0x68, 0xf6, 0x99, 0x93, 0xff, 0xd1, 0xdf, 0x1d, 0x51, 0xfb, 0xdd, 0x91, 0x93, 0xf8, - 0xe8, 0x79, 0x7f, 0xf6, 0xf7, 0xbf, 0x92, 0xf4, 0xa7, 0x4c, 0xf6, 0xa0, 0xb7, 0xff, 0xe7, 0xcc, - 0xd6, 0x81, 0x18, 0xae, 0x17, 0xb9, 0x47, 0xa5, 0x43, 0x8b, 0xea, 0x6c, 0xca, 0xff, 0x0b, 0x00, - 0x00, 0xff, 0xff, 0x1a, 0x28, 0x25, 0x79, 0x42, 0x1d, 0x00, 0x00, + // 2589 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xdd, 0x8e, 0xdb, 0xc6, + 0x15, 0x0e, 0xf5, 0xb7, 0xd2, 0x91, 0x56, 0x3b, 0x3b, 0xbb, 0xb1, 0xe9, 0xcd, 0x8f, 0xd7, 0xca, + 0x8f, 0xd7, 0x4e, 0xac, 0x0d, 0x1c, 0xdb, 0x71, 0xd6, 0x45, 0x5a, 0xad, 0x44, 0x6f, 0xe4, 0xee, + 0x4a, 0x2a, 0xa5, 0x6d, 0x7e, 0x80, 0x82, 0x98, 0x25, 0x47, 0x12, 0x6d, 0x8a, 0x64, 0x48, 0xca, + 0xf6, 0x06, 0xbd, 0x30, 0xd0, 0xab, 0x5e, 0x15, 0xe8, 0x55, 0x51, 0x14, 0xbd, 0xe8, 0x4d, 0x80, + 0x3e, 0x40, 0x81, 0xde, 0xf5, 0x09, 0x0a, 0xe4, 0x0d, 0x8a, 0xb6, 0x40, 0xfb, 0x08, 0xbd, 0x2c, + 0x66, 0x86, 0xa4, 0x48, 0x49, 0x1b, 0x6f, 0x02, 0xc4, 0xb9, 0x92, 0xe6, 0x3b, 0xdf, 0x39, 0x73, + 0xe6, 0xcc, 0x99, 0x99, 0x33, 0x43, 0xd8, 0x1e, 0x39, 0xce, 0xc8, 0xa2, 0xbb, 0xae, 0xe7, 0x04, + 0xce, 0xc9, 0x74, 0xb8, 0x6b, 0x50, 0x5f, 0xf7, 0x4c, 0x37, 0x70, 0xbc, 0x3a, 0xc7, 0xf0, 0x9a, + 0x60, 0xd4, 0x23, 0x46, 0xed, 0x08, 0xd6, 0xef, 0x9b, 0x16, 0x6d, 0xc5, 0xc4, 0x3e, 0x0d, 0xf0, + 0x5d, 0xc8, 0x0d, 0x4d, 0x8b, 0xca, 0xd2, 0x76, 0x76, 0xa7, 0x7c, 0xf3, 0xcd, 0xfa, 0x9c, 0x52, + 0x3d, 0xad, 0xd1, 0x63, 0xb0, 0xca, 0x35, 0x6a, 0xff, 0xce, 0xc1, 0xc6, 0x12, 0x29, 0xc6, 0x90, + 0xb3, 0xc9, 0x84, 0x59, 0x94, 0x76, 0x4a, 0x2a, 0xff, 0x8f, 0x65, 0x58, 0x71, 0x89, 0xfe, 0x88, + 0x8c, 0xa8, 0x9c, 0xe1, 0x70, 0xd4, 0xc4, 0xaf, 0x03, 0x18, 0xd4, 0xa5, 0xb6, 0x41, 0x6d, 0xfd, + 0x54, 0xce, 0x6e, 0x67, 0x77, 0x4a, 0x6a, 0x02, 0xc1, 0xef, 0xc0, 0xba, 0x3b, 0x3d, 0xb1, 0x4c, + 0x5d, 0x4b, 0xd0, 0x60, 0x3b, 0xbb, 0x93, 0x57, 0x91, 0x10, 0xb4, 0x66, 0xe4, 0xab, 0xb0, 0xf6, + 0x84, 0x92, 0x47, 0x49, 0x6a, 0x99, 0x53, 0xab, 0x0c, 0x4e, 0x10, 0x9b, 0x50, 0x99, 0x50, 0xdf, + 0x27, 0x23, 0xaa, 0x05, 0xa7, 0x2e, 0x95, 0x73, 0x7c, 0xf4, 0xdb, 0x0b, 0xa3, 0x9f, 0x1f, 0x79, + 0x39, 0xd4, 0x1a, 0x9c, 0xba, 0x14, 0x37, 0xa0, 0x44, 0xed, 0xe9, 0x44, 0x58, 0xc8, 0x9f, 0x11, + 0x3f, 0xc5, 0x9e, 0x4e, 0xe6, 0xad, 0x14, 0x99, 0x5a, 0x68, 0x62, 0xc5, 0xa7, 0xde, 0x63, 0x53, + 0xa7, 0x72, 0x81, 0x1b, 0xb8, 0xba, 0x60, 0xa0, 0x2f, 0xe4, 0xf3, 0x36, 0x22, 0x3d, 0xdc, 0x84, + 0x12, 0x7d, 0x1a, 0x50, 0xdb, 0x37, 0x1d, 0x5b, 0x5e, 0xe1, 0x46, 0xde, 0x5a, 0x32, 0x8b, 0xd4, + 0x32, 0xe6, 0x4d, 0xcc, 0xf4, 0xf0, 0x1d, 0x58, 0x71, 0xdc, 0xc0, 0x74, 0x6c, 0x5f, 0x2e, 0x6e, + 0x4b, 0x3b, 0xe5, 0x9b, 0xaf, 0x2e, 0x4d, 0x84, 0xae, 0xe0, 0xa8, 0x11, 0x19, 0xb7, 0x01, 0xf9, + 0xce, 0xd4, 0xd3, 0xa9, 0xa6, 0x3b, 0x06, 0xd5, 0x4c, 0x7b, 0xe8, 0xc8, 0x25, 0x6e, 0xe0, 0xf2, + 0xe2, 0x40, 0x38, 0xb1, 0xe9, 0x18, 0xb4, 0x6d, 0x0f, 0x1d, 0xb5, 0xea, 0xa7, 0xda, 0xf8, 0x02, + 0x14, 0xfc, 0x53, 0x3b, 0x20, 0x4f, 0xe5, 0x0a, 0xcf, 0x90, 0xb0, 0x55, 0xfb, 0x6b, 0x01, 0xd6, + 0xce, 0x93, 0x62, 0xf7, 0x20, 0x3f, 0x64, 0xa3, 0x94, 0x33, 0xdf, 0x26, 0x06, 0x42, 0x27, 0x1d, + 0xc4, 0xc2, 0x77, 0x0c, 0x62, 0x03, 0xca, 0x36, 0xf5, 0x03, 0x6a, 0x88, 0x8c, 0xc8, 0x9e, 0x33, + 0xa7, 0x40, 0x28, 0x2d, 0xa6, 0x54, 0xee, 0x3b, 0xa5, 0xd4, 0xa7, 0xb0, 0x16, 0xbb, 0xa4, 0x79, + 0xc4, 0x1e, 0x45, 0xb9, 0xb9, 0xfb, 0x3c, 0x4f, 0xea, 0x4a, 0xa4, 0xa7, 0x32, 0x35, 0xb5, 0x4a, + 0x53, 0x6d, 0xdc, 0x02, 0x70, 0x6c, 0xea, 0x0c, 0x35, 0x83, 0xea, 0x96, 0x5c, 0x3c, 0x23, 0x4a, + 0x5d, 0x46, 0x59, 0x88, 0x92, 0x23, 0x50, 0xdd, 0xc2, 0x1f, 0xce, 0x52, 0x6d, 0xe5, 0x8c, 0x4c, + 0x39, 0x12, 0x8b, 0x6c, 0x21, 0xdb, 0x8e, 0xa1, 0xea, 0x51, 0x96, 0xf7, 0xd4, 0x08, 0x47, 0x56, + 0xe2, 0x4e, 0xd4, 0x9f, 0x3b, 0x32, 0x35, 0x54, 0x13, 0x03, 0x5b, 0xf5, 0x92, 0x4d, 0xfc, 0x06, + 0xc4, 0x80, 0xc6, 0xd3, 0x0a, 0xf8, 0x2e, 0x54, 0x89, 0xc0, 0x0e, 0x99, 0xd0, 0xad, 0x2f, 0xa1, + 0x9a, 0x0e, 0x0f, 0xde, 0x84, 0xbc, 0x1f, 0x10, 0x2f, 0xe0, 0x59, 0x98, 0x57, 0x45, 0x03, 0x23, + 0xc8, 0x52, 0xdb, 0xe0, 0xbb, 0x5c, 0x5e, 0x65, 0x7f, 0xf1, 0x4f, 0x66, 0x03, 0xce, 0xf2, 0x01, + 0xbf, 0xbd, 0x38, 0xa3, 0x29, 0xcb, 0xf3, 0xe3, 0xde, 0xfa, 0x00, 0x56, 0x53, 0x03, 0x38, 0x6f, + 0xd7, 0xb5, 0x5f, 0xc2, 0xcb, 0x4b, 0x4d, 0xe3, 0x4f, 0x61, 0x73, 0x6a, 0x9b, 0x76, 0x40, 0x3d, + 0xd7, 0xa3, 0x2c, 0x63, 0x45, 0x57, 0xf2, 0x7f, 0x56, 0xce, 0xc8, 0xb9, 0xe3, 0x24, 0x5b, 0x58, + 0x51, 0x37, 0xa6, 0x8b, 0xe0, 0xf5, 0x52, 0xf1, 0xbf, 0x2b, 0xe8, 0xd9, 0xb3, 0x67, 0xcf, 0x32, + 0xb5, 0xdf, 0x15, 0x60, 0x73, 0xd9, 0x9a, 0x59, 0xba, 0x7c, 0x2f, 0x40, 0xc1, 0x9e, 0x4e, 0x4e, + 0xa8, 0xc7, 0x83, 0x94, 0x57, 0xc3, 0x16, 0x6e, 0x40, 0xde, 0x22, 0x27, 0xd4, 0x92, 0x73, 0xdb, + 0xd2, 0x4e, 0xf5, 0xe6, 0x3b, 0xe7, 0x5a, 0x95, 0xf5, 0x43, 0xa6, 0xa2, 0x0a, 0x4d, 0xfc, 0x11, + 0xe4, 0xc2, 0x2d, 0x9a, 0x59, 0xb8, 0x7e, 0x3e, 0x0b, 0x6c, 0x2d, 0xa9, 0x5c, 0x0f, 0xbf, 0x02, + 0x25, 0xf6, 0x2b, 0x72, 0xa3, 0xc0, 0x7d, 0x2e, 0x32, 0x80, 0xe5, 0x05, 0xde, 0x82, 0x22, 0x5f, + 0x26, 0x06, 0x8d, 0x8e, 0xb6, 0xb8, 0xcd, 0x12, 0xcb, 0xa0, 0x43, 0x32, 0xb5, 0x02, 0xed, 0x31, + 0xb1, 0xa6, 0x94, 0x27, 0x7c, 0x49, 0xad, 0x84, 0xe0, 0xcf, 0x19, 0x86, 0x2f, 0x43, 0x59, 0xac, + 0x2a, 0xd3, 0x36, 0xe8, 0x53, 0xbe, 0x7b, 0xe6, 0x55, 0xb1, 0xd0, 0xda, 0x0c, 0x61, 0xdd, 0x3f, + 0xf4, 0x1d, 0x3b, 0x4a, 0x4d, 0xde, 0x05, 0x03, 0x78, 0xf7, 0x1f, 0xcc, 0x6f, 0xdc, 0xaf, 0x2d, + 0x1f, 0xde, 0x7c, 0x4e, 0xd5, 0xfe, 0x92, 0x81, 0x1c, 0xdf, 0x2f, 0xd6, 0xa0, 0x3c, 0xf8, 0xac, + 0xa7, 0x68, 0xad, 0xee, 0xf1, 0xfe, 0xa1, 0x82, 0x24, 0x5c, 0x05, 0xe0, 0xc0, 0xfd, 0xc3, 0x6e, + 0x63, 0x80, 0x32, 0x71, 0xbb, 0xdd, 0x19, 0xdc, 0xb9, 0x85, 0xb2, 0xb1, 0xc2, 0xb1, 0x00, 0x72, + 0x49, 0xc2, 0xfb, 0x37, 0x51, 0x1e, 0x23, 0xa8, 0x08, 0x03, 0xed, 0x4f, 0x95, 0xd6, 0x9d, 0x5b, + 0xa8, 0x90, 0x46, 0xde, 0xbf, 0x89, 0x56, 0xf0, 0x2a, 0x94, 0x38, 0xb2, 0xdf, 0xed, 0x1e, 0xa2, + 0x62, 0x6c, 0xb3, 0x3f, 0x50, 0xdb, 0x9d, 0x03, 0x54, 0x8a, 0x6d, 0x1e, 0xa8, 0xdd, 0xe3, 0x1e, + 0x82, 0xd8, 0xc2, 0x91, 0xd2, 0xef, 0x37, 0x0e, 0x14, 0x54, 0x8e, 0x19, 0xfb, 0x9f, 0x0d, 0x94, + 0x3e, 0xaa, 0xa4, 0xdc, 0x7a, 0xff, 0x26, 0x5a, 0x8d, 0xbb, 0x50, 0x3a, 0xc7, 0x47, 0xa8, 0x8a, + 0xd7, 0x61, 0x55, 0x74, 0x11, 0x39, 0xb1, 0x36, 0x07, 0xdd, 0xb9, 0x85, 0xd0, 0xcc, 0x11, 0x61, + 0x65, 0x3d, 0x05, 0xdc, 0xb9, 0x85, 0x70, 0xad, 0x09, 0x79, 0x9e, 0x5d, 0x18, 0x43, 0xf5, 0xb0, + 0xb1, 0xaf, 0x1c, 0x6a, 0xdd, 0xde, 0xa0, 0xdd, 0xed, 0x34, 0x0e, 0x91, 0x34, 0xc3, 0x54, 0xe5, + 0x67, 0xc7, 0x6d, 0x55, 0x69, 0xa1, 0x4c, 0x12, 0xeb, 0x29, 0x8d, 0x81, 0xd2, 0x42, 0xd9, 0x9a, + 0x0e, 0x9b, 0xcb, 0xf6, 0xc9, 0xa5, 0x2b, 0x23, 0x31, 0xc5, 0x99, 0x33, 0xa6, 0x98, 0xdb, 0x5a, + 0x98, 0xe2, 0x7f, 0x65, 0x60, 0x63, 0xc9, 0x59, 0xb1, 0xb4, 0x93, 0x1f, 0x43, 0x5e, 0xa4, 0xa8, + 0x38, 0x3d, 0xaf, 0x2d, 0x3d, 0x74, 0x78, 0xc2, 0x2e, 0x9c, 0xa0, 0x5c, 0x2f, 0x59, 0x41, 0x64, + 0xcf, 0xa8, 0x20, 0x98, 0x89, 0x85, 0x3d, 0xfd, 0x17, 0x0b, 0x7b, 0xba, 0x38, 0xf6, 0xee, 0x9c, + 0xe7, 0xd8, 0xe3, 0xd8, 0xb7, 0xdb, 0xdb, 0xf3, 0x4b, 0xf6, 0xf6, 0x7b, 0xb0, 0xbe, 0x60, 0xe8, + 0xdc, 0x7b, 0xec, 0xaf, 0x24, 0x90, 0xcf, 0x0a, 0xce, 0x73, 0x76, 0xba, 0x4c, 0x6a, 0xa7, 0xbb, + 0x37, 0x1f, 0xc1, 0x2b, 0x67, 0x4f, 0xc2, 0xc2, 0x5c, 0x7f, 0x25, 0xc1, 0x85, 0xe5, 0x95, 0xe2, + 0x52, 0x1f, 0x3e, 0x82, 0xc2, 0x84, 0x06, 0x63, 0x27, 0xaa, 0x96, 0xde, 0x5e, 0x72, 0x06, 0x33, + 0xf1, 0xfc, 0x64, 0x87, 0x5a, 0xc9, 0x43, 0x3c, 0x7b, 0x56, 0xb9, 0x27, 0xbc, 0x59, 0xf0, 0xf4, + 0xd7, 0x19, 0x78, 0x79, 0xa9, 0xf1, 0xa5, 0x8e, 0xbe, 0x06, 0x60, 0xda, 0xee, 0x34, 0x10, 0x15, + 0x91, 0xd8, 0x60, 0x4b, 0x1c, 0xe1, 0x9b, 0x17, 0xdb, 0x3c, 0xa7, 0x41, 0x2c, 0xcf, 0x72, 0x39, + 0x08, 0x88, 0x13, 0xee, 0xce, 0x1c, 0xcd, 0x71, 0x47, 0x5f, 0x3f, 0x63, 0xa4, 0x0b, 0x89, 0xf9, + 0x1e, 0x20, 0xdd, 0x32, 0xa9, 0x1d, 0x68, 0x7e, 0xe0, 0x51, 0x32, 0x31, 0xed, 0x11, 0x3f, 0x41, + 0x8a, 0x7b, 0xf9, 0x21, 0xb1, 0x7c, 0xaa, 0xae, 0x09, 0x71, 0x3f, 0x92, 0x32, 0x0d, 0x9e, 0x40, + 0x5e, 0x42, 0xa3, 0x90, 0xd2, 0x10, 0xe2, 0x58, 0xa3, 0xf6, 0xdb, 0x12, 0x94, 0x13, 0x75, 0x35, + 0xbe, 0x02, 0x95, 0x87, 0xe4, 0x31, 0xd1, 0xa2, 0xbb, 0x92, 0x88, 0x44, 0x99, 0x61, 0xbd, 0xf0, + 0xbe, 0xf4, 0x1e, 0x6c, 0x72, 0x8a, 0x33, 0x0d, 0xa8, 0xa7, 0xe9, 0x16, 0xf1, 0x7d, 0x1e, 0xb4, + 0x22, 0xa7, 0x62, 0x26, 0xeb, 0x32, 0x51, 0x33, 0x92, 0xe0, 0xdb, 0xb0, 0xc1, 0x35, 0x26, 0x53, + 0x2b, 0x30, 0x5d, 0x8b, 0x6a, 0xec, 0xf6, 0xe6, 0xf3, 0x93, 0x24, 0xf6, 0x6c, 0x9d, 0x31, 0x8e, + 0x42, 0x02, 0xf3, 0xc8, 0xc7, 0x2d, 0x78, 0x8d, 0xab, 0x8d, 0xa8, 0x4d, 0x3d, 0x12, 0x50, 0x8d, + 0x7e, 0x31, 0x25, 0x96, 0xaf, 0x11, 0xdb, 0xd0, 0xc6, 0xc4, 0x1f, 0xcb, 0x9b, 0xcc, 0xc0, 0x7e, + 0x46, 0x96, 0xd4, 0x4b, 0x8c, 0x78, 0x10, 0xf2, 0x14, 0x4e, 0x6b, 0xd8, 0xc6, 0xc7, 0xc4, 0x1f, + 0xe3, 0x3d, 0xb8, 0xc0, 0xad, 0xf8, 0x81, 0x67, 0xda, 0x23, 0x4d, 0x1f, 0x53, 0xfd, 0x91, 0x36, + 0x0d, 0x86, 0x77, 0xe5, 0x57, 0x92, 0xfd, 0x73, 0x0f, 0xfb, 0x9c, 0xd3, 0x64, 0x94, 0xe3, 0x60, + 0x78, 0x17, 0xf7, 0xa1, 0xc2, 0x26, 0x63, 0x62, 0x7e, 0x49, 0xb5, 0xa1, 0xe3, 0xf1, 0xa3, 0xb1, + 0xba, 0x64, 0x6b, 0x4a, 0x44, 0xb0, 0xde, 0x0d, 0x15, 0x8e, 0x1c, 0x83, 0xee, 0xe5, 0xfb, 0x3d, + 0x45, 0x69, 0xa9, 0xe5, 0xc8, 0xca, 0x7d, 0xc7, 0x63, 0x09, 0x35, 0x72, 0xe2, 0x00, 0x97, 0x45, + 0x42, 0x8d, 0x9c, 0x28, 0xbc, 0xb7, 0x61, 0x43, 0xd7, 0xc5, 0x98, 0x4d, 0x5d, 0x0b, 0xef, 0x58, + 0xbe, 0x8c, 0x52, 0xc1, 0xd2, 0xf5, 0x03, 0x41, 0x08, 0x73, 0xdc, 0xc7, 0x1f, 0xc2, 0xcb, 0xb3, + 0x60, 0x25, 0x15, 0xd7, 0x17, 0x46, 0x39, 0xaf, 0x7a, 0x1b, 0x36, 0xdc, 0xd3, 0x45, 0x45, 0x9c, + 0xea, 0xd1, 0x3d, 0x9d, 0x57, 0xfb, 0x00, 0x36, 0xdd, 0xb1, 0xbb, 0xa8, 0x77, 0x3d, 0xa9, 0x87, + 0xdd, 0xb1, 0x3b, 0xaf, 0xf8, 0x16, 0xbf, 0x70, 0x7b, 0x54, 0x27, 0x01, 0x35, 0xe4, 0x8b, 0x49, + 0x7a, 0x42, 0x80, 0x77, 0x01, 0xe9, 0xba, 0x46, 0x6d, 0x72, 0x62, 0x51, 0x8d, 0x78, 0xd4, 0x26, + 0xbe, 0x7c, 0x39, 0x49, 0xae, 0xea, 0xba, 0xc2, 0xa5, 0x0d, 0x2e, 0xc4, 0xd7, 0x61, 0xdd, 0x39, + 0x79, 0xa8, 0x8b, 0x94, 0xd4, 0x5c, 0x8f, 0x0e, 0xcd, 0xa7, 0xf2, 0x9b, 0x3c, 0xbe, 0x6b, 0x4c, + 0xc0, 0x13, 0xb2, 0xc7, 0x61, 0x7c, 0x0d, 0x90, 0xee, 0x8f, 0x89, 0xe7, 0xf2, 0x3d, 0xd9, 0x77, + 0x89, 0x4e, 0xe5, 0xb7, 0x04, 0x55, 0xe0, 0x9d, 0x08, 0x66, 0x4b, 0xc2, 0x7f, 0x62, 0x0e, 0x83, + 0xc8, 0xe2, 0x55, 0xb1, 0x24, 0x38, 0x16, 0x5a, 0xdb, 0x01, 0xc4, 0x42, 0x91, 0xea, 0x78, 0x87, + 0xd3, 0xaa, 0xee, 0xd8, 0x4d, 0xf6, 0xfb, 0x06, 0xac, 0x32, 0xe6, 0xac, 0xd3, 0x6b, 0xa2, 0x20, + 0x73, 0xc7, 0x89, 0x1e, 0x6f, 0xc1, 0x05, 0x46, 0x9a, 0xd0, 0x80, 0x18, 0x24, 0x20, 0x09, 0xf6, + 0xbb, 0x9c, 0xcd, 0xe2, 0x7e, 0x14, 0x0a, 0x53, 0x7e, 0x7a, 0xd3, 0x93, 0xd3, 0x38, 0xb3, 0x6e, + 0x08, 0x3f, 0x19, 0x16, 0xe5, 0xd6, 0xf7, 0x56, 0x74, 0xd7, 0xf6, 0xa0, 0x92, 0x4c, 0x7c, 0x5c, + 0x02, 0x91, 0xfa, 0x48, 0x62, 0x55, 0x50, 0xb3, 0xdb, 0x62, 0xf5, 0xcb, 0xe7, 0x0a, 0xca, 0xb0, + 0x3a, 0xea, 0xb0, 0x3d, 0x50, 0x34, 0xf5, 0xb8, 0x33, 0x68, 0x1f, 0x29, 0x28, 0x9b, 0x28, 0xd8, + 0x1f, 0xe4, 0x8a, 0x6f, 0xa3, 0xab, 0xb5, 0xaf, 0x33, 0x50, 0x4d, 0xdf, 0xc0, 0xf0, 0x8f, 0xe0, + 0x62, 0xf4, 0x5c, 0xe2, 0xd3, 0x40, 0x7b, 0x62, 0x7a, 0x7c, 0x45, 0x4e, 0x88, 0x38, 0x1d, 0xe3, + 0x9c, 0xd8, 0x0c, 0x59, 0x7d, 0x1a, 0x7c, 0x62, 0x7a, 0x6c, 0xbd, 0x4d, 0x48, 0x80, 0x0f, 0xe1, + 0xb2, 0xed, 0x68, 0x7e, 0x40, 0x6c, 0x83, 0x78, 0x86, 0x36, 0x7b, 0xa8, 0xd2, 0x88, 0xae, 0x53, + 0xdf, 0x77, 0xc4, 0x49, 0x18, 0x5b, 0x79, 0xd5, 0x76, 0xfa, 0x21, 0x79, 0x76, 0x44, 0x34, 0x42, + 0xea, 0x5c, 0xfe, 0x66, 0xcf, 0xca, 0xdf, 0x57, 0xa0, 0x34, 0x21, 0xae, 0x46, 0xed, 0xc0, 0x3b, + 0xe5, 0x75, 0x77, 0x51, 0x2d, 0x4e, 0x88, 0xab, 0xb0, 0xf6, 0x0b, 0xb9, 0xfe, 0x3c, 0xc8, 0x15, + 0x8b, 0xa8, 0xf4, 0x20, 0x57, 0x2c, 0x21, 0xa8, 0xfd, 0x33, 0x0b, 0x95, 0x64, 0x1d, 0xce, 0xae, + 0x35, 0x3a, 0x3f, 0xb2, 0x24, 0xbe, 0xa9, 0xbd, 0xf1, 0x8d, 0x55, 0x7b, 0xbd, 0xc9, 0xce, 0xb2, + 0xbd, 0x82, 0xa8, 0x8e, 0x55, 0xa1, 0xc9, 0xea, 0x08, 0x96, 0x6c, 0x54, 0x54, 0x23, 0x45, 0x35, + 0x6c, 0xe1, 0x03, 0x28, 0x3c, 0xf4, 0xb9, 0xed, 0x02, 0xb7, 0xfd, 0xe6, 0x37, 0xdb, 0x7e, 0xd0, + 0xe7, 0xc6, 0x4b, 0x0f, 0xfa, 0x5a, 0xa7, 0xab, 0x1e, 0x35, 0x0e, 0xd5, 0x50, 0x1d, 0x5f, 0x82, + 0x9c, 0x45, 0xbe, 0x3c, 0x4d, 0x9f, 0x7a, 0x1c, 0x3a, 0xef, 0x24, 0x5c, 0x82, 0xdc, 0x13, 0x4a, + 0x1e, 0xa5, 0xcf, 0x1a, 0x0e, 0x7d, 0x8f, 0x8b, 0x61, 0x17, 0xf2, 0x3c, 0x5e, 0x18, 0x20, 0x8c, + 0x18, 0x7a, 0x09, 0x17, 0x21, 0xd7, 0xec, 0xaa, 0x6c, 0x41, 0x20, 0xa8, 0x08, 0x54, 0xeb, 0xb5, + 0x95, 0xa6, 0x82, 0x32, 0xb5, 0xdb, 0x50, 0x10, 0x41, 0x60, 0x8b, 0x25, 0x0e, 0x03, 0x7a, 0x29, + 0x6c, 0x86, 0x36, 0xa4, 0x48, 0x7a, 0x7c, 0xb4, 0xaf, 0xa8, 0x28, 0x93, 0x9e, 0xea, 0x1c, 0xca, + 0xd7, 0x7c, 0xa8, 0x24, 0x0b, 0xf1, 0x17, 0x73, 0xc9, 0xfe, 0x9b, 0x04, 0xe5, 0x44, 0x61, 0xcd, + 0x2a, 0x22, 0x62, 0x59, 0xce, 0x13, 0x8d, 0x58, 0x26, 0xf1, 0xc3, 0xd4, 0x00, 0x0e, 0x35, 0x18, + 0x72, 0xde, 0xa9, 0x7b, 0x41, 0x4b, 0x24, 0x8f, 0x0a, 0xb5, 0x3f, 0x4a, 0x80, 0xe6, 0x2b, 0xdb, + 0x39, 0x37, 0xa5, 0x1f, 0xd2, 0xcd, 0xda, 0x1f, 0x24, 0xa8, 0xa6, 0xcb, 0xd9, 0x39, 0xf7, 0xae, + 0xfc, 0xa0, 0xee, 0xfd, 0x23, 0x03, 0xab, 0xa9, 0x22, 0xf6, 0xbc, 0xde, 0x7d, 0x01, 0xeb, 0xa6, + 0x41, 0x27, 0xae, 0x13, 0x50, 0x5b, 0x3f, 0xd5, 0x2c, 0xfa, 0x98, 0x5a, 0x72, 0x8d, 0x6f, 0x1a, + 0xbb, 0xdf, 0x5c, 0x26, 0xd7, 0xdb, 0x33, 0xbd, 0x43, 0xa6, 0xb6, 0xb7, 0xd1, 0x6e, 0x29, 0x47, + 0xbd, 0xee, 0x40, 0xe9, 0x34, 0x3f, 0xd3, 0x8e, 0x3b, 0x3f, 0xed, 0x74, 0x3f, 0xe9, 0xa8, 0xc8, + 0x9c, 0xa3, 0x7d, 0x8f, 0xcb, 0xbe, 0x07, 0x68, 0xde, 0x29, 0x7c, 0x11, 0x96, 0xb9, 0x85, 0x5e, + 0xc2, 0x1b, 0xb0, 0xd6, 0xe9, 0x6a, 0xfd, 0x76, 0x4b, 0xd1, 0x94, 0xfb, 0xf7, 0x95, 0xe6, 0xa0, + 0x2f, 0x1e, 0x3e, 0x62, 0xf6, 0x20, 0xb5, 0xc0, 0x6b, 0xbf, 0xcf, 0xc2, 0xc6, 0x12, 0x4f, 0x70, + 0x23, 0xbc, 0xb2, 0x88, 0x5b, 0xd4, 0x8d, 0xf3, 0x78, 0x5f, 0x67, 0x35, 0x43, 0x8f, 0x78, 0x41, + 0x78, 0xc3, 0xb9, 0x06, 0x2c, 0x4a, 0x76, 0x60, 0x0e, 0x4d, 0xea, 0x85, 0xef, 0x44, 0xe2, 0x1e, + 0xb3, 0x36, 0xc3, 0xc5, 0x53, 0xd1, 0xbb, 0x80, 0x5d, 0xc7, 0x37, 0x03, 0xf3, 0x31, 0xd5, 0x4c, + 0x3b, 0x7a, 0x54, 0x62, 0xf7, 0x9a, 0x9c, 0x8a, 0x22, 0x49, 0xdb, 0x0e, 0x62, 0xb6, 0x4d, 0x47, + 0x64, 0x8e, 0xcd, 0x36, 0xf3, 0xac, 0x8a, 0x22, 0x49, 0xcc, 0xbe, 0x02, 0x15, 0xc3, 0x99, 0xb2, + 0x62, 0x4f, 0xf0, 0xd8, 0xd9, 0x21, 0xa9, 0x65, 0x81, 0xc5, 0x94, 0xb0, 0x8c, 0x9f, 0xbd, 0x66, + 0x55, 0xd4, 0xb2, 0xc0, 0x04, 0xe5, 0x2a, 0xac, 0x91, 0xd1, 0xc8, 0x63, 0xc6, 0x23, 0x43, 0xe2, + 0x62, 0x52, 0x8d, 0x61, 0x4e, 0xdc, 0x7a, 0x00, 0xc5, 0x28, 0x0e, 0xec, 0xa8, 0x66, 0x91, 0xd0, + 0x5c, 0x71, 0xdb, 0xce, 0xec, 0x94, 0xd4, 0xa2, 0x1d, 0x09, 0xaf, 0x40, 0xc5, 0xf4, 0xb5, 0xd9, + 0xe3, 0x7c, 0x66, 0x3b, 0xb3, 0x53, 0x54, 0xcb, 0xa6, 0x1f, 0x3f, 0x6c, 0xd6, 0xbe, 0xca, 0x40, + 0x35, 0xfd, 0x71, 0x01, 0xb7, 0xa0, 0x68, 0x39, 0x3a, 0xe1, 0xa9, 0x25, 0xbe, 0x6c, 0xed, 0x3c, + 0xe7, 0x7b, 0x44, 0xfd, 0x30, 0xe4, 0xab, 0xb1, 0xe6, 0xd6, 0xdf, 0x25, 0x28, 0x46, 0x30, 0xbe, + 0x00, 0x39, 0x97, 0x04, 0x63, 0x6e, 0x2e, 0xbf, 0x9f, 0x41, 0x92, 0xca, 0xdb, 0x0c, 0xf7, 0x5d, + 0x62, 0xf3, 0x14, 0x08, 0x71, 0xd6, 0x66, 0xf3, 0x6a, 0x51, 0x62, 0xf0, 0x5b, 0x8f, 0x33, 0x99, + 0x50, 0x3b, 0xf0, 0xa3, 0x79, 0x0d, 0xf1, 0x66, 0x08, 0xe3, 0x77, 0x60, 0x3d, 0xf0, 0x88, 0x69, + 0xa5, 0xb8, 0x39, 0xce, 0x45, 0x91, 0x20, 0x26, 0xef, 0xc1, 0xa5, 0xc8, 0xae, 0x41, 0x03, 0xa2, + 0x8f, 0xa9, 0x31, 0x53, 0x2a, 0xf0, 0xd7, 0x8d, 0x8b, 0x21, 0xa1, 0x15, 0xca, 0x23, 0xdd, 0xda, + 0xd7, 0x12, 0xac, 0x47, 0xf7, 0x34, 0x23, 0x0e, 0xd6, 0x11, 0x00, 0xb1, 0x6d, 0x27, 0x48, 0x86, + 0x6b, 0x31, 0x95, 0x17, 0xf4, 0xea, 0x8d, 0x58, 0x49, 0x4d, 0x18, 0xd8, 0x9a, 0x00, 0xcc, 0x24, + 0x67, 0x86, 0xed, 0x32, 0x94, 0xc3, 0x2f, 0x47, 0xfc, 0xf3, 0xa3, 0xb8, 0xd9, 0x83, 0x80, 0xd8, + 0x85, 0x0e, 0x6f, 0x42, 0xfe, 0x84, 0x8e, 0x4c, 0x3b, 0x7c, 0x0f, 0x16, 0x8d, 0xe8, 0xfd, 0x25, + 0x17, 0xbf, 0xbf, 0xec, 0xff, 0x46, 0x82, 0x0d, 0xdd, 0x99, 0xcc, 0xfb, 0xbb, 0x8f, 0xe6, 0x9e, + 0x17, 0xfc, 0x8f, 0xa5, 0xcf, 0x3f, 0x1a, 0x99, 0xc1, 0x78, 0x7a, 0x52, 0xd7, 0x9d, 0xc9, 0xee, + 0xc8, 0xb1, 0x88, 0x3d, 0x9a, 0x7d, 0x3f, 0xe5, 0x7f, 0xf4, 0x1b, 0x23, 0x6a, 0xdf, 0x18, 0x39, + 0x89, 0xaf, 0xa9, 0xf7, 0x66, 0x7f, 0xff, 0x27, 0x49, 0x7f, 0xca, 0x64, 0x0f, 0x7a, 0xfb, 0x7f, + 0xce, 0x6c, 0x1d, 0x88, 0xee, 0x7a, 0x51, 0x78, 0x54, 0x3a, 0xb4, 0xa8, 0xce, 0x86, 0xfc, 0xff, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xe8, 0xef, 0xc4, 0x9b, 0x1d, 0x00, 0x00, } diff --git a/protoc-gen-go/descriptor/descriptor.proto b/protoc-gen-go/descriptor/descriptor.proto index 8697a50de4..ed08fcbc54 100644 --- a/protoc-gen-go/descriptor/descriptor.proto +++ b/protoc-gen-go/descriptor/descriptor.proto @@ -417,6 +417,17 @@ message FileOptions { // determining the namespace. optional string php_namespace = 41; + + // Use this option to change the namespace of php generated metadata classes. + // Default is empty. When this option is empty, the proto file name will be used + // for determining the namespace. + optional string php_metadata_namespace = 44; + + // Use this option to change the package of ruby generated classes. Default + // is empty. When this option is not set, the package name will be used for + // determining the ruby package. + optional string ruby_package = 45; + // The parser stores options it doesn't recognize here. // See the documentation for the "Options" section above. repeated UninterpretedOption uninterpreted_option = 999; diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index 6e760e3a00..9a11e7d5a4 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -101,17 +101,18 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // } // type Any struct { - // A URL/resource name whose content describes the type of the - // serialized protocol buffer message. + // A URL/resource name that uniquely identifies the type of the serialized + // protocol buffer message. The last segment of the URL's path must represent + // the fully qualified name of the type (as in + // `path/google.protobuf.Duration`). The name should be in a canonical form + // (e.g., leading "." is not accepted). // - // For URLs which use the scheme `http`, `https`, or no scheme, the - // following restrictions and interpretations apply: + // In practice, teams usually precompile into the binary all types that they + // expect it to use in the context of Any. However, for URLs which use the + // scheme `http`, `https`, or no scheme, one can optionally set up a type + // server that maps type URLs to message definitions as follows: // // * If no scheme is provided, `https` is assumed. - // * The last segment of the URL's path must represent the fully - // qualified name of the type (as in `path/google.protobuf.Duration`). - // The name should be in a canonical form (e.g., leading "." is - // not accepted). // * An HTTP GET on the URL must yield a [google.protobuf.Type][] // value in binary format, or produce an error. // * Applications are allowed to cache lookup results based on the @@ -120,6 +121,10 @@ type Any struct { // on changes to types. (Use versioned type names to manage // breaking changes.) // + // Note: this functionality is not currently available in the official + // protobuf release, and it is not used for type URLs beginning with + // type.googleapis.com. + // // Schemes other than `http`, `https` (or the empty scheme) might be // used with implementation specific semantics. // diff --git a/ptypes/any/any.proto b/ptypes/any/any.proto index c748667623..4932942558 100644 --- a/ptypes/any/any.proto +++ b/ptypes/any/any.proto @@ -120,17 +120,18 @@ option objc_class_prefix = "GPB"; // } // message Any { - // A URL/resource name whose content describes the type of the - // serialized protocol buffer message. + // A URL/resource name that uniquely identifies the type of the serialized + // protocol buffer message. The last segment of the URL's path must represent + // the fully qualified name of the type (as in + // `path/google.protobuf.Duration`). The name should be in a canonical form + // (e.g., leading "." is not accepted). // - // For URLs which use the scheme `http`, `https`, or no scheme, the - // following restrictions and interpretations apply: + // In practice, teams usually precompile into the binary all types that they + // expect it to use in the context of Any. However, for URLs which use the + // scheme `http`, `https`, or no scheme, one can optionally set up a type + // server that maps type URLs to message definitions as follows: // // * If no scheme is provided, `https` is assumed. - // * The last segment of the URL's path must represent the fully - // qualified name of the type (as in `path/google.protobuf.Duration`). - // The name should be in a canonical form (e.g., leading "." is - // not accepted). // * An HTTP GET on the URL must yield a [google.protobuf.Type][] // value in binary format, or produce an error. // * Applications are allowed to cache lookup results based on the @@ -139,6 +140,10 @@ message Any { // on changes to types. (Use versioned type names to manage // breaking changes.) // + // Note: this functionality is not currently available in the official + // protobuf release, and it is not used for type URLs beginning with + // type.googleapis.com. + // // Schemes other than `http`, `https` (or the empty scheme) might be // used with implementation specific semantics. // diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index fe4fc28b89..b001e4a49e 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -83,7 +83,9 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -// is required, though only UTC (as indicated by "Z") is presently supported. +// is required. A proto3 JSON serializer should always use UTC (as indicated by +// "Z") when printing the Timestamp type and a proto3 JSON parser should be +// able to accept both UTC and other timezones (as indicated by an offset). // // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past // 01:30 UTC on January 15, 2017. @@ -94,8 +96,8 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) // with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one // can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--) -// to obtain a formatter capable of generating timestamps in this format. +// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime-- +// ) to obtain a formatter capable of generating timestamps in this format. // // type Timestamp struct { diff --git a/ptypes/timestamp/timestamp.proto b/ptypes/timestamp/timestamp.proto index 06750ab1f1..eafb3fa03a 100644 --- a/ptypes/timestamp/timestamp.proto +++ b/ptypes/timestamp/timestamp.proto @@ -103,7 +103,9 @@ option objc_class_prefix = "GPB"; // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -// is required, though only UTC (as indicated by "Z") is presently supported. +// is required. A proto3 JSON serializer should always use UTC (as indicated by +// "Z") when printing the Timestamp type and a proto3 JSON parser should be +// able to accept both UTC and other timezones (as indicated by an offset). // // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past // 01:30 UTC on January 15, 2017. @@ -114,8 +116,8 @@ option objc_class_prefix = "GPB"; // to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) // with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one // can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--) -// to obtain a formatter capable of generating timestamps in this format. +// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime-- +// ) to obtain a formatter capable of generating timestamps in this format. // // message Timestamp { From b929213ad233e2e44b7e54790995e0c0488f2566 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 11:39:49 -0800 Subject: [PATCH 024/133] protoc-gen-go: generate XXX_OneofWrappers instead of XXX_OneofFuncs (#760) The marshaler, unmarshaler, and sizer functions are unused ever since the underlying implementation was switched to be table-driven. Change the function to only return the wrapper structs. This change: * enables generated protos to drop dependencies on certain proto types * reduces the size of generated protos * simplifies the implementation of oneofs in protoc-gen-go Updates #708 Change-Id: I5d45dacc72549864a0fe5b2bf27de9a31ea91607 Cherry-Pick: github.com/golang/protobuf@8d0c54c1246661d9a51ca0ba455d22116d485eaa Original-Author: Joe Tsai Reviewed-on: https://go-review.googlesource.com/c/151399 Reviewed-by: Damien Neil --- .../conformance_proto/conformance.pb.go | 298 +---------- go.mod | 2 +- go.sum | 12 +- .../jsonpb_test_proto/more_test_objects.pb.go | 2 +- jsonpb/jsonpb_test_proto/test_objects.pb.go | 111 +---- proto/lib.go | 20 +- proto/properties.go | 22 +- proto/proto3_proto/proto3.pb.go | 52 +- proto/table_marshal.go | 9 +- proto/table_unmarshal.go | 68 +-- proto/test_proto/test.pb.go | 471 +----------------- protoc-gen-go/descriptor/descriptor.pb.go | 2 +- protoc-gen-go/generator/generator.go | 271 +--------- .../testdata/deprecated/deprecated.pb.go | 53 +- .../extension_base/extension_base.pb.go | 2 +- .../extension_extra/extension_extra.pb.go | 2 +- .../extension_user/extension_user.pb.go | 2 +- protoc-gen-go/testdata/grpc/grpc.pb.go | 2 +- protoc-gen-go/testdata/import_public/a.pb.go | 6 +- protoc-gen-go/testdata/import_public/b.pb.go | 2 +- .../import_public/importing/importing.pb.go | 2 +- .../testdata/import_public/sub/a.pb.go | 126 +---- .../testdata/import_public/sub/b.pb.go | 2 +- protoc-gen-go/testdata/imports/fmt/m.pb.go | 2 +- .../testdata/imports/test_a_1/m1.pb.go | 2 +- .../testdata/imports/test_a_1/m2.pb.go | 2 +- .../testdata/imports/test_a_2/m3.pb.go | 2 +- .../testdata/imports/test_a_2/m4.pb.go | 2 +- .../testdata/imports/test_b_1/m1.pb.go | 2 +- .../testdata/imports/test_b_1/m2.pb.go | 2 +- .../testdata/imports/test_import_a1m1.pb.go | 2 +- .../testdata/imports/test_import_a1m2.pb.go | 2 +- .../testdata/imports/test_import_all.pb.go | 2 +- protoc-gen-go/testdata/multi/multi1.pb.go | 2 +- protoc-gen-go/testdata/multi/multi2.pb.go | 2 +- protoc-gen-go/testdata/multi/multi3.pb.go | 2 +- protoc-gen-go/testdata/my_test/test.pb.go | 184 +------ protoc-gen-go/testdata/proto3/proto3.pb.go | 2 +- ptypes/any/any.pb.go | 2 +- ptypes/duration/duration.pb.go | 2 +- ptypes/empty/empty.pb.go | 2 +- ptypes/struct/struct.pb.go | 137 +---- ptypes/timestamp/timestamp.pb.go | 2 +- ptypes/wrappers/wrappers.pb.go | 2 +- 44 files changed, 184 insertions(+), 1714 deletions(-) diff --git a/conformance/internal/conformance_proto/conformance.pb.go b/conformance/internal/conformance_proto/conformance.pb.go index 6b4a361841..e0136d31ef 100644 --- a/conformance/internal/conformance_proto/conformance.pb.go +++ b/conformance/internal/conformance_proto/conformance.pb.go @@ -24,7 +24,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type WireFormat int32 @@ -202,80 +202,39 @@ func (m *ConformanceRequest) GetRequestedOutputFormat() WireFormat { return WireFormat_UNSPECIFIED } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ConformanceRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ConformanceRequest_OneofMarshaler, _ConformanceRequest_OneofUnmarshaler, _ConformanceRequest_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ConformanceRequest) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*ConformanceRequest_ProtobufPayload)(nil), (*ConformanceRequest_JsonPayload)(nil), } } -func _ConformanceRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ConformanceRequest) - // payload - switch x := m.Payload.(type) { - case *ConformanceRequest_ProtobufPayload: - b.EncodeVarint(1<<3 | proto.WireBytes) - b.EncodeRawBytes(x.ProtobufPayload) - case *ConformanceRequest_JsonPayload: - b.EncodeVarint(2<<3 | proto.WireBytes) - b.EncodeStringBytes(x.JsonPayload) - case nil: - default: - return fmt.Errorf("ConformanceRequest.Payload has unexpected type %T", x) - } - return nil -} - -func _ConformanceRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ConformanceRequest) - switch tag { - case 1: // payload.protobuf_payload - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Payload = &ConformanceRequest_ProtobufPayload{x} - return true, err - case 2: // payload.json_payload - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Payload = &ConformanceRequest_JsonPayload{x} - return true, err - default: - return false, nil - } -} - -func _ConformanceRequest_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ConformanceRequest) - // payload - switch x := m.Payload.(type) { - case *ConformanceRequest_ProtobufPayload: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.ProtobufPayload))) - n += len(x.ProtobufPayload) - case *ConformanceRequest_JsonPayload: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.JsonPayload))) - n += len(x.JsonPayload) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - // Represents a single test case's output. type ConformanceResponse struct { // Types that are valid to be assigned to Result: + // This string should be set to indicate parsing failed. The string can + // provide more information about the parse error if it is available. + // + // Setting this string does not necessarily mean the testee failed the + // test. Some of the test cases are intentionally invalid input. // *ConformanceResponse_ParseError + // If the input was successfully parsed but errors occurred when + // serializing it to the requested output format, set the error message in + // this field. // *ConformanceResponse_SerializeError + // This should be set if some other error occurred. This will always + // indicate that the test failed. The string can provide more information + // about the failure. // *ConformanceResponse_RuntimeError + // If the input was successfully parsed and the requested output was + // protobuf, serialize it to protobuf and set it in this field. // *ConformanceResponse_ProtobufPayload + // If the input was successfully parsed and the requested output was JSON, + // serialize to JSON and set it in this field. // *ConformanceResponse_JsonPayload + // For when the testee skipped the test, likely because a certain feature + // wasn't supported, like JSON input/output. // *ConformanceResponse_Skipped Result isConformanceResponse_Result `protobuf_oneof:"result"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -397,9 +356,9 @@ func (m *ConformanceResponse) GetSkipped() string { return "" } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ConformanceResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ConformanceResponse_OneofMarshaler, _ConformanceResponse_OneofUnmarshaler, _ConformanceResponse_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ConformanceResponse) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*ConformanceResponse_ParseError)(nil), (*ConformanceResponse_SerializeError)(nil), (*ConformanceResponse_RuntimeError)(nil), @@ -409,120 +368,6 @@ func (*ConformanceResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.B } } -func _ConformanceResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ConformanceResponse) - // result - switch x := m.Result.(type) { - case *ConformanceResponse_ParseError: - b.EncodeVarint(1<<3 | proto.WireBytes) - b.EncodeStringBytes(x.ParseError) - case *ConformanceResponse_SerializeError: - b.EncodeVarint(6<<3 | proto.WireBytes) - b.EncodeStringBytes(x.SerializeError) - case *ConformanceResponse_RuntimeError: - b.EncodeVarint(2<<3 | proto.WireBytes) - b.EncodeStringBytes(x.RuntimeError) - case *ConformanceResponse_ProtobufPayload: - b.EncodeVarint(3<<3 | proto.WireBytes) - b.EncodeRawBytes(x.ProtobufPayload) - case *ConformanceResponse_JsonPayload: - b.EncodeVarint(4<<3 | proto.WireBytes) - b.EncodeStringBytes(x.JsonPayload) - case *ConformanceResponse_Skipped: - b.EncodeVarint(5<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Skipped) - case nil: - default: - return fmt.Errorf("ConformanceResponse.Result has unexpected type %T", x) - } - return nil -} - -func _ConformanceResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ConformanceResponse) - switch tag { - case 1: // result.parse_error - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Result = &ConformanceResponse_ParseError{x} - return true, err - case 6: // result.serialize_error - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Result = &ConformanceResponse_SerializeError{x} - return true, err - case 2: // result.runtime_error - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Result = &ConformanceResponse_RuntimeError{x} - return true, err - case 3: // result.protobuf_payload - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Result = &ConformanceResponse_ProtobufPayload{x} - return true, err - case 4: // result.json_payload - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Result = &ConformanceResponse_JsonPayload{x} - return true, err - case 5: // result.skipped - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Result = &ConformanceResponse_Skipped{x} - return true, err - default: - return false, nil - } -} - -func _ConformanceResponse_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ConformanceResponse) - // result - switch x := m.Result.(type) { - case *ConformanceResponse_ParseError: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.ParseError))) - n += len(x.ParseError) - case *ConformanceResponse_SerializeError: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.SerializeError))) - n += len(x.SerializeError) - case *ConformanceResponse_RuntimeError: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.RuntimeError))) - n += len(x.RuntimeError) - case *ConformanceResponse_ProtobufPayload: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.ProtobufPayload))) - n += len(x.ProtobufPayload) - case *ConformanceResponse_JsonPayload: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.JsonPayload))) - n += len(x.JsonPayload) - case *ConformanceResponse_Skipped: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Skipped))) - n += len(x.Skipped) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - // This proto includes every type of field in both singular and repeated // forms. type TestAllTypes struct { @@ -1462,9 +1307,9 @@ func (m *TestAllTypes) GetFIELDName12() int32 { return 0 } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*TestAllTypes) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _TestAllTypes_OneofMarshaler, _TestAllTypes_OneofUnmarshaler, _TestAllTypes_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*TestAllTypes) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*TestAllTypes_OneofUint32)(nil), (*TestAllTypes_OneofNestedMessage)(nil), (*TestAllTypes_OneofString)(nil), @@ -1472,95 +1317,6 @@ func (*TestAllTypes) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) } } -func _TestAllTypes_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*TestAllTypes) - // oneof_field - switch x := m.OneofField.(type) { - case *TestAllTypes_OneofUint32: - b.EncodeVarint(111<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.OneofUint32)) - case *TestAllTypes_OneofNestedMessage: - b.EncodeVarint(112<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.OneofNestedMessage); err != nil { - return err - } - case *TestAllTypes_OneofString: - b.EncodeVarint(113<<3 | proto.WireBytes) - b.EncodeStringBytes(x.OneofString) - case *TestAllTypes_OneofBytes: - b.EncodeVarint(114<<3 | proto.WireBytes) - b.EncodeRawBytes(x.OneofBytes) - case nil: - default: - return fmt.Errorf("TestAllTypes.OneofField has unexpected type %T", x) - } - return nil -} - -func _TestAllTypes_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*TestAllTypes) - switch tag { - case 111: // oneof_field.oneof_uint32 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.OneofField = &TestAllTypes_OneofUint32{uint32(x)} - return true, err - case 112: // oneof_field.oneof_nested_message - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(TestAllTypes_NestedMessage) - err := b.DecodeMessage(msg) - m.OneofField = &TestAllTypes_OneofNestedMessage{msg} - return true, err - case 113: // oneof_field.oneof_string - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.OneofField = &TestAllTypes_OneofString{x} - return true, err - case 114: // oneof_field.oneof_bytes - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.OneofField = &TestAllTypes_OneofBytes{x} - return true, err - default: - return false, nil - } -} - -func _TestAllTypes_OneofSizer(msg proto.Message) (n int) { - m := msg.(*TestAllTypes) - // oneof_field - switch x := m.OneofField.(type) { - case *TestAllTypes_OneofUint32: - n += 2 // tag and wire - n += proto.SizeVarint(uint64(x.OneofUint32)) - case *TestAllTypes_OneofNestedMessage: - s := proto.Size(x.OneofNestedMessage) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *TestAllTypes_OneofString: - n += 2 // tag and wire - n += proto.SizeVarint(uint64(len(x.OneofString))) - n += len(x.OneofString) - case *TestAllTypes_OneofBytes: - n += 2 // tag and wire - n += proto.SizeVarint(uint64(len(x.OneofBytes))) - n += len(x.OneofBytes) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type TestAllTypes_NestedMessage struct { A int32 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"` Corecursive *TestAllTypes `protobuf:"bytes,2,opt,name=corecursive,proto3" json:"corecursive,omitempty"` diff --git a/go.mod b/go.mod index 465a928a85..28fda76c4e 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/golang/protobuf require ( - github.com/golang/protobuf/v2 v2.0.0-20180928215628-ccf3fa6cad50 + github.com/golang/protobuf/v2 v2.0.0-20181127193627-d7e97bc71bcb golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 // indirect golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f golang.org/x/tools v0.0.0-20180928181343-b3c0be4c978b // indirect diff --git a/go.sum b/go.sum index 00d3daddf6..e191a9eea1 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,9 @@ -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf/v2 v2.0.0-20180928215628-ccf3fa6cad50 h1:gM4MP5Fi9r5FbsQY7aYxj/GBqNZUZiKjgYdAoQu129M= -github.com/golang/protobuf/v2 v2.0.0-20180928215628-ccf3fa6cad50/go.mod h1:pUFc/zvPj/qlI5nj8gEgsCPCTpICLT32W2c/kQ1v5HU= -github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -golang.org/x/net v0.0.0-20180821023952-922f4815f713/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +github.com/golang/protobuf v1.2.1-0.20181127190454-8d0c54c12466/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf/v2 v2.0.0-20181127193627-d7e97bc71bcb h1:xAZBrlIILcZ8PEjDVZFkOVURYqYAF9y3+wnJXB/t7I8= +github.com/golang/protobuf/v2 v2.0.0-20181127193627-d7e97bc71bcb/go.mod h1:MgUD+N3FwzDmj2CdMsT5ap7K7jx+c9cQDQ7fVhmH+Xw= +github.com/google/go-cmp v0.2.1-0.20181101181452-745b8ec83783 h1:wVZ6laEGf86tNDTpR5mxFyFIclJJiXCxuJhcQKnsOHk= +github.com/google/go-cmp v0.2.1-0.20181101181452-745b8ec83783/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 h1:dgd4x4kJt7G4k4m93AYLzM8Ni6h2qLTfh9n9vXJT3/0= golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= diff --git a/jsonpb/jsonpb_test_proto/more_test_objects.pb.go b/jsonpb/jsonpb_test_proto/more_test_objects.pb.go index 9309bf353b..ef8bc343ff 100644 --- a/jsonpb/jsonpb_test_proto/more_test_objects.pb.go +++ b/jsonpb/jsonpb_test_proto/more_test_objects.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Numeral int32 diff --git a/jsonpb/jsonpb_test_proto/test_objects.pb.go b/jsonpb/jsonpb_test_proto/test_objects.pb.go index d9f918fcaf..9f4a97e205 100644 --- a/jsonpb/jsonpb_test_proto/test_objects.pb.go +++ b/jsonpb/jsonpb_test_proto/test_objects.pb.go @@ -23,7 +23,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Widget_Color int32 @@ -693,9 +693,9 @@ func (m *MsgWithOneof) GetMsgWithRequired() *MsgWithRequired { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*MsgWithOneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _MsgWithOneof_OneofMarshaler, _MsgWithOneof_OneofUnmarshaler, _MsgWithOneof_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*MsgWithOneof) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*MsgWithOneof_Title)(nil), (*MsgWithOneof_Salary)(nil), (*MsgWithOneof_Country)(nil), @@ -704,109 +704,6 @@ func (*MsgWithOneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) } } -func _MsgWithOneof_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*MsgWithOneof) - // union - switch x := m.Union.(type) { - case *MsgWithOneof_Title: - b.EncodeVarint(1<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Title) - case *MsgWithOneof_Salary: - b.EncodeVarint(2<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Salary)) - case *MsgWithOneof_Country: - b.EncodeVarint(3<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Country) - case *MsgWithOneof_HomeAddress: - b.EncodeVarint(4<<3 | proto.WireBytes) - b.EncodeStringBytes(x.HomeAddress) - case *MsgWithOneof_MsgWithRequired: - b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.MsgWithRequired); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("MsgWithOneof.Union has unexpected type %T", x) - } - return nil -} - -func _MsgWithOneof_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*MsgWithOneof) - switch tag { - case 1: // union.title - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Union = &MsgWithOneof_Title{x} - return true, err - case 2: // union.salary - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &MsgWithOneof_Salary{int64(x)} - return true, err - case 3: // union.Country - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Union = &MsgWithOneof_Country{x} - return true, err - case 4: // union.home_address - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Union = &MsgWithOneof_HomeAddress{x} - return true, err - case 5: // union.msg_with_required - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(MsgWithRequired) - err := b.DecodeMessage(msg) - m.Union = &MsgWithOneof_MsgWithRequired{msg} - return true, err - default: - return false, nil - } -} - -func _MsgWithOneof_OneofSizer(msg proto.Message) (n int) { - m := msg.(*MsgWithOneof) - // union - switch x := m.Union.(type) { - case *MsgWithOneof_Title: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Title))) - n += len(x.Title) - case *MsgWithOneof_Salary: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Salary)) - case *MsgWithOneof_Country: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Country))) - n += len(x.Country) - case *MsgWithOneof_HomeAddress: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.HomeAddress))) - n += len(x.HomeAddress) - case *MsgWithOneof_MsgWithRequired: - s := proto.Size(x.MsgWithRequired) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type Real struct { Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` diff --git a/proto/lib.go b/proto/lib.go index e66cbf76cf..b5d80684c4 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -944,13 +944,19 @@ func isProto3Zero(v reflect.Value) bool { return false } -// ProtoPackageIsVersion2 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the proto package. -const ProtoPackageIsVersion2 = true - -// ProtoPackageIsVersion1 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the proto package. -const ProtoPackageIsVersion1 = true +const ( + // ProtoPackageIsVersion3 is referenced from generated protocol buffer files + // to assert that that code is compatible with this version of the proto package. + ProtoPackageIsVersion3 = true + + // ProtoPackageIsVersion2 is referenced from generated protocol buffer files + // to assert that that code is compatible with this version of the proto package. + ProtoPackageIsVersion2 = true + + // ProtoPackageIsVersion1 is referenced from generated protocol buffer files + // to assert that that code is compatible with this version of the proto package. + ProtoPackageIsVersion1 = true +) // InternalMessageInfo is a type used internally by generated .pb.go files. // This type is not intended to be used by non-generated code. diff --git a/proto/properties.go b/proto/properties.go index dce098e6e1..79668ff5c5 100644 --- a/proto/properties.go +++ b/proto/properties.go @@ -343,6 +343,15 @@ func GetProperties(t reflect.Type) *StructProperties { return sprop } +type ( + oneofFuncsIface interface { + XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) + } + oneofWrappersIface interface { + XXX_OneofWrappers() []interface{} + } +) + // getPropertiesLocked requires that propertiesMu is held. func getPropertiesLocked(t reflect.Type) *StructProperties { if prop, ok := propertiesMap[t]; ok { @@ -382,13 +391,14 @@ func getPropertiesLocked(t reflect.Type) *StructProperties { // Re-order prop.order. sort.Sort(prop) - type oneofMessage interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) + var oots []interface{} + switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { + case oneofFuncsIface: + _, _, _, oots = m.XXX_OneofFuncs() + case oneofWrappersIface: + oots = m.XXX_OneofWrappers() } - if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok { - var oots []interface{} - _, _, _, oots = om.XXX_OneofFuncs() - + if len(oots) > 0 { // Interpret oneof metadata. prop.OneofTypes = make(map[string]*OneofProperties) for _, oot := range oots { diff --git a/proto/proto3_proto/proto3.pb.go b/proto/proto3_proto/proto3.pb.go index c3a9b09342..9a754c8acd 100644 --- a/proto/proto3_proto/proto3.pb.go +++ b/proto/proto3_proto/proto3.pb.go @@ -20,7 +20,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Message_Humour int32 @@ -490,57 +490,13 @@ func (m *TestUTF8) GetMapValue() map[int64]string { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*TestUTF8) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _TestUTF8_OneofMarshaler, _TestUTF8_OneofUnmarshaler, _TestUTF8_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*TestUTF8) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*TestUTF8_Field)(nil), } } -func _TestUTF8_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*TestUTF8) - // oneof - switch x := m.Oneof.(type) { - case *TestUTF8_Field: - b.EncodeVarint(3<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Field) - case nil: - default: - return fmt.Errorf("TestUTF8.Oneof has unexpected type %T", x) - } - return nil -} - -func _TestUTF8_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*TestUTF8) - switch tag { - case 3: // oneof.field - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Oneof = &TestUTF8_Field{x} - return true, err - default: - return false, nil - } -} - -func _TestUTF8_OneofSizer(msg proto.Message) (n int) { - m := msg.(*TestUTF8) - // oneof - switch x := m.Oneof.(type) { - case *TestUTF8_Field: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Field))) - n += len(x.Field) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - func init() { proto.RegisterEnum("proto3_proto.Message_Humour", Message_Humour_name, Message_Humour_value) proto.RegisterType((*Message)(nil), "proto3_proto.Message") diff --git a/proto/table_marshal.go b/proto/table_marshal.go index ad747bfa1d..5cb11fa955 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -321,8 +321,11 @@ func (u *marshalInfo) computeMarshalInfo() { // get oneof implementers var oneofImplementers []interface{} - if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok { + switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { + case oneofFuncsIface: _, _, _, oneofImplementers = m.XXX_OneofFuncs() + case oneofWrappersIface: + oneofImplementers = m.XXX_OneofWrappers() } n := t.NumField() @@ -486,10 +489,6 @@ func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofI } } -type oneofMessage interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) -} - // wiretype returns the wire encoding of the type. func wiretype(encoding string) uint64 { switch encoding { diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index 5da26ed523..acee2fc529 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -362,46 +362,48 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { } // Find any types associated with oneof fields. - // TODO: XXX_OneofFuncs returns more info than we need. Get rid of some of it? - fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("XXX_OneofFuncs") - if fn.IsValid() { - res := fn.Call(nil)[3] // last return value from XXX_OneofFuncs: []interface{} - for i := res.Len() - 1; i >= 0; i-- { - v := res.Index(i) // interface{} - tptr := reflect.ValueOf(v.Interface()).Type() // *Msg_X - typ := tptr.Elem() // Msg_X - - f := typ.Field(0) // oneof implementers have one field - baseUnmarshal := fieldUnmarshaler(&f) - tags := strings.Split(f.Tag.Get("protobuf"), ",") - fieldNum, err := strconv.Atoi(tags[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tags[1]) - } - var name string - for _, tag := range tags { - if strings.HasPrefix(tag, "name=") { - name = strings.TrimPrefix(tag, "name=") - break - } + var oneofImplementers []interface{} + switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { + case oneofFuncsIface: + _, _, _, oneofImplementers = m.XXX_OneofFuncs() + case oneofWrappersIface: + oneofImplementers = m.XXX_OneofWrappers() + } + for _, v := range oneofImplementers { + tptr := reflect.TypeOf(v) // *Msg_X + typ := tptr.Elem() // Msg_X + + f := typ.Field(0) // oneof implementers have one field + baseUnmarshal := fieldUnmarshaler(&f) + tags := strings.Split(f.Tag.Get("protobuf"), ",") + fieldNum, err := strconv.Atoi(tags[1]) + if err != nil { + panic("protobuf tag field not an integer: " + tags[1]) + } + var name string + for _, tag := range tags { + if strings.HasPrefix(tag, "name=") { + name = strings.TrimPrefix(tag, "name=") + break } + } - // Find the oneof field that this struct implements. - // Might take O(n^2) to process all of the oneofs, but who cares. - for _, of := range oneofFields { - if tptr.Implements(of.ityp) { - // We have found the corresponding interface for this struct. - // That lets us know where this struct should be stored - // when we encounter it during unmarshaling. - unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) - u.setTag(fieldNum, of.field, unmarshal, 0, name) - } + // Find the oneof field that this struct implements. + // Might take O(n^2) to process all of the oneofs, but who cares. + for _, of := range oneofFields { + if tptr.Implements(of.ityp) { + // We have found the corresponding interface for this struct. + // That lets us know where this struct should be stored + // when we encounter it during unmarshaling. + unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) + u.setTag(fieldNum, of.field, unmarshal, 0, name) } } + } // Get extension ranges, if any. - fn = reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") + fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") if fn.IsValid() { if !u.extensions.IsValid() && !u.oldExtensions.IsValid() { panic("a message with extensions, but no extensions field in " + t.Name()) diff --git a/proto/test_proto/test.pb.go b/proto/test_proto/test.pb.go index 1cd6b5b9ea..9265b3a6e0 100644 --- a/proto/test_proto/test.pb.go +++ b/proto/test_proto/test.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type FOO int32 @@ -3403,9 +3403,9 @@ func (m *Oneof) GetValue() int32 { return 0 } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Oneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Oneof_OneofMarshaler, _Oneof_OneofUnmarshaler, _Oneof_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Oneof) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Oneof_F_Bool)(nil), (*Oneof_F_Int32)(nil), (*Oneof_F_Int64)(nil), @@ -3427,298 +3427,6 @@ func (*Oneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, } } -func _Oneof_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Oneof) - // union - switch x := m.Union.(type) { - case *Oneof_F_Bool: - t := uint64(0) - if x.F_Bool { - t = 1 - } - b.EncodeVarint(1<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *Oneof_F_Int32: - b.EncodeVarint(2<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Int32)) - case *Oneof_F_Int64: - b.EncodeVarint(3<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Int64)) - case *Oneof_F_Fixed32: - b.EncodeVarint(4<<3 | proto.WireFixed32) - b.EncodeFixed32(uint64(x.F_Fixed32)) - case *Oneof_F_Fixed64: - b.EncodeVarint(5<<3 | proto.WireFixed64) - b.EncodeFixed64(uint64(x.F_Fixed64)) - case *Oneof_F_Uint32: - b.EncodeVarint(6<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Uint32)) - case *Oneof_F_Uint64: - b.EncodeVarint(7<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Uint64)) - case *Oneof_F_Float: - b.EncodeVarint(8<<3 | proto.WireFixed32) - b.EncodeFixed32(uint64(math.Float32bits(x.F_Float))) - case *Oneof_F_Double: - b.EncodeVarint(9<<3 | proto.WireFixed64) - b.EncodeFixed64(math.Float64bits(x.F_Double)) - case *Oneof_F_String: - b.EncodeVarint(10<<3 | proto.WireBytes) - b.EncodeStringBytes(x.F_String) - case *Oneof_F_Bytes: - b.EncodeVarint(11<<3 | proto.WireBytes) - b.EncodeRawBytes(x.F_Bytes) - case *Oneof_F_Sint32: - b.EncodeVarint(12<<3 | proto.WireVarint) - b.EncodeZigzag32(uint64(x.F_Sint32)) - case *Oneof_F_Sint64: - b.EncodeVarint(13<<3 | proto.WireVarint) - b.EncodeZigzag64(uint64(x.F_Sint64)) - case *Oneof_F_Enum: - b.EncodeVarint(14<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Enum)) - case *Oneof_F_Message: - b.EncodeVarint(15<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.F_Message); err != nil { - return err - } - case *Oneof_FGroup: - b.EncodeVarint(16<<3 | proto.WireStartGroup) - if err := b.Marshal(x.FGroup); err != nil { - return err - } - b.EncodeVarint(16<<3 | proto.WireEndGroup) - case *Oneof_F_Largest_Tag: - b.EncodeVarint(536870911<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Largest_Tag)) - case nil: - default: - return fmt.Errorf("Oneof.Union has unexpected type %T", x) - } - // tormato - switch x := m.Tormato.(type) { - case *Oneof_Value: - b.EncodeVarint(100<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Value)) - case nil: - default: - return fmt.Errorf("Oneof.Tormato has unexpected type %T", x) - } - return nil -} - -func _Oneof_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Oneof) - switch tag { - case 1: // union.F_Bool - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Bool{x != 0} - return true, err - case 2: // union.F_Int32 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Int32{int32(x)} - return true, err - case 3: // union.F_Int64 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Int64{int64(x)} - return true, err - case 4: // union.F_Fixed32 - if wire != proto.WireFixed32 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed32() - m.Union = &Oneof_F_Fixed32{uint32(x)} - return true, err - case 5: // union.F_Fixed64 - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Union = &Oneof_F_Fixed64{x} - return true, err - case 6: // union.F_Uint32 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Uint32{uint32(x)} - return true, err - case 7: // union.F_Uint64 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Uint64{x} - return true, err - case 8: // union.F_Float - if wire != proto.WireFixed32 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed32() - m.Union = &Oneof_F_Float{math.Float32frombits(uint32(x))} - return true, err - case 9: // union.F_Double - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Union = &Oneof_F_Double{math.Float64frombits(x)} - return true, err - case 10: // union.F_String - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Union = &Oneof_F_String{x} - return true, err - case 11: // union.F_Bytes - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Union = &Oneof_F_Bytes{x} - return true, err - case 12: // union.F_Sint32 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeZigzag32() - m.Union = &Oneof_F_Sint32{int32(x)} - return true, err - case 13: // union.F_Sint64 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeZigzag64() - m.Union = &Oneof_F_Sint64{int64(x)} - return true, err - case 14: // union.F_Enum - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Enum{MyMessage_Color(x)} - return true, err - case 15: // union.F_Message - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(GoTestField) - err := b.DecodeMessage(msg) - m.Union = &Oneof_F_Message{msg} - return true, err - case 16: // union.f_group - if wire != proto.WireStartGroup { - return true, proto.ErrInternalBadWireType - } - msg := new(Oneof_F_Group) - err := b.DecodeGroup(msg) - m.Union = &Oneof_FGroup{msg} - return true, err - case 536870911: // union.F_Largest_Tag - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Largest_Tag{int32(x)} - return true, err - case 100: // tormato.value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Tormato = &Oneof_Value{int32(x)} - return true, err - default: - return false, nil - } -} - -func _Oneof_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Oneof) - // union - switch x := m.Union.(type) { - case *Oneof_F_Bool: - n += 1 // tag and wire - n += 1 - case *Oneof_F_Int32: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.F_Int32)) - case *Oneof_F_Int64: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.F_Int64)) - case *Oneof_F_Fixed32: - n += 1 // tag and wire - n += 4 - case *Oneof_F_Fixed64: - n += 1 // tag and wire - n += 8 - case *Oneof_F_Uint32: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.F_Uint32)) - case *Oneof_F_Uint64: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.F_Uint64)) - case *Oneof_F_Float: - n += 1 // tag and wire - n += 4 - case *Oneof_F_Double: - n += 1 // tag and wire - n += 8 - case *Oneof_F_String: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.F_String))) - n += len(x.F_String) - case *Oneof_F_Bytes: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.F_Bytes))) - n += len(x.F_Bytes) - case *Oneof_F_Sint32: - n += 1 // tag and wire - n += proto.SizeVarint(uint64((uint32(x.F_Sint32) << 1) ^ uint32((int32(x.F_Sint32) >> 31)))) - case *Oneof_F_Sint64: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(uint64(x.F_Sint64<<1) ^ uint64((int64(x.F_Sint64) >> 63)))) - case *Oneof_F_Enum: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.F_Enum)) - case *Oneof_F_Message: - s := proto.Size(x.F_Message) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Oneof_FGroup: - n += 2 // tag and wire - n += proto.Size(x.FGroup) - n += 2 // tag and wire - case *Oneof_F_Largest_Tag: - n += 10 // tag and wire - n += proto.SizeVarint(uint64(x.F_Largest_Tag)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // tormato - switch x := m.Tormato.(type) { - case *Oneof_Value: - n += 2 // tag and wire - n += proto.SizeVarint(uint64(x.Value)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type Oneof_F_Group struct { X *int32 `protobuf:"varint,17,opt,name=x" json:"x,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -3896,9 +3604,9 @@ func (m *Communique) GetMsg() *Strings { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Communique_OneofMarshaler, _Communique_OneofUnmarshaler, _Communique_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Communique) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Communique_Number)(nil), (*Communique_Name)(nil), (*Communique_Data)(nil), @@ -3908,121 +3616,6 @@ func (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) er } } -func _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Communique) - // union - switch x := m.Union.(type) { - case *Communique_Number: - b.EncodeVarint(5<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Number)) - case *Communique_Name: - b.EncodeVarint(6<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Name) - case *Communique_Data: - b.EncodeVarint(7<<3 | proto.WireBytes) - b.EncodeRawBytes(x.Data) - case *Communique_TempC: - b.EncodeVarint(8<<3 | proto.WireFixed64) - b.EncodeFixed64(math.Float64bits(x.TempC)) - case *Communique_Col: - b.EncodeVarint(9<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Col)) - case *Communique_Msg: - b.EncodeVarint(10<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Msg); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Communique.Union has unexpected type %T", x) - } - return nil -} - -func _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Communique) - switch tag { - case 5: // union.number - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Communique_Number{int32(x)} - return true, err - case 6: // union.name - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Union = &Communique_Name{x} - return true, err - case 7: // union.data - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Union = &Communique_Data{x} - return true, err - case 8: // union.temp_c - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Union = &Communique_TempC{math.Float64frombits(x)} - return true, err - case 9: // union.col - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Communique_Col{MyMessage_Color(x)} - return true, err - case 10: // union.msg - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Strings) - err := b.DecodeMessage(msg) - m.Union = &Communique_Msg{msg} - return true, err - default: - return false, nil - } -} - -func _Communique_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Communique) - // union - switch x := m.Union.(type) { - case *Communique_Number: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Number)) - case *Communique_Name: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Name))) - n += len(x.Name) - case *Communique_Data: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Data))) - n += len(x.Data) - case *Communique_TempC: - n += 1 // tag and wire - n += 8 - case *Communique_Col: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Col)) - case *Communique_Msg: - s := proto.Size(x.Msg) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type TestUTF8 struct { Scalar *string `protobuf:"bytes,1,opt,name=scalar" json:"scalar,omitempty"` Vector []string `protobuf:"bytes,2,rep,name=vector" json:"vector,omitempty"` @@ -4113,57 +3706,13 @@ func (m *TestUTF8) GetMapValue() map[int64]string { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*TestUTF8) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _TestUTF8_OneofMarshaler, _TestUTF8_OneofUnmarshaler, _TestUTF8_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*TestUTF8) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*TestUTF8_Field)(nil), } } -func _TestUTF8_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*TestUTF8) - // oneof - switch x := m.Oneof.(type) { - case *TestUTF8_Field: - b.EncodeVarint(3<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Field) - case nil: - default: - return fmt.Errorf("TestUTF8.Oneof has unexpected type %T", x) - } - return nil -} - -func _TestUTF8_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*TestUTF8) - switch tag { - case 3: // oneof.field - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Oneof = &TestUTF8_Field{x} - return true, err - default: - return false, nil - } -} - -func _TestUTF8_OneofSizer(msg proto.Message) (n int) { - m := msg.(*TestUTF8) - // oneof - switch x := m.Oneof.(type) { - case *TestUTF8_Field: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Field))) - n += len(x.Field) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - var E_Greeting = &proto.ExtensionDesc{ ExtendedType: (*MyMessage)(nil), ExtensionType: ([]string)(nil), diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index 3ec5f43e1b..1ded05bbe7 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type FieldDescriptorProto_Type int32 diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 3cc2091730..e28084d203 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -69,7 +69,7 @@ import ( // It is incremented whenever an incompatibility between the generated code and // proto package is introduced; the generated code references // a constant, proto.ProtoPackageIsVersionN (where N is generatedCodeVersion). -const generatedCodeVersion = 2 +const generatedCodeVersion = 3 // A Plugin provides functionality to add to the output during Go code generation, // such as to produce RPC stubs. @@ -1873,214 +1873,12 @@ type oneofSubField struct { deprecated string // Deprecation comment, if any. } -// wireTypeName returns a textual wire type, needed for oneof sub fields in generated code. -func (f *oneofSubField) wireTypeName() string { - switch f.protoType { - case descriptor.FieldDescriptorProto_TYPE_FIXED64, - descriptor.FieldDescriptorProto_TYPE_SFIXED64, - descriptor.FieldDescriptorProto_TYPE_DOUBLE: - return "WireFixed64" - case descriptor.FieldDescriptorProto_TYPE_FIXED32, - descriptor.FieldDescriptorProto_TYPE_SFIXED32, - descriptor.FieldDescriptorProto_TYPE_FLOAT: - return "WireFixed32" - case descriptor.FieldDescriptorProto_TYPE_GROUP: - return "WireStartGroup" - case descriptor.FieldDescriptorProto_TYPE_MESSAGE, - descriptor.FieldDescriptorProto_TYPE_STRING, - descriptor.FieldDescriptorProto_TYPE_BYTES: - return "WireBytes" - default: // All others are Varints - return "WireVarint" - } -} - // typedNil prints a nil casted to the pointer to this field. -// - for XXX_OneofFuncs +// - for XXX_OneofWrappers func (f *oneofSubField) typedNil(g *Generator) { g.P("(*", f.oneofTypeName, ")(nil),") } -// marshalCase prints the case matching this oneof subfield in the marshalling code. -func (f *oneofSubField) marshalCase(g *Generator) { - g.P("case *", f.oneofTypeName, ":") - wire := f.wireTypeName() - var pre, post string - val := "x." + f.goName // overridden for TYPE_BOOL - switch f.protoType { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE: - pre = "b.EncodeFixed64(" + g.Pkg["math"] + ".Float64bits(" - post = "))" - case descriptor.FieldDescriptorProto_TYPE_FLOAT: - pre = "b.EncodeFixed32(uint64(" + g.Pkg["math"] + ".Float32bits(" - post = ")))" - case descriptor.FieldDescriptorProto_TYPE_INT64, descriptor.FieldDescriptorProto_TYPE_UINT64: - pre, post = "b.EncodeVarint(uint64(", "))" - case descriptor.FieldDescriptorProto_TYPE_INT32, descriptor.FieldDescriptorProto_TYPE_UINT32, descriptor.FieldDescriptorProto_TYPE_ENUM: - pre, post = "b.EncodeVarint(uint64(", "))" - case descriptor.FieldDescriptorProto_TYPE_FIXED64, descriptor.FieldDescriptorProto_TYPE_SFIXED64: - pre, post = "b.EncodeFixed64(uint64(", "))" - case descriptor.FieldDescriptorProto_TYPE_FIXED32, descriptor.FieldDescriptorProto_TYPE_SFIXED32: - pre, post = "b.EncodeFixed32(uint64(", "))" - case descriptor.FieldDescriptorProto_TYPE_BOOL: - g.P("t := uint64(0)") - g.P("if ", val, " { t = 1 }") - val = "t" - pre, post = "b.EncodeVarint(", ")" - case descriptor.FieldDescriptorProto_TYPE_STRING: - pre, post = "b.EncodeStringBytes(", ")" - case descriptor.FieldDescriptorProto_TYPE_GROUP: - pre, post = "b.Marshal(", ")" - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - pre, post = "b.EncodeMessage(", ")" - case descriptor.FieldDescriptorProto_TYPE_BYTES: - pre, post = "b.EncodeRawBytes(", ")" - case descriptor.FieldDescriptorProto_TYPE_SINT32: - pre, post = "b.EncodeZigzag32(uint64(", "))" - case descriptor.FieldDescriptorProto_TYPE_SINT64: - pre, post = "b.EncodeZigzag64(uint64(", "))" - default: - g.Fail("unhandled oneof field type ", f.protoType.String()) - } - g.P("b.EncodeVarint(", f.fieldNumber, "<<3|", g.Pkg["proto"], ".", wire, ")") - if t := f.protoType; t != descriptor.FieldDescriptorProto_TYPE_GROUP && t != descriptor.FieldDescriptorProto_TYPE_MESSAGE { - g.P(pre, val, post) - } else { - g.P("if err := ", pre, val, post, "; err != nil {") - g.P("return err") - g.P("}") - } - if f.protoType == descriptor.FieldDescriptorProto_TYPE_GROUP { - g.P("b.EncodeVarint(", f.fieldNumber, "<<3|", g.Pkg["proto"], ".WireEndGroup)") - } -} - -// unmarshalCase prints the case matching this oneof subfield in the unmarshalling code. -func (f *oneofSubField) unmarshalCase(g *Generator, origOneofName string, oneofName string) { - g.P("case ", f.fieldNumber, ": // ", origOneofName, ".", f.getProtoName()) - g.P("if wire != ", g.Pkg["proto"], ".", f.wireTypeName(), " {") - g.P("return true, ", g.Pkg["proto"], ".ErrInternalBadWireType") - g.P("}") - lhs := "x, err" // overridden for TYPE_MESSAGE and TYPE_GROUP - var dec, cast, cast2 string - switch f.protoType { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE: - dec, cast = "b.DecodeFixed64()", g.Pkg["math"]+".Float64frombits" - case descriptor.FieldDescriptorProto_TYPE_FLOAT: - dec, cast, cast2 = "b.DecodeFixed32()", "uint32", g.Pkg["math"]+".Float32frombits" - case descriptor.FieldDescriptorProto_TYPE_INT64: - dec, cast = "b.DecodeVarint()", "int64" - case descriptor.FieldDescriptorProto_TYPE_UINT64: - dec = "b.DecodeVarint()" - case descriptor.FieldDescriptorProto_TYPE_INT32: - dec, cast = "b.DecodeVarint()", "int32" - case descriptor.FieldDescriptorProto_TYPE_FIXED64: - dec = "b.DecodeFixed64()" - case descriptor.FieldDescriptorProto_TYPE_FIXED32: - dec, cast = "b.DecodeFixed32()", "uint32" - case descriptor.FieldDescriptorProto_TYPE_BOOL: - dec = "b.DecodeVarint()" - // handled specially below - case descriptor.FieldDescriptorProto_TYPE_STRING: - dec = "b.DecodeStringBytes()" - case descriptor.FieldDescriptorProto_TYPE_GROUP: - g.P("msg := new(", f.goType[1:], ")") // drop star - lhs = "err" - dec = "b.DecodeGroup(msg)" - // handled specially below - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - g.P("msg := new(", f.goType[1:], ")") // drop star - lhs = "err" - dec = "b.DecodeMessage(msg)" - // handled specially below - case descriptor.FieldDescriptorProto_TYPE_BYTES: - dec = "b.DecodeRawBytes(true)" - case descriptor.FieldDescriptorProto_TYPE_UINT32: - dec, cast = "b.DecodeVarint()", "uint32" - case descriptor.FieldDescriptorProto_TYPE_ENUM: - dec, cast = "b.DecodeVarint()", f.goType - case descriptor.FieldDescriptorProto_TYPE_SFIXED32: - dec, cast = "b.DecodeFixed32()", "int32" - case descriptor.FieldDescriptorProto_TYPE_SFIXED64: - dec, cast = "b.DecodeFixed64()", "int64" - case descriptor.FieldDescriptorProto_TYPE_SINT32: - dec, cast = "b.DecodeZigzag32()", "int32" - case descriptor.FieldDescriptorProto_TYPE_SINT64: - dec, cast = "b.DecodeZigzag64()", "int64" - default: - g.Fail("unhandled oneof field type ", f.protoType.String()) - } - g.P(lhs, " := ", dec) - val := "x" - if cast != "" { - val = cast + "(" + val + ")" - } - if cast2 != "" { - val = cast2 + "(" + val + ")" - } - switch f.protoType { - case descriptor.FieldDescriptorProto_TYPE_BOOL: - val += " != 0" - case descriptor.FieldDescriptorProto_TYPE_GROUP, - descriptor.FieldDescriptorProto_TYPE_MESSAGE: - val = "msg" - } - g.P("m.", oneofName, " = &", f.oneofTypeName, "{", val, "}") - g.P("return true, err") -} - -// sizerCase prints the case matching this oneof subfield in the sizer code. -func (f *oneofSubField) sizerCase(g *Generator) { - g.P("case *", f.oneofTypeName, ":") - val := "x." + f.goName - var varint, fixed string - switch f.protoType { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE: - fixed = "8" - case descriptor.FieldDescriptorProto_TYPE_FLOAT: - fixed = "4" - case descriptor.FieldDescriptorProto_TYPE_INT64, descriptor.FieldDescriptorProto_TYPE_UINT64, descriptor.FieldDescriptorProto_TYPE_INT32, descriptor.FieldDescriptorProto_TYPE_UINT32, descriptor.FieldDescriptorProto_TYPE_ENUM: - varint = val - case descriptor.FieldDescriptorProto_TYPE_FIXED64, descriptor.FieldDescriptorProto_TYPE_SFIXED64: - fixed = "8" - case descriptor.FieldDescriptorProto_TYPE_FIXED32, descriptor.FieldDescriptorProto_TYPE_SFIXED32: - fixed = "4" - case descriptor.FieldDescriptorProto_TYPE_BOOL: - fixed = "1" - case descriptor.FieldDescriptorProto_TYPE_STRING: - fixed = "len(" + val + ")" - varint = fixed - case descriptor.FieldDescriptorProto_TYPE_GROUP: - fixed = g.Pkg["proto"] + ".Size(" + val + ")" - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - g.P("s := ", g.Pkg["proto"], ".Size(", val, ")") - fixed = "s" - varint = fixed - case descriptor.FieldDescriptorProto_TYPE_BYTES: - fixed = "len(" + val + ")" - varint = fixed - case descriptor.FieldDescriptorProto_TYPE_SINT32: - varint = "(uint32(" + val + ") << 1) ^ uint32((int32(" + val + ") >> 31))" - case descriptor.FieldDescriptorProto_TYPE_SINT64: - varint = "uint64(" + val + " << 1) ^ uint64((int64(" + val + ") >> 63))" - default: - g.Fail("unhandled oneof field type ", f.protoType.String()) - } - // Tag and wire varint is known statically, - // so don't generate code for that part of the size computation. - tagAndWireSize := proto.SizeVarint(uint64(f.fieldNumber << 3)) // wire doesn't affect varint size - g.P("n += ", tagAndWireSize, " // tag and wire") - if varint != "" { - g.P("n += ", g.Pkg["proto"], ".SizeVarint(uint64(", varint, "))") - } - if fixed != "" { - g.P("n += ", fixed) - } - if f.protoType == descriptor.FieldDescriptorProto_TYPE_GROUP { - g.P("n += ", tagAndWireSize, " // tag and wire") - } -} - // getProtoDef returns the default value explicitly stated in the proto file, e.g "yoshi" or "5". func (f *oneofSubField) getProtoDef() string { return f.protoDef @@ -2276,17 +2074,11 @@ func (g *Generator) generateOneofFuncs(mc *msgCtx, topLevelFields []topLevelFiel if len(ofields) == 0 { return } - enc := "_" + mc.goName + "_OneofMarshaler" - dec := "_" + mc.goName + "_OneofUnmarshaler" - size := "_" + mc.goName + "_OneofSizer" - encSig := "(msg " + g.Pkg["proto"] + ".Message, b *" + g.Pkg["proto"] + ".Buffer) error" - decSig := "(msg " + g.Pkg["proto"] + ".Message, tag, wire int, b *" + g.Pkg["proto"] + ".Buffer) (bool, error)" - sizeSig := "(msg " + g.Pkg["proto"] + ".Message) (n int)" // OneofFuncs - g.P("// XXX_OneofFuncs is for the internal use of the proto package.") - g.P("func (*", mc.goName, ") XXX_OneofFuncs() (func", encSig, ", func", decSig, ", func", sizeSig, ", []interface{}) {") - g.P("return ", enc, ", ", dec, ", ", size, ", []interface{}{") + g.P("// XXX_OneofWrappers is for the internal use of the proto package.") + g.P("func (*", mc.goName, ") XXX_OneofWrappers() []interface{} {") + g.P("return []interface{}{") for _, of := range ofields { for _, sf := range of.subFields { sf.typedNil(g) @@ -2295,59 +2087,6 @@ func (g *Generator) generateOneofFuncs(mc *msgCtx, topLevelFields []topLevelFiel g.P("}") g.P("}") g.P() - - // marshaler - g.P("func ", enc, encSig, " {") - g.P("m := msg.(*", mc.goName, ")") - for _, of := range ofields { - g.P("// ", of.getProtoName()) - g.P("switch x := m.", of.goName, ".(type) {") - for _, sf := range of.subFields { - // also fills in field.wire - sf.marshalCase(g) - } - g.P("case nil:") - g.P("default:") - g.P(" return ", g.Pkg["fmt"], `.Errorf("`, mc.goName, ".", of.goName, ` has unexpected type %T", x)`) - g.P("}") - } - g.P("return nil") - g.P("}") - g.P() - - // unmarshaler - g.P("func ", dec, decSig, " {") - g.P("m := msg.(*", mc.goName, ")") - g.P("switch tag {") - for _, of := range ofields { - for _, sf := range of.subFields { - sf.unmarshalCase(g, of.getProtoName(), of.goName) - } - } - g.P("default:") - g.P("return false, nil") - g.P("}") - g.P("}") - g.P() - - // sizer - g.P("func ", size, sizeSig, " {") - g.P("m := msg.(*", mc.goName, ")") - for _, of := range ofields { - g.P("// ", of.getProtoName()) - g.P("switch x := m.", of.goName, ".(type) {") - for _, sf := range of.subFields { - // also fills in field.wire - sf.sizerCase(g) - } - g.P("case nil:") - g.P("default:") - g.P("panic(", g.Pkg["fmt"], ".Sprintf(\"proto: unexpected type %T in oneof\", x))") - g.P("}") - } - g.P("return n") - g.P("}") - g.P() } // generateMessageStruct adds the actual struct with it's members (but not methods) to the output. diff --git a/protoc-gen-go/testdata/deprecated/deprecated.pb.go b/protoc-gen-go/testdata/deprecated/deprecated.pb.go index 3d943cbfe3..fc25333e97 100644 --- a/protoc-gen-go/testdata/deprecated/deprecated.pb.go +++ b/protoc-gen-go/testdata/deprecated/deprecated.pb.go @@ -22,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // DeprecatedEnum contains deprecated values. type DeprecatedEnum int32 // Deprecated: Do not use. @@ -88,6 +88,7 @@ type DeprecatedResponse struct { // DeprecatedOneof contains a deprecated field. // // Types that are valid to be assigned to DeprecatedOneof: + // DeprecatedOneofField is a deprecated field. // *DeprecatedResponse_DeprecatedOneofField DeprecatedOneof isDeprecatedResponse_DeprecatedOneof `protobuf_oneof:"deprecated_oneof"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -153,57 +154,13 @@ func (m *DeprecatedResponse) GetDeprecatedOneofField() string { return "" } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*DeprecatedResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _DeprecatedResponse_OneofMarshaler, _DeprecatedResponse_OneofUnmarshaler, _DeprecatedResponse_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*DeprecatedResponse) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*DeprecatedResponse_DeprecatedOneofField)(nil), } } -func _DeprecatedResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*DeprecatedResponse) - // deprecated_oneof - switch x := m.DeprecatedOneof.(type) { - case *DeprecatedResponse_DeprecatedOneofField: - b.EncodeVarint(2<<3 | proto.WireBytes) - b.EncodeStringBytes(x.DeprecatedOneofField) - case nil: - default: - return fmt.Errorf("DeprecatedResponse.DeprecatedOneof has unexpected type %T", x) - } - return nil -} - -func _DeprecatedResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*DeprecatedResponse) - switch tag { - case 2: // deprecated_oneof.deprecated_oneof_field - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.DeprecatedOneof = &DeprecatedResponse_DeprecatedOneofField{x} - return true, err - default: - return false, nil - } -} - -func _DeprecatedResponse_OneofSizer(msg proto.Message) (n int) { - m := msg.(*DeprecatedResponse) - // deprecated_oneof - switch x := m.DeprecatedOneof.(type) { - case *DeprecatedResponse_DeprecatedOneofField: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.DeprecatedOneofField))) - n += len(x.DeprecatedOneofField) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - func init() { proto.RegisterEnum("deprecated.DeprecatedEnum", DeprecatedEnum_name, DeprecatedEnum_value) proto.RegisterType((*DeprecatedRequest)(nil), "deprecated.DeprecatedRequest") diff --git a/protoc-gen-go/testdata/extension_base/extension_base.pb.go b/protoc-gen-go/testdata/extension_base/extension_base.pb.go index 7cd6bb94a1..62437ef56f 100644 --- a/protoc-gen-go/testdata/extension_base/extension_base.pb.go +++ b/protoc-gen-go/testdata/extension_base/extension_base.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type BaseMessage struct { Height *int32 `protobuf:"varint,1,opt,name=height" json:"height,omitempty"` diff --git a/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go b/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go index 45d841800b..fd82a253b8 100644 --- a/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go +++ b/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type ExtraMessage struct { Width *int32 `protobuf:"varint,1,opt,name=width" json:"width,omitempty"` diff --git a/protoc-gen-go/testdata/extension_user/extension_user.pb.go b/protoc-gen-go/testdata/extension_user/extension_user.pb.go index 2f7fe3a457..41321cf77f 100644 --- a/protoc-gen-go/testdata/extension_user/extension_user.pb.go +++ b/protoc-gen-go/testdata/extension_user/extension_user.pb.go @@ -20,7 +20,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type UserMessage struct { Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` diff --git a/protoc-gen-go/testdata/grpc/grpc.pb.go b/protoc-gen-go/testdata/grpc/grpc.pb.go index 79ab362285..62dba4185e 100644 --- a/protoc-gen-go/testdata/grpc/grpc.pb.go +++ b/protoc-gen-go/testdata/grpc/grpc.pb.go @@ -20,7 +20,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type SimpleRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` diff --git a/protoc-gen-go/testdata/import_public/a.pb.go b/protoc-gen-go/testdata/import_public/a.pb.go index 0c23c06bcf..fa511fcbef 100644 --- a/protoc-gen-go/testdata/import_public/a.pb.go +++ b/protoc-gen-go/testdata/import_public/a.pb.go @@ -19,7 +19,9 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +const Default_M_DefaultField = sub.Default_M_DefaultField // M from public import import_public/sub/a.proto type M = sub.M @@ -58,6 +60,8 @@ var M_Submessage_Submessage_Subenum_value = sub.M_Submessage_Submessage_Subenum_ const M_Submessage_M_SUBMESSAGE_ZERO = M_Submessage_Submessage_Subenum(sub.M_Submessage_M_SUBMESSAGE_ZERO) +var E_ExtensionField = sub.E_ExtensionField + type Public struct { M *sub.M `protobuf:"bytes,1,opt,name=m" json:"m,omitempty"` E *sub.E `protobuf:"varint,2,opt,name=e,enum=goproto.test.import_public.sub.E" json:"e,omitempty"` diff --git a/protoc-gen-go/testdata/import_public/b.pb.go b/protoc-gen-go/testdata/import_public/b.pb.go index 74f327f850..522f215ca2 100644 --- a/protoc-gen-go/testdata/import_public/b.pb.go +++ b/protoc-gen-go/testdata/import_public/b.pb.go @@ -19,7 +19,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Local struct { M *sub.M `protobuf:"bytes,1,opt,name=m" json:"m,omitempty"` diff --git a/protoc-gen-go/testdata/import_public/importing/importing.pb.go b/protoc-gen-go/testdata/import_public/importing/importing.pb.go index afc323e199..3f0f37e9a4 100644 --- a/protoc-gen-go/testdata/import_public/importing/importing.pb.go +++ b/protoc-gen-go/testdata/import_public/importing/importing.pb.go @@ -20,7 +20,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type M struct { // Message type defined in a file publicly imported by a file we import. diff --git a/protoc-gen-go/testdata/import_public/sub/a.pb.go b/protoc-gen-go/testdata/import_public/sub/a.pb.go index 9b66282913..6f815678ae 100644 --- a/protoc-gen-go/testdata/import_public/sub/a.pb.go +++ b/protoc-gen-go/testdata/import_public/sub/a.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type E int32 @@ -230,70 +230,14 @@ func (m *M) GetDefaultField() string { return Default_M_DefaultField } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*M) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _M_OneofMarshaler, _M_OneofUnmarshaler, _M_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*M) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*M_OneofInt32)(nil), (*M_OneofInt64)(nil), } } -func _M_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*M) - // oneof_field - switch x := m.OneofField.(type) { - case *M_OneofInt32: - b.EncodeVarint(2<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.OneofInt32)) - case *M_OneofInt64: - b.EncodeVarint(3<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.OneofInt64)) - case nil: - default: - return fmt.Errorf("M.OneofField has unexpected type %T", x) - } - return nil -} - -func _M_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*M) - switch tag { - case 2: // oneof_field.oneof_int32 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.OneofField = &M_OneofInt32{int32(x)} - return true, err - case 3: // oneof_field.oneof_int64 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.OneofField = &M_OneofInt64{int64(x)} - return true, err - default: - return false, nil - } -} - -func _M_OneofSizer(msg proto.Message) (n int) { - m := msg.(*M) - // oneof_field - switch x := m.OneofField.(type) { - case *M_OneofInt32: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.OneofInt32)) - case *M_OneofInt64: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.OneofInt64)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type M_Grouping struct { GroupField *string `protobuf:"bytes,5,opt,name=group_field,json=groupField" json:"group_field,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -405,70 +349,14 @@ func (m *M_Submessage) GetSubmessageOneofInt64() int64 { return 0 } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*M_Submessage) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _M_Submessage_OneofMarshaler, _M_Submessage_OneofUnmarshaler, _M_Submessage_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*M_Submessage) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*M_Submessage_SubmessageOneofInt32)(nil), (*M_Submessage_SubmessageOneofInt64)(nil), } } -func _M_Submessage_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*M_Submessage) - // submessage_oneof_field - switch x := m.SubmessageOneofField.(type) { - case *M_Submessage_SubmessageOneofInt32: - b.EncodeVarint(1<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.SubmessageOneofInt32)) - case *M_Submessage_SubmessageOneofInt64: - b.EncodeVarint(2<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.SubmessageOneofInt64)) - case nil: - default: - return fmt.Errorf("M_Submessage.SubmessageOneofField has unexpected type %T", x) - } - return nil -} - -func _M_Submessage_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*M_Submessage) - switch tag { - case 1: // submessage_oneof_field.submessage_oneof_int32 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.SubmessageOneofField = &M_Submessage_SubmessageOneofInt32{int32(x)} - return true, err - case 2: // submessage_oneof_field.submessage_oneof_int64 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.SubmessageOneofField = &M_Submessage_SubmessageOneofInt64{int64(x)} - return true, err - default: - return false, nil - } -} - -func _M_Submessage_OneofSizer(msg proto.Message) (n int) { - m := msg.(*M_Submessage) - // submessage_oneof_field - switch x := m.SubmessageOneofField.(type) { - case *M_Submessage_SubmessageOneofInt32: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.SubmessageOneofInt32)) - case *M_Submessage_SubmessageOneofInt64: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.SubmessageOneofInt64)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - var E_ExtensionField = &proto.ExtensionDesc{ ExtendedType: (*M2)(nil), ExtensionType: (*string)(nil), diff --git a/protoc-gen-go/testdata/import_public/sub/b.pb.go b/protoc-gen-go/testdata/import_public/sub/b.pb.go index 1f3c4cbc61..cb4ea17e8c 100644 --- a/protoc-gen-go/testdata/import_public/sub/b.pb.go +++ b/protoc-gen-go/testdata/import_public/sub/b.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type M2 struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` diff --git a/protoc-gen-go/testdata/imports/fmt/m.pb.go b/protoc-gen-go/testdata/imports/fmt/m.pb.go index ec263db0ee..9f774fe064 100644 --- a/protoc-gen-go/testdata/imports/fmt/m.pb.go +++ b/protoc-gen-go/testdata/imports/fmt/m.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type M struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` diff --git a/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go b/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go index 174854bde1..1cec006b9d 100644 --- a/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go +++ b/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type E1 int32 diff --git a/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go b/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go index 9b6cd05cc1..0563d580ca 100644 --- a/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go +++ b/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type M2 struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` diff --git a/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go b/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go index 61b5155a41..cbc8430b07 100644 --- a/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go +++ b/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type M3 struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` diff --git a/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go b/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go index 19b0bd8a10..2771b839aa 100644 --- a/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go +++ b/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type M4 struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` diff --git a/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go b/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go index d15f4c9b53..51592e7264 100644 --- a/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go +++ b/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type M1 struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` diff --git a/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go b/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go index 66e66de299..f31fb0d273 100644 --- a/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go +++ b/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type M2 struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` diff --git a/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go b/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go index 6713a20739..1fef9ea30a 100644 --- a/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go +++ b/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go @@ -19,7 +19,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type A1M1 struct { F *test_a_1.M1 `protobuf:"bytes,1,opt,name=f,proto3" json:"f,omitempty"` diff --git a/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go b/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go index a0a1588c8e..13d5dd6fb8 100644 --- a/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go +++ b/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go @@ -19,7 +19,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type A1M2 struct { F *test_a_1.M2 `protobuf:"bytes,1,opt,name=f,proto3" json:"f,omitempty"` diff --git a/protoc-gen-go/testdata/imports/test_import_all.pb.go b/protoc-gen-go/testdata/imports/test_import_all.pb.go index 1746f9daf0..467051708f 100644 --- a/protoc-gen-go/testdata/imports/test_import_all.pb.go +++ b/protoc-gen-go/testdata/imports/test_import_all.pb.go @@ -22,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type All struct { Am1 *test_a_1.M1 `protobuf:"bytes,1,opt,name=am1,proto3" json:"am1,omitempty"` diff --git a/protoc-gen-go/testdata/multi/multi1.pb.go b/protoc-gen-go/testdata/multi/multi1.pb.go index 1b2e4aabfd..6ff8dd64bd 100644 --- a/protoc-gen-go/testdata/multi/multi1.pb.go +++ b/protoc-gen-go/testdata/multi/multi1.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Multi1 struct { Multi2 *Multi2 `protobuf:"bytes,1,req,name=multi2" json:"multi2,omitempty"` diff --git a/protoc-gen-go/testdata/multi/multi2.pb.go b/protoc-gen-go/testdata/multi/multi2.pb.go index 27a2352625..2eb07ad1a8 100644 --- a/protoc-gen-go/testdata/multi/multi2.pb.go +++ b/protoc-gen-go/testdata/multi/multi2.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Multi2_Color int32 diff --git a/protoc-gen-go/testdata/multi/multi3.pb.go b/protoc-gen-go/testdata/multi/multi3.pb.go index ae3a1ffaff..9fb771f512 100644 --- a/protoc-gen-go/testdata/multi/multi3.pb.go +++ b/protoc-gen-go/testdata/multi/multi3.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Multi3_HatType int32 diff --git a/protoc-gen-go/testdata/my_test/test.pb.go b/protoc-gen-go/testdata/my_test/test.pb.go index 066e33e8d6..66c05117da 100644 --- a/protoc-gen-go/testdata/my_test/test.pb.go +++ b/protoc-gen-go/testdata/my_test/test.pb.go @@ -21,7 +21,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type HatType int32 @@ -899,9 +899,9 @@ func (m *Communique) GetSomegroup() *Communique_SomeGroup { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Communique_OneofMarshaler, _Communique_OneofUnmarshaler, _Communique_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Communique) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Communique_Number)(nil), (*Communique_Name)(nil), (*Communique_Data)(nil), @@ -915,182 +915,6 @@ func (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) er } } -func _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Communique) - // union - switch x := m.Union.(type) { - case *Communique_Number: - b.EncodeVarint(5<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Number)) - case *Communique_Name: - b.EncodeVarint(6<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Name) - case *Communique_Data: - b.EncodeVarint(7<<3 | proto.WireBytes) - b.EncodeRawBytes(x.Data) - case *Communique_TempC: - b.EncodeVarint(8<<3 | proto.WireFixed64) - b.EncodeFixed64(math.Float64bits(x.TempC)) - case *Communique_Height: - b.EncodeVarint(9<<3 | proto.WireFixed32) - b.EncodeFixed32(uint64(math.Float32bits(x.Height))) - case *Communique_Today: - b.EncodeVarint(10<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Today)) - case *Communique_Maybe: - t := uint64(0) - if x.Maybe { - t = 1 - } - b.EncodeVarint(11<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *Communique_Delta_: - b.EncodeVarint(12<<3 | proto.WireVarint) - b.EncodeZigzag32(uint64(x.Delta)) - case *Communique_Msg: - b.EncodeVarint(16<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Msg); err != nil { - return err - } - case *Communique_Somegroup: - b.EncodeVarint(14<<3 | proto.WireStartGroup) - if err := b.Marshal(x.Somegroup); err != nil { - return err - } - b.EncodeVarint(14<<3 | proto.WireEndGroup) - case nil: - default: - return fmt.Errorf("Communique.Union has unexpected type %T", x) - } - return nil -} - -func _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Communique) - switch tag { - case 5: // union.number - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Communique_Number{int32(x)} - return true, err - case 6: // union.name - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Union = &Communique_Name{x} - return true, err - case 7: // union.data - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Union = &Communique_Data{x} - return true, err - case 8: // union.temp_c - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Union = &Communique_TempC{math.Float64frombits(x)} - return true, err - case 9: // union.height - if wire != proto.WireFixed32 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed32() - m.Union = &Communique_Height{math.Float32frombits(uint32(x))} - return true, err - case 10: // union.today - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Communique_Today{Days(x)} - return true, err - case 11: // union.maybe - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Communique_Maybe{x != 0} - return true, err - case 12: // union.delta - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeZigzag32() - m.Union = &Communique_Delta_{int32(x)} - return true, err - case 16: // union.msg - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Reply) - err := b.DecodeMessage(msg) - m.Union = &Communique_Msg{msg} - return true, err - case 14: // union.somegroup - if wire != proto.WireStartGroup { - return true, proto.ErrInternalBadWireType - } - msg := new(Communique_SomeGroup) - err := b.DecodeGroup(msg) - m.Union = &Communique_Somegroup{msg} - return true, err - default: - return false, nil - } -} - -func _Communique_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Communique) - // union - switch x := m.Union.(type) { - case *Communique_Number: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Number)) - case *Communique_Name: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Name))) - n += len(x.Name) - case *Communique_Data: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Data))) - n += len(x.Data) - case *Communique_TempC: - n += 1 // tag and wire - n += 8 - case *Communique_Height: - n += 1 // tag and wire - n += 4 - case *Communique_Today: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Today)) - case *Communique_Maybe: - n += 1 // tag and wire - n += 1 - case *Communique_Delta_: - n += 1 // tag and wire - n += proto.SizeVarint(uint64((uint32(x.Delta) << 1) ^ uint32((int32(x.Delta) >> 31)))) - case *Communique_Msg: - s := proto.Size(x.Msg) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Communique_Somegroup: - n += 1 // tag and wire - n += proto.Size(x.Somegroup) - n += 1 // tag and wire - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type Communique_SomeGroup struct { Member *string `protobuf:"bytes,15,opt,name=member" json:"member,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` diff --git a/protoc-gen-go/testdata/proto3/proto3.pb.go b/protoc-gen-go/testdata/proto3/proto3.pb.go index fcce2e6bc4..a816962523 100644 --- a/protoc-gen-go/testdata/proto3/proto3.pb.go +++ b/protoc-gen-go/testdata/proto3/proto3.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Request_Flavour int32 diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index 9a11e7d5a4..78ee523349 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // `Any` contains an arbitrary serialized protocol buffer message along with a // URL that describes the type of the serialized message. diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index 5e841af272..0d681ee21a 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // A Duration represents a signed, fixed-length span of time represented // as a count of seconds and fractions of seconds at nanosecond diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index 3085d76ec2..b4eb03eccf 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // A generic empty message that you can re-use to avoid defining duplicated // empty messages in your APIs. A typical example is to use it as the request diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index a56fb70dbd..c680c1d7c7 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // `NullValue` is a singleton enumeration to represent the null value for the // `Value` type union. @@ -109,11 +109,17 @@ type Value struct { // The kind of value. // // Types that are valid to be assigned to Kind: + // Represents a null value. // *Value_NullValue + // Represents a double value. // *Value_NumberValue + // Represents a string value. // *Value_StringValue + // Represents a boolean value. // *Value_BoolValue + // Represents a structured value. // *Value_StructValue + // Represents a repeated `Value`. // *Value_ListValue Kind isValue_Kind `protobuf_oneof:"kind"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -237,9 +243,9 @@ func (m *Value) GetListValue() *ListValue { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Value_OneofMarshaler, _Value_OneofUnmarshaler, _Value_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Value) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Value_NullValue)(nil), (*Value_NumberValue)(nil), (*Value_StringValue)(nil), @@ -249,129 +255,6 @@ func (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, } } -func _Value_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Value) - // kind - switch x := m.Kind.(type) { - case *Value_NullValue: - b.EncodeVarint(1<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.NullValue)) - case *Value_NumberValue: - b.EncodeVarint(2<<3 | proto.WireFixed64) - b.EncodeFixed64(math.Float64bits(x.NumberValue)) - case *Value_StringValue: - b.EncodeVarint(3<<3 | proto.WireBytes) - b.EncodeStringBytes(x.StringValue) - case *Value_BoolValue: - t := uint64(0) - if x.BoolValue { - t = 1 - } - b.EncodeVarint(4<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *Value_StructValue: - b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.StructValue); err != nil { - return err - } - case *Value_ListValue: - b.EncodeVarint(6<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ListValue); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Value.Kind has unexpected type %T", x) - } - return nil -} - -func _Value_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Value) - switch tag { - case 1: // kind.null_value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Kind = &Value_NullValue{NullValue(x)} - return true, err - case 2: // kind.number_value - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Kind = &Value_NumberValue{math.Float64frombits(x)} - return true, err - case 3: // kind.string_value - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Kind = &Value_StringValue{x} - return true, err - case 4: // kind.bool_value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Kind = &Value_BoolValue{x != 0} - return true, err - case 5: // kind.struct_value - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Struct) - err := b.DecodeMessage(msg) - m.Kind = &Value_StructValue{msg} - return true, err - case 6: // kind.list_value - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ListValue) - err := b.DecodeMessage(msg) - m.Kind = &Value_ListValue{msg} - return true, err - default: - return false, nil - } -} - -func _Value_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Value) - // kind - switch x := m.Kind.(type) { - case *Value_NullValue: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.NullValue)) - case *Value_NumberValue: - n += 1 // tag and wire - n += 8 - case *Value_StringValue: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.StringValue))) - n += len(x.StringValue) - case *Value_BoolValue: - n += 1 // tag and wire - n += 1 - case *Value_StructValue: - s := proto.Size(x.StructValue) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Value_ListValue: - s := proto.Size(x.ListValue) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - // `ListValue` is a wrapper around a repeated field of values. // // The JSON representation for `ListValue` is JSON array. diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index b001e4a49e..31cd846de9 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // A Timestamp represents a point in time independent of any time zone // or calendar, represented as seconds and fractions of seconds at diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index 68e9b3db1d..add19a1adb 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -18,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // Wrapper message for `double`. // From eef680e7be968b72053e9179e727773761e46391 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 28 Nov 2018 07:16:45 -0800 Subject: [PATCH 025/133] conformance: remove the conformance test The conformance test will eventually live in the v2 repository. Remove it from v1. It does not even work anymore and is not worth fixing up. Change-Id: I39b5b615becdd294306d5782ab37c94a5bd7713a Reviewed-on: https://go-review.googlesource.com/c/151406 Reviewed-by: Herbie Ong --- conformance/Makefile | 49 - conformance/conformance.go | 154 -- conformance/conformance.sh | 4 - conformance/failure_list_go.txt | 61 - .../conformance_proto/conformance.pb.go | 1603 ----------------- .../conformance_proto/conformance.proto | 273 --- conformance/test.sh | 26 - go.mod | 1 - 8 files changed, 2171 deletions(-) delete mode 100644 conformance/Makefile delete mode 100644 conformance/conformance.go delete mode 100755 conformance/conformance.sh delete mode 100644 conformance/failure_list_go.txt delete mode 100644 conformance/internal/conformance_proto/conformance.pb.go delete mode 100644 conformance/internal/conformance_proto/conformance.proto delete mode 100755 conformance/test.sh diff --git a/conformance/Makefile b/conformance/Makefile deleted file mode 100644 index b99e4ed6de..0000000000 --- a/conformance/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2016 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. - -PROTOBUF_ROOT=$(HOME)/src/protobuf - -all: - @echo To run the tests in this directory, acquire the main protobuf - @echo distribution from: - @echo - @echo ' https://github.com/google/protobuf' - @echo - @echo Build the test runner with: - @echo - @echo ' cd conformance && make conformance-test-runner' - @echo - @echo And run the tests in this directory with: - @echo - @echo ' make test PROTOBUF_ROOT=' - -test: - ./test.sh $(PROTOBUF_ROOT) diff --git a/conformance/conformance.go b/conformance/conformance.go deleted file mode 100644 index 3029312a1b..0000000000 --- a/conformance/conformance.go +++ /dev/null @@ -1,154 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 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. - -// conformance implements the conformance test subprocess protocol as -// documented in conformance.proto. -package main - -import ( - "encoding/binary" - "fmt" - "io" - "os" - - pb "github.com/golang/protobuf/conformance/internal/conformance_proto" - "github.com/golang/protobuf/jsonpb" - "github.com/golang/protobuf/proto" -) - -func main() { - var sizeBuf [4]byte - inbuf := make([]byte, 0, 4096) - outbuf := proto.NewBuffer(nil) - for { - if _, err := io.ReadFull(os.Stdin, sizeBuf[:]); err == io.EOF { - break - } else if err != nil { - fmt.Fprintln(os.Stderr, "go conformance: read request:", err) - os.Exit(1) - } - size := binary.LittleEndian.Uint32(sizeBuf[:]) - if int(size) > cap(inbuf) { - inbuf = make([]byte, size) - } - inbuf = inbuf[:size] - if _, err := io.ReadFull(os.Stdin, inbuf); err != nil { - fmt.Fprintln(os.Stderr, "go conformance: read request:", err) - os.Exit(1) - } - - req := new(pb.ConformanceRequest) - if err := proto.Unmarshal(inbuf, req); err != nil { - fmt.Fprintln(os.Stderr, "go conformance: parse request:", err) - os.Exit(1) - } - res := handle(req) - - if err := outbuf.Marshal(res); err != nil { - fmt.Fprintln(os.Stderr, "go conformance: marshal response:", err) - os.Exit(1) - } - binary.LittleEndian.PutUint32(sizeBuf[:], uint32(len(outbuf.Bytes()))) - if _, err := os.Stdout.Write(sizeBuf[:]); err != nil { - fmt.Fprintln(os.Stderr, "go conformance: write response:", err) - os.Exit(1) - } - if _, err := os.Stdout.Write(outbuf.Bytes()); err != nil { - fmt.Fprintln(os.Stderr, "go conformance: write response:", err) - os.Exit(1) - } - outbuf.Reset() - } -} - -var jsonMarshaler = jsonpb.Marshaler{ - OrigName: true, -} - -func handle(req *pb.ConformanceRequest) *pb.ConformanceResponse { - var err error - var msg pb.TestAllTypes - switch p := req.Payload.(type) { - case *pb.ConformanceRequest_ProtobufPayload: - err = proto.Unmarshal(p.ProtobufPayload, &msg) - case *pb.ConformanceRequest_JsonPayload: - err = jsonpb.UnmarshalString(p.JsonPayload, &msg) - default: - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_RuntimeError{ - RuntimeError: "unknown request payload type", - }, - } - } - if err != nil { - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_ParseError{ - ParseError: err.Error(), - }, - } - } - switch req.RequestedOutputFormat { - case pb.WireFormat_PROTOBUF: - p, err := proto.Marshal(&msg) - if err != nil { - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_SerializeError{ - SerializeError: err.Error(), - }, - } - } - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_ProtobufPayload{ - ProtobufPayload: p, - }, - } - case pb.WireFormat_JSON: - p, err := jsonMarshaler.MarshalToString(&msg) - if err != nil { - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_SerializeError{ - SerializeError: err.Error(), - }, - } - } - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_JsonPayload{ - JsonPayload: p, - }, - } - default: - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_RuntimeError{ - RuntimeError: "unknown output format", - }, - } - } -} diff --git a/conformance/conformance.sh b/conformance/conformance.sh deleted file mode 100755 index 8532f57115..0000000000 --- a/conformance/conformance.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -cd $(dirname $0) -exec go run conformance.go $* diff --git a/conformance/failure_list_go.txt b/conformance/failure_list_go.txt deleted file mode 100644 index d372808967..0000000000 --- a/conformance/failure_list_go.txt +++ /dev/null @@ -1,61 +0,0 @@ -# This is the list of conformance tests that are known ot fail right now. -# TODO: These should be fixed. - -DurationProtoInputTooLarge.JsonOutput -DurationProtoInputTooSmall.JsonOutput -FieldMaskNumbersDontRoundTrip.JsonOutput -FieldMaskPathsDontRoundTrip.JsonOutput -FieldMaskTooManyUnderscore.JsonOutput -JsonInput.AnyWithFieldMask.JsonOutput -JsonInput.AnyWithFieldMask.ProtobufOutput -JsonInput.DoubleFieldQuotedValue.JsonOutput -JsonInput.DoubleFieldQuotedValue.ProtobufOutput -JsonInput.DurationHas3FractionalDigits.Validator -JsonInput.DurationHas6FractionalDigits.Validator -JsonInput.DurationHas9FractionalDigits.Validator -JsonInput.DurationHasZeroFractionalDigit.Validator -JsonInput.DurationMaxValue.JsonOutput -JsonInput.DurationMaxValue.ProtobufOutput -JsonInput.DurationMinValue.JsonOutput -JsonInput.DurationMinValue.ProtobufOutput -JsonInput.EnumFieldUnknownValue.Validator -JsonInput.FieldMask.JsonOutput -JsonInput.FieldMask.ProtobufOutput -JsonInput.FieldNameInLowerCamelCase.Validator -JsonInput.FieldNameWithMixedCases.JsonOutput -JsonInput.FieldNameWithMixedCases.ProtobufOutput -JsonInput.FieldNameWithMixedCases.Validator -JsonInput.FieldNameWithNumbers.Validator -JsonInput.FloatFieldQuotedValue.JsonOutput -JsonInput.FloatFieldQuotedValue.ProtobufOutput -JsonInput.Int32FieldExponentialFormat.JsonOutput -JsonInput.Int32FieldExponentialFormat.ProtobufOutput -JsonInput.Int32FieldFloatTrailingZero.JsonOutput -JsonInput.Int32FieldFloatTrailingZero.ProtobufOutput -JsonInput.Int32FieldMaxFloatValue.JsonOutput -JsonInput.Int32FieldMaxFloatValue.ProtobufOutput -JsonInput.Int32FieldMinFloatValue.JsonOutput -JsonInput.Int32FieldMinFloatValue.ProtobufOutput -JsonInput.Int32FieldStringValue.JsonOutput -JsonInput.Int32FieldStringValue.ProtobufOutput -JsonInput.Int32FieldStringValueEscaped.JsonOutput -JsonInput.Int32FieldStringValueEscaped.ProtobufOutput -JsonInput.Int64FieldBeString.Validator -JsonInput.MapFieldValueIsNull -JsonInput.OneofFieldDuplicate -JsonInput.RepeatedFieldMessageElementIsNull -JsonInput.RepeatedFieldPrimitiveElementIsNull -JsonInput.StringFieldSurrogateInWrongOrder -JsonInput.StringFieldUnpairedHighSurrogate -JsonInput.StringFieldUnpairedLowSurrogate -JsonInput.TimestampHas3FractionalDigits.Validator -JsonInput.TimestampHas6FractionalDigits.Validator -JsonInput.TimestampHas9FractionalDigits.Validator -JsonInput.TimestampHasZeroFractionalDigit.Validator -JsonInput.TimestampJsonInputTooSmall -JsonInput.TimestampZeroNormalized.Validator -JsonInput.Uint32FieldMaxFloatValue.JsonOutput -JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput -JsonInput.Uint64FieldBeString.Validator -TimestampProtoInputTooLarge.JsonOutput -TimestampProtoInputTooSmall.JsonOutput diff --git a/conformance/internal/conformance_proto/conformance.pb.go b/conformance/internal/conformance_proto/conformance.pb.go deleted file mode 100644 index e0136d31ef..0000000000 --- a/conformance/internal/conformance_proto/conformance.pb.go +++ /dev/null @@ -1,1603 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: conformance.proto - -package conformance - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" - duration "github.com/golang/protobuf/ptypes/duration" - _struct "github.com/golang/protobuf/ptypes/struct" - timestamp "github.com/golang/protobuf/ptypes/timestamp" - wrappers "github.com/golang/protobuf/ptypes/wrappers" - field_mask "google.golang.org/genproto/protobuf/field_mask" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type WireFormat int32 - -const ( - WireFormat_UNSPECIFIED WireFormat = 0 - WireFormat_PROTOBUF WireFormat = 1 - WireFormat_JSON WireFormat = 2 -) - -var WireFormat_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "PROTOBUF", - 2: "JSON", -} - -var WireFormat_value = map[string]int32{ - "UNSPECIFIED": 0, - "PROTOBUF": 1, - "JSON": 2, -} - -func (x WireFormat) String() string { - return proto.EnumName(WireFormat_name, int32(x)) -} - -func (WireFormat) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e7c910178d599565, []int{0} -} - -type ForeignEnum int32 - -const ( - ForeignEnum_FOREIGN_FOO ForeignEnum = 0 - ForeignEnum_FOREIGN_BAR ForeignEnum = 1 - ForeignEnum_FOREIGN_BAZ ForeignEnum = 2 -) - -var ForeignEnum_name = map[int32]string{ - 0: "FOREIGN_FOO", - 1: "FOREIGN_BAR", - 2: "FOREIGN_BAZ", -} - -var ForeignEnum_value = map[string]int32{ - "FOREIGN_FOO": 0, - "FOREIGN_BAR": 1, - "FOREIGN_BAZ": 2, -} - -func (x ForeignEnum) String() string { - return proto.EnumName(ForeignEnum_name, int32(x)) -} - -func (ForeignEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e7c910178d599565, []int{1} -} - -type TestAllTypes_NestedEnum int32 - -const ( - TestAllTypes_FOO TestAllTypes_NestedEnum = 0 - TestAllTypes_BAR TestAllTypes_NestedEnum = 1 - TestAllTypes_BAZ TestAllTypes_NestedEnum = 2 - TestAllTypes_NEG TestAllTypes_NestedEnum = -1 -) - -var TestAllTypes_NestedEnum_name = map[int32]string{ - 0: "FOO", - 1: "BAR", - 2: "BAZ", - -1: "NEG", -} - -var TestAllTypes_NestedEnum_value = map[string]int32{ - "FOO": 0, - "BAR": 1, - "BAZ": 2, - "NEG": -1, -} - -func (x TestAllTypes_NestedEnum) String() string { - return proto.EnumName(TestAllTypes_NestedEnum_name, int32(x)) -} - -func (TestAllTypes_NestedEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e7c910178d599565, []int{2, 0} -} - -// Represents a single test case's input. The testee should: -// -// 1. parse this proto (which should always succeed) -// 2. parse the protobuf or JSON payload in "payload" (which may fail) -// 3. if the parse succeeded, serialize the message in the requested format. -type ConformanceRequest struct { - // The payload (whether protobuf of JSON) is always for a TestAllTypes proto - // (see below). - // - // Types that are valid to be assigned to Payload: - // *ConformanceRequest_ProtobufPayload - // *ConformanceRequest_JsonPayload - Payload isConformanceRequest_Payload `protobuf_oneof:"payload"` - // Which format should the testee serialize its message to? - RequestedOutputFormat WireFormat `protobuf:"varint,3,opt,name=requested_output_format,json=requestedOutputFormat,proto3,enum=conformance.WireFormat" json:"requested_output_format,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ConformanceRequest) Reset() { *m = ConformanceRequest{} } -func (m *ConformanceRequest) String() string { return proto.CompactTextString(m) } -func (*ConformanceRequest) ProtoMessage() {} -func (*ConformanceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e7c910178d599565, []int{0} -} - -func (m *ConformanceRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ConformanceRequest.Unmarshal(m, b) -} -func (m *ConformanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ConformanceRequest.Marshal(b, m, deterministic) -} -func (m *ConformanceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConformanceRequest.Merge(m, src) -} -func (m *ConformanceRequest) XXX_Size() int { - return xxx_messageInfo_ConformanceRequest.Size(m) -} -func (m *ConformanceRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ConformanceRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ConformanceRequest proto.InternalMessageInfo - -type isConformanceRequest_Payload interface { - isConformanceRequest_Payload() -} - -type ConformanceRequest_ProtobufPayload struct { - ProtobufPayload []byte `protobuf:"bytes,1,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"` -} - -type ConformanceRequest_JsonPayload struct { - JsonPayload string `protobuf:"bytes,2,opt,name=json_payload,json=jsonPayload,proto3,oneof"` -} - -func (*ConformanceRequest_ProtobufPayload) isConformanceRequest_Payload() {} - -func (*ConformanceRequest_JsonPayload) isConformanceRequest_Payload() {} - -func (m *ConformanceRequest) GetPayload() isConformanceRequest_Payload { - if m != nil { - return m.Payload - } - return nil -} - -func (m *ConformanceRequest) GetProtobufPayload() []byte { - if x, ok := m.GetPayload().(*ConformanceRequest_ProtobufPayload); ok { - return x.ProtobufPayload - } - return nil -} - -func (m *ConformanceRequest) GetJsonPayload() string { - if x, ok := m.GetPayload().(*ConformanceRequest_JsonPayload); ok { - return x.JsonPayload - } - return "" -} - -func (m *ConformanceRequest) GetRequestedOutputFormat() WireFormat { - if m != nil { - return m.RequestedOutputFormat - } - return WireFormat_UNSPECIFIED -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*ConformanceRequest) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*ConformanceRequest_ProtobufPayload)(nil), - (*ConformanceRequest_JsonPayload)(nil), - } -} - -// Represents a single test case's output. -type ConformanceResponse struct { - // Types that are valid to be assigned to Result: - // This string should be set to indicate parsing failed. The string can - // provide more information about the parse error if it is available. - // - // Setting this string does not necessarily mean the testee failed the - // test. Some of the test cases are intentionally invalid input. - // *ConformanceResponse_ParseError - // If the input was successfully parsed but errors occurred when - // serializing it to the requested output format, set the error message in - // this field. - // *ConformanceResponse_SerializeError - // This should be set if some other error occurred. This will always - // indicate that the test failed. The string can provide more information - // about the failure. - // *ConformanceResponse_RuntimeError - // If the input was successfully parsed and the requested output was - // protobuf, serialize it to protobuf and set it in this field. - // *ConformanceResponse_ProtobufPayload - // If the input was successfully parsed and the requested output was JSON, - // serialize to JSON and set it in this field. - // *ConformanceResponse_JsonPayload - // For when the testee skipped the test, likely because a certain feature - // wasn't supported, like JSON input/output. - // *ConformanceResponse_Skipped - Result isConformanceResponse_Result `protobuf_oneof:"result"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ConformanceResponse) Reset() { *m = ConformanceResponse{} } -func (m *ConformanceResponse) String() string { return proto.CompactTextString(m) } -func (*ConformanceResponse) ProtoMessage() {} -func (*ConformanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e7c910178d599565, []int{1} -} - -func (m *ConformanceResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ConformanceResponse.Unmarshal(m, b) -} -func (m *ConformanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ConformanceResponse.Marshal(b, m, deterministic) -} -func (m *ConformanceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConformanceResponse.Merge(m, src) -} -func (m *ConformanceResponse) XXX_Size() int { - return xxx_messageInfo_ConformanceResponse.Size(m) -} -func (m *ConformanceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ConformanceResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ConformanceResponse proto.InternalMessageInfo - -type isConformanceResponse_Result interface { - isConformanceResponse_Result() -} - -type ConformanceResponse_ParseError struct { - ParseError string `protobuf:"bytes,1,opt,name=parse_error,json=parseError,proto3,oneof"` -} - -type ConformanceResponse_SerializeError struct { - SerializeError string `protobuf:"bytes,6,opt,name=serialize_error,json=serializeError,proto3,oneof"` -} - -type ConformanceResponse_RuntimeError struct { - RuntimeError string `protobuf:"bytes,2,opt,name=runtime_error,json=runtimeError,proto3,oneof"` -} - -type ConformanceResponse_ProtobufPayload struct { - ProtobufPayload []byte `protobuf:"bytes,3,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"` -} - -type ConformanceResponse_JsonPayload struct { - JsonPayload string `protobuf:"bytes,4,opt,name=json_payload,json=jsonPayload,proto3,oneof"` -} - -type ConformanceResponse_Skipped struct { - Skipped string `protobuf:"bytes,5,opt,name=skipped,proto3,oneof"` -} - -func (*ConformanceResponse_ParseError) isConformanceResponse_Result() {} - -func (*ConformanceResponse_SerializeError) isConformanceResponse_Result() {} - -func (*ConformanceResponse_RuntimeError) isConformanceResponse_Result() {} - -func (*ConformanceResponse_ProtobufPayload) isConformanceResponse_Result() {} - -func (*ConformanceResponse_JsonPayload) isConformanceResponse_Result() {} - -func (*ConformanceResponse_Skipped) isConformanceResponse_Result() {} - -func (m *ConformanceResponse) GetResult() isConformanceResponse_Result { - if m != nil { - return m.Result - } - return nil -} - -func (m *ConformanceResponse) GetParseError() string { - if x, ok := m.GetResult().(*ConformanceResponse_ParseError); ok { - return x.ParseError - } - return "" -} - -func (m *ConformanceResponse) GetSerializeError() string { - if x, ok := m.GetResult().(*ConformanceResponse_SerializeError); ok { - return x.SerializeError - } - return "" -} - -func (m *ConformanceResponse) GetRuntimeError() string { - if x, ok := m.GetResult().(*ConformanceResponse_RuntimeError); ok { - return x.RuntimeError - } - return "" -} - -func (m *ConformanceResponse) GetProtobufPayload() []byte { - if x, ok := m.GetResult().(*ConformanceResponse_ProtobufPayload); ok { - return x.ProtobufPayload - } - return nil -} - -func (m *ConformanceResponse) GetJsonPayload() string { - if x, ok := m.GetResult().(*ConformanceResponse_JsonPayload); ok { - return x.JsonPayload - } - return "" -} - -func (m *ConformanceResponse) GetSkipped() string { - if x, ok := m.GetResult().(*ConformanceResponse_Skipped); ok { - return x.Skipped - } - return "" -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*ConformanceResponse) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*ConformanceResponse_ParseError)(nil), - (*ConformanceResponse_SerializeError)(nil), - (*ConformanceResponse_RuntimeError)(nil), - (*ConformanceResponse_ProtobufPayload)(nil), - (*ConformanceResponse_JsonPayload)(nil), - (*ConformanceResponse_Skipped)(nil), - } -} - -// This proto includes every type of field in both singular and repeated -// forms. -type TestAllTypes struct { - // Singular - OptionalInt32 int32 `protobuf:"varint,1,opt,name=optional_int32,json=optionalInt32,proto3" json:"optional_int32,omitempty"` - OptionalInt64 int64 `protobuf:"varint,2,opt,name=optional_int64,json=optionalInt64,proto3" json:"optional_int64,omitempty"` - OptionalUint32 uint32 `protobuf:"varint,3,opt,name=optional_uint32,json=optionalUint32,proto3" json:"optional_uint32,omitempty"` - OptionalUint64 uint64 `protobuf:"varint,4,opt,name=optional_uint64,json=optionalUint64,proto3" json:"optional_uint64,omitempty"` - OptionalSint32 int32 `protobuf:"zigzag32,5,opt,name=optional_sint32,json=optionalSint32,proto3" json:"optional_sint32,omitempty"` - OptionalSint64 int64 `protobuf:"zigzag64,6,opt,name=optional_sint64,json=optionalSint64,proto3" json:"optional_sint64,omitempty"` - OptionalFixed32 uint32 `protobuf:"fixed32,7,opt,name=optional_fixed32,json=optionalFixed32,proto3" json:"optional_fixed32,omitempty"` - OptionalFixed64 uint64 `protobuf:"fixed64,8,opt,name=optional_fixed64,json=optionalFixed64,proto3" json:"optional_fixed64,omitempty"` - OptionalSfixed32 int32 `protobuf:"fixed32,9,opt,name=optional_sfixed32,json=optionalSfixed32,proto3" json:"optional_sfixed32,omitempty"` - OptionalSfixed64 int64 `protobuf:"fixed64,10,opt,name=optional_sfixed64,json=optionalSfixed64,proto3" json:"optional_sfixed64,omitempty"` - OptionalFloat float32 `protobuf:"fixed32,11,opt,name=optional_float,json=optionalFloat,proto3" json:"optional_float,omitempty"` - OptionalDouble float64 `protobuf:"fixed64,12,opt,name=optional_double,json=optionalDouble,proto3" json:"optional_double,omitempty"` - OptionalBool bool `protobuf:"varint,13,opt,name=optional_bool,json=optionalBool,proto3" json:"optional_bool,omitempty"` - OptionalString string `protobuf:"bytes,14,opt,name=optional_string,json=optionalString,proto3" json:"optional_string,omitempty"` - OptionalBytes []byte `protobuf:"bytes,15,opt,name=optional_bytes,json=optionalBytes,proto3" json:"optional_bytes,omitempty"` - OptionalNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,18,opt,name=optional_nested_message,json=optionalNestedMessage,proto3" json:"optional_nested_message,omitempty"` - OptionalForeignMessage *ForeignMessage `protobuf:"bytes,19,opt,name=optional_foreign_message,json=optionalForeignMessage,proto3" json:"optional_foreign_message,omitempty"` - OptionalNestedEnum TestAllTypes_NestedEnum `protobuf:"varint,21,opt,name=optional_nested_enum,json=optionalNestedEnum,proto3,enum=conformance.TestAllTypes_NestedEnum" json:"optional_nested_enum,omitempty"` - OptionalForeignEnum ForeignEnum `protobuf:"varint,22,opt,name=optional_foreign_enum,json=optionalForeignEnum,proto3,enum=conformance.ForeignEnum" json:"optional_foreign_enum,omitempty"` - OptionalStringPiece string `protobuf:"bytes,24,opt,name=optional_string_piece,json=optionalStringPiece,proto3" json:"optional_string_piece,omitempty"` - OptionalCord string `protobuf:"bytes,25,opt,name=optional_cord,json=optionalCord,proto3" json:"optional_cord,omitempty"` - RecursiveMessage *TestAllTypes `protobuf:"bytes,27,opt,name=recursive_message,json=recursiveMessage,proto3" json:"recursive_message,omitempty"` - // Repeated - RepeatedInt32 []int32 `protobuf:"varint,31,rep,packed,name=repeated_int32,json=repeatedInt32,proto3" json:"repeated_int32,omitempty"` - RepeatedInt64 []int64 `protobuf:"varint,32,rep,packed,name=repeated_int64,json=repeatedInt64,proto3" json:"repeated_int64,omitempty"` - RepeatedUint32 []uint32 `protobuf:"varint,33,rep,packed,name=repeated_uint32,json=repeatedUint32,proto3" json:"repeated_uint32,omitempty"` - RepeatedUint64 []uint64 `protobuf:"varint,34,rep,packed,name=repeated_uint64,json=repeatedUint64,proto3" json:"repeated_uint64,omitempty"` - RepeatedSint32 []int32 `protobuf:"zigzag32,35,rep,packed,name=repeated_sint32,json=repeatedSint32,proto3" json:"repeated_sint32,omitempty"` - RepeatedSint64 []int64 `protobuf:"zigzag64,36,rep,packed,name=repeated_sint64,json=repeatedSint64,proto3" json:"repeated_sint64,omitempty"` - RepeatedFixed32 []uint32 `protobuf:"fixed32,37,rep,packed,name=repeated_fixed32,json=repeatedFixed32,proto3" json:"repeated_fixed32,omitempty"` - RepeatedFixed64 []uint64 `protobuf:"fixed64,38,rep,packed,name=repeated_fixed64,json=repeatedFixed64,proto3" json:"repeated_fixed64,omitempty"` - RepeatedSfixed32 []int32 `protobuf:"fixed32,39,rep,packed,name=repeated_sfixed32,json=repeatedSfixed32,proto3" json:"repeated_sfixed32,omitempty"` - RepeatedSfixed64 []int64 `protobuf:"fixed64,40,rep,packed,name=repeated_sfixed64,json=repeatedSfixed64,proto3" json:"repeated_sfixed64,omitempty"` - RepeatedFloat []float32 `protobuf:"fixed32,41,rep,packed,name=repeated_float,json=repeatedFloat,proto3" json:"repeated_float,omitempty"` - RepeatedDouble []float64 `protobuf:"fixed64,42,rep,packed,name=repeated_double,json=repeatedDouble,proto3" json:"repeated_double,omitempty"` - RepeatedBool []bool `protobuf:"varint,43,rep,packed,name=repeated_bool,json=repeatedBool,proto3" json:"repeated_bool,omitempty"` - RepeatedString []string `protobuf:"bytes,44,rep,name=repeated_string,json=repeatedString,proto3" json:"repeated_string,omitempty"` - RepeatedBytes [][]byte `protobuf:"bytes,45,rep,name=repeated_bytes,json=repeatedBytes,proto3" json:"repeated_bytes,omitempty"` - RepeatedNestedMessage []*TestAllTypes_NestedMessage `protobuf:"bytes,48,rep,name=repeated_nested_message,json=repeatedNestedMessage,proto3" json:"repeated_nested_message,omitempty"` - RepeatedForeignMessage []*ForeignMessage `protobuf:"bytes,49,rep,name=repeated_foreign_message,json=repeatedForeignMessage,proto3" json:"repeated_foreign_message,omitempty"` - RepeatedNestedEnum []TestAllTypes_NestedEnum `protobuf:"varint,51,rep,packed,name=repeated_nested_enum,json=repeatedNestedEnum,proto3,enum=conformance.TestAllTypes_NestedEnum" json:"repeated_nested_enum,omitempty"` - RepeatedForeignEnum []ForeignEnum `protobuf:"varint,52,rep,packed,name=repeated_foreign_enum,json=repeatedForeignEnum,proto3,enum=conformance.ForeignEnum" json:"repeated_foreign_enum,omitempty"` - RepeatedStringPiece []string `protobuf:"bytes,54,rep,name=repeated_string_piece,json=repeatedStringPiece,proto3" json:"repeated_string_piece,omitempty"` - RepeatedCord []string `protobuf:"bytes,55,rep,name=repeated_cord,json=repeatedCord,proto3" json:"repeated_cord,omitempty"` - // Map - MapInt32Int32 map[int32]int32 `protobuf:"bytes,56,rep,name=map_int32_int32,json=mapInt32Int32,proto3" json:"map_int32_int32,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - MapInt64Int64 map[int64]int64 `protobuf:"bytes,57,rep,name=map_int64_int64,json=mapInt64Int64,proto3" json:"map_int64_int64,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - MapUint32Uint32 map[uint32]uint32 `protobuf:"bytes,58,rep,name=map_uint32_uint32,json=mapUint32Uint32,proto3" json:"map_uint32_uint32,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - MapUint64Uint64 map[uint64]uint64 `protobuf:"bytes,59,rep,name=map_uint64_uint64,json=mapUint64Uint64,proto3" json:"map_uint64_uint64,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - MapSint32Sint32 map[int32]int32 `protobuf:"bytes,60,rep,name=map_sint32_sint32,json=mapSint32Sint32,proto3" json:"map_sint32_sint32,omitempty" protobuf_key:"zigzag32,1,opt,name=key,proto3" protobuf_val:"zigzag32,2,opt,name=value,proto3"` - MapSint64Sint64 map[int64]int64 `protobuf:"bytes,61,rep,name=map_sint64_sint64,json=mapSint64Sint64,proto3" json:"map_sint64_sint64,omitempty" protobuf_key:"zigzag64,1,opt,name=key,proto3" protobuf_val:"zigzag64,2,opt,name=value,proto3"` - MapFixed32Fixed32 map[uint32]uint32 `protobuf:"bytes,62,rep,name=map_fixed32_fixed32,json=mapFixed32Fixed32,proto3" json:"map_fixed32_fixed32,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` - MapFixed64Fixed64 map[uint64]uint64 `protobuf:"bytes,63,rep,name=map_fixed64_fixed64,json=mapFixed64Fixed64,proto3" json:"map_fixed64_fixed64,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` - MapSfixed32Sfixed32 map[int32]int32 `protobuf:"bytes,64,rep,name=map_sfixed32_sfixed32,json=mapSfixed32Sfixed32,proto3" json:"map_sfixed32_sfixed32,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` - MapSfixed64Sfixed64 map[int64]int64 `protobuf:"bytes,65,rep,name=map_sfixed64_sfixed64,json=mapSfixed64Sfixed64,proto3" json:"map_sfixed64_sfixed64,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` - MapInt32Float map[int32]float32 `protobuf:"bytes,66,rep,name=map_int32_float,json=mapInt32Float,proto3" json:"map_int32_float,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` - MapInt32Double map[int32]float64 `protobuf:"bytes,67,rep,name=map_int32_double,json=mapInt32Double,proto3" json:"map_int32_double,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` - MapBoolBool map[bool]bool `protobuf:"bytes,68,rep,name=map_bool_bool,json=mapBoolBool,proto3" json:"map_bool_bool,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - MapStringString map[string]string `protobuf:"bytes,69,rep,name=map_string_string,json=mapStringString,proto3" json:"map_string_string,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - MapStringBytes map[string][]byte `protobuf:"bytes,70,rep,name=map_string_bytes,json=mapStringBytes,proto3" json:"map_string_bytes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - MapStringNestedMessage map[string]*TestAllTypes_NestedMessage `protobuf:"bytes,71,rep,name=map_string_nested_message,json=mapStringNestedMessage,proto3" json:"map_string_nested_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - MapStringForeignMessage map[string]*ForeignMessage `protobuf:"bytes,72,rep,name=map_string_foreign_message,json=mapStringForeignMessage,proto3" json:"map_string_foreign_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - MapStringNestedEnum map[string]TestAllTypes_NestedEnum `protobuf:"bytes,73,rep,name=map_string_nested_enum,json=mapStringNestedEnum,proto3" json:"map_string_nested_enum,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=conformance.TestAllTypes_NestedEnum"` - MapStringForeignEnum map[string]ForeignEnum `protobuf:"bytes,74,rep,name=map_string_foreign_enum,json=mapStringForeignEnum,proto3" json:"map_string_foreign_enum,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=conformance.ForeignEnum"` - // Types that are valid to be assigned to OneofField: - // *TestAllTypes_OneofUint32 - // *TestAllTypes_OneofNestedMessage - // *TestAllTypes_OneofString - // *TestAllTypes_OneofBytes - OneofField isTestAllTypes_OneofField `protobuf_oneof:"oneof_field"` - // Well-known types - OptionalBoolWrapper *wrappers.BoolValue `protobuf:"bytes,201,opt,name=optional_bool_wrapper,json=optionalBoolWrapper,proto3" json:"optional_bool_wrapper,omitempty"` - OptionalInt32Wrapper *wrappers.Int32Value `protobuf:"bytes,202,opt,name=optional_int32_wrapper,json=optionalInt32Wrapper,proto3" json:"optional_int32_wrapper,omitempty"` - OptionalInt64Wrapper *wrappers.Int64Value `protobuf:"bytes,203,opt,name=optional_int64_wrapper,json=optionalInt64Wrapper,proto3" json:"optional_int64_wrapper,omitempty"` - OptionalUint32Wrapper *wrappers.UInt32Value `protobuf:"bytes,204,opt,name=optional_uint32_wrapper,json=optionalUint32Wrapper,proto3" json:"optional_uint32_wrapper,omitempty"` - OptionalUint64Wrapper *wrappers.UInt64Value `protobuf:"bytes,205,opt,name=optional_uint64_wrapper,json=optionalUint64Wrapper,proto3" json:"optional_uint64_wrapper,omitempty"` - OptionalFloatWrapper *wrappers.FloatValue `protobuf:"bytes,206,opt,name=optional_float_wrapper,json=optionalFloatWrapper,proto3" json:"optional_float_wrapper,omitempty"` - OptionalDoubleWrapper *wrappers.DoubleValue `protobuf:"bytes,207,opt,name=optional_double_wrapper,json=optionalDoubleWrapper,proto3" json:"optional_double_wrapper,omitempty"` - OptionalStringWrapper *wrappers.StringValue `protobuf:"bytes,208,opt,name=optional_string_wrapper,json=optionalStringWrapper,proto3" json:"optional_string_wrapper,omitempty"` - OptionalBytesWrapper *wrappers.BytesValue `protobuf:"bytes,209,opt,name=optional_bytes_wrapper,json=optionalBytesWrapper,proto3" json:"optional_bytes_wrapper,omitempty"` - RepeatedBoolWrapper []*wrappers.BoolValue `protobuf:"bytes,211,rep,name=repeated_bool_wrapper,json=repeatedBoolWrapper,proto3" json:"repeated_bool_wrapper,omitempty"` - RepeatedInt32Wrapper []*wrappers.Int32Value `protobuf:"bytes,212,rep,name=repeated_int32_wrapper,json=repeatedInt32Wrapper,proto3" json:"repeated_int32_wrapper,omitempty"` - RepeatedInt64Wrapper []*wrappers.Int64Value `protobuf:"bytes,213,rep,name=repeated_int64_wrapper,json=repeatedInt64Wrapper,proto3" json:"repeated_int64_wrapper,omitempty"` - RepeatedUint32Wrapper []*wrappers.UInt32Value `protobuf:"bytes,214,rep,name=repeated_uint32_wrapper,json=repeatedUint32Wrapper,proto3" json:"repeated_uint32_wrapper,omitempty"` - RepeatedUint64Wrapper []*wrappers.UInt64Value `protobuf:"bytes,215,rep,name=repeated_uint64_wrapper,json=repeatedUint64Wrapper,proto3" json:"repeated_uint64_wrapper,omitempty"` - RepeatedFloatWrapper []*wrappers.FloatValue `protobuf:"bytes,216,rep,name=repeated_float_wrapper,json=repeatedFloatWrapper,proto3" json:"repeated_float_wrapper,omitempty"` - RepeatedDoubleWrapper []*wrappers.DoubleValue `protobuf:"bytes,217,rep,name=repeated_double_wrapper,json=repeatedDoubleWrapper,proto3" json:"repeated_double_wrapper,omitempty"` - RepeatedStringWrapper []*wrappers.StringValue `protobuf:"bytes,218,rep,name=repeated_string_wrapper,json=repeatedStringWrapper,proto3" json:"repeated_string_wrapper,omitempty"` - RepeatedBytesWrapper []*wrappers.BytesValue `protobuf:"bytes,219,rep,name=repeated_bytes_wrapper,json=repeatedBytesWrapper,proto3" json:"repeated_bytes_wrapper,omitempty"` - OptionalDuration *duration.Duration `protobuf:"bytes,301,opt,name=optional_duration,json=optionalDuration,proto3" json:"optional_duration,omitempty"` - OptionalTimestamp *timestamp.Timestamp `protobuf:"bytes,302,opt,name=optional_timestamp,json=optionalTimestamp,proto3" json:"optional_timestamp,omitempty"` - OptionalFieldMask *field_mask.FieldMask `protobuf:"bytes,303,opt,name=optional_field_mask,json=optionalFieldMask,proto3" json:"optional_field_mask,omitempty"` - OptionalStruct *_struct.Struct `protobuf:"bytes,304,opt,name=optional_struct,json=optionalStruct,proto3" json:"optional_struct,omitempty"` - OptionalAny *any.Any `protobuf:"bytes,305,opt,name=optional_any,json=optionalAny,proto3" json:"optional_any,omitempty"` - OptionalValue *_struct.Value `protobuf:"bytes,306,opt,name=optional_value,json=optionalValue,proto3" json:"optional_value,omitempty"` - RepeatedDuration []*duration.Duration `protobuf:"bytes,311,rep,name=repeated_duration,json=repeatedDuration,proto3" json:"repeated_duration,omitempty"` - RepeatedTimestamp []*timestamp.Timestamp `protobuf:"bytes,312,rep,name=repeated_timestamp,json=repeatedTimestamp,proto3" json:"repeated_timestamp,omitempty"` - RepeatedFieldmask []*field_mask.FieldMask `protobuf:"bytes,313,rep,name=repeated_fieldmask,json=repeatedFieldmask,proto3" json:"repeated_fieldmask,omitempty"` - RepeatedStruct []*_struct.Struct `protobuf:"bytes,324,rep,name=repeated_struct,json=repeatedStruct,proto3" json:"repeated_struct,omitempty"` - RepeatedAny []*any.Any `protobuf:"bytes,315,rep,name=repeated_any,json=repeatedAny,proto3" json:"repeated_any,omitempty"` - RepeatedValue []*_struct.Value `protobuf:"bytes,316,rep,name=repeated_value,json=repeatedValue,proto3" json:"repeated_value,omitempty"` - // Test field-name-to-JSON-name convention. - Fieldname1 int32 `protobuf:"varint,401,opt,name=fieldname1,proto3" json:"fieldname1,omitempty"` - FieldName2 int32 `protobuf:"varint,402,opt,name=field_name2,json=fieldName2,proto3" json:"field_name2,omitempty"` - XFieldName3 int32 `protobuf:"varint,403,opt,name=_field_name3,json=FieldName3,proto3" json:"_field_name3,omitempty"` - Field_Name4_ int32 `protobuf:"varint,404,opt,name=field__name4_,json=fieldName4,proto3" json:"field__name4_,omitempty"` - Field0Name5 int32 `protobuf:"varint,405,opt,name=field0name5,proto3" json:"field0name5,omitempty"` - Field_0Name6 int32 `protobuf:"varint,406,opt,name=field_0_name6,json=field0Name6,proto3" json:"field_0_name6,omitempty"` - FieldName7 int32 `protobuf:"varint,407,opt,name=fieldName7,proto3" json:"fieldName7,omitempty"` - FieldName8 int32 `protobuf:"varint,408,opt,name=FieldName8,proto3" json:"FieldName8,omitempty"` - Field_Name9 int32 `protobuf:"varint,409,opt,name=field_Name9,json=fieldName9,proto3" json:"field_Name9,omitempty"` - Field_Name10 int32 `protobuf:"varint,410,opt,name=Field_Name10,json=FieldName10,proto3" json:"Field_Name10,omitempty"` - FIELD_NAME11 int32 `protobuf:"varint,411,opt,name=FIELD_NAME11,json=FIELDNAME11,proto3" json:"FIELD_NAME11,omitempty"` - FIELDName12 int32 `protobuf:"varint,412,opt,name=FIELD_name12,json=FIELDName12,proto3" json:"FIELD_name12,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TestAllTypes) Reset() { *m = TestAllTypes{} } -func (m *TestAllTypes) String() string { return proto.CompactTextString(m) } -func (*TestAllTypes) ProtoMessage() {} -func (*TestAllTypes) Descriptor() ([]byte, []int) { - return fileDescriptor_e7c910178d599565, []int{2} -} - -func (m *TestAllTypes) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TestAllTypes.Unmarshal(m, b) -} -func (m *TestAllTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TestAllTypes.Marshal(b, m, deterministic) -} -func (m *TestAllTypes) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestAllTypes.Merge(m, src) -} -func (m *TestAllTypes) XXX_Size() int { - return xxx_messageInfo_TestAllTypes.Size(m) -} -func (m *TestAllTypes) XXX_DiscardUnknown() { - xxx_messageInfo_TestAllTypes.DiscardUnknown(m) -} - -var xxx_messageInfo_TestAllTypes proto.InternalMessageInfo - -func (m *TestAllTypes) GetOptionalInt32() int32 { - if m != nil { - return m.OptionalInt32 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalInt64() int64 { - if m != nil { - return m.OptionalInt64 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalUint32() uint32 { - if m != nil { - return m.OptionalUint32 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalUint64() uint64 { - if m != nil { - return m.OptionalUint64 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalSint32() int32 { - if m != nil { - return m.OptionalSint32 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalSint64() int64 { - if m != nil { - return m.OptionalSint64 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalFixed32() uint32 { - if m != nil { - return m.OptionalFixed32 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalFixed64() uint64 { - if m != nil { - return m.OptionalFixed64 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalSfixed32() int32 { - if m != nil { - return m.OptionalSfixed32 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalSfixed64() int64 { - if m != nil { - return m.OptionalSfixed64 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalFloat() float32 { - if m != nil { - return m.OptionalFloat - } - return 0 -} - -func (m *TestAllTypes) GetOptionalDouble() float64 { - if m != nil { - return m.OptionalDouble - } - return 0 -} - -func (m *TestAllTypes) GetOptionalBool() bool { - if m != nil { - return m.OptionalBool - } - return false -} - -func (m *TestAllTypes) GetOptionalString() string { - if m != nil { - return m.OptionalString - } - return "" -} - -func (m *TestAllTypes) GetOptionalBytes() []byte { - if m != nil { - return m.OptionalBytes - } - return nil -} - -func (m *TestAllTypes) GetOptionalNestedMessage() *TestAllTypes_NestedMessage { - if m != nil { - return m.OptionalNestedMessage - } - return nil -} - -func (m *TestAllTypes) GetOptionalForeignMessage() *ForeignMessage { - if m != nil { - return m.OptionalForeignMessage - } - return nil -} - -func (m *TestAllTypes) GetOptionalNestedEnum() TestAllTypes_NestedEnum { - if m != nil { - return m.OptionalNestedEnum - } - return TestAllTypes_FOO -} - -func (m *TestAllTypes) GetOptionalForeignEnum() ForeignEnum { - if m != nil { - return m.OptionalForeignEnum - } - return ForeignEnum_FOREIGN_FOO -} - -func (m *TestAllTypes) GetOptionalStringPiece() string { - if m != nil { - return m.OptionalStringPiece - } - return "" -} - -func (m *TestAllTypes) GetOptionalCord() string { - if m != nil { - return m.OptionalCord - } - return "" -} - -func (m *TestAllTypes) GetRecursiveMessage() *TestAllTypes { - if m != nil { - return m.RecursiveMessage - } - return nil -} - -func (m *TestAllTypes) GetRepeatedInt32() []int32 { - if m != nil { - return m.RepeatedInt32 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedInt64() []int64 { - if m != nil { - return m.RepeatedInt64 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedUint32() []uint32 { - if m != nil { - return m.RepeatedUint32 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedUint64() []uint64 { - if m != nil { - return m.RepeatedUint64 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedSint32() []int32 { - if m != nil { - return m.RepeatedSint32 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedSint64() []int64 { - if m != nil { - return m.RepeatedSint64 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedFixed32() []uint32 { - if m != nil { - return m.RepeatedFixed32 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedFixed64() []uint64 { - if m != nil { - return m.RepeatedFixed64 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedSfixed32() []int32 { - if m != nil { - return m.RepeatedSfixed32 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedSfixed64() []int64 { - if m != nil { - return m.RepeatedSfixed64 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedFloat() []float32 { - if m != nil { - return m.RepeatedFloat - } - return nil -} - -func (m *TestAllTypes) GetRepeatedDouble() []float64 { - if m != nil { - return m.RepeatedDouble - } - return nil -} - -func (m *TestAllTypes) GetRepeatedBool() []bool { - if m != nil { - return m.RepeatedBool - } - return nil -} - -func (m *TestAllTypes) GetRepeatedString() []string { - if m != nil { - return m.RepeatedString - } - return nil -} - -func (m *TestAllTypes) GetRepeatedBytes() [][]byte { - if m != nil { - return m.RepeatedBytes - } - return nil -} - -func (m *TestAllTypes) GetRepeatedNestedMessage() []*TestAllTypes_NestedMessage { - if m != nil { - return m.RepeatedNestedMessage - } - return nil -} - -func (m *TestAllTypes) GetRepeatedForeignMessage() []*ForeignMessage { - if m != nil { - return m.RepeatedForeignMessage - } - return nil -} - -func (m *TestAllTypes) GetRepeatedNestedEnum() []TestAllTypes_NestedEnum { - if m != nil { - return m.RepeatedNestedEnum - } - return nil -} - -func (m *TestAllTypes) GetRepeatedForeignEnum() []ForeignEnum { - if m != nil { - return m.RepeatedForeignEnum - } - return nil -} - -func (m *TestAllTypes) GetRepeatedStringPiece() []string { - if m != nil { - return m.RepeatedStringPiece - } - return nil -} - -func (m *TestAllTypes) GetRepeatedCord() []string { - if m != nil { - return m.RepeatedCord - } - return nil -} - -func (m *TestAllTypes) GetMapInt32Int32() map[int32]int32 { - if m != nil { - return m.MapInt32Int32 - } - return nil -} - -func (m *TestAllTypes) GetMapInt64Int64() map[int64]int64 { - if m != nil { - return m.MapInt64Int64 - } - return nil -} - -func (m *TestAllTypes) GetMapUint32Uint32() map[uint32]uint32 { - if m != nil { - return m.MapUint32Uint32 - } - return nil -} - -func (m *TestAllTypes) GetMapUint64Uint64() map[uint64]uint64 { - if m != nil { - return m.MapUint64Uint64 - } - return nil -} - -func (m *TestAllTypes) GetMapSint32Sint32() map[int32]int32 { - if m != nil { - return m.MapSint32Sint32 - } - return nil -} - -func (m *TestAllTypes) GetMapSint64Sint64() map[int64]int64 { - if m != nil { - return m.MapSint64Sint64 - } - return nil -} - -func (m *TestAllTypes) GetMapFixed32Fixed32() map[uint32]uint32 { - if m != nil { - return m.MapFixed32Fixed32 - } - return nil -} - -func (m *TestAllTypes) GetMapFixed64Fixed64() map[uint64]uint64 { - if m != nil { - return m.MapFixed64Fixed64 - } - return nil -} - -func (m *TestAllTypes) GetMapSfixed32Sfixed32() map[int32]int32 { - if m != nil { - return m.MapSfixed32Sfixed32 - } - return nil -} - -func (m *TestAllTypes) GetMapSfixed64Sfixed64() map[int64]int64 { - if m != nil { - return m.MapSfixed64Sfixed64 - } - return nil -} - -func (m *TestAllTypes) GetMapInt32Float() map[int32]float32 { - if m != nil { - return m.MapInt32Float - } - return nil -} - -func (m *TestAllTypes) GetMapInt32Double() map[int32]float64 { - if m != nil { - return m.MapInt32Double - } - return nil -} - -func (m *TestAllTypes) GetMapBoolBool() map[bool]bool { - if m != nil { - return m.MapBoolBool - } - return nil -} - -func (m *TestAllTypes) GetMapStringString() map[string]string { - if m != nil { - return m.MapStringString - } - return nil -} - -func (m *TestAllTypes) GetMapStringBytes() map[string][]byte { - if m != nil { - return m.MapStringBytes - } - return nil -} - -func (m *TestAllTypes) GetMapStringNestedMessage() map[string]*TestAllTypes_NestedMessage { - if m != nil { - return m.MapStringNestedMessage - } - return nil -} - -func (m *TestAllTypes) GetMapStringForeignMessage() map[string]*ForeignMessage { - if m != nil { - return m.MapStringForeignMessage - } - return nil -} - -func (m *TestAllTypes) GetMapStringNestedEnum() map[string]TestAllTypes_NestedEnum { - if m != nil { - return m.MapStringNestedEnum - } - return nil -} - -func (m *TestAllTypes) GetMapStringForeignEnum() map[string]ForeignEnum { - if m != nil { - return m.MapStringForeignEnum - } - return nil -} - -type isTestAllTypes_OneofField interface { - isTestAllTypes_OneofField() -} - -type TestAllTypes_OneofUint32 struct { - OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,proto3,oneof"` -} - -type TestAllTypes_OneofNestedMessage struct { - OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,proto3,oneof"` -} - -type TestAllTypes_OneofString struct { - OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,proto3,oneof"` -} - -type TestAllTypes_OneofBytes struct { - OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof"` -} - -func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField() {} - -func (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {} - -func (*TestAllTypes_OneofString) isTestAllTypes_OneofField() {} - -func (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField() {} - -func (m *TestAllTypes) GetOneofField() isTestAllTypes_OneofField { - if m != nil { - return m.OneofField - } - return nil -} - -func (m *TestAllTypes) GetOneofUint32() uint32 { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofUint32); ok { - return x.OneofUint32 - } - return 0 -} - -func (m *TestAllTypes) GetOneofNestedMessage() *TestAllTypes_NestedMessage { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofNestedMessage); ok { - return x.OneofNestedMessage - } - return nil -} - -func (m *TestAllTypes) GetOneofString() string { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofString); ok { - return x.OneofString - } - return "" -} - -func (m *TestAllTypes) GetOneofBytes() []byte { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofBytes); ok { - return x.OneofBytes - } - return nil -} - -func (m *TestAllTypes) GetOptionalBoolWrapper() *wrappers.BoolValue { - if m != nil { - return m.OptionalBoolWrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalInt32Wrapper() *wrappers.Int32Value { - if m != nil { - return m.OptionalInt32Wrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalInt64Wrapper() *wrappers.Int64Value { - if m != nil { - return m.OptionalInt64Wrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalUint32Wrapper() *wrappers.UInt32Value { - if m != nil { - return m.OptionalUint32Wrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalUint64Wrapper() *wrappers.UInt64Value { - if m != nil { - return m.OptionalUint64Wrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalFloatWrapper() *wrappers.FloatValue { - if m != nil { - return m.OptionalFloatWrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalDoubleWrapper() *wrappers.DoubleValue { - if m != nil { - return m.OptionalDoubleWrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalStringWrapper() *wrappers.StringValue { - if m != nil { - return m.OptionalStringWrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalBytesWrapper() *wrappers.BytesValue { - if m != nil { - return m.OptionalBytesWrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedBoolWrapper() []*wrappers.BoolValue { - if m != nil { - return m.RepeatedBoolWrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedInt32Wrapper() []*wrappers.Int32Value { - if m != nil { - return m.RepeatedInt32Wrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedInt64Wrapper() []*wrappers.Int64Value { - if m != nil { - return m.RepeatedInt64Wrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedUint32Wrapper() []*wrappers.UInt32Value { - if m != nil { - return m.RepeatedUint32Wrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedUint64Wrapper() []*wrappers.UInt64Value { - if m != nil { - return m.RepeatedUint64Wrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedFloatWrapper() []*wrappers.FloatValue { - if m != nil { - return m.RepeatedFloatWrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedDoubleWrapper() []*wrappers.DoubleValue { - if m != nil { - return m.RepeatedDoubleWrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedStringWrapper() []*wrappers.StringValue { - if m != nil { - return m.RepeatedStringWrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedBytesWrapper() []*wrappers.BytesValue { - if m != nil { - return m.RepeatedBytesWrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalDuration() *duration.Duration { - if m != nil { - return m.OptionalDuration - } - return nil -} - -func (m *TestAllTypes) GetOptionalTimestamp() *timestamp.Timestamp { - if m != nil { - return m.OptionalTimestamp - } - return nil -} - -func (m *TestAllTypes) GetOptionalFieldMask() *field_mask.FieldMask { - if m != nil { - return m.OptionalFieldMask - } - return nil -} - -func (m *TestAllTypes) GetOptionalStruct() *_struct.Struct { - if m != nil { - return m.OptionalStruct - } - return nil -} - -func (m *TestAllTypes) GetOptionalAny() *any.Any { - if m != nil { - return m.OptionalAny - } - return nil -} - -func (m *TestAllTypes) GetOptionalValue() *_struct.Value { - if m != nil { - return m.OptionalValue - } - return nil -} - -func (m *TestAllTypes) GetRepeatedDuration() []*duration.Duration { - if m != nil { - return m.RepeatedDuration - } - return nil -} - -func (m *TestAllTypes) GetRepeatedTimestamp() []*timestamp.Timestamp { - if m != nil { - return m.RepeatedTimestamp - } - return nil -} - -func (m *TestAllTypes) GetRepeatedFieldmask() []*field_mask.FieldMask { - if m != nil { - return m.RepeatedFieldmask - } - return nil -} - -func (m *TestAllTypes) GetRepeatedStruct() []*_struct.Struct { - if m != nil { - return m.RepeatedStruct - } - return nil -} - -func (m *TestAllTypes) GetRepeatedAny() []*any.Any { - if m != nil { - return m.RepeatedAny - } - return nil -} - -func (m *TestAllTypes) GetRepeatedValue() []*_struct.Value { - if m != nil { - return m.RepeatedValue - } - return nil -} - -func (m *TestAllTypes) GetFieldname1() int32 { - if m != nil { - return m.Fieldname1 - } - return 0 -} - -func (m *TestAllTypes) GetFieldName2() int32 { - if m != nil { - return m.FieldName2 - } - return 0 -} - -func (m *TestAllTypes) GetXFieldName3() int32 { - if m != nil { - return m.XFieldName3 - } - return 0 -} - -func (m *TestAllTypes) GetField_Name4_() int32 { - if m != nil { - return m.Field_Name4_ - } - return 0 -} - -func (m *TestAllTypes) GetField0Name5() int32 { - if m != nil { - return m.Field0Name5 - } - return 0 -} - -func (m *TestAllTypes) GetField_0Name6() int32 { - if m != nil { - return m.Field_0Name6 - } - return 0 -} - -func (m *TestAllTypes) GetFieldName7() int32 { - if m != nil { - return m.FieldName7 - } - return 0 -} - -func (m *TestAllTypes) GetFieldName8() int32 { - if m != nil { - return m.FieldName8 - } - return 0 -} - -func (m *TestAllTypes) GetField_Name9() int32 { - if m != nil { - return m.Field_Name9 - } - return 0 -} - -func (m *TestAllTypes) GetField_Name10() int32 { - if m != nil { - return m.Field_Name10 - } - return 0 -} - -func (m *TestAllTypes) GetFIELD_NAME11() int32 { - if m != nil { - return m.FIELD_NAME11 - } - return 0 -} - -func (m *TestAllTypes) GetFIELDName12() int32 { - if m != nil { - return m.FIELDName12 - } - return 0 -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*TestAllTypes) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*TestAllTypes_OneofUint32)(nil), - (*TestAllTypes_OneofNestedMessage)(nil), - (*TestAllTypes_OneofString)(nil), - (*TestAllTypes_OneofBytes)(nil), - } -} - -type TestAllTypes_NestedMessage struct { - A int32 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"` - Corecursive *TestAllTypes `protobuf:"bytes,2,opt,name=corecursive,proto3" json:"corecursive,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TestAllTypes_NestedMessage) Reset() { *m = TestAllTypes_NestedMessage{} } -func (m *TestAllTypes_NestedMessage) String() string { return proto.CompactTextString(m) } -func (*TestAllTypes_NestedMessage) ProtoMessage() {} -func (*TestAllTypes_NestedMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_e7c910178d599565, []int{2, 0} -} - -func (m *TestAllTypes_NestedMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TestAllTypes_NestedMessage.Unmarshal(m, b) -} -func (m *TestAllTypes_NestedMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TestAllTypes_NestedMessage.Marshal(b, m, deterministic) -} -func (m *TestAllTypes_NestedMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestAllTypes_NestedMessage.Merge(m, src) -} -func (m *TestAllTypes_NestedMessage) XXX_Size() int { - return xxx_messageInfo_TestAllTypes_NestedMessage.Size(m) -} -func (m *TestAllTypes_NestedMessage) XXX_DiscardUnknown() { - xxx_messageInfo_TestAllTypes_NestedMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_TestAllTypes_NestedMessage proto.InternalMessageInfo - -func (m *TestAllTypes_NestedMessage) GetA() int32 { - if m != nil { - return m.A - } - return 0 -} - -func (m *TestAllTypes_NestedMessage) GetCorecursive() *TestAllTypes { - if m != nil { - return m.Corecursive - } - return nil -} - -type ForeignMessage struct { - C int32 `protobuf:"varint,1,opt,name=c,proto3" json:"c,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ForeignMessage) Reset() { *m = ForeignMessage{} } -func (m *ForeignMessage) String() string { return proto.CompactTextString(m) } -func (*ForeignMessage) ProtoMessage() {} -func (*ForeignMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_e7c910178d599565, []int{3} -} - -func (m *ForeignMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ForeignMessage.Unmarshal(m, b) -} -func (m *ForeignMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ForeignMessage.Marshal(b, m, deterministic) -} -func (m *ForeignMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_ForeignMessage.Merge(m, src) -} -func (m *ForeignMessage) XXX_Size() int { - return xxx_messageInfo_ForeignMessage.Size(m) -} -func (m *ForeignMessage) XXX_DiscardUnknown() { - xxx_messageInfo_ForeignMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_ForeignMessage proto.InternalMessageInfo - -func (m *ForeignMessage) GetC() int32 { - if m != nil { - return m.C - } - return 0 -} - -func init() { - proto.RegisterEnum("conformance.WireFormat", WireFormat_name, WireFormat_value) - proto.RegisterEnum("conformance.ForeignEnum", ForeignEnum_name, ForeignEnum_value) - proto.RegisterEnum("conformance.TestAllTypes_NestedEnum", TestAllTypes_NestedEnum_name, TestAllTypes_NestedEnum_value) - proto.RegisterType((*ConformanceRequest)(nil), "conformance.ConformanceRequest") - proto.RegisterType((*ConformanceResponse)(nil), "conformance.ConformanceResponse") - proto.RegisterType((*TestAllTypes)(nil), "conformance.TestAllTypes") - proto.RegisterMapType((map[bool]bool)(nil), "conformance.TestAllTypes.MapBoolBoolEntry") - proto.RegisterMapType((map[uint32]uint32)(nil), "conformance.TestAllTypes.MapFixed32Fixed32Entry") - proto.RegisterMapType((map[uint64]uint64)(nil), "conformance.TestAllTypes.MapFixed64Fixed64Entry") - proto.RegisterMapType((map[int32]float64)(nil), "conformance.TestAllTypes.MapInt32DoubleEntry") - proto.RegisterMapType((map[int32]float32)(nil), "conformance.TestAllTypes.MapInt32FloatEntry") - proto.RegisterMapType((map[int32]int32)(nil), "conformance.TestAllTypes.MapInt32Int32Entry") - proto.RegisterMapType((map[int64]int64)(nil), "conformance.TestAllTypes.MapInt64Int64Entry") - proto.RegisterMapType((map[int32]int32)(nil), "conformance.TestAllTypes.MapSfixed32Sfixed32Entry") - proto.RegisterMapType((map[int64]int64)(nil), "conformance.TestAllTypes.MapSfixed64Sfixed64Entry") - proto.RegisterMapType((map[int32]int32)(nil), "conformance.TestAllTypes.MapSint32Sint32Entry") - proto.RegisterMapType((map[int64]int64)(nil), "conformance.TestAllTypes.MapSint64Sint64Entry") - proto.RegisterMapType((map[string][]byte)(nil), "conformance.TestAllTypes.MapStringBytesEntry") - proto.RegisterMapType((map[string]ForeignEnum)(nil), "conformance.TestAllTypes.MapStringForeignEnumEntry") - proto.RegisterMapType((map[string]*ForeignMessage)(nil), "conformance.TestAllTypes.MapStringForeignMessageEntry") - proto.RegisterMapType((map[string]TestAllTypes_NestedEnum)(nil), "conformance.TestAllTypes.MapStringNestedEnumEntry") - proto.RegisterMapType((map[string]*TestAllTypes_NestedMessage)(nil), "conformance.TestAllTypes.MapStringNestedMessageEntry") - proto.RegisterMapType((map[string]string)(nil), "conformance.TestAllTypes.MapStringStringEntry") - proto.RegisterMapType((map[uint32]uint32)(nil), "conformance.TestAllTypes.MapUint32Uint32Entry") - proto.RegisterMapType((map[uint64]uint64)(nil), "conformance.TestAllTypes.MapUint64Uint64Entry") - proto.RegisterType((*TestAllTypes_NestedMessage)(nil), "conformance.TestAllTypes.NestedMessage") - proto.RegisterType((*ForeignMessage)(nil), "conformance.ForeignMessage") -} - -func init() { proto.RegisterFile("conformance.proto", fileDescriptor_e7c910178d599565) } - -var fileDescriptor_e7c910178d599565 = []byte{ - // 2600 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5a, 0x5b, 0x73, 0x13, 0xc9, - 0x15, 0xf6, 0x68, 0xc0, 0x36, 0x2d, 0xd9, 0x96, 0xdb, 0xb7, 0xc6, 0x50, 0xcb, 0x60, 0x96, 0x20, - 0x60, 0xd7, 0xeb, 0xcb, 0x30, 0x5c, 0x36, 0x4b, 0xb0, 0xc0, 0x02, 0x93, 0xc5, 0xa2, 0xc6, 0x78, - 0xa9, 0x22, 0x0f, 0xca, 0x20, 0x8f, 0x5d, 0x5a, 0x24, 0x8d, 0x76, 0x66, 0xb4, 0x89, 0xf3, 0x98, - 0x7f, 0x90, 0xfb, 0xf5, 0x2f, 0xe4, 0x5a, 0x95, 0x4a, 0x52, 0xc9, 0x53, 0x2a, 0x2f, 0xb9, 0x27, - 0x95, 0x7b, 0xf2, 0x63, 0x92, 0xea, 0xeb, 0x74, 0xb7, 0x7a, 0x64, 0xb1, 0x55, 0x2b, 0x5b, 0xa7, - 0xbf, 0xfe, 0xce, 0xe9, 0xd3, 0x67, 0xbe, 0x76, 0x9f, 0x01, 0xcc, 0x36, 0xa3, 0xee, 0x61, 0x14, - 0x77, 0x82, 0x6e, 0x33, 0x5c, 0xed, 0xc5, 0x51, 0x1a, 0xc1, 0xa2, 0x64, 0x5a, 0x3e, 0x7b, 0x14, - 0x45, 0x47, 0xed, 0xf0, 0x1d, 0x32, 0xf4, 0xb2, 0x7f, 0xf8, 0x4e, 0xd0, 0x3d, 0xa6, 0xb8, 0xe5, - 0x37, 0xf4, 0xa1, 0x83, 0x7e, 0x1c, 0xa4, 0xad, 0xa8, 0xcb, 0xc6, 0x1d, 0x7d, 0xfc, 0xb0, 0x15, - 0xb6, 0x0f, 0x1a, 0x9d, 0x20, 0x79, 0xc5, 0x10, 0xe7, 0x75, 0x44, 0x92, 0xc6, 0xfd, 0x66, 0xca, - 0x46, 0x2f, 0xe8, 0xa3, 0x69, 0xab, 0x13, 0x26, 0x69, 0xd0, 0xe9, 0xe5, 0x05, 0xf0, 0xb9, 0x38, - 0xe8, 0xf5, 0xc2, 0x38, 0xa1, 0xe3, 0x2b, 0xbf, 0xb2, 0x00, 0xbc, 0x9f, 0xad, 0xc5, 0x0f, 0x3f, - 0xea, 0x87, 0x49, 0x0a, 0xaf, 0x83, 0x32, 0x9f, 0xd1, 0xe8, 0x05, 0xc7, 0xed, 0x28, 0x38, 0x40, - 0x96, 0x63, 0x55, 0x4a, 0x8f, 0xc6, 0xfc, 0x19, 0x3e, 0xf2, 0x94, 0x0e, 0xc0, 0x4b, 0xa0, 0xf4, - 0x61, 0x12, 0x75, 0x05, 0xb0, 0xe0, 0x58, 0x95, 0x33, 0x8f, 0xc6, 0xfc, 0x22, 0xb6, 0x72, 0x50, - 0x1d, 0x2c, 0xc5, 0x94, 0x3c, 0x3c, 0x68, 0x44, 0xfd, 0xb4, 0xd7, 0x4f, 0x1b, 0xc4, 0x6b, 0x8a, - 0x6c, 0xc7, 0xaa, 0x4c, 0x6f, 0x2c, 0xad, 0xca, 0x69, 0x7e, 0xde, 0x8a, 0xc3, 0x1a, 0x19, 0xf6, - 0x17, 0xc4, 0xbc, 0x3a, 0x99, 0x46, 0xcd, 0xd5, 0x33, 0x60, 0x82, 0x39, 0x5c, 0xf9, 0x62, 0x01, - 0xcc, 0x29, 0x8b, 0x48, 0x7a, 0x51, 0x37, 0x09, 0xe1, 0x45, 0x50, 0xec, 0x05, 0x71, 0x12, 0x36, - 0xc2, 0x38, 0x8e, 0x62, 0xb2, 0x00, 0x1c, 0x17, 0x20, 0xc6, 0x6d, 0x6c, 0x83, 0x57, 0xc1, 0x4c, - 0x12, 0xc6, 0xad, 0xa0, 0xdd, 0xfa, 0x02, 0x87, 0x8d, 0x33, 0xd8, 0xb4, 0x18, 0xa0, 0xd0, 0xcb, - 0x60, 0x2a, 0xee, 0x77, 0x71, 0x82, 0x19, 0x90, 0xaf, 0xb3, 0xc4, 0xcc, 0x14, 0x66, 0x4a, 0x9d, - 0x3d, 0x6a, 0xea, 0x4e, 0x99, 0x52, 0xb7, 0x0c, 0x26, 0x92, 0x57, 0xad, 0x5e, 0x2f, 0x3c, 0x40, - 0xa7, 0xd9, 0x38, 0x37, 0x54, 0x27, 0xc1, 0x78, 0x1c, 0x26, 0xfd, 0x76, 0xba, 0xf2, 0x93, 0xfb, - 0xa0, 0xf4, 0x2c, 0x4c, 0xd2, 0xad, 0x76, 0xfb, 0xd9, 0x71, 0x2f, 0x4c, 0xe0, 0x65, 0x30, 0x1d, - 0xf5, 0x70, 0xad, 0x05, 0xed, 0x46, 0xab, 0x9b, 0x6e, 0x6e, 0x90, 0x04, 0x9c, 0xf6, 0xa7, 0xb8, - 0x75, 0x07, 0x1b, 0x75, 0x98, 0xe7, 0x92, 0x75, 0xd9, 0x0a, 0xcc, 0x73, 0xe1, 0x15, 0x30, 0x23, - 0x60, 0x7d, 0x4a, 0x87, 0x57, 0x35, 0xe5, 0x8b, 0xd9, 0xfb, 0xc4, 0x3a, 0x00, 0xf4, 0x5c, 0xb2, - 0xaa, 0x53, 0x2a, 0x50, 0x63, 0x4c, 0x28, 0x23, 0x5e, 0xde, 0x6c, 0x06, 0xdc, 0x1b, 0x64, 0x4c, - 0x28, 0x23, 0xde, 0x23, 0xa8, 0x02, 0x3d, 0x17, 0x5e, 0x05, 0x65, 0x01, 0x3c, 0x6c, 0x7d, 0x3e, - 0x3c, 0xd8, 0xdc, 0x40, 0x13, 0x8e, 0x55, 0x99, 0xf0, 0x05, 0x41, 0x8d, 0x9a, 0x07, 0xa1, 0x9e, - 0x8b, 0x26, 0x1d, 0xab, 0x32, 0xae, 0x41, 0x3d, 0x17, 0x5e, 0x07, 0xb3, 0x99, 0x7b, 0x4e, 0x7b, - 0xc6, 0xb1, 0x2a, 0x33, 0xbe, 0xe0, 0xd8, 0x63, 0x76, 0x03, 0xd8, 0x73, 0x11, 0x70, 0xac, 0x4a, - 0x59, 0x07, 0x7b, 0xae, 0x92, 0xfa, 0xc3, 0x76, 0x14, 0xa4, 0xa8, 0xe8, 0x58, 0x95, 0x42, 0x96, - 0xfa, 0x1a, 0x36, 0x2a, 0xeb, 0x3f, 0x88, 0xfa, 0x2f, 0xdb, 0x21, 0x2a, 0x39, 0x56, 0xc5, 0xca, - 0xd6, 0xff, 0x80, 0x58, 0xe1, 0x25, 0x20, 0x66, 0x36, 0x5e, 0x46, 0x51, 0x1b, 0x4d, 0x39, 0x56, - 0x65, 0xd2, 0x2f, 0x71, 0x63, 0x35, 0x8a, 0xda, 0x6a, 0x36, 0xd3, 0xb8, 0xd5, 0x3d, 0x42, 0xd3, - 0xb8, 0xaa, 0xa4, 0x6c, 0x12, 0xab, 0x12, 0xdd, 0xcb, 0xe3, 0x34, 0x4c, 0xd0, 0x0c, 0x2e, 0xe3, - 0x2c, 0xba, 0x2a, 0x36, 0xc2, 0x06, 0x58, 0x12, 0xb0, 0x2e, 0x7d, 0xbc, 0x3b, 0x61, 0x92, 0x04, - 0x47, 0x21, 0x82, 0x8e, 0x55, 0x29, 0x6e, 0x5c, 0x51, 0x1e, 0x6c, 0xb9, 0x44, 0x57, 0x77, 0x09, - 0xfe, 0x09, 0x85, 0xfb, 0x0b, 0x9c, 0x47, 0x31, 0xc3, 0x7d, 0x80, 0xb2, 0x2c, 0x45, 0x71, 0xd8, - 0x3a, 0xea, 0x0a, 0x0f, 0x73, 0xc4, 0xc3, 0x39, 0xc5, 0x43, 0x8d, 0x62, 0x38, 0xeb, 0xa2, 0x48, - 0xa6, 0x62, 0x87, 0x1f, 0x80, 0x79, 0x3d, 0xee, 0xb0, 0xdb, 0xef, 0xa0, 0x05, 0xa2, 0x46, 0x6f, - 0x9e, 0x14, 0xf4, 0x76, 0xb7, 0xdf, 0xf1, 0xa1, 0x1a, 0x31, 0xb6, 0xc1, 0xf7, 0xc1, 0xc2, 0x40, - 0xb8, 0x84, 0x78, 0x91, 0x10, 0x23, 0x53, 0xac, 0x84, 0x6c, 0x4e, 0x0b, 0x94, 0xb0, 0x79, 0x12, - 0x1b, 0xdd, 0xad, 0x46, 0xaf, 0x15, 0x36, 0x43, 0x84, 0xf0, 0x9e, 0x55, 0x0b, 0x93, 0x85, 0x6c, - 0x1e, 0xdd, 0xb7, 0xa7, 0x78, 0x18, 0x5e, 0x91, 0x4a, 0xa1, 0x19, 0xc5, 0x07, 0xe8, 0x2c, 0xc3, - 0x5b, 0x59, 0x39, 0xdc, 0x8f, 0xe2, 0x03, 0x58, 0x03, 0xb3, 0x71, 0xd8, 0xec, 0xc7, 0x49, 0xeb, - 0xe3, 0x50, 0xa4, 0xf5, 0x1c, 0x49, 0xeb, 0xd9, 0xdc, 0x1c, 0xf8, 0x65, 0x31, 0x87, 0xa7, 0xf3, - 0x32, 0x98, 0x8e, 0xc3, 0x5e, 0x18, 0xe0, 0x3c, 0xd2, 0x87, 0xf9, 0x82, 0x63, 0x63, 0xb5, 0xe1, - 0x56, 0xa1, 0x36, 0x32, 0xcc, 0x73, 0x91, 0xe3, 0xd8, 0x58, 0x6d, 0x24, 0x18, 0xd5, 0x06, 0x01, - 0x63, 0x6a, 0x73, 0xd1, 0xb1, 0xb1, 0xda, 0x70, 0x73, 0xa6, 0x36, 0x0a, 0xd0, 0x73, 0xd1, 0x8a, - 0x63, 0x63, 0xb5, 0x91, 0x81, 0x1a, 0x23, 0x53, 0x9b, 0x4b, 0x8e, 0x8d, 0xd5, 0x86, 0x9b, 0xf7, - 0x06, 0x19, 0x99, 0xda, 0xbc, 0xe9, 0xd8, 0x58, 0x6d, 0x64, 0x20, 0x55, 0x1b, 0x01, 0xe4, 0xb2, - 0x70, 0xd9, 0xb1, 0xb1, 0xda, 0x70, 0xbb, 0xa4, 0x36, 0x2a, 0xd4, 0x73, 0xd1, 0x27, 0x1c, 0x1b, - 0xab, 0x8d, 0x02, 0xa5, 0x6a, 0x93, 0xb9, 0xe7, 0xb4, 0x57, 0x1c, 0x1b, 0xab, 0x8d, 0x08, 0x40, - 0x52, 0x1b, 0x0d, 0xec, 0xb9, 0xa8, 0xe2, 0xd8, 0x58, 0x6d, 0x54, 0x30, 0x55, 0x9b, 0x2c, 0x08, - 0xa2, 0x36, 0x57, 0x1d, 0x1b, 0xab, 0x8d, 0x08, 0x81, 0xab, 0x8d, 0x80, 0x31, 0xb5, 0xb9, 0xe6, - 0xd8, 0x58, 0x6d, 0xb8, 0x39, 0x53, 0x1b, 0x01, 0x24, 0x6a, 0x73, 0xdd, 0xb1, 0xb1, 0xda, 0x70, - 0x23, 0x57, 0x9b, 0x2c, 0x42, 0xaa, 0x36, 0x6f, 0x39, 0x36, 0x56, 0x1b, 0x11, 0x9f, 0x50, 0x9b, - 0x8c, 0x8d, 0xa8, 0xcd, 0xdb, 0x8e, 0x8d, 0xd5, 0x46, 0xd0, 0x71, 0xb5, 0x11, 0x30, 0x4d, 0x6d, - 0xd6, 0x1c, 0xfb, 0xb5, 0xd4, 0x86, 0xf3, 0x0c, 0xa8, 0x4d, 0x96, 0x25, 0x4d, 0x6d, 0xd6, 0x89, - 0x87, 0xe1, 0x6a, 0x23, 0x92, 0x39, 0xa0, 0x36, 0x7a, 0xdc, 0x44, 0x14, 0x36, 0x1d, 0x7b, 0x74, - 0xb5, 0x51, 0x23, 0xe6, 0x6a, 0x33, 0x10, 0x2e, 0x21, 0x76, 0x09, 0xf1, 0x10, 0xb5, 0xd1, 0x02, - 0xe5, 0x6a, 0xa3, 0xed, 0x16, 0x53, 0x1b, 0x0f, 0xef, 0x19, 0x55, 0x1b, 0x75, 0xdf, 0x84, 0xda, - 0x88, 0x79, 0x44, 0x6d, 0x6e, 0x32, 0xbc, 0x95, 0x95, 0x03, 0x51, 0x9b, 0x67, 0x60, 0xa6, 0x13, - 0xf4, 0xa8, 0x40, 0x30, 0x99, 0xb8, 0x45, 0x92, 0xfa, 0x56, 0x7e, 0x06, 0x9e, 0x04, 0x3d, 0xa2, - 0x1d, 0xe4, 0x63, 0xbb, 0x9b, 0xc6, 0xc7, 0xfe, 0x54, 0x47, 0xb6, 0x49, 0xac, 0x9e, 0xcb, 0x54, - 0xe5, 0xf6, 0x68, 0xac, 0x9e, 0x4b, 0x3e, 0x14, 0x56, 0x66, 0x83, 0x2f, 0xc0, 0x2c, 0x66, 0xa5, - 0xf2, 0xc3, 0x55, 0xe8, 0x0e, 0xe1, 0x5d, 0x1d, 0xca, 0x4b, 0xa5, 0x89, 0x7e, 0x52, 0x66, 0x1c, - 0x9e, 0x6c, 0x95, 0xb9, 0x3d, 0x97, 0x0b, 0xd7, 0xbb, 0x23, 0x72, 0x7b, 0x2e, 0xfd, 0x54, 0xb9, - 0xb9, 0x95, 0x73, 0x53, 0x91, 0xe3, 0x5a, 0xf7, 0xc9, 0x11, 0xb8, 0xa9, 0x00, 0xee, 0x69, 0x71, - 0xcb, 0x56, 0x99, 0xdb, 0x73, 0xb9, 0x3c, 0xbe, 0x37, 0x22, 0xb7, 0xe7, 0xee, 0x69, 0x71, 0xcb, - 0x56, 0xf8, 0x59, 0x30, 0x87, 0xb9, 0x99, 0xb6, 0x09, 0x49, 0xbd, 0x4b, 0xd8, 0xd7, 0x86, 0xb2, - 0x33, 0x9d, 0x65, 0x3f, 0x28, 0x3f, 0x0e, 0x54, 0xb5, 0x2b, 0x1e, 0x3c, 0x57, 0x28, 0xf1, 0xa7, - 0x46, 0xf5, 0xe0, 0xb9, 0xec, 0x87, 0xe6, 0x41, 0xd8, 0xe1, 0x21, 0x58, 0x20, 0xf9, 0xe1, 0x8b, - 0x10, 0x0a, 0x7e, 0x8f, 0xf8, 0xd8, 0x18, 0x9e, 0x23, 0x06, 0xe6, 0x3f, 0xa9, 0x17, 0x1c, 0xb2, - 0x3e, 0xa2, 0xfa, 0xc1, 0x3b, 0xc1, 0xd7, 0xb2, 0x35, 0xb2, 0x1f, 0xcf, 0xe5, 0x3f, 0x75, 0x3f, - 0xd9, 0x88, 0xfa, 0xbc, 0xd2, 0x43, 0xa3, 0x3a, 0xea, 0xf3, 0x4a, 0x8e, 0x13, 0xed, 0x79, 0xa5, - 0x47, 0xcc, 0x73, 0x50, 0xce, 0x58, 0xd9, 0x19, 0x73, 0x9f, 0xd0, 0xbe, 0x7d, 0x32, 0x2d, 0x3d, - 0x7d, 0x28, 0xef, 0x74, 0x47, 0x31, 0xc2, 0x5d, 0x80, 0x3d, 0x91, 0xd3, 0x88, 0x1e, 0x49, 0x0f, - 0x08, 0xeb, 0xb5, 0xa1, 0xac, 0xf8, 0x9c, 0xc2, 0xff, 0x53, 0xca, 0x62, 0x27, 0xb3, 0x88, 0x72, - 0xa7, 0x52, 0xc8, 0xce, 0xaf, 0xed, 0x51, 0xca, 0x9d, 0x40, 0xe9, 0xa7, 0x54, 0xee, 0x92, 0x95, - 0x27, 0x81, 0x71, 0xd3, 0x23, 0xaf, 0x36, 0x42, 0x12, 0xe8, 0x74, 0x72, 0x1a, 0x66, 0x49, 0x90, - 0x8c, 0xb0, 0x07, 0xce, 0x4a, 0xc4, 0xda, 0x21, 0xf9, 0x90, 0x78, 0xb8, 0x31, 0x82, 0x07, 0xe5, - 0x58, 0xa4, 0x9e, 0x16, 0x3b, 0xc6, 0x41, 0x98, 0x80, 0x65, 0xc9, 0xa3, 0x7e, 0x6a, 0x3e, 0x22, - 0x2e, 0xbd, 0x11, 0x5c, 0xaa, 0x67, 0x26, 0xf5, 0xb9, 0xd4, 0x31, 0x8f, 0xc2, 0x23, 0xb0, 0x38, - 0xb8, 0x4c, 0x72, 0xf4, 0xed, 0x8c, 0xf2, 0x0c, 0x48, 0xcb, 0xc0, 0x47, 0x9f, 0xf4, 0x0c, 0x68, - 0x23, 0xf0, 0x43, 0xb0, 0x64, 0x58, 0x1d, 0xf1, 0xf4, 0x98, 0x78, 0xda, 0x1c, 0x7d, 0x69, 0x99, - 0xab, 0xf9, 0x8e, 0x61, 0x08, 0x5e, 0x02, 0xa5, 0xa8, 0x1b, 0x46, 0x87, 0xfc, 0xb8, 0x89, 0xf0, - 0x15, 0xfb, 0xd1, 0x98, 0x5f, 0x24, 0x56, 0x76, 0x78, 0x7c, 0x06, 0xcc, 0x53, 0x90, 0xb6, 0xb7, - 0xbd, 0xd7, 0xba, 0x6e, 0x3d, 0x1a, 0xf3, 0x21, 0xa1, 0x51, 0xf7, 0x52, 0x44, 0xc0, 0xaa, 0xfd, - 0x23, 0xde, 0x91, 0x20, 0x56, 0x56, 0xbb, 0x17, 0x01, 0xfd, 0xca, 0xca, 0x36, 0x66, 0xed, 0x0d, - 0x40, 0x8c, 0xb4, 0x0a, 0xeb, 0xd2, 0xc5, 0x85, 0x3c, 0x8f, 0xac, 0xf1, 0x84, 0x7e, 0x63, 0x91, - 0x30, 0x97, 0x57, 0x69, 0x67, 0x6a, 0x95, 0xb7, 0x44, 0x56, 0xf1, 0x13, 0xf7, 0x41, 0xd0, 0xee, - 0x87, 0xd9, 0x8d, 0x06, 0x9b, 0x9e, 0xd3, 0x79, 0xd0, 0x07, 0x8b, 0x6a, 0x3b, 0x43, 0x30, 0xfe, - 0xd6, 0x62, 0xb7, 0x40, 0x9d, 0x91, 0x48, 0x03, 0xa5, 0x9c, 0x57, 0x9a, 0x1e, 0x39, 0x9c, 0x9e, - 0x2b, 0x38, 0x7f, 0x37, 0x84, 0xd3, 0x73, 0x07, 0x39, 0x3d, 0x97, 0x73, 0xee, 0x4b, 0xf7, 0xe1, - 0xbe, 0x1a, 0xe8, 0xef, 0x29, 0xe9, 0xf9, 0x01, 0xd2, 0x7d, 0x29, 0xd2, 0x05, 0xb5, 0x9f, 0x92, - 0x47, 0x2b, 0xc5, 0xfa, 0x87, 0x61, 0xb4, 0x3c, 0xd8, 0x05, 0xb5, 0xfb, 0x62, 0xca, 0x00, 0xd1, - 0x77, 0xc1, 0xfa, 0xc7, 0xbc, 0x0c, 0x10, 0x0d, 0xd7, 0x32, 0x40, 0x6c, 0xa6, 0x50, 0xa9, 0xba, - 0x0b, 0xd2, 0x3f, 0xe5, 0x85, 0x4a, 0x05, 0x5c, 0x0b, 0x95, 0x1a, 0x4d, 0xb4, 0xec, 0x61, 0xe4, - 0xb4, 0x7f, 0xce, 0xa3, 0xa5, 0xf5, 0xaa, 0xd1, 0x52, 0xa3, 0x29, 0x03, 0xa4, 0x9c, 0x05, 0xeb, - 0x5f, 0xf2, 0x32, 0x40, 0x2a, 0x5c, 0xcb, 0x00, 0xb1, 0x71, 0xce, 0xba, 0xf4, 0x77, 0xb4, 0x52, - 0xfc, 0x7f, 0xb5, 0x88, 0x62, 0x0c, 0x2d, 0x7e, 0xf9, 0xfe, 0x24, 0x05, 0xa9, 0xde, 0xae, 0x05, - 0xe3, 0xdf, 0x2c, 0x76, 0x29, 0x19, 0x56, 0xfc, 0xca, 0x1d, 0x3c, 0x87, 0x53, 0x2a, 0xa8, 0xbf, - 0x0f, 0xe1, 0x14, 0xc5, 0xaf, 0x5c, 0xd8, 0xa5, 0x3d, 0xd2, 0xee, 0xed, 0x82, 0xf4, 0x1f, 0x94, - 0xf4, 0x84, 0xe2, 0x57, 0xaf, 0xf7, 0x79, 0xb4, 0x52, 0xac, 0xff, 0x1c, 0x46, 0x2b, 0x8a, 0x5f, - 0x6d, 0x06, 0x98, 0x32, 0xa0, 0x16, 0xff, 0xbf, 0xf2, 0x32, 0x20, 0x17, 0xbf, 0x72, 0x6f, 0x36, - 0x85, 0xaa, 0x15, 0xff, 0xbf, 0xf3, 0x42, 0x55, 0x8a, 0x5f, 0xbd, 0x65, 0x9b, 0x68, 0xb5, 0xe2, - 0xff, 0x4f, 0x1e, 0xad, 0x52, 0xfc, 0xea, 0xb5, 0xcd, 0x94, 0x01, 0xb5, 0xf8, 0xff, 0x9b, 0x97, - 0x01, 0xb9, 0xf8, 0x95, 0xbb, 0x39, 0xe7, 0x7c, 0x28, 0xb5, 0x40, 0xf9, 0xeb, 0x0e, 0xf4, 0xbd, - 0x02, 0x6b, 0x29, 0x0d, 0xac, 0x9d, 0x21, 0xb2, 0xf6, 0x28, 0xb7, 0xc0, 0xc7, 0x40, 0xf4, 0xd7, - 0x1a, 0xe2, 0xbd, 0x06, 0xfa, 0x7e, 0x21, 0xe7, 0xfc, 0x78, 0xc6, 0x21, 0xbe, 0xf0, 0x2f, 0x4c, - 0xf0, 0xd3, 0x60, 0x4e, 0xea, 0xf7, 0xf2, 0x77, 0x2c, 0xe8, 0x07, 0x79, 0x64, 0x35, 0x8c, 0x79, - 0x12, 0x24, 0xaf, 0x32, 0x32, 0x61, 0x82, 0x5b, 0x6a, 0x0b, 0xb5, 0xdf, 0x4c, 0xd1, 0x0f, 0x29, - 0xd1, 0x92, 0x69, 0x13, 0xfa, 0xcd, 0x54, 0x69, 0xae, 0xf6, 0x9b, 0x29, 0xbc, 0x05, 0x44, 0x1b, - 0xae, 0x11, 0x74, 0x8f, 0xd1, 0x8f, 0xe8, 0xfc, 0xf9, 0x81, 0xf9, 0x5b, 0xdd, 0x63, 0xbf, 0xc8, - 0xa1, 0x5b, 0xdd, 0x63, 0x78, 0x57, 0x6a, 0xcb, 0x7e, 0x8c, 0xb7, 0x01, 0xfd, 0x98, 0xce, 0x5d, - 0x1c, 0x98, 0x4b, 0x77, 0x49, 0x34, 0x02, 0xc9, 0x57, 0xbc, 0x3d, 0x59, 0x81, 0xf2, 0xed, 0xf9, - 0x69, 0x81, 0xec, 0xf6, 0xb0, 0xed, 0x11, 0x75, 0x29, 0x6d, 0x8f, 0x20, 0xca, 0xb6, 0xe7, 0x67, - 0x85, 0x1c, 0x85, 0x93, 0xb6, 0x87, 0x4f, 0xcb, 0xb6, 0x47, 0xe6, 0x22, 0xdb, 0x43, 0x76, 0xe7, - 0xe7, 0x79, 0x5c, 0xd2, 0xee, 0x64, 0xfd, 0x33, 0x36, 0x0b, 0xef, 0x8e, 0xfc, 0xa8, 0xe0, 0xdd, - 0xf9, 0x35, 0x25, 0xca, 0xdf, 0x1d, 0xe9, 0xe9, 0x60, 0xbb, 0x23, 0x28, 0xf0, 0xee, 0xfc, 0x82, - 0xce, 0xcf, 0xd9, 0x1d, 0x0e, 0x65, 0xbb, 0x23, 0x66, 0xd2, 0xdd, 0xf9, 0x25, 0x9d, 0x9b, 0xbb, - 0x3b, 0x1c, 0x4e, 0x77, 0xe7, 0x02, 0x00, 0x64, 0xfd, 0xdd, 0xa0, 0x13, 0xae, 0xa3, 0x2f, 0xd9, - 0xe4, 0x8d, 0x8d, 0x64, 0x82, 0x0e, 0x28, 0xd2, 0xfa, 0xc5, 0x5f, 0x37, 0xd0, 0x97, 0x65, 0xc4, - 0x2e, 0x36, 0xc1, 0x8b, 0xa0, 0xd4, 0xc8, 0x20, 0x9b, 0xe8, 0x2b, 0x0c, 0x52, 0xe3, 0x90, 0x4d, - 0xb8, 0x02, 0xa6, 0x28, 0x82, 0x40, 0xdc, 0x06, 0xfa, 0xaa, 0x4e, 0xe3, 0xe2, 0xbf, 0xf1, 0xc8, - 0xb7, 0x35, 0x0c, 0xb9, 0x81, 0xbe, 0x46, 0x11, 0xb2, 0x0d, 0x5e, 0xe2, 0x34, 0x6b, 0x84, 0xc7, - 0x43, 0x5f, 0x57, 0x40, 0x98, 0xc7, 0x13, 0x2b, 0xc2, 0xdf, 0x6e, 0xa2, 0x6f, 0xe8, 0x8e, 0x6e, - 0x62, 0x80, 0x08, 0xed, 0x16, 0xfa, 0xa6, 0x1e, 0xed, 0xad, 0x6c, 0xc9, 0xf8, 0xeb, 0x6d, 0xf4, - 0x2d, 0x9d, 0xe2, 0x36, 0x5c, 0x01, 0xa5, 0x9a, 0x40, 0xac, 0xaf, 0xa1, 0x6f, 0xb3, 0x38, 0x04, - 0xc9, 0xfa, 0x1a, 0xc1, 0xec, 0x6c, 0xbf, 0xff, 0xa0, 0xb1, 0xbb, 0xf5, 0x64, 0x7b, 0x7d, 0x1d, - 0x7d, 0x87, 0x63, 0xb0, 0x91, 0xda, 0x32, 0x0c, 0xc9, 0xf5, 0x06, 0xfa, 0xae, 0x82, 0x21, 0xb6, - 0xe5, 0x17, 0x60, 0x4a, 0xfd, 0x8b, 0xb9, 0x04, 0xac, 0x80, 0xbd, 0x5a, 0xb3, 0x02, 0xf8, 0x2e, - 0x28, 0x36, 0x23, 0xd1, 0x1d, 0x47, 0x85, 0x93, 0x3a, 0xe9, 0x32, 0x7a, 0xf9, 0x1e, 0x80, 0x83, - 0xdd, 0x2e, 0x58, 0x06, 0xf6, 0xab, 0xf0, 0x98, 0xb9, 0xc0, 0xbf, 0xc2, 0x79, 0x70, 0x9a, 0x16, - 0x57, 0x81, 0xd8, 0xe8, 0x97, 0x3b, 0x85, 0x5b, 0x56, 0xc6, 0x20, 0x77, 0xb6, 0x64, 0x06, 0xdb, - 0xc0, 0x60, 0xcb, 0x0c, 0x55, 0x30, 0x6f, 0xea, 0x61, 0xc9, 0x1c, 0x53, 0x06, 0x8e, 0x29, 0x33, - 0x87, 0xd2, 0xab, 0x92, 0x39, 0x4e, 0x19, 0x38, 0x4e, 0x0d, 0x72, 0x0c, 0xf4, 0xa4, 0x64, 0x8e, - 0x59, 0x03, 0xc7, 0xac, 0x99, 0x43, 0xe9, 0x3d, 0xc9, 0x1c, 0xd0, 0xc0, 0x01, 0x65, 0x8e, 0x07, - 0x60, 0xd1, 0xdc, 0x61, 0x92, 0x59, 0x26, 0x0c, 0x2c, 0x13, 0x39, 0x2c, 0x6a, 0x17, 0x49, 0x66, - 0x19, 0x37, 0xb0, 0x8c, 0xcb, 0x2c, 0x35, 0x80, 0xf2, 0xfa, 0x44, 0x32, 0xcf, 0x8c, 0x81, 0x67, - 0x26, 0x8f, 0x47, 0xeb, 0x03, 0xc9, 0x3c, 0x65, 0x03, 0x4f, 0xd9, 0x58, 0x6d, 0x72, 0xb7, 0xe7, - 0xa4, 0x7a, 0x2d, 0xc8, 0x0c, 0x5b, 0x60, 0xce, 0xd0, 0xd8, 0x39, 0x89, 0xc2, 0x92, 0x29, 0xee, - 0x82, 0xb2, 0xde, 0xc5, 0x91, 0xe7, 0x4f, 0x1a, 0xe6, 0x4f, 0x1a, 0x8a, 0x44, 0xef, 0xd8, 0xc8, - 0x1c, 0x67, 0x0c, 0x1c, 0x67, 0x06, 0x97, 0xa1, 0xb7, 0x66, 0x4e, 0xa2, 0x28, 0xc9, 0x14, 0x31, - 0x38, 0x37, 0xa4, 0xf7, 0x62, 0xa0, 0x7a, 0x4f, 0xa6, 0x7a, 0x8d, 0x17, 0x1f, 0x92, 0xcf, 0x23, - 0x70, 0x7e, 0x58, 0xf3, 0xc5, 0xe0, 0x74, 0x5d, 0x75, 0x3a, 0xf4, 0x5d, 0x88, 0xe4, 0xa8, 0x4d, - 0x0b, 0xce, 0xd4, 0x74, 0x31, 0x38, 0xb9, 0x23, 0x3b, 0x19, 0xf5, 0xed, 0x88, 0xe4, 0x2d, 0x00, - 0x67, 0x73, 0x1b, 0x2f, 0x06, 0x77, 0xab, 0xaa, 0xbb, 0xfc, 0x77, 0x26, 0x99, 0x8b, 0x95, 0xdb, - 0x00, 0x48, 0x2d, 0xa2, 0x09, 0x60, 0xd7, 0xea, 0xf5, 0xf2, 0x18, 0xfe, 0xa5, 0xba, 0xe5, 0x97, - 0x2d, 0xfa, 0xcb, 0x8b, 0x72, 0x01, 0xbb, 0xdb, 0xdd, 0x7e, 0x58, 0xfe, 0x1f, 0xff, 0xcf, 0xaa, - 0x4e, 0xf1, 0xe6, 0x09, 0x39, 0xc0, 0x56, 0xde, 0x00, 0xd3, 0x5a, 0x67, 0xab, 0x04, 0xac, 0x26, - 0x3f, 0x50, 0x9a, 0xd7, 0x6e, 0x00, 0x90, 0xfd, 0x63, 0x18, 0x38, 0x03, 0x8a, 0xfb, 0xbb, 0x7b, - 0x4f, 0xb7, 0xef, 0xef, 0xd4, 0x76, 0xb6, 0x1f, 0x94, 0xc7, 0x60, 0x09, 0x4c, 0x3e, 0xf5, 0xeb, - 0xcf, 0xea, 0xd5, 0xfd, 0x5a, 0xd9, 0x82, 0x93, 0xe0, 0xd4, 0xe3, 0xbd, 0xfa, 0x6e, 0xb9, 0x70, - 0xed, 0x1e, 0x28, 0xca, 0x8d, 0xa5, 0x19, 0x50, 0xac, 0xd5, 0xfd, 0xed, 0x9d, 0x87, 0xbb, 0x0d, - 0x1a, 0xa9, 0x64, 0xa0, 0x11, 0x2b, 0x86, 0x17, 0xe5, 0x42, 0xf5, 0x22, 0xb8, 0xd0, 0x8c, 0x3a, - 0x03, 0x7f, 0xb6, 0x48, 0xc9, 0x79, 0x39, 0x4e, 0xac, 0x9b, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, - 0x29, 0x30, 0x51, 0x54, 0x22, 0x25, 0x00, 0x00, -} diff --git a/conformance/internal/conformance_proto/conformance.proto b/conformance/internal/conformance_proto/conformance.proto deleted file mode 100644 index fc96074ac8..0000000000 --- a/conformance/internal/conformance_proto/conformance.proto +++ /dev/null @@ -1,273 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - -syntax = "proto3"; -package conformance; -option java_package = "com.google.protobuf.conformance"; - -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -// This defines the conformance testing protocol. This protocol exists between -// the conformance test suite itself and the code being tested. For each test, -// the suite will send a ConformanceRequest message and expect a -// ConformanceResponse message. -// -// You can either run the tests in two different ways: -// -// 1. in-process (using the interface in conformance_test.h). -// -// 2. as a sub-process communicating over a pipe. Information about how to -// do this is in conformance_test_runner.cc. -// -// Pros/cons of the two approaches: -// -// - running as a sub-process is much simpler for languages other than C/C++. -// -// - running as a sub-process may be more tricky in unusual environments like -// iOS apps, where fork/stdin/stdout are not available. - -enum WireFormat { - UNSPECIFIED = 0; - PROTOBUF = 1; - JSON = 2; -} - -// Represents a single test case's input. The testee should: -// -// 1. parse this proto (which should always succeed) -// 2. parse the protobuf or JSON payload in "payload" (which may fail) -// 3. if the parse succeeded, serialize the message in the requested format. -message ConformanceRequest { - // The payload (whether protobuf of JSON) is always for a TestAllTypes proto - // (see below). - oneof payload { - bytes protobuf_payload = 1; - string json_payload = 2; - } - - // Which format should the testee serialize its message to? - WireFormat requested_output_format = 3; -} - -// Represents a single test case's output. -message ConformanceResponse { - oneof result { - // This string should be set to indicate parsing failed. The string can - // provide more information about the parse error if it is available. - // - // Setting this string does not necessarily mean the testee failed the - // test. Some of the test cases are intentionally invalid input. - string parse_error = 1; - - // If the input was successfully parsed but errors occurred when - // serializing it to the requested output format, set the error message in - // this field. - string serialize_error = 6; - - // This should be set if some other error occurred. This will always - // indicate that the test failed. The string can provide more information - // about the failure. - string runtime_error = 2; - - // If the input was successfully parsed and the requested output was - // protobuf, serialize it to protobuf and set it in this field. - bytes protobuf_payload = 3; - - // If the input was successfully parsed and the requested output was JSON, - // serialize to JSON and set it in this field. - string json_payload = 4; - - // For when the testee skipped the test, likely because a certain feature - // wasn't supported, like JSON input/output. - string skipped = 5; - } -} - -// This proto includes every type of field in both singular and repeated -// forms. -message TestAllTypes { - message NestedMessage { - int32 a = 1; - TestAllTypes corecursive = 2; - } - - enum NestedEnum { - FOO = 0; - BAR = 1; - BAZ = 2; - NEG = -1; // Intentionally negative. - } - - // Singular - int32 optional_int32 = 1; - int64 optional_int64 = 2; - uint32 optional_uint32 = 3; - uint64 optional_uint64 = 4; - sint32 optional_sint32 = 5; - sint64 optional_sint64 = 6; - fixed32 optional_fixed32 = 7; - fixed64 optional_fixed64 = 8; - sfixed32 optional_sfixed32 = 9; - sfixed64 optional_sfixed64 = 10; - float optional_float = 11; - double optional_double = 12; - bool optional_bool = 13; - string optional_string = 14; - bytes optional_bytes = 15; - - NestedMessage optional_nested_message = 18; - ForeignMessage optional_foreign_message = 19; - - NestedEnum optional_nested_enum = 21; - ForeignEnum optional_foreign_enum = 22; - - string optional_string_piece = 24 [ctype=STRING_PIECE]; - string optional_cord = 25 [ctype=CORD]; - - TestAllTypes recursive_message = 27; - - // Repeated - repeated int32 repeated_int32 = 31; - repeated int64 repeated_int64 = 32; - repeated uint32 repeated_uint32 = 33; - repeated uint64 repeated_uint64 = 34; - repeated sint32 repeated_sint32 = 35; - repeated sint64 repeated_sint64 = 36; - repeated fixed32 repeated_fixed32 = 37; - repeated fixed64 repeated_fixed64 = 38; - repeated sfixed32 repeated_sfixed32 = 39; - repeated sfixed64 repeated_sfixed64 = 40; - repeated float repeated_float = 41; - repeated double repeated_double = 42; - repeated bool repeated_bool = 43; - repeated string repeated_string = 44; - repeated bytes repeated_bytes = 45; - - repeated NestedMessage repeated_nested_message = 48; - repeated ForeignMessage repeated_foreign_message = 49; - - repeated NestedEnum repeated_nested_enum = 51; - repeated ForeignEnum repeated_foreign_enum = 52; - - repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; - repeated string repeated_cord = 55 [ctype=CORD]; - - // Map - map < int32, int32> map_int32_int32 = 56; - map < int64, int64> map_int64_int64 = 57; - map < uint32, uint32> map_uint32_uint32 = 58; - map < uint64, uint64> map_uint64_uint64 = 59; - map < sint32, sint32> map_sint32_sint32 = 60; - map < sint64, sint64> map_sint64_sint64 = 61; - map < fixed32, fixed32> map_fixed32_fixed32 = 62; - map < fixed64, fixed64> map_fixed64_fixed64 = 63; - map map_sfixed32_sfixed32 = 64; - map map_sfixed64_sfixed64 = 65; - map < int32, float> map_int32_float = 66; - map < int32, double> map_int32_double = 67; - map < bool, bool> map_bool_bool = 68; - map < string, string> map_string_string = 69; - map < string, bytes> map_string_bytes = 70; - map < string, NestedMessage> map_string_nested_message = 71; - map < string, ForeignMessage> map_string_foreign_message = 72; - map < string, NestedEnum> map_string_nested_enum = 73; - map < string, ForeignEnum> map_string_foreign_enum = 74; - - oneof oneof_field { - uint32 oneof_uint32 = 111; - NestedMessage oneof_nested_message = 112; - string oneof_string = 113; - bytes oneof_bytes = 114; - } - - // Well-known types - google.protobuf.BoolValue optional_bool_wrapper = 201; - google.protobuf.Int32Value optional_int32_wrapper = 202; - google.protobuf.Int64Value optional_int64_wrapper = 203; - google.protobuf.UInt32Value optional_uint32_wrapper = 204; - google.protobuf.UInt64Value optional_uint64_wrapper = 205; - google.protobuf.FloatValue optional_float_wrapper = 206; - google.protobuf.DoubleValue optional_double_wrapper = 207; - google.protobuf.StringValue optional_string_wrapper = 208; - google.protobuf.BytesValue optional_bytes_wrapper = 209; - - repeated google.protobuf.BoolValue repeated_bool_wrapper = 211; - repeated google.protobuf.Int32Value repeated_int32_wrapper = 212; - repeated google.protobuf.Int64Value repeated_int64_wrapper = 213; - repeated google.protobuf.UInt32Value repeated_uint32_wrapper = 214; - repeated google.protobuf.UInt64Value repeated_uint64_wrapper = 215; - repeated google.protobuf.FloatValue repeated_float_wrapper = 216; - repeated google.protobuf.DoubleValue repeated_double_wrapper = 217; - repeated google.protobuf.StringValue repeated_string_wrapper = 218; - repeated google.protobuf.BytesValue repeated_bytes_wrapper = 219; - - google.protobuf.Duration optional_duration = 301; - google.protobuf.Timestamp optional_timestamp = 302; - google.protobuf.FieldMask optional_field_mask = 303; - google.protobuf.Struct optional_struct = 304; - google.protobuf.Any optional_any = 305; - google.protobuf.Value optional_value = 306; - - repeated google.protobuf.Duration repeated_duration = 311; - repeated google.protobuf.Timestamp repeated_timestamp = 312; - repeated google.protobuf.FieldMask repeated_fieldmask = 313; - repeated google.protobuf.Struct repeated_struct = 324; - repeated google.protobuf.Any repeated_any = 315; - repeated google.protobuf.Value repeated_value = 316; - - // Test field-name-to-JSON-name convention. - int32 fieldname1 = 401; - int32 field_name2 = 402; - int32 _field_name3 = 403; - int32 field__name4_ = 404; - int32 field0name5 = 405; - int32 field_0_name6 = 406; - int32 fieldName7 = 407; - int32 FieldName8 = 408; - int32 field_Name9 = 409; - int32 Field_Name10 = 410; - int32 FIELD_NAME11 = 411; - int32 FIELD_name12 = 412; -} - -message ForeignMessage { - int32 c = 1; -} - -enum ForeignEnum { - FOREIGN_FOO = 0; - FOREIGN_BAR = 1; - FOREIGN_BAZ = 2; -} diff --git a/conformance/test.sh b/conformance/test.sh deleted file mode 100755 index e6de29b9a9..0000000000 --- a/conformance/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -PROTOBUF_ROOT=$1 -CONFORMANCE_ROOT=$1/conformance -CONFORMANCE_TEST_RUNNER=$CONFORMANCE_ROOT/conformance-test-runner - -cd $(dirname $0) - -if [[ $PROTOBUF_ROOT == "" ]]; then - echo "usage: test.sh " >/dev/stderr - exit 1 -fi - -if [[ ! -x $CONFORMANCE_TEST_RUNNER ]]; then - echo "SKIP: conformance test runner not installed" >/dev/stderr - exit 0 -fi - -a=$CONFORMANCE_ROOT/conformance.proto -b=internal/conformance_proto/conformance.proto -if [[ $(diff $a $b) != "" ]]; then - cp $a $b - echo "WARNING: conformance.proto is out of date" >/dev/stderr -fi - -$CONFORMANCE_TEST_RUNNER --failure_list failure_list_go.txt ./conformance.sh diff --git a/go.mod b/go.mod index 28fda76c4e..15a12130c0 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,4 @@ require ( golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 // indirect golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f golang.org/x/tools v0.0.0-20180928181343-b3c0be4c978b // indirect - google.golang.org/genproto v0.0.0-20180831171423-11092d34479b ) From 4c13d30a989dbbac43986e557b20326463dd5096 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 28 Nov 2018 07:22:51 -0800 Subject: [PATCH 026/133] descriptor: deprecate the package The descriptor package is an inferior way to access the descriptor protos compared to the new v2 Message interface which provides direct support for the same information and more. We remove the tests since: * It is a source of failures inside Google since the proto package for the descriptors is not at "google.protobuf" for historical reasons. * To avoid showing an example usage to further discourage usage. Change-Id: I6d34287b258e2905de99207e486b842eb9152e35 Reviewed-on: https://go-review.googlesource.com/c/151407 Reviewed-by: Herbie Ong --- descriptor/descriptor.go | 12 ++++++------ descriptor/descriptor_test.go | 32 -------------------------------- 2 files changed, 6 insertions(+), 38 deletions(-) delete mode 100644 descriptor/descriptor_test.go diff --git a/descriptor/descriptor.go b/descriptor/descriptor.go index ac7e51bfb1..7928787685 100644 --- a/descriptor/descriptor.go +++ b/descriptor/descriptor.go @@ -32,8 +32,8 @@ // Package descriptor provides functions for obtaining protocol buffer // descriptors for generated Go types. // -// These functions cannot go in package proto because they depend on the -// generated protobuf descriptor messages, which themselves depend on proto. +// Deprecated: Do not use. The new v2 Message interface provides direct support +// for programmatically interacting with the descriptor information. package descriptor import ( @@ -43,11 +43,11 @@ import ( "io/ioutil" "github.com/golang/protobuf/proto" - protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor" + descriptorpb "github.com/golang/protobuf/protoc-gen-go/descriptor" ) // extractFile extracts a FileDescriptorProto from a gzip'd buffer. -func extractFile(gz []byte) (*protobuf.FileDescriptorProto, error) { +func extractFile(gz []byte) (*descriptorpb.FileDescriptorProto, error) { r, err := gzip.NewReader(bytes.NewReader(gz)) if err != nil { return nil, fmt.Errorf("failed to open gzip reader: %v", err) @@ -59,7 +59,7 @@ func extractFile(gz []byte) (*protobuf.FileDescriptorProto, error) { return nil, fmt.Errorf("failed to uncompress descriptor: %v", err) } - fd := new(protobuf.FileDescriptorProto) + fd := new(descriptorpb.FileDescriptorProto) if err := proto.Unmarshal(b, fd); err != nil { return nil, fmt.Errorf("malformed FileDescriptorProto: %v", err) } @@ -78,7 +78,7 @@ type Message interface { // ForMessage returns a FileDescriptorProto and a DescriptorProto from within it // describing the given message. -func ForMessage(msg Message) (fd *protobuf.FileDescriptorProto, md *protobuf.DescriptorProto) { +func ForMessage(msg Message) (fd *descriptorpb.FileDescriptorProto, md *descriptorpb.DescriptorProto) { gz, path := msg.Descriptor() fd, err := extractFile(gz) if err != nil { diff --git a/descriptor/descriptor_test.go b/descriptor/descriptor_test.go deleted file mode 100644 index bf5174d3b1..0000000000 --- a/descriptor/descriptor_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package descriptor_test - -import ( - "fmt" - "testing" - - "github.com/golang/protobuf/descriptor" - tpb "github.com/golang/protobuf/proto/test_proto" - protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor" -) - -func TestMessage(t *testing.T) { - var msg *protobuf.DescriptorProto - fd, md := descriptor.ForMessage(msg) - if pkg, want := fd.GetPackage(), "google.protobuf"; pkg != want { - t.Errorf("descriptor.ForMessage(%T).GetPackage() = %q; want %q", msg, pkg, want) - } - if name, want := md.GetName(), "DescriptorProto"; name != want { - t.Fatalf("descriptor.ForMessage(%T).GetName() = %q; want %q", msg, name, want) - } -} - -func Example_options() { - var msg *tpb.MyMessageSet - _, md := descriptor.ForMessage(msg) - if md.GetOptions().GetMessageSetWireFormat() { - fmt.Printf("%v uses option message_set_wire_format.\n", md.GetName()) - } - - // Output: - // MyMessageSet uses option message_set_wire_format. -} From 2f9da38e0d66a86743a06423e43d7e0b0fa510b2 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 28 Nov 2018 07:06:26 -0800 Subject: [PATCH 027/133] all: cleanup build tags For some cases, we already rely on Go1.9 as the minimally supported Go version, in which case the build tag is always satisfied. In other cases, we drop special casing for appengine or js. Instead, just rely on the purego tag being properly specified in those specialized environments. Change-Id: I8b1b1511ea85531166f0d778f0029bd41664075b Reviewed-on: https://go-review.googlesource.com/c/151404 Reviewed-by: Herbie Ong --- proto/decode_test.go | 2 -- proto/encode_test.go | 2 -- proto/pointer_reflect.go | 2 +- proto/pointer_unsafe.go | 2 +- protoc-gen-go/testdata/import_public_test.go | 2 -- 5 files changed, 2 insertions(+), 8 deletions(-) diff --git a/proto/decode_test.go b/proto/decode_test.go index 949be3abda..5d496171ea 100644 --- a/proto/decode_test.go +++ b/proto/decode_test.go @@ -29,8 +29,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// +build go1.7 - package proto_test import ( diff --git a/proto/encode_test.go b/proto/encode_test.go index a7209475f1..0b36a0e9f6 100644 --- a/proto/encode_test.go +++ b/proto/encode_test.go @@ -29,8 +29,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// +build go1.7 - package proto_test import ( diff --git a/proto/pointer_reflect.go b/proto/pointer_reflect.go index 94fa9194a8..b993af9b76 100644 --- a/proto/pointer_reflect.go +++ b/proto/pointer_reflect.go @@ -29,7 +29,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// +build purego appengine js +// +build purego // This file contains an implementation of proto field accesses using package reflect. // It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can diff --git a/proto/pointer_unsafe.go b/proto/pointer_unsafe.go index dbfffe071b..163d7fec78 100644 --- a/proto/pointer_unsafe.go +++ b/proto/pointer_unsafe.go @@ -29,7 +29,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// +build !purego,!appengine,!js +// +build !purego // This file contains the implementation of the proto field accesses using package unsafe. diff --git a/protoc-gen-go/testdata/import_public_test.go b/protoc-gen-go/testdata/import_public_test.go index e3cbc89201..0667c4cb53 100644 --- a/protoc-gen-go/testdata/import_public_test.go +++ b/protoc-gen-go/testdata/import_public_test.go @@ -29,8 +29,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// +build go1.9 - package testdata import ( From f015b0719f669a4da66037dc00e48de0c2589125 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 28 Nov 2018 06:56:58 -0800 Subject: [PATCH 028/133] all: use short license header form Consistently use the short license header for all Go source files in a manner similar to all the other golang.org/x projects. Some source files were entirely missing the license header. In the mean time, fix the package docstring for most packages to consistently use "//" notation instead of "/*". Change-Id: I2848ede6fb6ffdfc2ee7992e0d71d79b52bb61e3 Reviewed-on: https://go-review.googlesource.com/c/151405 Reviewed-by: Herbie Ong --- Makefile | 33 +---------- descriptor/descriptor.go | 33 +---------- jsonpb/jsonpb.go | 45 +++------------ jsonpb/jsonpb_test.go | 33 +---------- proto/all_test.go | 33 +---------- proto/any_test.go | 33 +---------- proto/clone.go | 33 +---------- proto/clone_test.go | 33 +---------- proto/decode.go | 33 +---------- proto/decode_test.go | 33 +---------- proto/deprecated.go | 33 +---------- proto/discard.go | 33 +---------- proto/discard_test.go | 33 +---------- proto/encode.go | 33 +---------- proto/encode_test.go | 33 +---------- proto/equal.go | 33 +---------- proto/equal_test.go | 33 +---------- proto/extensions.go | 33 +---------- proto/extensions_test.go | 33 +---------- proto/lib.go | 33 +---------- proto/map_test.go | 4 ++ proto/message_set.go | 33 +---------- proto/message_set_test.go | 33 +---------- proto/pointer_reflect.go | 33 +---------- proto/pointer_unsafe.go | 33 +---------- proto/properties.go | 33 +---------- proto/proto3_test.go | 33 +---------- proto/size2_test.go | 33 +---------- proto/size_test.go | 33 +---------- proto/table_marshal.go | 33 +---------- proto/table_merge.go | 33 +---------- proto/table_unmarshal.go | 33 +---------- proto/text.go | 33 +---------- proto/text_parser.go | 33 +---------- proto/text_parser_test.go | 33 +---------- proto/text_test.go | 33 +---------- protoc-gen-go/doc.go | 51 ----------------- protoc-gen-go/generator/generator.go | 33 +---------- .../generator/internal/remap/remap.go | 39 ++----------- .../generator/internal/remap/remap_test.go | 33 +---------- protoc-gen-go/generator/name_test.go | 33 +---------- protoc-gen-go/golden_test.go | 4 ++ protoc-gen-go/grpc/grpc.go | 33 +---------- protoc-gen-go/main.go | 57 +++++-------------- protoc-gen-go/testdata/extension_test.go | 33 +---------- protoc-gen-go/testdata/import_public_test.go | 33 +---------- protoc-gen-go/testdata/main_test.go | 33 +---------- ptypes/any.go | 33 +---------- ptypes/any_test.go | 33 +---------- ptypes/doc.go | 37 ++---------- ptypes/duration.go | 33 +---------- ptypes/duration_test.go | 33 +---------- ptypes/timestamp.go | 33 +---------- ptypes/timestamp_test.go | 33 +---------- 54 files changed, 180 insertions(+), 1608 deletions(-) delete mode 100644 protoc-gen-go/doc.go diff --git a/Makefile b/Makefile index 7a51c95bb4..60ea390bed 100644 --- a/Makefile +++ b/Makefile @@ -1,33 +1,6 @@ -# 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. all: install diff --git a/descriptor/descriptor.go b/descriptor/descriptor.go index 7928787685..90c53904b6 100644 --- a/descriptor/descriptor.go +++ b/descriptor/descriptor.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 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 2016 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 descriptor provides functions for obtaining protocol buffer // descriptors for generated Go types. diff --git a/jsonpb/jsonpb.go b/jsonpb/jsonpb.go index ada2b78e89..6bcb71946e 100644 --- a/jsonpb/jsonpb.go +++ b/jsonpb/jsonpb.go @@ -1,41 +1,12 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2015 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. +// Copyright 2015 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 jsonpb provides marshaling and unmarshaling between protocol buffers and JSON. +// It follows the specification at https://developers.google.com/protocol-buffers/docs/proto3#json. // -// 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 jsonpb provides marshaling and unmarshaling between protocol buffers and JSON. -It follows the specification at https://developers.google.com/protocol-buffers/docs/proto3#json. - -This package produces a different output than the standard "encoding/json" package, -which does not operate correctly on protocol buffers. -*/ +// This package produces a different output than the standard "encoding/json" package, +// which does not operate correctly on protocol buffers. package jsonpb import ( diff --git a/jsonpb/jsonpb_test.go b/jsonpb/jsonpb_test.go index 45a13d45a5..607a57a1f9 100644 --- a/jsonpb/jsonpb_test.go +++ b/jsonpb/jsonpb_test.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2015 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 2015 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 jsonpb diff --git a/proto/all_test.go b/proto/all_test.go index 1bea4b6e8e..a16c05613d 100644 --- a/proto/all_test.go +++ b/proto/all_test.go @@ -1,33 +1,6 @@ -// 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_test diff --git a/proto/any_test.go b/proto/any_test.go index 56fc97c11f..69e497dbad 100644 --- a/proto/any_test.go +++ b/proto/any_test.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 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 2016 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_test diff --git a/proto/clone.go b/proto/clone.go index 3cd3249f70..29e93c3432 100644 --- a/proto/clone.go +++ b/proto/clone.go @@ -1,33 +1,6 @@ -// 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. +// Copyright 2011 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. // Protocol buffer deep copy and merge. // TODO: RawMessage. diff --git a/proto/clone_test.go b/proto/clone_test.go index b04989e27d..d83a058a77 100644 --- a/proto/clone_test.go +++ b/proto/clone_test.go @@ -1,33 +1,6 @@ -// 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. +// Copyright 2011 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_test diff --git a/proto/decode.go b/proto/decode.go index 63b0f08bef..e0f52c754d 100644 --- a/proto/decode.go +++ b/proto/decode.go @@ -1,33 +1,6 @@ -// 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 diff --git a/proto/decode_test.go b/proto/decode_test.go index 5d496171ea..50a49d1b58 100644 --- a/proto/decode_test.go +++ b/proto/decode_test.go @@ -1,33 +1,6 @@ -// 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_test diff --git a/proto/deprecated.go b/proto/deprecated.go index 35b882c09a..1a2cb14991 100644 --- a/proto/deprecated.go +++ b/proto/deprecated.go @@ -1,33 +1,6 @@ -// 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 diff --git a/proto/discard.go b/proto/discard.go index dea2617ced..5504736e92 100644 --- a/proto/discard.go +++ b/proto/discard.go @@ -1,33 +1,6 @@ -// 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 2017 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 diff --git a/proto/discard_test.go b/proto/discard_test.go index a2ff5509d9..d2dd3aafb4 100644 --- a/proto/discard_test.go +++ b/proto/discard_test.go @@ -1,33 +1,6 @@ -// 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 2017 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_test diff --git a/proto/encode.go b/proto/encode.go index 3abfed2cff..2d7135354e 100644 --- a/proto/encode.go +++ b/proto/encode.go @@ -1,33 +1,6 @@ -// 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 diff --git a/proto/encode_test.go b/proto/encode_test.go index 0b36a0e9f6..010aa64d6a 100644 --- a/proto/encode_test.go +++ b/proto/encode_test.go @@ -1,33 +1,6 @@ -// 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_test diff --git a/proto/equal.go b/proto/equal.go index f9b6e41b3c..e4dc9fb276 100644 --- a/proto/equal.go +++ b/proto/equal.go @@ -1,33 +1,6 @@ -// 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. +// Copyright 2011 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. // Protocol buffer comparison. diff --git a/proto/equal_test.go b/proto/equal_test.go index 93ff88f3ab..6f94c39bac 100644 --- a/proto/equal_test.go +++ b/proto/equal_test.go @@ -1,33 +1,6 @@ -// 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. +// Copyright 2011 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_test diff --git a/proto/extensions.go b/proto/extensions.go index fa88add30a..a944f72623 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -1,33 +1,6 @@ -// 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 diff --git a/proto/extensions_test.go b/proto/extensions_test.go index dc69fe971a..a32243d765 100644 --- a/proto/extensions_test.go +++ b/proto/extensions_test.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2014 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 2014 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_test diff --git a/proto/lib.go b/proto/lib.go index b5d80684c4..4fa41eb779 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -1,33 +1,6 @@ -// 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 converts data structures to and from the wire format of diff --git a/proto/map_test.go b/proto/map_test.go index b1e1529ee3..d61d402283 100644 --- a/proto/map_test.go +++ b/proto/map_test.go @@ -1,3 +1,7 @@ +// Copyright 2016 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_test import ( diff --git a/proto/message_set.go b/proto/message_set.go index f48a756761..c75407cf5a 100644 --- a/proto/message_set.go +++ b/proto/message_set.go @@ -1,33 +1,6 @@ -// 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 diff --git a/proto/message_set_test.go b/proto/message_set_test.go index 1bd11aaec1..cabd44c8b9 100644 --- a/proto/message_set_test.go +++ b/proto/message_set_test.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2014 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 2014 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_test diff --git a/proto/pointer_reflect.go b/proto/pointer_reflect.go index b993af9b76..5ee1a0a91d 100644 --- a/proto/pointer_reflect.go +++ b/proto/pointer_reflect.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 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 2012 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. // +build purego diff --git a/proto/pointer_unsafe.go b/proto/pointer_unsafe.go index 163d7fec78..52f1c92b55 100644 --- a/proto/pointer_unsafe.go +++ b/proto/pointer_unsafe.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 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 2012 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. // +build !purego diff --git a/proto/properties.go b/proto/properties.go index 79668ff5c5..d9d8bfaf55 100644 --- a/proto/properties.go +++ b/proto/properties.go @@ -1,33 +1,6 @@ -// 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 diff --git a/proto/proto3_test.go b/proto/proto3_test.go index 73eed6c0b5..943ca20326 100644 --- a/proto/proto3_test.go +++ b/proto/proto3_test.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2014 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 2014 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_test diff --git a/proto/size2_test.go b/proto/size2_test.go index 0b8eb85cf2..ec9ff7eeba 100644 --- a/proto/size2_test.go +++ b/proto/size2_test.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 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 2012 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 diff --git a/proto/size_test.go b/proto/size_test.go index 3abac418a0..fce40fa494 100644 --- a/proto/size_test.go +++ b/proto/size_test.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 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 2012 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_test diff --git a/proto/table_marshal.go b/proto/table_marshal.go index 5cb11fa955..60340d666c 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 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 2016 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 diff --git a/proto/table_merge.go b/proto/table_merge.go index 5525def6a5..ee0a4d3701 100644 --- a/proto/table_merge.go +++ b/proto/table_merge.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 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 2016 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 diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index acee2fc529..29fa5ca69e 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 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 2016 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 diff --git a/proto/text.go b/proto/text.go index 1aaee725b4..6a6fc42175 100644 --- a/proto/text.go +++ b/proto/text.go @@ -1,33 +1,6 @@ -// 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 diff --git a/proto/text_parser.go b/proto/text_parser.go index bb55a3af27..10e93d9bcd 100644 --- a/proto/text_parser.go +++ b/proto/text_parser.go @@ -1,33 +1,6 @@ -// 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 diff --git a/proto/text_parser_test.go b/proto/text_parser_test.go index a819808796..e0a89272c8 100644 --- a/proto/text_parser_test.go +++ b/proto/text_parser_test.go @@ -1,33 +1,6 @@ -// 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_test diff --git a/proto/text_test.go b/proto/text_test.go index 3c8b033c0b..2ff67af5ac 100644 --- a/proto/text_test.go +++ b/proto/text_test.go @@ -1,33 +1,6 @@ -// 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_test diff --git a/protoc-gen-go/doc.go b/protoc-gen-go/doc.go deleted file mode 100644 index 0d6055d610..0000000000 --- a/protoc-gen-go/doc.go +++ /dev/null @@ -1,51 +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. - -/* - A plugin for the Google protocol buffer compiler to generate Go code. - Run it by building this program and putting it in your path with the name - protoc-gen-go - That word 'go' at the end becomes part of the option string set for the - protocol compiler, so once the protocol compiler (protoc) is installed - you can run - protoc --go_out=output_directory input_directory/file.proto - to generate Go bindings for the protocol defined by file.proto. - With that input, the output will be written to - output_directory/file.pb.go - - The generated code is documented in the package comment for - the library. - - See the README and documentation for protocol buffers to learn more: - https://developers.google.com/protocol-buffers/ - -*/ -package documentation diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index e28084d203..03950d95b1 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -1,33 +1,6 @@ -// 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 generator is deprecated. // diff --git a/protoc-gen-go/generator/internal/remap/remap.go b/protoc-gen-go/generator/internal/remap/remap.go index a9b61036cc..e688c8941d 100644 --- a/protoc-gen-go/generator/internal/remap/remap.go +++ b/protoc-gen-go/generator/internal/remap/remap.go @@ -1,38 +1,9 @@ -// 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 2017 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 remap handles tracking the locations of Go tokens in a source text -across a rewrite by the Go formatter. -*/ +// Package remap handles tracking the locations of Go tokens in a source text +// across a rewrite by the Go formatter. package remap import ( diff --git a/protoc-gen-go/generator/internal/remap/remap_test.go b/protoc-gen-go/generator/internal/remap/remap_test.go index ccc7fca031..441ef57cb4 100644 --- a/protoc-gen-go/generator/internal/remap/remap_test.go +++ b/protoc-gen-go/generator/internal/remap/remap_test.go @@ -1,33 +1,6 @@ -// 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 2017 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 remap diff --git a/protoc-gen-go/generator/name_test.go b/protoc-gen-go/generator/name_test.go index e4a119d6fb..07ddb77a09 100644 --- a/protoc-gen-go/generator/name_test.go +++ b/protoc-gen-go/generator/name_test.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2013 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 2013 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 generator diff --git a/protoc-gen-go/golden_test.go b/protoc-gen-go/golden_test.go index 2950eac75b..3e99b4b65a 100644 --- a/protoc-gen-go/golden_test.go +++ b/protoc-gen-go/golden_test.go @@ -1,3 +1,7 @@ +// 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 main import ( diff --git a/protoc-gen-go/grpc/grpc.go b/protoc-gen-go/grpc/grpc.go index e6db758c70..88e20d7af9 100644 --- a/protoc-gen-go/grpc/grpc.go +++ b/protoc-gen-go/grpc/grpc.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2015 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 2015 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 grpc is deprecated. // diff --git a/protoc-gen-go/main.go b/protoc-gen-go/main.go index d9aef43d48..3d6ebba4e0 100644 --- a/protoc-gen-go/main.go +++ b/protoc-gen-go/main.go @@ -1,51 +1,22 @@ -// 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. // protoc-gen-go is a plugin for the Google protocol buffer compiler to generate -// Go code. Run it by building this program and putting it in your path with -// the name -// protoc-gen-go -// That word 'go' at the end becomes part of the option string set for the -// protocol compiler, so once the protocol compiler (protoc) is installed -// you can run -// protoc --go_out=output_directory input_directory/file.proto -// to generate Go bindings for the protocol defined by file.proto. -// With that input, the output will be written to -// output_directory/file.pb.go +// Go code. Install it by building this program and making it accessible within +// your PATH with the name: +// protoc-gen-go +// +// The 'go' suffix becomes part of the argument for the protocol compiler, +// such that it can be invoked as: +// protoc --go_out=paths=source_relative:. path/to/file.proto // -// The generated code is documented in the package comment for -// the library. +// This generates Go bindings for the protocol buffer defined by file.proto. +// With that input, the output will be written to: +// path/to/file.pb.go // // See the README and documentation for protocol buffers to learn more: -// https://developers.google.com/protocol-buffers/ +// https://developers.google.com/protocol-buffers/ package main import ( diff --git a/protoc-gen-go/testdata/extension_test.go b/protoc-gen-go/testdata/extension_test.go index 0524729922..2e0ff4e3da 100644 --- a/protoc-gen-go/testdata/extension_test.go +++ b/protoc-gen-go/testdata/extension_test.go @@ -1,33 +1,6 @@ -// 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. // Test that we can use protocol buffers that use extensions. diff --git a/protoc-gen-go/testdata/import_public_test.go b/protoc-gen-go/testdata/import_public_test.go index 0667c4cb53..cd0689cf9e 100644 --- a/protoc-gen-go/testdata/import_public_test.go +++ b/protoc-gen-go/testdata/import_public_test.go @@ -1,33 +1,6 @@ -// 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 testdata diff --git a/protoc-gen-go/testdata/main_test.go b/protoc-gen-go/testdata/main_test.go index 7ec1f2dbaa..ffa5419f29 100644 --- a/protoc-gen-go/testdata/main_test.go +++ b/protoc-gen-go/testdata/main_test.go @@ -1,33 +1,6 @@ -// 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. // A simple binary to link together the protocol buffers in this test. diff --git a/ptypes/any.go b/ptypes/any.go index 70276e8f5c..3a847dfeef 100644 --- a/ptypes/any.go +++ b/ptypes/any.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 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 2016 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 ptypes diff --git a/ptypes/any_test.go b/ptypes/any_test.go index 871c6de1ef..053ab43b62 100644 --- a/ptypes/any_test.go +++ b/ptypes/any_test.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 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 2016 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 ptypes diff --git a/ptypes/doc.go b/ptypes/doc.go index c0d595da7a..b15f8c5394 100644 --- a/ptypes/doc.go +++ b/ptypes/doc.go @@ -1,35 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 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 2016 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 ptypes contains code for interacting with well-known types. -*/ +// Package ptypes contains code for interacting with well-known types. package ptypes diff --git a/ptypes/duration.go b/ptypes/duration.go index 65cb0f8eb5..e51dc126a6 100644 --- a/ptypes/duration.go +++ b/ptypes/duration.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 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 2016 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 ptypes diff --git a/ptypes/duration_test.go b/ptypes/duration_test.go index e00491a34f..0328e3f209 100644 --- a/ptypes/duration_test.go +++ b/ptypes/duration_test.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 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 2016 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 ptypes diff --git a/ptypes/timestamp.go b/ptypes/timestamp.go index 47f10dbc2c..ed4d006423 100644 --- a/ptypes/timestamp.go +++ b/ptypes/timestamp.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 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 2016 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 ptypes diff --git a/ptypes/timestamp_test.go b/ptypes/timestamp_test.go index 6e3c969b94..179f5035c3 100644 --- a/ptypes/timestamp_test.go +++ b/ptypes/timestamp_test.go @@ -1,33 +1,6 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 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 2016 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 ptypes From 87f1426e53050c0f4afa48ba109097ddb98b05a7 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 27 Nov 2018 14:39:42 -0800 Subject: [PATCH 029/133] protoapi: new package for v1 types that generated messages depend on Create a new package protoapi that contains the minimum set of types depended upon by generated messages so that a generated message implemented the v2 APIs do not need to import the v1 proto runtime. Some types like proto.Buffer are not included here since those dependencies are going away with PR#760. Explicitly document that no one should import this package directly, so we have the flexibility to remove this package if necessary. Change-Id: Iddd0c697c9170b809a587bee626347e4ffdddbc7 Reviewed-on: https://go-review.googlesource.com/c/151347 Reviewed-by: Damien Neil --- proto/clone.go | 38 ++--- proto/discard.go | 20 +-- proto/equal.go | 56 +++---- proto/extensions.go | 308 ++++++++++++--------------------------- proto/extensions_test.go | 2 +- proto/lib.go | 8 +- proto/message_set.go | 25 ++-- proto/table_marshal.go | 159 ++++++++++---------- proto/table_merge.go | 10 +- proto/table_unmarshal.go | 23 ++- proto/text.go | 36 ++--- proto/text_parser.go | 2 +- protoapi/api.go | 242 ++++++++++++++++++++++++++++++ 13 files changed, 530 insertions(+), 399 deletions(-) create mode 100644 protoapi/api.go diff --git a/proto/clone.go b/proto/clone.go index 29e93c3432..aea08994f1 100644 --- a/proto/clone.go +++ b/proto/clone.go @@ -12,6 +12,9 @@ import ( "log" "reflect" "strings" + + "github.com/golang/protobuf/protoapi" + "github.com/golang/protobuf/v2/reflect/protoreflect" ) // Clone returns a deep copy of a protocol buffer. @@ -83,12 +86,10 @@ func mergeStruct(out, in reflect.Value) { 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() + if emIn.HasInit() { + emIn.Lock() + mergeExtension(emOut, emIn) + emIn.Unlock() } } @@ -208,19 +209,20 @@ func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { } } -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() +func mergeExtension(out, in protoapi.ExtensionFields) { + in.Range(func(extNum protoreflect.FieldNumber, eIn Extension) bool { + 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) + if eIn.Raw != nil { + eOut.Raw = make([]byte, len(eIn.Raw)) + copy(eOut.Raw, eIn.Raw) } - out[extNum] = eOut - } + out.Set(extNum, eOut) + return true + }) } diff --git a/proto/discard.go b/proto/discard.go index 5504736e92..c850e0905b 100644 --- a/proto/discard.go +++ b/proto/discard.go @@ -10,6 +10,8 @@ import ( "strings" "sync" "sync/atomic" + + "github.com/golang/protobuf/v2/reflect/protoreflect" ) type generatedDiscarder interface { @@ -96,13 +98,12 @@ func (di *discardInfo) discard(src pointer) { // 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 { + em.Range(func(_ protoreflect.FieldNumber, mx Extension) bool { + if m, ok := mx.Value.(Message); ok { DiscardUnknown(m) } - } + return true + }) } if di.unrecognized.IsValid() { @@ -312,12 +313,11 @@ func discardLegacy(m Message) { // 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 { + em.Range(func(_ protoreflect.FieldNumber, mx Extension) bool { + if m, ok := mx.Value.(Message); ok { discardLegacy(m) } - } + return true + }) } } diff --git a/proto/equal.go b/proto/equal.go index e4dc9fb276..b87230172d 100644 --- a/proto/equal.go +++ b/proto/equal.go @@ -11,6 +11,9 @@ import ( "log" "reflect" "strings" + + "github.com/golang/protobuf/protoapi" + "github.com/golang/protobuf/v2/reflect/protoreflect" ) /* @@ -91,14 +94,18 @@ func equalStruct(v1, v2 reflect.Value) bool { 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)) { + m1 := protoapi.ExtensionFieldsOf(em1.Addr().Interface()) + m2 := protoapi.ExtensionFieldsOf(em2.Addr().Interface()) + if !equalExtensions(v1.Type(), m1, m2) { 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)) { + m1 := protoapi.ExtensionFieldsOf(em1.Addr().Interface()) + m2 := protoapi.ExtensionFieldsOf(em2.Addr().Interface()) + if !equalExtensions(v1.Type(), m1, m2) { return false } } @@ -200,32 +207,26 @@ func equalAny(v1, v2 reflect.Value, prop *Properties) bool { 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) { +func equalExtensions(base reflect.Type, em1, em2 protoapi.ExtensionFields) bool { + if em1.Len() != em2.Len() { return false } - for extNum, e1 := range em1 { - e2, ok := em2[extNum] - if !ok { + equal := true + em1.Range(func(extNum protoreflect.FieldNumber, e1 Extension) bool { + if !em2.Has(extNum) { + equal = false return false } + e2 := em2.Get(extNum) - m1 := extensionAsLegacyType(e1.value) - m2 := extensionAsLegacyType(e2.value) + 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 + if bytes.Equal(e1.Raw, e2.Raw) { + return true } // The bytes are different, but the extensions might still be // equal. We need to decode them to compare. @@ -234,16 +235,17 @@ func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { if m1 != nil && m2 != nil { // Both are unencoded. if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { + equal = false return false } - continue + return true } // 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] + desc = m[int32(extNum)] } if desc == nil { // If both have only encoded form and the bytes are the same, @@ -251,24 +253,28 @@ func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { // 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) + equal = false return false } var err error if m1 == nil { - m1, err = decodeExtension(e1.enc, desc) + m1, err = decodeExtension(e1.Raw, desc) } if m2 == nil && err == nil { - m2, err = decodeExtension(e2.enc, desc) + m2, err = decodeExtension(e2.Raw, desc) } if err != nil { // The encoded form is invalid. log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err) + equal = false return false } if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { + equal = false return false } - } + return true + }) - return true + return equal } diff --git a/proto/extensions.go b/proto/extensions.go index a944f72623..d0f1598da5 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -15,68 +15,30 @@ import ( "reflect" "strconv" "sync" + + "github.com/golang/protobuf/protoapi" + "github.com/golang/protobuf/v2/reflect/protoreflect" ) // 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 -} - -func (e extensionAdapter) extensionsWrite() map[int32]Extension { - return e.ExtensionMap() -} - -func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { - return e.ExtensionMap(), notLocker{} -} - -// notLocker is a sync.Locker whose Lock and Unlock methods are nops. -type notLocker struct{} - -func (n notLocker) Lock() {} -func (n notLocker) Unlock() {} - -// 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) +func extendable(p interface{}) (protoapi.ExtensionFields, error) { + type extendableProto interface { + Message + ExtensionRangeArray() []ExtensionRange + } + if _, ok := p.(extendableProto); ok { + v := reflect.ValueOf(p) + if v.Kind() == reflect.Ptr && !v.IsNil() { + v = v.Elem() + if v := v.FieldByName("XXX_InternalExtensions"); v.IsValid() { + return protoapi.ExtensionFieldsOf(v.Addr().Interface()), nil + } + if v := v.FieldByName("XXX_extensions"); v.IsValid() { + return protoapi.ExtensionFieldsOf(v.Addr().Interface()), nil + } } - return extensionAdapter{p}, nil } // Don't allocate a specific error containing %T: // this is the hot path for Clone and MarshalText. @@ -85,129 +47,47 @@ func extendable(p interface{}) (extendableProto, error) { 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 - } -} - -// 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 - }) - 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 - } - 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 -} +type ( + ExtensionRange = protoapi.ExtensionRange + ExtensionDesc = protoapi.ExtensionDesc + Extension = protoapi.ExtensionField + XXX_InternalExtensions = protoapi.XXX_InternalExtensions +) -func (ed *ExtensionDesc) repeated() bool { +func isRepeatedExtension(ed *ExtensionDesc) 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 -} - // SetRawExtension is for testing only. func SetRawExtension(base Message, id int32, b []byte) { epb, err := extendable(base) if err != nil { return } - extmap := epb.extensionsWrite() - extmap[id] = Extension{enc: b} + epb.Set(protoreflect.FieldNumber(id), Extension{Raw: 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 { - return true +func isExtensionField(pb Message, field int32) bool { + m, ok := pb.(interface{ ExtensionRangeArray() []ExtensionRange }) + if ok { + for _, er := range m.ExtensionRangeArray() { + if er.Start <= field && field <= er.End { + 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 +// checkExtensionTypeAndRanges checks that the given extension is valid for pb. +func checkExtensionTypeAndRanges(pb Message, extension *ExtensionDesc) error { // 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) + if extension.ExtendedType != nil { + if a, b := reflect.TypeOf(pb), 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) { @@ -229,8 +109,8 @@ var extProp = struct { m: make(map[extPropKey]*Properties), } -func extensionProperties(ed *ExtensionDesc) *Properties { - key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field} +func extensionProperties(pb Message, ed *ExtensionDesc) *Properties { + key := extPropKey{base: reflect.TypeOf(pb), field: ed.Field} extProp.RLock() if prop, ok := extProp.m[key]; ok { @@ -259,14 +139,12 @@ func HasExtension(pb Message, extension *ExtensionDesc) bool { if err != nil { return false } - extmap, mu := epb.extensionsRead() - if extmap == nil { + if !epb.HasInit() { return false } - mu.Lock() - _, ok := extmap[extension.Field] - mu.Unlock() - return ok + epb.Lock() + defer epb.Unlock() + return epb.Has(protoreflect.FieldNumber(extension.Field)) } // ClearExtension removes the given extension from pb. @@ -276,8 +154,7 @@ func ClearExtension(pb Message, extension *ExtensionDesc) { return } // TODO: Check types, field numbers, etc.? - extmap := epb.extensionsWrite() - delete(extmap, extension.Field) + epb.Clear(protoreflect.FieldNumber(extension.Field)) } // GetExtension retrieves a proto2 extended field from pb. @@ -295,66 +172,63 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { 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 - } + // can only check type if this is a complete descriptor + if err := checkExtensionTypeAndRanges(pb, extension); err != nil { + return nil, err } - emap, mu := epb.extensionsRead() - if emap == nil { - return defaultExtensionValue(extension) + if !epb.HasInit() { + return defaultExtensionValue(pb, extension) } - mu.Lock() - defer mu.Unlock() - e, ok := emap[extension.Field] - if !ok { + epb.Lock() + defer epb.Unlock() + if !epb.Has(protoreflect.FieldNumber(extension.Field)) { // defaultExtensionValue returns the default value or // ErrMissingExtension if there is no default. - return defaultExtensionValue(extension) + return defaultExtensionValue(pb, extension) } + e := epb.Get(protoreflect.FieldNumber(extension.Field)) - if e.value != nil { + if e.Value != nil { // Already decoded. Check the descriptor, though. - if e.desc != extension { + 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 + return extensionAsLegacyType(e.Value), nil } if extension.ExtensionType == nil { // incomplete descriptor - return e.enc, nil + return e.Raw, nil } - v, err := decodeExtension(e.enc, extension) + v, err := decodeExtension(e.Raw, extension) if err != nil { return nil, err } // Remember the decoded version and drop the encoded version. // That way it is safe to mutate what we return. - e.value = extensionAsStorageType(v) - e.desc = extension - e.enc = nil - emap[extension.Field] = e - return extensionAsLegacyType(e.value), nil + e.Value = extensionAsStorageType(v) + e.Desc = extension + e.Raw = nil + epb.Set(protoreflect.FieldNumber(extension.Field), e) + return extensionAsLegacyType(e.Value), nil } // defaultExtensionValue returns the default value for extension. // If no default for an extension is defined ErrMissingExtension is returned. -func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { +func defaultExtensionValue(pb Message, extension *ExtensionDesc) (interface{}, error) { if extension.ExtensionType == nil { // incomplete descriptor, so no default return nil, ErrMissingExtension } t := reflect.TypeOf(extension.ExtensionType) - props := extensionProperties(extension) + props := extensionProperties(pb, extension) sf, _, err := fieldDefault(t, props) if err != nil { @@ -376,7 +250,7 @@ func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { value.Set(reflect.New(value.Type().Elem())) if sf.kind == reflect.Int32 { // We may have an int32 or an enum, but the underlying data is int32. - // Since we can't set an int32 into a non int32 reflect.value directly + // Since we can't set an int32 into a non int32 reflect.Value directly // set it as a int32. value.Elem().SetInt(int64(sf.value.(int32))) } else { @@ -418,13 +292,13 @@ func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { // GetExtensions returns a slice of the extensions present in pb that are also listed in es. // The returned slice has the same length as es; missing extensions will appear as nil elements. func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { - epb, err := extendable(pb) + _, err = extendable(pb) if err != nil { return nil, err } extensions = make([]interface{}, len(es)) for i, e := range es { - extensions[i], err = GetExtension(epb, e) + extensions[i], err = GetExtension(pb, e) if err == ErrMissingExtension { err = nil } @@ -445,24 +319,24 @@ func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { } registeredExtensions := RegisteredExtensions(pb) - emap, mu := epb.extensionsRead() - if emap == nil { + if !epb.HasInit() { return nil, nil } - mu.Lock() - defer mu.Unlock() - extensions := make([]*ExtensionDesc, 0, len(emap)) - for extid, e := range emap { - desc := e.desc + epb.Lock() + defer epb.Unlock() + extensions := make([]*ExtensionDesc, 0, epb.Len()) + epb.Range(func(extid protoreflect.FieldNumber, e Extension) bool { + desc := e.Desc if desc == nil { - desc = registeredExtensions[extid] + desc = registeredExtensions[int32(extid)] if desc == nil { - desc = &ExtensionDesc{Field: extid} + desc = &ExtensionDesc{Field: int32(extid)} } } extensions = append(extensions, desc) - } + return true + }) return extensions, nil } @@ -472,7 +346,7 @@ func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error if err != nil { return err } - if err := checkExtensionTypes(epb, extension); err != nil { + if err := checkExtensionTypeAndRanges(pb, extension); err != nil { return err } typ := reflect.TypeOf(extension.ExtensionType) @@ -488,8 +362,10 @@ func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) } - extmap := epb.extensionsWrite() - extmap[extension.Field] = Extension{desc: extension, value: extensionAsStorageType(value)} + epb.Set(protoreflect.FieldNumber(extension.Field), Extension{ + Desc: extension, + Value: extensionAsStorageType(value), + }) return nil } @@ -499,10 +375,10 @@ func ClearAllExtensions(pb Message) { if err != nil { return } - m := epb.extensionsWrite() - for k := range m { - delete(m, k) - } + epb.Range(func(k protoreflect.FieldNumber, _ Extension) bool { + epb.Clear(k) + return true + }) } // A global registry of extensions. @@ -532,7 +408,7 @@ func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { } // extensionAsLegacyType converts an value in the storage type as the API type. -// See Extension.value. +// See Extension.Value. func extensionAsLegacyType(v interface{}) interface{} { switch rv := reflect.ValueOf(v); rv.Kind() { case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: @@ -555,7 +431,7 @@ func extensionAsLegacyType(v interface{}) interface{} { } // extensionAsStorageType converts an value in the API type as the storage type. -// See Extension.value. +// See Extension.Value. func extensionAsStorageType(v interface{}) interface{} { switch rv := reflect.ValueOf(v); rv.Kind() { case reflect.Ptr: diff --git a/proto/extensions_test.go b/proto/extensions_test.go index a32243d765..767a153e13 100644 --- a/proto/extensions_test.go +++ b/proto/extensions_test.go @@ -377,7 +377,7 @@ func TestNilMessage(t *testing.T) { desc := pb.E_Ext_More isNotExtendable := func(err error) bool { - return strings.Contains(fmt.Sprint(err), "not extendable") + return strings.Contains(fmt.Sprint(err), "not an extendable") } if proto.HasExtension(nilMsg, desc) { diff --git a/proto/lib.go b/proto/lib.go index 4fa41eb779..932553f6d1 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -248,6 +248,8 @@ import ( // Add a bogus dependency on the v2 API to ensure the Go toolchain does not // remove our dependency from the go.mod file. _ "github.com/golang/protobuf/v2/reflect/protoreflect" + + "github.com/golang/protobuf/protoapi" ) // RequiredNotSetError is an error type returned by either Marshal or Unmarshal. @@ -312,11 +314,7 @@ func (nf *nonFatal) Merge(err error) (ok bool) { } // Message is implemented by generated protocol buffer messages. -type Message interface { - Reset() - String() string - ProtoMessage() -} +type Message = protoapi.Message // A Buffer is a buffer manager for marshaling and unmarshaling // protocol buffers. It may be reused between invocations to diff --git a/proto/message_set.go b/proto/message_set.go index c75407cf5a..19a1a00852 100644 --- a/proto/message_set.go +++ b/proto/message_set.go @@ -10,6 +10,9 @@ package proto import ( "errors" + + "github.com/golang/protobuf/protoapi" + "github.com/golang/protobuf/v2/reflect/protoreflect" ) // errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. @@ -115,32 +118,26 @@ func skipVarint(buf []byte) []byte { // unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. // It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. func unmarshalMessageSet(buf []byte, exts interface{}) error { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - m = exts.extensionsWrite() - case map[int32]Extension: - m = exts - default: - return errors.New("proto: not an extension map") - } + m := protoapi.ExtensionFieldsOf(exts) ms := new(messageSet) if err := Unmarshal(buf, ms); err != nil { return err } for _, item := range ms.Item { - id := *item.TypeId + id := protoreflect.FieldNumber(*item.TypeId) msg := item.Message // Restore wire type and field number varint, plus length varint. // Be careful to preserve duplicate items. b := EncodeVarint(uint64(id)<<3 | WireBytes) - if ext, ok := m[id]; ok { + if m.Has(id) { + ext := m.Get(id) + // Existing data; rip off the tag and length varint // so we join the new data correctly. - // We can assume that ext.enc is set because we are unmarshaling. - o := ext.enc[len(b):] // skip wire type and field number + // We can assume that ext.Raw is set because we are unmarshaling. + o := ext.Raw[len(b):] // skip wire type and field number _, n := DecodeVarint(o) // calculate length of length varint o = o[n:] // skip length varint msg = append(o, msg...) // join old data and new data @@ -148,7 +145,7 @@ func unmarshalMessageSet(buf []byte, exts interface{}) error { b = append(b, EncodeVarint(uint64(len(msg)))...) b = append(b, msg...) - m[id] = Extension{enc: b} + m.Set(id, Extension{Raw: b}) } return nil } diff --git a/proto/table_marshal.go b/proto/table_marshal.go index 60340d666c..528388ad4f 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -15,6 +15,9 @@ import ( "sync" "sync/atomic" "unicode/utf8" + + "github.com/golang/protobuf/protoapi" + "github.com/golang/protobuf/v2/reflect/protoreflect" ) // a sizer takes a pointer to a field and the size of its tag, computes the size of @@ -2362,82 +2365,86 @@ func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, ma // sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field. func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { - m, mu := ext.extensionsRead() - if m == nil { + m := protoapi.ExtensionFieldsOf(ext) + if !m.HasInit() { return 0 } - mu.Lock() + m.Lock() + defer m.Unlock() n := 0 - for _, e := range m { - if e.value == nil || e.desc == nil { + m.Range(func(_ protoreflect.FieldNumber, e Extension) bool { + if e.Value == nil || e.Desc == nil { // Extension is only in its encoded form. - n += len(e.enc) - continue + n += len(e.Raw) + return true } // We don't skip extensions that have an encoded form set, // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.desc) - v := e.value + ei := u.getExtElemInfo(e.Desc) + v := e.Value p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, ei.tagsize) - } - mu.Unlock() + return true + }) return n } // appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b. func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m, mu := ext.extensionsRead() - if m == nil { + m := protoapi.ExtensionFieldsOf(ext) + if !m.HasInit() { return b, nil } - mu.Lock() - defer mu.Unlock() + m.Lock() + defer m.Unlock() var err error var nerr nonFatal // Fast-path for common cases: zero or one extensions. // Don't bother sorting the keys. - if len(m) <= 1 { - for _, e := range m { - if e.value == nil || e.desc == nil { + if m.Len() <= 1 { + m.Range(func(_ protoreflect.FieldNumber, e Extension) bool { + if e.Value == nil || e.Desc == nil { // Extension is only in its encoded form. - b = append(b, e.enc...) - continue + b = append(b, e.Raw...) + return true } // We don't skip extensions that have an encoded form set, // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.desc) - v := e.value + ei := u.getExtElemInfo(e.Desc) + v := e.Value p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { - return b, err + return false } - } - return b, nerr.E + err = nerr.E + return true + }) + return b, err } // Sort the keys to provide a deterministic encoding. // Not sure this is required, but the old code does it. - keys := make([]int, 0, len(m)) - for k := range m { + keys := make([]int, 0, m.Len()) + m.Range(func(k protoreflect.FieldNumber, _ Extension) bool { keys = append(keys, int(k)) - } + return true + }) sort.Ints(keys) for _, k := range keys { - e := m[int32(k)] - if e.value == nil || e.desc == nil { + e := m.Get(protoreflect.FieldNumber(k)) + if e.Value == nil || e.Desc == nil { // Extension is only in its encoded form. - b = append(b, e.enc...) + b = append(b, e.Raw...) continue } @@ -2445,8 +2452,8 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.desc) - v := e.value + ei := u.getExtElemInfo(e.Desc) + v := e.Value p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { @@ -2467,100 +2474,104 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de // sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field // in message set format (above). func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { - m, mu := ext.extensionsRead() - if m == nil { + m := protoapi.ExtensionFieldsOf(ext) + if !m.HasInit() { return 0 } - mu.Lock() + m.Lock() + defer m.Unlock() n := 0 - for id, e := range m { + m.Range(func(id protoreflect.FieldNumber, e Extension) bool { n += 2 // start group, end group. tag = 1 (size=1) n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) - if e.value == nil || e.desc == nil { + if e.Value == nil || e.Desc == nil { // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint + msgWithLen := skipVarint(e.Raw) // skip old tag, but leave the length varint siz := len(msgWithLen) n += siz + 1 // message, tag = 3 (size=1) - continue + return true } // We don't skip extensions that have an encoded form set, // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.desc) - v := e.value + ei := u.getExtElemInfo(e.Desc) + v := e.Value p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, 1) // message, tag = 3 (size=1) - } - mu.Unlock() + return true + }) return n } // appendMessageSet marshals a XXX_InternalExtensions field in message set format (above) // to the end of byte slice b. func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m, mu := ext.extensionsRead() - if m == nil { + m := protoapi.ExtensionFieldsOf(ext) + if !m.HasInit() { return b, nil } - mu.Lock() - defer mu.Unlock() + m.Lock() + defer m.Unlock() var err error var nerr nonFatal // Fast-path for common cases: zero or one extensions. // Don't bother sorting the keys. - if len(m) <= 1 { - for id, e := range m { + if m.Len() <= 1 { + m.Range(func(id protoreflect.FieldNumber, e Extension) bool { b = append(b, 1<<3|WireStartGroup) b = append(b, 2<<3|WireVarint) b = appendVarint(b, uint64(id)) - if e.value == nil || e.desc == nil { + if e.Value == nil || e.Desc == nil { // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint + msgWithLen := skipVarint(e.Raw) // skip old tag, but leave the length varint b = append(b, 3<<3|WireBytes) b = append(b, msgWithLen...) b = append(b, 1<<3|WireEndGroup) - continue + return true } // We don't skip extensions that have an encoded form set, // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.desc) - v := e.value + ei := u.getExtElemInfo(e.Desc) + v := e.Value p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) if !nerr.Merge(err) { - return b, err + return false } b = append(b, 1<<3|WireEndGroup) - } - return b, nerr.E + err = nerr.E + return true + }) + return b, err } // Sort the keys to provide a deterministic encoding. - keys := make([]int, 0, len(m)) - for k := range m { + keys := make([]int, 0, m.Len()) + m.Range(func(k protoreflect.FieldNumber, _ Extension) bool { keys = append(keys, int(k)) - } + return true + }) sort.Ints(keys) for _, id := range keys { - e := m[int32(id)] + e := m.Get(protoreflect.FieldNumber(id)) b = append(b, 1<<3|WireStartGroup) b = append(b, 2<<3|WireVarint) b = appendVarint(b, uint64(id)) - if e.value == nil || e.desc == nil { + if e.Value == nil || e.Desc == nil { // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint + msgWithLen := skipVarint(e.Raw) // skip old tag, but leave the length varint b = append(b, 3<<3|WireBytes) b = append(b, msgWithLen...) b = append(b, 1<<3|WireEndGroup) @@ -2571,8 +2582,8 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.desc) - v := e.value + ei := u.getExtElemInfo(e.Desc) + v := e.Value p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) b = append(b, 1<<3|WireEndGroup) @@ -2591,9 +2602,9 @@ func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { n := 0 for _, e := range m { - if e.value == nil || e.desc == nil { + if e.Value == nil || e.Desc == nil { // Extension is only in its encoded form. - n += len(e.enc) + n += len(e.Raw) continue } @@ -2601,8 +2612,8 @@ func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.desc) - v := e.value + ei := u.getExtElemInfo(e.Desc) + v := e.Value p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, ei.tagsize) } @@ -2626,9 +2637,9 @@ func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, determ var nerr nonFatal for _, k := range keys { e := m[int32(k)] - if e.value == nil || e.desc == nil { + if e.Value == nil || e.Desc == nil { // Extension is only in its encoded form. - b = append(b, e.enc...) + b = append(b, e.Raw...) continue } @@ -2636,8 +2647,8 @@ func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, determ // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.desc) - v := e.value + ei := u.getExtElemInfo(e.Desc) + v := e.Value p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { diff --git a/proto/table_merge.go b/proto/table_merge.go index ee0a4d3701..4edb4f4e0f 100644 --- a/proto/table_merge.go +++ b/proto/table_merge.go @@ -117,12 +117,10 @@ func (mi *mergeInfo) merge(dst, src pointer) { in := src.asPointerTo(mi.typ).Elem() 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() + if emIn.HasInit() { + emIn.Lock() + mergeExtension(emOut, emIn) + emIn.Unlock() } } diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index 29fa5ca69e..3b9c5b3dc5 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -15,6 +15,9 @@ import ( "sync" "sync/atomic" "unicode/utf8" + + "github.com/golang/protobuf/protoapi" + "github.com/golang/protobuf/v2/reflect/protoreflect" ) // Unmarshal is the entry point from the generated .pb.go files. @@ -183,26 +186,22 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { // Keep unrecognized data around. // maybe in extensions, maybe in the unrecognized field. z := m.offset(u.unrecognized).toBytes() - var emap map[int32]Extension + var emap protoapi.ExtensionFields var e Extension for _, r := range u.extensionRanges { if uint64(r.Start) <= tag && tag <= uint64(r.End) { if u.extensions.IsValid() { mp := m.offset(u.extensions).toExtensions() - emap = mp.extensionsWrite() - e = emap[int32(tag)] - z = &e.enc + emap = protoapi.ExtensionFieldsOf(mp) + e = emap.Get(protoreflect.FieldNumber(tag)) + z = &e.Raw break } if u.oldExtensions.IsValid() { p := m.offset(u.oldExtensions).toOldExtensions() - emap = *p - if emap == nil { - emap = map[int32]Extension{} - *p = emap - } - e = emap[int32(tag)] - z = &e.enc + emap = protoapi.ExtensionFieldsOf(p) + e = emap.Get(protoreflect.FieldNumber(tag)) + z = &e.Raw break } panic("no extensions field available") @@ -220,7 +219,7 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { *z = append(*z, b0[:len(b0)-len(b)]...) if emap != nil { - emap[int32(tag)] = e + emap.Set(protoreflect.FieldNumber(tag), e) } } if reqMask != u.reqMask && errLater == nil { diff --git a/proto/text.go b/proto/text.go index 6a6fc42175..d9cd9cc782 100644 --- a/proto/text.go +++ b/proto/text.go @@ -18,6 +18,8 @@ import ( "reflect" "sort" "strings" + + "github.com/golang/protobuf/v2/reflect/protoreflect" ) var ( @@ -641,11 +643,11 @@ func writeUnknownInt(w *textWriter, x uint64, err error) error { return err } -type int32Slice []int32 +type fieldNumSlice []protoreflect.FieldNumber -func (s int32Slice) Len() int { return len(s) } -func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } -func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s fieldNumSlice) Len() int { return len(s) } +func (s fieldNumSlice) Less(i, j int) bool { return s[i] < s[j] } +func (s fieldNumSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } // writeExtensions writes all the extensions in pv. // pv is assumed to be a pointer to a protocol message struct that is extendable. @@ -656,39 +658,39 @@ func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error // Order the extensions by ID. // This isn't strictly necessary, but it will give us // canonical output, which will also make testing easier. - m, mu := ep.extensionsRead() - if m == nil { + if !ep.HasInit() { return nil } - mu.Lock() - ids := make([]int32, 0, len(m)) - for id := range m { + ep.Lock() + ids := make([]protoreflect.FieldNumber, 0, ep.Len()) + ep.Range(func(id protoreflect.FieldNumber, _ Extension) bool { ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) - mu.Unlock() + return true + }) + sort.Sort(fieldNumSlice(ids)) + ep.Unlock() for _, extNum := range ids { - ext := m[extNum] + ext := ep.Get(extNum) var desc *ExtensionDesc if emap != nil { - desc = emap[extNum] + desc = emap[int32(extNum)] } if desc == nil { // Unknown extension. - if err := writeUnknownStruct(w, ext.enc); err != nil { + if err := writeUnknownStruct(w, ext.Raw); err != nil { return err } continue } - pb, err := GetExtension(ep, desc) + pb, err := GetExtension(pv.Interface().(Message), desc) if err != nil { return fmt.Errorf("failed getting extension: %v", err) } // Repeated extensions will appear as a slice. - if !desc.repeated() { + if !isRepeatedExtension(desc) { if err := tm.writeExtension(w, desc.Name, pb); err != nil { return err } diff --git a/proto/text_parser.go b/proto/text_parser.go index 10e93d9bcd..93a1c63d7f 100644 --- a/proto/text_parser.go +++ b/proto/text_parser.go @@ -504,7 +504,7 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) error { return err } - rep := desc.repeated() + rep := isRepeatedExtension(desc) // Read the extension structure, and set it in // the value we're constructing. diff --git a/protoapi/api.go b/protoapi/api.go new file mode 100644 index 0000000000..6dca38352b --- /dev/null +++ b/protoapi/api.go @@ -0,0 +1,242 @@ +// 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 protoapi contains the set of types referenced by generated messages. +// +// WARNING: This package should only ever be imported by generated messages. +// The compatibility agreement covers nothing except for functionality needed +// to keep existing generated messages operational. +package protoapi + +import ( + "fmt" + "sync" + + "github.com/golang/protobuf/v2/reflect/protoreflect" +) + +// TODO: How to handle Registration during the v1 to v2 switchover? + +type ( + Message interface { + Reset() + String() string + ProtoMessage() + } + + ExtensionRange struct { + Start, End int32 // both inclusive + } + + ExtensionDesc struct { + // Type is the descriptor type for the extension field using the v2 API. + // If populated, the information in this field takes precedence over + // all other fields in ExtensionDesc. + Type protoreflect.ExtensionType + + // ExtendedType is a typed nil-pointer to the parent message type that + // is being extended. It is possible for this to be unpopulated in v2 + // since the message may no longer implement the v1 Message interface. + // + // Deprecated: Use Type.ExtendedType instead. + ExtendedType Message + + // ExtensionType is zero value of the extension type. + // + // For historical reasons, reflect.TypeOf(ExtensionType) and Type.GoType + // may not be identical: + // * for scalars (except []byte), where ExtensionType uses *T, + // while Type.GoType uses T. + // * for repeated fields, where ExtensionType uses []T, + // while Type.GoType uses *[]T. + // + // Deprecated: Use Type.GoType instead. + ExtensionType interface{} + + // Field is the field number of the extension. + // + // Deprecated: Use Type.Number instead. + Field int32 // field number + + // Name is the fully qualified name of extension. + // + // Deprecated: Use Type.FullName instead. + Name string + + // Tag is the protobuf struct tag used in the v1 API. + // + // Deprecated: Do not use. + Tag string + + // Filename is the proto filename in which the extension is defined. + // + // Deprecated: Use Type.Parent to ascend to the top-most parent and use + // protoreflect.FileDescriptor.Path. + Filename string + } + + ExtensionFields extensionFields + ExtensionField extensionField + XXX_InternalExtensions extensionSyncMap +) + +// ExtensionFieldsOf returns an ExtensionFields abstraction over various +// internal representations of extension fields. +func ExtensionFieldsOf(p interface{}) ExtensionFields { + switch p := p.(type) { + case *map[int32]ExtensionField: + return (*extensionMap)(p) + case *XXX_InternalExtensions: + return (*extensionSyncMap)(p) + default: + panic(fmt.Sprintf("invalid extension fields type: %T", p)) + } +} + +type extensionFields interface { + Len() int + Has(protoreflect.FieldNumber) bool + Get(protoreflect.FieldNumber) ExtensionField + Set(protoreflect.FieldNumber, ExtensionField) + Clear(protoreflect.FieldNumber) + Range(f func(protoreflect.FieldNumber, ExtensionField) bool) + + // HasInit and Locker are used by v1 GetExtension to provide + // an artificial degree of concurrent safety. + HasInit() bool + sync.Locker +} + +type extensionField struct { + // When an extension is stored in a message using SetExtension + // only desc and value are set. When the message is marshaled + // Raw will be set to the encoded form of the message. + // + // When a message is unmarshaled and contains extensions, each + // extension will have only Raw set. When such an extension is + // accessed using GetExtension (or GetExtensions) desc and value + // will be set. + Desc *ExtensionDesc // TODO: switch to protoreflect.ExtensionType + + // Value is a concrete value for the extension field. Let the type of + // Desc.ExtensionType be the "API type" and the type of Value be the + // "storage type". The API type and storage type are the same except: + // * for scalars (except []byte), where the API type uses *T, + // while the storage type uses T. + // * for repeated fields, where 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{} // TODO: switch to protoreflect.Value + + // Raw is the raw encoded bytes for the extension field. + // It is possible for Raw to be populated irrespective of whether the + // other fields are populated. + Raw []byte // TODO: switch to protoreflect.RawFields +} + +type extensionSyncMap struct { + p *struct { + mu sync.Mutex + m extensionMap + } +} + +func (m extensionSyncMap) Len() int { + if m.p == nil { + return 0 + } + return m.p.m.Len() +} +func (m extensionSyncMap) Has(n protoreflect.FieldNumber) bool { + if m.p == nil { + return false + } + return m.p.m.Has(n) +} +func (m extensionSyncMap) Get(n protoreflect.FieldNumber) ExtensionField { + if m.p == nil { + return ExtensionField{} + } + return m.p.m.Get(n) +} +func (m *extensionSyncMap) Set(n protoreflect.FieldNumber, x ExtensionField) { + if m.p == nil { + m.p = new(struct { + mu sync.Mutex + m extensionMap + }) + } + m.p.m.Set(n, x) +} +func (m extensionSyncMap) Clear(n protoreflect.FieldNumber) { + if m.p == nil { + return + } + m.p.m.Clear(n) +} +func (m extensionSyncMap) Range(f func(protoreflect.FieldNumber, ExtensionField) bool) { + if m.p == nil { + return + } + m.p.m.Range(f) +} + +func (m extensionSyncMap) HasInit() bool { + return m.p != nil +} +func (m extensionSyncMap) Lock() { + m.p.mu.Lock() +} +func (m extensionSyncMap) Unlock() { + m.p.mu.Unlock() +} + +type extensionMap map[int32]ExtensionField + +func (m extensionMap) Len() int { + return len(m) +} +func (m extensionMap) Has(n protoreflect.FieldNumber) bool { + _, ok := m[int32(n)] + return ok +} +func (m extensionMap) Get(n protoreflect.FieldNumber) ExtensionField { + return m[int32(n)] +} +func (m *extensionMap) Set(n protoreflect.FieldNumber, x ExtensionField) { + if *m == nil { + *m = make(map[int32]ExtensionField) + } + (*m)[int32(n)] = x +} +func (m *extensionMap) Clear(n protoreflect.FieldNumber) { + delete(*m, int32(n)) +} +func (m extensionMap) Range(f func(protoreflect.FieldNumber, ExtensionField) bool) { + for n, x := range m { + if !f(protoreflect.FieldNumber(n), x) { + return + } + } +} + +var globalLock sync.Mutex + +func (m extensionMap) HasInit() bool { + return m != nil +} +func (m extensionMap) Lock() { + if !m.HasInit() { + panic("cannot lock an uninitialized map") + } + globalLock.Lock() +} +func (m extensionMap) Unlock() { + globalLock.Lock() +} From 8f39668044312fefe96aeebdea4657bd554b03f2 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 30 Nov 2018 13:30:47 -0800 Subject: [PATCH 030/133] protoapi: fix trivial deadlock Change-Id: I7779711d9759aa31f479847b8ffd30f1d8cb3f1d Reviewed-on: https://go-review.googlesource.com/c/152019 Reviewed-by: Damien Neil --- protoapi/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoapi/api.go b/protoapi/api.go index 6dca38352b..1cae07b39f 100644 --- a/protoapi/api.go +++ b/protoapi/api.go @@ -238,5 +238,5 @@ func (m extensionMap) Lock() { globalLock.Lock() } func (m extensionMap) Unlock() { - globalLock.Lock() + globalLock.Unlock() } From 7e65e513332f05017b0d7a54f556546d83320a33 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 4 Dec 2018 22:48:16 -0800 Subject: [PATCH 031/133] protoapi: move registration from proto to protoapi In order to generate the descriptor package with reflection support, it must stop depending on the v1 proto package itself. However, it still depends on v1 proto for registration. Thus, to break descriptor's dependency on v1 proto, we temporarily move registration to the protoapi package. This move is temporary since registration will eventually be held in the v2 package and newly generated messages will directly register with the v2 registries, and legacy messages will continue to register through the v1 proto package, which will just forward the registrations to v2. However, the v2 registry is not complete yet. Change-Id: Iba16d5b3a947c332fc0506217e9e033076764092 Reviewed-on: https://go-review.googlesource.com/c/152546 Reviewed-by: Damien Neil --- proto/deprecated.go | 16 ++++- proto/equal.go | 3 +- proto/extensions.go | 27 -------- proto/lib.go | 38 ----------- proto/properties.go | 98 ----------------------------- proto/registry.go | 72 +++++++++++++++++++++ proto/table_marshal.go | 3 +- proto/table_unmarshal.go | 3 +- proto/text.go | 7 ++- proto/text_parser.go | 6 +- protoapi/impl.go | 53 ++++++++++++++++ protoapi/registry.go | 132 +++++++++++++++++++++++++++++++++++++++ 12 files changed, 288 insertions(+), 170 deletions(-) create mode 100644 proto/registry.go create mode 100644 protoapi/impl.go create mode 100644 protoapi/registry.go diff --git a/proto/deprecated.go b/proto/deprecated.go index 1a2cb14991..5aa7e6e754 100644 --- a/proto/deprecated.go +++ b/proto/deprecated.go @@ -4,7 +4,11 @@ package proto -import "errors" +import ( + "errors" + + "github.com/golang/protobuf/protoapi" +) // Deprecated: do not use. type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } @@ -34,3 +38,13 @@ func UnmarshalMessageSetJSON([]byte, interface{}) error { // Deprecated: do not use. func RegisterMessageSetType(Message, int32, string) {} + +// Deprecated: do not use. +func EnumName(m map[int32]string, v int32) string { + return protoapi.EnumName(m, v) +} + +// Deprecated: do not use. +func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { + return protoapi.UnmarshalJSONEnum(m, data, enumName) +} diff --git a/proto/equal.go b/proto/equal.go index b87230172d..c7097903f7 100644 --- a/proto/equal.go +++ b/proto/equal.go @@ -244,7 +244,8 @@ func equalExtensions(base reflect.Type, em1, em2 protoapi.ExtensionFields) bool // 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 { + mz := reflect.Zero(reflect.PtrTo(base)).Interface().(Message) + if m := protoapi.RegisteredExtensions(mz); m != nil { desc = m[int32(extNum)] } if desc == nil { diff --git a/proto/extensions.go b/proto/extensions.go index d0f1598da5..3923707b85 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -13,7 +13,6 @@ import ( "fmt" "io" "reflect" - "strconv" "sync" "github.com/golang/protobuf/protoapi" @@ -381,32 +380,6 @@ func ClearAllExtensions(pb Message) { }) } -// A global registry of extensions. -// The generated code will register the generated descriptors by calling RegisterExtension. - -var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) - -// RegisterExtension is called from the generated code. -func RegisterExtension(desc *ExtensionDesc) { - st := reflect.TypeOf(desc.ExtendedType).Elem() - m := extensionMaps[st] - if m == nil { - m = make(map[int32]*ExtensionDesc) - extensionMaps[st] = m - } - if _, ok := m[desc.Field]; ok { - panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) - } - m[desc.Field] = desc -} - -// RegisteredExtensions returns a map of the registered extensions of a -// protocol buffer struct, indexed by the extension number. -// The argument pb should be a nil pointer to the struct type. -func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { - return extensionMaps[reflect.TypeOf(pb).Elem()] -} - // extensionAsLegacyType converts an value in the storage type as the API type. // See Extension.Value. func extensionAsLegacyType(v interface{}) interface{} { diff --git a/proto/lib.go b/proto/lib.go index 932553f6d1..51e88fd206 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -237,7 +237,6 @@ To create and play with a Test object: package proto import ( - "encoding/json" "fmt" "log" "reflect" @@ -435,43 +434,6 @@ func String(v string) *string { return &v } -// EnumName is a helper function to simplify printing protocol buffer enums -// by name. Given an enum map and a value, it returns a useful string. -func EnumName(m map[int32]string, v int32) string { - s, ok := m[v] - if ok { - return s - } - return strconv.Itoa(int(v)) -} - -// UnmarshalJSONEnum is a helper function to simplify recovering enum int values -// from their JSON-encoded representation. Given a map from the enum's symbolic -// names to its int values, and a byte buffer containing the JSON-encoded -// value, it returns an int32 that can be cast to the enum type by the caller. -// -// The function can deal with both JSON representations, numeric and symbolic. -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 -} - // DebugPrint dumps the encoded data in b in a debugging format with a header // including the string s. Used in testing but made available for general debugging. func (p *Buffer) DebugPrint(s string, b []byte) { diff --git a/proto/properties.go b/proto/properties.go index d9d8bfaf55..07e6d4221d 100644 --- a/proto/properties.go +++ b/proto/properties.go @@ -10,7 +10,6 @@ package proto import ( "fmt" - "log" "os" "reflect" "sort" @@ -419,100 +418,3 @@ func getPropertiesLocked(t reflect.Type) *StructProperties { return prop } - -// A global registry of enum types. -// The generated code will register the generated maps by calling RegisterEnum. - -var enumValueMaps = make(map[string]map[string]int32) - -// RegisterEnum is called from the generated code to install the enum descriptor -// maps into the global table to aid parsing text format protocol buffers. -func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { - if _, ok := enumValueMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumValueMaps[typeName] = valueMap -} - -// EnumValueMap returns the mapping from names to integers of the -// enum type enumType, or a nil if not found. -func EnumValueMap(enumType string) map[string]int32 { - return enumValueMaps[enumType] -} - -// A registry of all linked message types. -// The string is a fully-qualified proto name ("pkg.Message"). -var ( - protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers - protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types - revProtoTypes = make(map[reflect.Type]string) -) - -// RegisterType is called from generated code and maps from the fully qualified -// proto name to the type (pointer to struct) of the protocol buffer. -func RegisterType(x Message, name string) { - if _, ok := protoTypedNils[name]; ok { - // TODO: Some day, make this a panic. - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { - // Generated code always calls RegisterType with nil x. - // This check is just for extra safety. - protoTypedNils[name] = x - } else { - protoTypedNils[name] = reflect.Zero(t).Interface().(Message) - } - revProtoTypes[t] = name -} - -// RegisterMapType is called from generated code and maps from the fully qualified -// proto name to the native map type of the proto map definition. -func RegisterMapType(x interface{}, name string) { - if reflect.TypeOf(x).Kind() != reflect.Map { - panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) - } - if _, ok := protoMapTypes[name]; ok { - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - protoMapTypes[name] = t - revProtoTypes[t] = name -} - -// MessageName returns the fully-qualified proto name for the given message type. -func MessageName(x Message) string { - type xname interface { - XXX_MessageName() string - } - if m, ok := x.(xname); ok { - return m.XXX_MessageName() - } - return revProtoTypes[reflect.TypeOf(x)] -} - -// MessageType returns the message type (pointer to struct) for a named message. -// The type is not guaranteed to implement proto.Message if the name refers to a -// map entry. -func MessageType(name string) reflect.Type { - if t, ok := protoTypedNils[name]; ok { - return reflect.TypeOf(t) - } - return protoMapTypes[name] -} - -// A registry of all linked proto files. -var ( - protoFiles = make(map[string][]byte) // file name => fileDescriptor -) - -// RegisterFile is called from generated code and maps from the -// full file name of a .proto file to its compressed FileDescriptorProto. -func RegisterFile(filename string, fileDescriptor []byte) { - protoFiles[filename] = fileDescriptor -} - -// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. -func FileDescriptor(filename string) []byte { return protoFiles[filename] } diff --git a/proto/registry.go b/proto/registry.go new file mode 100644 index 0000000000..b2c0265368 --- /dev/null +++ b/proto/registry.go @@ -0,0 +1,72 @@ +// Copyright 2016 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 ( + "reflect" + + "github.com/golang/protobuf/protoapi" +) + +// TODO: Registration should be written in terms of v2 registries. + +// RegisterEnum is called from the generated code to install the enum descriptor +// maps into the global table to aid parsing text format protocol buffers. +func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { + protoapi.RegisterEnum(typeName, unusedNameMap, valueMap) +} + +// EnumValueMap returns the mapping from names to integers of the +// enum type enumType, or a nil if not found. +func EnumValueMap(enumType string) map[string]int32 { + return protoapi.EnumValueMap(enumType) +} + +// RegisterType is called from generated code and maps from the fully qualified +// proto name to the type (pointer to struct) of the protocol buffer. +func RegisterType(x Message, name string) { + protoapi.RegisterType(x, name) +} + +// RegisterMapType is called from generated code and maps from the fully qualified +// proto name to the native map type of the proto map definition. +func RegisterMapType(x interface{}, name string) { + protoapi.RegisterMapType(x, name) +} + +// MessageName returns the fully-qualified proto name for the given message type. +func MessageName(x Message) string { + return protoapi.MessageName(x) +} + +// MessageType returns the message type (pointer to struct) for a named message. +// The type is not guaranteed to implement proto.Message if the name refers to a +// map entry. +func MessageType(name string) reflect.Type { + return protoapi.MessageType(name) +} + +// RegisterFile is called from generated code and maps from the +// full file name of a .proto file to its compressed FileDescriptorProto. +func RegisterFile(filename string, fileDescriptor []byte) { + protoapi.RegisterFile(filename, fileDescriptor) +} + +// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. +func FileDescriptor(filename string) []byte { + return protoapi.FileDescriptor(filename) +} + +// RegisterExtension is called from the generated code. +func RegisterExtension(desc *ExtensionDesc) { + protoapi.RegisterExtension(desc) +} + +// RegisteredExtensions returns a map of the registered extensions of a +// protocol buffer struct, indexed by the extension number. +// The argument pb should be a nil pointer to the struct type. +func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { + return protoapi.RegisteredExtensions(pb) +} diff --git a/proto/table_marshal.go b/proto/table_marshal.go index 528388ad4f..008d07db15 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -258,7 +258,8 @@ func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte } if err == errInvalidUTF8 { if errLater == nil { - fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name + mz := reflect.Zero(reflect.PtrTo(u.typ)).Interface().(Message) + fullName := protoapi.MessageName(mz) + "." + f.name errLater = &invalidUTF8Error{fullName} } continue diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index 3b9c5b3dc5..aed2af8f19 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -163,7 +163,8 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { if err != errInternalBadWireType { if err == errInvalidUTF8 { if errLater == nil { - fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name + mz := reflect.Zero(reflect.PtrTo(u.typ)).Interface().(Message) + fullName := protoapi.MessageName(mz) + "." + f.name errLater = &invalidUTF8Error{fullName} } continue diff --git a/proto/text.go b/proto/text.go index d9cd9cc782..dcbd98d7f0 100644 --- a/proto/text.go +++ b/proto/text.go @@ -19,6 +19,7 @@ import ( "sort" "strings" + "github.com/golang/protobuf/protoapi" "github.com/golang/protobuf/v2/reflect/protoreflect" ) @@ -652,7 +653,7 @@ func (s fieldNumSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } // writeExtensions writes all the extensions in pv. // pv is assumed to be a pointer to a protocol message struct that is extendable. func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { - emap := extensionMaps[pv.Type().Elem()] + emap := protoapi.RegisteredExtensions(pv.Interface().(Message)) ep, _ := extendable(pv.Interface()) // Order the extensions by ID. @@ -816,3 +817,7 @@ func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Ma // CompactTextString is the same as CompactText, but returns the string directly. func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } + +func init() { + protoapi.CompactTextString = CompactTextString +} diff --git a/proto/text_parser.go b/proto/text_parser.go index 93a1c63d7f..0371f0d5b4 100644 --- a/proto/text_parser.go +++ b/proto/text_parser.go @@ -15,6 +15,8 @@ import ( "strconv" "strings" "unicode/utf8" + + "github.com/golang/protobuf/protoapi" ) // Error string emitted when deserializing Any and fields are already set @@ -787,8 +789,8 @@ func (p *textParser) readAny(v reflect.Value, props *Properties) error { if len(props.Enum) == 0 { break } - m, ok := enumValueMaps[props.Enum] - if !ok { + m := protoapi.EnumValueMap(props.Enum) + if m == nil { break } x, ok := m[tok.value] diff --git a/protoapi/impl.go b/protoapi/impl.go new file mode 100644 index 0000000000..1801ed28a5 --- /dev/null +++ b/protoapi/impl.go @@ -0,0 +1,53 @@ +// 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 protoapi + +import ( + "encoding/json" + "fmt" + "strconv" +) + +// TODO: Are these the final signatures that we want? + +// EnumName is a helper function to simplify printing protocol buffer enums +// by name. Given an enum map and a value, it returns a useful string. +func EnumName(m map[int32]string, v int32) string { + s, ok := m[v] + if ok { + return s + } + return strconv.Itoa(int(v)) +} + +// UnmarshalJSONEnum is a helper function to simplify recovering enum int values +// from their JSON-encoded representation. Given a map from the enum's symbolic +// names to its int values, and a byte buffer containing the JSON-encoded +// value, it returns an int32 that can be cast to the enum type by the caller. +// +// The function can deal with both JSON representations, numeric and symbolic. +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 +} + +// TODO: Remove this when v2 textpb is available. +var CompactTextString func(Message) string diff --git a/protoapi/registry.go b/protoapi/registry.go new file mode 100644 index 0000000000..0383d4f458 --- /dev/null +++ b/protoapi/registry.go @@ -0,0 +1,132 @@ +// 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 protoapi + +import ( + "fmt" + "log" + "reflect" + "strconv" +) + +// TODO: This entire file should not exist and will eventually be deleted. +// This is added for bootstrapping purposes so that a descriptor proto can be +// generated that supports v2 reflection, but still registers into the +// v1 registries for the time being. + +var enumValueMaps = make(map[string]map[string]int32) + +// RegisterEnum is called from the generated code to install the enum descriptor +// maps into the global table to aid parsing text format protocol buffers. +func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { + if _, ok := enumValueMaps[typeName]; ok { + panic("proto: duplicate enum registered: " + typeName) + } + enumValueMaps[typeName] = valueMap +} + +// EnumValueMap returns the mapping from names to integers of the +// enum type enumType, or a nil if not found. +func EnumValueMap(enumType string) map[string]int32 { + return enumValueMaps[enumType] +} + +// A registry of all linked message types. +// The string is a fully-qualified proto name ("pkg.Message"). +var ( + protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers + protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types + revProtoTypes = make(map[reflect.Type]string) +) + +// RegisterType is called from generated code and maps from the fully qualified +// proto name to the type (pointer to struct) of the protocol buffer. +func RegisterType(x Message, name string) { + if _, ok := protoTypedNils[name]; ok { + // TODO: Some day, make this a panic. + log.Printf("proto: duplicate proto type registered: %s", name) + return + } + t := reflect.TypeOf(x) + if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { + // Generated code always calls RegisterType with nil x. + // This check is just for extra safety. + protoTypedNils[name] = x + } else { + protoTypedNils[name] = reflect.Zero(t).Interface().(Message) + } + revProtoTypes[t] = name +} + +// RegisterMapType is called from generated code and maps from the fully qualified +// proto name to the native map type of the proto map definition. +func RegisterMapType(x interface{}, name string) { + if reflect.TypeOf(x).Kind() != reflect.Map { + panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) + } + if _, ok := protoMapTypes[name]; ok { + log.Printf("proto: duplicate proto type registered: %s", name) + return + } + t := reflect.TypeOf(x) + protoMapTypes[name] = t + revProtoTypes[t] = name +} + +// MessageName returns the fully-qualified proto name for the given message type. +func MessageName(x Message) string { + type xname interface { + XXX_MessageName() string + } + if m, ok := x.(xname); ok { + return m.XXX_MessageName() + } + return revProtoTypes[reflect.TypeOf(x)] +} + +// MessageType returns the message type (pointer to struct) for a named message. +// The type is not guaranteed to implement proto.Message if the name refers to a +// map entry. +func MessageType(name string) reflect.Type { + if t, ok := protoTypedNils[name]; ok { + return reflect.TypeOf(t) + } + return protoMapTypes[name] +} + +// A registry of all linked proto files. +var protoFiles = make(map[string][]byte) // file name => fileDescriptor + +// RegisterFile is called from generated code and maps from the +// full file name of a .proto file to its compressed FileDescriptorProto. +func RegisterFile(filename string, fileDescriptor []byte) { + protoFiles[filename] = fileDescriptor +} + +// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. +func FileDescriptor(filename string) []byte { return protoFiles[filename] } + +var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) + +// RegisterExtension is called from the generated code. +func RegisterExtension(desc *ExtensionDesc) { + st := reflect.TypeOf(desc.ExtendedType).Elem() + m := extensionMaps[st] + if m == nil { + m = make(map[int32]*ExtensionDesc) + extensionMaps[st] = m + } + if _, ok := m[desc.Field]; ok { + panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) + } + m[desc.Field] = desc +} + +// RegisteredExtensions returns a map of the registered extensions of a +// protocol buffer struct, indexed by the extension number. +// The argument pb should be a nil pointer to the struct type. +func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { + return extensionMaps[reflect.TypeOf(pb).Elem()] +} From 22c36ed9548020eb693da7257ae6fecf2d563552 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 28 Feb 2019 13:27:29 -0800 Subject: [PATCH 032/133] protoapi: add CompressGZIP helper function The current generated API relies on GZIP since the Descriptor and EnumDescriptor methods return the file descriptor as the GZIP-compressed form of the raw encoded bytes. It turns out that it was a mistake to compress the descriptor since they hardly contribute any significant size to the total binary bloat and instead forces us to have a dependency on gzip in the public API. The CompressGZIP function added is hand-tailored to be as simple and fast as possible to reduce runtime cost as well. Change-Id: I32a62f8ba39a0f2dd12fb31800f270b672facf5f Reviewed-on: https://go-review.googlesource.com/c/164637 Reviewed-by: Damien Neil --- protoapi/impl.go | 38 ++++++++++++++++++++++++++++++++++++++ protoapi/impl_test.go | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 protoapi/impl_test.go diff --git a/protoapi/impl.go b/protoapi/impl.go index 1801ed28a5..460b592e56 100644 --- a/protoapi/impl.go +++ b/protoapi/impl.go @@ -5,8 +5,11 @@ package protoapi import ( + "encoding/binary" "encoding/json" "fmt" + "hash/crc32" + "math" "strconv" ) @@ -49,5 +52,40 @@ func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, return val, nil } +// CompressGZIP compresses the input as a GZIP-encoded file. +// The current implementation does no compression. +func CompressGZIP(in []byte) (out []byte) { + // RFC 1952, section 2.3.1. + var gzipHeader = [10]byte{0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff} + + // RFC 1951, section 3.2.4. + var blockHeader [5]byte + const maxBlockSize = math.MaxUint16 + numBlocks := 1 + len(in)/maxBlockSize + + // RFC 1952, section 2.3.1. + var gzipFooter [8]byte + binary.LittleEndian.PutUint32(gzipFooter[0:4], crc32.ChecksumIEEE(in)) + binary.LittleEndian.PutUint32(gzipFooter[4:8], uint32(len(in))) + + // Encode the input without compression using raw DEFLATE blocks. + out = make([]byte, 0, len(gzipHeader)+len(blockHeader)*numBlocks+len(in)+len(gzipFooter)) + out = append(out, gzipHeader[:]...) + for blockHeader[0] == 0 { + blockSize := maxBlockSize + if blockSize > len(in) { + blockHeader[0] = 0x01 // final bit per RFC 1951, section 3.2.3. + blockSize = len(in) + } + binary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize)^0x0000) + binary.LittleEndian.PutUint16(blockHeader[3:5], uint16(blockSize)^0xffff) + out = append(out, blockHeader[:]...) + out = append(out, in[:blockSize]...) + in = in[blockSize:] + } + out = append(out, gzipFooter[:]...) + return out +} + // TODO: Remove this when v2 textpb is available. var CompactTextString func(Message) string diff --git a/protoapi/impl_test.go b/protoapi/impl_test.go new file mode 100644 index 0000000000..bc73ed79a7 --- /dev/null +++ b/protoapi/impl_test.go @@ -0,0 +1,41 @@ +// 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 protoapi + +import ( + "bytes" + "compress/gzip" + "io/ioutil" + "math" + "strings" + "testing" +) + +func TestCompressGZIP(t *testing.T) { + tests := []string{ + "", + "a", + "ab", + "abc", + strings.Repeat("a", math.MaxUint16-1), + strings.Repeat("b", math.MaxUint16), + strings.Repeat("c", math.MaxUint16+1), + strings.Repeat("abcdefghijklmnopqrstuvwxyz", math.MaxUint16-13), + } + for _, want := range tests { + rb := bytes.NewReader(CompressGZIP([]byte(want))) + zr, err := gzip.NewReader(rb) + if err != nil { + t.Errorf("unexpected gzip.NewReader error: %v", err) + } + b, err := ioutil.ReadAll(zr) + if err != nil { + t.Errorf("unexpected ioutil.ReadAll error: %v", err) + } + if got := string(b); got != want { + t.Errorf("output mismatch: got %q, want %q", got, want) + } + } +} From 6ce2da42b4ff428fb89d76d0d928b7f53b636214 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Sun, 10 Mar 2019 15:46:51 -0700 Subject: [PATCH 033/133] all: update to latest in golang/protobuf@b5d812f8 This merges in the following upstream PRs: * #797: ptypes: More cleanly construct a Timestamp * #796: ptypes: Avoid assuming time.Duration is nanoseconds * #805: proto: remove test dependency on experimental packages * #808: Delete the conformance test Change-Id: I104189682bbc0a18e3d8460e57f9fcb45f1f4a46 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/166521 Reviewed-by: Herbie Ong --- Makefile | 1 - go.mod | 7 +------ go.sum | 7 +------ proto/extensions_test.go | 28 ++++++++++++++++------------ ptypes/duration.go | 2 +- ptypes/timestamp.go | 6 ++---- regenerate.sh | 1 - 7 files changed, 21 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index 60ea390bed..f35d959f95 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,6 @@ test: go test ./... ./protoc-gen-go/testdata go test -tags purego ./... ./protoc-gen-go/testdata go build ./protoc-gen-go/testdata/grpc/grpc.pb.go - make -C conformance test clean: go clean ./... diff --git a/go.mod b/go.mod index 15a12130c0..90e3effe2e 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,3 @@ module github.com/golang/protobuf -require ( - github.com/golang/protobuf/v2 v2.0.0-20181127193627-d7e97bc71bcb - golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 // indirect - golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f - golang.org/x/tools v0.0.0-20180928181343-b3c0be4c978b // indirect -) +require github.com/golang/protobuf/v2 v2.0.0-20181127193627-d7e97bc71bcb diff --git a/go.sum b/go.sum index e191a9eea1..64215f02e4 100644 --- a/go.sum +++ b/go.sum @@ -4,12 +4,7 @@ github.com/golang/protobuf/v2 v2.0.0-20181127193627-d7e97bc71bcb/go.mod h1:MgUD+ github.com/google/go-cmp v0.2.1-0.20181101181452-745b8ec83783 h1:wVZ6laEGf86tNDTpR5mxFyFIclJJiXCxuJhcQKnsOHk= github.com/google/go-cmp v0.2.1-0.20181101181452-745b8ec83783/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 h1:dgd4x4kJt7G4k4m93AYLzM8Ni6h2qLTfh9n9vXJT3/0= -golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/tools v0.0.0-20180904205237-0aa4b8830f48 h1:PIz+xUHW4G/jqfFWeKhQ96ZV/t2HDsXfWj923rV0bZY= golang.org/x/tools v0.0.0-20180904205237-0aa4b8830f48/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180928181343-b3c0be4c978b h1:hjfKpJoTfQ2QXKPX9eCDFBZ0t9sDrZL/viAgrN962TQ= -golang.org/x/tools v0.0.0-20180928181343-b3c0be4c978b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b h1:lohp5blsw53GBXtLyLNaTXPXS9pJ1tiTw61ZHUoE9Qw= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= diff --git a/proto/extensions_test.go b/proto/extensions_test.go index 767a153e13..13d419bf70 100644 --- a/proto/extensions_test.go +++ b/proto/extensions_test.go @@ -11,11 +11,11 @@ import ( "reflect" "sort" "strings" + "sync" "testing" "github.com/golang/protobuf/proto" pb "github.com/golang/protobuf/proto/test_proto" - "golang.org/x/sync/errgroup" ) func TestGetExtensionsWithMissingExtensions(t *testing.T) { @@ -644,18 +644,22 @@ func TestMarshalRace(t *testing.T) { // GetExtension will decode it lazily. Make sure this does // not race against Marshal. - var g errgroup.Group + wg := sync.WaitGroup{} + errs := make(chan error, 3) for n := 3; n > 0; n-- { - g.Go(func() error { + wg.Add(1) + go func() { + defer wg.Done() _, err := proto.Marshal(m) - return err - }) - g.Go(func() error { - _, err := proto.GetExtension(m, pb.E_Ext_More) - return err - }) - } - if err := g.Wait(); err != nil { - t.Fatal(err) + errs <- err + }() + } + wg.Wait() + close(errs) + + for err = range errs { + if err != nil { + t.Fatal(err) + } } } diff --git a/ptypes/duration.go b/ptypes/duration.go index e51dc126a6..71798a9e87 100644 --- a/ptypes/duration.go +++ b/ptypes/duration.go @@ -55,7 +55,7 @@ func Duration(p *durpb.Duration) (time.Duration, error) { return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p) } if p.Nanos != 0 { - d += time.Duration(p.Nanos) + d += time.Duration(p.Nanos) * time.Nanosecond if (d < 0) != (p.Nanos < 0) { return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p) } diff --git a/ptypes/timestamp.go b/ptypes/timestamp.go index ed4d006423..2ad3246ace 100644 --- a/ptypes/timestamp.go +++ b/ptypes/timestamp.go @@ -84,11 +84,9 @@ func TimestampNow() *tspb.Timestamp { // TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. // It returns an error if the resulting Timestamp is invalid. func TimestampProto(t time.Time) (*tspb.Timestamp, error) { - seconds := t.Unix() - nanos := int32(t.Sub(time.Unix(seconds, 0))) ts := &tspb.Timestamp{ - Seconds: seconds, - Nanos: nanos, + Seconds: t.Unix(), + Nanos: int32(t.Nanosecond()), } if err := validateTimestamp(ts); err != nil { return nil, err diff --git a/regenerate.sh b/regenerate.sh index dc7e2d1f61..db0a0d661f 100755 --- a/regenerate.sh +++ b/regenerate.sh @@ -17,7 +17,6 @@ fi # Generate various test protos. PROTO_DIRS=( - conformance/internal/conformance_proto jsonpb/jsonpb_test_proto proto protoc-gen-go/testdata From 379b5a7ff78a13ef1c6d56ff40a880fa15786732 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 11 Mar 2019 14:45:35 -0700 Subject: [PATCH 034/133] go.sum: purge unused dependencies Change-Id: I0e75725696c4c5fe7bade91db6169398f7be0a1a Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/166998 Reviewed-by: Joe Tsai --- go.sum | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/go.sum b/go.sum index 64215f02e4..2730eafa0e 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,3 @@ -github.com/golang/protobuf v1.2.1-0.20181127190454-8d0c54c12466/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf/v2 v2.0.0-20181127193627-d7e97bc71bcb h1:xAZBrlIILcZ8PEjDVZFkOVURYqYAF9y3+wnJXB/t7I8= -github.com/golang/protobuf/v2 v2.0.0-20181127193627-d7e97bc71bcb/go.mod h1:MgUD+N3FwzDmj2CdMsT5ap7K7jx+c9cQDQ7fVhmH+Xw= +github.com/golang/protobuf v1.2.1-0.20190311202412-6ce2da42b4ff/go.mod h1:5kErVJxM6E04eNoOY5G7ivXy1PbRgsxJrBwZ0obu4lQ= github.com/google/go-cmp v0.2.1-0.20181101181452-745b8ec83783 h1:wVZ6laEGf86tNDTpR5mxFyFIclJJiXCxuJhcQKnsOHk= github.com/google/go-cmp v0.2.1-0.20181101181452-745b8ec83783/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/tools v0.0.0-20180904205237-0aa4b8830f48 h1:PIz+xUHW4G/jqfFWeKhQ96ZV/t2HDsXfWj923rV0bZY= -golang.org/x/tools v0.0.0-20180904205237-0aa4b8830f48/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= From a15d72443bae574c66947add51eaea37c8309592 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 11 Mar 2019 14:53:40 -0700 Subject: [PATCH 035/133] go.sum: temporarily delete go.sum file Change-Id: I050222bc8c111001e5c47c95cd1749c829e4f555 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/166999 Reviewed-by: Joe Tsai --- go.mod | 2 +- go.sum | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 go.sum diff --git a/go.mod b/go.mod index 90e3effe2e..fb4c0f3065 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/golang/protobuf -require github.com/golang/protobuf/v2 v2.0.0-20181127193627-d7e97bc71bcb +require github.com/golang/protobuf/v2 v2.0.0-20190311214845-9d8c804b555c diff --git a/go.sum b/go.sum deleted file mode 100644 index 2730eafa0e..0000000000 --- a/go.sum +++ /dev/null @@ -1,3 +0,0 @@ -github.com/golang/protobuf v1.2.1-0.20190311202412-6ce2da42b4ff/go.mod h1:5kErVJxM6E04eNoOY5G7ivXy1PbRgsxJrBwZ0obu4lQ= -github.com/google/go-cmp v0.2.1-0.20181101181452-745b8ec83783 h1:wVZ6laEGf86tNDTpR5mxFyFIclJJiXCxuJhcQKnsOHk= -github.com/google/go-cmp v0.2.1-0.20181101181452-745b8ec83783/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= From 968e039ade0310f7548c0cfa533afe47efb2d963 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 11 Mar 2019 16:37:12 -0700 Subject: [PATCH 036/133] go.mod: temporarily delete go.mod file Change-Id: I538adc19970b1a3a88d3b1558bd7f858de0129a7 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/166886 Reviewed-by: Joe Tsai --- go.mod | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 go.mod diff --git a/go.mod b/go.mod deleted file mode 100644 index fb4c0f3065..0000000000 --- a/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/golang/protobuf - -require github.com/golang/protobuf/v2 v2.0.0-20190311214845-9d8c804b555c From 51c19b98ee31f61d189148a34a64742b08f0741d Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 11 Mar 2019 16:46:42 -0700 Subject: [PATCH 037/133] go.mod: re-add go.mod file Change-Id: I256629b36a9de3128b3a17cbbc868aa3fb048e66 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/166889 Reviewed-by: Joe Tsai --- go.mod | 3 +++ go.sum | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 go.mod create mode 100644 go.sum diff --git a/go.mod b/go.mod new file mode 100644 index 0000000000..cc7a70eaa4 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/golang/protobuf + +require github.com/golang/protobuf/v2 v2.0.0-20190311234237-8692540cce25 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000000..a51b4cbe43 --- /dev/null +++ b/go.sum @@ -0,0 +1,5 @@ +github.com/golang/protobuf v1.2.1-0.20190311233832-968e039ade03/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf/v2 v2.0.0-20190311234237-8692540cce25 h1:OPot/6pIGOXutoEWwijGIyc0s72oha4VMKjoMKgSD84= +github.com/golang/protobuf/v2 v2.0.0-20190311234237-8692540cce25/go.mod h1:JBgB92qSNOVlmhtPbF3BkMlBy5KGJj+k0lo1MaNJhxE= +github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= From d210aa88265a135957d8337c04ce5b8d13ab5557 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 11 Mar 2019 16:59:30 -0700 Subject: [PATCH 038/133] all: fix travis after v2 update Change-Id: I1c8d926a857beef239973e762f00d324a4da3b4d Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/166890 Reviewed-by: Joe Tsai --- .../jsonpb_test_proto/more_test_objects.pb.go | 158 +- jsonpb/jsonpb_test_proto/test_objects.pb.go | 372 ++- proto/proto3_proto/proto3.pb.go | 214 +- proto/test_proto/test.pb.go | 2722 +++++++++++------ protoc-gen-go/descriptor/descriptor.pb.go | 2029 ++++++------ protoc-gen-go/main.go | 4 +- .../testdata/deprecated/deprecated.pb.go | 75 +- .../extension_base/extension_base.pb.go | 58 +- .../extension_extra/extension_extra.pb.go | 39 +- .../extension_user/extension_user.pb.go | 217 +- protoc-gen-go/testdata/grpc/grpc.pb.go | 74 +- protoc-gen-go/testdata/import_public/a.pb.go | 93 +- protoc-gen-go/testdata/import_public/b.pb.go | 46 +- .../import_public/importing/importing.pb.go | 44 +- .../testdata/import_public/sub/a.pb.go | 106 +- .../testdata/import_public/sub/b.pb.go | 38 +- protoc-gen-go/testdata/imports/fmt/m.pb.go | 33 +- .../testdata/imports/test_a_1/m1.pb.go | 45 +- .../testdata/imports/test_a_1/m2.pb.go | 35 +- .../testdata/imports/test_a_2/m3.pb.go | 35 +- .../testdata/imports/test_a_2/m4.pb.go | 35 +- .../testdata/imports/test_b_1/m1.pb.go | 36 +- .../testdata/imports/test_b_1/m2.pb.go | 36 +- .../testdata/imports/test_import_a1m1.pb.go | 40 +- .../testdata/imports/test_import_a1m2.pb.go | 40 +- .../testdata/imports/test_import_all.pb.go | 77 +- protoc-gen-go/testdata/multi/multi1.pb.go | 51 +- protoc-gen-go/testdata/multi/multi2.pb.go | 51 +- protoc-gen-go/testdata/multi/multi3.pb.go | 47 +- protoc-gen-go/testdata/my_test/test.pb.go | 513 ++-- protoc-gen-go/testdata/proto3/proto3.pb.go | 69 +- ptypes/any/any.pb.go | 45 +- ptypes/duration/duration.pb.go | 47 +- ptypes/empty/empty.pb.go | 41 +- ptypes/struct/struct.pb.go | 101 +- ptypes/timestamp/timestamp.pb.go | 47 +- ptypes/wrappers/wrappers.pb.go | 86 +- 37 files changed, 4432 insertions(+), 3367 deletions(-) diff --git a/jsonpb/jsonpb_test_proto/more_test_objects.pb.go b/jsonpb/jsonpb_test_proto/more_test_objects.pb.go index ef8bc343ff..c19d859cc4 100644 --- a/jsonpb/jsonpb_test_proto/more_test_objects.pb.go +++ b/jsonpb/jsonpb_test_proto/more_test_objects.pb.go @@ -4,16 +4,10 @@ package jsonpb import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -45,7 +39,7 @@ func (x Numeral) String() string { } func (Numeral) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e6c135db3023e377, []int{0} + return xxx_File_more_test_objects_proto_rawdesc_gzipped, []int{0} } type Simple3 struct { @@ -59,7 +53,7 @@ func (m *Simple3) Reset() { *m = Simple3{} } func (m *Simple3) String() string { return proto.CompactTextString(m) } func (*Simple3) ProtoMessage() {} func (*Simple3) Descriptor() ([]byte, []int) { - return fileDescriptor_e6c135db3023e377, []int{0} + return xxx_File_more_test_objects_proto_rawdesc_gzipped, []int{0} } func (m *Simple3) XXX_Unmarshal(b []byte) error { @@ -98,7 +92,7 @@ func (m *SimpleSlice3) Reset() { *m = SimpleSlice3{} } func (m *SimpleSlice3) String() string { return proto.CompactTextString(m) } func (*SimpleSlice3) ProtoMessage() {} func (*SimpleSlice3) Descriptor() ([]byte, []int) { - return fileDescriptor_e6c135db3023e377, []int{1} + return xxx_File_more_test_objects_proto_rawdesc_gzipped, []int{1} } func (m *SimpleSlice3) XXX_Unmarshal(b []byte) error { @@ -137,7 +131,7 @@ func (m *SimpleMap3) Reset() { *m = SimpleMap3{} } func (m *SimpleMap3) String() string { return proto.CompactTextString(m) } func (*SimpleMap3) ProtoMessage() {} func (*SimpleMap3) Descriptor() ([]byte, []int) { - return fileDescriptor_e6c135db3023e377, []int{2} + return xxx_File_more_test_objects_proto_rawdesc_gzipped, []int{2} } func (m *SimpleMap3) XXX_Unmarshal(b []byte) error { @@ -176,7 +170,7 @@ func (m *SimpleNull3) Reset() { *m = SimpleNull3{} } func (m *SimpleNull3) String() string { return proto.CompactTextString(m) } func (*SimpleNull3) ProtoMessage() {} func (*SimpleNull3) Descriptor() ([]byte, []int) { - return fileDescriptor_e6c135db3023e377, []int{3} + return xxx_File_more_test_objects_proto_rawdesc_gzipped, []int{3} } func (m *SimpleNull3) XXX_Unmarshal(b []byte) error { @@ -224,7 +218,7 @@ func (m *Mappy) Reset() { *m = Mappy{} } func (m *Mappy) String() string { return proto.CompactTextString(m) } func (*Mappy) ProtoMessage() {} func (*Mappy) Descriptor() ([]byte, []int) { - return fileDescriptor_e6c135db3023e377, []int{4} + return xxx_File_more_test_objects_proto_rawdesc_gzipped, []int{4} } func (m *Mappy) XXX_Unmarshal(b []byte) error { @@ -316,6 +310,7 @@ func (m *Mappy) GetU64Booly() map[uint64]bool { } func init() { + proto.RegisterFile("more_test_objects.proto", xxx_File_more_test_objects_proto_rawdesc_gzipped) proto.RegisterEnum("jsonpb.Numeral", Numeral_name, Numeral_value) proto.RegisterType((*Simple3)(nil), "jsonpb.Simple3") proto.RegisterType((*SimpleSlice3)(nil), "jsonpb.SimpleSlice3") @@ -335,41 +330,102 @@ func init() { proto.RegisterMapType((map[uint64]bool)(nil), "jsonpb.Mappy.U64boolyEntry") } -func init() { proto.RegisterFile("more_test_objects.proto", fileDescriptor_e6c135db3023e377) } - -var fileDescriptor_e6c135db3023e377 = []byte{ - // 526 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xdd, 0x6b, 0xdb, 0x3c, - 0x14, 0x87, 0x5f, 0x27, 0xf5, 0xd7, 0x49, 0xfb, 0x2e, 0x88, 0xb1, 0x99, 0xf4, 0x62, 0xc5, 0xb0, - 0xad, 0x0c, 0xe6, 0x8b, 0x78, 0x74, 0x5d, 0x77, 0x95, 0x8e, 0x5e, 0x94, 0x11, 0x07, 0x1c, 0xc2, - 0x2e, 0x4b, 0xdc, 0x99, 0x90, 0xcc, 0x5f, 0xd8, 0xd6, 0xc0, 0xd7, 0xfb, 0xbb, 0x07, 0xe3, 0x48, - 0x72, 0x2d, 0x07, 0x85, 0x6c, 0x77, 0x52, 0x7e, 0xcf, 0xe3, 0x73, 0x24, 0x1d, 0x02, 0x2f, 0xd3, - 0xbc, 0x8c, 0x1f, 0xea, 0xb8, 0xaa, 0x1f, 0xf2, 0x68, 0x17, 0x3f, 0xd6, 0x95, 0x57, 0x94, 0x79, - 0x9d, 0x13, 0x63, 0x57, 0xe5, 0x59, 0x11, 0xb9, 0xe7, 0x60, 0x2e, 0xb7, 0x69, 0x91, 0xc4, 0x3e, - 0x19, 0xc3, 0xf0, 0x3b, 0x8d, 0x1c, 0xed, 0x42, 0xbb, 0xd4, 0x42, 0x5c, 0xba, 0x6f, 0xe0, 0x94, - 0x87, 0xcb, 0x64, 0xfb, 0x18, 0xfb, 0xe4, 0x05, 0x18, 0x15, 0xae, 0x2a, 0x47, 0xbb, 0x18, 0x5e, - 0xda, 0xa1, 0xd8, 0xb9, 0xbf, 0x34, 0x00, 0x0e, 0xce, 0xd7, 0x85, 0x4f, 0x3e, 0x81, 0x59, 0xd5, - 0xe5, 0x36, 0xdb, 0x34, 0x8c, 0x1b, 0x4d, 0x5f, 0x79, 0xbc, 0x9a, 0xd7, 0x41, 0xde, 0x92, 0x13, - 0x77, 0x59, 0x5d, 0x36, 0x61, 0xcb, 0x4f, 0x6e, 0xe0, 0x54, 0x0e, 0xb0, 0xa7, 0x1f, 0x71, 0xc3, - 0x7a, 0xb2, 0x43, 0x5c, 0x92, 0xe7, 0xa0, 0xff, 0x5c, 0x27, 0x34, 0x76, 0x06, 0xec, 0x37, 0xbe, - 0xb9, 0x19, 0x5c, 0x6b, 0xee, 0x15, 0x8c, 0xf8, 0xf7, 0x03, 0x9a, 0x24, 0x3e, 0x79, 0x0b, 0x46, - 0xc5, 0xb6, 0xcc, 0x1e, 0x4d, 0x9f, 0xf5, 0x9b, 0xf0, 0x43, 0x11, 0xbb, 0xbf, 0x2d, 0xd0, 0xe7, - 0xeb, 0xa2, 0x68, 0x88, 0x07, 0x7a, 0x46, 0xd3, 0xb4, 0x6d, 0xdb, 0x69, 0x0d, 0x96, 0x7a, 0x01, - 0x46, 0xbc, 0x5f, 0x8e, 0x21, 0x5f, 0xd5, 0x65, 0xd9, 0x38, 0x03, 0x15, 0xbf, 0xc4, 0x48, 0xf0, - 0x0c, 0x43, 0x3e, 0x8f, 0x76, 0xbb, 0xc6, 0x19, 0xaa, 0xf8, 0x05, 0x46, 0x82, 0x67, 0x18, 0xf2, - 0x11, 0xdd, 0x6c, 0x1a, 0xe7, 0x44, 0xc5, 0xdf, 0x62, 0x24, 0x78, 0x86, 0x31, 0x3e, 0xcf, 0x93, - 0xc6, 0xd1, 0x95, 0x3c, 0x46, 0x2d, 0x8f, 0x6b, 0xe4, 0xe3, 0x8c, 0xa6, 0x8d, 0x63, 0xa8, 0xf8, - 0x3b, 0x8c, 0x04, 0xcf, 0x30, 0xf2, 0x11, 0xac, 0xca, 0x9f, 0xf2, 0x12, 0x26, 0x53, 0xce, 0xf7, - 0x8e, 0x2c, 0x52, 0x6e, 0x3d, 0xc1, 0x4c, 0xbc, 0xfa, 0xc0, 0x45, 0x4b, 0x29, 0x8a, 0xb4, 0x15, - 0xc5, 0x16, 0x45, 0xda, 0x56, 0xb4, 0x55, 0xe2, 0xaa, 0x5f, 0x91, 0x4a, 0x15, 0x69, 0x5b, 0x11, - 0x94, 0x62, 0xbf, 0x62, 0x0b, 0x4f, 0xae, 0x01, 0xba, 0x87, 0x96, 0xe7, 0x6f, 0xa8, 0x98, 0x3f, - 0x5d, 0x9a, 0x3f, 0x34, 0xbb, 0x27, 0xff, 0x97, 0xc9, 0x9d, 0xdc, 0x03, 0x74, 0x8f, 0x2f, 0x9b, - 0x3a, 0x37, 0x5f, 0xcb, 0xa6, 0x62, 0x92, 0xfb, 0x4d, 0x74, 0x73, 0x71, 0xac, 0x7d, 0x7b, 0xdf, - 0x7c, 0xba, 0x10, 0xd9, 0xb4, 0x14, 0xa6, 0xb5, 0xd7, 0x7e, 0x37, 0x2b, 0x8a, 0x83, 0xf7, 0xda, - 0xff, 0xbf, 0x6b, 0x3f, 0xa0, 0x69, 0x5c, 0xae, 0x13, 0xf9, 0x53, 0x9f, 0xe1, 0xac, 0x37, 0x43, - 0x8a, 0xcb, 0x38, 0xdc, 0x07, 0xca, 0xf2, 0xab, 0x1e, 0x3b, 0xfe, 0xbe, 0xbc, 0x3a, 0x54, 0xf9, - 0xec, 0x6f, 0xe4, 0x43, 0x95, 0x4f, 0x8e, 0xc8, 0xef, 0xde, 0x83, 0x29, 0x6e, 0x82, 0x8c, 0xc0, - 0x5c, 0x05, 0x5f, 0x83, 0xc5, 0xb7, 0x60, 0xfc, 0x1f, 0x01, 0x30, 0x66, 0xe1, 0xec, 0xf6, 0xfe, - 0xcb, 0x58, 0x23, 0x36, 0xe8, 0xe1, 0x62, 0x3e, 0x0b, 0xc6, 0x83, 0xc8, 0x60, 0x7f, 0xe0, 0xfe, - 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x84, 0x34, 0xaf, 0xdb, 0x05, 0x00, 0x00, -} +var xxx_File_more_test_objects_proto_rawdesc = []byte{ + // 1499 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x17, 0x6d, 0x6f, 0x72, 0x65, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6a, 0x73, 0x6f, 0x6e, 0x70, + 0x62, 0x22, 0x1b, 0x0a, 0x07, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x33, 0x12, 0x10, 0x0a, 0x03, + 0x64, 0x75, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x64, 0x75, 0x62, 0x22, 0x26, + 0x0a, 0x0c, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x33, 0x12, 0x16, + 0x0a, 0x06, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, + 0x73, 0x6c, 0x69, 0x63, 0x65, 0x73, 0x22, 0x83, 0x01, 0x0a, 0x0a, 0x53, 0x69, 0x6d, 0x70, 0x6c, + 0x65, 0x4d, 0x61, 0x70, 0x33, 0x12, 0x39, 0x0a, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x79, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, + 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x61, 0x70, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x79, + 0x1a, 0x3a, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x36, 0x0a, 0x0b, + 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4e, 0x75, 0x6c, 0x6c, 0x33, 0x12, 0x27, 0x0a, 0x06, 0x73, + 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6a, 0x73, + 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x33, 0x52, 0x06, 0x73, 0x69, + 0x6d, 0x70, 0x6c, 0x65, 0x22, 0xfd, 0x08, 0x0a, 0x05, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x12, 0x2e, + 0x0a, 0x05, 0x6e, 0x75, 0x6d, 0x6d, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x4e, 0x75, 0x6d, + 0x6d, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6e, 0x75, 0x6d, 0x6d, 0x79, 0x12, 0x2e, + 0x0a, 0x05, 0x73, 0x74, 0x72, 0x72, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x53, 0x74, 0x72, + 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x73, 0x74, 0x72, 0x72, 0x79, 0x12, 0x2e, + 0x0a, 0x05, 0x6f, 0x62, 0x6a, 0x6a, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x4f, 0x62, 0x6a, + 0x6a, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6f, 0x62, 0x6a, 0x6a, 0x79, 0x12, 0x2e, + 0x0a, 0x05, 0x62, 0x75, 0x67, 0x67, 0x79, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x42, 0x75, 0x67, + 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x62, 0x75, 0x67, 0x67, 0x79, 0x12, 0x2e, + 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x42, 0x6f, 0x6f, + 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x12, 0x2e, + 0x0a, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x79, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x79, 0x12, 0x37, + 0x0a, 0x08, 0x73, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, + 0x53, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x73, + 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x12, 0x37, 0x0a, 0x08, 0x73, 0x36, 0x34, 0x62, 0x6f, + 0x6f, 0x6c, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, + 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x53, 0x36, 0x34, 0x62, 0x6f, 0x6f, 0x6c, + 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x73, 0x36, 0x34, 0x62, 0x6f, 0x6f, 0x6c, 0x79, + 0x12, 0x37, 0x0a, 0x08, 0x75, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x09, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, + 0x79, 0x2e, 0x55, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x08, 0x75, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x12, 0x37, 0x0a, 0x08, 0x75, 0x36, 0x34, + 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6a, 0x73, + 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x55, 0x36, 0x34, 0x62, 0x6f, + 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x75, 0x36, 0x34, 0x62, 0x6f, 0x6f, + 0x6c, 0x79, 0x1a, 0x38, 0x0a, 0x0a, 0x4e, 0x75, 0x6d, 0x6d, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, + 0x53, 0x74, 0x72, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x49, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x6a, 0x79, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, + 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x33, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x42, 0x75, 0x67, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x42, + 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x49, 0x0a, 0x0a, 0x45, 0x6e, 0x75, 0x6d, 0x79, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4e, 0x75, + 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x1a, 0x3b, 0x0a, 0x0d, 0x53, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, + 0x0d, 0x53, 0x36, 0x34, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x55, 0x33, + 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x55, 0x36, 0x34, 0x62, 0x6f, + 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x2d, 0x0a, 0x07, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x12, + 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, + 0x41, 0x52, 0x41, 0x42, 0x49, 0x43, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x4f, 0x4d, 0x41, + 0x4e, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var xxx_File_more_test_objects_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_more_test_objects_proto_rawdesc) diff --git a/jsonpb/jsonpb_test_proto/test_objects.pb.go b/jsonpb/jsonpb_test_proto/test_objects.pb.go index 9f4a97e205..8147573939 100644 --- a/jsonpb/jsonpb_test_proto/test_objects.pb.go +++ b/jsonpb/jsonpb_test_proto/test_objects.pb.go @@ -4,21 +4,15 @@ package jsonpb import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" any "github.com/golang/protobuf/ptypes/any" duration "github.com/golang/protobuf/ptypes/duration" _struct "github.com/golang/protobuf/ptypes/struct" timestamp "github.com/golang/protobuf/ptypes/timestamp" wrappers "github.com/golang/protobuf/ptypes/wrappers" - math "math" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -65,7 +59,7 @@ func (x *Widget_Color) UnmarshalJSON(data []byte) error { } func (Widget_Color) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{3, 0} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{3, 0} } // Test message for holding primitive types. @@ -98,7 +92,7 @@ func (m *Simple) Reset() { *m = Simple{} } func (m *Simple) String() string { return proto.CompactTextString(m) } func (*Simple) ProtoMessage() {} func (*Simple) Descriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{0} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{0} } func (m *Simple) XXX_Unmarshal(b []byte) error { @@ -269,7 +263,7 @@ func (m *NonFinites) Reset() { *m = NonFinites{} } func (m *NonFinites) String() string { return proto.CompactTextString(m) } func (*NonFinites) ProtoMessage() {} func (*NonFinites) Descriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{1} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{1} } func (m *NonFinites) XXX_Unmarshal(b []byte) error { @@ -354,7 +348,7 @@ func (m *Repeats) Reset() { *m = Repeats{} } func (m *Repeats) String() string { return proto.CompactTextString(m) } func (*Repeats) ProtoMessage() {} func (*Repeats) Descriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{2} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{2} } func (m *Repeats) XXX_Unmarshal(b []byte) error { @@ -469,7 +463,7 @@ func (m *Widget) Reset() { *m = Widget{} } func (m *Widget) String() string { return proto.CompactTextString(m) } func (*Widget) ProtoMessage() {} func (*Widget) Descriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{3} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{3} } func (m *Widget) XXX_Unmarshal(b []byte) error { @@ -544,7 +538,7 @@ func (m *Maps) Reset() { *m = Maps{} } func (m *Maps) String() string { return proto.CompactTextString(m) } func (*Maps) ProtoMessage() {} func (*Maps) Descriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{4} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{4} } func (m *Maps) XXX_Unmarshal(b []byte) error { @@ -596,7 +590,7 @@ func (m *MsgWithOneof) Reset() { *m = MsgWithOneof{} } func (m *MsgWithOneof) String() string { return proto.CompactTextString(m) } func (*MsgWithOneof) ProtoMessage() {} func (*MsgWithOneof) Descriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{5} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{5} } func (m *MsgWithOneof) XXX_Unmarshal(b []byte) error { @@ -716,7 +710,7 @@ func (m *Real) Reset() { *m = Real{} } func (m *Real) String() string { return proto.CompactTextString(m) } func (*Real) ProtoMessage() {} func (*Real) Descriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{6} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{6} } var extRange_Real = []proto.ExtensionRange{ @@ -764,7 +758,7 @@ func (m *Complex) Reset() { *m = Complex{} } func (m *Complex) String() string { return proto.CompactTextString(m) } func (*Complex) ProtoMessage() {} func (*Complex) Descriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{7} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{7} } var extRange_Complex = []proto.ExtensionRange{ @@ -800,15 +794,6 @@ func (m *Complex) GetImaginary() float64 { return 0 } -var E_Complex_RealExtension = &proto.ExtensionDesc{ - ExtendedType: (*Real)(nil), - ExtensionType: (*Complex)(nil), - Field: 123, - Name: "jsonpb.Complex.real_extension", - Tag: "bytes,123,opt,name=real_extension", - Filename: "test_objects.proto", -} - type KnownTypes struct { An *any.Any `protobuf:"bytes,14,opt,name=an" json:"an,omitempty"` Dur *duration.Duration `protobuf:"bytes,1,opt,name=dur" json:"dur,omitempty"` @@ -834,7 +819,7 @@ func (m *KnownTypes) Reset() { *m = KnownTypes{} } func (m *KnownTypes) String() string { return proto.CompactTextString(m) } func (*KnownTypes) ProtoMessage() {} func (*KnownTypes) Descriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{8} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{8} } func (m *KnownTypes) XXX_Unmarshal(b []byte) error { @@ -972,7 +957,7 @@ func (m *MsgWithRequired) Reset() { *m = MsgWithRequired{} } func (m *MsgWithRequired) String() string { return proto.CompactTextString(m) } func (*MsgWithRequired) ProtoMessage() {} func (*MsgWithRequired) Descriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{9} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{9} } func (m *MsgWithRequired) XXX_Unmarshal(b []byte) error { @@ -1013,7 +998,7 @@ func (m *MsgWithIndirectRequired) Reset() { *m = MsgWithIndirectRequired func (m *MsgWithIndirectRequired) String() string { return proto.CompactTextString(m) } func (*MsgWithIndirectRequired) ProtoMessage() {} func (*MsgWithIndirectRequired) Descriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{10} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{10} } func (m *MsgWithIndirectRequired) XXX_Unmarshal(b []byte) error { @@ -1066,7 +1051,7 @@ func (m *MsgWithRequiredBytes) Reset() { *m = MsgWithRequiredBytes{} } func (m *MsgWithRequiredBytes) String() string { return proto.CompactTextString(m) } func (*MsgWithRequiredBytes) ProtoMessage() {} func (*MsgWithRequiredBytes) Descriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{11} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{11} } func (m *MsgWithRequiredBytes) XXX_Unmarshal(b []byte) error { @@ -1105,7 +1090,7 @@ func (m *MsgWithRequiredWKT) Reset() { *m = MsgWithRequiredWKT{} } func (m *MsgWithRequiredWKT) String() string { return proto.CompactTextString(m) } func (*MsgWithRequiredWKT) ProtoMessage() {} func (*MsgWithRequiredWKT) Descriptor() ([]byte, []int) { - return fileDescriptor_e97c739a0ce14cc6, []int{12} + return xxx_File_test_objects_proto_rawdesc_gzipped, []int{12} } func (m *MsgWithRequiredWKT) XXX_Unmarshal(b []byte) error { @@ -1151,7 +1136,17 @@ var E_Extm = &proto.ExtensionDesc{ Filename: "test_objects.proto", } +var E_Complex_RealExtension = &proto.ExtensionDesc{ + ExtendedType: (*Real)(nil), + ExtensionType: (*Complex)(nil), + Field: 123, + Name: "jsonpb.Complex.real_extension", + Tag: "bytes,123,opt,name=real_extension", + Filename: "test_objects.proto", +} + func init() { + proto.RegisterFile("test_objects.proto", xxx_File_test_objects_proto_rawdesc_gzipped) proto.RegisterEnum("jsonpb.Widget_Color", Widget_Color_name, Widget_Color_value) proto.RegisterType((*Simple)(nil), "jsonpb.Simple") proto.RegisterType((*NonFinites)(nil), "jsonpb.NonFinites") @@ -1162,7 +1157,6 @@ func init() { proto.RegisterMapType((map[int64]string)(nil), "jsonpb.Maps.MInt64StrEntry") proto.RegisterType((*MsgWithOneof)(nil), "jsonpb.MsgWithOneof") proto.RegisterType((*Real)(nil), "jsonpb.Real") - proto.RegisterExtension(E_Complex_RealExtension) proto.RegisterType((*Complex)(nil), "jsonpb.Complex") proto.RegisterType((*KnownTypes)(nil), "jsonpb.KnownTypes") proto.RegisterType((*MsgWithRequired)(nil), "jsonpb.MsgWithRequired") @@ -1172,102 +1166,224 @@ func init() { proto.RegisterType((*MsgWithRequiredWKT)(nil), "jsonpb.MsgWithRequiredWKT") proto.RegisterExtension(E_Name) proto.RegisterExtension(E_Extm) + proto.RegisterExtension(E_Complex_RealExtension) } -func init() { proto.RegisterFile("test_objects.proto", fileDescriptor_e97c739a0ce14cc6) } - -var fileDescriptor_e97c739a0ce14cc6 = []byte{ - // 1460 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xdd, 0x72, 0xdb, 0x44, - 0x14, 0x8e, 0x24, 0xcb, 0xb6, 0x8e, 0xf3, 0xd7, 0x6d, 0xda, 0x2a, 0xa1, 0x14, 0x8d, 0x5b, 0x8a, - 0x69, 0x89, 0x3b, 0x38, 0x1e, 0x4f, 0x29, 0xdc, 0x34, 0x4d, 0x4a, 0x4b, 0xdb, 0xc0, 0x6c, 0x52, - 0x7a, 0xe9, 0x91, 0x23, 0x39, 0x55, 0x91, 0xb4, 0x66, 0x77, 0x9d, 0xd4, 0x03, 0xcc, 0xe4, 0x19, - 0x18, 0x9e, 0x80, 0x0b, 0x6e, 0xb9, 0xe3, 0x82, 0xb7, 0xe0, 0x8d, 0x98, 0x3d, 0xbb, 0xf2, 0x5f, - 0xe2, 0x81, 0x2b, 0x7b, 0xf7, 0xfb, 0xd9, 0xd5, 0x9e, 0x4f, 0x67, 0x05, 0x44, 0xc6, 0x42, 0x76, - 0x59, 0xef, 0x5d, 0x7c, 0x2c, 0x45, 0x73, 0xc0, 0x99, 0x64, 0xa4, 0xfc, 0x4e, 0xb0, 0x7c, 0xd0, - 0xdb, 0xda, 0x3c, 0x61, 0xec, 0x24, 0x8d, 0x1f, 0xe0, 0x6c, 0x6f, 0xd8, 0x7f, 0x10, 0xe6, 0x23, - 0x4d, 0xd9, 0xba, 0x35, 0x0f, 0x45, 0x43, 0x1e, 0xca, 0x84, 0xe5, 0x06, 0xbf, 0x39, 0x8f, 0x0b, - 0xc9, 0x87, 0xc7, 0xd2, 0xa0, 0x1f, 0xcd, 0xa3, 0x32, 0xc9, 0x62, 0x21, 0xc3, 0x6c, 0xb0, 0xc8, - 0xfe, 0x8c, 0x87, 0x83, 0x41, 0xcc, 0xcd, 0x0e, 0xeb, 0x7f, 0x96, 0xa0, 0x7c, 0x98, 0x64, 0x83, - 0x34, 0x26, 0xd7, 0xa0, 0xcc, 0xba, 0x3d, 0xc6, 0x52, 0xdf, 0x0a, 0xac, 0x46, 0x95, 0xba, 0x6c, - 0x97, 0xb1, 0x94, 0xdc, 0x80, 0x0a, 0xeb, 0x26, 0xb9, 0xdc, 0x69, 0xf9, 0x76, 0x60, 0x35, 0x5c, - 0x5a, 0x66, 0xcf, 0xd5, 0x88, 0xdc, 0x82, 0x9a, 0x01, 0xba, 0x42, 0x72, 0xdf, 0x41, 0xd0, 0xd3, - 0xe0, 0xa1, 0xe4, 0x63, 0x61, 0xa7, 0xed, 0x97, 0x02, 0xab, 0xe1, 0x68, 0x61, 0xa7, 0x3d, 0x16, - 0x76, 0xda, 0x28, 0x74, 0x11, 0xf4, 0x34, 0xa8, 0x84, 0x9b, 0x50, 0x65, 0xdd, 0xa1, 0x5e, 0xb2, - 0x1c, 0x58, 0x8d, 0x15, 0x5a, 0x61, 0xaf, 0x71, 0x48, 0x02, 0x58, 0x2e, 0x20, 0xd4, 0x56, 0x10, - 0x06, 0x03, 0xcf, 0x88, 0x3b, 0x6d, 0xbf, 0x1a, 0x58, 0x8d, 0x92, 0x11, 0x77, 0xda, 0x13, 0xb1, - 0x59, 0xd8, 0x43, 0x18, 0x0c, 0x3c, 0x16, 0x0b, 0xbd, 0x32, 0x04, 0x56, 0xe3, 0x0a, 0xad, 0xb0, - 0xc3, 0xa9, 0x95, 0xc5, 0x64, 0xe5, 0x1a, 0xc2, 0x60, 0xe0, 0x19, 0x71, 0xa7, 0xed, 0x2f, 0x07, - 0x56, 0x83, 0x18, 0x71, 0xb1, 0xb2, 0x98, 0xac, 0xbc, 0x82, 0x30, 0x18, 0x78, 0x7c, 0x58, 0xfd, - 0x94, 0x85, 0xd2, 0x5f, 0x0d, 0xac, 0x86, 0x4d, 0xcb, 0xec, 0xa9, 0x1a, 0xe9, 0xc3, 0x42, 0x00, - 0x95, 0x6b, 0x08, 0x7a, 0x1a, 0x1c, 0xaf, 0x1a, 0xb1, 0x61, 0x2f, 0x8d, 0xfd, 0xf5, 0xc0, 0x6a, - 0x58, 0xb4, 0xc2, 0xf6, 0x70, 0xa8, 0x57, 0xd5, 0x10, 0x6a, 0xaf, 0x20, 0x0c, 0x06, 0x9e, 0x6c, - 0x59, 0xf2, 0x24, 0x3f, 0xf1, 0x49, 0x60, 0x35, 0x3c, 0xb5, 0x65, 0x1c, 0xea, 0x0d, 0xf5, 0x46, - 0x32, 0x16, 0xfe, 0xd5, 0xc0, 0x6a, 0x2c, 0xd3, 0x32, 0xdb, 0x55, 0xa3, 0xfa, 0xaf, 0x16, 0xc0, - 0x01, 0xcb, 0x9f, 0x26, 0x79, 0x22, 0x63, 0x41, 0xae, 0x82, 0xdb, 0xef, 0xe6, 0x61, 0x8e, 0xa1, - 0xb1, 0x69, 0xa9, 0x7f, 0x10, 0xe6, 0x2a, 0x4a, 0xfd, 0xee, 0x20, 0xc9, 0xfb, 0x18, 0x19, 0x9b, - 0xba, 0xfd, 0xef, 0x92, 0xbc, 0xaf, 0xa7, 0x73, 0x35, 0xed, 0x98, 0xe9, 0x03, 0x35, 0x7d, 0x15, - 0xdc, 0x08, 0x2d, 0x4a, 0xb8, 0xc1, 0x52, 0x64, 0x2c, 0x22, 0x6d, 0xe1, 0xe2, 0xac, 0x1b, 0x15, - 0x16, 0x91, 0xb6, 0x28, 0x9b, 0x69, 0x65, 0x51, 0xff, 0xc3, 0x86, 0x0a, 0x8d, 0x07, 0x71, 0x28, - 0x85, 0xa2, 0xf0, 0x22, 0xc7, 0x8e, 0xca, 0x31, 0x2f, 0x72, 0xcc, 0xc7, 0x39, 0x76, 0x54, 0x8e, - 0xb9, 0xce, 0x71, 0x01, 0x74, 0xda, 0xbe, 0x13, 0x38, 0x2a, 0xa7, 0x5c, 0xe7, 0x74, 0x13, 0xaa, - 0xbc, 0xc8, 0x61, 0x29, 0x70, 0x54, 0x0e, 0xb9, 0xc9, 0xe1, 0x18, 0xea, 0xb4, 0x7d, 0x37, 0x70, - 0x54, 0xca, 0xb8, 0x49, 0x19, 0x42, 0xa2, 0x48, 0xaf, 0xa3, 0x32, 0xc4, 0x0f, 0xa7, 0x54, 0x26, - 0x21, 0x95, 0xc0, 0x51, 0x09, 0xe1, 0x26, 0x21, 0xb8, 0x09, 0x5d, 0xff, 0x6a, 0xe0, 0xa8, 0xfa, - 0x73, 0x5d, 0x7f, 0xd4, 0x98, 0xfa, 0x7a, 0x81, 0xa3, 0xea, 0xcb, 0x4d, 0x7d, 0xb5, 0x9d, 0xae, - 0x1e, 0x04, 0x8e, 0xaa, 0x1e, 0x9f, 0x54, 0x8f, 0x9b, 0xea, 0xd5, 0x02, 0x47, 0x55, 0x8f, 0xeb, - 0xea, 0xfd, 0x65, 0x43, 0xf9, 0x4d, 0x12, 0x9d, 0xc4, 0x92, 0xdc, 0x03, 0xf7, 0x98, 0xa5, 0x8c, - 0x63, 0xe5, 0x56, 0x5b, 0x1b, 0x4d, 0xdd, 0xac, 0x9a, 0x1a, 0x6e, 0x3e, 0x51, 0x18, 0xd5, 0x14, - 0xb2, 0xad, 0xfc, 0x34, 0x5b, 0x1d, 0xde, 0x22, 0x76, 0x99, 0xe3, 0x2f, 0xb9, 0x0b, 0x65, 0x81, - 0x4d, 0x05, 0xdf, 0xa2, 0x5a, 0x6b, 0xb5, 0x60, 0xeb, 0x56, 0x43, 0x0d, 0x4a, 0x3e, 0xd5, 0x07, - 0x82, 0x4c, 0xb5, 0xcf, 0x8b, 0x4c, 0x75, 0x40, 0x86, 0x5a, 0xe1, 0xba, 0xc0, 0xfe, 0x06, 0x7a, - 0xae, 0x15, 0x4c, 0x53, 0x77, 0x5a, 0xe0, 0xe4, 0x33, 0xf0, 0x78, 0xb7, 0x20, 0x5f, 0x43, 0xdb, - 0x0b, 0xe4, 0x2a, 0x37, 0xff, 0xea, 0x1f, 0x83, 0xab, 0x37, 0x5d, 0x01, 0x87, 0xee, 0xef, 0xad, - 0x2f, 0x11, 0x0f, 0xdc, 0xaf, 0xe9, 0xfe, 0xfe, 0xc1, 0xba, 0x45, 0xaa, 0x50, 0xda, 0x7d, 0xf9, - 0x7a, 0x7f, 0xdd, 0xae, 0xff, 0x66, 0x43, 0xe9, 0x55, 0x38, 0x10, 0xe4, 0x4b, 0xa8, 0x65, 0x53, - 0xdd, 0xcb, 0x42, 0xff, 0x0f, 0x0a, 0x7f, 0x45, 0x69, 0xbe, 0x2a, 0x5a, 0xd9, 0x7e, 0x2e, 0xf9, - 0x88, 0x7a, 0xd9, 0xb8, 0xb5, 0x3d, 0x86, 0x95, 0x0c, 0xb3, 0x59, 0x3c, 0xb5, 0x8d, 0xf2, 0x0f, - 0x67, 0xe5, 0x2a, 0xaf, 0xfa, 0xb1, 0xb5, 0x41, 0x2d, 0x9b, 0xcc, 0x6c, 0x7d, 0x05, 0xab, 0xb3, - 0xfe, 0x64, 0x1d, 0x9c, 0x1f, 0xe2, 0x11, 0x96, 0xd1, 0xa1, 0xea, 0x2f, 0xd9, 0x00, 0xf7, 0x34, - 0x4c, 0x87, 0x31, 0xbe, 0x7e, 0x1e, 0xd5, 0x83, 0x47, 0xf6, 0x43, 0x6b, 0xeb, 0x00, 0xd6, 0xe7, - 0xed, 0xa7, 0xf5, 0x55, 0xad, 0xbf, 0x33, 0xad, 0xbf, 0x58, 0x94, 0x89, 0x5f, 0xfd, 0x1f, 0x0b, - 0x96, 0x5f, 0x89, 0x93, 0x37, 0x89, 0x7c, 0xfb, 0x6d, 0x1e, 0xb3, 0x3e, 0xb9, 0x0e, 0xae, 0x4c, - 0x64, 0x1a, 0xa3, 0x9d, 0xf7, 0x6c, 0x89, 0xea, 0x21, 0xf1, 0xa1, 0x2c, 0xc2, 0x34, 0xe4, 0x23, - 0xf4, 0x74, 0x9e, 0x2d, 0x51, 0x33, 0x26, 0x5b, 0x50, 0x79, 0xc2, 0x86, 0x6a, 0x27, 0xd8, 0x16, - 0x94, 0xa6, 0x98, 0x20, 0xb7, 0x61, 0xf9, 0x2d, 0xcb, 0xe2, 0x6e, 0x18, 0x45, 0x3c, 0x16, 0x02, - 0x3b, 0x84, 0x22, 0xd4, 0xd4, 0xec, 0x63, 0x3d, 0x49, 0xf6, 0xe1, 0x4a, 0x26, 0x4e, 0xba, 0x67, - 0x89, 0x7c, 0xdb, 0xe5, 0xf1, 0x8f, 0xc3, 0x84, 0xc7, 0x11, 0x76, 0x8d, 0x5a, 0xeb, 0xc6, 0xf8, - 0x60, 0xf5, 0x1e, 0xa9, 0x81, 0x9f, 0x2d, 0xd1, 0xb5, 0x6c, 0x76, 0x6a, 0xb7, 0x02, 0xee, 0x30, - 0x4f, 0x58, 0x5e, 0xbf, 0x0b, 0x25, 0x1a, 0x87, 0xe9, 0xe4, 0x14, 0x2d, 0xdd, 0x6a, 0x70, 0x70, - 0xaf, 0x5a, 0x8d, 0xd6, 0xcf, 0xcf, 0xcf, 0xcf, 0xed, 0xfa, 0x99, 0xda, 0xb8, 0x3a, 0x90, 0xf7, - 0xe4, 0x26, 0x78, 0x49, 0x16, 0x9e, 0x24, 0xb9, 0x7a, 0x40, 0x4d, 0x9f, 0x4c, 0x4c, 0x24, 0xad, - 0x3d, 0x58, 0xe5, 0x71, 0x98, 0x76, 0xe3, 0xf7, 0x32, 0xce, 0x45, 0xc2, 0x72, 0xb2, 0x3c, 0x49, - 0x66, 0x98, 0xfa, 0x3f, 0xcd, 0x46, 0xdb, 0xd8, 0xd3, 0x15, 0x25, 0xda, 0x2f, 0x34, 0xf5, 0xbf, - 0x5d, 0x80, 0x17, 0x39, 0x3b, 0xcb, 0x8f, 0x46, 0x83, 0x58, 0x90, 0x3b, 0x60, 0x87, 0x39, 0x5e, - 0x1b, 0xb5, 0xd6, 0x46, 0x53, 0x5f, 0xf8, 0xcd, 0xe2, 0xc2, 0x6f, 0x3e, 0xce, 0x47, 0xd4, 0x0e, - 0x73, 0x72, 0x1f, 0x9c, 0x68, 0xa8, 0x5f, 0xf6, 0x5a, 0x6b, 0xf3, 0x02, 0x6d, 0xcf, 0x7c, 0x76, - 0x50, 0xc5, 0x22, 0x9f, 0x80, 0x2d, 0x24, 0xde, 0x62, 0xea, 0x0c, 0xe7, 0xb9, 0x87, 0xf8, 0x09, - 0x42, 0x6d, 0xa1, 0x9a, 0x88, 0x2d, 0x85, 0x89, 0xc9, 0xd6, 0x05, 0xe2, 0x51, 0xf1, 0x35, 0x42, - 0x6d, 0x29, 0x14, 0x37, 0x3d, 0xc5, 0x1b, 0xec, 0x32, 0xee, 0xcb, 0x44, 0xc8, 0xef, 0xd5, 0x09, - 0x53, 0x3b, 0x3d, 0x25, 0x0d, 0x70, 0x4e, 0xc3, 0x14, 0x6f, 0xb4, 0x5a, 0xeb, 0xfa, 0x05, 0xb2, - 0x26, 0x2a, 0x0a, 0x69, 0x82, 0x13, 0xf5, 0x52, 0x8c, 0x4e, 0xad, 0x75, 0xf3, 0xe2, 0x73, 0x61, - 0xaf, 0x34, 0xfc, 0xa8, 0x97, 0x92, 0x6d, 0x70, 0xfa, 0xa9, 0xc4, 0x24, 0xa9, 0xf7, 0x76, 0x9e, - 0x8f, 0x5d, 0xd7, 0xd0, 0xfb, 0xa9, 0x54, 0xf4, 0x04, 0x9b, 0xfc, 0xe5, 0x74, 0x7c, 0x13, 0x0d, - 0x3d, 0xe9, 0xb4, 0xd5, 0x6e, 0x86, 0x9d, 0x36, 0x5e, 0x4e, 0x97, 0xed, 0xe6, 0xf5, 0x34, 0x7f, - 0xd8, 0x69, 0xa3, 0xfd, 0x4e, 0x0b, 0xbf, 0x63, 0x16, 0xd8, 0xef, 0xb4, 0x0a, 0xfb, 0x9d, 0x16, - 0xda, 0xef, 0xb4, 0xf0, 0xc3, 0x66, 0x91, 0xfd, 0x98, 0x3f, 0x44, 0x7e, 0x09, 0x6f, 0x42, 0x6f, - 0xc1, 0xa1, 0xab, 0x56, 0xa0, 0xe9, 0xc8, 0x53, 0xfe, 0xaa, 0xa9, 0xc1, 0x02, 0x7f, 0x7d, 0xbb, - 0x18, 0x7f, 0x21, 0x39, 0xf9, 0x1c, 0xdc, 0xe2, 0x96, 0xb9, 0xfc, 0x01, 0xf0, 0xd6, 0xd1, 0x02, - 0xcd, 0xac, 0xdf, 0x86, 0xb5, 0xb9, 0x97, 0x51, 0x35, 0x20, 0xdd, 0x4a, 0xed, 0x86, 0x87, 0xbe, - 0xf5, 0xdf, 0x6d, 0xb8, 0x61, 0x58, 0xcf, 0xf3, 0x28, 0xe1, 0xf1, 0xb1, 0x1c, 0xb3, 0xef, 0x43, - 0x49, 0x0c, 0x7b, 0x99, 0x49, 0xf2, 0xa2, 0x37, 0x9c, 0x22, 0x89, 0x7c, 0x03, 0x5e, 0x16, 0x0e, - 0xba, 0xfd, 0x24, 0x4e, 0x23, 0xd3, 0x6c, 0xb7, 0xe7, 0x14, 0xf3, 0x0b, 0xa8, 0x26, 0xfc, 0x54, - 0xf1, 0x75, 0xf3, 0xad, 0x66, 0x66, 0x48, 0x1e, 0x42, 0x4d, 0xa4, 0xc9, 0x71, 0x6c, 0xdc, 0x1c, - 0x74, 0x5b, 0xb8, 0x3e, 0x20, 0x17, 0x95, 0x5b, 0x47, 0xb0, 0x32, 0x63, 0x3a, 0xdd, 0x72, 0x3d, - 0xdd, 0x72, 0xb7, 0x67, 0x5b, 0xee, 0x42, 0xdb, 0xa9, 0xde, 0x7b, 0x0f, 0x36, 0xe6, 0x50, 0x3c, - 0x6d, 0x42, 0xa0, 0xd4, 0x1b, 0x49, 0x81, 0xe7, 0xb9, 0x4c, 0xf1, 0x7f, 0x7d, 0x0f, 0xc8, 0x1c, - 0xf7, 0xcd, 0x8b, 0xa3, 0xa2, 0xdc, 0x8a, 0xf8, 0x7f, 0xca, 0xfd, 0x28, 0x80, 0x52, 0x1e, 0x66, - 0xf1, 0x5c, 0xd3, 0xfa, 0x19, 0x9f, 0x02, 0x91, 0x47, 0x5f, 0x40, 0x29, 0x7e, 0x2f, 0xb3, 0x39, - 0xc6, 0x2f, 0xff, 0x51, 0x2a, 0x25, 0xf9, 0x37, 0x00, 0x00, 0xff, 0xff, 0xe9, 0xd4, 0xfd, 0x2f, - 0x41, 0x0d, 0x00, 0x00, -} +var xxx_File_test_objects_proto_rawdesc = []byte{ + // 3393 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x12, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x1a, 0x19, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, + 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x04, 0x0a, 0x06, 0x53, 0x69, 0x6d, 0x70, 0x6c, + 0x65, 0x12, 0x15, 0x0a, 0x06, 0x6f, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x05, 0x6f, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x5f, 0x69, 0x6e, + 0x74, 0x33, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6f, 0x49, 0x6e, 0x74, 0x33, + 0x32, 0x12, 0x1e, 0x0a, 0x0b, 0x6f, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x73, 0x74, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x53, 0x74, + 0x72, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x06, 0x6f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1e, 0x0a, 0x0b, 0x6f, 0x5f, + 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x09, 0x6f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, + 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6f, 0x55, + 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, + 0x32, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6f, 0x55, 0x69, + 0x6e, 0x74, 0x33, 0x32, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x75, 0x69, 0x6e, + 0x74, 0x36, 0x34, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6f, 0x55, 0x69, 0x6e, 0x74, + 0x36, 0x34, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x73, + 0x74, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x6f, 0x55, 0x69, 0x6e, 0x74, 0x36, + 0x34, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x11, 0x52, 0x07, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, + 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x73, 0x74, 0x72, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x11, 0x52, 0x0a, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x53, 0x74, + 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x0c, 0x20, + 0x01, 0x28, 0x12, 0x52, 0x07, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x20, 0x0a, 0x0c, + 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x0d, 0x20, 0x01, + 0x28, 0x12, 0x52, 0x0a, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x12, 0x17, + 0x0a, 0x07, 0x6f, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x02, 0x52, + 0x06, 0x6f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x1e, 0x0a, 0x0b, 0x6f, 0x5f, 0x66, 0x6c, 0x6f, + 0x61, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x02, 0x52, 0x09, 0x6f, 0x46, + 0x6c, 0x6f, 0x61, 0x74, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x64, 0x6f, 0x75, + 0x62, 0x6c, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6f, 0x44, 0x6f, 0x75, 0x62, + 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x73, + 0x74, 0x72, 0x18, 0x11, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6f, 0x44, 0x6f, 0x75, 0x62, 0x6c, + 0x65, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, + 0x17, 0x0a, 0x07, 0x6f, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x06, 0x6f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x92, 0x01, 0x0a, 0x0a, 0x4e, 0x6f, 0x6e, + 0x46, 0x69, 0x6e, 0x69, 0x74, 0x65, 0x73, 0x12, 0x13, 0x0a, 0x05, 0x66, 0x5f, 0x6e, 0x61, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x04, 0x66, 0x4e, 0x61, 0x6e, 0x12, 0x15, 0x0a, 0x06, + 0x66, 0x5f, 0x70, 0x69, 0x6e, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x66, 0x50, + 0x69, 0x6e, 0x66, 0x12, 0x15, 0x0a, 0x06, 0x66, 0x5f, 0x6e, 0x69, 0x6e, 0x66, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x02, 0x52, 0x05, 0x66, 0x4e, 0x69, 0x6e, 0x66, 0x12, 0x13, 0x0a, 0x05, 0x64, 0x5f, + 0x6e, 0x61, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x64, 0x4e, 0x61, 0x6e, 0x12, + 0x15, 0x0a, 0x06, 0x64, 0x5f, 0x70, 0x69, 0x6e, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, + 0x05, 0x64, 0x50, 0x69, 0x6e, 0x66, 0x12, 0x15, 0x0a, 0x06, 0x64, 0x5f, 0x6e, 0x69, 0x6e, 0x66, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x64, 0x4e, 0x69, 0x6e, 0x66, 0x22, 0xa6, 0x02, + 0x0a, 0x07, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x5f, 0x62, + 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x08, 0x52, 0x05, 0x72, 0x42, 0x6f, 0x6f, 0x6c, + 0x12, 0x17, 0x0a, 0x07, 0x72, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x05, 0x52, 0x06, 0x72, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x5f, 0x69, + 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x72, 0x49, 0x6e, 0x74, + 0x36, 0x34, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x07, 0x72, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x19, 0x0a, + 0x08, 0x72, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x05, 0x20, 0x03, 0x28, 0x04, 0x52, + 0x07, 0x72, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x69, + 0x6e, 0x74, 0x33, 0x32, 0x18, 0x06, 0x20, 0x03, 0x28, 0x11, 0x52, 0x07, 0x72, 0x53, 0x69, 0x6e, + 0x74, 0x33, 0x32, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, + 0x07, 0x20, 0x03, 0x28, 0x12, 0x52, 0x07, 0x72, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x17, + 0x0a, 0x07, 0x72, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x03, 0x28, 0x02, 0x52, + 0x06, 0x72, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x64, 0x6f, 0x75, + 0x62, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x01, 0x52, 0x07, 0x72, 0x44, 0x6f, 0x75, 0x62, + 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x0a, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x17, 0x0a, + 0x07, 0x72, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, + 0x72, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0xb6, 0x02, 0x0a, 0x06, 0x57, 0x69, 0x64, 0x67, 0x65, + 0x74, 0x12, 0x2a, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x14, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, + 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x2d, 0x0a, + 0x07, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x14, + 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x2e, 0x43, + 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x06, 0x72, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x26, 0x0a, 0x06, + 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6a, + 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x06, 0x73, 0x69, + 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x29, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, + 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, + 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x07, 0x72, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x12, + 0x29, 0x0a, 0x07, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, + 0x73, 0x52, 0x07, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x09, 0x72, 0x5f, + 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, + 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x52, 0x08, + 0x72, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x22, 0x25, 0x0a, 0x05, 0x43, 0x6f, 0x6c, 0x6f, + 0x72, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, + 0x45, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x22, + 0x94, 0x02, 0x0a, 0x04, 0x4d, 0x61, 0x70, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x6d, 0x5f, 0x69, 0x6e, + 0x74, 0x36, 0x34, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x73, 0x2e, 0x4d, 0x49, 0x6e, 0x74, + 0x36, 0x34, 0x53, 0x74, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x49, 0x6e, 0x74, + 0x36, 0x34, 0x53, 0x74, 0x72, 0x12, 0x41, 0x0a, 0x0d, 0x6d, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, + 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6a, + 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x73, 0x2e, 0x4d, 0x42, 0x6f, 0x6f, 0x6c, + 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x6d, 0x42, 0x6f, + 0x6f, 0x6c, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x49, 0x6e, 0x74, + 0x36, 0x34, 0x53, 0x74, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4e, 0x0a, 0x10, 0x4d, 0x42, 0x6f, 0x6f, 0x6c, 0x53, + 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6a, 0x73, + 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd1, 0x01, 0x0a, 0x0c, 0x4d, 0x73, 0x67, 0x57, 0x69, + 0x74, 0x68, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, + 0x18, 0x0a, 0x06, 0x73, 0x61, 0x6c, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, + 0x00, 0x52, 0x06, 0x73, 0x61, 0x6c, 0x61, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x07, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x23, 0x0a, 0x0c, 0x68, 0x6f, 0x6d, 0x65, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x68, + 0x6f, 0x6d, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x45, 0x0a, 0x11, 0x6d, 0x73, + 0x67, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, + 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x48, 0x00, + 0x52, 0x0f, 0x6d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, + 0x64, 0x42, 0x07, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x22, 0x26, 0x0a, 0x04, 0x52, 0x65, + 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, 0x80, 0x80, + 0x80, 0x02, 0x22, 0x77, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x12, 0x1c, 0x0a, + 0x09, 0x69, 0x6d, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x2a, 0x08, 0x08, 0x64, 0x10, + 0x80, 0x80, 0x80, 0x80, 0x02, 0x32, 0x44, 0x0a, 0x0e, 0x72, 0x65, 0x61, 0x6c, 0x5f, 0x65, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0c, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, + 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x18, 0x7b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6a, 0x73, + 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x52, 0x0d, 0x72, 0x65, + 0x61, 0x6c, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xba, 0x05, 0x0a, 0x0a, + 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x02, 0x61, 0x6e, + 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x02, 0x61, 0x6e, + 0x12, 0x2b, 0x0a, 0x03, 0x64, 0x75, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x64, 0x75, 0x72, 0x12, 0x27, 0x0a, + 0x02, 0x73, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x52, 0x02, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x02, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x02, + 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x28, + 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x12, 0x2e, 0x0a, 0x03, 0x64, 0x62, 0x6c, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x03, 0x64, 0x62, 0x6c, 0x12, 0x2d, 0x0a, 0x03, 0x66, 0x6c, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x52, 0x03, 0x66, 0x6c, 0x74, 0x12, 0x2d, 0x0a, 0x03, 0x69, 0x36, 0x34, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x03, 0x69, 0x36, 0x34, 0x12, 0x2e, 0x0a, 0x03, 0x75, 0x36, 0x34, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x03, 0x75, 0x36, 0x34, 0x12, 0x2d, 0x0a, 0x03, 0x69, 0x33, 0x32, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x03, 0x69, 0x33, 0x32, 0x12, 0x2e, 0x0a, 0x03, 0x75, 0x33, 0x32, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x03, 0x75, 0x33, 0x32, 0x12, 0x2e, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, + 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x2e, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x03, 0x73, 0x74, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0b, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0x23, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x57, + 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, + 0x74, 0x72, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x03, 0x73, 0x74, 0x72, 0x22, 0xa2, 0x02, + 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x64, 0x69, 0x72, 0x65, 0x63, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x04, 0x73, 0x75, 0x62, + 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, + 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, + 0x52, 0x04, 0x73, 0x75, 0x62, 0x6d, 0x12, 0x4a, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, + 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x64, 0x69, 0x72, 0x65, + 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x2e, 0x4d, 0x61, 0x70, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, + 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, + 0x52, 0x0a, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x54, 0x0a, 0x0d, + 0x4d, 0x61, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x22, 0x2a, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x79, + 0x74, 0x73, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x79, 0x74, 0x73, 0x22, 0x44, + 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, + 0x64, 0x57, 0x4b, 0x54, 0x12, 0x2e, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x02, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, + 0x03, 0x73, 0x74, 0x72, 0x3a, 0x20, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0c, 0x2e, 0x6a, + 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x18, 0x7c, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x39, 0x0a, 0x04, 0x65, 0x78, 0x74, 0x6d, 0x12, 0x0c, + 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x18, 0x7d, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, + 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x52, 0x04, 0x65, 0x78, 0x74, + 0x6d, +} + +var xxx_File_test_objects_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_test_objects_proto_rawdesc) diff --git a/proto/proto3_proto/proto3.pb.go b/proto/proto3_proto/proto3.pb.go index 9a754c8acd..ab5f52c04a 100644 --- a/proto/proto3_proto/proto3.pb.go +++ b/proto/proto3_proto/proto3.pb.go @@ -4,18 +4,12 @@ package proto3_proto import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" test_proto "github.com/golang/protobuf/proto/test_proto" + protoapi "github.com/golang/protobuf/protoapi" any "github.com/golang/protobuf/ptypes/any" - math "math" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -50,7 +44,7 @@ func (x Message_Humour) String() string { } func (Message_Humour) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{0, 0} + return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{0, 0} } type Message struct { @@ -82,7 +76,7 @@ func (m *Message) Reset() { *m = Message{} } func (m *Message) String() string { return proto.CompactTextString(m) } func (*Message) ProtoMessage() {} func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{0} + return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{0} } func (m *Message) XXX_Unmarshal(b []byte) error { @@ -248,7 +242,7 @@ func (m *Nested) Reset() { *m = Nested{} } func (m *Nested) String() string { return proto.CompactTextString(m) } func (*Nested) ProtoMessage() {} func (*Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{1} + return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{1} } func (m *Nested) XXX_Unmarshal(b []byte) error { @@ -294,7 +288,7 @@ func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } func (*MessageWithMap) ProtoMessage() {} func (*MessageWithMap) Descriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{2} + return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{2} } func (m *MessageWithMap) XXX_Unmarshal(b []byte) error { @@ -333,7 +327,7 @@ func (m *IntMap) Reset() { *m = IntMap{} } func (m *IntMap) String() string { return proto.CompactTextString(m) } func (*IntMap) ProtoMessage() {} func (*IntMap) Descriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{3} + return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{3} } func (m *IntMap) XXX_Unmarshal(b []byte) error { @@ -372,7 +366,7 @@ func (m *IntMaps) Reset() { *m = IntMaps{} } func (m *IntMaps) String() string { return proto.CompactTextString(m) } func (*IntMaps) ProtoMessage() {} func (*IntMaps) Descriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{4} + return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{4} } func (m *IntMaps) XXX_Unmarshal(b []byte) error { @@ -417,7 +411,7 @@ func (m *TestUTF8) Reset() { *m = TestUTF8{} } func (m *TestUTF8) String() string { return proto.CompactTextString(m) } func (*TestUTF8) ProtoMessage() {} func (*TestUTF8) Descriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{5} + return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{5} } func (m *TestUTF8) XXX_Unmarshal(b []byte) error { @@ -498,6 +492,7 @@ func (*TestUTF8) XXX_OneofWrappers() []interface{} { } func init() { + proto.RegisterFile("proto3_proto/proto3.proto", xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped) proto.RegisterEnum("proto3_proto.Message_Humour", Message_Humour_name, Message_Humour_value) proto.RegisterType((*Message)(nil), "proto3_proto.Message") proto.RegisterMapType((map[string]*test_proto.SubDefaults)(nil), "proto3_proto.Message.Proto2ValueEntry") @@ -514,64 +509,133 @@ func init() { proto.RegisterMapType((map[int64]string)(nil), "proto3_proto.TestUTF8.MapValueEntry") } -func init() { proto.RegisterFile("proto3_proto/proto3.proto", fileDescriptor_1c50d9b824d4ac38) } - -var fileDescriptor_1c50d9b824d4ac38 = []byte{ - // 896 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x6f, 0x6f, 0xdb, 0xb6, - 0x13, 0xae, 0x2c, 0xff, 0x91, 0xcf, 0x76, 0xea, 0x1f, 0x7f, 0x6e, 0xc7, 0x7a, 0x1b, 0xa0, 0x79, - 0xc3, 0x20, 0x0c, 0xab, 0xb2, 0xb9, 0xc8, 0x90, 0xb5, 0xc5, 0x86, 0x24, 0x6b, 0x50, 0x23, 0xb1, - 0x67, 0xd0, 0xce, 0x82, 0xbd, 0x12, 0x68, 0x87, 0xb6, 0x85, 0x59, 0x94, 0x27, 0x52, 0x05, 0xf4, - 0x05, 0xf6, 0x41, 0xf6, 0x95, 0xf6, 0x85, 0x06, 0x92, 0x72, 0x2a, 0x17, 0xea, 0xf2, 0x4a, 0xbc, - 0x47, 0xcf, 0xdd, 0x73, 0xbc, 0x3b, 0x1e, 0x3c, 0xdb, 0x25, 0xb1, 0x8c, 0x5f, 0x04, 0xfa, 0x73, - 0x6c, 0x0c, 0x5f, 0x7f, 0x50, 0xbb, 0xf8, 0xab, 0xff, 0x6c, 0x1d, 0xc7, 0xeb, 0x2d, 0x33, 0x94, - 0x45, 0xba, 0x3a, 0xa6, 0x3c, 0x33, 0xc4, 0xfe, 0x13, 0xc9, 0x84, 0xcc, 0x23, 0xa8, 0xa3, 0x81, - 0x07, 0x7f, 0x35, 0xa1, 0x31, 0x66, 0x42, 0xd0, 0x35, 0x43, 0x08, 0xaa, 0x9c, 0x46, 0x0c, 0x5b, - 0xae, 0xe5, 0x35, 0x89, 0x3e, 0xa3, 0x53, 0x70, 0x36, 0xe1, 0x96, 0x26, 0xa1, 0xcc, 0x70, 0xc5, - 0xb5, 0xbc, 0xa3, 0xe1, 0x67, 0x7e, 0x51, 0xd2, 0xcf, 0x9d, 0xfd, 0xb7, 0x69, 0x14, 0xa7, 0x09, - 0xb9, 0x67, 0x23, 0x17, 0xda, 0x1b, 0x16, 0xae, 0x37, 0x32, 0x08, 0x79, 0xb0, 0x8c, 0xb0, 0xed, - 0x5a, 0x5e, 0x87, 0x80, 0xc1, 0x46, 0xfc, 0x22, 0x52, 0x7a, 0x77, 0x54, 0x52, 0x5c, 0x75, 0x2d, - 0xaf, 0x4d, 0xf4, 0x19, 0x7d, 0x01, 0xed, 0x84, 0x89, 0x74, 0x2b, 0x83, 0x65, 0x9c, 0x72, 0x89, - 0x1b, 0xae, 0xe5, 0xd9, 0xa4, 0x65, 0xb0, 0x0b, 0x05, 0xa1, 0x2f, 0xa1, 0x23, 0x93, 0x94, 0x05, - 0x62, 0x19, 0x4b, 0x11, 0x51, 0x8e, 0x1d, 0xd7, 0xf2, 0x1c, 0xd2, 0x56, 0xe0, 0x2c, 0xc7, 0x50, - 0x0f, 0x6a, 0x62, 0x19, 0x27, 0x0c, 0x37, 0x5d, 0xcb, 0xab, 0x10, 0x63, 0xa0, 0x2e, 0xd8, 0x7f, - 0xb0, 0x0c, 0xd7, 0x5c, 0xdb, 0xab, 0x12, 0x75, 0x44, 0x9f, 0x42, 0x53, 0x6c, 0xe2, 0x44, 0x06, - 0x0a, 0xff, 0xbf, 0x6b, 0x7b, 0x35, 0xe2, 0x68, 0xe0, 0x8a, 0x65, 0xe8, 0x5b, 0xa8, 0x73, 0x26, - 0x24, 0xbb, 0xc3, 0x75, 0xd7, 0xf2, 0x5a, 0xc3, 0xde, 0xe1, 0xd5, 0x27, 0xfa, 0x1f, 0xc9, 0x39, - 0xe8, 0x04, 0x1a, 0x49, 0xb0, 0x4a, 0x39, 0xcf, 0x70, 0xd7, 0xb5, 0x1f, 0xac, 0x54, 0x3d, 0xb9, - 0x54, 0x5c, 0xf4, 0x1a, 0x1a, 0x92, 0x25, 0x09, 0x0d, 0x39, 0x06, 0xd7, 0xf6, 0x5a, 0xc3, 0x41, - 0xb9, 0xdb, 0xdc, 0x90, 0xde, 0x70, 0x99, 0x64, 0x64, 0xef, 0x82, 0x5e, 0x82, 0x99, 0x80, 0x61, - 0xb0, 0x0a, 0xd9, 0xf6, 0x0e, 0xb7, 0x74, 0xa2, 0x9f, 0xf8, 0xef, 0xbb, 0xed, 0xcf, 0xd2, 0xc5, - 0x2f, 0x6c, 0x45, 0xd3, 0xad, 0x14, 0xa4, 0x65, 0xc8, 0x97, 0x8a, 0x8b, 0x46, 0xf7, 0xbe, 0xef, - 0xe8, 0x36, 0x65, 0xb8, 0xa3, 0xe5, 0xbf, 0x2e, 0x97, 0x9f, 0x6a, 0xe6, 0x6f, 0x8a, 0x68, 0x52, - 0xc8, 0x43, 0x69, 0x04, 0x7d, 0x07, 0x0e, 0xe5, 0x99, 0xdc, 0x84, 0x7c, 0x8d, 0x8f, 0xf2, 0x5a, - 0x99, 0x59, 0xf4, 0xf7, 0xb3, 0xe8, 0x9f, 0xf1, 0x8c, 0xdc, 0xb3, 0xd0, 0x09, 0xb4, 0x22, 0xca, - 0xb3, 0x40, 0x5b, 0x02, 0x3f, 0xd6, 0xda, 0xe5, 0x4e, 0xa0, 0x88, 0x73, 0xcd, 0x43, 0x27, 0x00, - 0x22, 0x5d, 0x44, 0x26, 0x29, 0xfc, 0x3f, 0x2d, 0xf5, 0xa4, 0x34, 0x63, 0x52, 0x20, 0xa2, 0xef, - 0xc1, 0x59, 0x6e, 0xc2, 0xed, 0x5d, 0xc2, 0x38, 0x46, 0x5a, 0xea, 0x23, 0x4e, 0xf7, 0x34, 0x74, - 0x01, 0x20, 0x64, 0x12, 0xf2, 0x75, 0x10, 0xd1, 0x1d, 0xee, 0x69, 0xa7, 0xaf, 0xca, 0x6b, 0x33, - 0xd3, 0xbc, 0x31, 0xdd, 0x99, 0xca, 0x34, 0xc5, 0xde, 0xee, 0x4f, 0xa1, 0x5d, 0xec, 0xdb, 0x7e, - 0x00, 0xcd, 0x0b, 0xd3, 0x03, 0xf8, 0x0d, 0xd4, 0x4c, 0xf5, 0x2b, 0xff, 0x31, 0x62, 0x86, 0xf2, - 0xb2, 0x72, 0x6a, 0xf5, 0x6f, 0xa1, 0xfb, 0x61, 0x2b, 0x4a, 0xa2, 0x3e, 0x3f, 0x8c, 0xfa, 0xd1, - 0x79, 0x28, 0x04, 0x7e, 0x0d, 0x47, 0x87, 0xf7, 0x28, 0x09, 0xdb, 0x2b, 0x86, 0x6d, 0x16, 0xbc, - 0x07, 0x3f, 0x43, 0xdd, 0xcc, 0x35, 0x6a, 0x41, 0xe3, 0x66, 0x72, 0x35, 0xf9, 0xf5, 0x76, 0xd2, - 0x7d, 0x84, 0x1c, 0xa8, 0x4e, 0x6f, 0x26, 0xb3, 0xae, 0x85, 0x3a, 0xd0, 0x9c, 0x5d, 0x9f, 0x4d, - 0x67, 0xf3, 0xd1, 0xc5, 0x55, 0xb7, 0x82, 0x1e, 0x43, 0xeb, 0x7c, 0x74, 0x7d, 0x1d, 0x9c, 0x9f, - 0x8d, 0xae, 0xdf, 0xfc, 0xde, 0xb5, 0x07, 0x43, 0xa8, 0x9b, 0xcb, 0x2a, 0x91, 0x85, 0x7e, 0x45, - 0x46, 0xd8, 0x18, 0x6a, 0x59, 0x2c, 0x53, 0x69, 0x94, 0x1d, 0xa2, 0xcf, 0x83, 0xbf, 0x2d, 0x38, - 0xca, 0x7b, 0x70, 0x1b, 0xca, 0xcd, 0x98, 0xee, 0xd0, 0x14, 0xda, 0x8b, 0x4c, 0x32, 0xd5, 0xb3, - 0x9d, 0x1a, 0x46, 0x4b, 0xf7, 0xed, 0x79, 0x69, 0xdf, 0x72, 0x1f, 0xff, 0x3c, 0x93, 0x6c, 0x6c, - 0xf8, 0xf9, 0x68, 0x2f, 0xde, 0x23, 0xfd, 0x9f, 0xa0, 0xfb, 0x21, 0xa1, 0x58, 0x19, 0xa7, 0xa4, - 0x32, 0xed, 0x62, 0x65, 0xfe, 0x84, 0xfa, 0x88, 0x4b, 0x95, 0xdb, 0x31, 0xd8, 0x89, 0x94, 0x79, - 0x4a, 0x9f, 0x1f, 0xa6, 0x64, 0x28, 0x3e, 0x91, 0xd2, 0xa4, 0xa0, 0x98, 0xfd, 0x1f, 0xc0, 0xd9, - 0x03, 0x45, 0xc9, 0x5a, 0x89, 0x64, 0xad, 0x28, 0xf9, 0x02, 0x1a, 0x26, 0x9e, 0x40, 0x1e, 0x54, - 0x23, 0xba, 0x13, 0xb9, 0x68, 0xaf, 0x4c, 0x94, 0x68, 0xc6, 0xe0, 0x9f, 0x0a, 0x38, 0x73, 0x26, - 0xe4, 0xcd, 0xfc, 0xf2, 0x14, 0x3d, 0x85, 0xba, 0x58, 0xd2, 0x2d, 0x4d, 0xf2, 0x26, 0xe4, 0x96, - 0xc2, 0xdf, 0xb1, 0xa5, 0x8c, 0x13, 0x5c, 0x71, 0x6d, 0x85, 0x1b, 0x0b, 0x3d, 0x85, 0x9a, 0xd9, - 0x3f, 0x6a, 0xcb, 0x37, 0xdf, 0x3e, 0x22, 0xc6, 0x44, 0xaf, 0xa0, 0x11, 0xd1, 0x9d, 0x5e, 0xae, - 0xd5, 0xb2, 0xe5, 0xb6, 0x17, 0xf4, 0xc7, 0x74, 0x77, 0xc5, 0x32, 0x73, 0xf7, 0x7a, 0xa4, 0x0d, - 0x74, 0x06, 0x4d, 0xe5, 0x6c, 0x2e, 0x59, 0x2b, 0x7b, 0x80, 0x45, 0xf7, 0xc2, 0x6a, 0x72, 0xa2, - 0xdc, 0xec, 0xff, 0x08, 0xad, 0x42, 0xe4, 0x87, 0x26, 0xda, 0x2e, 0xbe, 0x87, 0x57, 0xd0, 0x39, - 0x88, 0x5a, 0x74, 0xb6, 0x1f, 0x78, 0x0e, 0xe7, 0x0d, 0xa8, 0xc5, 0x9c, 0xc5, 0xab, 0x45, 0xdd, - 0xe4, 0xfb, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xeb, 0x74, 0x17, 0x7f, 0xc3, 0x07, 0x00, 0x00, -} +var xxx_File_proto3_proto_proto3_proto_rawdesc = []byte{ + // 1987 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x19, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x86, 0x09, 0x0a, 0x07, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x08, 0x68, + 0x69, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x48, 0x75, 0x6d, 0x6f, 0x75, 0x72, 0x52, 0x08, 0x68, 0x69, 0x6c, + 0x61, 0x72, 0x69, 0x74, 0x79, 0x12, 0x20, 0x0a, 0x0c, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, + 0x69, 0x6e, 0x5f, 0x63, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x68, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x49, 0x6e, 0x43, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x21, 0x0a, 0x0c, 0x72, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0b, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23, + 0x0a, 0x0d, 0x74, 0x72, 0x75, 0x65, 0x5f, 0x73, 0x63, 0x6f, 0x74, 0x73, 0x6d, 0x61, 0x6e, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x74, 0x72, 0x75, 0x65, 0x53, 0x63, 0x6f, 0x74, 0x73, + 0x6d, 0x61, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x02, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x73, + 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x13, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, + 0x73, 0x68, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, + 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x06, + 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x07, 0x72, 0x5f, 0x66, 0x75, 0x6e, 0x6e, + 0x79, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x48, + 0x75, 0x6d, 0x6f, 0x75, 0x72, 0x52, 0x06, 0x72, 0x46, 0x75, 0x6e, 0x6e, 0x79, 0x12, 0x3c, 0x0a, + 0x07, 0x74, 0x65, 0x72, 0x72, 0x61, 0x69, 0x6e, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x65, 0x72, 0x72, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x07, 0x74, 0x65, 0x72, 0x72, 0x61, 0x69, 0x6e, 0x12, 0x3a, 0x0a, 0x0c, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, + 0x75, 0x62, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x32, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x49, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x61, 0x6e, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x18, 0x0e, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x61, 0x6e, 0x79, 0x74, + 0x68, 0x69, 0x6e, 0x67, 0x12, 0x35, 0x0a, 0x0b, 0x6d, 0x61, 0x6e, 0x79, 0x5f, 0x74, 0x68, 0x69, + 0x6e, 0x67, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, + 0x0a, 0x6d, 0x61, 0x6e, 0x79, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x35, 0x0a, 0x0a, 0x73, + 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x31, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x12, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x63, 0x68, 0x69, + 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x43, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, + 0x6d, 0x61, 0x70, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x09, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x1a, 0x50, 0x0a, 0x0c, 0x54, 0x65, + 0x72, 0x72, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, + 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x57, 0x0a, 0x10, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, + 0x75, 0x62, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3c, 0x0a, 0x0e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, + 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x22, 0x3f, 0x0a, 0x06, 0x48, 0x75, 0x6d, 0x6f, 0x75, 0x72, 0x12, 0x0b, 0x0a, + 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x50, 0x55, + 0x4e, 0x53, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x4c, 0x41, 0x50, 0x53, 0x54, 0x49, 0x43, + 0x4b, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x42, 0x49, 0x4c, 0x4c, 0x5f, 0x42, 0x41, 0x49, 0x4c, + 0x45, 0x59, 0x10, 0x03, 0x22, 0x32, 0x0a, 0x06, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x62, 0x75, 0x6e, 0x6e, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, + 0x75, 0x6e, 0x6e, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x04, 0x63, 0x75, 0x74, 0x65, 0x22, 0xa2, 0x01, 0x0a, 0x0e, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x61, 0x70, 0x12, 0x50, 0x0a, 0x0c, 0x62, + 0x79, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x2d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x61, 0x70, 0x2e, + 0x42, 0x79, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x1a, 0x3e, 0x0a, + 0x10, 0x42, 0x79, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x71, 0x0a, + 0x06, 0x49, 0x6e, 0x74, 0x4d, 0x61, 0x70, 0x12, 0x2f, 0x0a, 0x03, 0x72, 0x74, 0x74, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x74, 0x4d, 0x61, 0x70, 0x2e, 0x52, 0x74, 0x74, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x03, 0x72, 0x74, 0x74, 0x1a, 0x36, 0x0a, 0x08, 0x52, 0x74, 0x74, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x22, 0x33, 0x0a, 0x07, 0x49, 0x6e, 0x74, 0x4d, 0x61, 0x70, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x6d, + 0x61, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x74, 0x4d, 0x61, 0x70, 0x52, + 0x04, 0x6d, 0x61, 0x70, 0x73, 0x22, 0xd3, 0x02, 0x0a, 0x08, 0x54, 0x65, 0x73, 0x74, 0x55, 0x54, + 0x46, 0x38, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x3b, 0x0a, 0x07, 0x6d, 0x61, + 0x70, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x55, + 0x54, 0x46, 0x38, 0x2e, 0x4d, 0x61, 0x70, 0x4b, 0x65, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x06, 0x6d, 0x61, 0x70, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x55, 0x54, + 0x46, 0x38, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x08, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x39, 0x0a, 0x0b, 0x4d, 0x61, + 0x70, 0x4b, 0x65, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_proto3_proto_proto3_proto_rawdesc) diff --git a/proto/test_proto/test.pb.go b/proto/test_proto/test.pb.go index 9265b3a6e0..4b450dbdde 100644 --- a/proto/test_proto/test.pb.go +++ b/proto/test_proto/test.pb.go @@ -4,16 +4,11 @@ package test_proto import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" math "math" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -54,7 +49,7 @@ func (x *FOO) UnmarshalJSON(data []byte) error { } func (FOO) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{0} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{0} } // An enum, for completeness. @@ -132,7 +127,7 @@ func (x *GoTest_KIND) UnmarshalJSON(data []byte) error { } func (GoTest_KIND) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{2, 0} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{2, 0} } type MyMessage_Color int32 @@ -175,7 +170,7 @@ func (x *MyMessage_Color) UnmarshalJSON(data []byte) error { } func (MyMessage_Color) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{13, 0} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{13, 0} } type DefaultsMessage_DefaultsEnum int32 @@ -218,7 +213,7 @@ func (x *DefaultsMessage_DefaultsEnum) UnmarshalJSON(data []byte) error { } func (DefaultsMessage_DefaultsEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{16, 0} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{16, 0} } type Defaults_Color int32 @@ -261,7 +256,7 @@ func (x *Defaults_Color) UnmarshalJSON(data []byte) error { } func (Defaults_Color) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{21, 0} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{21, 0} } type RepeatedEnum_Color int32 @@ -298,7 +293,7 @@ func (x *RepeatedEnum_Color) UnmarshalJSON(data []byte) error { } func (RepeatedEnum_Color) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{23, 0} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{23, 0} } type GoEnum struct { @@ -312,7 +307,7 @@ func (m *GoEnum) Reset() { *m = GoEnum{} } func (m *GoEnum) String() string { return proto.CompactTextString(m) } func (*GoEnum) ProtoMessage() {} func (*GoEnum) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{0} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{0} } func (m *GoEnum) XXX_Unmarshal(b []byte) error { @@ -352,7 +347,7 @@ func (m *GoTestField) Reset() { *m = GoTestField{} } func (m *GoTestField) String() string { return proto.CompactTextString(m) } func (*GoTestField) ProtoMessage() {} func (*GoTestField) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{1} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{1} } func (m *GoTestField) XXX_Unmarshal(b []byte) error { @@ -486,7 +481,7 @@ func (m *GoTest) Reset() { *m = GoTest{} } func (m *GoTest) String() string { return proto.CompactTextString(m) } func (*GoTest) ProtoMessage() {} func (*GoTest) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{2} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{2} } func (m *GoTest) XXX_Unmarshal(b []byte) error { @@ -1099,124 +1094,6 @@ func (m *GoTest) GetOptionalgroup() *GoTest_OptionalGroup { return nil } -// Required, repeated, and optional groups. -type GoTest_RequiredGroup struct { - RequiredField *string `protobuf:"bytes,71,req,name=RequiredField" json:"RequiredField,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GoTest_RequiredGroup) Reset() { *m = GoTest_RequiredGroup{} } -func (m *GoTest_RequiredGroup) String() string { return proto.CompactTextString(m) } -func (*GoTest_RequiredGroup) ProtoMessage() {} -func (*GoTest_RequiredGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{2, 0} -} - -func (m *GoTest_RequiredGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GoTest_RequiredGroup.Unmarshal(m, b) -} -func (m *GoTest_RequiredGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GoTest_RequiredGroup.Marshal(b, m, deterministic) -} -func (m *GoTest_RequiredGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_GoTest_RequiredGroup.Merge(m, src) -} -func (m *GoTest_RequiredGroup) XXX_Size() int { - return xxx_messageInfo_GoTest_RequiredGroup.Size(m) -} -func (m *GoTest_RequiredGroup) XXX_DiscardUnknown() { - xxx_messageInfo_GoTest_RequiredGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_GoTest_RequiredGroup proto.InternalMessageInfo - -func (m *GoTest_RequiredGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" -} - -type GoTest_RepeatedGroup struct { - RequiredField *string `protobuf:"bytes,81,req,name=RequiredField" json:"RequiredField,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GoTest_RepeatedGroup) Reset() { *m = GoTest_RepeatedGroup{} } -func (m *GoTest_RepeatedGroup) String() string { return proto.CompactTextString(m) } -func (*GoTest_RepeatedGroup) ProtoMessage() {} -func (*GoTest_RepeatedGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{2, 1} -} - -func (m *GoTest_RepeatedGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GoTest_RepeatedGroup.Unmarshal(m, b) -} -func (m *GoTest_RepeatedGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GoTest_RepeatedGroup.Marshal(b, m, deterministic) -} -func (m *GoTest_RepeatedGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_GoTest_RepeatedGroup.Merge(m, src) -} -func (m *GoTest_RepeatedGroup) XXX_Size() int { - return xxx_messageInfo_GoTest_RepeatedGroup.Size(m) -} -func (m *GoTest_RepeatedGroup) XXX_DiscardUnknown() { - xxx_messageInfo_GoTest_RepeatedGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_GoTest_RepeatedGroup proto.InternalMessageInfo - -func (m *GoTest_RepeatedGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" -} - -type GoTest_OptionalGroup struct { - RequiredField *string `protobuf:"bytes,91,req,name=RequiredField" json:"RequiredField,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GoTest_OptionalGroup) Reset() { *m = GoTest_OptionalGroup{} } -func (m *GoTest_OptionalGroup) String() string { return proto.CompactTextString(m) } -func (*GoTest_OptionalGroup) ProtoMessage() {} -func (*GoTest_OptionalGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{2, 2} -} - -func (m *GoTest_OptionalGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GoTest_OptionalGroup.Unmarshal(m, b) -} -func (m *GoTest_OptionalGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GoTest_OptionalGroup.Marshal(b, m, deterministic) -} -func (m *GoTest_OptionalGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_GoTest_OptionalGroup.Merge(m, src) -} -func (m *GoTest_OptionalGroup) XXX_Size() int { - return xxx_messageInfo_GoTest_OptionalGroup.Size(m) -} -func (m *GoTest_OptionalGroup) XXX_DiscardUnknown() { - xxx_messageInfo_GoTest_OptionalGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_GoTest_OptionalGroup proto.InternalMessageInfo - -func (m *GoTest_OptionalGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" -} - // For testing a group containing a required field. type GoTestRequiredGroupField struct { Group *GoTestRequiredGroupField_Group `protobuf:"group,1,req,name=Group,json=group" json:"group,omitempty"` @@ -1229,7 +1106,7 @@ func (m *GoTestRequiredGroupField) Reset() { *m = GoTestRequiredGroupFie func (m *GoTestRequiredGroupField) String() string { return proto.CompactTextString(m) } func (*GoTestRequiredGroupField) ProtoMessage() {} func (*GoTestRequiredGroupField) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{3} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{3} } func (m *GoTestRequiredGroupField) XXX_Unmarshal(b []byte) error { @@ -1257,45 +1134,6 @@ func (m *GoTestRequiredGroupField) GetGroup() *GoTestRequiredGroupField_Group { return nil } -type GoTestRequiredGroupField_Group struct { - Field *int32 `protobuf:"varint,2,req,name=Field" json:"Field,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GoTestRequiredGroupField_Group) Reset() { *m = GoTestRequiredGroupField_Group{} } -func (m *GoTestRequiredGroupField_Group) String() string { return proto.CompactTextString(m) } -func (*GoTestRequiredGroupField_Group) ProtoMessage() {} -func (*GoTestRequiredGroupField_Group) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{3, 0} -} - -func (m *GoTestRequiredGroupField_Group) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GoTestRequiredGroupField_Group.Unmarshal(m, b) -} -func (m *GoTestRequiredGroupField_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GoTestRequiredGroupField_Group.Marshal(b, m, deterministic) -} -func (m *GoTestRequiredGroupField_Group) XXX_Merge(src proto.Message) { - xxx_messageInfo_GoTestRequiredGroupField_Group.Merge(m, src) -} -func (m *GoTestRequiredGroupField_Group) XXX_Size() int { - return xxx_messageInfo_GoTestRequiredGroupField_Group.Size(m) -} -func (m *GoTestRequiredGroupField_Group) XXX_DiscardUnknown() { - xxx_messageInfo_GoTestRequiredGroupField_Group.DiscardUnknown(m) -} - -var xxx_messageInfo_GoTestRequiredGroupField_Group proto.InternalMessageInfo - -func (m *GoTestRequiredGroupField_Group) GetField() int32 { - if m != nil && m.Field != nil { - return *m.Field - } - return 0 -} - // For testing skipping of unrecognized fields. // Numbers are all big, larger than tag numbers in GoTestField, // the message used in the corresponding test. @@ -1314,7 +1152,7 @@ func (m *GoSkipTest) Reset() { *m = GoSkipTest{} } func (m *GoSkipTest) String() string { return proto.CompactTextString(m) } func (*GoSkipTest) ProtoMessage() {} func (*GoSkipTest) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{4} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{4} } func (m *GoSkipTest) XXX_Unmarshal(b []byte) error { @@ -1370,53 +1208,6 @@ func (m *GoSkipTest) GetSkipgroup() *GoSkipTest_SkipGroup { return nil } -type GoSkipTest_SkipGroup struct { - GroupInt32 *int32 `protobuf:"varint,16,req,name=group_int32,json=groupInt32" json:"group_int32,omitempty"` - GroupString *string `protobuf:"bytes,17,req,name=group_string,json=groupString" json:"group_string,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GoSkipTest_SkipGroup) Reset() { *m = GoSkipTest_SkipGroup{} } -func (m *GoSkipTest_SkipGroup) String() string { return proto.CompactTextString(m) } -func (*GoSkipTest_SkipGroup) ProtoMessage() {} -func (*GoSkipTest_SkipGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{4, 0} -} - -func (m *GoSkipTest_SkipGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GoSkipTest_SkipGroup.Unmarshal(m, b) -} -func (m *GoSkipTest_SkipGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GoSkipTest_SkipGroup.Marshal(b, m, deterministic) -} -func (m *GoSkipTest_SkipGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_GoSkipTest_SkipGroup.Merge(m, src) -} -func (m *GoSkipTest_SkipGroup) XXX_Size() int { - return xxx_messageInfo_GoSkipTest_SkipGroup.Size(m) -} -func (m *GoSkipTest_SkipGroup) XXX_DiscardUnknown() { - xxx_messageInfo_GoSkipTest_SkipGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_GoSkipTest_SkipGroup proto.InternalMessageInfo - -func (m *GoSkipTest_SkipGroup) GetGroupInt32() int32 { - if m != nil && m.GroupInt32 != nil { - return *m.GroupInt32 - } - return 0 -} - -func (m *GoSkipTest_SkipGroup) GetGroupString() string { - if m != nil && m.GroupString != nil { - return *m.GroupString - } - return "" -} - // For testing packed/non-packed decoder switching. // A serialized instance of one should be deserializable as the other. type NonPackedTest struct { @@ -1430,7 +1221,7 @@ func (m *NonPackedTest) Reset() { *m = NonPackedTest{} } func (m *NonPackedTest) String() string { return proto.CompactTextString(m) } func (*NonPackedTest) ProtoMessage() {} func (*NonPackedTest) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{5} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{5} } func (m *NonPackedTest) XXX_Unmarshal(b []byte) error { @@ -1469,7 +1260,7 @@ func (m *PackedTest) Reset() { *m = PackedTest{} } func (m *PackedTest) String() string { return proto.CompactTextString(m) } func (*PackedTest) ProtoMessage() {} func (*PackedTest) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{6} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{6} } func (m *PackedTest) XXX_Unmarshal(b []byte) error { @@ -1509,7 +1300,7 @@ func (m *MaxTag) Reset() { *m = MaxTag{} } func (m *MaxTag) String() string { return proto.CompactTextString(m) } func (*MaxTag) ProtoMessage() {} func (*MaxTag) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{7} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{7} } func (m *MaxTag) XXX_Unmarshal(b []byte) error { @@ -1549,7 +1340,7 @@ func (m *OldMessage) Reset() { *m = OldMessage{} } func (m *OldMessage) String() string { return proto.CompactTextString(m) } func (*OldMessage) ProtoMessage() {} func (*OldMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{8} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{8} } func (m *OldMessage) XXX_Unmarshal(b []byte) error { @@ -1584,45 +1375,6 @@ func (m *OldMessage) GetNum() int32 { return 0 } -type OldMessage_Nested struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OldMessage_Nested) Reset() { *m = OldMessage_Nested{} } -func (m *OldMessage_Nested) String() string { return proto.CompactTextString(m) } -func (*OldMessage_Nested) ProtoMessage() {} -func (*OldMessage_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{8, 0} -} - -func (m *OldMessage_Nested) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OldMessage_Nested.Unmarshal(m, b) -} -func (m *OldMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OldMessage_Nested.Marshal(b, m, deterministic) -} -func (m *OldMessage_Nested) XXX_Merge(src proto.Message) { - xxx_messageInfo_OldMessage_Nested.Merge(m, src) -} -func (m *OldMessage_Nested) XXX_Size() int { - return xxx_messageInfo_OldMessage_Nested.Size(m) -} -func (m *OldMessage_Nested) XXX_DiscardUnknown() { - xxx_messageInfo_OldMessage_Nested.DiscardUnknown(m) -} - -var xxx_messageInfo_OldMessage_Nested proto.InternalMessageInfo - -func (m *OldMessage_Nested) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - // NewMessage is wire compatible with OldMessage; // imagine it as a future version. type NewMessage struct { @@ -1638,7 +1390,7 @@ func (m *NewMessage) Reset() { *m = NewMessage{} } func (m *NewMessage) String() string { return proto.CompactTextString(m) } func (*NewMessage) ProtoMessage() {} func (*NewMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{9} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{9} } func (m *NewMessage) XXX_Unmarshal(b []byte) error { @@ -1673,67 +1425,20 @@ func (m *NewMessage) GetNum() int64 { return 0 } -type NewMessage_Nested struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - FoodGroup *string `protobuf:"bytes,2,opt,name=food_group,json=foodGroup" json:"food_group,omitempty"` +type InnerMessage struct { + Host *string `protobuf:"bytes,1,req,name=host" json:"host,omitempty"` + Port *int32 `protobuf:"varint,2,opt,name=port,def=4000" json:"port,omitempty"` + Connected *bool `protobuf:"varint,3,opt,name=connected" json:"connected,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *NewMessage_Nested) Reset() { *m = NewMessage_Nested{} } -func (m *NewMessage_Nested) String() string { return proto.CompactTextString(m) } -func (*NewMessage_Nested) ProtoMessage() {} -func (*NewMessage_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{9, 0} -} - -func (m *NewMessage_Nested) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NewMessage_Nested.Unmarshal(m, b) -} -func (m *NewMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NewMessage_Nested.Marshal(b, m, deterministic) -} -func (m *NewMessage_Nested) XXX_Merge(src proto.Message) { - xxx_messageInfo_NewMessage_Nested.Merge(m, src) -} -func (m *NewMessage_Nested) XXX_Size() int { - return xxx_messageInfo_NewMessage_Nested.Size(m) -} -func (m *NewMessage_Nested) XXX_DiscardUnknown() { - xxx_messageInfo_NewMessage_Nested.DiscardUnknown(m) -} - -var xxx_messageInfo_NewMessage_Nested proto.InternalMessageInfo - -func (m *NewMessage_Nested) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *NewMessage_Nested) GetFoodGroup() string { - if m != nil && m.FoodGroup != nil { - return *m.FoodGroup - } - return "" -} - -type InnerMessage struct { - Host *string `protobuf:"bytes,1,req,name=host" json:"host,omitempty"` - Port *int32 `protobuf:"varint,2,opt,name=port,def=4000" json:"port,omitempty"` - Connected *bool `protobuf:"varint,3,opt,name=connected" json:"connected,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *InnerMessage) Reset() { *m = InnerMessage{} } -func (m *InnerMessage) String() string { return proto.CompactTextString(m) } -func (*InnerMessage) ProtoMessage() {} -func (*InnerMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{10} +func (m *InnerMessage) Reset() { *m = InnerMessage{} } +func (m *InnerMessage) String() string { return proto.CompactTextString(m) } +func (*InnerMessage) ProtoMessage() {} +func (*InnerMessage) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{10} } func (m *InnerMessage) XXX_Unmarshal(b []byte) error { @@ -1792,7 +1497,7 @@ func (m *OtherMessage) Reset() { *m = OtherMessage{} } func (m *OtherMessage) String() string { return proto.CompactTextString(m) } func (*OtherMessage) ProtoMessage() {} func (*OtherMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{11} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{11} } var extRange_OtherMessage = []proto.ExtensionRange{ @@ -1860,7 +1565,7 @@ func (m *RequiredInnerMessage) Reset() { *m = RequiredInnerMessage{} } func (m *RequiredInnerMessage) String() string { return proto.CompactTextString(m) } func (*RequiredInnerMessage) ProtoMessage() {} func (*RequiredInnerMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{12} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{12} } func (m *RequiredInnerMessage) XXX_Unmarshal(b []byte) error { @@ -1912,7 +1617,7 @@ func (m *MyMessage) Reset() { *m = MyMessage{} } func (m *MyMessage) String() string { return proto.CompactTextString(m) } func (*MyMessage) ProtoMessage() {} func (*MyMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{13} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{13} } var extRange_MyMessage = []proto.ExtensionRange{ @@ -2025,45 +1730,6 @@ func (m *MyMessage) GetBigfloat() float64 { return 0 } -type MyMessage_SomeGroup struct { - GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MyMessage_SomeGroup) Reset() { *m = MyMessage_SomeGroup{} } -func (m *MyMessage_SomeGroup) String() string { return proto.CompactTextString(m) } -func (*MyMessage_SomeGroup) ProtoMessage() {} -func (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{13, 0} -} - -func (m *MyMessage_SomeGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MyMessage_SomeGroup.Unmarshal(m, b) -} -func (m *MyMessage_SomeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MyMessage_SomeGroup.Marshal(b, m, deterministic) -} -func (m *MyMessage_SomeGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_MyMessage_SomeGroup.Merge(m, src) -} -func (m *MyMessage_SomeGroup) XXX_Size() int { - return xxx_messageInfo_MyMessage_SomeGroup.Size(m) -} -func (m *MyMessage_SomeGroup) XXX_DiscardUnknown() { - xxx_messageInfo_MyMessage_SomeGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_MyMessage_SomeGroup proto.InternalMessageInfo - -func (m *MyMessage_SomeGroup) GetGroupField() int32 { - if m != nil && m.GroupField != nil { - return *m.GroupField - } - return 0 -} - type Ext struct { Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` MapField map[int32]int32 `protobuf:"bytes,2,rep,name=map_field,json=mapField" json:"map_field,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` @@ -2076,7 +1742,7 @@ func (m *Ext) Reset() { *m = Ext{} } func (m *Ext) String() string { return proto.CompactTextString(m) } func (*Ext) ProtoMessage() {} func (*Ext) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{14} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{14} } func (m *Ext) XXX_Unmarshal(b []byte) error { @@ -2111,33 +1777,6 @@ func (m *Ext) GetMapField() map[int32]int32 { return nil } -var E_Ext_More = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: (*Ext)(nil), - Field: 103, - Name: "test_proto.Ext.more", - Tag: "bytes,103,opt,name=more", - Filename: "test_proto/test.proto", -} - -var E_Ext_Text = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: (*string)(nil), - Field: 104, - Name: "test_proto.Ext.text", - Tag: "bytes,104,opt,name=text", - Filename: "test_proto/test.proto", -} - -var E_Ext_Number = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 105, - Name: "test_proto.Ext.number", - Tag: "varint,105,opt,name=number", - Filename: "test_proto/test.proto", -} - type ComplexExtension struct { First *int32 `protobuf:"varint,1,opt,name=first" json:"first,omitempty"` Second *int32 `protobuf:"varint,2,opt,name=second" json:"second,omitempty"` @@ -2151,7 +1790,7 @@ func (m *ComplexExtension) Reset() { *m = ComplexExtension{} } func (m *ComplexExtension) String() string { return proto.CompactTextString(m) } func (*ComplexExtension) ProtoMessage() {} func (*ComplexExtension) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{15} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{15} } func (m *ComplexExtension) XXX_Unmarshal(b []byte) error { @@ -2204,7 +1843,7 @@ func (m *DefaultsMessage) Reset() { *m = DefaultsMessage{} } func (m *DefaultsMessage) String() string { return proto.CompactTextString(m) } func (*DefaultsMessage) ProtoMessage() {} func (*DefaultsMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{16} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{16} } var extRange_DefaultsMessage = []proto.ExtensionRange{ @@ -2244,14 +1883,7 @@ func (m *MyMessageSet) Reset() { *m = MyMessageSet{} } func (m *MyMessageSet) String() string { return proto.CompactTextString(m) } func (*MyMessageSet) ProtoMessage() {} func (*MyMessageSet) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{17} -} - -func (m *MyMessageSet) MarshalJSON() ([]byte, error) { - return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions) -} -func (m *MyMessageSet) UnmarshalJSON(buf []byte) error { - return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions) + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{17} } var extRange_MyMessageSet = []proto.ExtensionRange{ @@ -2290,7 +1922,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{18} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{18} } func (m *Empty) XXX_Unmarshal(b []byte) error { @@ -2322,7 +1954,7 @@ func (m *MessageList) Reset() { *m = MessageList{} } func (m *MessageList) String() string { return proto.CompactTextString(m) } func (*MessageList) ProtoMessage() {} func (*MessageList) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{19} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{19} } func (m *MessageList) XXX_Unmarshal(b []byte) error { @@ -2350,53 +1982,6 @@ func (m *MessageList) GetMessage() []*MessageList_Message { return nil } -type MessageList_Message struct { - Name *string `protobuf:"bytes,2,req,name=name" json:"name,omitempty"` - Count *int32 `protobuf:"varint,3,req,name=count" json:"count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MessageList_Message) Reset() { *m = MessageList_Message{} } -func (m *MessageList_Message) String() string { return proto.CompactTextString(m) } -func (*MessageList_Message) ProtoMessage() {} -func (*MessageList_Message) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{19, 0} -} - -func (m *MessageList_Message) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MessageList_Message.Unmarshal(m, b) -} -func (m *MessageList_Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MessageList_Message.Marshal(b, m, deterministic) -} -func (m *MessageList_Message) XXX_Merge(src proto.Message) { - xxx_messageInfo_MessageList_Message.Merge(m, src) -} -func (m *MessageList_Message) XXX_Size() int { - return xxx_messageInfo_MessageList_Message.Size(m) -} -func (m *MessageList_Message) XXX_DiscardUnknown() { - xxx_messageInfo_MessageList_Message.DiscardUnknown(m) -} - -var xxx_messageInfo_MessageList_Message proto.InternalMessageInfo - -func (m *MessageList_Message) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *MessageList_Message) GetCount() int32 { - if m != nil && m.Count != nil { - return *m.Count - } - return 0 -} - type Strings struct { StringField *string `protobuf:"bytes,1,opt,name=string_field,json=stringField" json:"string_field,omitempty"` BytesField []byte `protobuf:"bytes,2,opt,name=bytes_field,json=bytesField" json:"bytes_field,omitempty"` @@ -2409,7 +1994,7 @@ func (m *Strings) Reset() { *m = Strings{} } func (m *Strings) String() string { return proto.CompactTextString(m) } func (*Strings) ProtoMessage() {} func (*Strings) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{20} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{20} } func (m *Strings) XXX_Unmarshal(b []byte) error { @@ -2478,7 +2063,7 @@ func (m *Defaults) Reset() { *m = Defaults{} } func (m *Defaults) String() string { return proto.CompactTextString(m) } func (*Defaults) ProtoMessage() {} func (*Defaults) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{21} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{21} } func (m *Defaults) XXX_Unmarshal(b []byte) error { @@ -2520,6 +2105,8 @@ var Default_Defaults_F_Pinf float32 = float32(math.Inf(1)) var Default_Defaults_F_Ninf float32 = float32(math.Inf(-1)) var Default_Defaults_F_Nan float32 = float32(math.NaN()) +const Default_Defaults_StrZero string = "" + func (m *Defaults) GetF_Bool() bool { if m != nil && m.F_Bool != nil { return *m.F_Bool @@ -2650,7 +2237,7 @@ func (m *Defaults) GetStrZero() string { if m != nil && m.StrZero != nil { return *m.StrZero } - return "" + return Default_Defaults_StrZero } type SubDefaults struct { @@ -2664,7 +2251,7 @@ func (m *SubDefaults) Reset() { *m = SubDefaults{} } func (m *SubDefaults) String() string { return proto.CompactTextString(m) } func (*SubDefaults) ProtoMessage() {} func (*SubDefaults) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{22} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{22} } func (m *SubDefaults) XXX_Unmarshal(b []byte) error { @@ -2705,7 +2292,7 @@ func (m *RepeatedEnum) Reset() { *m = RepeatedEnum{} } func (m *RepeatedEnum) String() string { return proto.CompactTextString(m) } func (*RepeatedEnum) ProtoMessage() {} func (*RepeatedEnum) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{23} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{23} } func (m *RepeatedEnum) XXX_Unmarshal(b []byte) error { @@ -2750,7 +2337,7 @@ func (m *MoreRepeated) Reset() { *m = MoreRepeated{} } func (m *MoreRepeated) String() string { return proto.CompactTextString(m) } func (*MoreRepeated) ProtoMessage() {} func (*MoreRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{24} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{24} } func (m *MoreRepeated) XXX_Unmarshal(b []byte) error { @@ -2831,7 +2418,7 @@ func (m *GroupOld) Reset() { *m = GroupOld{} } func (m *GroupOld) String() string { return proto.CompactTextString(m) } func (*GroupOld) ProtoMessage() {} func (*GroupOld) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{25} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{25} } func (m *GroupOld) XXX_Unmarshal(b []byte) error { @@ -2859,45 +2446,6 @@ func (m *GroupOld) GetG() *GroupOld_G { return nil } -type GroupOld_G struct { - X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GroupOld_G) Reset() { *m = GroupOld_G{} } -func (m *GroupOld_G) String() string { return proto.CompactTextString(m) } -func (*GroupOld_G) ProtoMessage() {} -func (*GroupOld_G) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{25, 0} -} - -func (m *GroupOld_G) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GroupOld_G.Unmarshal(m, b) -} -func (m *GroupOld_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GroupOld_G.Marshal(b, m, deterministic) -} -func (m *GroupOld_G) XXX_Merge(src proto.Message) { - xxx_messageInfo_GroupOld_G.Merge(m, src) -} -func (m *GroupOld_G) XXX_Size() int { - return xxx_messageInfo_GroupOld_G.Size(m) -} -func (m *GroupOld_G) XXX_DiscardUnknown() { - xxx_messageInfo_GroupOld_G.DiscardUnknown(m) -} - -var xxx_messageInfo_GroupOld_G proto.InternalMessageInfo - -func (m *GroupOld_G) GetX() int32 { - if m != nil && m.X != nil { - return *m.X - } - return 0 -} - type GroupNew struct { G *GroupNew_G `protobuf:"group,101,opt,name=G,json=g" json:"g,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -2909,7 +2457,7 @@ func (m *GroupNew) Reset() { *m = GroupNew{} } func (m *GroupNew) String() string { return proto.CompactTextString(m) } func (*GroupNew) ProtoMessage() {} func (*GroupNew) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{26} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{26} } func (m *GroupNew) XXX_Unmarshal(b []byte) error { @@ -2937,53 +2485,6 @@ func (m *GroupNew) GetG() *GroupNew_G { return nil } -type GroupNew_G struct { - X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` - Y *int32 `protobuf:"varint,3,opt,name=y" json:"y,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GroupNew_G) Reset() { *m = GroupNew_G{} } -func (m *GroupNew_G) String() string { return proto.CompactTextString(m) } -func (*GroupNew_G) ProtoMessage() {} -func (*GroupNew_G) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{26, 0} -} - -func (m *GroupNew_G) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GroupNew_G.Unmarshal(m, b) -} -func (m *GroupNew_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GroupNew_G.Marshal(b, m, deterministic) -} -func (m *GroupNew_G) XXX_Merge(src proto.Message) { - xxx_messageInfo_GroupNew_G.Merge(m, src) -} -func (m *GroupNew_G) XXX_Size() int { - return xxx_messageInfo_GroupNew_G.Size(m) -} -func (m *GroupNew_G) XXX_DiscardUnknown() { - xxx_messageInfo_GroupNew_G.DiscardUnknown(m) -} - -var xxx_messageInfo_GroupNew_G proto.InternalMessageInfo - -func (m *GroupNew_G) GetX() int32 { - if m != nil && m.X != nil { - return *m.X - } - return 0 -} - -func (m *GroupNew_G) GetY() int32 { - if m != nil && m.Y != nil { - return *m.Y - } - return 0 -} - type FloatingPoint struct { F *float64 `protobuf:"fixed64,1,req,name=f" json:"f,omitempty"` Exact *bool `protobuf:"varint,2,opt,name=exact" json:"exact,omitempty"` @@ -2996,7 +2497,7 @@ func (m *FloatingPoint) Reset() { *m = FloatingPoint{} } func (m *FloatingPoint) String() string { return proto.CompactTextString(m) } func (*FloatingPoint) ProtoMessage() {} func (*FloatingPoint) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{27} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{27} } func (m *FloatingPoint) XXX_Unmarshal(b []byte) error { @@ -3045,7 +2546,7 @@ func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } func (*MessageWithMap) ProtoMessage() {} func (*MessageWithMap) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{28} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{28} } func (m *MessageWithMap) XXX_Unmarshal(b []byte) error { @@ -3126,7 +2627,7 @@ func (m *Oneof) Reset() { *m = Oneof{} } func (m *Oneof) String() string { return proto.CompactTextString(m) } func (*Oneof) ProtoMessage() {} func (*Oneof) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{29} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{29} } func (m *Oneof) XXX_Unmarshal(b []byte) error { @@ -3427,45 +2928,6 @@ func (*Oneof) XXX_OneofWrappers() []interface{} { } } -type Oneof_F_Group struct { - X *int32 `protobuf:"varint,17,opt,name=x" json:"x,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Oneof_F_Group) Reset() { *m = Oneof_F_Group{} } -func (m *Oneof_F_Group) String() string { return proto.CompactTextString(m) } -func (*Oneof_F_Group) ProtoMessage() {} -func (*Oneof_F_Group) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{29, 0} -} - -func (m *Oneof_F_Group) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Oneof_F_Group.Unmarshal(m, b) -} -func (m *Oneof_F_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Oneof_F_Group.Marshal(b, m, deterministic) -} -func (m *Oneof_F_Group) XXX_Merge(src proto.Message) { - xxx_messageInfo_Oneof_F_Group.Merge(m, src) -} -func (m *Oneof_F_Group) XXX_Size() int { - return xxx_messageInfo_Oneof_F_Group.Size(m) -} -func (m *Oneof_F_Group) XXX_DiscardUnknown() { - xxx_messageInfo_Oneof_F_Group.DiscardUnknown(m) -} - -var xxx_messageInfo_Oneof_F_Group proto.InternalMessageInfo - -func (m *Oneof_F_Group) GetX() int32 { - if m != nil && m.X != nil { - return *m.X - } - return 0 -} - type Communique struct { MakeMeCry *bool `protobuf:"varint,1,opt,name=make_me_cry,json=makeMeCry" json:"make_me_cry,omitempty"` // This is a oneof, called "union". @@ -3487,7 +2949,7 @@ func (m *Communique) Reset() { *m = Communique{} } func (m *Communique) String() string { return proto.CompactTextString(m) } func (*Communique) ProtoMessage() {} func (*Communique) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{30} + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{30} } func (m *Communique) XXX_Unmarshal(b []byte) error { @@ -3562,155 +3024,656 @@ func (m *Communique) GetUnion() isCommunique_Union { return nil } -func (m *Communique) GetNumber() int32 { - if x, ok := m.GetUnion().(*Communique_Number); ok { - return x.Number - } - return 0 -} +func (m *Communique) GetNumber() int32 { + if x, ok := m.GetUnion().(*Communique_Number); ok { + return x.Number + } + return 0 +} + +func (m *Communique) GetName() string { + if x, ok := m.GetUnion().(*Communique_Name); ok { + return x.Name + } + return "" +} + +func (m *Communique) GetData() []byte { + if x, ok := m.GetUnion().(*Communique_Data); ok { + return x.Data + } + return nil +} + +func (m *Communique) GetTempC() float64 { + if x, ok := m.GetUnion().(*Communique_TempC); ok { + return x.TempC + } + return 0 +} + +func (m *Communique) GetCol() MyMessage_Color { + if x, ok := m.GetUnion().(*Communique_Col); ok { + return x.Col + } + return MyMessage_RED +} + +func (m *Communique) GetMsg() *Strings { + if x, ok := m.GetUnion().(*Communique_Msg); ok { + return x.Msg + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Communique) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Communique_Number)(nil), + (*Communique_Name)(nil), + (*Communique_Data)(nil), + (*Communique_TempC)(nil), + (*Communique_Col)(nil), + (*Communique_Msg)(nil), + } +} + +type TestUTF8 struct { + Scalar *string `protobuf:"bytes,1,opt,name=scalar" json:"scalar,omitempty"` + Vector []string `protobuf:"bytes,2,rep,name=vector" json:"vector,omitempty"` + // Types that are valid to be assigned to Oneof: + // *TestUTF8_Field + Oneof isTestUTF8_Oneof `protobuf_oneof:"oneof"` + MapKey map[string]int64 `protobuf:"bytes,4,rep,name=map_key,json=mapKey" json:"map_key,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + MapValue map[int64]string `protobuf:"bytes,5,rep,name=map_value,json=mapValue" json:"map_value,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TestUTF8) Reset() { *m = TestUTF8{} } +func (m *TestUTF8) String() string { return proto.CompactTextString(m) } +func (*TestUTF8) ProtoMessage() {} +func (*TestUTF8) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{31} +} + +func (m *TestUTF8) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TestUTF8.Unmarshal(m, b) +} +func (m *TestUTF8) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TestUTF8.Marshal(b, m, deterministic) +} +func (m *TestUTF8) XXX_Merge(src proto.Message) { + xxx_messageInfo_TestUTF8.Merge(m, src) +} +func (m *TestUTF8) XXX_Size() int { + return xxx_messageInfo_TestUTF8.Size(m) +} +func (m *TestUTF8) XXX_DiscardUnknown() { + xxx_messageInfo_TestUTF8.DiscardUnknown(m) +} + +var xxx_messageInfo_TestUTF8 proto.InternalMessageInfo + +func (m *TestUTF8) GetScalar() string { + if m != nil && m.Scalar != nil { + return *m.Scalar + } + return "" +} + +func (m *TestUTF8) GetVector() []string { + if m != nil { + return m.Vector + } + return nil +} + +type isTestUTF8_Oneof interface { + isTestUTF8_Oneof() +} + +type TestUTF8_Field struct { + Field string `protobuf:"bytes,3,opt,name=field,oneof"` +} + +func (*TestUTF8_Field) isTestUTF8_Oneof() {} + +func (m *TestUTF8) GetOneof() isTestUTF8_Oneof { + if m != nil { + return m.Oneof + } + return nil +} + +func (m *TestUTF8) GetField() string { + if x, ok := m.GetOneof().(*TestUTF8_Field); ok { + return x.Field + } + return "" +} + +func (m *TestUTF8) GetMapKey() map[string]int64 { + if m != nil { + return m.MapKey + } + return nil +} + +func (m *TestUTF8) GetMapValue() map[int64]string { + if m != nil { + return m.MapValue + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*TestUTF8) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*TestUTF8_Field)(nil), + } +} + +// Required, repeated, and optional groups. +type GoTest_RequiredGroup struct { + RequiredField *string `protobuf:"bytes,71,req,name=RequiredField" json:"RequiredField,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTest_RequiredGroup) Reset() { *m = GoTest_RequiredGroup{} } +func (m *GoTest_RequiredGroup) String() string { return proto.CompactTextString(m) } +func (*GoTest_RequiredGroup) ProtoMessage() {} +func (*GoTest_RequiredGroup) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{2, 0} +} + +func (m *GoTest_RequiredGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTest_RequiredGroup.Unmarshal(m, b) +} +func (m *GoTest_RequiredGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTest_RequiredGroup.Marshal(b, m, deterministic) +} +func (m *GoTest_RequiredGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTest_RequiredGroup.Merge(m, src) +} +func (m *GoTest_RequiredGroup) XXX_Size() int { + return xxx_messageInfo_GoTest_RequiredGroup.Size(m) +} +func (m *GoTest_RequiredGroup) XXX_DiscardUnknown() { + xxx_messageInfo_GoTest_RequiredGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTest_RequiredGroup proto.InternalMessageInfo + +func (m *GoTest_RequiredGroup) GetRequiredField() string { + if m != nil && m.RequiredField != nil { + return *m.RequiredField + } + return "" +} + +type GoTest_RepeatedGroup struct { + RequiredField *string `protobuf:"bytes,81,req,name=RequiredField" json:"RequiredField,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTest_RepeatedGroup) Reset() { *m = GoTest_RepeatedGroup{} } +func (m *GoTest_RepeatedGroup) String() string { return proto.CompactTextString(m) } +func (*GoTest_RepeatedGroup) ProtoMessage() {} +func (*GoTest_RepeatedGroup) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{2, 1} +} + +func (m *GoTest_RepeatedGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTest_RepeatedGroup.Unmarshal(m, b) +} +func (m *GoTest_RepeatedGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTest_RepeatedGroup.Marshal(b, m, deterministic) +} +func (m *GoTest_RepeatedGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTest_RepeatedGroup.Merge(m, src) +} +func (m *GoTest_RepeatedGroup) XXX_Size() int { + return xxx_messageInfo_GoTest_RepeatedGroup.Size(m) +} +func (m *GoTest_RepeatedGroup) XXX_DiscardUnknown() { + xxx_messageInfo_GoTest_RepeatedGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTest_RepeatedGroup proto.InternalMessageInfo + +func (m *GoTest_RepeatedGroup) GetRequiredField() string { + if m != nil && m.RequiredField != nil { + return *m.RequiredField + } + return "" +} + +type GoTest_OptionalGroup struct { + RequiredField *string `protobuf:"bytes,91,req,name=RequiredField" json:"RequiredField,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTest_OptionalGroup) Reset() { *m = GoTest_OptionalGroup{} } +func (m *GoTest_OptionalGroup) String() string { return proto.CompactTextString(m) } +func (*GoTest_OptionalGroup) ProtoMessage() {} +func (*GoTest_OptionalGroup) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{2, 2} +} + +func (m *GoTest_OptionalGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTest_OptionalGroup.Unmarshal(m, b) +} +func (m *GoTest_OptionalGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTest_OptionalGroup.Marshal(b, m, deterministic) +} +func (m *GoTest_OptionalGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTest_OptionalGroup.Merge(m, src) +} +func (m *GoTest_OptionalGroup) XXX_Size() int { + return xxx_messageInfo_GoTest_OptionalGroup.Size(m) +} +func (m *GoTest_OptionalGroup) XXX_DiscardUnknown() { + xxx_messageInfo_GoTest_OptionalGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTest_OptionalGroup proto.InternalMessageInfo + +func (m *GoTest_OptionalGroup) GetRequiredField() string { + if m != nil && m.RequiredField != nil { + return *m.RequiredField + } + return "" +} + +type GoTestRequiredGroupField_Group struct { + Field *int32 `protobuf:"varint,2,req,name=Field" json:"Field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTestRequiredGroupField_Group) Reset() { *m = GoTestRequiredGroupField_Group{} } +func (m *GoTestRequiredGroupField_Group) String() string { return proto.CompactTextString(m) } +func (*GoTestRequiredGroupField_Group) ProtoMessage() {} +func (*GoTestRequiredGroupField_Group) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{3, 0} +} + +func (m *GoTestRequiredGroupField_Group) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTestRequiredGroupField_Group.Unmarshal(m, b) +} +func (m *GoTestRequiredGroupField_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTestRequiredGroupField_Group.Marshal(b, m, deterministic) +} +func (m *GoTestRequiredGroupField_Group) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTestRequiredGroupField_Group.Merge(m, src) +} +func (m *GoTestRequiredGroupField_Group) XXX_Size() int { + return xxx_messageInfo_GoTestRequiredGroupField_Group.Size(m) +} +func (m *GoTestRequiredGroupField_Group) XXX_DiscardUnknown() { + xxx_messageInfo_GoTestRequiredGroupField_Group.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTestRequiredGroupField_Group proto.InternalMessageInfo + +func (m *GoTestRequiredGroupField_Group) GetField() int32 { + if m != nil && m.Field != nil { + return *m.Field + } + return 0 +} + +type GoSkipTest_SkipGroup struct { + GroupInt32 *int32 `protobuf:"varint,16,req,name=group_int32,json=groupInt32" json:"group_int32,omitempty"` + GroupString *string `protobuf:"bytes,17,req,name=group_string,json=groupString" json:"group_string,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoSkipTest_SkipGroup) Reset() { *m = GoSkipTest_SkipGroup{} } +func (m *GoSkipTest_SkipGroup) String() string { return proto.CompactTextString(m) } +func (*GoSkipTest_SkipGroup) ProtoMessage() {} +func (*GoSkipTest_SkipGroup) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{4, 0} +} + +func (m *GoSkipTest_SkipGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoSkipTest_SkipGroup.Unmarshal(m, b) +} +func (m *GoSkipTest_SkipGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoSkipTest_SkipGroup.Marshal(b, m, deterministic) +} +func (m *GoSkipTest_SkipGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoSkipTest_SkipGroup.Merge(m, src) +} +func (m *GoSkipTest_SkipGroup) XXX_Size() int { + return xxx_messageInfo_GoSkipTest_SkipGroup.Size(m) +} +func (m *GoSkipTest_SkipGroup) XXX_DiscardUnknown() { + xxx_messageInfo_GoSkipTest_SkipGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_GoSkipTest_SkipGroup proto.InternalMessageInfo + +func (m *GoSkipTest_SkipGroup) GetGroupInt32() int32 { + if m != nil && m.GroupInt32 != nil { + return *m.GroupInt32 + } + return 0 +} + +func (m *GoSkipTest_SkipGroup) GetGroupString() string { + if m != nil && m.GroupString != nil { + return *m.GroupString + } + return "" +} + +type OldMessage_Nested struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OldMessage_Nested) Reset() { *m = OldMessage_Nested{} } +func (m *OldMessage_Nested) String() string { return proto.CompactTextString(m) } +func (*OldMessage_Nested) ProtoMessage() {} +func (*OldMessage_Nested) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{8, 0} +} + +func (m *OldMessage_Nested) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OldMessage_Nested.Unmarshal(m, b) +} +func (m *OldMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OldMessage_Nested.Marshal(b, m, deterministic) +} +func (m *OldMessage_Nested) XXX_Merge(src proto.Message) { + xxx_messageInfo_OldMessage_Nested.Merge(m, src) +} +func (m *OldMessage_Nested) XXX_Size() int { + return xxx_messageInfo_OldMessage_Nested.Size(m) +} +func (m *OldMessage_Nested) XXX_DiscardUnknown() { + xxx_messageInfo_OldMessage_Nested.DiscardUnknown(m) +} + +var xxx_messageInfo_OldMessage_Nested proto.InternalMessageInfo + +func (m *OldMessage_Nested) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +type NewMessage_Nested struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + FoodGroup *string `protobuf:"bytes,2,opt,name=food_group,json=foodGroup" json:"food_group,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NewMessage_Nested) Reset() { *m = NewMessage_Nested{} } +func (m *NewMessage_Nested) String() string { return proto.CompactTextString(m) } +func (*NewMessage_Nested) ProtoMessage() {} +func (*NewMessage_Nested) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{9, 0} +} + +func (m *NewMessage_Nested) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NewMessage_Nested.Unmarshal(m, b) +} +func (m *NewMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NewMessage_Nested.Marshal(b, m, deterministic) +} +func (m *NewMessage_Nested) XXX_Merge(src proto.Message) { + xxx_messageInfo_NewMessage_Nested.Merge(m, src) +} +func (m *NewMessage_Nested) XXX_Size() int { + return xxx_messageInfo_NewMessage_Nested.Size(m) +} +func (m *NewMessage_Nested) XXX_DiscardUnknown() { + xxx_messageInfo_NewMessage_Nested.DiscardUnknown(m) +} + +var xxx_messageInfo_NewMessage_Nested proto.InternalMessageInfo + +func (m *NewMessage_Nested) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *NewMessage_Nested) GetFoodGroup() string { + if m != nil && m.FoodGroup != nil { + return *m.FoodGroup + } + return "" +} + +type MyMessage_SomeGroup struct { + GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MyMessage_SomeGroup) Reset() { *m = MyMessage_SomeGroup{} } +func (m *MyMessage_SomeGroup) String() string { return proto.CompactTextString(m) } +func (*MyMessage_SomeGroup) ProtoMessage() {} +func (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{13, 0} +} + +func (m *MyMessage_SomeGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MyMessage_SomeGroup.Unmarshal(m, b) +} +func (m *MyMessage_SomeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MyMessage_SomeGroup.Marshal(b, m, deterministic) +} +func (m *MyMessage_SomeGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_MyMessage_SomeGroup.Merge(m, src) +} +func (m *MyMessage_SomeGroup) XXX_Size() int { + return xxx_messageInfo_MyMessage_SomeGroup.Size(m) +} +func (m *MyMessage_SomeGroup) XXX_DiscardUnknown() { + xxx_messageInfo_MyMessage_SomeGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_MyMessage_SomeGroup proto.InternalMessageInfo + +func (m *MyMessage_SomeGroup) GetGroupField() int32 { + if m != nil && m.GroupField != nil { + return *m.GroupField + } + return 0 +} + +type MessageList_Message struct { + Name *string `protobuf:"bytes,2,req,name=name" json:"name,omitempty"` + Count *int32 `protobuf:"varint,3,req,name=count" json:"count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MessageList_Message) Reset() { *m = MessageList_Message{} } +func (m *MessageList_Message) String() string { return proto.CompactTextString(m) } +func (*MessageList_Message) ProtoMessage() {} +func (*MessageList_Message) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{19, 0} +} + +func (m *MessageList_Message) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MessageList_Message.Unmarshal(m, b) +} +func (m *MessageList_Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MessageList_Message.Marshal(b, m, deterministic) +} +func (m *MessageList_Message) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageList_Message.Merge(m, src) +} +func (m *MessageList_Message) XXX_Size() int { + return xxx_messageInfo_MessageList_Message.Size(m) +} +func (m *MessageList_Message) XXX_DiscardUnknown() { + xxx_messageInfo_MessageList_Message.DiscardUnknown(m) +} + +var xxx_messageInfo_MessageList_Message proto.InternalMessageInfo -func (m *Communique) GetName() string { - if x, ok := m.GetUnion().(*Communique_Name); ok { - return x.Name +func (m *MessageList_Message) GetName() string { + if m != nil && m.Name != nil { + return *m.Name } return "" } -func (m *Communique) GetData() []byte { - if x, ok := m.GetUnion().(*Communique_Data); ok { - return x.Data +func (m *MessageList_Message) GetCount() int32 { + if m != nil && m.Count != nil { + return *m.Count } - return nil + return 0 } -func (m *Communique) GetTempC() float64 { - if x, ok := m.GetUnion().(*Communique_TempC); ok { - return x.TempC - } - return 0 +type GroupOld_G struct { + X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Communique) GetCol() MyMessage_Color { - if x, ok := m.GetUnion().(*Communique_Col); ok { - return x.Col - } - return MyMessage_RED +func (m *GroupOld_G) Reset() { *m = GroupOld_G{} } +func (m *GroupOld_G) String() string { return proto.CompactTextString(m) } +func (*GroupOld_G) ProtoMessage() {} +func (*GroupOld_G) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{25, 0} } -func (m *Communique) GetMsg() *Strings { - if x, ok := m.GetUnion().(*Communique_Msg); ok { - return x.Msg - } - return nil +func (m *GroupOld_G) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupOld_G.Unmarshal(m, b) +} +func (m *GroupOld_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupOld_G.Marshal(b, m, deterministic) +} +func (m *GroupOld_G) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupOld_G.Merge(m, src) +} +func (m *GroupOld_G) XXX_Size() int { + return xxx_messageInfo_GroupOld_G.Size(m) +} +func (m *GroupOld_G) XXX_DiscardUnknown() { + xxx_messageInfo_GroupOld_G.DiscardUnknown(m) } -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Communique) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Communique_Number)(nil), - (*Communique_Name)(nil), - (*Communique_Data)(nil), - (*Communique_TempC)(nil), - (*Communique_Col)(nil), - (*Communique_Msg)(nil), +var xxx_messageInfo_GroupOld_G proto.InternalMessageInfo + +func (m *GroupOld_G) GetX() int32 { + if m != nil && m.X != nil { + return *m.X } + return 0 } -type TestUTF8 struct { - Scalar *string `protobuf:"bytes,1,opt,name=scalar" json:"scalar,omitempty"` - Vector []string `protobuf:"bytes,2,rep,name=vector" json:"vector,omitempty"` - // Types that are valid to be assigned to Oneof: - // *TestUTF8_Field - Oneof isTestUTF8_Oneof `protobuf_oneof:"oneof"` - MapKey map[string]int64 `protobuf:"bytes,4,rep,name=map_key,json=mapKey" json:"map_key,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` - MapValue map[int64]string `protobuf:"bytes,5,rep,name=map_value,json=mapValue" json:"map_value,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type GroupNew_G struct { + X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` + Y *int32 `protobuf:"varint,3,opt,name=y" json:"y,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *TestUTF8) Reset() { *m = TestUTF8{} } -func (m *TestUTF8) String() string { return proto.CompactTextString(m) } -func (*TestUTF8) ProtoMessage() {} -func (*TestUTF8) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{31} +func (m *GroupNew_G) Reset() { *m = GroupNew_G{} } +func (m *GroupNew_G) String() string { return proto.CompactTextString(m) } +func (*GroupNew_G) ProtoMessage() {} +func (*GroupNew_G) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{26, 0} } -func (m *TestUTF8) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TestUTF8.Unmarshal(m, b) +func (m *GroupNew_G) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupNew_G.Unmarshal(m, b) } -func (m *TestUTF8) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TestUTF8.Marshal(b, m, deterministic) +func (m *GroupNew_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupNew_G.Marshal(b, m, deterministic) } -func (m *TestUTF8) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestUTF8.Merge(m, src) +func (m *GroupNew_G) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupNew_G.Merge(m, src) } -func (m *TestUTF8) XXX_Size() int { - return xxx_messageInfo_TestUTF8.Size(m) +func (m *GroupNew_G) XXX_Size() int { + return xxx_messageInfo_GroupNew_G.Size(m) } -func (m *TestUTF8) XXX_DiscardUnknown() { - xxx_messageInfo_TestUTF8.DiscardUnknown(m) +func (m *GroupNew_G) XXX_DiscardUnknown() { + xxx_messageInfo_GroupNew_G.DiscardUnknown(m) } -var xxx_messageInfo_TestUTF8 proto.InternalMessageInfo +var xxx_messageInfo_GroupNew_G proto.InternalMessageInfo -func (m *TestUTF8) GetScalar() string { - if m != nil && m.Scalar != nil { - return *m.Scalar +func (m *GroupNew_G) GetX() int32 { + if m != nil && m.X != nil { + return *m.X } - return "" + return 0 } -func (m *TestUTF8) GetVector() []string { - if m != nil { - return m.Vector +func (m *GroupNew_G) GetY() int32 { + if m != nil && m.Y != nil { + return *m.Y } - return nil + return 0 } -type isTestUTF8_Oneof interface { - isTestUTF8_Oneof() +type Oneof_F_Group struct { + X *int32 `protobuf:"varint,17,opt,name=x" json:"x,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -type TestUTF8_Field struct { - Field string `protobuf:"bytes,3,opt,name=field,oneof"` +func (m *Oneof_F_Group) Reset() { *m = Oneof_F_Group{} } +func (m *Oneof_F_Group) String() string { return proto.CompactTextString(m) } +func (*Oneof_F_Group) ProtoMessage() {} +func (*Oneof_F_Group) Descriptor() ([]byte, []int) { + return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{29, 0} } -func (*TestUTF8_Field) isTestUTF8_Oneof() {} - -func (m *TestUTF8) GetOneof() isTestUTF8_Oneof { - if m != nil { - return m.Oneof - } - return nil +func (m *Oneof_F_Group) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Oneof_F_Group.Unmarshal(m, b) } - -func (m *TestUTF8) GetField() string { - if x, ok := m.GetOneof().(*TestUTF8_Field); ok { - return x.Field - } - return "" +func (m *Oneof_F_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Oneof_F_Group.Marshal(b, m, deterministic) } - -func (m *TestUTF8) GetMapKey() map[string]int64 { - if m != nil { - return m.MapKey - } - return nil +func (m *Oneof_F_Group) XXX_Merge(src proto.Message) { + xxx_messageInfo_Oneof_F_Group.Merge(m, src) } - -func (m *TestUTF8) GetMapValue() map[int64]string { - if m != nil { - return m.MapValue - } - return nil +func (m *Oneof_F_Group) XXX_Size() int { + return xxx_messageInfo_Oneof_F_Group.Size(m) +} +func (m *Oneof_F_Group) XXX_DiscardUnknown() { + xxx_messageInfo_Oneof_F_Group.DiscardUnknown(m) } -// XXX_OneofWrappers is for the internal use of the proto package. -func (*TestUTF8) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*TestUTF8_Field)(nil), +var xxx_messageInfo_Oneof_F_Group proto.InternalMessageInfo + +func (m *Oneof_F_Group) GetX() int32 { + if m != nil && m.X != nil { + return *m.X } + return 0 } var E_Greeting = &proto.ExtensionDesc{ @@ -4478,7 +4441,35 @@ var E_X250 = &proto.ExtensionDesc{ Filename: "test_proto/test.proto", } +var E_Ext_More = &proto.ExtensionDesc{ + ExtendedType: (*MyMessage)(nil), + ExtensionType: (*Ext)(nil), + Field: 103, + Name: "test_proto.Ext.more", + Tag: "bytes,103,opt,name=more", + Filename: "test_proto/test.proto", +} + +var E_Ext_Text = &proto.ExtensionDesc{ + ExtendedType: (*MyMessage)(nil), + ExtensionType: (*string)(nil), + Field: 104, + Name: "test_proto.Ext.text", + Tag: "bytes,104,opt,name=text", + Filename: "test_proto/test.proto", +} + +var E_Ext_Number = &proto.ExtensionDesc{ + ExtendedType: (*MyMessage)(nil), + ExtensionType: (*int32)(nil), + Field: 105, + Name: "test_proto.Ext.number", + Tag: "varint,105,opt,name=number", + Filename: "test_proto/test.proto", +} + func init() { + proto.RegisterFile("test_proto/test.proto", xxx_File_test_proto_test_proto_rawdesc_gzipped) proto.RegisterEnum("test_proto.FOO", FOO_name, FOO_value) proto.RegisterEnum("test_proto.GoTest_KIND", GoTest_KIND_name, GoTest_KIND_value) proto.RegisterEnum("test_proto.MyMessage_Color", MyMessage_Color_name, MyMessage_Color_value) @@ -4488,28 +4479,17 @@ func init() { proto.RegisterType((*GoEnum)(nil), "test_proto.GoEnum") proto.RegisterType((*GoTestField)(nil), "test_proto.GoTestField") proto.RegisterType((*GoTest)(nil), "test_proto.GoTest") - proto.RegisterType((*GoTest_RequiredGroup)(nil), "test_proto.GoTest.RequiredGroup") - proto.RegisterType((*GoTest_RepeatedGroup)(nil), "test_proto.GoTest.RepeatedGroup") - proto.RegisterType((*GoTest_OptionalGroup)(nil), "test_proto.GoTest.OptionalGroup") proto.RegisterType((*GoTestRequiredGroupField)(nil), "test_proto.GoTestRequiredGroupField") - proto.RegisterType((*GoTestRequiredGroupField_Group)(nil), "test_proto.GoTestRequiredGroupField.Group") proto.RegisterType((*GoSkipTest)(nil), "test_proto.GoSkipTest") - proto.RegisterType((*GoSkipTest_SkipGroup)(nil), "test_proto.GoSkipTest.SkipGroup") proto.RegisterType((*NonPackedTest)(nil), "test_proto.NonPackedTest") proto.RegisterType((*PackedTest)(nil), "test_proto.PackedTest") proto.RegisterType((*MaxTag)(nil), "test_proto.MaxTag") proto.RegisterType((*OldMessage)(nil), "test_proto.OldMessage") - proto.RegisterType((*OldMessage_Nested)(nil), "test_proto.OldMessage.Nested") proto.RegisterType((*NewMessage)(nil), "test_proto.NewMessage") - proto.RegisterType((*NewMessage_Nested)(nil), "test_proto.NewMessage.Nested") proto.RegisterType((*InnerMessage)(nil), "test_proto.InnerMessage") proto.RegisterType((*OtherMessage)(nil), "test_proto.OtherMessage") proto.RegisterType((*RequiredInnerMessage)(nil), "test_proto.RequiredInnerMessage") proto.RegisterType((*MyMessage)(nil), "test_proto.MyMessage") - proto.RegisterType((*MyMessage_SomeGroup)(nil), "test_proto.MyMessage.SomeGroup") - proto.RegisterExtension(E_Ext_More) - proto.RegisterExtension(E_Ext_Text) - proto.RegisterExtension(E_Ext_Number) proto.RegisterType((*Ext)(nil), "test_proto.Ext") proto.RegisterMapType((map[int32]int32)(nil), "test_proto.Ext.MapFieldEntry") proto.RegisterType((*ComplexExtension)(nil), "test_proto.ComplexExtension") @@ -4517,16 +4497,13 @@ func init() { proto.RegisterType((*MyMessageSet)(nil), "test_proto.MyMessageSet") proto.RegisterType((*Empty)(nil), "test_proto.Empty") proto.RegisterType((*MessageList)(nil), "test_proto.MessageList") - proto.RegisterType((*MessageList_Message)(nil), "test_proto.MessageList.Message") proto.RegisterType((*Strings)(nil), "test_proto.Strings") proto.RegisterType((*Defaults)(nil), "test_proto.Defaults") proto.RegisterType((*SubDefaults)(nil), "test_proto.SubDefaults") proto.RegisterType((*RepeatedEnum)(nil), "test_proto.RepeatedEnum") proto.RegisterType((*MoreRepeated)(nil), "test_proto.MoreRepeated") proto.RegisterType((*GroupOld)(nil), "test_proto.GroupOld") - proto.RegisterType((*GroupOld_G)(nil), "test_proto.GroupOld.G") proto.RegisterType((*GroupNew)(nil), "test_proto.GroupNew") - proto.RegisterType((*GroupNew_G)(nil), "test_proto.GroupNew.G") proto.RegisterType((*FloatingPoint)(nil), "test_proto.FloatingPoint") proto.RegisterType((*MessageWithMap)(nil), "test_proto.MessageWithMap") proto.RegisterMapType((map[bool][]byte)(nil), "test_proto.MessageWithMap.ByteMappingEntry") @@ -4534,11 +4511,22 @@ func init() { proto.RegisterMapType((map[int32]string)(nil), "test_proto.MessageWithMap.NameMappingEntry") proto.RegisterMapType((map[string]string)(nil), "test_proto.MessageWithMap.StrToStrEntry") proto.RegisterType((*Oneof)(nil), "test_proto.Oneof") - proto.RegisterType((*Oneof_F_Group)(nil), "test_proto.Oneof.F_Group") proto.RegisterType((*Communique)(nil), "test_proto.Communique") proto.RegisterType((*TestUTF8)(nil), "test_proto.TestUTF8") proto.RegisterMapType((map[string]int64)(nil), "test_proto.TestUTF8.MapKeyEntry") proto.RegisterMapType((map[int64]string)(nil), "test_proto.TestUTF8.MapValueEntry") + proto.RegisterType((*GoTest_RequiredGroup)(nil), "test_proto.GoTest.RequiredGroup") + proto.RegisterType((*GoTest_RepeatedGroup)(nil), "test_proto.GoTest.RepeatedGroup") + proto.RegisterType((*GoTest_OptionalGroup)(nil), "test_proto.GoTest.OptionalGroup") + proto.RegisterType((*GoTestRequiredGroupField_Group)(nil), "test_proto.GoTestRequiredGroupField.Group") + proto.RegisterType((*GoSkipTest_SkipGroup)(nil), "test_proto.GoSkipTest.SkipGroup") + proto.RegisterType((*OldMessage_Nested)(nil), "test_proto.OldMessage.Nested") + proto.RegisterType((*NewMessage_Nested)(nil), "test_proto.NewMessage.Nested") + proto.RegisterType((*MyMessage_SomeGroup)(nil), "test_proto.MyMessage.SomeGroup") + proto.RegisterType((*MessageList_Message)(nil), "test_proto.MessageList.Message") + proto.RegisterType((*GroupOld_G)(nil), "test_proto.GroupOld.G") + proto.RegisterType((*GroupNew_G)(nil), "test_proto.GroupNew.G") + proto.RegisterType((*Oneof_F_Group)(nil), "test_proto.Oneof.F_Group") proto.RegisterExtension(E_Greeting) proto.RegisterExtension(E_Complex) proto.RegisterExtension(E_RComplex) @@ -4624,310 +4612,1020 @@ func init() { proto.RegisterExtension(E_X248) proto.RegisterExtension(E_X249) proto.RegisterExtension(E_X250) + proto.RegisterExtension(E_Ext_More) + proto.RegisterExtension(E_Ext_Text) + proto.RegisterExtension(E_Ext_Number) } -func init() { proto.RegisterFile("test_proto/test.proto", fileDescriptor_8ca34d01332f1402) } - -var fileDescriptor_8ca34d01332f1402 = []byte{ - // 4795 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5b, 0xd9, 0x73, 0x1b, 0x47, - 0x7a, 0xd7, 0x0c, 0xee, 0x0f, 0x20, 0x31, 0x6c, 0xc9, 0x12, 0x44, 0x59, 0xd2, 0x08, 0x6b, 0xaf, - 0x61, 0xc9, 0xa2, 0x48, 0x60, 0x08, 0x49, 0x70, 0xec, 0x58, 0x07, 0x41, 0xb3, 0x24, 0x12, 0xf2, - 0x90, 0xb6, 0xb3, 0xca, 0x03, 0x0a, 0x24, 0x06, 0x20, 0x56, 0xc0, 0x0c, 0x0c, 0x0c, 0x56, 0x64, - 0x52, 0xa9, 0xf2, 0x63, 0xaa, 0xf2, 0x94, 0x4d, 0x52, 0x95, 0xf7, 0xbc, 0xe4, 0x25, 0xd7, 0x43, - 0xf2, 0x37, 0xc4, 0xd7, 0x7a, 0x77, 0xbd, 0x57, 0x92, 0x4d, 0x36, 0xf7, 0x9d, 0xcd, 0xbd, 0x47, - 0x5e, 0x9c, 0xea, 0xaf, 0x7b, 0x66, 0x7a, 0x06, 0x50, 0x93, 0x7c, 0xe2, 0x74, 0xf7, 0xef, 0xfb, - 0xf5, 0xf5, 0x9b, 0xef, 0xfb, 0xba, 0x31, 0x84, 0xe7, 0x5c, 0x6b, 0xec, 0x36, 0x87, 0x23, 0xc7, - 0x75, 0x6e, 0xd0, 0xc7, 0x25, 0x7c, 0x24, 0x10, 0x54, 0x17, 0xaf, 0x41, 0x72, 0xdd, 0x59, 0xb3, - 0x27, 0x03, 0x72, 0x05, 0x62, 0x1d, 0xc7, 0x29, 0x28, 0xba, 0x5a, 0x9a, 0x2f, 0xe7, 0x97, 0x02, - 0xcc, 0x52, 0xbd, 0xd1, 0x30, 0x69, 0x5b, 0xf1, 0x26, 0x64, 0xd7, 0x9d, 0x1d, 0x6b, 0xec, 0xd6, - 0x7b, 0x56, 0xbf, 0x4d, 0xce, 0x40, 0xe2, 0x61, 0x6b, 0xd7, 0xea, 0xa3, 0x4d, 0xc6, 0x64, 0x05, - 0x42, 0x20, 0xbe, 0x73, 0x38, 0xb4, 0x0a, 0x2a, 0x56, 0xe2, 0x73, 0xf1, 0x0f, 0x8b, 0xb4, 0x1b, - 0x6a, 0x49, 0xae, 0x41, 0xfc, 0x41, 0xcf, 0x6e, 0xf3, 0x7e, 0xce, 0x89, 0xfd, 0x30, 0xc4, 0xd2, - 0x83, 0x8d, 0xad, 0xfb, 0x26, 0x82, 0x68, 0x0f, 0x3b, 0xad, 0xdd, 0x3e, 0x25, 0x53, 0x68, 0x0f, - 0x58, 0xa0, 0xb5, 0x8f, 0x5a, 0xa3, 0xd6, 0xa0, 0x10, 0xd3, 0x95, 0x52, 0xc2, 0x64, 0x05, 0xf2, - 0x1a, 0xcc, 0x99, 0xd6, 0x7b, 0x93, 0xde, 0xc8, 0x6a, 0xe3, 0xf0, 0x0a, 0x71, 0x5d, 0x2d, 0x65, - 0x67, 0xf5, 0x80, 0xcd, 0x66, 0x18, 0xcd, 0xcc, 0x87, 0x56, 0xcb, 0xf5, 0xcc, 0x13, 0x7a, 0xec, - 0x08, 0x73, 0x01, 0x4d, 0xcd, 0x1b, 0x43, 0xb7, 0xe7, 0xd8, 0xad, 0x3e, 0x33, 0x4f, 0xea, 0x8a, - 0xd4, 0x3c, 0x84, 0x26, 0x5f, 0x84, 0x7c, 0xbd, 0x79, 0xd7, 0x71, 0xfa, 0xcd, 0x11, 0x1f, 0x55, - 0x01, 0x74, 0xb5, 0x94, 0x36, 0xe7, 0xea, 0xb4, 0xd6, 0x1b, 0x2a, 0x29, 0x81, 0x56, 0x6f, 0x6e, - 0xd8, 0x6e, 0xa5, 0x1c, 0x00, 0xb3, 0xba, 0x5a, 0x4a, 0x98, 0xf3, 0x75, 0xac, 0x9e, 0x42, 0x56, - 0x8d, 0x00, 0x99, 0xd3, 0xd5, 0x52, 0x8c, 0x21, 0xab, 0x86, 0x8f, 0x7c, 0x05, 0x48, 0xbd, 0x59, - 0xef, 0x1d, 0x58, 0x6d, 0x91, 0x75, 0x4e, 0x57, 0x4b, 0x29, 0x53, 0xab, 0xf3, 0x86, 0x19, 0x68, - 0x91, 0x79, 0x5e, 0x57, 0x4b, 0x49, 0x0f, 0x2d, 0x70, 0x5f, 0x85, 0x85, 0x7a, 0xf3, 0xed, 0x5e, - 0x78, 0xc0, 0x79, 0x5d, 0x2d, 0xcd, 0x99, 0xf9, 0x3a, 0xab, 0x9f, 0xc6, 0x8a, 0xc4, 0x9a, 0xae, - 0x96, 0xe2, 0x1c, 0x2b, 0xf0, 0xe2, 0xec, 0xea, 0x7d, 0xa7, 0xe5, 0x06, 0xd0, 0x05, 0x5d, 0x2d, - 0xa9, 0xe6, 0x7c, 0x1d, 0xab, 0xc3, 0xac, 0xf7, 0x9d, 0xc9, 0x6e, 0xdf, 0x0a, 0xa0, 0x44, 0x57, - 0x4b, 0x8a, 0x99, 0xaf, 0xb3, 0xfa, 0x30, 0x76, 0xdb, 0x1d, 0xf5, 0xec, 0x6e, 0x80, 0x3d, 0x8d, - 0x3a, 0xce, 0xd7, 0x59, 0x7d, 0x78, 0x04, 0x77, 0x0f, 0x5d, 0x6b, 0x1c, 0x40, 0x2d, 0x5d, 0x2d, - 0xe5, 0xcc, 0xf9, 0x3a, 0x56, 0x47, 0x58, 0x23, 0x6b, 0xd0, 0xd1, 0xd5, 0xd2, 0x02, 0x65, 0x9d, - 0xb1, 0x06, 0xdb, 0x91, 0x35, 0xe8, 0xea, 0x6a, 0x89, 0x70, 0xac, 0xb0, 0x06, 0x4b, 0x70, 0xba, - 0xde, 0xdc, 0xee, 0x44, 0x37, 0x6e, 0x5f, 0x57, 0x4b, 0x79, 0x73, 0xa1, 0xee, 0xb5, 0xcc, 0xc2, - 0x8b, 0xec, 0x3d, 0x5d, 0x2d, 0x69, 0x3e, 0x5e, 0xe0, 0x17, 0x35, 0xc9, 0xa4, 0x5e, 0x38, 0xa3, - 0xc7, 0x04, 0x4d, 0xb2, 0xca, 0xb0, 0x26, 0x39, 0xf0, 0x39, 0x3d, 0x26, 0x6a, 0x32, 0x82, 0xc4, - 0xee, 0x39, 0xf2, 0xac, 0x1e, 0x13, 0x35, 0xc9, 0x91, 0x11, 0x4d, 0x72, 0xec, 0x39, 0x3d, 0x16, - 0xd6, 0xe4, 0x14, 0x5a, 0x64, 0x2e, 0xe8, 0xb1, 0xb0, 0x26, 0x39, 0x3a, 0xac, 0x49, 0x0e, 0x3e, - 0xaf, 0xc7, 0x42, 0x9a, 0x8c, 0x62, 0x45, 0xe2, 0x45, 0x3d, 0x16, 0xd2, 0xa4, 0x38, 0x3b, 0x4f, - 0x93, 0x1c, 0x7a, 0x41, 0x8f, 0x89, 0x9a, 0x14, 0x59, 0x7d, 0x4d, 0x72, 0xe8, 0xf3, 0x7a, 0x2c, - 0xa4, 0x49, 0x11, 0xeb, 0x6b, 0x92, 0x63, 0x2f, 0xea, 0xb1, 0x90, 0x26, 0x39, 0xf6, 0x65, 0x51, - 0x93, 0x1c, 0xfa, 0x81, 0xa2, 0xc7, 0x44, 0x51, 0x72, 0xe8, 0xb5, 0x90, 0x28, 0x39, 0xf6, 0x43, - 0x8a, 0x15, 0x55, 0x19, 0x05, 0x8b, 0xab, 0xf0, 0x11, 0x05, 0x8b, 0xb2, 0xe4, 0xe0, 0x1b, 0x11, - 0x59, 0x72, 0xf8, 0xc7, 0x14, 0x1e, 0xd6, 0xe5, 0xb4, 0x81, 0xc8, 0xff, 0x09, 0x35, 0x08, 0x0b, - 0x93, 0x1b, 0x04, 0xc2, 0x74, 0xb8, 0x13, 0x2d, 0x5c, 0xd2, 0x15, 0x5f, 0x98, 0x9e, 0x67, 0x15, - 0x85, 0xe9, 0x03, 0x2f, 0x63, 0xc8, 0xe0, 0xc2, 0x9c, 0x42, 0x56, 0x8d, 0x00, 0xa9, 0xeb, 0x4a, - 0x20, 0x4c, 0x1f, 0x19, 0x12, 0xa6, 0x8f, 0xbd, 0xa2, 0x2b, 0xa2, 0x30, 0x67, 0xa0, 0x45, 0xe6, - 0xa2, 0xae, 0x88, 0xc2, 0xf4, 0xd1, 0xa2, 0x30, 0x7d, 0xf0, 0x17, 0x74, 0x45, 0x10, 0xe6, 0x34, - 0x56, 0x24, 0x7e, 0x41, 0x57, 0x04, 0x61, 0x86, 0x67, 0xc7, 0x84, 0xe9, 0x43, 0x5f, 0xd4, 0x95, - 0x40, 0x98, 0x61, 0x56, 0x2e, 0x4c, 0x1f, 0xfa, 0x45, 0x5d, 0x11, 0x84, 0x19, 0xc6, 0x72, 0x61, - 0xfa, 0xd8, 0x97, 0x30, 0x4e, 0x7b, 0xc2, 0xf4, 0xb1, 0x82, 0x30, 0x7d, 0xe8, 0xef, 0xd0, 0x98, - 0xee, 0x0b, 0xd3, 0x87, 0x8a, 0xc2, 0xf4, 0xb1, 0xbf, 0x4b, 0xb1, 0x81, 0x30, 0xa7, 0xc1, 0xe2, - 0x2a, 0xfc, 0x1e, 0x05, 0x07, 0xc2, 0xf4, 0xc1, 0x61, 0x61, 0xfa, 0xf0, 0xdf, 0xa7, 0x70, 0x51, - 0x98, 0xb3, 0x0c, 0x44, 0xfe, 0x3f, 0xa0, 0x06, 0xa2, 0x30, 0x7d, 0x83, 0x25, 0x9c, 0x26, 0x15, - 0x66, 0xdb, 0xea, 0xb4, 0x26, 0x7d, 0x2a, 0xe3, 0x12, 0x55, 0x66, 0x2d, 0xee, 0x8e, 0x26, 0x16, - 0x9d, 0xab, 0xe3, 0xf4, 0xef, 0x7b, 0x6d, 0x64, 0x89, 0x0e, 0x9f, 0x09, 0x34, 0x30, 0x78, 0x99, - 0x2a, 0xb4, 0xa6, 0x56, 0xca, 0x66, 0x9e, 0xa9, 0x74, 0x1a, 0x5f, 0x35, 0x04, 0xfc, 0x55, 0xaa, - 0xd3, 0x9a, 0x5a, 0x35, 0x18, 0xbe, 0x6a, 0x04, 0xf8, 0x0a, 0x9d, 0x80, 0x27, 0xd6, 0xc0, 0xe2, - 0x1a, 0x55, 0x6b, 0x2d, 0x56, 0x29, 0x2f, 0x9b, 0x0b, 0x9e, 0x64, 0x67, 0x19, 0x85, 0xba, 0x79, - 0x85, 0x8a, 0xb6, 0x16, 0xab, 0x1a, 0xbe, 0x91, 0xd8, 0x53, 0x99, 0x0a, 0x9d, 0x4b, 0x37, 0xb0, - 0xb9, 0x4e, 0xb5, 0x5b, 0x8b, 0x57, 0xca, 0xcb, 0xcb, 0xa6, 0xc6, 0x15, 0x3c, 0xc3, 0x26, 0xd4, - 0xcf, 0x12, 0xd5, 0x70, 0x2d, 0x5e, 0x35, 0x7c, 0x9b, 0x70, 0x3f, 0x0b, 0x9e, 0x94, 0x03, 0x93, - 0x1b, 0x54, 0xcb, 0xb5, 0x64, 0x65, 0xc5, 0x58, 0x59, 0xbd, 0x6d, 0xe6, 0x99, 0xa6, 0x03, 0x1b, - 0x83, 0xf6, 0xc3, 0x45, 0x1d, 0x18, 0x2d, 0x53, 0x55, 0xd7, 0x92, 0xe5, 0x9b, 0x2b, 0xb7, 0xca, - 0xb7, 0x4c, 0x8d, 0xab, 0x3b, 0xb0, 0x7a, 0x9d, 0x5a, 0x71, 0x79, 0x07, 0x56, 0x2b, 0x54, 0xdf, - 0x35, 0x6d, 0xdf, 0xea, 0xf7, 0x9d, 0x57, 0xf4, 0xe2, 0x53, 0x67, 0xd4, 0x6f, 0x5f, 0x29, 0x82, - 0xa9, 0x71, 0xc5, 0x8b, 0xbd, 0x2e, 0x78, 0x92, 0x0f, 0xcc, 0x7f, 0x95, 0x66, 0xac, 0xb9, 0x5a, - 0xea, 0x6e, 0xaf, 0x6b, 0x3b, 0x63, 0xcb, 0xcc, 0x33, 0xf1, 0x47, 0xd6, 0x64, 0x3b, 0xba, 0x8e, - 0x5f, 0xa5, 0x66, 0x0b, 0xb5, 0xd8, 0xf5, 0x4a, 0x99, 0xf6, 0x34, 0x6b, 0x1d, 0xb7, 0xa3, 0xeb, - 0xf8, 0x6b, 0xd4, 0x86, 0xd4, 0x62, 0xd7, 0xab, 0x06, 0xb7, 0x11, 0xd7, 0xb1, 0x0a, 0x67, 0x84, - 0x77, 0x21, 0xb0, 0xfa, 0x75, 0x6a, 0x95, 0x67, 0x3d, 0x11, 0xff, 0x8d, 0x98, 0x69, 0x17, 0xea, - 0xed, 0x37, 0xa8, 0x9d, 0xc6, 0x7a, 0x23, 0xfe, 0x8b, 0x11, 0xd8, 0xdd, 0x84, 0xb3, 0x91, 0x5c, - 0xa2, 0x39, 0x6c, 0xed, 0x3d, 0xb1, 0xda, 0x85, 0x32, 0x4d, 0x29, 0xee, 0xaa, 0x9a, 0x62, 0x9e, - 0x0e, 0xa5, 0x15, 0x8f, 0xb0, 0x99, 0xdc, 0x86, 0x73, 0xd1, 0xe4, 0xc2, 0xb3, 0xac, 0xd0, 0x1c, - 0x03, 0x2d, 0xcf, 0x84, 0xf3, 0x8c, 0x88, 0xa9, 0x10, 0x54, 0x3c, 0x53, 0x83, 0x26, 0x1d, 0x81, - 0x69, 0x10, 0x5b, 0xb8, 0xe9, 0x6b, 0x70, 0x7e, 0x3a, 0xfd, 0xf0, 0x8c, 0x57, 0x69, 0x16, 0x82, - 0xc6, 0x67, 0xa3, 0x99, 0xc8, 0x94, 0xf9, 0x8c, 0xbe, 0xab, 0x34, 0x2d, 0x11, 0xcd, 0xa7, 0x7a, - 0x7f, 0x15, 0x0a, 0x53, 0x09, 0x8a, 0x67, 0x7d, 0x93, 0xe6, 0x29, 0x68, 0xfd, 0x5c, 0x24, 0x57, - 0x89, 0x1a, 0xcf, 0xe8, 0xfa, 0x16, 0x4d, 0x5c, 0x04, 0xe3, 0xa9, 0x9e, 0x71, 0xc9, 0xc2, 0x29, - 0x8c, 0x67, 0x7b, 0x9b, 0x66, 0x32, 0x7c, 0xc9, 0x42, 0xd9, 0x8c, 0xd8, 0x6f, 0x24, 0xa7, 0xf1, - 0x6c, 0x6b, 0x34, 0xb5, 0xe1, 0xfd, 0x86, 0xd3, 0x1b, 0x6e, 0xfc, 0x33, 0xd4, 0x78, 0x7b, 0xf6, - 0x8c, 0x7f, 0x14, 0xa3, 0x49, 0x09, 0xb7, 0xde, 0x9e, 0x35, 0x65, 0xdf, 0x7a, 0xc6, 0x94, 0x7f, - 0x4c, 0xad, 0x89, 0x60, 0x3d, 0x35, 0xe7, 0x37, 0x60, 0x71, 0x46, 0xbe, 0xe2, 0xd9, 0xff, 0x84, - 0xda, 0xe7, 0xd1, 0xfe, 0xdc, 0x54, 0xea, 0x32, 0xcd, 0x30, 0x63, 0x04, 0x3f, 0xa5, 0x0c, 0x5a, - 0x88, 0x61, 0x6a, 0x0c, 0x75, 0x98, 0xf3, 0xf2, 0xf1, 0xee, 0xc8, 0x99, 0x0c, 0x0b, 0x75, 0x5d, - 0x2d, 0x41, 0x59, 0x9f, 0x71, 0x3a, 0xf6, 0xd2, 0xf3, 0x75, 0x8a, 0x33, 0xc3, 0x66, 0x8c, 0x87, - 0x31, 0x33, 0x9e, 0x47, 0x7a, 0xec, 0x99, 0x3c, 0x0c, 0xe7, 0xf3, 0x08, 0x66, 0x94, 0xc7, 0x0b, - 0x77, 0x8c, 0xe7, 0xb1, 0xae, 0x3c, 0x83, 0xc7, 0x0b, 0x7e, 0x9c, 0x27, 0x64, 0xb6, 0xb8, 0x1a, - 0x9c, 0xc9, 0xb1, 0x9d, 0xbc, 0x10, 0x3d, 0xa4, 0xaf, 0xe3, 0xe9, 0x2a, 0x5c, 0xc9, 0xcc, 0x84, - 0xe1, 0x4d, 0x9b, 0xbd, 0xf5, 0x0c, 0xb3, 0xd0, 0x68, 0xa6, 0xcd, 0x7e, 0x7e, 0x86, 0x59, 0xf1, - 0x37, 0x15, 0x88, 0x3f, 0xd8, 0xd8, 0xba, 0x4f, 0xd2, 0x10, 0x7f, 0xa7, 0xb1, 0x71, 0x5f, 0x3b, - 0x45, 0x9f, 0xee, 0x36, 0x1a, 0x0f, 0x35, 0x85, 0x64, 0x20, 0x71, 0xf7, 0x4b, 0x3b, 0x6b, 0xdb, - 0x9a, 0x4a, 0xf2, 0x90, 0xad, 0x6f, 0x6c, 0xad, 0xaf, 0x99, 0x8f, 0xcc, 0x8d, 0xad, 0x1d, 0x2d, - 0x46, 0xdb, 0xea, 0x0f, 0x1b, 0x77, 0x76, 0xb4, 0x38, 0x49, 0x41, 0x8c, 0xd6, 0x25, 0x08, 0x40, - 0x72, 0x7b, 0xc7, 0xdc, 0xd8, 0x5a, 0xd7, 0x92, 0x94, 0x65, 0x67, 0x63, 0x73, 0x4d, 0x4b, 0x51, - 0xe4, 0xce, 0xdb, 0x8f, 0x1e, 0xae, 0x69, 0x69, 0xfa, 0x78, 0xc7, 0x34, 0xef, 0x7c, 0x49, 0xcb, - 0x50, 0xa3, 0xcd, 0x3b, 0x8f, 0x34, 0xc0, 0xe6, 0x3b, 0x77, 0x1f, 0xae, 0x69, 0x59, 0x92, 0x83, - 0x74, 0xfd, 0xed, 0xad, 0x7b, 0x3b, 0x1b, 0x8d, 0x2d, 0x2d, 0x57, 0xfc, 0x45, 0x28, 0xb0, 0x65, - 0x0e, 0xad, 0x22, 0xbb, 0x32, 0x78, 0x03, 0x12, 0x6c, 0x6f, 0x14, 0xd4, 0xca, 0xd5, 0xe9, 0xbd, - 0x99, 0x36, 0x5a, 0x62, 0xbb, 0xc4, 0x0c, 0x17, 0x2f, 0x42, 0x82, 0xad, 0xd3, 0x19, 0x48, 0xb0, - 0xf5, 0x51, 0xf1, 0x2a, 0x81, 0x15, 0x8a, 0xbf, 0xa5, 0x02, 0xac, 0x3b, 0xdb, 0x4f, 0x7a, 0x43, - 0xbc, 0xb8, 0xb9, 0x08, 0x30, 0x7e, 0xd2, 0x1b, 0x36, 0xf1, 0x0d, 0xe4, 0x97, 0x0e, 0x19, 0x5a, - 0x83, 0xbe, 0x97, 0x5c, 0x81, 0x1c, 0x36, 0xf3, 0x57, 0x04, 0xef, 0x1a, 0x52, 0x66, 0x96, 0xd6, - 0x71, 0x27, 0x19, 0x86, 0x54, 0x0d, 0xbc, 0x62, 0x48, 0x0a, 0x90, 0xaa, 0x41, 0x2e, 0x03, 0x16, - 0x9b, 0x63, 0x8c, 0xa6, 0x78, 0xad, 0x90, 0x31, 0xb1, 0x5f, 0x16, 0x5f, 0xc9, 0xeb, 0x80, 0x7d, - 0xb2, 0x99, 0xe7, 0x67, 0xbd, 0x25, 0xde, 0x80, 0x97, 0xe8, 0x03, 0x9b, 0x6f, 0x60, 0xb2, 0xd8, - 0x80, 0x8c, 0x5f, 0x4f, 0x7b, 0xc3, 0x5a, 0x3e, 0x27, 0x0d, 0xe7, 0x04, 0x58, 0xe5, 0x4f, 0x8a, - 0x01, 0xf8, 0x78, 0x16, 0x70, 0x3c, 0xcc, 0x88, 0x0d, 0xa8, 0x78, 0x11, 0xe6, 0xb6, 0x1c, 0x9b, - 0xbd, 0xc7, 0xb8, 0x4e, 0x39, 0x50, 0x5a, 0x05, 0x05, 0xcf, 0xbf, 0x4a, 0xab, 0x78, 0x09, 0x40, - 0x68, 0xd3, 0x40, 0xd9, 0x65, 0x6d, 0xe8, 0x0f, 0x94, 0xdd, 0xe2, 0x35, 0x48, 0x6e, 0xb6, 0x0e, - 0x76, 0x5a, 0x5d, 0x72, 0x05, 0xa0, 0xdf, 0x1a, 0xbb, 0xcd, 0x0e, 0xee, 0xc4, 0xe7, 0x9f, 0x7f, - 0xfe, 0xb9, 0x82, 0xc9, 0x74, 0x86, 0xd6, 0xb2, 0x1d, 0x19, 0x03, 0x34, 0xfa, 0xed, 0x4d, 0x6b, - 0x3c, 0x6e, 0x75, 0x2d, 0xb2, 0x0a, 0x49, 0xdb, 0x1a, 0xd3, 0xe8, 0xab, 0xe0, 0x5d, 0xd3, 0x45, - 0x71, 0x1d, 0x02, 0xdc, 0xd2, 0x16, 0x82, 0x4c, 0x0e, 0x26, 0x1a, 0xc4, 0xec, 0xc9, 0x00, 0x6f, - 0xd4, 0x12, 0x26, 0x7d, 0x5c, 0x7c, 0x1e, 0x92, 0x0c, 0x43, 0x08, 0xc4, 0xed, 0xd6, 0xc0, 0x2a, - 0xb0, 0x9e, 0xf1, 0xb9, 0xf8, 0x55, 0x05, 0x60, 0xcb, 0x7a, 0x7a, 0xac, 0x5e, 0x03, 0x9c, 0xa4, - 0xd7, 0x18, 0xeb, 0xf5, 0x55, 0x59, 0xaf, 0x54, 0x6d, 0x1d, 0xc7, 0x69, 0x37, 0xd9, 0x46, 0xb3, - 0xeb, 0xbf, 0x0c, 0xad, 0xc1, 0x9d, 0x2b, 0x3e, 0x86, 0xdc, 0x86, 0x6d, 0x5b, 0x23, 0x6f, 0x54, - 0x04, 0xe2, 0xfb, 0xce, 0xd8, 0xe5, 0x37, 0x91, 0xf8, 0x4c, 0x0a, 0x10, 0x1f, 0x3a, 0x23, 0x97, - 0xcd, 0xb4, 0x16, 0x37, 0x96, 0x97, 0x97, 0x4d, 0xac, 0x21, 0xcf, 0x43, 0x66, 0xcf, 0xb1, 0x6d, - 0x6b, 0x8f, 0x4e, 0x23, 0x86, 0x47, 0xc7, 0xa0, 0xa2, 0xf8, 0xcb, 0x0a, 0xe4, 0x1a, 0xee, 0x7e, - 0x40, 0xae, 0x41, 0xec, 0x89, 0x75, 0x88, 0xc3, 0x8b, 0x99, 0xf4, 0x91, 0xbe, 0x30, 0x5f, 0x69, - 0xf5, 0x27, 0xec, 0x5e, 0x32, 0x67, 0xb2, 0x02, 0x39, 0x0b, 0xc9, 0xa7, 0x56, 0xaf, 0xbb, 0xef, - 0x22, 0xa7, 0x6a, 0xf2, 0x12, 0x59, 0x82, 0x44, 0x8f, 0x0e, 0xb6, 0x10, 0xc7, 0x15, 0x2b, 0x88, - 0x2b, 0x26, 0xce, 0xc2, 0x64, 0xb0, 0xab, 0xe9, 0x74, 0x5b, 0x7b, 0xff, 0xfd, 0xf7, 0xdf, 0x57, - 0x8b, 0xfb, 0x70, 0xc6, 0x7b, 0x89, 0x43, 0xd3, 0x7d, 0x04, 0x85, 0xbe, 0xe5, 0x34, 0x3b, 0x3d, - 0xbb, 0xd5, 0xef, 0x1f, 0x36, 0x9f, 0x3a, 0x76, 0xb3, 0x65, 0x37, 0x9d, 0xf1, 0x5e, 0x6b, 0x84, - 0x4b, 0x20, 0xeb, 0xe4, 0x4c, 0xdf, 0x72, 0xea, 0xcc, 0xf0, 0x5d, 0xc7, 0xbe, 0x63, 0x37, 0xa8, - 0x55, 0xf1, 0xb3, 0x38, 0x64, 0x36, 0x0f, 0x3d, 0xfe, 0x33, 0x90, 0xd8, 0x73, 0x26, 0x36, 0x5b, - 0xcf, 0x84, 0xc9, 0x0a, 0xfe, 0x3e, 0xa9, 0xc2, 0x3e, 0x9d, 0x81, 0xc4, 0x7b, 0x13, 0xc7, 0xb5, - 0x70, 0xca, 0x19, 0x93, 0x15, 0xe8, 0x8a, 0x0d, 0x2d, 0xb7, 0x10, 0xc7, 0x6b, 0x0a, 0xfa, 0x18, - 0xac, 0x41, 0xe2, 0x58, 0x6b, 0x40, 0x96, 0x21, 0xe9, 0xd0, 0x3d, 0x18, 0x17, 0x92, 0x78, 0x0f, - 0x1b, 0x32, 0x10, 0x77, 0xc7, 0xe4, 0x38, 0xf2, 0x00, 0x16, 0x9e, 0x5a, 0xcd, 0xc1, 0x64, 0xec, - 0x36, 0xbb, 0x4e, 0xb3, 0x6d, 0x59, 0x43, 0x6b, 0x54, 0x98, 0xc3, 0xde, 0x42, 0x1e, 0x62, 0xd6, - 0x82, 0x9a, 0xf3, 0x4f, 0xad, 0xcd, 0xc9, 0xd8, 0x5d, 0x77, 0xee, 0xa3, 0x1d, 0x59, 0x85, 0xcc, - 0xc8, 0xa2, 0x7e, 0x81, 0x0e, 0x39, 0x37, 0x3d, 0x82, 0x90, 0x71, 0x7a, 0x64, 0x0d, 0xb1, 0x82, - 0xdc, 0x84, 0xf4, 0x6e, 0xef, 0x89, 0x35, 0xde, 0xb7, 0xda, 0x85, 0x94, 0xae, 0x94, 0xe6, 0xcb, - 0x17, 0x44, 0x2b, 0x7f, 0x81, 0x97, 0xee, 0x39, 0x7d, 0x67, 0x64, 0xfa, 0x60, 0xf2, 0x1a, 0x64, - 0xc6, 0xce, 0xc0, 0x62, 0x6a, 0x4f, 0x63, 0xb0, 0xbd, 0x3c, 0xdb, 0x72, 0xdb, 0x19, 0x58, 0x9e, - 0x57, 0xf3, 0x2c, 0xc8, 0x05, 0x36, 0xdc, 0x5d, 0x7a, 0x98, 0x28, 0x00, 0x5e, 0xf8, 0xd0, 0x41, - 0xe1, 0xe1, 0x82, 0x2c, 0xd2, 0x41, 0x75, 0x3b, 0x34, 0x67, 0x2b, 0x64, 0xf1, 0x2c, 0xef, 0x97, - 0x17, 0x5f, 0x81, 0x8c, 0x4f, 0x18, 0xb8, 0x43, 0xe6, 0x82, 0x32, 0xe8, 0x21, 0x98, 0x3b, 0x64, - 0xfe, 0xe7, 0x45, 0x48, 0xe0, 0xc0, 0x69, 0xe4, 0x32, 0xd7, 0x68, 0xa0, 0xcc, 0x40, 0x62, 0xdd, - 0x5c, 0x5b, 0xdb, 0xd2, 0x14, 0x8c, 0x99, 0x0f, 0xdf, 0x5e, 0xd3, 0x54, 0x41, 0xbf, 0xbf, 0xad, - 0x42, 0x6c, 0xed, 0x00, 0x95, 0xd3, 0x6e, 0xb9, 0x2d, 0xef, 0x0d, 0xa7, 0xcf, 0xa4, 0x06, 0x99, - 0x41, 0xcb, 0xeb, 0x4b, 0xc5, 0x25, 0x0e, 0xf9, 0x92, 0xb5, 0x03, 0x77, 0x69, 0xb3, 0xc5, 0x7a, - 0x5e, 0xb3, 0xdd, 0xd1, 0xa1, 0x99, 0x1e, 0xf0, 0xe2, 0xe2, 0xab, 0x30, 0x17, 0x6a, 0x12, 0x5f, - 0xd1, 0xc4, 0x8c, 0x57, 0x34, 0xc1, 0x5f, 0xd1, 0x9a, 0x7a, 0x4b, 0x29, 0xd7, 0x20, 0x3e, 0x70, - 0x46, 0x16, 0x79, 0x6e, 0xe6, 0x02, 0x17, 0xba, 0x28, 0x99, 0x7c, 0x64, 0x28, 0x26, 0xda, 0x94, - 0x5f, 0x86, 0xb8, 0x6b, 0x1d, 0xb8, 0xcf, 0xb2, 0xdd, 0x67, 0xf3, 0xa3, 0x90, 0xf2, 0x75, 0x48, - 0xda, 0x93, 0xc1, 0xae, 0x35, 0x7a, 0x16, 0xb8, 0x87, 0x03, 0xe3, 0xa0, 0xe2, 0x3b, 0xa0, 0xdd, - 0x73, 0x06, 0xc3, 0xbe, 0x75, 0xb0, 0x76, 0xe0, 0x5a, 0xf6, 0xb8, 0xe7, 0xd8, 0x74, 0x0e, 0x9d, - 0xde, 0x08, 0xdd, 0x1a, 0xce, 0x01, 0x0b, 0xd4, 0xcd, 0x8c, 0xad, 0x3d, 0xc7, 0x6e, 0xf3, 0xa9, - 0xf1, 0x12, 0x45, 0xbb, 0xfb, 0xbd, 0x11, 0xf5, 0x68, 0x34, 0xf8, 0xb0, 0x42, 0x71, 0x1d, 0xf2, - 0xfc, 0x18, 0x36, 0xe6, 0x1d, 0x17, 0xaf, 0x42, 0xce, 0xab, 0xc2, 0x5f, 0x7e, 0xd2, 0x10, 0x7f, - 0xbc, 0x66, 0x36, 0xb4, 0x53, 0x74, 0x5f, 0x1b, 0x5b, 0x6b, 0x9a, 0x42, 0x1f, 0x76, 0xde, 0x6d, - 0x84, 0xf6, 0xf2, 0x79, 0xc8, 0xf9, 0x63, 0xdf, 0xb6, 0x5c, 0x6c, 0xa1, 0x51, 0x2a, 0x55, 0x53, - 0xd3, 0x4a, 0x31, 0x05, 0x89, 0xb5, 0xc1, 0xd0, 0x3d, 0x2c, 0xfe, 0x12, 0x64, 0x39, 0xe8, 0x61, - 0x6f, 0xec, 0x92, 0xdb, 0x90, 0x1a, 0xf0, 0xf9, 0x2a, 0x98, 0x8b, 0x86, 0x65, 0x1d, 0x20, 0xbd, - 0x67, 0xd3, 0xc3, 0x2f, 0x56, 0x20, 0x25, 0xb8, 0x77, 0xee, 0x79, 0x54, 0xd1, 0xf3, 0x30, 0x1f, - 0x15, 0x13, 0x7c, 0x54, 0x71, 0x13, 0x52, 0x2c, 0x30, 0x8f, 0x31, 0xdd, 0x60, 0xe7, 0x77, 0xa6, - 0x31, 0x26, 0xbe, 0x2c, 0xab, 0x63, 0x39, 0xd4, 0x65, 0xc8, 0xe2, 0x3b, 0xe3, 0xab, 0x90, 0x7a, - 0x73, 0xc0, 0x2a, 0xa6, 0xf8, 0x3f, 0x4a, 0x40, 0xda, 0x5b, 0x2b, 0x72, 0x01, 0x92, 0xec, 0x10, - 0x8b, 0x54, 0xde, 0xa5, 0x4e, 0x02, 0x8f, 0xad, 0xe4, 0x02, 0xa4, 0xf8, 0x41, 0x95, 0x07, 0x1c, - 0xb5, 0x52, 0x36, 0x93, 0xec, 0x60, 0xea, 0x37, 0x56, 0x0d, 0xf4, 0x93, 0xec, 0xba, 0x26, 0xc9, - 0x8e, 0x9e, 0x44, 0x87, 0x8c, 0x7f, 0xd8, 0xc4, 0x10, 0xc1, 0xef, 0x66, 0xd2, 0xde, 0xe9, 0x52, - 0x40, 0x54, 0x0d, 0x74, 0xa0, 0xfc, 0x22, 0x26, 0x5d, 0x0f, 0xf2, 0xa6, 0xb4, 0x77, 0x64, 0xc4, - 0x5f, 0x9e, 0xbc, 0x5b, 0x97, 0x14, 0x3f, 0x24, 0x06, 0x80, 0xaa, 0x81, 0x9e, 0xc9, 0xbb, 0x62, - 0x49, 0xf1, 0x83, 0x20, 0xb9, 0x4c, 0x87, 0x88, 0x07, 0x3b, 0xf4, 0x3f, 0xc1, 0x7d, 0x4a, 0x92, - 0x1d, 0xf7, 0xc8, 0x15, 0xca, 0xc0, 0x4e, 0x6f, 0xe8, 0x1a, 0x82, 0xcb, 0x93, 0x14, 0x3f, 0xd4, - 0x91, 0x6b, 0x14, 0xc2, 0x96, 0xbf, 0x00, 0xcf, 0xb8, 0x29, 0x49, 0xf1, 0x9b, 0x12, 0xa2, 0xd3, - 0x0e, 0xd1, 0x43, 0xa1, 0x57, 0x12, 0x6e, 0x45, 0x92, 0xec, 0x56, 0x84, 0x5c, 0x42, 0x3a, 0x36, - 0xa9, 0x5c, 0x70, 0x03, 0x92, 0xe2, 0xa7, 0xc0, 0xa0, 0x1d, 0x73, 0x49, 0xff, 0xb6, 0x23, 0xc5, - 0xcf, 0x79, 0xe4, 0x16, 0xdd, 0x2f, 0xaa, 0xf0, 0xc2, 0x3c, 0xfa, 0xe2, 0x45, 0x51, 0x7a, 0xde, - 0xae, 0x32, 0x57, 0x5c, 0x63, 0x6e, 0xcc, 0x4c, 0xd4, 0xf1, 0x8d, 0x58, 0xa4, 0x96, 0x8f, 0x7a, - 0x76, 0xa7, 0x90, 0xc7, 0xb5, 0x88, 0xf5, 0xec, 0x8e, 0x99, 0xa8, 0xd3, 0x1a, 0xa6, 0x82, 0x2d, - 0xda, 0xa6, 0x61, 0x5b, 0xfc, 0x3a, 0x6b, 0xa4, 0x55, 0xa4, 0x00, 0x89, 0x7a, 0x73, 0xab, 0x65, - 0x17, 0x16, 0x98, 0x9d, 0xdd, 0xb2, 0xcd, 0x78, 0x7d, 0xab, 0x65, 0x93, 0x97, 0x21, 0x36, 0x9e, - 0xec, 0x16, 0xc8, 0xf4, 0xcf, 0x82, 0xdb, 0x93, 0x5d, 0x6f, 0x30, 0x26, 0xc5, 0x90, 0x0b, 0x90, - 0x1e, 0xbb, 0xa3, 0xe6, 0x2f, 0x58, 0x23, 0xa7, 0x70, 0x1a, 0x97, 0xf1, 0x94, 0x99, 0x1a, 0xbb, - 0xa3, 0xc7, 0xd6, 0xc8, 0x39, 0xa6, 0x0f, 0x2e, 0x5e, 0x82, 0xac, 0xc0, 0x4b, 0xf2, 0xa0, 0xd8, - 0x2c, 0x81, 0xa9, 0x29, 0x37, 0x4d, 0xc5, 0x2e, 0xbe, 0x03, 0x39, 0xef, 0x88, 0x85, 0x33, 0x36, - 0xe8, 0xdb, 0xd4, 0x77, 0x46, 0xf8, 0x96, 0xce, 0x97, 0x2f, 0x85, 0x23, 0x66, 0x00, 0xe4, 0x91, - 0x8b, 0x81, 0x8b, 0x5a, 0x64, 0x30, 0x4a, 0xf1, 0x07, 0x0a, 0xe4, 0x36, 0x9d, 0x51, 0xf0, 0xfb, - 0xc5, 0x19, 0x48, 0xec, 0x3a, 0x4e, 0x7f, 0x8c, 0xc4, 0x69, 0x93, 0x15, 0xc8, 0x8b, 0x90, 0xc3, - 0x07, 0xef, 0x90, 0xac, 0xfa, 0xb7, 0x40, 0x59, 0xac, 0xe7, 0xe7, 0x62, 0x02, 0xf1, 0x9e, 0xed, - 0x8e, 0xb9, 0x47, 0xc3, 0x67, 0xf2, 0x05, 0xc8, 0xd2, 0xbf, 0x9e, 0x65, 0xdc, 0xcf, 0xa6, 0x81, - 0x56, 0x73, 0xc3, 0x97, 0x60, 0x0e, 0x35, 0xe0, 0xc3, 0x52, 0xfe, 0x8d, 0x4f, 0x8e, 0x35, 0x70, - 0x60, 0x01, 0x52, 0xcc, 0x21, 0x8c, 0xf1, 0x07, 0xdf, 0x8c, 0xe9, 0x15, 0xa9, 0x9b, 0xc5, 0x83, - 0x0a, 0xcb, 0x40, 0x52, 0x26, 0x2f, 0x15, 0xef, 0x41, 0x1a, 0xc3, 0x65, 0xa3, 0xdf, 0x26, 0x2f, - 0x80, 0xd2, 0x2d, 0x58, 0x18, 0xae, 0xcf, 0x86, 0x4e, 0x21, 0x1c, 0xb0, 0xb4, 0x6e, 0x2a, 0xdd, - 0xc5, 0x05, 0x50, 0xd6, 0xe9, 0xb1, 0xe0, 0x80, 0x3b, 0x6c, 0xe5, 0xa0, 0xf8, 0x16, 0x27, 0xd9, - 0xb2, 0x9e, 0xca, 0x49, 0xb6, 0xac, 0xa7, 0x8c, 0xe4, 0xf2, 0x14, 0x09, 0x2d, 0x1d, 0xf2, 0xdf, - 0xc0, 0x95, 0xc3, 0x62, 0x05, 0xe6, 0xf0, 0x45, 0xed, 0xd9, 0xdd, 0x47, 0x4e, 0xcf, 0xc6, 0x83, - 0x48, 0x07, 0x13, 0x38, 0xc5, 0x54, 0x3a, 0x74, 0x1f, 0xac, 0x83, 0xd6, 0x1e, 0x4b, 0x87, 0xd3, - 0x26, 0x2b, 0x14, 0xbf, 0x1f, 0x87, 0x79, 0xee, 0x64, 0xdf, 0xed, 0xb9, 0xfb, 0x9b, 0xad, 0x21, - 0xd9, 0x82, 0x1c, 0xf5, 0xaf, 0xcd, 0x41, 0x6b, 0x38, 0xa4, 0x2f, 0xb2, 0x82, 0xa1, 0xf9, 0xda, - 0x0c, 0xb7, 0xcd, 0x2d, 0x96, 0xb6, 0x5a, 0x03, 0x6b, 0x93, 0xa1, 0x59, 0xa0, 0xce, 0xda, 0x41, - 0x0d, 0x79, 0x00, 0xd9, 0xc1, 0xb8, 0xeb, 0xd3, 0xb1, 0x48, 0x7f, 0x55, 0x42, 0xb7, 0x39, 0xee, - 0x86, 0xd8, 0x60, 0xe0, 0x57, 0xd0, 0xc1, 0x51, 0xef, 0xec, 0xb3, 0xc5, 0x8e, 0x1c, 0x1c, 0x75, - 0x25, 0xe1, 0xc1, 0xed, 0x06, 0x35, 0xa4, 0x0e, 0x40, 0x5f, 0x35, 0xd7, 0xa1, 0x27, 0x3c, 0xd4, - 0x52, 0xb6, 0x5c, 0x92, 0xb0, 0x6d, 0xbb, 0xa3, 0x1d, 0x67, 0xdb, 0x1d, 0xf1, 0x84, 0x64, 0xcc, - 0x8b, 0x8b, 0xaf, 0x83, 0x16, 0x5d, 0x85, 0xa3, 0x72, 0x92, 0x8c, 0x90, 0x93, 0x2c, 0xfe, 0x1c, - 0xe4, 0x23, 0xd3, 0x16, 0xcd, 0x09, 0x33, 0xbf, 0x21, 0x9a, 0x67, 0xcb, 0xe7, 0x43, 0xdf, 0x68, - 0x88, 0x5b, 0x2f, 0x32, 0xbf, 0x0e, 0x5a, 0x74, 0x09, 0x44, 0xea, 0xb4, 0xe4, 0x40, 0x83, 0xf6, - 0xaf, 0xc2, 0x5c, 0x68, 0xd2, 0xa2, 0x71, 0xe6, 0x88, 0x69, 0x15, 0x7f, 0x25, 0x01, 0x89, 0x86, - 0x6d, 0x39, 0x1d, 0x72, 0x2e, 0x1c, 0x3b, 0xdf, 0x3c, 0xe5, 0xc5, 0xcd, 0xf3, 0x91, 0xb8, 0xf9, - 0xe6, 0x29, 0x3f, 0x6a, 0x9e, 0x8f, 0x44, 0x4d, 0xaf, 0xa9, 0x6a, 0x90, 0x8b, 0x53, 0x31, 0xf3, - 0xcd, 0x53, 0x42, 0xc0, 0xbc, 0x38, 0x15, 0x30, 0x83, 0xe6, 0xaa, 0x41, 0x1d, 0x6c, 0x38, 0x5a, - 0xbe, 0x79, 0x2a, 0x88, 0x94, 0x17, 0xa2, 0x91, 0xd2, 0x6f, 0xac, 0x1a, 0x6c, 0x48, 0x42, 0x94, - 0xc4, 0x21, 0xb1, 0xf8, 0x78, 0x21, 0x1a, 0x1f, 0xd1, 0x8e, 0x47, 0xc6, 0x0b, 0xd1, 0xc8, 0x88, - 0x8d, 0x3c, 0x12, 0x9e, 0x8f, 0x44, 0x42, 0x24, 0x65, 0x21, 0xf0, 0x42, 0x34, 0x04, 0x32, 0x3b, - 0x61, 0xa4, 0x62, 0xfc, 0xf3, 0x1b, 0xab, 0x06, 0x31, 0x22, 0xc1, 0x4f, 0x76, 0x10, 0xc1, 0xdd, - 0xc0, 0x30, 0x50, 0xa5, 0x0b, 0xe7, 0x25, 0xa8, 0x79, 0xe9, 0x27, 0x2c, 0xb8, 0xa2, 0x5e, 0x82, - 0x66, 0x40, 0xaa, 0xc3, 0xcf, 0xea, 0x1a, 0x7a, 0xb2, 0x90, 0x38, 0x51, 0x02, 0x4b, 0xf5, 0x26, - 0x7a, 0x34, 0x3a, 0xbb, 0x0e, 0x3b, 0x70, 0x94, 0x60, 0xae, 0xde, 0x7c, 0xd8, 0x1a, 0x75, 0x29, - 0x74, 0xa7, 0xd5, 0xf5, 0x6f, 0x3d, 0xa8, 0x0a, 0xb2, 0x75, 0xde, 0xb2, 0xd3, 0xea, 0x92, 0xb3, - 0x9e, 0xc4, 0xda, 0xd8, 0xaa, 0x70, 0x91, 0x2d, 0x9e, 0xa3, 0x4b, 0xc7, 0xc8, 0xd0, 0x37, 0x2e, - 0x70, 0xdf, 0x78, 0x37, 0x05, 0x89, 0x89, 0xdd, 0x73, 0xec, 0xbb, 0x19, 0x48, 0xb9, 0xce, 0x68, - 0xd0, 0x72, 0x9d, 0xe2, 0x0f, 0x15, 0x80, 0x7b, 0xce, 0x60, 0x30, 0xb1, 0x7b, 0xef, 0x4d, 0x2c, - 0x72, 0x09, 0xb2, 0x83, 0xd6, 0x13, 0xab, 0x39, 0xb0, 0x9a, 0x7b, 0x23, 0xef, 0x6d, 0xc8, 0xd0, - 0xaa, 0x4d, 0xeb, 0xde, 0xe8, 0x90, 0x14, 0xbc, 0x04, 0x1e, 0x15, 0x84, 0xc2, 0xe4, 0x09, 0xfd, - 0x19, 0x9e, 0x8e, 0x26, 0xf9, 0x4e, 0x7a, 0x09, 0x29, 0x3b, 0xe4, 0xa4, 0xf8, 0x1e, 0xb2, 0x63, - 0xce, 0x39, 0x48, 0xba, 0xd6, 0x60, 0xd8, 0xdc, 0x43, 0xc1, 0x50, 0x51, 0x24, 0x68, 0xf9, 0x1e, - 0xb9, 0x01, 0xb1, 0x3d, 0xa7, 0x8f, 0x52, 0x39, 0x72, 0x77, 0x28, 0x92, 0xbc, 0x04, 0xb1, 0xc1, - 0x98, 0xc9, 0x27, 0x5b, 0x3e, 0x1d, 0xca, 0x20, 0x58, 0xc8, 0xa2, 0xc0, 0xc1, 0xb8, 0xeb, 0xcf, - 0xbd, 0xf8, 0xa9, 0x0a, 0x69, 0xba, 0x5f, 0x6f, 0xef, 0xd4, 0x6f, 0xe1, 0xb1, 0x61, 0xaf, 0xd5, - 0xc7, 0x1b, 0x02, 0xfa, 0x9a, 0xf2, 0x12, 0xad, 0xff, 0x8a, 0xb5, 0xe7, 0x3a, 0x23, 0x74, 0xcd, - 0x19, 0x93, 0x97, 0xe8, 0x92, 0xb3, 0xac, 0x38, 0xc6, 0x67, 0xc9, 0x8a, 0x98, 0xd1, 0xb7, 0x86, - 0x4d, 0xea, 0x03, 0x98, 0xbf, 0x0c, 0x9d, 0xae, 0xbd, 0xee, 0xe8, 0xd1, 0xed, 0x81, 0x75, 0xc8, - 0xfc, 0x64, 0x72, 0x80, 0x05, 0xf2, 0xb3, 0xec, 0xc8, 0xc7, 0x76, 0x92, 0x7d, 0x5f, 0x55, 0x7c, - 0x96, 0xf1, 0x3b, 0x14, 0x14, 0x9c, 0xfb, 0xb0, 0xb8, 0x78, 0x1b, 0xb2, 0x02, 0xef, 0x51, 0xae, - 0x28, 0x16, 0xf1, 0x63, 0x21, 0xd6, 0xa3, 0x6e, 0x75, 0x44, 0x3f, 0x46, 0x57, 0xd4, 0xa1, 0x1a, - 0xbe, 0x9a, 0x87, 0x58, 0xbd, 0xd1, 0xa0, 0x79, 0x56, 0xbd, 0xd1, 0x58, 0xd1, 0x94, 0xda, 0x0a, - 0xa4, 0xbb, 0x23, 0xcb, 0xa2, 0xae, 0xf7, 0x59, 0xe7, 0xbc, 0x2f, 0xe3, 0xb2, 0xfa, 0xb0, 0xda, - 0x5b, 0x90, 0xda, 0x63, 0x27, 0x3d, 0xf2, 0xcc, 0x5b, 0x8d, 0xc2, 0x1f, 0xb3, 0xdb, 0xb5, 0xe7, - 0x45, 0x40, 0xf4, 0x7c, 0x68, 0x7a, 0x3c, 0xb5, 0x1d, 0xc8, 0x8c, 0x9a, 0x47, 0x93, 0x7e, 0xc0, - 0x62, 0xb9, 0x9c, 0x34, 0x3d, 0xe2, 0x55, 0xb5, 0x75, 0x58, 0xb0, 0x1d, 0xef, 0x47, 0xbe, 0x66, - 0x9b, 0x7b, 0xb2, 0x59, 0x49, 0xb4, 0xd7, 0x81, 0xc5, 0x3e, 0x15, 0xb0, 0x1d, 0xde, 0xc0, 0xbc, - 0x5f, 0x6d, 0x0d, 0x34, 0x81, 0xa8, 0xc3, 0xdc, 0xa5, 0x8c, 0xa7, 0xc3, 0xbe, 0x4e, 0xf0, 0x79, - 0xd0, 0xc3, 0x46, 0x68, 0xb8, 0x0f, 0x94, 0xd1, 0x74, 0xd9, 0xc7, 0x1e, 0x3e, 0x0d, 0x86, 0x95, - 0x69, 0x1a, 0x1a, 0x11, 0x64, 0x34, 0xfb, 0xec, 0x4b, 0x10, 0x91, 0xa6, 0x6a, 0x44, 0x56, 0x67, - 0x72, 0x8c, 0xe1, 0xf4, 0xd8, 0xa7, 0x1c, 0x3e, 0x0f, 0x0b, 0x38, 0x33, 0x88, 0x8e, 0x1a, 0xd0, - 0x97, 0xd9, 0x77, 0x1e, 0x21, 0xa2, 0xa9, 0x11, 0x8d, 0x8f, 0x31, 0xa2, 0x27, 0xec, 0xb3, 0x0a, - 0x9f, 0x68, 0x7b, 0xd6, 0x88, 0xc6, 0xc7, 0x18, 0x51, 0x9f, 0x7d, 0x72, 0x11, 0x22, 0xaa, 0x1a, - 0xb5, 0x0d, 0x20, 0xe2, 0xc6, 0xf3, 0xe8, 0x2c, 0x65, 0x1a, 0xb0, 0x4f, 0x69, 0x82, 0xad, 0x67, - 0x46, 0xb3, 0xa8, 0x8e, 0x1a, 0x94, 0xcd, 0xbe, 0xb3, 0x09, 0x53, 0x55, 0x8d, 0xda, 0x03, 0x38, - 0x2d, 0x4e, 0xef, 0x58, 0xc3, 0x72, 0xd8, 0x47, 0x22, 0xc1, 0x04, 0xb9, 0xd5, 0x4c, 0xb2, 0xa3, - 0x06, 0x36, 0x64, 0x1f, 0x90, 0x44, 0xc8, 0xaa, 0x46, 0xed, 0x1e, 0xe4, 0x05, 0xb2, 0x5d, 0xbc, - 0x57, 0x90, 0x11, 0xbd, 0xc7, 0x3e, 0x7b, 0xf2, 0x89, 0x68, 0x46, 0x15, 0xdd, 0x3d, 0x96, 0x63, - 0x48, 0x69, 0x46, 0xec, 0xab, 0x9d, 0x60, 0x3c, 0x68, 0x13, 0x79, 0x51, 0x76, 0x59, 0x42, 0x22, - 0xe3, 0x19, 0xb3, 0x2f, 0x7a, 0x82, 0xe1, 0x50, 0x93, 0xda, 0x20, 0x34, 0x29, 0x8b, 0xa6, 0x19, - 0x52, 0x16, 0x17, 0x23, 0x62, 0x49, 0x02, 0x59, 0x12, 0xaf, 0xaf, 0x84, 0xe9, 0xd3, 0x62, 0xed, - 0x01, 0xcc, 0x9f, 0xc4, 0x65, 0x7d, 0xa0, 0xb0, 0xbb, 0x8c, 0xca, 0xd2, 0x8a, 0xb1, 0xb2, 0x6a, - 0xce, 0xb5, 0x43, 0x9e, 0x6b, 0x1d, 0xe6, 0x4e, 0xe0, 0xb6, 0x3e, 0x54, 0xd8, 0x8d, 0x00, 0xe5, - 0x32, 0x73, 0xed, 0xb0, 0xef, 0x9a, 0x3b, 0x81, 0xe3, 0xfa, 0x48, 0x61, 0x57, 0x48, 0x46, 0xd9, - 0xa7, 0xf1, 0x7c, 0xd7, 0xdc, 0x09, 0x1c, 0xd7, 0xc7, 0xec, 0xc4, 0xaf, 0x1a, 0x15, 0x91, 0x06, - 0x3d, 0xc5, 0xfc, 0x49, 0x1c, 0xd7, 0x27, 0x0a, 0x5e, 0x29, 0xa9, 0x86, 0xe1, 0xaf, 0x8f, 0xef, - 0xbb, 0xe6, 0x4f, 0xe2, 0xb8, 0xbe, 0xa6, 0xe0, 0xd5, 0x93, 0x6a, 0xac, 0x86, 0x88, 0xc2, 0x23, - 0x3a, 0x8e, 0xe3, 0xfa, 0x54, 0xc1, 0xfb, 0x20, 0xd5, 0xa8, 0xfa, 0x44, 0xdb, 0x53, 0x23, 0x3a, - 0x8e, 0xe3, 0xfa, 0x3a, 0x9e, 0xaf, 0x6a, 0xaa, 0x71, 0x33, 0x44, 0x84, 0xbe, 0x2b, 0x7f, 0x22, - 0xc7, 0xf5, 0x0d, 0x05, 0xaf, 0xee, 0x54, 0xe3, 0x96, 0xe9, 0x8d, 0x20, 0xf0, 0x5d, 0xf9, 0x13, - 0x39, 0xae, 0x6f, 0x2a, 0x78, 0xc7, 0xa7, 0x1a, 0xb7, 0xc3, 0x54, 0xe8, 0xbb, 0xb4, 0x93, 0x39, - 0xae, 0xcf, 0x14, 0xfc, 0xa2, 0x47, 0x5d, 0x5d, 0x36, 0xbd, 0x41, 0x08, 0xbe, 0x4b, 0x3b, 0x99, - 0xe3, 0xfa, 0x96, 0x82, 0x9f, 0xf9, 0xa8, 0xab, 0x2b, 0x11, 0xb2, 0xaa, 0x51, 0x5b, 0x83, 0xdc, - 0xf1, 0x1d, 0xd7, 0xb7, 0xc5, 0x1b, 0xd4, 0x6c, 0x5b, 0xf0, 0x5e, 0x8f, 0x85, 0xfd, 0x3b, 0x86, - 0xeb, 0xfa, 0x0e, 0x26, 0x7f, 0xb5, 0xe7, 0xde, 0x64, 0xf7, 0x8c, 0xcc, 0xe4, 0x95, 0xb6, 0xd5, - 0x79, 0xad, 0xe3, 0x38, 0xc1, 0x96, 0x32, 0x87, 0xd6, 0x08, 0xde, 0x9e, 0x63, 0x78, 0xb3, 0xef, - 0x2a, 0x78, 0x2d, 0x99, 0xe3, 0xd4, 0x68, 0xe1, 0xbf, 0x47, 0xcc, 0xb5, 0xd9, 0xc1, 0x9c, 0x8f, - 0xf6, 0x6b, 0xdf, 0x53, 0x4e, 0xe6, 0xd8, 0x6a, 0xb1, 0xc6, 0xd6, 0x9a, 0xbf, 0x38, 0x58, 0xf3, - 0x06, 0xc4, 0x0f, 0xca, 0xcb, 0x2b, 0xe1, 0x14, 0x4f, 0xbc, 0x95, 0x67, 0xee, 0x2c, 0x5b, 0x5e, - 0x08, 0xfd, 0x7c, 0x31, 0x18, 0xba, 0x87, 0x26, 0x5a, 0x72, 0x86, 0xb2, 0x84, 0xe1, 0x43, 0x29, - 0x43, 0x99, 0x33, 0x54, 0x24, 0x0c, 0x1f, 0x49, 0x19, 0x2a, 0x9c, 0xc1, 0x90, 0x30, 0x7c, 0x2c, - 0x65, 0x30, 0x38, 0xc3, 0xaa, 0x84, 0xe1, 0x13, 0x29, 0xc3, 0x2a, 0x67, 0xa8, 0x4a, 0x18, 0xbe, - 0x26, 0x65, 0xa8, 0x72, 0x86, 0x9b, 0x12, 0x86, 0x4f, 0xa5, 0x0c, 0x37, 0x39, 0xc3, 0x2d, 0x09, - 0xc3, 0xd7, 0xa5, 0x0c, 0xb7, 0x38, 0xc3, 0x6d, 0x09, 0xc3, 0x37, 0xa4, 0x0c, 0xb7, 0x19, 0xc3, - 0xca, 0xb2, 0x84, 0xe1, 0x9b, 0x32, 0x86, 0x95, 0x65, 0xce, 0x20, 0xd3, 0xe4, 0x67, 0x52, 0x06, - 0xae, 0xc9, 0x15, 0x99, 0x26, 0xbf, 0x25, 0x65, 0xe0, 0x9a, 0x5c, 0x91, 0x69, 0xf2, 0xdb, 0x52, - 0x06, 0xae, 0xc9, 0x15, 0x99, 0x26, 0xbf, 0x23, 0x65, 0xe0, 0x9a, 0x5c, 0x91, 0x69, 0xf2, 0xbb, - 0x52, 0x06, 0xae, 0xc9, 0x15, 0x99, 0x26, 0xbf, 0x27, 0x65, 0xe0, 0x9a, 0x5c, 0x91, 0x69, 0xf2, - 0x4f, 0xa4, 0x0c, 0x5c, 0x93, 0x2b, 0x32, 0x4d, 0xfe, 0xa9, 0x94, 0x81, 0x6b, 0x72, 0x45, 0xa6, - 0xc9, 0x3f, 0x93, 0x32, 0x70, 0x4d, 0x96, 0x65, 0x9a, 0xfc, 0xbe, 0x8c, 0xa1, 0xcc, 0x35, 0x59, - 0x96, 0x69, 0xf2, 0xcf, 0xa5, 0x0c, 0x5c, 0x93, 0x65, 0x99, 0x26, 0xff, 0x42, 0xca, 0xc0, 0x35, - 0x59, 0x96, 0x69, 0xf2, 0x07, 0x52, 0x06, 0xae, 0xc9, 0xb2, 0x4c, 0x93, 0x7f, 0x29, 0x65, 0xe0, - 0x9a, 0x2c, 0xcb, 0x34, 0xf9, 0x57, 0x52, 0x06, 0xae, 0xc9, 0xb2, 0x4c, 0x93, 0x7f, 0x2d, 0x65, - 0xe0, 0x9a, 0x2c, 0xcb, 0x34, 0xf9, 0x37, 0x52, 0x06, 0xae, 0xc9, 0xb2, 0x4c, 0x93, 0x7f, 0x2b, - 0x65, 0xe0, 0x9a, 0x2c, 0xcb, 0x34, 0xf9, 0x77, 0x52, 0x06, 0xae, 0xc9, 0x8a, 0x4c, 0x93, 0x7f, - 0x2f, 0x63, 0xa8, 0x70, 0x4d, 0x56, 0x64, 0x9a, 0xfc, 0x07, 0x29, 0x03, 0xd7, 0x64, 0x45, 0xa6, - 0xc9, 0x7f, 0x94, 0x32, 0x70, 0x4d, 0x56, 0x64, 0x9a, 0xfc, 0x27, 0x29, 0x03, 0xd7, 0x64, 0x45, - 0xa6, 0xc9, 0x7f, 0x96, 0x32, 0x70, 0x4d, 0x56, 0x64, 0x9a, 0xfc, 0x17, 0x29, 0x03, 0xd7, 0x64, - 0x45, 0xa6, 0xc9, 0x7f, 0x95, 0x32, 0x70, 0x4d, 0x56, 0x64, 0x9a, 0xfc, 0x37, 0x29, 0x03, 0xd7, - 0x64, 0x45, 0xa6, 0xc9, 0x1f, 0x4a, 0x19, 0xb8, 0x26, 0x2b, 0x32, 0x4d, 0xfe, 0xbb, 0x94, 0x81, - 0x6b, 0xd2, 0x90, 0x69, 0xf2, 0x3f, 0x64, 0x0c, 0x06, 0xd7, 0xa4, 0x21, 0xd3, 0xe4, 0x7f, 0x4a, - 0x19, 0xb8, 0x26, 0x0d, 0x99, 0x26, 0xff, 0x4b, 0xca, 0xc0, 0x35, 0x69, 0xc8, 0x34, 0xf9, 0xdf, - 0x52, 0x06, 0xae, 0x49, 0x43, 0xa6, 0xc9, 0xff, 0x91, 0x32, 0x70, 0x4d, 0x1a, 0x32, 0x4d, 0xfe, - 0xaf, 0x94, 0x81, 0x6b, 0xd2, 0x90, 0x69, 0xf2, 0x47, 0x52, 0x06, 0xae, 0x49, 0x43, 0xa6, 0xc9, - 0x1f, 0x4b, 0x19, 0xb8, 0x26, 0x0d, 0x99, 0x26, 0x7f, 0x22, 0x65, 0xe0, 0x9a, 0x34, 0x64, 0x9a, - 0xfc, 0xa9, 0x94, 0x81, 0x6b, 0x72, 0x55, 0xa6, 0xc9, 0xff, 0x93, 0x31, 0xac, 0x2e, 0xdf, 0xbd, - 0xfe, 0xf8, 0x5a, 0xb7, 0xe7, 0xee, 0x4f, 0x76, 0x97, 0xf6, 0x9c, 0xc1, 0x8d, 0xae, 0xd3, 0x6f, - 0xd9, 0xdd, 0x1b, 0x08, 0xdb, 0x9d, 0x74, 0x6e, 0x04, 0xff, 0xcc, 0xce, 0x4c, 0xff, 0x3f, 0x00, - 0x00, 0xff, 0xff, 0x8e, 0xb4, 0x0c, 0xbd, 0xe4, 0x3e, 0x00, 0x00, -} +var xxx_File_test_proto_test_proto_rawdesc = []byte{ + // 16100 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, + 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x06, 0x47, 0x6f, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x21, 0x0a, + 0x03, 0x66, 0x6f, 0x6f, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x4f, 0x4f, 0x52, 0x03, 0x66, 0x6f, 0x6f, + 0x22, 0x37, 0x0a, 0x0b, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, + 0x14, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x05, + 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, + 0x02, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x22, 0xb5, 0x22, 0x0a, 0x06, 0x47, 0x6f, + 0x54, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x02, + 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x4b, 0x49, 0x4e, 0x44, 0x52, 0x04, 0x4b, 0x69, 0x6e, + 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x3d, 0x0a, + 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x04, + 0x20, 0x02, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0d, 0x52, + 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x3d, 0x0a, 0x0d, + 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x05, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0d, 0x52, 0x65, + 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x3d, 0x0a, 0x0d, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0d, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x26, 0x0a, 0x0f, 0x46, 0x5f, + 0x42, 0x6f, 0x6f, 0x6c, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x0a, 0x20, + 0x02, 0x28, 0x08, 0x52, 0x0d, 0x46, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, + 0x65, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x72, 0x65, + 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x02, 0x28, 0x05, 0x52, 0x0e, 0x46, 0x49, + 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x28, 0x0a, 0x10, + 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, + 0x18, 0x0c, 0x20, 0x02, 0x28, 0x03, 0x52, 0x0e, 0x46, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, + 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, + 0x64, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x0d, 0x20, 0x02, + 0x28, 0x07, 0x52, 0x10, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x52, 0x65, 0x71, 0x75, + 0x69, 0x72, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, + 0x34, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x0e, 0x20, 0x02, 0x28, 0x06, + 0x52, 0x10, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, + 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x72, + 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x0f, 0x46, + 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2a, + 0x0a, 0x11, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, + 0x72, 0x65, 0x64, 0x18, 0x10, 0x20, 0x02, 0x28, 0x04, 0x52, 0x0f, 0x46, 0x55, 0x69, 0x6e, 0x74, + 0x36, 0x34, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x46, 0x5f, + 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x11, + 0x20, 0x02, 0x28, 0x02, 0x52, 0x0e, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x69, 0x72, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, + 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x12, 0x20, 0x02, 0x28, 0x01, 0x52, + 0x0f, 0x46, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, + 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x13, 0x20, 0x02, 0x28, 0x09, 0x52, 0x0f, 0x46, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x28, 0x0a, 0x10, + 0x46, 0x5f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, + 0x18, 0x65, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x0e, 0x46, 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, + 0x33, 0x32, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x66, 0x20, 0x02, 0x28, + 0x11, 0x52, 0x0f, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, + 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, + 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x67, 0x20, 0x02, 0x28, 0x12, 0x52, 0x0f, 0x46, + 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2e, + 0x0a, 0x13, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x68, 0x20, 0x02, 0x28, 0x0f, 0x52, 0x11, 0x46, 0x53, 0x66, + 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2e, + 0x0a, 0x13, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x69, 0x20, 0x02, 0x28, 0x10, 0x52, 0x11, 0x46, 0x53, 0x66, + 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x26, + 0x0a, 0x0f, 0x46, 0x5f, 0x42, 0x6f, 0x6f, 0x6c, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x18, 0x14, 0x20, 0x03, 0x28, 0x08, 0x52, 0x0d, 0x46, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, + 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, + 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x15, 0x20, 0x03, 0x28, 0x05, + 0x52, 0x0e, 0x46, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x12, 0x28, 0x0a, 0x10, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x18, 0x16, 0x20, 0x03, 0x28, 0x03, 0x52, 0x0e, 0x46, 0x49, 0x6e, 0x74, + 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x46, 0x5f, + 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x18, 0x17, 0x20, 0x03, 0x28, 0x07, 0x52, 0x10, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, + 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x46, 0x5f, 0x46, 0x69, + 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x18, + 0x20, 0x03, 0x28, 0x06, 0x52, 0x10, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, 0x65, + 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, + 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x19, 0x20, 0x03, 0x28, + 0x0d, 0x52, 0x0f, 0x46, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, + 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x1a, 0x20, 0x03, 0x28, 0x04, 0x52, 0x0f, 0x46, + 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x28, + 0x0a, 0x10, 0x46, 0x5f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x18, 0x1b, 0x20, 0x03, 0x28, 0x02, 0x52, 0x0e, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, + 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x44, 0x6f, + 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x1c, 0x20, + 0x03, 0x28, 0x01, 0x52, 0x0f, 0x46, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x1d, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x0f, 0x46, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x12, 0x29, 0x0a, 0x10, 0x46, 0x5f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x70, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x18, 0xc9, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0e, 0x46, 0x42, 0x79, + 0x74, 0x65, 0x73, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x46, + 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x18, 0xca, 0x01, 0x20, 0x03, 0x28, 0x11, 0x52, 0x0f, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, + 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x69, + 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0xcb, 0x01, + 0x20, 0x03, 0x28, 0x12, 0x52, 0x0f, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, 0x70, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2f, 0x0a, 0x13, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, + 0x64, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0xcc, 0x01, 0x20, + 0x03, 0x28, 0x0f, 0x52, 0x11, 0x46, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x52, 0x65, + 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2f, 0x0a, 0x13, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, + 0x65, 0x64, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0xcd, 0x01, + 0x20, 0x03, 0x28, 0x10, 0x52, 0x11, 0x46, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, + 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x26, 0x0a, 0x0f, 0x46, 0x5f, 0x42, 0x6f, 0x6f, + 0x6c, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0d, 0x46, 0x42, 0x6f, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, + 0x28, 0x0a, 0x10, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x46, 0x49, 0x6e, 0x74, 0x33, + 0x32, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x28, 0x0a, 0x10, 0x46, 0x5f, 0x49, + 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x20, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0e, 0x46, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 0x12, 0x2c, 0x0a, 0x12, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, + 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x21, 0x20, 0x01, 0x28, 0x07, 0x52, + 0x10, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, + 0x6c, 0x12, 0x2c, 0x0a, 0x12, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x06, 0x52, 0x10, 0x46, + 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, + 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x6f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x23, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x46, 0x55, 0x69, 0x6e, + 0x74, 0x33, 0x32, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x2a, 0x0a, 0x11, 0x46, + 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, + 0x18, 0x24, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x46, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x28, 0x0a, 0x10, 0x46, 0x5f, 0x46, 0x6c, 0x6f, + 0x61, 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x25, 0x20, 0x01, 0x28, + 0x02, 0x52, 0x0e, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, + 0x6c, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x26, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0f, 0x46, 0x44, + 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x2a, 0x0a, + 0x11, 0x46, 0x5f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x61, 0x6c, 0x18, 0x27, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x46, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x29, 0x0a, 0x10, 0x46, 0x5f, 0x42, + 0x79, 0x74, 0x65, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0xad, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x46, 0x42, 0x79, 0x74, 0x65, 0x73, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x2b, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, + 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0xae, 0x02, 0x20, 0x01, 0x28, 0x11, + 0x52, 0x0f, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, + 0x6c, 0x12, 0x2b, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0xaf, 0x02, 0x20, 0x01, 0x28, 0x12, 0x52, 0x0f, 0x46, + 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x2f, + 0x0a, 0x13, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0xb0, 0x02, 0x20, 0x01, 0x28, 0x0f, 0x52, 0x11, 0x46, 0x53, + 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, + 0x2f, 0x0a, 0x13, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0xb1, 0x02, 0x20, 0x01, 0x28, 0x10, 0x52, 0x11, 0x46, + 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, + 0x12, 0x2e, 0x0a, 0x10, 0x46, 0x5f, 0x42, 0x6f, 0x6f, 0x6c, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x65, 0x64, 0x18, 0x28, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x04, 0x74, 0x72, 0x75, 0x65, + 0x52, 0x0e, 0x46, 0x42, 0x6f, 0x6f, 0x6c, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, + 0x12, 0x2e, 0x0a, 0x11, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x64, 0x65, 0x66, 0x61, + 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x29, 0x20, 0x01, 0x28, 0x05, 0x3a, 0x02, 0x33, 0x32, 0x52, + 0x0f, 0x46, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, + 0x12, 0x2e, 0x0a, 0x11, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x64, 0x65, 0x66, 0x61, + 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x2a, 0x20, 0x01, 0x28, 0x03, 0x3a, 0x02, 0x36, 0x34, 0x52, + 0x0f, 0x46, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, + 0x12, 0x33, 0x0a, 0x13, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x64, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x2b, 0x20, 0x01, 0x28, 0x07, 0x3a, 0x03, 0x33, + 0x32, 0x30, 0x52, 0x11, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x44, 0x65, 0x66, 0x61, + 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x33, 0x0a, 0x13, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, 0x64, + 0x36, 0x34, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x2c, 0x20, 0x01, + 0x28, 0x06, 0x3a, 0x03, 0x36, 0x34, 0x30, 0x52, 0x11, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, + 0x34, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x32, 0x0a, 0x12, 0x46, 0x5f, + 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, + 0x18, 0x2d, 0x20, 0x01, 0x28, 0x0d, 0x3a, 0x04, 0x33, 0x32, 0x30, 0x30, 0x52, 0x10, 0x46, 0x55, + 0x69, 0x6e, 0x74, 0x33, 0x32, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x32, + 0x0a, 0x12, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x65, 0x64, 0x18, 0x2e, 0x20, 0x01, 0x28, 0x04, 0x3a, 0x04, 0x36, 0x34, 0x30, 0x30, + 0x52, 0x10, 0x46, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x65, 0x64, 0x12, 0x32, 0x0a, 0x11, 0x46, 0x5f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x64, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x2f, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x06, 0x33, + 0x31, 0x34, 0x31, 0x35, 0x39, 0x52, 0x0f, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x44, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x12, 0x46, 0x5f, 0x44, 0x6f, 0x75, 0x62, + 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x30, 0x20, 0x01, + 0x28, 0x01, 0x3a, 0x06, 0x32, 0x37, 0x31, 0x38, 0x32, 0x38, 0x52, 0x10, 0x46, 0x44, 0x6f, 0x75, + 0x62, 0x6c, 0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x3e, 0x0a, 0x12, + 0x46, 0x5f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x65, 0x64, 0x18, 0x31, 0x20, 0x01, 0x28, 0x09, 0x3a, 0x10, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, + 0x20, 0x22, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x22, 0x0a, 0x52, 0x10, 0x46, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x11, + 0x46, 0x5f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, + 0x64, 0x18, 0x91, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x3a, 0x07, 0x42, 0x69, 0x67, 0x6e, 0x6f, 0x73, + 0x65, 0x52, 0x0f, 0x46, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x65, 0x64, 0x12, 0x32, 0x0a, 0x12, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x64, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x92, 0x03, 0x20, 0x01, 0x28, 0x11, 0x3a, + 0x03, 0x2d, 0x33, 0x32, 0x52, 0x10, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x44, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x32, 0x0a, 0x12, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, + 0x36, 0x34, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x93, 0x03, 0x20, + 0x01, 0x28, 0x12, 0x3a, 0x03, 0x2d, 0x36, 0x34, 0x52, 0x10, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x36, + 0x34, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x14, 0x46, 0x5f, + 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x65, 0x64, 0x18, 0x94, 0x03, 0x20, 0x01, 0x28, 0x0f, 0x3a, 0x03, 0x2d, 0x33, 0x32, 0x52, 0x12, + 0x46, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x65, 0x64, 0x12, 0x36, 0x0a, 0x14, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, + 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x95, 0x03, 0x20, 0x01, 0x28, + 0x10, 0x3a, 0x03, 0x2d, 0x36, 0x34, 0x52, 0x12, 0x46, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, + 0x34, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x16, 0x46, 0x5f, + 0x42, 0x6f, 0x6f, 0x6c, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, + 0x63, 0x6b, 0x65, 0x64, 0x18, 0x32, 0x20, 0x03, 0x28, 0x08, 0x42, 0x02, 0x10, 0x01, 0x52, 0x13, + 0x46, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, + 0x6b, 0x65, 0x64, 0x12, 0x39, 0x0a, 0x17, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x72, + 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x33, + 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x14, 0x46, 0x49, 0x6e, 0x74, 0x33, 0x32, + 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x39, + 0x0a, 0x17, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x34, 0x20, 0x03, 0x28, 0x03, 0x42, + 0x02, 0x10, 0x01, 0x52, 0x14, 0x46, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3d, 0x0a, 0x19, 0x46, 0x5f, 0x46, + 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, + 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x35, 0x20, 0x03, 0x28, 0x07, 0x42, 0x02, 0x10, 0x01, + 0x52, 0x16, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3d, 0x0a, 0x19, 0x46, 0x5f, 0x46, 0x69, + 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, + 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x36, 0x20, 0x03, 0x28, 0x06, 0x42, 0x02, 0x10, 0x01, 0x52, + 0x16, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x18, 0x46, 0x5f, 0x55, 0x69, 0x6e, + 0x74, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, + 0x6b, 0x65, 0x64, 0x18, 0x37, 0x20, 0x03, 0x28, 0x0d, 0x42, 0x02, 0x10, 0x01, 0x52, 0x15, 0x46, + 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, + 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x18, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, + 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, + 0x18, 0x38, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x01, 0x52, 0x15, 0x46, 0x55, 0x69, 0x6e, + 0x74, 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x64, 0x12, 0x39, 0x0a, 0x17, 0x46, 0x5f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x72, 0x65, 0x70, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x39, 0x20, 0x03, + 0x28, 0x02, 0x42, 0x02, 0x10, 0x01, 0x52, 0x14, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x52, 0x65, + 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x18, + 0x46, 0x5f, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x3a, 0x20, 0x03, 0x28, 0x01, 0x42, 0x02, + 0x10, 0x01, 0x52, 0x15, 0x46, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3c, 0x0a, 0x18, 0x46, 0x5f, 0x53, + 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, + 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0xf6, 0x03, 0x20, 0x03, 0x28, 0x11, 0x42, 0x02, 0x10, 0x01, + 0x52, 0x15, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3c, 0x0a, 0x18, 0x46, 0x5f, 0x53, 0x69, 0x6e, + 0x74, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, + 0x6b, 0x65, 0x64, 0x18, 0xf7, 0x03, 0x20, 0x03, 0x28, 0x12, 0x42, 0x02, 0x10, 0x01, 0x52, 0x15, + 0x46, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x50, + 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x40, 0x0a, 0x1a, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, + 0x64, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, + 0x6b, 0x65, 0x64, 0x18, 0xf8, 0x03, 0x20, 0x03, 0x28, 0x0f, 0x42, 0x02, 0x10, 0x01, 0x52, 0x17, + 0x46, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x40, 0x0a, 0x1a, 0x46, 0x5f, 0x53, 0x66, 0x69, + 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, + 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0xf9, 0x03, 0x20, 0x03, 0x28, 0x10, 0x42, 0x02, 0x10, 0x01, + 0x52, 0x17, 0x46, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x46, 0x0a, 0x0d, 0x72, 0x65, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x46, 0x20, 0x02, 0x28, 0x0a, + 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x6f, + 0x54, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x52, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x12, 0x46, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x18, 0x50, 0x20, 0x03, 0x28, 0x0a, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0d, 0x72, 0x65, 0x70, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x46, 0x0a, 0x0d, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x0a, + 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x6f, + 0x54, 0x65, 0x73, 0x74, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x52, 0x0d, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x1a, 0x35, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x12, 0x24, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x18, 0x47, 0x20, 0x02, 0x28, 0x09, 0x52, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, + 0x72, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x35, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x24, 0x0a, 0x0d, 0x52, 0x65, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x51, 0x20, 0x02, 0x28, 0x09, + 0x52, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, + 0x35, 0x0a, 0x0d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x12, 0x24, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x18, 0x5b, 0x20, 0x02, 0x28, 0x09, 0x52, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, + 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x98, 0x01, 0x0a, 0x04, 0x4b, 0x49, 0x4e, 0x44, 0x12, + 0x08, 0x0a, 0x04, 0x56, 0x4f, 0x49, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4f, 0x4f, + 0x4c, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, 0x02, 0x12, 0x0f, + 0x0a, 0x0b, 0x46, 0x49, 0x4e, 0x47, 0x45, 0x52, 0x50, 0x52, 0x49, 0x4e, 0x54, 0x10, 0x03, 0x12, + 0x09, 0x0a, 0x05, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x04, 0x12, 0x07, 0x0a, 0x03, 0x49, 0x4e, + 0x54, 0x10, 0x05, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x06, 0x12, + 0x08, 0x0a, 0x04, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x55, 0x50, + 0x4c, 0x45, 0x10, 0x08, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x09, 0x12, + 0x07, 0x0a, 0x03, 0x4d, 0x41, 0x50, 0x10, 0x0a, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x41, 0x42, 0x4c, + 0x45, 0x10, 0x0b, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, + 0x0c, 0x22, 0x7b, 0x0a, 0x18, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, + 0x72, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x40, 0x0a, + 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0a, 0x32, 0x2a, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, + 0x1d, 0x0a, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x18, 0x02, 0x20, 0x02, 0x28, 0x05, 0x52, 0x05, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 0xa3, + 0x02, 0x0a, 0x0a, 0x47, 0x6f, 0x53, 0x6b, 0x69, 0x70, 0x54, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, + 0x0a, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x0b, 0x20, 0x02, 0x28, + 0x05, 0x52, 0x09, 0x73, 0x6b, 0x69, 0x70, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x21, 0x0a, 0x0c, + 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x0c, 0x20, 0x02, + 0x28, 0x07, 0x52, 0x0b, 0x73, 0x6b, 0x69, 0x70, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, + 0x21, 0x0a, 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x18, + 0x0d, 0x20, 0x02, 0x28, 0x06, 0x52, 0x0b, 0x73, 0x6b, 0x69, 0x70, 0x46, 0x69, 0x78, 0x65, 0x64, + 0x36, 0x34, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x18, 0x0e, 0x20, 0x02, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6b, 0x69, 0x70, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x6b, 0x69, 0x70, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x18, 0x0f, 0x20, 0x02, 0x28, 0x0a, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x6f, 0x53, 0x6b, 0x69, 0x70, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x53, + 0x6b, 0x69, 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x09, 0x73, 0x6b, 0x69, 0x70, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x1a, 0x4f, 0x0a, 0x09, 0x53, 0x6b, 0x69, 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, + 0x10, 0x20, 0x02, 0x28, 0x05, 0x52, 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, 0x74, 0x33, + 0x32, 0x12, 0x21, 0x0a, 0x0c, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x18, 0x11, 0x20, 0x02, 0x28, 0x09, 0x52, 0x0b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x22, 0x1d, 0x0a, 0x0d, 0x4e, 0x6f, 0x6e, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x64, 0x54, 0x65, 0x73, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, + 0x52, 0x01, 0x61, 0x22, 0x1e, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x54, 0x65, 0x73, + 0x74, 0x12, 0x10, 0x0a, 0x01, 0x62, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, + 0x52, 0x01, 0x62, 0x22, 0x2b, 0x0a, 0x06, 0x4d, 0x61, 0x78, 0x54, 0x61, 0x67, 0x12, 0x21, 0x0a, + 0x0a, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0xff, 0xff, 0xff, 0xff, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x22, 0x73, 0x0a, 0x0a, 0x4f, 0x6c, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x35, + 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x6c, 0x64, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x06, 0x6e, + 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x1a, 0x1c, 0x0a, 0x06, 0x4e, 0x65, 0x73, 0x74, 0x65, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x0a, 0x4e, 0x65, 0x77, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x4e, 0x65, 0x77, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x65, 0x73, + 0x74, 0x65, 0x64, 0x52, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, + 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x1a, 0x3b, 0x0a, + 0x06, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, + 0x6f, 0x6f, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x66, 0x6f, 0x6f, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x5a, 0x0a, 0x0c, 0x49, 0x6e, + 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, + 0x73, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x18, + 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x3a, 0x04, 0x34, 0x30, + 0x30, 0x30, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x22, 0x88, 0x01, 0x0a, 0x0c, 0x4f, 0x74, 0x68, 0x65, 0x72, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, + 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x69, 0x6e, 0x6e, 0x65, 0x72, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x52, 0x05, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, 0x80, 0x80, 0x80, + 0x02, 0x22, 0x68, 0x0a, 0x14, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x49, 0x6e, 0x6e, + 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x50, 0x0a, 0x18, 0x6c, 0x65, 0x6f, + 0x5f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x6c, 0x79, 0x5f, 0x77, 0x6f, 0x6e, 0x5f, 0x61, 0x6e, 0x5f, + 0x6f, 0x73, 0x63, 0x61, 0x72, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x14, 0x6c, 0x65, 0x6f, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x6c, + 0x79, 0x57, 0x6f, 0x6e, 0x41, 0x6e, 0x4f, 0x73, 0x63, 0x61, 0x72, 0x22, 0xd3, 0x04, 0x0a, 0x09, + 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x65, 0x74, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x70, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x69, + 0x6e, 0x6e, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x52, 0x05, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x06, 0x6f, + 0x74, 0x68, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x06, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x73, 0x12, 0x4b, 0x0a, + 0x11, 0x77, 0x65, 0x5f, 0x6d, 0x75, 0x73, 0x74, 0x5f, 0x67, 0x6f, 0x5f, 0x64, 0x65, 0x65, 0x70, + 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x49, 0x6e, + 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0e, 0x77, 0x65, 0x4d, 0x75, + 0x73, 0x74, 0x47, 0x6f, 0x44, 0x65, 0x65, 0x70, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, + 0x70, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x72, 0x65, 0x70, 0x49, 0x6e, 0x6e, 0x65, + 0x72, 0x12, 0x37, 0x0a, 0x08, 0x62, 0x69, 0x6b, 0x65, 0x73, 0x68, 0x65, 0x64, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, + 0x52, 0x08, 0x62, 0x69, 0x6b, 0x65, 0x73, 0x68, 0x65, 0x64, 0x12, 0x3d, 0x0a, 0x09, 0x73, 0x6f, + 0x6d, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0a, 0x32, 0x1f, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x09, + 0x73, 0x6f, 0x6d, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x70, + 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, + 0x70, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x69, 0x67, 0x66, 0x6c, 0x6f, + 0x61, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x62, 0x69, 0x67, 0x66, 0x6c, 0x6f, + 0x61, 0x74, 0x1a, 0x2c, 0x0a, 0x09, 0x53, 0x6f, 0x6d, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, + 0x1f, 0x0a, 0x0b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x22, 0x25, 0x0a, 0x05, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x08, 0x0a, + 0x04, 0x42, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, 0x80, 0x80, 0x80, + 0x02, 0x22, 0xa8, 0x02, 0x0a, 0x03, 0x45, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3a, 0x0a, + 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, + 0x74, 0x2e, 0x4d, 0x61, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x08, 0x6d, 0x61, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x61, 0x70, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0x3a, 0x0a, 0x04, 0x6d, 0x6f, 0x72, 0x65, 0x12, 0x15, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x52, 0x04, 0x6d, 0x6f, + 0x72, 0x65, 0x32, 0x29, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x15, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x18, 0x68, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x32, 0x2d, 0x0a, + 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x69, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x56, 0x0a, 0x10, + 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x72, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x05, 0x66, 0x69, 0x72, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x74, 0x68, 0x69, 0x72, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x74, + 0x68, 0x69, 0x72, 0x64, 0x22, 0x47, 0x0a, 0x0f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2a, 0x0a, 0x0c, 0x44, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x73, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x5a, 0x45, 0x52, 0x4f, 0x10, + 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x57, + 0x4f, 0x10, 0x02, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x1c, 0x0a, + 0x0c, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x2a, 0x08, 0x08, + 0x64, 0x10, 0xff, 0xff, 0xff, 0xff, 0x07, 0x3a, 0x02, 0x08, 0x01, 0x22, 0x07, 0x0a, 0x05, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x22, 0x7d, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, + 0x69, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0a, 0x32, 0x1f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x33, + 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x02, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0x4d, 0x0a, 0x07, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x21, + 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x22, 0xb6, 0x05, 0x0a, 0x08, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, + 0x1b, 0x0a, 0x06, 0x46, 0x5f, 0x42, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, + 0x04, 0x74, 0x72, 0x75, 0x65, 0x52, 0x05, 0x46, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x1b, 0x0a, 0x07, + 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x3a, 0x02, 0x33, + 0x32, 0x52, 0x06, 0x46, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1b, 0x0a, 0x07, 0x46, 0x5f, 0x49, + 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x3a, 0x02, 0x36, 0x34, 0x52, 0x06, + 0x46, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x20, 0x0a, 0x09, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, + 0x64, 0x33, 0x32, 0x18, 0x04, 0x20, 0x01, 0x28, 0x07, 0x3a, 0x03, 0x33, 0x32, 0x30, 0x52, 0x08, + 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x20, 0x0a, 0x09, 0x46, 0x5f, 0x46, 0x69, + 0x78, 0x65, 0x64, 0x36, 0x34, 0x18, 0x05, 0x20, 0x01, 0x28, 0x06, 0x3a, 0x03, 0x36, 0x34, 0x30, + 0x52, 0x08, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x1f, 0x0a, 0x08, 0x46, 0x5f, + 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x3a, 0x04, 0x33, 0x32, + 0x30, 0x30, 0x52, 0x07, 0x46, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1f, 0x0a, 0x08, 0x46, + 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x3a, 0x04, 0x36, + 0x34, 0x30, 0x30, 0x52, 0x07, 0x46, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1f, 0x0a, 0x07, + 0x46, 0x5f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x06, 0x33, + 0x31, 0x34, 0x31, 0x35, 0x39, 0x52, 0x06, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x21, 0x0a, + 0x08, 0x46, 0x5f, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x3a, + 0x06, 0x32, 0x37, 0x31, 0x38, 0x32, 0x38, 0x52, 0x07, 0x46, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, + 0x12, 0x2b, 0x0a, 0x08, 0x46, 0x5f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x09, 0x3a, 0x10, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x22, 0x77, 0x6f, 0x72, 0x6c, + 0x64, 0x21, 0x22, 0x0a, 0x52, 0x07, 0x46, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x20, 0x0a, + 0x07, 0x46, 0x5f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x3a, 0x07, + 0x42, 0x69, 0x67, 0x6e, 0x6f, 0x73, 0x65, 0x52, 0x06, 0x46, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, + 0x1e, 0x0a, 0x08, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x11, 0x3a, 0x03, 0x2d, 0x33, 0x32, 0x52, 0x07, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, + 0x1e, 0x0a, 0x08, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x0d, 0x20, 0x01, 0x28, + 0x12, 0x3a, 0x03, 0x2d, 0x36, 0x34, 0x52, 0x07, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, + 0x38, 0x0a, 0x06, 0x46, 0x5f, 0x45, 0x6e, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x1a, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x05, 0x47, 0x52, 0x45, + 0x45, 0x4e, 0x52, 0x05, 0x46, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x06, 0x46, 0x5f, 0x50, + 0x69, 0x6e, 0x66, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x03, 0x69, 0x6e, 0x66, 0x52, 0x05, + 0x46, 0x50, 0x69, 0x6e, 0x66, 0x12, 0x1b, 0x0a, 0x06, 0x46, 0x5f, 0x4e, 0x69, 0x6e, 0x66, 0x18, + 0x10, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x04, 0x2d, 0x69, 0x6e, 0x66, 0x52, 0x05, 0x46, 0x4e, 0x69, + 0x6e, 0x66, 0x12, 0x18, 0x0a, 0x05, 0x46, 0x5f, 0x4e, 0x61, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, + 0x02, 0x3a, 0x03, 0x6e, 0x61, 0x6e, 0x52, 0x04, 0x46, 0x4e, 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x03, + 0x73, 0x75, 0x62, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x75, 0x62, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x73, 0x52, 0x03, 0x73, 0x75, 0x62, 0x12, 0x1b, 0x0a, 0x08, 0x73, 0x74, 0x72, 0x5f, 0x7a, + 0x65, 0x72, 0x6f, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x3a, 0x00, 0x52, 0x07, 0x73, 0x74, 0x72, + 0x5a, 0x65, 0x72, 0x6f, 0x22, 0x25, 0x0a, 0x05, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x07, 0x0a, + 0x03, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x10, + 0x01, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x22, 0x1e, 0x0a, 0x0b, 0x53, + 0x75, 0x62, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x0f, 0x0a, 0x01, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x3a, 0x01, 0x37, 0x52, 0x01, 0x6e, 0x22, 0x56, 0x0a, 0x0c, 0x52, + 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x34, 0x0a, 0x05, 0x63, + 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x45, 0x6e, 0x75, 0x6d, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, + 0x72, 0x22, 0x10, 0x0a, 0x05, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x45, + 0x44, 0x10, 0x01, 0x22, 0xdf, 0x01, 0x0a, 0x0c, 0x4d, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x70, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x73, 0x12, 0x25, 0x0a, 0x0c, 0x62, 0x6f, + 0x6f, 0x6c, 0x73, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x08, + 0x42, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x62, 0x6f, 0x6f, 0x6c, 0x73, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, + 0x04, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x23, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x73, 0x5f, 0x70, 0x61, + 0x63, 0x6b, 0x65, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x0a, + 0x69, 0x6e, 0x74, 0x73, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x27, 0x0a, 0x0d, 0x69, 0x6e, + 0x74, 0x36, 0x34, 0x73, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x07, 0x20, 0x03, 0x28, + 0x03, 0x42, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x73, 0x50, 0x61, 0x63, + 0x6b, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x05, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x16, 0x0a, + 0x06, 0x66, 0x69, 0x78, 0x65, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x07, 0x52, 0x06, 0x66, + 0x69, 0x78, 0x65, 0x64, 0x73, 0x22, 0x43, 0x0a, 0x08, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4f, 0x6c, + 0x64, 0x12, 0x24, 0x0a, 0x01, 0x67, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0a, 0x32, 0x16, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4f, + 0x6c, 0x64, 0x2e, 0x47, 0x52, 0x01, 0x67, 0x1a, 0x11, 0x0a, 0x01, 0x47, 0x12, 0x0c, 0x0a, 0x01, + 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x22, 0x51, 0x0a, 0x08, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x4e, 0x65, 0x77, 0x12, 0x24, 0x0a, 0x01, 0x67, 0x18, 0x65, 0x20, 0x01, 0x28, + 0x0a, 0x32, 0x16, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x65, 0x77, 0x2e, 0x47, 0x52, 0x01, 0x67, 0x1a, 0x1f, 0x0a, 0x01, + 0x47, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, + 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0x33, 0x0a, + 0x0d, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x0c, + 0x0a, 0x01, 0x66, 0x18, 0x01, 0x20, 0x02, 0x28, 0x01, 0x52, 0x01, 0x66, 0x12, 0x14, 0x0a, 0x05, + 0x65, 0x78, 0x61, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x65, 0x78, 0x61, + 0x63, 0x74, 0x22, 0xdc, 0x04, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, + 0x74, 0x68, 0x4d, 0x61, 0x70, 0x12, 0x4e, 0x0a, 0x0c, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x6d, 0x61, + 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x57, 0x69, 0x74, 0x68, 0x4d, 0x61, 0x70, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x70, 0x70, + 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x4d, 0x61, + 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x73, 0x67, 0x5f, 0x6d, 0x61, 0x70, + 0x70, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, + 0x69, 0x74, 0x68, 0x4d, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, + 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x6d, 0x73, 0x67, 0x4d, 0x61, 0x70, 0x70, 0x69, + 0x6e, 0x67, 0x12, 0x4e, 0x0a, 0x0c, 0x62, 0x79, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, + 0x6e, 0x67, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, + 0x68, 0x4d, 0x61, 0x70, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, + 0x6e, 0x67, 0x12, 0x46, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x5f, 0x74, 0x6f, 0x5f, 0x73, 0x74, 0x72, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4d, + 0x61, 0x70, 0x2e, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x53, 0x74, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x08, 0x73, 0x74, 0x72, 0x54, 0x6f, 0x53, 0x74, 0x72, 0x1a, 0x3e, 0x0a, 0x10, 0x4e, 0x61, + 0x6d, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x58, 0x0a, 0x0f, 0x4d, 0x73, + 0x67, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x12, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x2f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x6c, 0x6f, 0x61, + 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x42, 0x79, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x70, + 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x53, 0x74, 0x72, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x22, 0x8b, 0x05, 0x0a, 0x05, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x17, 0x0a, 0x06, 0x46, + 0x5f, 0x42, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x05, 0x46, + 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x19, 0x0a, 0x07, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x06, 0x46, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, + 0x19, 0x0a, 0x07, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, + 0x48, 0x00, 0x52, 0x06, 0x46, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1d, 0x0a, 0x09, 0x46, 0x5f, + 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x04, 0x20, 0x01, 0x28, 0x07, 0x48, 0x00, 0x52, + 0x08, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x1d, 0x0a, 0x09, 0x46, 0x5f, 0x46, + 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x18, 0x05, 0x20, 0x01, 0x28, 0x06, 0x48, 0x00, 0x52, 0x08, + 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x1b, 0x0a, 0x08, 0x46, 0x5f, 0x55, 0x69, + 0x6e, 0x74, 0x33, 0x32, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x07, 0x46, 0x55, + 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1b, 0x0a, 0x08, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, + 0x34, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x07, 0x46, 0x55, 0x69, 0x6e, 0x74, + 0x36, 0x34, 0x12, 0x19, 0x0a, 0x07, 0x46, 0x5f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x02, 0x48, 0x00, 0x52, 0x06, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x1b, 0x0a, + 0x08, 0x46, 0x5f, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x48, + 0x00, 0x52, 0x07, 0x46, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x08, 0x46, 0x5f, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, + 0x46, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x19, 0x0a, 0x07, 0x46, 0x5f, 0x42, 0x79, 0x74, + 0x65, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x06, 0x46, 0x42, 0x79, 0x74, + 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x08, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x11, 0x48, 0x00, 0x52, 0x07, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, + 0x1b, 0x0a, 0x08, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x0d, 0x20, 0x01, 0x28, + 0x12, 0x48, 0x00, 0x52, 0x07, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x34, 0x0a, 0x06, + 0x46, 0x5f, 0x45, 0x6e, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x05, 0x46, 0x45, 0x6e, + 0x75, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x46, 0x5f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x00, + 0x52, 0x08, 0x46, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x66, 0x5f, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0a, 0x32, 0x19, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x46, + 0x5f, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x48, 0x00, 0x52, 0x06, 0x66, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x12, 0x28, 0x0a, 0x0d, 0x46, 0x5f, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x73, 0x74, 0x5f, 0x54, 0x61, + 0x67, 0x18, 0xff, 0xff, 0xff, 0xff, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x0b, 0x46, + 0x4c, 0x61, 0x72, 0x67, 0x65, 0x73, 0x74, 0x54, 0x61, 0x67, 0x12, 0x16, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x1a, 0x17, 0x0a, 0x07, 0x46, 0x5f, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x0c, 0x0a, + 0x01, 0x78, 0x18, 0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x42, 0x07, 0x0a, 0x05, 0x75, + 0x6e, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x74, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x6f, 0x22, + 0xee, 0x01, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x12, 0x1e, + 0x0a, 0x0b, 0x6d, 0x61, 0x6b, 0x65, 0x5f, 0x6d, 0x65, 0x5f, 0x63, 0x72, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x09, 0x6d, 0x61, 0x6b, 0x65, 0x4d, 0x65, 0x43, 0x72, 0x79, 0x12, 0x18, + 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, + 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, + 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x17, 0x0a, 0x06, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x63, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x05, 0x74, 0x65, 0x6d, 0x70, 0x43, 0x12, 0x2f, 0x0a, + 0x03, 0x63, 0x6f, 0x6c, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x03, 0x63, 0x6f, 0x6c, 0x12, 0x27, + 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, + 0x48, 0x00, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x42, 0x07, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x6f, 0x6e, + 0x22, 0xcf, 0x02, 0x0a, 0x08, 0x54, 0x65, 0x73, 0x74, 0x55, 0x54, 0x46, 0x38, 0x12, 0x16, 0x0a, + 0x06, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, + 0x63, 0x61, 0x6c, 0x61, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x16, 0x0a, + 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x39, 0x0a, 0x07, 0x6d, 0x61, 0x70, 0x5f, 0x6b, 0x65, 0x79, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x55, 0x54, 0x46, 0x38, 0x2e, 0x4d, 0x61, 0x70, + 0x4b, 0x65, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6d, 0x61, 0x70, 0x4b, 0x65, 0x79, + 0x12, 0x3f, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x54, 0x65, 0x73, 0x74, 0x55, 0x54, 0x46, 0x38, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x1a, 0x39, 0x0a, 0x0b, 0x4d, 0x61, 0x70, 0x4b, 0x65, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, + 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, + 0x6f, 0x66, 0x2a, 0x0f, 0x0a, 0x03, 0x46, 0x4f, 0x4f, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x4f, 0x4f, + 0x31, 0x10, 0x01, 0x3a, 0x31, 0x0a, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x12, + 0x15, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x6a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, + 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x3a, 0x51, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, + 0x78, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, + 0x74, 0x68, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xc8, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x3a, 0x54, 0x0a, 0x09, 0x72, 0x5f, 0x63, + 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x18, 0xc9, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x45, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x3a, + 0x47, 0x0a, 0x11, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x64, 0x6f, + 0x75, 0x62, 0x6c, 0x65, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x18, 0x65, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0f, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x3a, 0x45, 0x0a, 0x10, 0x6e, 0x6f, 0x5f, 0x64, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x1b, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x66, 0x20, 0x01, 0x28, 0x02, 0x52, + 0x0e, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x3a, + 0x45, 0x0a, 0x10, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x69, 0x6e, + 0x74, 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x18, 0x67, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x3a, 0x45, 0x0a, 0x10, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x68, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x6e, + 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x3a, 0x47, 0x0a, + 0x11, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x75, 0x69, 0x6e, 0x74, + 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x69, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x3a, 0x47, 0x0a, 0x11, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x6a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, + 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x3a, + 0x47, 0x0a, 0x11, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x69, + 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x11, 0x52, 0x0f, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x3a, 0x47, 0x0a, 0x11, 0x6e, 0x6f, 0x5f, 0x64, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1b, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x6c, 0x20, 0x01, 0x28, 0x12, + 0x52, 0x0f, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x69, 0x6e, 0x74, 0x36, + 0x34, 0x3a, 0x49, 0x0a, 0x12, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, + 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x18, 0x6d, 0x20, 0x01, 0x28, 0x07, 0x52, 0x10, 0x6e, 0x6f, 0x44, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x3a, 0x49, 0x0a, 0x12, + 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, + 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x6e, 0x20, 0x01, 0x28, 0x06, 0x52, 0x10, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x3a, 0x4b, 0x0a, 0x13, 0x6e, 0x6f, 0x5f, 0x64, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x1b, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, + 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x6f, 0x20, 0x01, 0x28, + 0x0f, 0x52, 0x11, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x66, 0x69, 0x78, + 0x65, 0x64, 0x33, 0x32, 0x3a, 0x4b, 0x0a, 0x13, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x5f, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x70, 0x20, 0x01, 0x28, 0x10, 0x52, 0x11, + 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, + 0x34, 0x3a, 0x43, 0x0a, 0x0f, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, + 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x18, 0x71, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x42, 0x6f, 0x6f, 0x6c, 0x3a, 0x47, 0x0a, 0x11, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x1b, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x72, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, + 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3a, + 0x45, 0x0a, 0x10, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x62, 0x79, + 0x74, 0x65, 0x73, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x18, 0x73, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x3a, 0x6d, 0x0a, 0x0f, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x74, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x73, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x0d, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x45, 0x6e, 0x75, 0x6d, 0x3a, 0x4b, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x18, 0xc9, 0x01, 0x20, 0x01, 0x28, 0x01, 0x3a, 0x06, 0x33, 0x2e, 0x31, + 0x34, 0x31, 0x35, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x6f, 0x75, 0x62, + 0x6c, 0x65, 0x3a, 0x47, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x6c, + 0x6f, 0x61, 0x74, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x18, 0xca, 0x01, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x04, 0x33, 0x2e, 0x31, 0x34, 0x52, 0x0c, 0x64, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x3a, 0x45, 0x0a, 0x0d, 0x64, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xcb, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x3a, 0x02, 0x34, 0x32, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x49, 0x6e, 0x74, + 0x33, 0x32, 0x3a, 0x45, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x69, 0x6e, + 0x74, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x18, 0xcc, 0x01, 0x20, 0x01, 0x28, 0x03, 0x3a, 0x02, 0x34, 0x33, 0x52, 0x0c, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x3a, 0x47, 0x0a, 0x0e, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xcd, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x3a, + 0x02, 0x34, 0x34, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x55, 0x69, 0x6e, 0x74, + 0x33, 0x32, 0x3a, 0x47, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x75, 0x69, + 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x18, 0xce, 0x01, 0x20, 0x01, 0x28, 0x04, 0x3a, 0x02, 0x34, 0x35, 0x52, 0x0d, 0x64, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x3a, 0x47, 0x0a, 0x0e, 0x64, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1b, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xcf, 0x01, 0x20, 0x01, 0x28, + 0x11, 0x3a, 0x02, 0x34, 0x36, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x69, + 0x6e, 0x74, 0x33, 0x32, 0x3a, 0x47, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, + 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0xd0, 0x01, 0x20, 0x01, 0x28, 0x12, 0x3a, 0x02, 0x34, 0x37, 0x52, 0x0d, + 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x3a, 0x49, 0x0a, + 0x0f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, + 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xd1, 0x01, + 0x20, 0x01, 0x28, 0x07, 0x3a, 0x02, 0x34, 0x38, 0x52, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x3a, 0x49, 0x0a, 0x0f, 0x64, 0x65, 0x66, 0x61, + 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xd2, 0x01, 0x20, 0x01, 0x28, 0x06, 0x3a, + 0x02, 0x34, 0x39, 0x52, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x46, 0x69, 0x78, 0x65, + 0x64, 0x36, 0x34, 0x3a, 0x4b, 0x0a, 0x10, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, + 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x18, 0xd3, 0x01, 0x20, 0x01, 0x28, 0x0f, 0x3a, 0x02, 0x35, 0x30, 0x52, + 0x0f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, + 0x3a, 0x4b, 0x0a, 0x10, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x66, 0x69, 0x78, + 0x65, 0x64, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x18, 0xd4, 0x01, 0x20, 0x01, 0x28, 0x10, 0x3a, 0x02, 0x35, 0x31, 0x52, 0x0f, 0x64, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x3a, 0x45, 0x0a, + 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x1b, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xd5, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x3a, 0x04, 0x74, 0x72, 0x75, 0x65, 0x52, 0x0b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x42, 0x6f, 0x6f, 0x6c, 0x3a, 0x5a, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, + 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0xd6, 0x01, 0x20, 0x01, 0x28, 0x09, 0x3a, 0x15, 0x48, 0x65, 0x6c, 0x6c, + 0x6f, 0x2c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2c, 0x64, 0x65, 0x66, 0x3d, 0x66, 0x6f, + 0x6f, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x3a, 0x4f, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, + 0x73, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xd7, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x3a, 0x0c, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x62, 0x79, + 0x74, 0x65, 0x73, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x42, 0x79, 0x74, 0x65, + 0x73, 0x3a, 0x6e, 0x0a, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x65, 0x6e, 0x75, + 0x6d, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xd8, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x45, 0x6e, 0x75, 0x6d, 0x3a, + 0x03, 0x4f, 0x4e, 0x45, 0x52, 0x0b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x45, 0x6e, 0x75, + 0x6d, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, 0x31, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x53, 0x65, 0x74, 0x18, 0xc9, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, + 0x32, 0x30, 0x31, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, 0x32, 0x12, 0x18, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xca, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, + 0x04, 0x78, 0x32, 0x30, 0x32, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, 0x33, 0x12, 0x18, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xcb, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x52, 0x04, 0x78, 0x32, 0x30, 0x33, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, 0x34, 0x12, + 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xcc, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x30, 0x34, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, + 0x35, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, + 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xcd, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x30, 0x35, 0x3a, 0x40, 0x0a, 0x04, 0x78, + 0x32, 0x30, 0x36, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xce, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x30, 0x36, 0x3a, 0x40, 0x0a, + 0x04, 0x78, 0x32, 0x30, 0x37, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, + 0xcf, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x30, 0x37, 0x3a, + 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, 0x38, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, + 0x74, 0x18, 0xd0, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x30, + 0x38, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, 0x39, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x53, 0x65, 0x74, 0x18, 0xd1, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, + 0x32, 0x30, 0x39, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x30, 0x12, 0x18, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xd2, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, + 0x04, 0x78, 0x32, 0x31, 0x30, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x31, 0x12, 0x18, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xd3, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, 0x31, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x32, 0x12, + 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xd4, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, 0x32, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, + 0x33, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, + 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xd5, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, 0x33, 0x3a, 0x40, 0x0a, 0x04, 0x78, + 0x32, 0x31, 0x34, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xd6, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, 0x34, 0x3a, 0x40, 0x0a, + 0x04, 0x78, 0x32, 0x31, 0x35, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, + 0xd7, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, 0x35, 0x3a, + 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x36, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, + 0x74, 0x18, 0xd8, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, + 0x36, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x37, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x53, 0x65, 0x74, 0x18, 0xd9, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, + 0x32, 0x31, 0x37, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x38, 0x12, 0x18, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xda, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, + 0x04, 0x78, 0x32, 0x31, 0x38, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x39, 0x12, 0x18, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xdb, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, 0x39, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, 0x30, 0x12, + 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xdc, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x30, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, + 0x31, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, + 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xdd, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x31, 0x3a, 0x40, 0x0a, 0x04, 0x78, + 0x32, 0x32, 0x32, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xde, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x32, 0x3a, 0x40, 0x0a, + 0x04, 0x78, 0x32, 0x32, 0x33, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, + 0xdf, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x33, 0x3a, + 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, 0x34, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, + 0x74, 0x18, 0xe0, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, + 0x34, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, 0x35, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x53, 0x65, 0x74, 0x18, 0xe1, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, + 0x32, 0x32, 0x35, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, 0x36, 0x12, 0x18, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xe2, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, + 0x04, 0x78, 0x32, 0x32, 0x36, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, 0x37, 0x12, 0x18, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xe3, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x37, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, 0x38, 0x12, + 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xe4, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x38, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, + 0x39, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, + 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xe5, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x39, 0x3a, 0x40, 0x0a, 0x04, 0x78, + 0x32, 0x33, 0x30, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xe6, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x30, 0x3a, 0x40, 0x0a, + 0x04, 0x78, 0x32, 0x33, 0x31, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, + 0xe7, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x31, 0x3a, + 0x40, 0x0a, 0x04, 0x78, 0x32, 0x33, 0x32, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, + 0x74, 0x18, 0xe8, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, + 0x32, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x33, 0x33, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x53, 0x65, 0x74, 0x18, 0xe9, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, + 0x32, 0x33, 0x33, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x33, 0x34, 0x12, 0x18, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xea, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, + 0x04, 0x78, 0x32, 0x33, 0x34, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x33, 0x35, 0x12, 0x18, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xeb, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x35, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x33, 0x36, 0x12, + 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xec, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x36, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x33, + 0x37, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, + 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xed, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x37, 0x3a, 0x40, 0x0a, 0x04, 0x78, + 0x32, 0x33, 0x38, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xee, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x38, 0x3a, 0x40, 0x0a, + 0x04, 0x78, 0x32, 0x33, 0x39, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, + 0xef, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x39, 0x3a, + 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x30, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, + 0x74, 0x18, 0xf0, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, + 0x30, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x31, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x53, 0x65, 0x74, 0x18, 0xf1, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, + 0x32, 0x34, 0x31, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x32, 0x12, 0x18, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xf2, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, + 0x04, 0x78, 0x32, 0x34, 0x32, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x33, 0x12, 0x18, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xf3, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, 0x33, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x34, 0x12, + 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xf4, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, 0x34, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, + 0x35, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, + 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xf5, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, 0x35, 0x3a, 0x40, 0x0a, 0x04, 0x78, + 0x32, 0x34, 0x36, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xf6, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, 0x36, 0x3a, 0x40, 0x0a, + 0x04, 0x78, 0x32, 0x34, 0x37, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, + 0xf7, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, 0x37, 0x3a, + 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x38, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, + 0x74, 0x18, 0xf8, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, + 0x38, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x39, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x53, 0x65, 0x74, 0x18, 0xf9, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, + 0x32, 0x34, 0x39, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x35, 0x30, 0x12, 0x18, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xfa, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, + 0x04, 0x78, 0x32, 0x35, 0x30, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, +} + +var xxx_File_test_proto_test_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_test_proto_test_proto_rawdesc) diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index 1ded05bbe7..7fb952c6b1 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -4,22 +4,13 @@ package descriptor import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" + protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + prototype "github.com/golang/protobuf/v2/reflect/prototype" + protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" + reflect "reflect" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - type FieldDescriptorProto_Type int32 const ( @@ -54,6 +45,13 @@ const ( FieldDescriptorProto_TYPE_SINT64 FieldDescriptorProto_Type = 18 ) +func (e FieldDescriptorProto_Type) Type() protoreflect.EnumType { + return xxx_File_google_protobuf_descriptor_proto_enumTypes[0] +} +func (e FieldDescriptorProto_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var FieldDescriptorProto_Type_name = map[int32]string{ 1: "TYPE_DOUBLE", 2: "TYPE_FLOAT", @@ -103,11 +101,11 @@ func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type { } func (x FieldDescriptorProto_Type) String() string { - return proto.EnumName(FieldDescriptorProto_Type_name, int32(x)) + return protoapi.EnumName(FieldDescriptorProto_Type_name, int32(x)) } func (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Type_value, data, "FieldDescriptorProto_Type") + value, err := protoapi.UnmarshalJSONEnum(FieldDescriptorProto_Type_value, data, "FieldDescriptorProto_Type") if err != nil { return err } @@ -116,7 +114,7 @@ func (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error { } func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{4, 0} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{4, 0} } type FieldDescriptorProto_Label int32 @@ -128,6 +126,13 @@ const ( FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3 ) +func (e FieldDescriptorProto_Label) Type() protoreflect.EnumType { + return xxx_File_google_protobuf_descriptor_proto_enumTypes[1] +} +func (e FieldDescriptorProto_Label) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var FieldDescriptorProto_Label_name = map[int32]string{ 1: "LABEL_OPTIONAL", 2: "LABEL_REQUIRED", @@ -147,11 +152,11 @@ func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label { } func (x FieldDescriptorProto_Label) String() string { - return proto.EnumName(FieldDescriptorProto_Label_name, int32(x)) + return protoapi.EnumName(FieldDescriptorProto_Label_name, int32(x)) } func (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Label_value, data, "FieldDescriptorProto_Label") + value, err := protoapi.UnmarshalJSONEnum(FieldDescriptorProto_Label_value, data, "FieldDescriptorProto_Label") if err != nil { return err } @@ -160,7 +165,7 @@ func (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error { } func (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{4, 1} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{4, 1} } // Generated classes can be optimized for speed or code size. @@ -173,6 +178,13 @@ const ( FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 ) +func (e FileOptions_OptimizeMode) Type() protoreflect.EnumType { + return xxx_File_google_protobuf_descriptor_proto_enumTypes[2] +} +func (e FileOptions_OptimizeMode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var FileOptions_OptimizeMode_name = map[int32]string{ 1: "SPEED", 2: "CODE_SIZE", @@ -192,11 +204,11 @@ func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode { } func (x FileOptions_OptimizeMode) String() string { - return proto.EnumName(FileOptions_OptimizeMode_name, int32(x)) + return protoapi.EnumName(FileOptions_OptimizeMode_name, int32(x)) } func (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FileOptions_OptimizeMode_value, data, "FileOptions_OptimizeMode") + value, err := protoapi.UnmarshalJSONEnum(FileOptions_OptimizeMode_value, data, "FileOptions_OptimizeMode") if err != nil { return err } @@ -205,7 +217,7 @@ func (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error { } func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{10, 0} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{10, 0} } type FieldOptions_CType int32 @@ -217,6 +229,13 @@ const ( FieldOptions_STRING_PIECE FieldOptions_CType = 2 ) +func (e FieldOptions_CType) Type() protoreflect.EnumType { + return xxx_File_google_protobuf_descriptor_proto_enumTypes[3] +} +func (e FieldOptions_CType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var FieldOptions_CType_name = map[int32]string{ 0: "STRING", 1: "CORD", @@ -236,11 +255,11 @@ func (x FieldOptions_CType) Enum() *FieldOptions_CType { } func (x FieldOptions_CType) String() string { - return proto.EnumName(FieldOptions_CType_name, int32(x)) + return protoapi.EnumName(FieldOptions_CType_name, int32(x)) } func (x *FieldOptions_CType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldOptions_CType_value, data, "FieldOptions_CType") + value, err := protoapi.UnmarshalJSONEnum(FieldOptions_CType_value, data, "FieldOptions_CType") if err != nil { return err } @@ -249,7 +268,7 @@ func (x *FieldOptions_CType) UnmarshalJSON(data []byte) error { } func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{12, 0} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{12, 0} } type FieldOptions_JSType int32 @@ -263,6 +282,13 @@ const ( FieldOptions_JS_NUMBER FieldOptions_JSType = 2 ) +func (e FieldOptions_JSType) Type() protoreflect.EnumType { + return xxx_File_google_protobuf_descriptor_proto_enumTypes[4] +} +func (e FieldOptions_JSType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var FieldOptions_JSType_name = map[int32]string{ 0: "JS_NORMAL", 1: "JS_STRING", @@ -282,11 +308,11 @@ func (x FieldOptions_JSType) Enum() *FieldOptions_JSType { } func (x FieldOptions_JSType) String() string { - return proto.EnumName(FieldOptions_JSType_name, int32(x)) + return protoapi.EnumName(FieldOptions_JSType_name, int32(x)) } func (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldOptions_JSType_value, data, "FieldOptions_JSType") + value, err := protoapi.UnmarshalJSONEnum(FieldOptions_JSType_value, data, "FieldOptions_JSType") if err != nil { return err } @@ -295,7 +321,7 @@ func (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error { } func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{12, 1} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{12, 1} } // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, @@ -309,6 +335,13 @@ const ( MethodOptions_IDEMPOTENT MethodOptions_IdempotencyLevel = 2 ) +func (e MethodOptions_IdempotencyLevel) Type() protoreflect.EnumType { + return xxx_File_google_protobuf_descriptor_proto_enumTypes[5] +} +func (e MethodOptions_IdempotencyLevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var MethodOptions_IdempotencyLevel_name = map[int32]string{ 0: "IDEMPOTENCY_UNKNOWN", 1: "NO_SIDE_EFFECTS", @@ -328,11 +361,11 @@ func (x MethodOptions_IdempotencyLevel) Enum() *MethodOptions_IdempotencyLevel { } func (x MethodOptions_IdempotencyLevel) String() string { - return proto.EnumName(MethodOptions_IdempotencyLevel_name, int32(x)) + return protoapi.EnumName(MethodOptions_IdempotencyLevel_name, int32(x)) } func (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(MethodOptions_IdempotencyLevel_value, data, "MethodOptions_IdempotencyLevel") + value, err := protoapi.UnmarshalJSONEnum(MethodOptions_IdempotencyLevel_value, data, "MethodOptions_IdempotencyLevel") if err != nil { return err } @@ -341,7 +374,7 @@ func (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(data []byte) error { } func (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{17, 0} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{17, 0} } // The protocol compiler can output a FileDescriptorSet containing the .proto @@ -353,30 +386,15 @@ type FileDescriptorSet struct { XXX_sizecache int32 `json:"-"` } +func (m *FileDescriptorSet) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[0].MessageOf(m) +} func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} } -func (m *FileDescriptorSet) String() string { return proto.CompactTextString(m) } +func (m *FileDescriptorSet) String() string { return protoapi.CompactTextString(m) } func (*FileDescriptorSet) ProtoMessage() {} func (*FileDescriptorSet) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{0} -} - -func (m *FileDescriptorSet) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FileDescriptorSet.Unmarshal(m, b) -} -func (m *FileDescriptorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FileDescriptorSet.Marshal(b, m, deterministic) + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{0} } -func (m *FileDescriptorSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileDescriptorSet.Merge(m, src) -} -func (m *FileDescriptorSet) XXX_Size() int { - return xxx_messageInfo_FileDescriptorSet.Size(m) -} -func (m *FileDescriptorSet) XXX_DiscardUnknown() { - xxx_messageInfo_FileDescriptorSet.DiscardUnknown(m) -} - -var xxx_messageInfo_FileDescriptorSet proto.InternalMessageInfo func (m *FileDescriptorSet) GetFile() []*FileDescriptorProto { if m != nil { @@ -415,30 +433,15 @@ type FileDescriptorProto struct { XXX_sizecache int32 `json:"-"` } +func (m *FileDescriptorProto) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[1].MessageOf(m) +} func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} } -func (m *FileDescriptorProto) String() string { return proto.CompactTextString(m) } +func (m *FileDescriptorProto) String() string { return protoapi.CompactTextString(m) } func (*FileDescriptorProto) ProtoMessage() {} func (*FileDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{1} -} - -func (m *FileDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FileDescriptorProto.Unmarshal(m, b) -} -func (m *FileDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FileDescriptorProto.Marshal(b, m, deterministic) + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{1} } -func (m *FileDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileDescriptorProto.Merge(m, src) -} -func (m *FileDescriptorProto) XXX_Size() int { - return xxx_messageInfo_FileDescriptorProto.Size(m) -} -func (m *FileDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_FileDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_FileDescriptorProto proto.InternalMessageInfo func (m *FileDescriptorProto) GetName() string { if m != nil && m.Name != nil { @@ -543,30 +546,15 @@ type DescriptorProto struct { XXX_sizecache int32 `json:"-"` } +func (m *DescriptorProto) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[2].MessageOf(m) +} func (m *DescriptorProto) Reset() { *m = DescriptorProto{} } -func (m *DescriptorProto) String() string { return proto.CompactTextString(m) } +func (m *DescriptorProto) String() string { return protoapi.CompactTextString(m) } func (*DescriptorProto) ProtoMessage() {} func (*DescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{2} -} - -func (m *DescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DescriptorProto.Unmarshal(m, b) -} -func (m *DescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DescriptorProto.Marshal(b, m, deterministic) + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{2} } -func (m *DescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_DescriptorProto.Merge(m, src) -} -func (m *DescriptorProto) XXX_Size() int { - return xxx_messageInfo_DescriptorProto.Size(m) -} -func (m *DescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_DescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_DescriptorProto proto.InternalMessageInfo func (m *DescriptorProto) GetName() string { if m != nil && m.Name != nil { @@ -638,153 +626,33 @@ func (m *DescriptorProto) GetReservedName() []string { return nil } -type DescriptorProto_ExtensionRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} } -func (m *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto_ExtensionRange) ProtoMessage() {} -func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{2, 0} -} - -func (m *DescriptorProto_ExtensionRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DescriptorProto_ExtensionRange.Unmarshal(m, b) -} -func (m *DescriptorProto_ExtensionRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DescriptorProto_ExtensionRange.Marshal(b, m, deterministic) -} -func (m *DescriptorProto_ExtensionRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_DescriptorProto_ExtensionRange.Merge(m, src) -} -func (m *DescriptorProto_ExtensionRange) XXX_Size() int { - return xxx_messageInfo_DescriptorProto_ExtensionRange.Size(m) -} -func (m *DescriptorProto_ExtensionRange) XXX_DiscardUnknown() { - xxx_messageInfo_DescriptorProto_ExtensionRange.DiscardUnknown(m) -} - -var xxx_messageInfo_DescriptorProto_ExtensionRange proto.InternalMessageInfo - -func (m *DescriptorProto_ExtensionRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *DescriptorProto_ExtensionRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -func (m *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions { - if m != nil { - return m.Options - } - return nil -} - -// Range of reserved tag numbers. Reserved tag numbers may not be used by -// fields or extension ranges in the same message. Reserved ranges may -// not overlap. -type DescriptorProto_ReservedRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DescriptorProto_ReservedRange) Reset() { *m = DescriptorProto_ReservedRange{} } -func (m *DescriptorProto_ReservedRange) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto_ReservedRange) ProtoMessage() {} -func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{2, 1} -} - -func (m *DescriptorProto_ReservedRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DescriptorProto_ReservedRange.Unmarshal(m, b) -} -func (m *DescriptorProto_ReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DescriptorProto_ReservedRange.Marshal(b, m, deterministic) -} -func (m *DescriptorProto_ReservedRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_DescriptorProto_ReservedRange.Merge(m, src) -} -func (m *DescriptorProto_ReservedRange) XXX_Size() int { - return xxx_messageInfo_DescriptorProto_ReservedRange.Size(m) -} -func (m *DescriptorProto_ReservedRange) XXX_DiscardUnknown() { - xxx_messageInfo_DescriptorProto_ReservedRange.DiscardUnknown(m) -} - -var xxx_messageInfo_DescriptorProto_ReservedRange proto.InternalMessageInfo - -func (m *DescriptorProto_ReservedRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *DescriptorProto_ReservedRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - type ExtensionRangeOptions struct { // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + protoapi.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } +func (m *ExtensionRangeOptions) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[3].MessageOf(m) +} func (m *ExtensionRangeOptions) Reset() { *m = ExtensionRangeOptions{} } -func (m *ExtensionRangeOptions) String() string { return proto.CompactTextString(m) } +func (m *ExtensionRangeOptions) String() string { return protoapi.CompactTextString(m) } func (*ExtensionRangeOptions) ProtoMessage() {} func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{3} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{3} } -var extRange_ExtensionRangeOptions = []proto.ExtensionRange{ +var extRange_ExtensionRangeOptions = []protoapi.ExtensionRange{ {Start: 1000, End: 536870911}, } -func (*ExtensionRangeOptions) ExtensionRangeArray() []proto.ExtensionRange { +func (*ExtensionRangeOptions) ExtensionRangeArray() []protoapi.ExtensionRange { return extRange_ExtensionRangeOptions } -func (m *ExtensionRangeOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExtensionRangeOptions.Unmarshal(m, b) -} -func (m *ExtensionRangeOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExtensionRangeOptions.Marshal(b, m, deterministic) -} -func (m *ExtensionRangeOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExtensionRangeOptions.Merge(m, src) -} -func (m *ExtensionRangeOptions) XXX_Size() int { - return xxx_messageInfo_ExtensionRangeOptions.Size(m) -} -func (m *ExtensionRangeOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ExtensionRangeOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_ExtensionRangeOptions proto.InternalMessageInfo - func (m *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption { if m != nil { return m.UninterpretedOption @@ -829,31 +697,16 @@ type FieldDescriptorProto struct { XXX_sizecache int32 `json:"-"` } +func (m *FieldDescriptorProto) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[4].MessageOf(m) +} func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} } -func (m *FieldDescriptorProto) String() string { return proto.CompactTextString(m) } +func (m *FieldDescriptorProto) String() string { return protoapi.CompactTextString(m) } func (*FieldDescriptorProto) ProtoMessage() {} func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{4} -} - -func (m *FieldDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FieldDescriptorProto.Unmarshal(m, b) -} -func (m *FieldDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FieldDescriptorProto.Marshal(b, m, deterministic) -} -func (m *FieldDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_FieldDescriptorProto.Merge(m, src) -} -func (m *FieldDescriptorProto) XXX_Size() int { - return xxx_messageInfo_FieldDescriptorProto.Size(m) -} -func (m *FieldDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_FieldDescriptorProto.DiscardUnknown(m) + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{4} } -var xxx_messageInfo_FieldDescriptorProto proto.InternalMessageInfo - func (m *FieldDescriptorProto) GetName() string { if m != nil && m.Name != nil { return *m.Name @@ -933,31 +786,16 @@ type OneofDescriptorProto struct { XXX_sizecache int32 `json:"-"` } +func (m *OneofDescriptorProto) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[5].MessageOf(m) +} func (m *OneofDescriptorProto) Reset() { *m = OneofDescriptorProto{} } -func (m *OneofDescriptorProto) String() string { return proto.CompactTextString(m) } +func (m *OneofDescriptorProto) String() string { return protoapi.CompactTextString(m) } func (*OneofDescriptorProto) ProtoMessage() {} func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{5} -} - -func (m *OneofDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OneofDescriptorProto.Unmarshal(m, b) -} -func (m *OneofDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OneofDescriptorProto.Marshal(b, m, deterministic) -} -func (m *OneofDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_OneofDescriptorProto.Merge(m, src) -} -func (m *OneofDescriptorProto) XXX_Size() int { - return xxx_messageInfo_OneofDescriptorProto.Size(m) -} -func (m *OneofDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_OneofDescriptorProto.DiscardUnknown(m) + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{5} } -var xxx_messageInfo_OneofDescriptorProto proto.InternalMessageInfo - func (m *OneofDescriptorProto) GetName() string { if m != nil && m.Name != nil { return *m.Name @@ -989,31 +827,16 @@ type EnumDescriptorProto struct { XXX_sizecache int32 `json:"-"` } +func (m *EnumDescriptorProto) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[6].MessageOf(m) +} func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} } -func (m *EnumDescriptorProto) String() string { return proto.CompactTextString(m) } +func (m *EnumDescriptorProto) String() string { return protoapi.CompactTextString(m) } func (*EnumDescriptorProto) ProtoMessage() {} func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{6} -} - -func (m *EnumDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumDescriptorProto.Unmarshal(m, b) -} -func (m *EnumDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumDescriptorProto.Marshal(b, m, deterministic) -} -func (m *EnumDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumDescriptorProto.Merge(m, src) -} -func (m *EnumDescriptorProto) XXX_Size() int { - return xxx_messageInfo_EnumDescriptorProto.Size(m) -} -func (m *EnumDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_EnumDescriptorProto.DiscardUnknown(m) + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{6} } -var xxx_messageInfo_EnumDescriptorProto proto.InternalMessageInfo - func (m *EnumDescriptorProto) GetName() string { if m != nil && m.Name != nil { return *m.Name @@ -1049,59 +872,6 @@ func (m *EnumDescriptorProto) GetReservedName() []string { return nil } -// Range of reserved numeric values. Reserved values may not be used by -// entries in the same enum. Reserved ranges may not overlap. -// -// Note that this is distinct from DescriptorProto.ReservedRange in that it -// is inclusive such that it can appropriately represent the entire int32 -// domain. -type EnumDescriptorProto_EnumReservedRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumDescriptorProto_EnumReservedRange) Reset() { *m = EnumDescriptorProto_EnumReservedRange{} } -func (m *EnumDescriptorProto_EnumReservedRange) String() string { return proto.CompactTextString(m) } -func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} -func (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{6, 0} -} - -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Unmarshal(m, b) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Marshal(b, m, deterministic) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Merge(m, src) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Size() int { - return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Size(m) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_DiscardUnknown() { - xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumDescriptorProto_EnumReservedRange proto.InternalMessageInfo - -func (m *EnumDescriptorProto_EnumReservedRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - // Describes a value within an enum. type EnumValueDescriptorProto struct { Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` @@ -1112,31 +882,16 @@ type EnumValueDescriptorProto struct { XXX_sizecache int32 `json:"-"` } +func (m *EnumValueDescriptorProto) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[7].MessageOf(m) +} func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} } -func (m *EnumValueDescriptorProto) String() string { return proto.CompactTextString(m) } +func (m *EnumValueDescriptorProto) String() string { return protoapi.CompactTextString(m) } func (*EnumValueDescriptorProto) ProtoMessage() {} func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{7} -} - -func (m *EnumValueDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumValueDescriptorProto.Unmarshal(m, b) -} -func (m *EnumValueDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumValueDescriptorProto.Marshal(b, m, deterministic) -} -func (m *EnumValueDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumValueDescriptorProto.Merge(m, src) -} -func (m *EnumValueDescriptorProto) XXX_Size() int { - return xxx_messageInfo_EnumValueDescriptorProto.Size(m) -} -func (m *EnumValueDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_EnumValueDescriptorProto.DiscardUnknown(m) + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{7} } -var xxx_messageInfo_EnumValueDescriptorProto proto.InternalMessageInfo - func (m *EnumValueDescriptorProto) GetName() string { if m != nil && m.Name != nil { return *m.Name @@ -1168,31 +923,16 @@ type ServiceDescriptorProto struct { XXX_sizecache int32 `json:"-"` } +func (m *ServiceDescriptorProto) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[8].MessageOf(m) +} func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} } -func (m *ServiceDescriptorProto) String() string { return proto.CompactTextString(m) } +func (m *ServiceDescriptorProto) String() string { return protoapi.CompactTextString(m) } func (*ServiceDescriptorProto) ProtoMessage() {} func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{8} -} - -func (m *ServiceDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ServiceDescriptorProto.Unmarshal(m, b) -} -func (m *ServiceDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ServiceDescriptorProto.Marshal(b, m, deterministic) -} -func (m *ServiceDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceDescriptorProto.Merge(m, src) -} -func (m *ServiceDescriptorProto) XXX_Size() int { - return xxx_messageInfo_ServiceDescriptorProto.Size(m) -} -func (m *ServiceDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceDescriptorProto.DiscardUnknown(m) + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{8} } -var xxx_messageInfo_ServiceDescriptorProto proto.InternalMessageInfo - func (m *ServiceDescriptorProto) GetName() string { if m != nil && m.Name != nil { return *m.Name @@ -1231,31 +971,16 @@ type MethodDescriptorProto struct { XXX_sizecache int32 `json:"-"` } +func (m *MethodDescriptorProto) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[9].MessageOf(m) +} func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} } -func (m *MethodDescriptorProto) String() string { return proto.CompactTextString(m) } +func (m *MethodDescriptorProto) String() string { return protoapi.CompactTextString(m) } func (*MethodDescriptorProto) ProtoMessage() {} func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{9} -} - -func (m *MethodDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MethodDescriptorProto.Unmarshal(m, b) -} -func (m *MethodDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MethodDescriptorProto.Marshal(b, m, deterministic) -} -func (m *MethodDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_MethodDescriptorProto.Merge(m, src) -} -func (m *MethodDescriptorProto) XXX_Size() int { - return xxx_messageInfo_MethodDescriptorProto.Size(m) -} -func (m *MethodDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_MethodDescriptorProto.DiscardUnknown(m) + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{9} } -var xxx_messageInfo_MethodDescriptorProto proto.InternalMessageInfo - const Default_MethodDescriptorProto_ClientStreaming bool = false const Default_MethodDescriptorProto_ServerStreaming bool = false @@ -1385,46 +1110,31 @@ type FileOptions struct { RubyPackage *string `protobuf:"bytes,45,opt,name=ruby_package,json=rubyPackage" json:"ruby_package,omitempty"` // The parser stores options it doesn't recognize here. // See the documentation for the "Options" section above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + protoapi.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } +func (m *FileOptions) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[10].MessageOf(m) +} func (m *FileOptions) Reset() { *m = FileOptions{} } -func (m *FileOptions) String() string { return proto.CompactTextString(m) } +func (m *FileOptions) String() string { return protoapi.CompactTextString(m) } func (*FileOptions) ProtoMessage() {} func (*FileOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{10} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{10} } -var extRange_FileOptions = []proto.ExtensionRange{ +var extRange_FileOptions = []protoapi.ExtensionRange{ {Start: 1000, End: 536870911}, } -func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange { +func (*FileOptions) ExtensionRangeArray() []protoapi.ExtensionRange { return extRange_FileOptions } -func (m *FileOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FileOptions.Unmarshal(m, b) -} -func (m *FileOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FileOptions.Marshal(b, m, deterministic) -} -func (m *FileOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileOptions.Merge(m, src) -} -func (m *FileOptions) XXX_Size() int { - return xxx_messageInfo_FileOptions.Size(m) -} -func (m *FileOptions) XXX_DiscardUnknown() { - xxx_messageInfo_FileOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_FileOptions proto.InternalMessageInfo - const Default_FileOptions_JavaMultipleFiles bool = false const Default_FileOptions_JavaStringCheckUtf8 bool = false const Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED @@ -1635,46 +1345,31 @@ type MessageOptions struct { // parser. MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + protoapi.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } +func (m *MessageOptions) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[11].MessageOf(m) +} func (m *MessageOptions) Reset() { *m = MessageOptions{} } -func (m *MessageOptions) String() string { return proto.CompactTextString(m) } +func (m *MessageOptions) String() string { return protoapi.CompactTextString(m) } func (*MessageOptions) ProtoMessage() {} func (*MessageOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{11} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{11} } -var extRange_MessageOptions = []proto.ExtensionRange{ +var extRange_MessageOptions = []protoapi.ExtensionRange{ {Start: 1000, End: 536870911}, } -func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange { +func (*MessageOptions) ExtensionRangeArray() []protoapi.ExtensionRange { return extRange_MessageOptions } -func (m *MessageOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MessageOptions.Unmarshal(m, b) -} -func (m *MessageOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MessageOptions.Marshal(b, m, deterministic) -} -func (m *MessageOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_MessageOptions.Merge(m, src) -} -func (m *MessageOptions) XXX_Size() int { - return xxx_messageInfo_MessageOptions.Size(m) -} -func (m *MessageOptions) XXX_DiscardUnknown() { - xxx_messageInfo_MessageOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_MessageOptions proto.InternalMessageInfo - const Default_MessageOptions_MessageSetWireFormat bool = false const Default_MessageOptions_NoStandardDescriptorAccessor bool = false const Default_MessageOptions_Deprecated bool = false @@ -1775,46 +1470,31 @@ type FieldOptions struct { // For Google-internal migration only. Do not use. Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + protoapi.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } +func (m *FieldOptions) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[12].MessageOf(m) +} func (m *FieldOptions) Reset() { *m = FieldOptions{} } -func (m *FieldOptions) String() string { return proto.CompactTextString(m) } +func (m *FieldOptions) String() string { return protoapi.CompactTextString(m) } func (*FieldOptions) ProtoMessage() {} func (*FieldOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{12} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{12} } -var extRange_FieldOptions = []proto.ExtensionRange{ +var extRange_FieldOptions = []protoapi.ExtensionRange{ {Start: 1000, End: 536870911}, } -func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange { +func (*FieldOptions) ExtensionRangeArray() []protoapi.ExtensionRange { return extRange_FieldOptions } -func (m *FieldOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FieldOptions.Unmarshal(m, b) -} -func (m *FieldOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FieldOptions.Marshal(b, m, deterministic) -} -func (m *FieldOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_FieldOptions.Merge(m, src) -} -func (m *FieldOptions) XXX_Size() int { - return xxx_messageInfo_FieldOptions.Size(m) -} -func (m *FieldOptions) XXX_DiscardUnknown() { - xxx_messageInfo_FieldOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_FieldOptions proto.InternalMessageInfo - const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING const Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL const Default_FieldOptions_Lazy bool = false @@ -1872,46 +1552,31 @@ func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { type OneofOptions struct { // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + protoapi.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } +func (m *OneofOptions) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[13].MessageOf(m) +} func (m *OneofOptions) Reset() { *m = OneofOptions{} } -func (m *OneofOptions) String() string { return proto.CompactTextString(m) } +func (m *OneofOptions) String() string { return protoapi.CompactTextString(m) } func (*OneofOptions) ProtoMessage() {} func (*OneofOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{13} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{13} } -var extRange_OneofOptions = []proto.ExtensionRange{ +var extRange_OneofOptions = []protoapi.ExtensionRange{ {Start: 1000, End: 536870911}, } -func (*OneofOptions) ExtensionRangeArray() []proto.ExtensionRange { +func (*OneofOptions) ExtensionRangeArray() []protoapi.ExtensionRange { return extRange_OneofOptions } -func (m *OneofOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OneofOptions.Unmarshal(m, b) -} -func (m *OneofOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OneofOptions.Marshal(b, m, deterministic) -} -func (m *OneofOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_OneofOptions.Merge(m, src) -} -func (m *OneofOptions) XXX_Size() int { - return xxx_messageInfo_OneofOptions.Size(m) -} -func (m *OneofOptions) XXX_DiscardUnknown() { - xxx_messageInfo_OneofOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_OneofOptions proto.InternalMessageInfo - func (m *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { if m != nil { return m.UninterpretedOption @@ -1929,46 +1594,31 @@ type EnumOptions struct { // is a formalization for deprecating enums. Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + protoapi.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } +func (m *EnumOptions) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[14].MessageOf(m) +} func (m *EnumOptions) Reset() { *m = EnumOptions{} } -func (m *EnumOptions) String() string { return proto.CompactTextString(m) } +func (m *EnumOptions) String() string { return protoapi.CompactTextString(m) } func (*EnumOptions) ProtoMessage() {} func (*EnumOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{14} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{14} } -var extRange_EnumOptions = []proto.ExtensionRange{ +var extRange_EnumOptions = []protoapi.ExtensionRange{ {Start: 1000, End: 536870911}, } -func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange { +func (*EnumOptions) ExtensionRangeArray() []protoapi.ExtensionRange { return extRange_EnumOptions } -func (m *EnumOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumOptions.Unmarshal(m, b) -} -func (m *EnumOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumOptions.Marshal(b, m, deterministic) -} -func (m *EnumOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumOptions.Merge(m, src) -} -func (m *EnumOptions) XXX_Size() int { - return xxx_messageInfo_EnumOptions.Size(m) -} -func (m *EnumOptions) XXX_DiscardUnknown() { - xxx_messageInfo_EnumOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumOptions proto.InternalMessageInfo - const Default_EnumOptions_Deprecated bool = false func (m *EnumOptions) GetAllowAlias() bool { @@ -1999,46 +1649,31 @@ type EnumValueOptions struct { // this is a formalization for deprecating enum values. Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + protoapi.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } +func (m *EnumValueOptions) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[15].MessageOf(m) +} func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} } -func (m *EnumValueOptions) String() string { return proto.CompactTextString(m) } +func (m *EnumValueOptions) String() string { return protoapi.CompactTextString(m) } func (*EnumValueOptions) ProtoMessage() {} func (*EnumValueOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{15} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{15} } -var extRange_EnumValueOptions = []proto.ExtensionRange{ +var extRange_EnumValueOptions = []protoapi.ExtensionRange{ {Start: 1000, End: 536870911}, } -func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange { +func (*EnumValueOptions) ExtensionRangeArray() []protoapi.ExtensionRange { return extRange_EnumValueOptions } -func (m *EnumValueOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumValueOptions.Unmarshal(m, b) -} -func (m *EnumValueOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumValueOptions.Marshal(b, m, deterministic) -} -func (m *EnumValueOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumValueOptions.Merge(m, src) -} -func (m *EnumValueOptions) XXX_Size() int { - return xxx_messageInfo_EnumValueOptions.Size(m) -} -func (m *EnumValueOptions) XXX_DiscardUnknown() { - xxx_messageInfo_EnumValueOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumValueOptions proto.InternalMessageInfo - const Default_EnumValueOptions_Deprecated bool = false func (m *EnumValueOptions) GetDeprecated() bool { @@ -2062,46 +1697,31 @@ type ServiceOptions struct { // this is a formalization for deprecating services. Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + protoapi.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } +func (m *ServiceOptions) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[16].MessageOf(m) +} func (m *ServiceOptions) Reset() { *m = ServiceOptions{} } -func (m *ServiceOptions) String() string { return proto.CompactTextString(m) } +func (m *ServiceOptions) String() string { return protoapi.CompactTextString(m) } func (*ServiceOptions) ProtoMessage() {} func (*ServiceOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{16} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{16} } -var extRange_ServiceOptions = []proto.ExtensionRange{ +var extRange_ServiceOptions = []protoapi.ExtensionRange{ {Start: 1000, End: 536870911}, } -func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange { +func (*ServiceOptions) ExtensionRangeArray() []protoapi.ExtensionRange { return extRange_ServiceOptions } -func (m *ServiceOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ServiceOptions.Unmarshal(m, b) -} -func (m *ServiceOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ServiceOptions.Marshal(b, m, deterministic) -} -func (m *ServiceOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceOptions.Merge(m, src) -} -func (m *ServiceOptions) XXX_Size() int { - return xxx_messageInfo_ServiceOptions.Size(m) -} -func (m *ServiceOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceOptions proto.InternalMessageInfo - const Default_ServiceOptions_Deprecated bool = false func (m *ServiceOptions) GetDeprecated() bool { @@ -2126,46 +1746,31 @@ type MethodOptions struct { Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"` // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + protoapi.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } +func (m *MethodOptions) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[17].MessageOf(m) +} func (m *MethodOptions) Reset() { *m = MethodOptions{} } -func (m *MethodOptions) String() string { return proto.CompactTextString(m) } +func (m *MethodOptions) String() string { return protoapi.CompactTextString(m) } func (*MethodOptions) ProtoMessage() {} func (*MethodOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{17} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{17} } -var extRange_MethodOptions = []proto.ExtensionRange{ +var extRange_MethodOptions = []protoapi.ExtensionRange{ {Start: 1000, End: 536870911}, } -func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange { +func (*MethodOptions) ExtensionRangeArray() []protoapi.ExtensionRange { return extRange_MethodOptions } -func (m *MethodOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MethodOptions.Unmarshal(m, b) -} -func (m *MethodOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MethodOptions.Marshal(b, m, deterministic) -} -func (m *MethodOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_MethodOptions.Merge(m, src) -} -func (m *MethodOptions) XXX_Size() int { - return xxx_messageInfo_MethodOptions.Size(m) -} -func (m *MethodOptions) XXX_DiscardUnknown() { - xxx_messageInfo_MethodOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_MethodOptions proto.InternalMessageInfo - const Default_MethodOptions_Deprecated bool = false const Default_MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN @@ -2211,30 +1816,15 @@ type UninterpretedOption struct { XXX_sizecache int32 `json:"-"` } +func (m *UninterpretedOption) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[18].MessageOf(m) +} func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} } -func (m *UninterpretedOption) String() string { return proto.CompactTextString(m) } +func (m *UninterpretedOption) String() string { return protoapi.CompactTextString(m) } func (*UninterpretedOption) ProtoMessage() {} func (*UninterpretedOption) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{18} -} - -func (m *UninterpretedOption) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UninterpretedOption.Unmarshal(m, b) -} -func (m *UninterpretedOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UninterpretedOption.Marshal(b, m, deterministic) + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{18} } -func (m *UninterpretedOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_UninterpretedOption.Merge(m, src) -} -func (m *UninterpretedOption) XXX_Size() int { - return xxx_messageInfo_UninterpretedOption.Size(m) -} -func (m *UninterpretedOption) XXX_DiscardUnknown() { - xxx_messageInfo_UninterpretedOption.DiscardUnknown(m) -} - -var xxx_messageInfo_UninterpretedOption proto.InternalMessageInfo func (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart { if m != nil { @@ -2285,58 +1875,6 @@ func (m *UninterpretedOption) GetAggregateValue() string { return "" } -// The name of the uninterpreted option. Each string represents a segment in -// a dot-separated name. is_extension is true iff a segment represents an -// extension (denoted with parentheses in options specs in .proto files). -// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents -// "foo.(bar.baz).qux". -type UninterpretedOption_NamePart struct { - NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` - IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} } -func (m *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(m) } -func (*UninterpretedOption_NamePart) ProtoMessage() {} -func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{18, 0} -} - -func (m *UninterpretedOption_NamePart) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UninterpretedOption_NamePart.Unmarshal(m, b) -} -func (m *UninterpretedOption_NamePart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UninterpretedOption_NamePart.Marshal(b, m, deterministic) -} -func (m *UninterpretedOption_NamePart) XXX_Merge(src proto.Message) { - xxx_messageInfo_UninterpretedOption_NamePart.Merge(m, src) -} -func (m *UninterpretedOption_NamePart) XXX_Size() int { - return xxx_messageInfo_UninterpretedOption_NamePart.Size(m) -} -func (m *UninterpretedOption_NamePart) XXX_DiscardUnknown() { - xxx_messageInfo_UninterpretedOption_NamePart.DiscardUnknown(m) -} - -var xxx_messageInfo_UninterpretedOption_NamePart proto.InternalMessageInfo - -func (m *UninterpretedOption_NamePart) GetNamePart() string { - if m != nil && m.NamePart != nil { - return *m.NamePart - } - return "" -} - -func (m *UninterpretedOption_NamePart) GetIsExtension() bool { - if m != nil && m.IsExtension != nil { - return *m.IsExtension - } - return false -} - // Encapsulates information about the original source file from which a // FileDescriptorProto was generated. type SourceCodeInfo struct { @@ -2389,38 +1927,202 @@ type SourceCodeInfo struct { XXX_sizecache int32 `json:"-"` } +func (m *SourceCodeInfo) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[19].MessageOf(m) +} func (m *SourceCodeInfo) Reset() { *m = SourceCodeInfo{} } -func (m *SourceCodeInfo) String() string { return proto.CompactTextString(m) } +func (m *SourceCodeInfo) String() string { return protoapi.CompactTextString(m) } func (*SourceCodeInfo) ProtoMessage() {} func (*SourceCodeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{19} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{19} } -func (m *SourceCodeInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SourceCodeInfo.Unmarshal(m, b) +func (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { + if m != nil { + return m.Location + } + return nil } -func (m *SourceCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SourceCodeInfo.Marshal(b, m, deterministic) + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +type GeneratedCodeInfo struct { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *SourceCodeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_SourceCodeInfo.Merge(m, src) + +func (m *GeneratedCodeInfo) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[20].MessageOf(m) } -func (m *SourceCodeInfo) XXX_Size() int { - return xxx_messageInfo_SourceCodeInfo.Size(m) +func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } +func (m *GeneratedCodeInfo) String() string { return protoapi.CompactTextString(m) } +func (*GeneratedCodeInfo) ProtoMessage() {} +func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{20} } -func (m *SourceCodeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_SourceCodeInfo.DiscardUnknown(m) + +func (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { + if m != nil { + return m.Annotation + } + return nil } -var xxx_messageInfo_SourceCodeInfo proto.InternalMessageInfo +type DescriptorProto_ExtensionRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} -func (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { +func (m *DescriptorProto_ExtensionRange) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[21].MessageOf(m) +} +func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} } +func (m *DescriptorProto_ExtensionRange) String() string { return protoapi.CompactTextString(m) } +func (*DescriptorProto_ExtensionRange) ProtoMessage() {} +func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{2, 0} +} + +func (m *DescriptorProto_ExtensionRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *DescriptorProto_ExtensionRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +func (m *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions { if m != nil { - return m.Location + return m.Options } return nil } +// Range of reserved tag numbers. Reserved tag numbers may not be used by +// fields or extension ranges in the same message. Reserved ranges may +// not overlap. +type DescriptorProto_ReservedRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto_ReservedRange) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[22].MessageOf(m) +} +func (m *DescriptorProto_ReservedRange) Reset() { *m = DescriptorProto_ReservedRange{} } +func (m *DescriptorProto_ReservedRange) String() string { return protoapi.CompactTextString(m) } +func (*DescriptorProto_ReservedRange) ProtoMessage() {} +func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{2, 1} +} + +func (m *DescriptorProto_ReservedRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *DescriptorProto_ReservedRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +// Range of reserved numeric values. Reserved values may not be used by +// entries in the same enum. Reserved ranges may not overlap. +// +// Note that this is distinct from DescriptorProto.ReservedRange in that it +// is inclusive such that it can appropriately represent the entire int32 +// domain. +type EnumDescriptorProto_EnumReservedRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumDescriptorProto_EnumReservedRange) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[23].MessageOf(m) +} +func (m *EnumDescriptorProto_EnumReservedRange) Reset() { *m = EnumDescriptorProto_EnumReservedRange{} } +func (m *EnumDescriptorProto_EnumReservedRange) String() string { return protoapi.CompactTextString(m) } +func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} +func (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) { + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{6, 0} +} + +func (m *EnumDescriptorProto_EnumReservedRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +// The name of the uninterpreted option. Each string represents a segment in +// a dot-separated name. is_extension is true iff a segment represents an +// extension (denoted with parentheses in options specs in .proto files). +// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents +// "foo.(bar.baz).qux". +type UninterpretedOption_NamePart struct { + NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` + IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UninterpretedOption_NamePart) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[24].MessageOf(m) +} +func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} } +func (m *UninterpretedOption_NamePart) String() string { return protoapi.CompactTextString(m) } +func (*UninterpretedOption_NamePart) ProtoMessage() {} +func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{18, 0} +} + +func (m *UninterpretedOption_NamePart) GetNamePart() string { + if m != nil && m.NamePart != nil { + return *m.NamePart + } + return "" +} + +func (m *UninterpretedOption_NamePart) GetIsExtension() bool { + if m != nil && m.IsExtension != nil { + return *m.IsExtension + } + return false +} + type SourceCodeInfo_Location struct { // Identifies which part of the FileDescriptorProto was defined at this // location. @@ -2507,31 +2209,16 @@ type SourceCodeInfo_Location struct { XXX_sizecache int32 `json:"-"` } +func (m *SourceCodeInfo_Location) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[25].MessageOf(m) +} func (m *SourceCodeInfo_Location) Reset() { *m = SourceCodeInfo_Location{} } -func (m *SourceCodeInfo_Location) String() string { return proto.CompactTextString(m) } +func (m *SourceCodeInfo_Location) String() string { return protoapi.CompactTextString(m) } func (*SourceCodeInfo_Location) ProtoMessage() {} func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{19, 0} + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{19, 0} } -func (m *SourceCodeInfo_Location) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SourceCodeInfo_Location.Unmarshal(m, b) -} -func (m *SourceCodeInfo_Location) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SourceCodeInfo_Location.Marshal(b, m, deterministic) -} -func (m *SourceCodeInfo_Location) XXX_Merge(src proto.Message) { - xxx_messageInfo_SourceCodeInfo_Location.Merge(m, src) -} -func (m *SourceCodeInfo_Location) XXX_Size() int { - return xxx_messageInfo_SourceCodeInfo_Location.Size(m) -} -func (m *SourceCodeInfo_Location) XXX_DiscardUnknown() { - xxx_messageInfo_SourceCodeInfo_Location.DiscardUnknown(m) -} - -var xxx_messageInfo_SourceCodeInfo_Location proto.InternalMessageInfo - func (m *SourceCodeInfo_Location) GetPath() []int32 { if m != nil { return m.Path @@ -2567,50 +2254,6 @@ func (m *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { return nil } -// Describes the relationship between generated code and its original source -// file. A GeneratedCodeInfo message is associated with only one generated -// source file, but may contain references to different source .proto files. -type GeneratedCodeInfo struct { - // An Annotation connects some span of text in generated code to an element - // of its generating .proto file. - Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } -func (m *GeneratedCodeInfo) String() string { return proto.CompactTextString(m) } -func (*GeneratedCodeInfo) ProtoMessage() {} -func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{20} -} - -func (m *GeneratedCodeInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GeneratedCodeInfo.Unmarshal(m, b) -} -func (m *GeneratedCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GeneratedCodeInfo.Marshal(b, m, deterministic) -} -func (m *GeneratedCodeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_GeneratedCodeInfo.Merge(m, src) -} -func (m *GeneratedCodeInfo) XXX_Size() int { - return xxx_messageInfo_GeneratedCodeInfo.Size(m) -} -func (m *GeneratedCodeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_GeneratedCodeInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_GeneratedCodeInfo proto.InternalMessageInfo - -func (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { - if m != nil { - return m.Annotation - } - return nil -} - type GeneratedCodeInfo_Annotation struct { // Identifies the element in the original source .proto file. This field // is formatted the same as SourceCodeInfo.Location.path. @@ -2629,30 +2272,15 @@ type GeneratedCodeInfo_Annotation struct { XXX_sizecache int32 `json:"-"` } +func (m *GeneratedCodeInfo_Annotation) ProtoReflect() protoreflect.Message { + return xxx_File_google_protobuf_descriptor_proto_messageTypes[26].MessageOf(m) +} func (m *GeneratedCodeInfo_Annotation) Reset() { *m = GeneratedCodeInfo_Annotation{} } -func (m *GeneratedCodeInfo_Annotation) String() string { return proto.CompactTextString(m) } +func (m *GeneratedCodeInfo_Annotation) String() string { return protoapi.CompactTextString(m) } func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { - return fileDescriptor_e5baabe45344a177, []int{20, 0} -} - -func (m *GeneratedCodeInfo_Annotation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GeneratedCodeInfo_Annotation.Unmarshal(m, b) -} -func (m *GeneratedCodeInfo_Annotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GeneratedCodeInfo_Annotation.Marshal(b, m, deterministic) + return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{20, 0} } -func (m *GeneratedCodeInfo_Annotation) XXX_Merge(src proto.Message) { - xxx_messageInfo_GeneratedCodeInfo_Annotation.Merge(m, src) -} -func (m *GeneratedCodeInfo_Annotation) XXX_Size() int { - return xxx_messageInfo_GeneratedCodeInfo_Annotation.Size(m) -} -func (m *GeneratedCodeInfo_Annotation) XXX_DiscardUnknown() { - xxx_messageInfo_GeneratedCodeInfo_Annotation.DiscardUnknown(m) -} - -var xxx_messageInfo_GeneratedCodeInfo_Annotation proto.InternalMessageInfo func (m *GeneratedCodeInfo_Annotation) GetPath() []int32 { if m != nil { @@ -2683,205 +2311,636 @@ func (m *GeneratedCodeInfo_Annotation) GetEnd() int32 { } func init() { - proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value) - proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value) - proto.RegisterEnum("google.protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value) - proto.RegisterEnum("google.protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value) - proto.RegisterEnum("google.protobuf.FieldOptions_JSType", FieldOptions_JSType_name, FieldOptions_JSType_value) - proto.RegisterEnum("google.protobuf.MethodOptions_IdempotencyLevel", MethodOptions_IdempotencyLevel_name, MethodOptions_IdempotencyLevel_value) - proto.RegisterType((*FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") - proto.RegisterType((*FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") - proto.RegisterType((*DescriptorProto)(nil), "google.protobuf.DescriptorProto") - proto.RegisterType((*DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") - proto.RegisterType((*DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") - proto.RegisterType((*ExtensionRangeOptions)(nil), "google.protobuf.ExtensionRangeOptions") - proto.RegisterType((*FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") - proto.RegisterType((*OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") - proto.RegisterType((*EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") - proto.RegisterType((*EnumDescriptorProto_EnumReservedRange)(nil), "google.protobuf.EnumDescriptorProto.EnumReservedRange") - proto.RegisterType((*EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") - proto.RegisterType((*ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") - proto.RegisterType((*MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") - proto.RegisterType((*FileOptions)(nil), "google.protobuf.FileOptions") - proto.RegisterType((*MessageOptions)(nil), "google.protobuf.MessageOptions") - proto.RegisterType((*FieldOptions)(nil), "google.protobuf.FieldOptions") - proto.RegisterType((*OneofOptions)(nil), "google.protobuf.OneofOptions") - proto.RegisterType((*EnumOptions)(nil), "google.protobuf.EnumOptions") - proto.RegisterType((*EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") - proto.RegisterType((*ServiceOptions)(nil), "google.protobuf.ServiceOptions") - proto.RegisterType((*MethodOptions)(nil), "google.protobuf.MethodOptions") - proto.RegisterType((*UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") - proto.RegisterType((*UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") - proto.RegisterType((*SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") - proto.RegisterType((*SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") - proto.RegisterType((*GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") - proto.RegisterType((*GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") -} - -func init() { proto.RegisterFile("google/protobuf/descriptor.proto", fileDescriptor_e5baabe45344a177) } - -var fileDescriptor_e5baabe45344a177 = []byte{ - // 2589 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xdd, 0x8e, 0xdb, 0xc6, - 0x15, 0x0e, 0xf5, 0xb7, 0xd2, 0x91, 0x56, 0x3b, 0x3b, 0xbb, 0xb1, 0xe9, 0xcd, 0x8f, 0xd7, 0xca, - 0x8f, 0xd7, 0x4e, 0xac, 0x0d, 0x1c, 0xdb, 0x71, 0xd6, 0x45, 0x5a, 0xad, 0x44, 0x6f, 0xe4, 0xee, - 0x4a, 0x2a, 0xa5, 0x6d, 0x7e, 0x80, 0x82, 0x98, 0x25, 0x47, 0x12, 0x6d, 0x8a, 0x64, 0x48, 0xca, - 0xf6, 0x06, 0xbd, 0x30, 0xd0, 0xab, 0x5e, 0x15, 0xe8, 0x55, 0x51, 0x14, 0xbd, 0xe8, 0x4d, 0x80, - 0x3e, 0x40, 0x81, 0xde, 0xf5, 0x09, 0x0a, 0xe4, 0x0d, 0x8a, 0xb6, 0x40, 0xfb, 0x08, 0xbd, 0x2c, - 0x66, 0x86, 0xa4, 0x48, 0x49, 0x1b, 0x6f, 0x02, 0xc4, 0xb9, 0x92, 0xe6, 0x3b, 0xdf, 0x39, 0x73, - 0xe6, 0xcc, 0x99, 0x99, 0x33, 0x43, 0xd8, 0x1e, 0x39, 0xce, 0xc8, 0xa2, 0xbb, 0xae, 0xe7, 0x04, - 0xce, 0xc9, 0x74, 0xb8, 0x6b, 0x50, 0x5f, 0xf7, 0x4c, 0x37, 0x70, 0xbc, 0x3a, 0xc7, 0xf0, 0x9a, - 0x60, 0xd4, 0x23, 0x46, 0xed, 0x08, 0xd6, 0xef, 0x9b, 0x16, 0x6d, 0xc5, 0xc4, 0x3e, 0x0d, 0xf0, - 0x5d, 0xc8, 0x0d, 0x4d, 0x8b, 0xca, 0xd2, 0x76, 0x76, 0xa7, 0x7c, 0xf3, 0xcd, 0xfa, 0x9c, 0x52, - 0x3d, 0xad, 0xd1, 0x63, 0xb0, 0xca, 0x35, 0x6a, 0xff, 0xce, 0xc1, 0xc6, 0x12, 0x29, 0xc6, 0x90, - 0xb3, 0xc9, 0x84, 0x59, 0x94, 0x76, 0x4a, 0x2a, 0xff, 0x8f, 0x65, 0x58, 0x71, 0x89, 0xfe, 0x88, - 0x8c, 0xa8, 0x9c, 0xe1, 0x70, 0xd4, 0xc4, 0xaf, 0x03, 0x18, 0xd4, 0xa5, 0xb6, 0x41, 0x6d, 0xfd, - 0x54, 0xce, 0x6e, 0x67, 0x77, 0x4a, 0x6a, 0x02, 0xc1, 0xef, 0xc0, 0xba, 0x3b, 0x3d, 0xb1, 0x4c, - 0x5d, 0x4b, 0xd0, 0x60, 0x3b, 0xbb, 0x93, 0x57, 0x91, 0x10, 0xb4, 0x66, 0xe4, 0xab, 0xb0, 0xf6, - 0x84, 0x92, 0x47, 0x49, 0x6a, 0x99, 0x53, 0xab, 0x0c, 0x4e, 0x10, 0x9b, 0x50, 0x99, 0x50, 0xdf, - 0x27, 0x23, 0xaa, 0x05, 0xa7, 0x2e, 0x95, 0x73, 0x7c, 0xf4, 0xdb, 0x0b, 0xa3, 0x9f, 0x1f, 0x79, - 0x39, 0xd4, 0x1a, 0x9c, 0xba, 0x14, 0x37, 0xa0, 0x44, 0xed, 0xe9, 0x44, 0x58, 0xc8, 0x9f, 0x11, - 0x3f, 0xc5, 0x9e, 0x4e, 0xe6, 0xad, 0x14, 0x99, 0x5a, 0x68, 0x62, 0xc5, 0xa7, 0xde, 0x63, 0x53, - 0xa7, 0x72, 0x81, 0x1b, 0xb8, 0xba, 0x60, 0xa0, 0x2f, 0xe4, 0xf3, 0x36, 0x22, 0x3d, 0xdc, 0x84, - 0x12, 0x7d, 0x1a, 0x50, 0xdb, 0x37, 0x1d, 0x5b, 0x5e, 0xe1, 0x46, 0xde, 0x5a, 0x32, 0x8b, 0xd4, - 0x32, 0xe6, 0x4d, 0xcc, 0xf4, 0xf0, 0x1d, 0x58, 0x71, 0xdc, 0xc0, 0x74, 0x6c, 0x5f, 0x2e, 0x6e, - 0x4b, 0x3b, 0xe5, 0x9b, 0xaf, 0x2e, 0x4d, 0x84, 0xae, 0xe0, 0xa8, 0x11, 0x19, 0xb7, 0x01, 0xf9, - 0xce, 0xd4, 0xd3, 0xa9, 0xa6, 0x3b, 0x06, 0xd5, 0x4c, 0x7b, 0xe8, 0xc8, 0x25, 0x6e, 0xe0, 0xf2, - 0xe2, 0x40, 0x38, 0xb1, 0xe9, 0x18, 0xb4, 0x6d, 0x0f, 0x1d, 0xb5, 0xea, 0xa7, 0xda, 0xf8, 0x02, - 0x14, 0xfc, 0x53, 0x3b, 0x20, 0x4f, 0xe5, 0x0a, 0xcf, 0x90, 0xb0, 0x55, 0xfb, 0x6b, 0x01, 0xd6, - 0xce, 0x93, 0x62, 0xf7, 0x20, 0x3f, 0x64, 0xa3, 0x94, 0x33, 0xdf, 0x26, 0x06, 0x42, 0x27, 0x1d, - 0xc4, 0xc2, 0x77, 0x0c, 0x62, 0x03, 0xca, 0x36, 0xf5, 0x03, 0x6a, 0x88, 0x8c, 0xc8, 0x9e, 0x33, - 0xa7, 0x40, 0x28, 0x2d, 0xa6, 0x54, 0xee, 0x3b, 0xa5, 0xd4, 0xa7, 0xb0, 0x16, 0xbb, 0xa4, 0x79, - 0xc4, 0x1e, 0x45, 0xb9, 0xb9, 0xfb, 0x3c, 0x4f, 0xea, 0x4a, 0xa4, 0xa7, 0x32, 0x35, 0xb5, 0x4a, - 0x53, 0x6d, 0xdc, 0x02, 0x70, 0x6c, 0xea, 0x0c, 0x35, 0x83, 0xea, 0x96, 0x5c, 0x3c, 0x23, 0x4a, - 0x5d, 0x46, 0x59, 0x88, 0x92, 0x23, 0x50, 0xdd, 0xc2, 0x1f, 0xce, 0x52, 0x6d, 0xe5, 0x8c, 0x4c, - 0x39, 0x12, 0x8b, 0x6c, 0x21, 0xdb, 0x8e, 0xa1, 0xea, 0x51, 0x96, 0xf7, 0xd4, 0x08, 0x47, 0x56, - 0xe2, 0x4e, 0xd4, 0x9f, 0x3b, 0x32, 0x35, 0x54, 0x13, 0x03, 0x5b, 0xf5, 0x92, 0x4d, 0xfc, 0x06, - 0xc4, 0x80, 0xc6, 0xd3, 0x0a, 0xf8, 0x2e, 0x54, 0x89, 0xc0, 0x0e, 0x99, 0xd0, 0xad, 0x2f, 0xa1, - 0x9a, 0x0e, 0x0f, 0xde, 0x84, 0xbc, 0x1f, 0x10, 0x2f, 0xe0, 0x59, 0x98, 0x57, 0x45, 0x03, 0x23, - 0xc8, 0x52, 0xdb, 0xe0, 0xbb, 0x5c, 0x5e, 0x65, 0x7f, 0xf1, 0x4f, 0x66, 0x03, 0xce, 0xf2, 0x01, - 0xbf, 0xbd, 0x38, 0xa3, 0x29, 0xcb, 0xf3, 0xe3, 0xde, 0xfa, 0x00, 0x56, 0x53, 0x03, 0x38, 0x6f, - 0xd7, 0xb5, 0x5f, 0xc2, 0xcb, 0x4b, 0x4d, 0xe3, 0x4f, 0x61, 0x73, 0x6a, 0x9b, 0x76, 0x40, 0x3d, - 0xd7, 0xa3, 0x2c, 0x63, 0x45, 0x57, 0xf2, 0x7f, 0x56, 0xce, 0xc8, 0xb9, 0xe3, 0x24, 0x5b, 0x58, - 0x51, 0x37, 0xa6, 0x8b, 0xe0, 0xf5, 0x52, 0xf1, 0xbf, 0x2b, 0xe8, 0xd9, 0xb3, 0x67, 0xcf, 0x32, - 0xb5, 0xdf, 0x15, 0x60, 0x73, 0xd9, 0x9a, 0x59, 0xba, 0x7c, 0x2f, 0x40, 0xc1, 0x9e, 0x4e, 0x4e, - 0xa8, 0xc7, 0x83, 0x94, 0x57, 0xc3, 0x16, 0x6e, 0x40, 0xde, 0x22, 0x27, 0xd4, 0x92, 0x73, 0xdb, - 0xd2, 0x4e, 0xf5, 0xe6, 0x3b, 0xe7, 0x5a, 0x95, 0xf5, 0x43, 0xa6, 0xa2, 0x0a, 0x4d, 0xfc, 0x11, - 0xe4, 0xc2, 0x2d, 0x9a, 0x59, 0xb8, 0x7e, 0x3e, 0x0b, 0x6c, 0x2d, 0xa9, 0x5c, 0x0f, 0xbf, 0x02, - 0x25, 0xf6, 0x2b, 0x72, 0xa3, 0xc0, 0x7d, 0x2e, 0x32, 0x80, 0xe5, 0x05, 0xde, 0x82, 0x22, 0x5f, - 0x26, 0x06, 0x8d, 0x8e, 0xb6, 0xb8, 0xcd, 0x12, 0xcb, 0xa0, 0x43, 0x32, 0xb5, 0x02, 0xed, 0x31, - 0xb1, 0xa6, 0x94, 0x27, 0x7c, 0x49, 0xad, 0x84, 0xe0, 0xcf, 0x19, 0x86, 0x2f, 0x43, 0x59, 0xac, - 0x2a, 0xd3, 0x36, 0xe8, 0x53, 0xbe, 0x7b, 0xe6, 0x55, 0xb1, 0xd0, 0xda, 0x0c, 0x61, 0xdd, 0x3f, - 0xf4, 0x1d, 0x3b, 0x4a, 0x4d, 0xde, 0x05, 0x03, 0x78, 0xf7, 0x1f, 0xcc, 0x6f, 0xdc, 0xaf, 0x2d, - 0x1f, 0xde, 0x7c, 0x4e, 0xd5, 0xfe, 0x92, 0x81, 0x1c, 0xdf, 0x2f, 0xd6, 0xa0, 0x3c, 0xf8, 0xac, - 0xa7, 0x68, 0xad, 0xee, 0xf1, 0xfe, 0xa1, 0x82, 0x24, 0x5c, 0x05, 0xe0, 0xc0, 0xfd, 0xc3, 0x6e, - 0x63, 0x80, 0x32, 0x71, 0xbb, 0xdd, 0x19, 0xdc, 0xb9, 0x85, 0xb2, 0xb1, 0xc2, 0xb1, 0x00, 0x72, - 0x49, 0xc2, 0xfb, 0x37, 0x51, 0x1e, 0x23, 0xa8, 0x08, 0x03, 0xed, 0x4f, 0x95, 0xd6, 0x9d, 0x5b, - 0xa8, 0x90, 0x46, 0xde, 0xbf, 0x89, 0x56, 0xf0, 0x2a, 0x94, 0x38, 0xb2, 0xdf, 0xed, 0x1e, 0xa2, - 0x62, 0x6c, 0xb3, 0x3f, 0x50, 0xdb, 0x9d, 0x03, 0x54, 0x8a, 0x6d, 0x1e, 0xa8, 0xdd, 0xe3, 0x1e, - 0x82, 0xd8, 0xc2, 0x91, 0xd2, 0xef, 0x37, 0x0e, 0x14, 0x54, 0x8e, 0x19, 0xfb, 0x9f, 0x0d, 0x94, - 0x3e, 0xaa, 0xa4, 0xdc, 0x7a, 0xff, 0x26, 0x5a, 0x8d, 0xbb, 0x50, 0x3a, 0xc7, 0x47, 0xa8, 0x8a, - 0xd7, 0x61, 0x55, 0x74, 0x11, 0x39, 0xb1, 0x36, 0x07, 0xdd, 0xb9, 0x85, 0xd0, 0xcc, 0x11, 0x61, - 0x65, 0x3d, 0x05, 0xdc, 0xb9, 0x85, 0x70, 0xad, 0x09, 0x79, 0x9e, 0x5d, 0x18, 0x43, 0xf5, 0xb0, - 0xb1, 0xaf, 0x1c, 0x6a, 0xdd, 0xde, 0xa0, 0xdd, 0xed, 0x34, 0x0e, 0x91, 0x34, 0xc3, 0x54, 0xe5, - 0x67, 0xc7, 0x6d, 0x55, 0x69, 0xa1, 0x4c, 0x12, 0xeb, 0x29, 0x8d, 0x81, 0xd2, 0x42, 0xd9, 0x9a, - 0x0e, 0x9b, 0xcb, 0xf6, 0xc9, 0xa5, 0x2b, 0x23, 0x31, 0xc5, 0x99, 0x33, 0xa6, 0x98, 0xdb, 0x5a, - 0x98, 0xe2, 0x7f, 0x65, 0x60, 0x63, 0xc9, 0x59, 0xb1, 0xb4, 0x93, 0x1f, 0x43, 0x5e, 0xa4, 0xa8, - 0x38, 0x3d, 0xaf, 0x2d, 0x3d, 0x74, 0x78, 0xc2, 0x2e, 0x9c, 0xa0, 0x5c, 0x2f, 0x59, 0x41, 0x64, - 0xcf, 0xa8, 0x20, 0x98, 0x89, 0x85, 0x3d, 0xfd, 0x17, 0x0b, 0x7b, 0xba, 0x38, 0xf6, 0xee, 0x9c, - 0xe7, 0xd8, 0xe3, 0xd8, 0xb7, 0xdb, 0xdb, 0xf3, 0x4b, 0xf6, 0xf6, 0x7b, 0xb0, 0xbe, 0x60, 0xe8, - 0xdc, 0x7b, 0xec, 0xaf, 0x24, 0x90, 0xcf, 0x0a, 0xce, 0x73, 0x76, 0xba, 0x4c, 0x6a, 0xa7, 0xbb, - 0x37, 0x1f, 0xc1, 0x2b, 0x67, 0x4f, 0xc2, 0xc2, 0x5c, 0x7f, 0x25, 0xc1, 0x85, 0xe5, 0x95, 0xe2, - 0x52, 0x1f, 0x3e, 0x82, 0xc2, 0x84, 0x06, 0x63, 0x27, 0xaa, 0x96, 0xde, 0x5e, 0x72, 0x06, 0x33, - 0xf1, 0xfc, 0x64, 0x87, 0x5a, 0xc9, 0x43, 0x3c, 0x7b, 0x56, 0xb9, 0x27, 0xbc, 0x59, 0xf0, 0xf4, - 0xd7, 0x19, 0x78, 0x79, 0xa9, 0xf1, 0xa5, 0x8e, 0xbe, 0x06, 0x60, 0xda, 0xee, 0x34, 0x10, 0x15, - 0x91, 0xd8, 0x60, 0x4b, 0x1c, 0xe1, 0x9b, 0x17, 0xdb, 0x3c, 0xa7, 0x41, 0x2c, 0xcf, 0x72, 0x39, - 0x08, 0x88, 0x13, 0xee, 0xce, 0x1c, 0xcd, 0x71, 0x47, 0x5f, 0x3f, 0x63, 0xa4, 0x0b, 0x89, 0xf9, - 0x1e, 0x20, 0xdd, 0x32, 0xa9, 0x1d, 0x68, 0x7e, 0xe0, 0x51, 0x32, 0x31, 0xed, 0x11, 0x3f, 0x41, - 0x8a, 0x7b, 0xf9, 0x21, 0xb1, 0x7c, 0xaa, 0xae, 0x09, 0x71, 0x3f, 0x92, 0x32, 0x0d, 0x9e, 0x40, - 0x5e, 0x42, 0xa3, 0x90, 0xd2, 0x10, 0xe2, 0x58, 0xa3, 0xf6, 0xdb, 0x12, 0x94, 0x13, 0x75, 0x35, - 0xbe, 0x02, 0x95, 0x87, 0xe4, 0x31, 0xd1, 0xa2, 0xbb, 0x92, 0x88, 0x44, 0x99, 0x61, 0xbd, 0xf0, - 0xbe, 0xf4, 0x1e, 0x6c, 0x72, 0x8a, 0x33, 0x0d, 0xa8, 0xa7, 0xe9, 0x16, 0xf1, 0x7d, 0x1e, 0xb4, - 0x22, 0xa7, 0x62, 0x26, 0xeb, 0x32, 0x51, 0x33, 0x92, 0xe0, 0xdb, 0xb0, 0xc1, 0x35, 0x26, 0x53, - 0x2b, 0x30, 0x5d, 0x8b, 0x6a, 0xec, 0xf6, 0xe6, 0xf3, 0x93, 0x24, 0xf6, 0x6c, 0x9d, 0x31, 0x8e, - 0x42, 0x02, 0xf3, 0xc8, 0xc7, 0x2d, 0x78, 0x8d, 0xab, 0x8d, 0xa8, 0x4d, 0x3d, 0x12, 0x50, 0x8d, - 0x7e, 0x31, 0x25, 0x96, 0xaf, 0x11, 0xdb, 0xd0, 0xc6, 0xc4, 0x1f, 0xcb, 0x9b, 0xcc, 0xc0, 0x7e, - 0x46, 0x96, 0xd4, 0x4b, 0x8c, 0x78, 0x10, 0xf2, 0x14, 0x4e, 0x6b, 0xd8, 0xc6, 0xc7, 0xc4, 0x1f, - 0xe3, 0x3d, 0xb8, 0xc0, 0xad, 0xf8, 0x81, 0x67, 0xda, 0x23, 0x4d, 0x1f, 0x53, 0xfd, 0x91, 0x36, - 0x0d, 0x86, 0x77, 0xe5, 0x57, 0x92, 0xfd, 0x73, 0x0f, 0xfb, 0x9c, 0xd3, 0x64, 0x94, 0xe3, 0x60, - 0x78, 0x17, 0xf7, 0xa1, 0xc2, 0x26, 0x63, 0x62, 0x7e, 0x49, 0xb5, 0xa1, 0xe3, 0xf1, 0xa3, 0xb1, - 0xba, 0x64, 0x6b, 0x4a, 0x44, 0xb0, 0xde, 0x0d, 0x15, 0x8e, 0x1c, 0x83, 0xee, 0xe5, 0xfb, 0x3d, - 0x45, 0x69, 0xa9, 0xe5, 0xc8, 0xca, 0x7d, 0xc7, 0x63, 0x09, 0x35, 0x72, 0xe2, 0x00, 0x97, 0x45, - 0x42, 0x8d, 0x9c, 0x28, 0xbc, 0xb7, 0x61, 0x43, 0xd7, 0xc5, 0x98, 0x4d, 0x5d, 0x0b, 0xef, 0x58, - 0xbe, 0x8c, 0x52, 0xc1, 0xd2, 0xf5, 0x03, 0x41, 0x08, 0x73, 0xdc, 0xc7, 0x1f, 0xc2, 0xcb, 0xb3, - 0x60, 0x25, 0x15, 0xd7, 0x17, 0x46, 0x39, 0xaf, 0x7a, 0x1b, 0x36, 0xdc, 0xd3, 0x45, 0x45, 0x9c, - 0xea, 0xd1, 0x3d, 0x9d, 0x57, 0xfb, 0x00, 0x36, 0xdd, 0xb1, 0xbb, 0xa8, 0x77, 0x3d, 0xa9, 0x87, - 0xdd, 0xb1, 0x3b, 0xaf, 0xf8, 0x16, 0xbf, 0x70, 0x7b, 0x54, 0x27, 0x01, 0x35, 0xe4, 0x8b, 0x49, - 0x7a, 0x42, 0x80, 0x77, 0x01, 0xe9, 0xba, 0x46, 0x6d, 0x72, 0x62, 0x51, 0x8d, 0x78, 0xd4, 0x26, - 0xbe, 0x7c, 0x39, 0x49, 0xae, 0xea, 0xba, 0xc2, 0xa5, 0x0d, 0x2e, 0xc4, 0xd7, 0x61, 0xdd, 0x39, - 0x79, 0xa8, 0x8b, 0x94, 0xd4, 0x5c, 0x8f, 0x0e, 0xcd, 0xa7, 0xf2, 0x9b, 0x3c, 0xbe, 0x6b, 0x4c, - 0xc0, 0x13, 0xb2, 0xc7, 0x61, 0x7c, 0x0d, 0x90, 0xee, 0x8f, 0x89, 0xe7, 0xf2, 0x3d, 0xd9, 0x77, - 0x89, 0x4e, 0xe5, 0xb7, 0x04, 0x55, 0xe0, 0x9d, 0x08, 0x66, 0x4b, 0xc2, 0x7f, 0x62, 0x0e, 0x83, - 0xc8, 0xe2, 0x55, 0xb1, 0x24, 0x38, 0x16, 0x5a, 0xdb, 0x01, 0xc4, 0x42, 0x91, 0xea, 0x78, 0x87, - 0xd3, 0xaa, 0xee, 0xd8, 0x4d, 0xf6, 0xfb, 0x06, 0xac, 0x32, 0xe6, 0xac, 0xd3, 0x6b, 0xa2, 0x20, - 0x73, 0xc7, 0x89, 0x1e, 0x6f, 0xc1, 0x05, 0x46, 0x9a, 0xd0, 0x80, 0x18, 0x24, 0x20, 0x09, 0xf6, - 0xbb, 0x9c, 0xcd, 0xe2, 0x7e, 0x14, 0x0a, 0x53, 0x7e, 0x7a, 0xd3, 0x93, 0xd3, 0x38, 0xb3, 0x6e, - 0x08, 0x3f, 0x19, 0x16, 0xe5, 0xd6, 0xf7, 0x56, 0x74, 0xd7, 0xf6, 0xa0, 0x92, 0x4c, 0x7c, 0x5c, - 0x02, 0x91, 0xfa, 0x48, 0x62, 0x55, 0x50, 0xb3, 0xdb, 0x62, 0xf5, 0xcb, 0xe7, 0x0a, 0xca, 0xb0, - 0x3a, 0xea, 0xb0, 0x3d, 0x50, 0x34, 0xf5, 0xb8, 0x33, 0x68, 0x1f, 0x29, 0x28, 0x9b, 0x28, 0xd8, - 0x1f, 0xe4, 0x8a, 0x6f, 0xa3, 0xab, 0xb5, 0xaf, 0x33, 0x50, 0x4d, 0xdf, 0xc0, 0xf0, 0x8f, 0xe0, - 0x62, 0xf4, 0x5c, 0xe2, 0xd3, 0x40, 0x7b, 0x62, 0x7a, 0x7c, 0x45, 0x4e, 0x88, 0x38, 0x1d, 0xe3, - 0x9c, 0xd8, 0x0c, 0x59, 0x7d, 0x1a, 0x7c, 0x62, 0x7a, 0x6c, 0xbd, 0x4d, 0x48, 0x80, 0x0f, 0xe1, - 0xb2, 0xed, 0x68, 0x7e, 0x40, 0x6c, 0x83, 0x78, 0x86, 0x36, 0x7b, 0xa8, 0xd2, 0x88, 0xae, 0x53, - 0xdf, 0x77, 0xc4, 0x49, 0x18, 0x5b, 0x79, 0xd5, 0x76, 0xfa, 0x21, 0x79, 0x76, 0x44, 0x34, 0x42, - 0xea, 0x5c, 0xfe, 0x66, 0xcf, 0xca, 0xdf, 0x57, 0xa0, 0x34, 0x21, 0xae, 0x46, 0xed, 0xc0, 0x3b, - 0xe5, 0x75, 0x77, 0x51, 0x2d, 0x4e, 0x88, 0xab, 0xb0, 0xf6, 0x0b, 0xb9, 0xfe, 0x3c, 0xc8, 0x15, - 0x8b, 0xa8, 0xf4, 0x20, 0x57, 0x2c, 0x21, 0xa8, 0xfd, 0x33, 0x0b, 0x95, 0x64, 0x1d, 0xce, 0xae, - 0x35, 0x3a, 0x3f, 0xb2, 0x24, 0xbe, 0xa9, 0xbd, 0xf1, 0x8d, 0x55, 0x7b, 0xbd, 0xc9, 0xce, 0xb2, - 0xbd, 0x82, 0xa8, 0x8e, 0x55, 0xa1, 0xc9, 0xea, 0x08, 0x96, 0x6c, 0x54, 0x54, 0x23, 0x45, 0x35, - 0x6c, 0xe1, 0x03, 0x28, 0x3c, 0xf4, 0xb9, 0xed, 0x02, 0xb7, 0xfd, 0xe6, 0x37, 0xdb, 0x7e, 0xd0, - 0xe7, 0xc6, 0x4b, 0x0f, 0xfa, 0x5a, 0xa7, 0xab, 0x1e, 0x35, 0x0e, 0xd5, 0x50, 0x1d, 0x5f, 0x82, - 0x9c, 0x45, 0xbe, 0x3c, 0x4d, 0x9f, 0x7a, 0x1c, 0x3a, 0xef, 0x24, 0x5c, 0x82, 0xdc, 0x13, 0x4a, - 0x1e, 0xa5, 0xcf, 0x1a, 0x0e, 0x7d, 0x8f, 0x8b, 0x61, 0x17, 0xf2, 0x3c, 0x5e, 0x18, 0x20, 0x8c, - 0x18, 0x7a, 0x09, 0x17, 0x21, 0xd7, 0xec, 0xaa, 0x6c, 0x41, 0x20, 0xa8, 0x08, 0x54, 0xeb, 0xb5, - 0x95, 0xa6, 0x82, 0x32, 0xb5, 0xdb, 0x50, 0x10, 0x41, 0x60, 0x8b, 0x25, 0x0e, 0x03, 0x7a, 0x29, - 0x6c, 0x86, 0x36, 0xa4, 0x48, 0x7a, 0x7c, 0xb4, 0xaf, 0xa8, 0x28, 0x93, 0x9e, 0xea, 0x1c, 0xca, - 0xd7, 0x7c, 0xa8, 0x24, 0x0b, 0xf1, 0x17, 0x73, 0xc9, 0xfe, 0x9b, 0x04, 0xe5, 0x44, 0x61, 0xcd, - 0x2a, 0x22, 0x62, 0x59, 0xce, 0x13, 0x8d, 0x58, 0x26, 0xf1, 0xc3, 0xd4, 0x00, 0x0e, 0x35, 0x18, - 0x72, 0xde, 0xa9, 0x7b, 0x41, 0x4b, 0x24, 0x8f, 0x0a, 0xb5, 0x3f, 0x4a, 0x80, 0xe6, 0x2b, 0xdb, - 0x39, 0x37, 0xa5, 0x1f, 0xd2, 0xcd, 0xda, 0x1f, 0x24, 0xa8, 0xa6, 0xcb, 0xd9, 0x39, 0xf7, 0xae, - 0xfc, 0xa0, 0xee, 0xfd, 0x23, 0x03, 0xab, 0xa9, 0x22, 0xf6, 0xbc, 0xde, 0x7d, 0x01, 0xeb, 0xa6, - 0x41, 0x27, 0xae, 0x13, 0x50, 0x5b, 0x3f, 0xd5, 0x2c, 0xfa, 0x98, 0x5a, 0x72, 0x8d, 0x6f, 0x1a, - 0xbb, 0xdf, 0x5c, 0x26, 0xd7, 0xdb, 0x33, 0xbd, 0x43, 0xa6, 0xb6, 0xb7, 0xd1, 0x6e, 0x29, 0x47, - 0xbd, 0xee, 0x40, 0xe9, 0x34, 0x3f, 0xd3, 0x8e, 0x3b, 0x3f, 0xed, 0x74, 0x3f, 0xe9, 0xa8, 0xc8, - 0x9c, 0xa3, 0x7d, 0x8f, 0xcb, 0xbe, 0x07, 0x68, 0xde, 0x29, 0x7c, 0x11, 0x96, 0xb9, 0x85, 0x5e, - 0xc2, 0x1b, 0xb0, 0xd6, 0xe9, 0x6a, 0xfd, 0x76, 0x4b, 0xd1, 0x94, 0xfb, 0xf7, 0x95, 0xe6, 0xa0, - 0x2f, 0x1e, 0x3e, 0x62, 0xf6, 0x20, 0xb5, 0xc0, 0x6b, 0xbf, 0xcf, 0xc2, 0xc6, 0x12, 0x4f, 0x70, - 0x23, 0xbc, 0xb2, 0x88, 0x5b, 0xd4, 0x8d, 0xf3, 0x78, 0x5f, 0x67, 0x35, 0x43, 0x8f, 0x78, 0x41, - 0x78, 0xc3, 0xb9, 0x06, 0x2c, 0x4a, 0x76, 0x60, 0x0e, 0x4d, 0xea, 0x85, 0xef, 0x44, 0xe2, 0x1e, - 0xb3, 0x36, 0xc3, 0xc5, 0x53, 0xd1, 0xbb, 0x80, 0x5d, 0xc7, 0x37, 0x03, 0xf3, 0x31, 0xd5, 0x4c, - 0x3b, 0x7a, 0x54, 0x62, 0xf7, 0x9a, 0x9c, 0x8a, 0x22, 0x49, 0xdb, 0x0e, 0x62, 0xb6, 0x4d, 0x47, - 0x64, 0x8e, 0xcd, 0x36, 0xf3, 0xac, 0x8a, 0x22, 0x49, 0xcc, 0xbe, 0x02, 0x15, 0xc3, 0x99, 0xb2, - 0x62, 0x4f, 0xf0, 0xd8, 0xd9, 0x21, 0xa9, 0x65, 0x81, 0xc5, 0x94, 0xb0, 0x8c, 0x9f, 0xbd, 0x66, - 0x55, 0xd4, 0xb2, 0xc0, 0x04, 0xe5, 0x2a, 0xac, 0x91, 0xd1, 0xc8, 0x63, 0xc6, 0x23, 0x43, 0xe2, - 0x62, 0x52, 0x8d, 0x61, 0x4e, 0xdc, 0x7a, 0x00, 0xc5, 0x28, 0x0e, 0xec, 0xa8, 0x66, 0x91, 0xd0, - 0x5c, 0x71, 0xdb, 0xce, 0xec, 0x94, 0xd4, 0xa2, 0x1d, 0x09, 0xaf, 0x40, 0xc5, 0xf4, 0xb5, 0xd9, - 0xe3, 0x7c, 0x66, 0x3b, 0xb3, 0x53, 0x54, 0xcb, 0xa6, 0x1f, 0x3f, 0x6c, 0xd6, 0xbe, 0xca, 0x40, - 0x35, 0xfd, 0x71, 0x01, 0xb7, 0xa0, 0x68, 0x39, 0x3a, 0xe1, 0xa9, 0x25, 0xbe, 0x6c, 0xed, 0x3c, - 0xe7, 0x7b, 0x44, 0xfd, 0x30, 0xe4, 0xab, 0xb1, 0xe6, 0xd6, 0xdf, 0x25, 0x28, 0x46, 0x30, 0xbe, - 0x00, 0x39, 0x97, 0x04, 0x63, 0x6e, 0x2e, 0xbf, 0x9f, 0x41, 0x92, 0xca, 0xdb, 0x0c, 0xf7, 0x5d, - 0x62, 0xf3, 0x14, 0x08, 0x71, 0xd6, 0x66, 0xf3, 0x6a, 0x51, 0x62, 0xf0, 0x5b, 0x8f, 0x33, 0x99, - 0x50, 0x3b, 0xf0, 0xa3, 0x79, 0x0d, 0xf1, 0x66, 0x08, 0xe3, 0x77, 0x60, 0x3d, 0xf0, 0x88, 0x69, - 0xa5, 0xb8, 0x39, 0xce, 0x45, 0x91, 0x20, 0x26, 0xef, 0xc1, 0xa5, 0xc8, 0xae, 0x41, 0x03, 0xa2, - 0x8f, 0xa9, 0x31, 0x53, 0x2a, 0xf0, 0xd7, 0x8d, 0x8b, 0x21, 0xa1, 0x15, 0xca, 0x23, 0xdd, 0xda, - 0xd7, 0x12, 0xac, 0x47, 0xf7, 0x34, 0x23, 0x0e, 0xd6, 0x11, 0x00, 0xb1, 0x6d, 0x27, 0x48, 0x86, - 0x6b, 0x31, 0x95, 0x17, 0xf4, 0xea, 0x8d, 0x58, 0x49, 0x4d, 0x18, 0xd8, 0x9a, 0x00, 0xcc, 0x24, - 0x67, 0x86, 0xed, 0x32, 0x94, 0xc3, 0x2f, 0x47, 0xfc, 0xf3, 0xa3, 0xb8, 0xd9, 0x83, 0x80, 0xd8, - 0x85, 0x0e, 0x6f, 0x42, 0xfe, 0x84, 0x8e, 0x4c, 0x3b, 0x7c, 0x0f, 0x16, 0x8d, 0xe8, 0xfd, 0x25, - 0x17, 0xbf, 0xbf, 0xec, 0xff, 0x46, 0x82, 0x0d, 0xdd, 0x99, 0xcc, 0xfb, 0xbb, 0x8f, 0xe6, 0x9e, - 0x17, 0xfc, 0x8f, 0xa5, 0xcf, 0x3f, 0x1a, 0x99, 0xc1, 0x78, 0x7a, 0x52, 0xd7, 0x9d, 0xc9, 0xee, - 0xc8, 0xb1, 0x88, 0x3d, 0x9a, 0x7d, 0x3f, 0xe5, 0x7f, 0xf4, 0x1b, 0x23, 0x6a, 0xdf, 0x18, 0x39, - 0x89, 0xaf, 0xa9, 0xf7, 0x66, 0x7f, 0xff, 0x27, 0x49, 0x7f, 0xca, 0x64, 0x0f, 0x7a, 0xfb, 0x7f, - 0xce, 0x6c, 0x1d, 0x88, 0xee, 0x7a, 0x51, 0x78, 0x54, 0x3a, 0xb4, 0xa8, 0xce, 0x86, 0xfc, 0xff, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xe8, 0xef, 0xc4, 0x9b, 0x1d, 0x00, 0x00, + protoapi.RegisterFile("google/protobuf/descriptor.proto", xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped) + protoapi.RegisterEnum("google.protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value) + protoapi.RegisterEnum("google.protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value) + protoapi.RegisterEnum("google.protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value) + protoapi.RegisterEnum("google.protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value) + protoapi.RegisterEnum("google.protobuf.FieldOptions_JSType", FieldOptions_JSType_name, FieldOptions_JSType_value) + protoapi.RegisterEnum("google.protobuf.MethodOptions_IdempotencyLevel", MethodOptions_IdempotencyLevel_name, MethodOptions_IdempotencyLevel_value) + protoapi.RegisterType((*FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") + protoapi.RegisterType((*FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") + protoapi.RegisterType((*DescriptorProto)(nil), "google.protobuf.DescriptorProto") + protoapi.RegisterType((*ExtensionRangeOptions)(nil), "google.protobuf.ExtensionRangeOptions") + protoapi.RegisterType((*FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") + protoapi.RegisterType((*OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") + protoapi.RegisterType((*EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") + protoapi.RegisterType((*EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") + protoapi.RegisterType((*ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") + protoapi.RegisterType((*MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") + protoapi.RegisterType((*FileOptions)(nil), "google.protobuf.FileOptions") + protoapi.RegisterType((*MessageOptions)(nil), "google.protobuf.MessageOptions") + protoapi.RegisterType((*FieldOptions)(nil), "google.protobuf.FieldOptions") + protoapi.RegisterType((*OneofOptions)(nil), "google.protobuf.OneofOptions") + protoapi.RegisterType((*EnumOptions)(nil), "google.protobuf.EnumOptions") + protoapi.RegisterType((*EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") + protoapi.RegisterType((*ServiceOptions)(nil), "google.protobuf.ServiceOptions") + protoapi.RegisterType((*MethodOptions)(nil), "google.protobuf.MethodOptions") + protoapi.RegisterType((*UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") + protoapi.RegisterType((*SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") + protoapi.RegisterType((*GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") + protoapi.RegisterType((*DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") + protoapi.RegisterType((*DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") + protoapi.RegisterType((*EnumDescriptorProto_EnumReservedRange)(nil), "google.protobuf.EnumDescriptorProto.EnumReservedRange") + protoapi.RegisterType((*UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") + protoapi.RegisterType((*SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") + protoapi.RegisterType((*GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") +} + +var xxx_File_google_protobuf_descriptor_proto_rawdesc = []byte{ + // 7579 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x22, 0x4d, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x04, 0x66, 0x69, + 0x6c, 0x65, 0x22, 0xe4, 0x04, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65, + 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, + 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x70, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0a, 0x20, + 0x03, 0x28, 0x05, 0x52, 0x10, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x70, 0x65, 0x6e, + 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x65, 0x61, 0x6b, 0x5f, 0x64, 0x65, + 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0e, + 0x77, 0x65, 0x61, 0x6b, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x43, + 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e, + 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36, + 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x49, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x22, 0xb9, 0x06, 0x0a, 0x0f, 0x44, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x43, + 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74, + 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, + 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x65, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x05, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, + 0x6e, 0x67, 0x65, 0x52, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, + 0x6e, 0x67, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x64, 0x65, 0x63, + 0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, + 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x63, 0x6c, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, + 0x1a, 0x7a, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x40, 0x0a, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x37, 0x0a, 0x0d, + 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x7c, 0x0a, 0x15, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, + 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, + 0x80, 0x80, 0x02, 0x22, 0x98, 0x06, 0x0a, 0x14, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, + 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x3e, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74, + 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x64, 0x65, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, + 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, + 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x73, + 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6a, + 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x22, 0xb6, 0x02, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x06, 0x12, 0x10, 0x0a, + 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x07, 0x12, + 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x08, 0x12, 0x0f, + 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x09, 0x12, + 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x0a, 0x12, + 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, + 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, + 0x0c, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, + 0x10, 0x0d, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, + 0x0e, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, + 0x33, 0x32, 0x10, 0x0f, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, + 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x10, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x11, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x12, 0x22, 0x43, 0x0a, 0x05, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, + 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, + 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, + 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x50, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x63, + 0x0a, 0x14, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, + 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x22, 0xe3, 0x02, 0x0a, 0x13, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x3f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x12, 0x36, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5d, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x3b, 0x0a, 0x11, + 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x45, 0x6e, + 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, + 0xa7, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, + 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x39, + 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x89, 0x02, 0x0a, 0x15, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, + 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x75, 0x74, + 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x30, 0x0a, 0x10, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, + 0x73, 0x65, 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x69, 0x6e, 0x67, 0x12, 0x30, 0x0a, 0x10, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, + 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x22, 0x92, 0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6a, 0x61, 0x76, + 0x61, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x6a, 0x61, 0x76, 0x61, + 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6a, 0x61, 0x76, 0x61, 0x4f, 0x75, 0x74, 0x65, + 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x6a, 0x61, + 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, + 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, + 0x6a, 0x61, 0x76, 0x61, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x65, + 0x73, 0x12, 0x44, 0x0a, 0x1d, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x5f, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x68, 0x61, + 0x73, 0x68, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x19, 0x6a, 0x61, + 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x73, + 0x41, 0x6e, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3a, 0x0a, 0x16, 0x6a, 0x61, 0x76, 0x61, 0x5f, + 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x75, 0x74, 0x66, + 0x38, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, + 0x6a, 0x61, 0x76, 0x61, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, + 0x74, 0x66, 0x38, 0x12, 0x53, 0x0a, 0x0c, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, + 0x66, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, + 0x4d, 0x6f, 0x64, 0x65, 0x3a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x52, 0x0b, 0x6f, 0x70, 0x74, + 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x46, 0x6f, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x5f, 0x70, + 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, + 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x63, 0x63, 0x5f, 0x67, 0x65, + 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x10, + 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x63, 0x63, 0x47, + 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x39, + 0x0a, 0x15, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, + 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, + 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x13, 0x70, 0x79, 0x5f, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x70, + 0x79, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x12, 0x37, 0x0a, 0x14, 0x70, 0x68, 0x70, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x2a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, + 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x12, 0x70, 0x68, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, + 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, + 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x12, 0x2f, 0x0a, 0x10, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, + 0x65, 0x6e, 0x61, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, + 0x65, 0x52, 0x0e, 0x63, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x72, 0x65, 0x6e, 0x61, + 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, + 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x24, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6f, 0x62, + 0x6a, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x29, 0x0a, + 0x10, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x4e, + 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x77, 0x69, 0x66, + 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x27, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x73, 0x77, 0x69, 0x66, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x28, 0x0a, 0x10, 0x70, + 0x68, 0x70, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, + 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x68, 0x70, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, + 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x68, 0x70, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x29, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x68, + 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x70, 0x68, + 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x18, 0x2c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x70, 0x68, 0x70, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x75, 0x62, 0x79, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x75, 0x62, 0x79, 0x50, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x0a, + 0x0c, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x09, 0x0a, + 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x44, 0x45, + 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x49, 0x54, 0x45, 0x5f, + 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x03, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, + 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x26, 0x10, 0x27, 0x22, 0xd1, 0x02, 0x0a, 0x0e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, + 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, + 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, + 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, + 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4c, 0x0a, 0x1f, 0x6e, + 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x1c, 0x6e, 0x6f, 0x53, + 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, + 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, + 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x58, 0x0a, + 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, + 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, + 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, + 0x80, 0x02, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0xe2, + 0x03, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x41, 0x0a, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, + 0x79, 0x70, 0x65, 0x3a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, + 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, + 0x3a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x25, + 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, + 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, + 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, + 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2f, 0x0a, 0x05, 0x43, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, + 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x44, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, + 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, 0x43, 0x45, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x06, 0x4a, + 0x53, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, + 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, + 0x47, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, + 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, + 0x04, 0x10, 0x05, 0x22, 0x73, 0x0a, 0x0c, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, + 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xc0, 0x01, 0x0a, 0x0b, 0x45, 0x6e, 0x75, + 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, + 0x77, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, + 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, + 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, + 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, + 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0x9e, 0x01, 0x0a, 0x10, + 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9c, 0x01, 0x0a, + 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, + 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, + 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, + 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, + 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xe0, 0x02, 0x0a, 0x0d, + 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, + 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, + 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, + 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x11, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, + 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, + 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, + 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, + 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x22, 0x50, 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, + 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, + 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, + 0x0a, 0x0f, 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, + 0x53, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, + 0x54, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9a, + 0x03, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x50, + 0x61, 0x72, 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, + 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x10, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, + 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, + 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, + 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, + 0x4a, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, + 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, + 0x6e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, + 0x69, 0x73, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa7, 0x02, 0x0a, 0x0e, + 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, + 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, + 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, 0x61, + 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, 0x61, + 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, 0x61, + 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, + 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, + 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, 0x61, + 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, 0x65, + 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd1, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a, 0x61, + 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, + 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x6d, 0x0a, 0x0a, 0x41, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, + 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x42, 0x8f, 0x01, 0x0a, 0x13, 0x63, 0x6f, + 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x3b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, + 0x1a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, +} + +var xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_descriptor_proto_rawdesc) + +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) + +var File_google_protobuf_descriptor_proto protoreflect.FileDescriptor + +var xxx_File_google_protobuf_descriptor_proto_enumTypes = make([]protoreflect.EnumType, 6) +var xxx_File_google_protobuf_descriptor_proto_messageTypes = make([]protoimpl.MessageType, 27) +var xxx_File_google_protobuf_descriptor_proto_goTypes = []interface{}{ + (FieldDescriptorProto_Type)(0), // 0: google.protobuf.FieldDescriptorProto.Type + (FieldDescriptorProto_Label)(0), // 1: google.protobuf.FieldDescriptorProto.Label + (FileOptions_OptimizeMode)(0), // 2: google.protobuf.FileOptions.OptimizeMode + (FieldOptions_CType)(0), // 3: google.protobuf.FieldOptions.CType + (FieldOptions_JSType)(0), // 4: google.protobuf.FieldOptions.JSType + (MethodOptions_IdempotencyLevel)(0), // 5: google.protobuf.MethodOptions.IdempotencyLevel + (*FileDescriptorSet)(nil), // 6: google.protobuf.FileDescriptorSet + (*FileDescriptorProto)(nil), // 7: google.protobuf.FileDescriptorProto + (*DescriptorProto)(nil), // 8: google.protobuf.DescriptorProto + (*ExtensionRangeOptions)(nil), // 9: google.protobuf.ExtensionRangeOptions + (*FieldDescriptorProto)(nil), // 10: google.protobuf.FieldDescriptorProto + (*OneofDescriptorProto)(nil), // 11: google.protobuf.OneofDescriptorProto + (*EnumDescriptorProto)(nil), // 12: google.protobuf.EnumDescriptorProto + (*EnumValueDescriptorProto)(nil), // 13: google.protobuf.EnumValueDescriptorProto + (*ServiceDescriptorProto)(nil), // 14: google.protobuf.ServiceDescriptorProto + (*MethodDescriptorProto)(nil), // 15: google.protobuf.MethodDescriptorProto + (*FileOptions)(nil), // 16: google.protobuf.FileOptions + (*MessageOptions)(nil), // 17: google.protobuf.MessageOptions + (*FieldOptions)(nil), // 18: google.protobuf.FieldOptions + (*OneofOptions)(nil), // 19: google.protobuf.OneofOptions + (*EnumOptions)(nil), // 20: google.protobuf.EnumOptions + (*EnumValueOptions)(nil), // 21: google.protobuf.EnumValueOptions + (*ServiceOptions)(nil), // 22: google.protobuf.ServiceOptions + (*MethodOptions)(nil), // 23: google.protobuf.MethodOptions + (*UninterpretedOption)(nil), // 24: google.protobuf.UninterpretedOption + (*SourceCodeInfo)(nil), // 25: google.protobuf.SourceCodeInfo + (*GeneratedCodeInfo)(nil), // 26: google.protobuf.GeneratedCodeInfo + (*DescriptorProto_ExtensionRange)(nil), // 27: google.protobuf.DescriptorProto.ExtensionRange + (*DescriptorProto_ReservedRange)(nil), // 28: google.protobuf.DescriptorProto.ReservedRange + (*EnumDescriptorProto_EnumReservedRange)(nil), // 29: google.protobuf.EnumDescriptorProto.EnumReservedRange + (*UninterpretedOption_NamePart)(nil), // 30: google.protobuf.UninterpretedOption.NamePart + (*SourceCodeInfo_Location)(nil), // 31: google.protobuf.SourceCodeInfo.Location + (*GeneratedCodeInfo_Annotation)(nil), // 32: google.protobuf.GeneratedCodeInfo.Annotation +} +var xxx_File_google_protobuf_descriptor_proto_depIdxs = []int32{ + 7, // google.protobuf.FileDescriptorSet.file:type_name -> google.protobuf.FileDescriptorProto + 8, // google.protobuf.FileDescriptorProto.message_type:type_name -> google.protobuf.DescriptorProto + 12, // google.protobuf.FileDescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto + 14, // google.protobuf.FileDescriptorProto.service:type_name -> google.protobuf.ServiceDescriptorProto + 10, // google.protobuf.FileDescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto + 16, // google.protobuf.FileDescriptorProto.options:type_name -> google.protobuf.FileOptions + 25, // google.protobuf.FileDescriptorProto.source_code_info:type_name -> google.protobuf.SourceCodeInfo + 10, // google.protobuf.DescriptorProto.field:type_name -> google.protobuf.FieldDescriptorProto + 10, // google.protobuf.DescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto + 8, // google.protobuf.DescriptorProto.nested_type:type_name -> google.protobuf.DescriptorProto + 12, // google.protobuf.DescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto + 27, // google.protobuf.DescriptorProto.extension_range:type_name -> google.protobuf.DescriptorProto.ExtensionRange + 11, // google.protobuf.DescriptorProto.oneof_decl:type_name -> google.protobuf.OneofDescriptorProto + 17, // google.protobuf.DescriptorProto.options:type_name -> google.protobuf.MessageOptions + 28, // google.protobuf.DescriptorProto.reserved_range:type_name -> google.protobuf.DescriptorProto.ReservedRange + 24, // google.protobuf.ExtensionRangeOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 1, // google.protobuf.FieldDescriptorProto.label:type_name -> google.protobuf.FieldDescriptorProto.Label + 0, // google.protobuf.FieldDescriptorProto.type:type_name -> google.protobuf.FieldDescriptorProto.Type + 18, // google.protobuf.FieldDescriptorProto.options:type_name -> google.protobuf.FieldOptions + 19, // google.protobuf.OneofDescriptorProto.options:type_name -> google.protobuf.OneofOptions + 13, // google.protobuf.EnumDescriptorProto.value:type_name -> google.protobuf.EnumValueDescriptorProto + 20, // google.protobuf.EnumDescriptorProto.options:type_name -> google.protobuf.EnumOptions + 29, // google.protobuf.EnumDescriptorProto.reserved_range:type_name -> google.protobuf.EnumDescriptorProto.EnumReservedRange + 21, // google.protobuf.EnumValueDescriptorProto.options:type_name -> google.protobuf.EnumValueOptions + 15, // google.protobuf.ServiceDescriptorProto.method:type_name -> google.protobuf.MethodDescriptorProto + 22, // google.protobuf.ServiceDescriptorProto.options:type_name -> google.protobuf.ServiceOptions + 23, // google.protobuf.MethodDescriptorProto.options:type_name -> google.protobuf.MethodOptions + 2, // google.protobuf.FileOptions.optimize_for:type_name -> google.protobuf.FileOptions.OptimizeMode + 24, // google.protobuf.FileOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 24, // google.protobuf.MessageOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 3, // google.protobuf.FieldOptions.ctype:type_name -> google.protobuf.FieldOptions.CType + 4, // google.protobuf.FieldOptions.jstype:type_name -> google.protobuf.FieldOptions.JSType + 24, // google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 24, // google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 24, // google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 24, // google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 24, // google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 5, // google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel + 24, // google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 30, // google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart + 31, // google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location + 32, // google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation + 9, // google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions +} + +func init() { xxx_File_google_protobuf_descriptor_proto_init() } +func xxx_File_google_protobuf_descriptor_proto_init() { + if File_google_protobuf_descriptor_proto != nil { + return + } + messageTypes := make([]protoreflect.MessageType, 27) + File_google_protobuf_descriptor_proto = protoimpl.FileBuilder{ + RawDescriptor: xxx_File_google_protobuf_descriptor_proto_rawdesc, + GoTypes: xxx_File_google_protobuf_descriptor_proto_goTypes, + DependencyIndexes: xxx_File_google_protobuf_descriptor_proto_depIdxs, + EnumOutputTypes: xxx_File_google_protobuf_descriptor_proto_enumTypes, + MessageOutputTypes: messageTypes, + }.Init() + messageGoTypes := xxx_File_google_protobuf_descriptor_proto_goTypes[6:][:27] + for i, mt := range messageTypes { + xxx_File_google_protobuf_descriptor_proto_messageTypes[i].GoType = reflect.TypeOf(messageGoTypes[i]) + xxx_File_google_protobuf_descriptor_proto_messageTypes[i].PBType = mt + } + prototype.X.RegisterExtensionRangeOptions((*ExtensionRangeOptions)(nil)) + prototype.X.RegisterFileOptions((*FileOptions)(nil)) + prototype.X.RegisterMessageOptions((*MessageOptions)(nil)) + prototype.X.RegisterFieldOptions((*FieldOptions)(nil)) + prototype.X.RegisterOneofOptions((*OneofOptions)(nil)) + prototype.X.RegisterEnumOptions((*EnumOptions)(nil)) + prototype.X.RegisterEnumValueOptions((*EnumValueOptions)(nil)) + prototype.X.RegisterServiceOptions((*ServiceOptions)(nil)) + prototype.X.RegisterMethodOptions((*MethodOptions)(nil)) + xxx_File_google_protobuf_descriptor_proto_goTypes = nil + xxx_File_google_protobuf_descriptor_proto_depIdxs = nil } diff --git a/protoc-gen-go/main.go b/protoc-gen-go/main.go index 3d6ebba4e0..5d1f07c223 100644 --- a/protoc-gen-go/main.go +++ b/protoc-gen-go/main.go @@ -64,9 +64,7 @@ func main() { if !f.Generate { continue } - filename := f.GeneratedFilenamePrefix + ".pb.go" - g := gen.NewGeneratedFile(filename, f.GoImportPath) - gengo.GenerateFile(gen, f, g) + g := gengo.GenerateFile(gen, f) if grpc { gengogrpc.GenerateFileContent(gen, f, g) } diff --git a/protoc-gen-go/testdata/deprecated/deprecated.pb.go b/protoc-gen-go/testdata/deprecated/deprecated.pb.go index fc25333e97..63b52dfb77 100644 --- a/protoc-gen-go/testdata/deprecated/deprecated.pb.go +++ b/protoc-gen-go/testdata/deprecated/deprecated.pb.go @@ -6,18 +6,12 @@ package deprecated import ( - fmt "fmt" + context "context" proto "github.com/golang/protobuf/proto" - context "golang.org/x/net/context" + protoapi "github.com/golang/protobuf/protoapi" grpc "google.golang.org/grpc" - math "math" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -44,7 +38,7 @@ func (x DeprecatedEnum) String() string { } func (DeprecatedEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_f64ba265cd7eae3f, []int{0} + return xxx_File_deprecated_deprecated_proto_rawdesc_gzipped, []int{0} } // DeprecatedRequest is a request to DeprecatedCall. @@ -60,7 +54,7 @@ func (m *DeprecatedRequest) Reset() { *m = DeprecatedRequest{} } func (m *DeprecatedRequest) String() string { return proto.CompactTextString(m) } func (*DeprecatedRequest) ProtoMessage() {} func (*DeprecatedRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f64ba265cd7eae3f, []int{0} + return xxx_File_deprecated_deprecated_proto_rawdesc_gzipped, []int{0} } func (m *DeprecatedRequest) XXX_Unmarshal(b []byte) error { @@ -100,7 +94,7 @@ func (m *DeprecatedResponse) Reset() { *m = DeprecatedResponse{} } func (m *DeprecatedResponse) String() string { return proto.CompactTextString(m) } func (*DeprecatedResponse) ProtoMessage() {} func (*DeprecatedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f64ba265cd7eae3f, []int{1} + return xxx_File_deprecated_deprecated_proto_rawdesc_gzipped, []int{1} } func (m *DeprecatedResponse) XXX_Unmarshal(b []byte) error { @@ -162,34 +156,47 @@ func (*DeprecatedResponse) XXX_OneofWrappers() []interface{} { } func init() { + proto.RegisterFile("deprecated/deprecated.proto", xxx_File_deprecated_deprecated_proto_rawdesc_gzipped) proto.RegisterEnum("deprecated.DeprecatedEnum", DeprecatedEnum_name, DeprecatedEnum_value) proto.RegisterType((*DeprecatedRequest)(nil), "deprecated.DeprecatedRequest") proto.RegisterType((*DeprecatedResponse)(nil), "deprecated.DeprecatedResponse") } -func init() { proto.RegisterFile("deprecated/deprecated.proto", fileDescriptor_f64ba265cd7eae3f) } - -var fileDescriptor_f64ba265cd7eae3f = []byte{ - // 287 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xcd, 0x4a, 0xf3, 0x40, - 0x14, 0x86, 0x7b, 0xe6, 0x83, 0x0f, 0x9d, 0x45, 0xad, 0x83, 0x68, 0x88, 0x28, 0x25, 0xab, 0x20, - 0x34, 0x81, 0xba, 0x2b, 0x6e, 0x9a, 0x26, 0xa2, 0x2b, 0x25, 0x76, 0xe5, 0x46, 0xf2, 0x73, 0x12, - 0x03, 0xe9, 0x4c, 0x4c, 0x26, 0x5e, 0x83, 0xf7, 0xe3, 0xc6, 0xcb, 0x93, 0x49, 0x8b, 0x33, 0x05, - 0xdd, 0x84, 0x93, 0x79, 0xdf, 0xe7, 0xfc, 0xd2, 0xf3, 0x1c, 0x9b, 0x16, 0xb3, 0x44, 0x62, 0xee, - 0xeb, 0xd0, 0x6b, 0x5a, 0x21, 0x05, 0xa3, 0xfa, 0xc5, 0x39, 0xa3, 0xc7, 0xe1, 0xcf, 0x5f, 0x8c, - 0x6f, 0x3d, 0x76, 0x72, 0x41, 0x2c, 0x70, 0x3e, 0x81, 0x32, 0x53, 0xe9, 0x1a, 0xc1, 0x3b, 0x64, - 0xf7, 0x74, 0xa2, 0xe9, 0x97, 0xa2, 0xc2, 0x3a, 0xb7, 0x60, 0x0a, 0xee, 0x78, 0x6e, 0x7b, 0x46, - 0x21, 0x4d, 0x46, 0xbc, 0xdf, 0x04, 0xc4, 0x82, 0xf8, 0x48, 0xcb, 0xb7, 0x0a, 0x63, 0x0b, 0x7a, - 0x6a, 0xa4, 0x12, 0x1c, 0x45, 0xb1, 0x4b, 0x48, 0xa6, 0xe0, 0x1e, 0x2a, 0xe8, 0x6e, 0x14, 0x9f, - 0x68, 0xcf, 0x83, 0xb2, 0x0c, 0xac, 0xea, 0x30, 0x60, 0x7b, 0xad, 0x0c, 0xfc, 0x95, 0x4b, 0xc7, - 0xfb, 0xa5, 0x19, 0xa3, 0x34, 0x8c, 0x1e, 0xe3, 0x68, 0xb5, 0x5c, 0x47, 0xe1, 0x64, 0x64, 0x93, - 0x03, 0xb0, 0x89, 0x05, 0x73, 0x6e, 0x0e, 0xfe, 0x84, 0xed, 0x7b, 0x95, 0x21, 0x5b, 0x9b, 0xf8, - 0x2a, 0xa9, 0x6b, 0x76, 0xf1, 0xfb, 0x54, 0xbb, 0x4d, 0xd9, 0x97, 0x7f, 0xc9, 0xdb, 0x75, 0x39, - 0xff, 0x3e, 0x08, 0xd8, 0xea, 0x13, 0x2c, 0x9f, 0x6f, 0xca, 0x4a, 0xbe, 0xf6, 0xa9, 0x97, 0x89, - 0x8d, 0x5f, 0x8a, 0x3a, 0xe1, 0xa5, 0x3f, 0xdc, 0x23, 0xed, 0x8b, 0x6d, 0x90, 0xcd, 0x4a, 0xe4, - 0xb3, 0x52, 0xf8, 0x12, 0x3b, 0x99, 0x27, 0x32, 0x31, 0x4e, 0xf7, 0x05, 0x90, 0xfe, 0x1f, 0x5c, - 0xd7, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x08, 0xd5, 0xa0, 0x89, 0xdd, 0x01, 0x00, 0x00, -} +var xxx_File_deprecated_deprecated_proto_rawdesc = []byte{ + // 477 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x1b, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x2f, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x64, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x22, 0x17, 0x0a, 0x11, 0x44, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x3a, 0x02, + 0x18, 0x01, 0x22, 0xb3, 0x01, 0x0a, 0x12, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x10, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6e, 0x75, 0x6d, 0x42, + 0x02, 0x18, 0x01, 0x52, 0x0f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x12, 0x3a, 0x0a, 0x16, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x48, 0x00, 0x52, 0x14, 0x64, 0x65, 0x70, 0x72, + 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x3a, 0x02, 0x18, 0x01, 0x42, 0x12, 0x0a, 0x10, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2a, 0x28, 0x0a, 0x0e, 0x44, 0x65, 0x70, 0x72, + 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x0a, 0x44, 0x45, + 0x50, 0x52, 0x45, 0x43, 0x41, 0x54, 0x45, 0x44, 0x10, 0x00, 0x1a, 0x02, 0x08, 0x01, 0x1a, 0x02, + 0x18, 0x01, 0x32, 0x6e, 0x0a, 0x11, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x54, 0x0a, 0x0e, 0x44, 0x65, 0x70, 0x72, 0x65, + 0x63, 0x61, 0x74, 0x65, 0x64, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x1d, 0x2e, 0x64, 0x65, 0x70, 0x72, + 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x64, 0x65, 0x70, 0x72, 0x65, + 0x63, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x1a, 0x03, 0x88, + 0x02, 0x01, 0x42, 0x41, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, + 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, + 0x65, 0x64, 0xb8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var xxx_File_deprecated_deprecated_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_deprecated_deprecated_proto_rawdesc) // Reference imports to suppress errors if they are not otherwise used. var _ context.Context diff --git a/protoc-gen-go/testdata/extension_base/extension_base.pb.go b/protoc-gen-go/testdata/extension_base/extension_base.pb.go index 62437ef56f..1267fcfb77 100644 --- a/protoc-gen-go/testdata/extension_base/extension_base.pb.go +++ b/protoc-gen-go/testdata/extension_base/extension_base.pb.go @@ -4,16 +4,10 @@ package extension_base import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -32,7 +26,7 @@ func (m *BaseMessage) Reset() { *m = BaseMessage{} } func (m *BaseMessage) String() string { return proto.CompactTextString(m) } func (*BaseMessage) ProtoMessage() {} func (*BaseMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_2fbd53bac0b7ca8a, []int{0} + return xxx_File_extension_base_extension_base_proto_rawdesc_gzipped, []int{0} } var extRange_BaseMessage = []proto.ExtensionRange{ @@ -81,14 +75,7 @@ func (m *OldStyleMessage) Reset() { *m = OldStyleMessage{} } func (m *OldStyleMessage) String() string { return proto.CompactTextString(m) } func (*OldStyleMessage) ProtoMessage() {} func (*OldStyleMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_2fbd53bac0b7ca8a, []int{1} -} - -func (m *OldStyleMessage) MarshalJSON() ([]byte, error) { - return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions) -} -func (m *OldStyleMessage) UnmarshalJSON(buf []byte) error { - return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions) + return xxx_File_extension_base_extension_base_proto_rawdesc_gzipped, []int{1} } var extRange_OldStyleMessage = []proto.ExtensionRange{ @@ -118,26 +105,27 @@ func (m *OldStyleMessage) XXX_DiscardUnknown() { var xxx_messageInfo_OldStyleMessage proto.InternalMessageInfo func init() { + proto.RegisterFile("extension_base/extension_base.proto", xxx_File_extension_base_extension_base_proto_rawdesc_gzipped) proto.RegisterType((*BaseMessage)(nil), "extension_base.BaseMessage") proto.RegisterType((*OldStyleMessage)(nil), "extension_base.OldStyleMessage") } -func init() { - proto.RegisterFile("extension_base/extension_base.proto", fileDescriptor_2fbd53bac0b7ca8a) -} - -var fileDescriptor_2fbd53bac0b7ca8a = []byte{ - // 179 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0xad, 0x28, 0x49, - 0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0x8b, 0x4f, 0x4a, 0x2c, 0x4e, 0xd5, 0x47, 0xe5, 0xea, 0x15, 0x14, - 0xe5, 0x97, 0xe4, 0x0b, 0xf1, 0xa1, 0x8a, 0x2a, 0x99, 0x72, 0x71, 0x3b, 0x25, 0x16, 0xa7, 0xfa, - 0xa6, 0x16, 0x17, 0x27, 0xa6, 0xa7, 0x0a, 0x89, 0x71, 0xb1, 0x65, 0xa4, 0x66, 0xa6, 0x67, 0x94, - 0x48, 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x06, 0x41, 0x79, 0x5a, 0x2c, 0x1c, 0x2c, 0x02, 0x5c, 0x5a, - 0x1c, 0x1c, 0x02, 0x02, 0x0d, 0x0d, 0x0d, 0x0d, 0x4c, 0x4a, 0xf2, 0x5c, 0xfc, 0xfe, 0x39, 0x29, - 0xc1, 0x25, 0x95, 0x39, 0x30, 0xad, 0x5a, 0x1c, 0x1c, 0x29, 0x02, 0xff, 0xff, 0xff, 0xff, 0xcf, - 0x6e, 0xc5, 0xc4, 0xc1, 0xe8, 0xe4, 0x14, 0xe5, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, - 0x9c, 0x9f, 0xab, 0x9f, 0x9e, 0x9f, 0x93, 0x98, 0x97, 0xae, 0x0f, 0x76, 0x42, 0x52, 0x69, 0x1a, - 0x84, 0x91, 0xac, 0x9b, 0x9e, 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x5f, 0x92, 0x5a, 0x5c, 0x92, 0x92, - 0x58, 0x92, 0x88, 0xe6, 0x62, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7a, 0x7f, 0xb7, 0x2a, 0xd1, - 0x00, 0x00, 0x00, -} +var xxx_File_extension_base_extension_base_proto_rawdesc = []byte{ + // 209 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x23, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, + 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x5f, 0x62, 0x61, 0x73, 0x65, 0x22, 0x35, 0x0a, 0x0b, 0x42, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x2a, 0x04, 0x08, 0x04, + 0x10, 0x0a, 0x2a, 0x08, 0x08, 0x10, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x1f, 0x0a, 0x0f, + 0x4f, 0x6c, 0x64, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, + 0x08, 0x08, 0x64, 0x10, 0xff, 0xff, 0xff, 0xff, 0x07, 0x3a, 0x02, 0x08, 0x01, 0x42, 0x42, 0x5a, + 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, + 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, + 0x74, 0x61, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, + 0x65, +} + +var xxx_File_extension_base_extension_base_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_extension_base_extension_base_proto_rawdesc) diff --git a/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go b/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go index fd82a253b8..c5afa2f046 100644 --- a/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go +++ b/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go @@ -4,16 +4,10 @@ package extension_extra import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -31,7 +25,7 @@ func (m *ExtraMessage) Reset() { *m = ExtraMessage{} } func (m *ExtraMessage) String() string { return proto.CompactTextString(m) } func (*ExtraMessage) ProtoMessage() {} func (*ExtraMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_fce75f5a63502cd5, []int{0} + return xxx_File_extension_extra_extension_extra_proto_rawdesc_gzipped, []int{0} } func (m *ExtraMessage) XXX_Unmarshal(b []byte) error { @@ -60,22 +54,23 @@ func (m *ExtraMessage) GetWidth() int32 { } func init() { + proto.RegisterFile("extension_extra/extension_extra.proto", xxx_File_extension_extra_extension_extra_proto_rawdesc_gzipped) proto.RegisterType((*ExtraMessage)(nil), "extension_extra.ExtraMessage") } -func init() { - proto.RegisterFile("extension_extra/extension_extra.proto", fileDescriptor_fce75f5a63502cd5) +var xxx_File_extension_extra_extension_extra_proto_rawdesc = []byte{ + // 163 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x25, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x72, + 0x61, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x72, + 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x24, 0x0a, 0x0c, 0x45, 0x78, 0x74, 0x72, + 0x61, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, + 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x42, 0x43, + 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, + 0x61, 0x74, 0x61, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, + 0x74, 0x72, 0x61, } -var fileDescriptor_fce75f5a63502cd5 = []byte{ - // 133 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x28, 0x49, - 0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0x8b, 0x4f, 0xad, 0x28, 0x29, 0x4a, 0xd4, 0x47, 0xe3, 0xeb, 0x15, - 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xf1, 0xa3, 0x09, 0x2b, 0xa9, 0x70, 0xf1, 0xb8, 0x82, 0x18, 0xbe, - 0xa9, 0xc5, 0xc5, 0x89, 0xe9, 0xa9, 0x42, 0x22, 0x5c, 0xac, 0xe5, 0x99, 0x29, 0x25, 0x19, 0x12, - 0x8c, 0x0a, 0x8c, 0x1a, 0xac, 0x41, 0x10, 0x8e, 0x93, 0x73, 0x94, 0x63, 0x7a, 0x66, 0x49, 0x46, - 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x4e, 0x62, 0x5e, 0xba, 0x3e, 0xd8, 0xc4, - 0xa4, 0xd2, 0x34, 0x08, 0x23, 0x59, 0x37, 0x3d, 0x35, 0x4f, 0x37, 0x3d, 0x5f, 0xbf, 0x24, 0xb5, - 0xb8, 0x24, 0x25, 0xb1, 0x04, 0xc3, 0x05, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf1, 0xec, 0xe3, - 0xb7, 0xa3, 0x00, 0x00, 0x00, -} +var xxx_File_extension_extra_extension_extra_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_extension_extra_extension_extra_proto_rawdesc) diff --git a/protoc-gen-go/testdata/extension_user/extension_user.pb.go b/protoc-gen-go/testdata/extension_user/extension_user.pb.go index 41321cf77f..c4accf1790 100644 --- a/protoc-gen-go/testdata/extension_user/extension_user.pb.go +++ b/protoc-gen-go/testdata/extension_user/extension_user.pb.go @@ -4,18 +4,12 @@ package extension_user import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" extension_base "github.com/golang/protobuf/protoc-gen-go/testdata/extension_base" extension_extra "github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra" - math "math" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -34,7 +28,7 @@ func (m *UserMessage) Reset() { *m = UserMessage{} } func (m *UserMessage) String() string { return proto.CompactTextString(m) } func (*UserMessage) ProtoMessage() {} func (*UserMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_359ba8abf543ca10, []int{0} + return xxx_File_extension_user_extension_user_proto_rawdesc_gzipped, []int{0} } func (m *UserMessage) XXX_Unmarshal(b []byte) error { @@ -81,7 +75,7 @@ func (m *LoudMessage) Reset() { *m = LoudMessage{} } func (m *LoudMessage) String() string { return proto.CompactTextString(m) } func (*LoudMessage) ProtoMessage() {} func (*LoudMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_359ba8abf543ca10, []int{1} + return xxx_File_extension_user_extension_user_proto_rawdesc_gzipped, []int{1} } var extRange_LoudMessage = []proto.ExtensionRange{ @@ -110,15 +104,6 @@ func (m *LoudMessage) XXX_DiscardUnknown() { var xxx_messageInfo_LoudMessage proto.InternalMessageInfo -var E_LoudMessage_Volume = &proto.ExtensionDesc{ - ExtendedType: (*extension_base.BaseMessage)(nil), - ExtensionType: (*uint32)(nil), - Field: 8, - Name: "extension_user.LoudMessage.volume", - Tag: "varint,8,opt,name=volume", - Filename: "extension_user/extension_user.proto", -} - // Extend inside the scope of another type, using a message. type LoginMessage struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -130,7 +115,7 @@ func (m *LoginMessage) Reset() { *m = LoginMessage{} } func (m *LoginMessage) String() string { return proto.CompactTextString(m) } func (*LoginMessage) ProtoMessage() {} func (*LoginMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_359ba8abf543ca10, []int{2} + return xxx_File_extension_user_extension_user_proto_rawdesc_gzipped, []int{2} } func (m *LoginMessage) XXX_Unmarshal(b []byte) error { @@ -151,15 +136,6 @@ func (m *LoginMessage) XXX_DiscardUnknown() { var xxx_messageInfo_LoginMessage proto.InternalMessageInfo -var E_LoginMessage_UserMessage = &proto.ExtensionDesc{ - ExtendedType: (*extension_base.BaseMessage)(nil), - ExtensionType: (*UserMessage)(nil), - Field: 16, - Name: "extension_user.LoginMessage.user_message", - Tag: "bytes,16,opt,name=user_message", - Filename: "extension_user/extension_user.proto", -} - type Detail struct { Color *string `protobuf:"bytes,1,opt,name=color" json:"color,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -171,7 +147,7 @@ func (m *Detail) Reset() { *m = Detail{} } func (m *Detail) String() string { return proto.CompactTextString(m) } func (*Detail) ProtoMessage() {} func (*Detail) Descriptor() ([]byte, []int) { - return fileDescriptor_359ba8abf543ca10, []int{3} + return xxx_File_extension_user_extension_user_proto_rawdesc_gzipped, []int{3} } func (m *Detail) XXX_Unmarshal(b []byte) error { @@ -211,7 +187,7 @@ func (m *Announcement) Reset() { *m = Announcement{} } func (m *Announcement) String() string { return proto.CompactTextString(m) } func (*Announcement) ProtoMessage() {} func (*Announcement) Descriptor() ([]byte, []int) { - return fileDescriptor_359ba8abf543ca10, []int{4} + return xxx_File_extension_user_extension_user_proto_rawdesc_gzipped, []int{4} } func (m *Announcement) XXX_Unmarshal(b []byte) error { @@ -239,15 +215,6 @@ func (m *Announcement) GetWords() string { return "" } -var E_Announcement_LoudExt = &proto.ExtensionDesc{ - ExtendedType: (*LoudMessage)(nil), - ExtensionType: (*Announcement)(nil), - Field: 100, - Name: "extension_user.Announcement.loud_ext", - Tag: "bytes,100,opt,name=loud_ext", - Filename: "extension_user/extension_user.proto", -} - // Something that can be put in a message set. type OldStyleParcel struct { Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` @@ -261,7 +228,7 @@ func (m *OldStyleParcel) Reset() { *m = OldStyleParcel{} } func (m *OldStyleParcel) String() string { return proto.CompactTextString(m) } func (*OldStyleParcel) ProtoMessage() {} func (*OldStyleParcel) Descriptor() ([]byte, []int) { - return fileDescriptor_359ba8abf543ca10, []int{5} + return xxx_File_extension_user_extension_user_proto_rawdesc_gzipped, []int{5} } func (m *OldStyleParcel) XXX_Unmarshal(b []byte) error { @@ -296,15 +263,6 @@ func (m *OldStyleParcel) GetHeight() int32 { return 0 } -var E_OldStyleParcel_MessageSetExtension = &proto.ExtensionDesc{ - ExtendedType: (*extension_base.OldStyleMessage)(nil), - ExtensionType: (*OldStyleParcel)(nil), - Field: 2001, - Name: "extension_user.OldStyleParcel", - Tag: "bytes,2001,opt,name=message_set_extension", - Filename: "extension_user/extension_user.proto", -} - var E_UserMessage = &proto.ExtensionDesc{ ExtendedType: (*extension_base.BaseMessage)(nil), ExtensionType: (*UserMessage)(nil), @@ -350,60 +308,135 @@ var E_Detail = &proto.ExtensionDesc{ Filename: "extension_user/extension_user.proto", } +var E_LoudMessage_Volume = &proto.ExtensionDesc{ + ExtendedType: (*extension_base.BaseMessage)(nil), + ExtensionType: (*uint32)(nil), + Field: 8, + Name: "extension_user.LoudMessage.volume", + Tag: "varint,8,opt,name=volume", + Filename: "extension_user/extension_user.proto", +} + +var E_LoginMessage_UserMessage = &proto.ExtensionDesc{ + ExtendedType: (*extension_base.BaseMessage)(nil), + ExtensionType: (*UserMessage)(nil), + Field: 16, + Name: "extension_user.LoginMessage.user_message", + Tag: "bytes,16,opt,name=user_message", + Filename: "extension_user/extension_user.proto", +} + +var E_Announcement_LoudExt = &proto.ExtensionDesc{ + ExtendedType: (*LoudMessage)(nil), + ExtensionType: (*Announcement)(nil), + Field: 100, + Name: "extension_user.Announcement.loud_ext", + Tag: "bytes,100,opt,name=loud_ext", + Filename: "extension_user/extension_user.proto", +} + +var E_OldStyleParcel_MessageSetExtension = &proto.ExtensionDesc{ + ExtendedType: (*extension_base.OldStyleMessage)(nil), + ExtensionType: (*OldStyleParcel)(nil), + Field: 2001, + Name: "extension_user.OldStyleParcel", + Tag: "bytes,2001,opt,name=message_set_extension", + Filename: "extension_user/extension_user.proto", +} + func init() { + proto.RegisterFile("extension_user/extension_user.proto", xxx_File_extension_user_extension_user_proto_rawdesc_gzipped) proto.RegisterType((*UserMessage)(nil), "extension_user.UserMessage") - proto.RegisterExtension(E_LoudMessage_Volume) proto.RegisterType((*LoudMessage)(nil), "extension_user.LoudMessage") - proto.RegisterExtension(E_LoginMessage_UserMessage) proto.RegisterType((*LoginMessage)(nil), "extension_user.LoginMessage") proto.RegisterType((*Detail)(nil), "extension_user.Detail") - proto.RegisterExtension(E_Announcement_LoudExt) proto.RegisterType((*Announcement)(nil), "extension_user.Announcement") - proto.RegisterExtension(E_OldStyleParcel_MessageSetExtension) - proto.RegisterMessageSetType((*OldStyleParcel)(nil), 2001, "extension_user.OldStyleParcel") proto.RegisterType((*OldStyleParcel)(nil), "extension_user.OldStyleParcel") proto.RegisterExtension(E_UserMessage) proto.RegisterExtension(E_ExtraMessage) proto.RegisterExtension(E_Width) proto.RegisterExtension(E_Area) proto.RegisterExtension(E_Detail) + proto.RegisterExtension(E_LoudMessage_Volume) + proto.RegisterExtension(E_LoginMessage_UserMessage) + proto.RegisterExtension(E_Announcement_LoudExt) + proto.RegisterExtension(E_OldStyleParcel_MessageSetExtension) } -func init() { - proto.RegisterFile("extension_user/extension_user.proto", fileDescriptor_359ba8abf543ca10) -} - -var fileDescriptor_359ba8abf543ca10 = []byte{ - // 492 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x51, 0x6f, 0x94, 0x40, - 0x10, 0x0e, 0x6d, 0x8f, 0x5e, 0x87, 0x6b, 0xad, 0xa8, 0xcd, 0xa5, 0x6a, 0x25, 0x18, 0x13, 0x62, - 0xd2, 0x23, 0x62, 0x7c, 0xe1, 0x49, 0x2f, 0xde, 0x93, 0x67, 0x34, 0x54, 0x5f, 0xf4, 0x81, 0xec, - 0xc1, 0xc8, 0x91, 0xc2, 0xae, 0xd9, 0x5d, 0xec, 0xe9, 0xd3, 0xfd, 0x26, 0xff, 0x89, 0xff, 0xc8, - 0xb0, 0x2c, 0x2d, 0x87, 0xc9, 0xc5, 0xbe, 0x90, 0xfd, 0x86, 0x6f, 0xbe, 0x99, 0xfd, 0x66, 0x00, - 0x9e, 0xe2, 0x4a, 0x22, 0x15, 0x39, 0xa3, 0x71, 0x25, 0x90, 0xfb, 0x9b, 0x70, 0xf2, 0x9d, 0x33, - 0xc9, 0xec, 0xa3, 0xcd, 0xe8, 0x69, 0x27, 0x69, 0x41, 0x04, 0xfa, 0x9b, 0xb0, 0x49, 0x3a, 0x7d, - 0x76, 0x13, 0xc5, 0x95, 0xe4, 0xc4, 0xef, 0xe1, 0x86, 0xe6, 0xbe, 0x02, 0xeb, 0xb3, 0x40, 0xfe, - 0x1e, 0x85, 0x20, 0x19, 0xda, 0x36, 0xec, 0x51, 0x52, 0xe2, 0xd8, 0x70, 0x0c, 0xef, 0x20, 0x52, - 0xe7, 0x3a, 0xc6, 0x09, 0xbd, 0x1c, 0xef, 0x34, 0xb1, 0xfa, 0xec, 0xce, 0xc1, 0x9a, 0xb3, 0x2a, - 0xd5, 0x69, 0xcf, 0x87, 0xc3, 0xf4, 0x78, 0xbd, 0x5e, 0xaf, 0x77, 0x82, 0x97, 0x60, 0xfe, 0x60, - 0x45, 0x55, 0xa2, 0xfd, 0x70, 0xd2, 0xeb, 0x6b, 0x4a, 0x04, 0xea, 0x84, 0xf1, 0xd0, 0x31, 0xbc, - 0xc3, 0x48, 0x53, 0xdd, 0x4b, 0x18, 0xcd, 0x59, 0x96, 0x53, 0xfd, 0x36, 0xf8, 0x0a, 0xa3, 0xfa, - 0xa2, 0x71, 0xa9, 0xbb, 0xda, 0x2a, 0x75, 0xec, 0x18, 0x9e, 0x15, 0x74, 0x29, 0xca, 0xba, 0xce, - 0xad, 0x22, 0xab, 0xba, 0x01, 0xee, 0x19, 0x98, 0x6f, 0x51, 0x92, 0xbc, 0xb0, 0xef, 0xc3, 0x20, - 0x61, 0x05, 0xe3, 0xfa, 0xb6, 0x0d, 0x70, 0x7f, 0xc1, 0xe8, 0x0d, 0xa5, 0xac, 0xa2, 0x09, 0x96, - 0x48, 0x65, 0xcd, 0xba, 0x62, 0x3c, 0x15, 0x2d, 0x4b, 0x81, 0xe0, 0x13, 0x0c, 0x0b, 0x56, 0xa5, - 0xb5, 0x97, 0xf6, 0x3f, 0xb5, 0x3b, 0xd6, 0x8c, 0x53, 0xd5, 0xde, 0xa3, 0x3e, 0xa5, 0x5b, 0x22, - 0xda, 0xaf, 0xa5, 0x66, 0x2b, 0xe9, 0xfe, 0x36, 0xe0, 0xe8, 0x43, 0x91, 0x5e, 0xc8, 0x9f, 0x05, - 0x7e, 0x24, 0x3c, 0xc1, 0xa2, 0x33, 0x91, 0x9d, 0xeb, 0x89, 0x9c, 0x80, 0xb9, 0xc4, 0x3c, 0x5b, - 0x4a, 0x35, 0x93, 0x41, 0xa4, 0x51, 0x20, 0xe1, 0x81, 0xb6, 0x2c, 0x16, 0x28, 0xe3, 0xeb, 0x92, - 0xf6, 0x93, 0xbe, 0x81, 0x6d, 0x91, 0xb6, 0xcb, 0x3f, 0x77, 0x54, 0x9b, 0x67, 0xfd, 0x36, 0x37, - 0x9b, 0x89, 0xee, 0x69, 0xf9, 0x0b, 0x94, 0xb3, 0x96, 0x18, 0xde, 0x6a, 0x5a, 0x83, 0xdb, 0x4d, - 0x2b, 0x8c, 0xe1, 0x50, 0xad, 0xeb, 0xff, 0xa9, 0x1f, 0x28, 0xf5, 0xc7, 0x93, 0xfe, 0xae, 0xcf, - 0xea, 0x67, 0xab, 0x3f, 0xc2, 0x0e, 0x0a, 0x5f, 0xc0, 0xe0, 0x2a, 0x4f, 0xe5, 0x72, 0xbb, 0xb0, - 0xa9, 0x7c, 0x6e, 0x98, 0xa1, 0x0f, 0x7b, 0x84, 0x23, 0xd9, 0x9e, 0xb1, 0xef, 0x18, 0xde, 0x6e, - 0xa4, 0x88, 0xe1, 0x3b, 0x30, 0xd3, 0x66, 0xe5, 0xb6, 0xa6, 0xdc, 0x75, 0x76, 0x3d, 0x2b, 0x38, - 0xe9, 0x7b, 0xd3, 0x6c, 0x6b, 0xa4, 0x25, 0xa6, 0xd3, 0x2f, 0xaf, 0xb3, 0x5c, 0x2e, 0xab, 0xc5, - 0x24, 0x61, 0xa5, 0x9f, 0xb1, 0x82, 0xd0, 0xcc, 0x57, 0x1f, 0xf3, 0xa2, 0xfa, 0xd6, 0x1c, 0x92, - 0xf3, 0x0c, 0xe9, 0x79, 0xc6, 0x7c, 0x89, 0x42, 0xa6, 0x44, 0x92, 0xde, 0x7f, 0xe5, 0x6f, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xdf, 0x18, 0x64, 0x15, 0x77, 0x04, 0x00, 0x00, -} +var xxx_File_extension_user_extension_user_proto_rawdesc = []byte{ + // 1143 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x23, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, + 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x5f, 0x75, 0x73, 0x65, 0x72, 0x1a, 0x23, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, + 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x25, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x2f, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x35, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x22, 0x4c, 0x0a, 0x0b, 0x4c, 0x6f, 0x75, 0x64, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, 0x80, 0x80, 0x80, + 0x02, 0x32, 0x33, 0x0a, 0x06, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x1b, 0x2e, 0x65, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, + 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, + 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x22, 0x6b, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x5b, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x22, 0x1e, 0x0a, 0x06, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, + 0x6c, 0x6f, 0x72, 0x22, 0x7a, 0x0a, 0x0c, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x32, 0x54, 0x0a, 0x08, 0x6c, 0x6f, 0x75, + 0x64, 0x5f, 0x65, 0x78, 0x74, 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x75, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, + 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x78, 0x74, 0x22, + 0xb2, 0x01, 0x0a, 0x0e, 0x4f, 0x6c, 0x64, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x50, 0x61, 0x72, 0x63, + 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x32, 0x74, + 0x0a, 0x15, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x65, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x4f, 0x6c, 0x64, 0x53, 0x74, 0x79, 0x6c, + 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xd1, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1e, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, + 0x2e, 0x4f, 0x6c, 0x64, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x50, 0x61, 0x72, 0x63, 0x65, 0x6c, 0x52, + 0x13, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x5b, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x3a, 0x5f, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, + 0x61, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x72, 0x61, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x3a, 0x31, 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12, 0x1b, 0x2e, 0x65, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, + 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, + 0x77, 0x69, 0x64, 0x74, 0x68, 0x3a, 0x2f, 0x0a, 0x04, 0x61, 0x72, 0x65, 0x61, 0x12, 0x1b, 0x2e, + 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x42, + 0x61, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x04, 0x61, 0x72, 0x65, 0x61, 0x3a, 0x4b, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, + 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x11, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, + 0x75, 0x73, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x64, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, + 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, +} + +var xxx_File_extension_user_extension_user_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_extension_user_extension_user_proto_rawdesc) diff --git a/protoc-gen-go/testdata/grpc/grpc.pb.go b/protoc-gen-go/testdata/grpc/grpc.pb.go index 62dba4185e..fcc46e79cf 100644 --- a/protoc-gen-go/testdata/grpc/grpc.pb.go +++ b/protoc-gen-go/testdata/grpc/grpc.pb.go @@ -4,18 +4,12 @@ package testing import ( - fmt "fmt" + context "context" proto "github.com/golang/protobuf/proto" - context "golang.org/x/net/context" + protoapi "github.com/golang/protobuf/protoapi" grpc "google.golang.org/grpc" - math "math" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -32,7 +26,7 @@ func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } func (*SimpleRequest) ProtoMessage() {} func (*SimpleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_81ea47a3f88c2082, []int{0} + return xxx_File_grpc_grpc_proto_rawdesc_gzipped, []int{0} } func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { @@ -63,7 +57,7 @@ func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } func (*SimpleResponse) ProtoMessage() {} func (*SimpleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_81ea47a3f88c2082, []int{1} + return xxx_File_grpc_grpc_proto_rawdesc_gzipped, []int{1} } func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { @@ -94,7 +88,7 @@ func (m *StreamMsg) Reset() { *m = StreamMsg{} } func (m *StreamMsg) String() string { return proto.CompactTextString(m) } func (*StreamMsg) ProtoMessage() {} func (*StreamMsg) Descriptor() ([]byte, []int) { - return fileDescriptor_81ea47a3f88c2082, []int{2} + return xxx_File_grpc_grpc_proto_rawdesc_gzipped, []int{2} } func (m *StreamMsg) XXX_Unmarshal(b []byte) error { @@ -125,7 +119,7 @@ func (m *StreamMsg2) Reset() { *m = StreamMsg2{} } func (m *StreamMsg2) String() string { return proto.CompactTextString(m) } func (*StreamMsg2) ProtoMessage() {} func (*StreamMsg2) Descriptor() ([]byte, []int) { - return fileDescriptor_81ea47a3f88c2082, []int{3} + return xxx_File_grpc_grpc_proto_rawdesc_gzipped, []int{3} } func (m *StreamMsg2) XXX_Unmarshal(b []byte) error { @@ -147,33 +141,47 @@ func (m *StreamMsg2) XXX_DiscardUnknown() { var xxx_messageInfo_StreamMsg2 proto.InternalMessageInfo func init() { + proto.RegisterFile("grpc/grpc.proto", xxx_File_grpc_grpc_proto_rawdesc_gzipped) proto.RegisterType((*SimpleRequest)(nil), "grpc.testing.SimpleRequest") proto.RegisterType((*SimpleResponse)(nil), "grpc.testing.SimpleResponse") proto.RegisterType((*StreamMsg)(nil), "grpc.testing.StreamMsg") proto.RegisterType((*StreamMsg2)(nil), "grpc.testing.StreamMsg2") } -func init() { proto.RegisterFile("grpc/grpc.proto", fileDescriptor_81ea47a3f88c2082) } - -var fileDescriptor_81ea47a3f88c2082 = []byte{ - // 244 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0x2f, 0x2a, 0x48, - 0xd6, 0x07, 0x11, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x3c, 0x60, 0x76, 0x49, 0x6a, 0x71, - 0x49, 0x66, 0x5e, 0xba, 0x12, 0x3f, 0x17, 0x6f, 0x70, 0x66, 0x6e, 0x41, 0x4e, 0x6a, 0x50, 0x6a, - 0x61, 0x69, 0x6a, 0x71, 0x89, 0x92, 0x00, 0x17, 0x1f, 0x4c, 0xa0, 0xb8, 0x20, 0x3f, 0xaf, 0x38, - 0x55, 0x89, 0x9b, 0x8b, 0x33, 0xb8, 0xa4, 0x28, 0x35, 0x31, 0xd7, 0xb7, 0x38, 0x5d, 0x89, 0x87, - 0x8b, 0x0b, 0xce, 0x31, 0x32, 0x9a, 0xc1, 0xc4, 0xc5, 0x12, 0x92, 0x5a, 0x5c, 0x22, 0xe4, 0xc6, - 0xc5, 0x19, 0x9a, 0x97, 0x58, 0x54, 0xe9, 0x9c, 0x98, 0x93, 0x23, 0x24, 0xad, 0x87, 0x6c, 0x85, - 0x1e, 0x8a, 0xf9, 0x52, 0x32, 0xd8, 0x25, 0x21, 0x76, 0x09, 0xb9, 0x70, 0x71, 0xb9, 0xe4, 0x97, - 0xe7, 0x15, 0x83, 0xad, 0xc0, 0x6f, 0x90, 0x38, 0x9a, 0x24, 0xcc, 0x55, 0x06, 0x8c, 0x42, 0xce, - 0x5c, 0x1c, 0xa1, 0x05, 0x50, 0x33, 0x70, 0x29, 0xc3, 0xef, 0x10, 0x0d, 0x46, 0x21, 0x5b, 0x2e, - 0x16, 0xa7, 0xcc, 0x94, 0x4c, 0xdc, 0x06, 0x48, 0xe0, 0x90, 0x30, 0xd2, 0x60, 0x34, 0x60, 0x74, - 0x72, 0x88, 0xb2, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, - 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x07, 0xc7, 0x40, 0x52, 0x69, 0x1a, 0x84, 0x91, 0xac, 0x9b, 0x9e, - 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x0f, 0x32, 0x22, 0x25, 0xb1, 0x24, 0x11, 0x1c, 0x4d, 0xd6, 0x50, - 0x03, 0x93, 0xd8, 0xc0, 0x8a, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x90, 0xb9, 0x95, 0x42, - 0xc2, 0x01, 0x00, 0x00, -} +var xxx_File_grpc_grpc_proto_rawdesc = []byte{ + // 450 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x0f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0c, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x22, + 0x0f, 0x0a, 0x0d, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x0b, 0x0a, 0x09, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x22, + 0x0c, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x32, 0x32, 0x98, 0x02, + 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x43, + 0x61, 0x6c, 0x6c, 0x12, 0x1b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1c, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, + 0x0a, 0x0a, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1b, 0x2e, 0x67, + 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x6d, 0x70, + 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, + 0x73, 0x67, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x08, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x12, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x1a, 0x1c, 0x2e, 0x67, 0x72, 0x70, 0x63, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x3d, 0x0a, 0x04, 0x42, 0x69, 0x64, + 0x69, 0x12, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, + 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x1a, 0x18, 0x2e, 0x67, 0x72, 0x70, + 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x4d, 0x73, 0x67, 0x32, 0x28, 0x01, 0x30, 0x01, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, + 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x3b, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var xxx_File_grpc_grpc_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_grpc_grpc_proto_rawdesc) // Reference imports to suppress errors if they are not otherwise used. var _ context.Context diff --git a/protoc-gen-go/testdata/import_public/a.pb.go b/protoc-gen-go/testdata/import_public/a.pb.go index fa511fcbef..9bc29a859f 100644 --- a/protoc-gen-go/testdata/import_public/a.pb.go +++ b/protoc-gen-go/testdata/import_public/a.pb.go @@ -4,61 +4,50 @@ package import_public import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" sub "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub" - math "math" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -const Default_M_DefaultField = sub.Default_M_DefaultField - -// M from public import import_public/sub/a.proto -type M = sub.M -type M_OneofInt32 = sub.M_OneofInt32 -type M_OneofInt64 = sub.M_OneofInt64 - -// M_Grouping from public import import_public/sub/a.proto -type M_Grouping = sub.M_Grouping +// Symbols defined in public import of import_public/sub/a.proto -// M_Submessage from public import import_public/sub/a.proto -type M_Submessage = sub.M_Submessage -type M_Submessage_SubmessageOneofInt32 = sub.M_Submessage_SubmessageOneofInt32 -type M_Submessage_SubmessageOneofInt64 = sub.M_Submessage_SubmessageOneofInt64 - -// E from public import import_public/sub/a.proto type E = sub.E +const E_ZERO = sub.E_ZERO + var E_name = sub.E_name var E_value = sub.E_value -const E_ZERO = E(sub.E_ZERO) - -// M_Subenum from public import import_public/sub/a.proto type M_Subenum = sub.M_Subenum +const M_M_ZERO = sub.M_M_ZERO + var M_Subenum_name = sub.M_Subenum_name var M_Subenum_value = sub.M_Subenum_value -const M_M_ZERO = M_Subenum(sub.M_M_ZERO) - -// M_Submessage_Submessage_Subenum from public import import_public/sub/a.proto type M_Submessage_Submessage_Subenum = sub.M_Submessage_Submessage_Subenum +const M_Submessage_M_SUBMESSAGE_ZERO = sub.M_Submessage_M_SUBMESSAGE_ZERO + var M_Submessage_Submessage_Subenum_name = sub.M_Submessage_Submessage_Subenum_name var M_Submessage_Submessage_Subenum_value = sub.M_Submessage_Submessage_Subenum_value -const M_Submessage_M_SUBMESSAGE_ZERO = M_Submessage_Submessage_Subenum(sub.M_Submessage_M_SUBMESSAGE_ZERO) +type M = sub.M + +const Default_M_DefaultField = sub.Default_M_DefaultField + +type M_OneofInt32 = sub.M_OneofInt32 +type M_OneofInt64 = sub.M_OneofInt64 +type M_Grouping = sub.M_Grouping +type M_Submessage = sub.M_Submessage +type M_Submessage_SubmessageOneofInt32 = sub.M_Submessage_SubmessageOneofInt32 +type M_Submessage_SubmessageOneofInt64 = sub.M_Submessage_SubmessageOneofInt64 var E_ExtensionField = sub.E_ExtensionField @@ -75,7 +64,7 @@ func (m *Public) Reset() { *m = Public{} } func (m *Public) String() string { return proto.CompactTextString(m) } func (*Public) ProtoMessage() {} func (*Public) Descriptor() ([]byte, []int) { - return fileDescriptor_73b7577c95fa6b70, []int{0} + return xxx_File_import_public_a_proto_rawdesc_gzipped, []int{0} } func (m *Public) XXX_Unmarshal(b []byte) error { @@ -118,24 +107,34 @@ func (m *Public) GetLocal() *Local { } func init() { + proto.RegisterFile("import_public/a.proto", xxx_File_import_public_a_proto_rawdesc_gzipped) proto.RegisterType((*Public)(nil), "goproto.test.import_public.Public") } -func init() { proto.RegisterFile("import_public/a.proto", fileDescriptor_73b7577c95fa6b70) } - -var fileDescriptor_73b7577c95fa6b70 = []byte{ - // 195 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcd, 0xcc, 0x2d, 0xc8, - 0x2f, 0x2a, 0x89, 0x2f, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xd6, 0x4f, 0xd4, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0x92, 0x4a, 0xcf, 0x07, 0x33, 0xf4, 0x4a, 0x52, 0x8b, 0x4b, 0xf4, 0x50, 0xd4, 0x48, - 0x49, 0xa2, 0x6a, 0x29, 0x2e, 0x4d, 0x82, 0x69, 0x93, 0x42, 0x33, 0x2d, 0x09, 0x22, 0xac, 0xb4, - 0x98, 0x91, 0x8b, 0x2d, 0x00, 0x2c, 0x24, 0xa4, 0xcf, 0xc5, 0x98, 0x2b, 0xc1, 0xa8, 0xc0, 0xa8, - 0xc1, 0x6d, 0xa4, 0xa8, 0x87, 0xdb, 0x12, 0xbd, 0xe2, 0xd2, 0x24, 0x3d, 0xdf, 0x20, 0xc6, 0x5c, - 0x90, 0x86, 0x54, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x3e, 0xc2, 0x1a, 0x5c, 0x83, 0x18, 0x53, 0x85, - 0xcc, 0xb9, 0x58, 0x73, 0xf2, 0x93, 0x13, 0x73, 0x24, 0x98, 0x09, 0xdb, 0xe2, 0x03, 0x52, 0x18, - 0x04, 0x51, 0xef, 0xe4, 0x18, 0x65, 0x9f, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, - 0xab, 0x9f, 0x9e, 0x9f, 0x93, 0x98, 0x97, 0xae, 0x0f, 0xd6, 0x9a, 0x54, 0x9a, 0x06, 0x61, 0x24, - 0xeb, 0xa6, 0xa7, 0xe6, 0xe9, 0xa6, 0xe7, 0xeb, 0x83, 0xcc, 0x4a, 0x49, 0x2c, 0x49, 0xd4, 0x47, - 0x31, 0x2f, 0x80, 0x21, 0x80, 0x11, 0x10, 0x00, 0x00, 0xff, 0xff, 0x17, 0x83, 0x2d, 0xd4, 0x52, - 0x01, 0x00, 0x00, +var xxx_File_import_public_a_proto_rawdesc = []byte{ + // 338 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x15, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, + 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x2f, 0x73, 0x75, 0x62, 0x2f, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, + 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x62, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa3, 0x01, 0x0a, 0x06, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x12, 0x2f, 0x0a, 0x01, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, + 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x4d, 0x52, 0x01, + 0x6d, 0x12, 0x2f, 0x0a, 0x01, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x67, + 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, + 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x45, 0x52, + 0x01, 0x65, 0x12, 0x37, 0x0a, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x4c, + 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x42, 0x41, 0x5a, 0x3f, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, + 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x50, 0x00, + 0x50, 0x01, } + +var xxx_File_import_public_a_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_a_proto_rawdesc) diff --git a/protoc-gen-go/testdata/import_public/b.pb.go b/protoc-gen-go/testdata/import_public/b.pb.go index 522f215ca2..f9f447e954 100644 --- a/protoc-gen-go/testdata/import_public/b.pb.go +++ b/protoc-gen-go/testdata/import_public/b.pb.go @@ -4,17 +4,11 @@ package import_public import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" sub "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub" - math "math" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -33,7 +27,7 @@ func (m *Local) Reset() { *m = Local{} } func (m *Local) String() string { return proto.CompactTextString(m) } func (*Local) ProtoMessage() {} func (*Local) Descriptor() ([]byte, []int) { - return fileDescriptor_84995586b3d09710, []int{0} + return xxx_File_import_public_b_proto_rawdesc_gzipped, []int{0} } func (m *Local) XXX_Unmarshal(b []byte) error { @@ -69,22 +63,28 @@ func (m *Local) GetE() sub.E { } func init() { + proto.RegisterFile("import_public/b.proto", xxx_File_import_public_b_proto_rawdesc_gzipped) proto.RegisterType((*Local)(nil), "goproto.test.import_public.Local") } -func init() { proto.RegisterFile("import_public/b.proto", fileDescriptor_84995586b3d09710) } - -var fileDescriptor_84995586b3d09710 = []byte{ - // 169 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcd, 0xcc, 0x2d, 0xc8, - 0x2f, 0x2a, 0x89, 0x2f, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xd6, 0x4f, 0xd2, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0x92, 0x4a, 0xcf, 0x07, 0x33, 0xf4, 0x4a, 0x52, 0x8b, 0x4b, 0xf4, 0x50, 0xd4, 0x48, - 0x49, 0xa2, 0x6a, 0x29, 0x2e, 0x4d, 0xd2, 0x4f, 0x84, 0x68, 0x53, 0xca, 0xe4, 0x62, 0xf5, 0xc9, - 0x4f, 0x4e, 0xcc, 0x11, 0xd2, 0xe7, 0x62, 0xcc, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x52, - 0xd4, 0xc3, 0x6d, 0x96, 0x5e, 0x71, 0x69, 0x92, 0x9e, 0x6f, 0x10, 0x63, 0x2e, 0x48, 0x43, 0xaa, - 0x04, 0x93, 0x02, 0xa3, 0x06, 0x1f, 0x61, 0x0d, 0xae, 0x41, 0x8c, 0xa9, 0x4e, 0x8e, 0x51, 0xf6, - 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0x39, 0x89, 0x79, - 0xe9, 0xfa, 0x60, 0x6d, 0x49, 0xa5, 0x69, 0x10, 0x46, 0xb2, 0x6e, 0x7a, 0x6a, 0x9e, 0x6e, 0x7a, - 0xbe, 0x3e, 0xc8, 0x9c, 0x94, 0xc4, 0x92, 0x44, 0x7d, 0x14, 0xb3, 0x00, 0x01, 0x00, 0x00, 0xff, - 0xff, 0x35, 0x0e, 0x6a, 0x82, 0xfc, 0x00, 0x00, 0x00, +var xxx_File_import_public_b_proto_rawdesc = []byte{ + // 252 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x15, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, + 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x2f, 0x73, 0x75, 0x62, 0x2f, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x69, + 0x0a, 0x05, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x12, 0x2f, 0x0a, 0x01, 0x6d, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, + 0x73, 0x75, 0x62, 0x2e, 0x4d, 0x52, 0x01, 0x6d, 0x12, 0x2f, 0x0a, 0x01, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x45, 0x52, 0x01, 0x65, 0x42, 0x41, 0x5a, 0x3f, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, + 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, + 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, } + +var xxx_File_import_public_b_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_b_proto_rawdesc) diff --git a/protoc-gen-go/testdata/import_public/importing/importing.pb.go b/protoc-gen-go/testdata/import_public/importing/importing.pb.go index 3f0f37e9a4..d902c930da 100644 --- a/protoc-gen-go/testdata/import_public/importing/importing.pb.go +++ b/protoc-gen-go/testdata/import_public/importing/importing.pb.go @@ -4,18 +4,12 @@ package importing import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" _ "github.com/golang/protobuf/protoc-gen-go/testdata/import_public" sub "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub" - math "math" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -34,7 +28,7 @@ func (m *M) Reset() { *m = M{} } func (m *M) String() string { return proto.CompactTextString(m) } func (*M) ProtoMessage() {} func (*M) Descriptor() ([]byte, []int) { - return fileDescriptor_36b835b3b8f6171a, []int{0} + return xxx_File_import_public_importing_importing_proto_rawdesc_gzipped, []int{0} } func (m *M) XXX_Unmarshal(b []byte) error { @@ -63,23 +57,27 @@ func (m *M) GetM() *sub.M { } func init() { + proto.RegisterFile("import_public/importing/importing.proto", xxx_File_import_public_importing_importing_proto_rawdesc_gzipped) proto.RegisterType((*M)(nil), "goproto.test.import_public.importing.M") } -func init() { - proto.RegisterFile("import_public/importing/importing.proto", fileDescriptor_36b835b3b8f6171a) +var xxx_File_import_public_importing_importing_proto_rawdesc = []byte{ + // 233 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x27, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, + 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, + 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x24, 0x67, 0x6f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x1a, + 0x15, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x61, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x01, 0x4d, 0x12, 0x2f, 0x0a, 0x01, 0x6d, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x4d, 0x52, 0x01, 0x6d, 0x42, 0x4b, 0x5a, 0x49, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, + 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, + 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, + 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, } -var fileDescriptor_36b835b3b8f6171a = []byte{ - // 153 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcf, 0xcc, 0x2d, 0xc8, - 0x2f, 0x2a, 0x89, 0x2f, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xd6, 0x87, 0xf0, 0x32, 0xf3, 0xd2, 0x11, - 0x2c, 0xbd, 0x82, 0xa2, 0xfc, 0x92, 0x7c, 0x21, 0x95, 0xf4, 0x7c, 0x30, 0x43, 0xaf, 0x24, 0xb5, - 0xb8, 0x44, 0x0f, 0x45, 0x97, 0x1e, 0x5c, 0xad, 0x94, 0x28, 0xaa, 0x71, 0x89, 0x10, 0xcd, 0x4a, - 0x26, 0x5c, 0x8c, 0xbe, 0x42, 0xfa, 0x5c, 0x8c, 0xb9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, - 0x8a, 0x7a, 0x78, 0x4c, 0x2b, 0x2e, 0x4d, 0xd2, 0xf3, 0x0d, 0x62, 0xcc, 0x75, 0xf2, 0x8e, 0xf2, - 0x4c, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, - 0x4b, 0xd7, 0x07, 0x6b, 0x4b, 0x2a, 0x4d, 0x83, 0x30, 0x92, 0x75, 0xd3, 0x53, 0xf3, 0x74, 0xd3, - 0xf3, 0xf5, 0x41, 0xe6, 0xa4, 0x24, 0x96, 0x24, 0xea, 0xe3, 0xf0, 0x0f, 0x20, 0x00, 0x00, 0xff, - 0xff, 0xd8, 0x7e, 0x58, 0x1c, 0xe9, 0x00, 0x00, 0x00, -} +var xxx_File_import_public_importing_importing_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_importing_importing_proto_rawdesc) diff --git a/protoc-gen-go/testdata/import_public/sub/a.pb.go b/protoc-gen-go/testdata/import_public/sub/a.pb.go index 6f815678ae..1d88e1ae1d 100644 --- a/protoc-gen-go/testdata/import_public/sub/a.pb.go +++ b/protoc-gen-go/testdata/import_public/sub/a.pb.go @@ -4,16 +4,10 @@ package sub import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -54,7 +48,7 @@ func (x *E) UnmarshalJSON(data []byte) error { } func (E) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_382f7805394b5c4e, []int{0} + return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0} } type M_Subenum int32 @@ -91,7 +85,7 @@ func (x *M_Subenum) UnmarshalJSON(data []byte) error { } func (M_Subenum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_382f7805394b5c4e, []int{0, 0} + return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0, 0} } type M_Submessage_Submessage_Subenum int32 @@ -128,7 +122,7 @@ func (x *M_Submessage_Submessage_Subenum) UnmarshalJSON(data []byte) error { } func (M_Submessage_Submessage_Subenum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_382f7805394b5c4e, []int{0, 1, 0} + return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0, 1, 0} } type M struct { @@ -149,7 +143,7 @@ func (m *M) Reset() { *m = M{} } func (m *M) String() string { return proto.CompactTextString(m) } func (*M) ProtoMessage() {} func (*M) Descriptor() ([]byte, []int) { - return fileDescriptor_382f7805394b5c4e, []int{0} + return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0} } func (m *M) XXX_Unmarshal(b []byte) error { @@ -249,7 +243,7 @@ func (m *M_Grouping) Reset() { *m = M_Grouping{} } func (m *M_Grouping) String() string { return proto.CompactTextString(m) } func (*M_Grouping) ProtoMessage() {} func (*M_Grouping) Descriptor() ([]byte, []int) { - return fileDescriptor_382f7805394b5c4e, []int{0, 0} + return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0, 0} } func (m *M_Grouping) XXX_Unmarshal(b []byte) error { @@ -291,7 +285,7 @@ func (m *M_Submessage) Reset() { *m = M_Submessage{} } func (m *M_Submessage) String() string { return proto.CompactTextString(m) } func (*M_Submessage) ProtoMessage() {} func (*M_Submessage) Descriptor() ([]byte, []int) { - return fileDescriptor_382f7805394b5c4e, []int{0, 1} + return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0, 1} } func (m *M_Submessage) XXX_Unmarshal(b []byte) error { @@ -367,6 +361,7 @@ var E_ExtensionField = &proto.ExtensionDesc{ } func init() { + proto.RegisterFile("import_public/sub/a.proto", xxx_File_import_public_sub_a_proto_rawdesc_gzipped) proto.RegisterEnum("goproto.test.import_public.sub.E", E_name, E_value) proto.RegisterEnum("goproto.test.import_public.sub.M_Subenum", M_Subenum_name, M_Subenum_value) proto.RegisterEnum("goproto.test.import_public.sub.M_Submessage_Submessage_Subenum", M_Submessage_Submessage_Subenum_name, M_Submessage_Submessage_Subenum_value) @@ -376,34 +371,57 @@ func init() { proto.RegisterExtension(E_ExtensionField) } -func init() { proto.RegisterFile("import_public/sub/a.proto", fileDescriptor_382f7805394b5c4e) } - -var fileDescriptor_382f7805394b5c4e = []byte{ - // 410 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0xbb, 0x49, 0x5a, 0xd2, 0x09, 0xe1, 0xcf, 0x8a, 0x22, 0xd3, 0x03, 0x98, 0x9c, 0xac, - 0x56, 0x5d, 0x4b, 0x26, 0xf2, 0xa1, 0x37, 0x82, 0xdc, 0x82, 0x90, 0x55, 0xc9, 0x16, 0x97, 0x5e, - 0x2c, 0x6f, 0xbc, 0x5e, 0x2c, 0xd9, 0xbb, 0x56, 0xbc, 0x2b, 0xf1, 0x08, 0xbc, 0x17, 0x2f, 0x86, - 0xbc, 0xb6, 0x93, 0x46, 0x04, 0xe8, 0x6d, 0x3d, 0xf3, 0xfd, 0xbe, 0xd1, 0x7c, 0x1e, 0x78, 0x53, - 0x54, 0xb5, 0xdc, 0xa8, 0xa4, 0xd6, 0xb4, 0x2c, 0xd6, 0x6e, 0xa3, 0xa9, 0x9b, 0x92, 0x7a, 0x23, - 0x95, 0xc4, 0x6f, 0xb9, 0x34, 0x0f, 0xa2, 0x58, 0xa3, 0xc8, 0x9e, 0x8e, 0x34, 0x9a, 0x9e, 0x1f, - 0x40, 0x69, 0x87, 0x2e, 0x7e, 0x4e, 0x00, 0x85, 0xd8, 0x83, 0x51, 0xe5, 0x59, 0xc8, 0x46, 0xce, - 0xcc, 0x5b, 0x90, 0x7f, 0xbb, 0x91, 0xd0, 0x8b, 0x46, 0x95, 0x87, 0xdf, 0xc3, 0x4c, 0x0a, 0x26, - 0xf3, 0xa4, 0x10, 0xea, 0x83, 0x67, 0x8d, 0x6c, 0xe4, 0x1c, 0x7f, 0x3e, 0x8a, 0xc0, 0x14, 0xbf, - 0xb4, 0xb5, 0x3d, 0x89, 0xbf, 0xb4, 0xc6, 0x36, 0x72, 0xc6, 0x0f, 0x25, 0xfe, 0x12, 0xdf, 0xc0, - 0x94, 0x6f, 0xa4, 0xae, 0x0b, 0xc1, 0xad, 0x89, 0x8d, 0x1c, 0xf0, 0x2e, 0xfe, 0x3b, 0x9f, 0xdc, - 0xf6, 0x44, 0xb4, 0x65, 0xb1, 0x03, 0xf3, 0x8c, 0xe5, 0xa9, 0x2e, 0x55, 0x92, 0x17, 0xac, 0xcc, - 0xac, 0x13, 0x1b, 0x39, 0xa7, 0xd7, 0xe3, 0x8c, 0xe5, 0xd1, 0xd3, 0xbe, 0x73, 0xd3, 0x36, 0xce, - 0x2f, 0x61, 0x3a, 0xf0, 0xf8, 0x1d, 0xcc, 0x8c, 0x43, 0xcf, 0x1c, 0xb7, 0x4c, 0x04, 0xa6, 0xd4, - 0x89, 0x7f, 0x21, 0x80, 0x58, 0xd3, 0x8a, 0x35, 0x4d, 0xca, 0x19, 0xf6, 0xe1, 0x75, 0xb3, 0xfd, - 0x4a, 0x1e, 0xae, 0x8f, 0xfa, 0xf5, 0x5f, 0xed, 0xfa, 0x77, 0xbb, 0x20, 0xfe, 0xc2, 0xf9, 0x4b, - 0x13, 0xdb, 0xf8, 0x30, 0xe7, 0x2f, 0x17, 0x97, 0x80, 0x77, 0xd3, 0x93, 0x58, 0x53, 0x26, 0x74, - 0x85, 0xcf, 0xe0, 0x65, 0x98, 0xc4, 0xdf, 0x56, 0x61, 0x10, 0xc7, 0x1f, 0x6f, 0x83, 0xe4, 0x3e, - 0x88, 0xee, 0x5e, 0x1c, 0xad, 0xac, 0x03, 0x43, 0xcc, 0x5e, 0x8b, 0x33, 0x78, 0x32, 0xb0, 0x00, - 0x27, 0xe1, 0x00, 0xcc, 0x87, 0xdf, 0x63, 0x54, 0x17, 0x73, 0x40, 0x01, 0x9e, 0xc2, 0xa4, 0xeb, - 0x5e, 0x7f, 0x85, 0xe7, 0xec, 0x87, 0x62, 0xa2, 0x29, 0xa4, 0xe8, 0x14, 0xf8, 0x11, 0xa7, 0x61, - 0x82, 0x38, 0x8d, 0x9e, 0x6d, 0x51, 0x93, 0xe3, 0x2a, 0xb8, 0xff, 0xc4, 0x0b, 0xf5, 0x5d, 0x53, - 0xb2, 0x96, 0x95, 0xcb, 0x65, 0x99, 0x0a, 0xee, 0x1a, 0x2b, 0xaa, 0xf3, 0xee, 0xb1, 0xbe, 0xe2, - 0x4c, 0x5c, 0x71, 0xe9, 0xb6, 0xde, 0x59, 0xaa, 0x52, 0xf7, 0x8f, 0xab, 0xfd, 0x1d, 0x00, 0x00, - 0xff, 0xff, 0x13, 0x4f, 0x31, 0x07, 0x04, 0x03, 0x00, 0x00, -} +var xxx_File_import_public_sub_a_proto_rawdesc = []byte{ + // 772 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, + 0x73, 0x75, 0x62, 0x2f, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x67, 0x6f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, + 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x1a, 0x19, 0x69, 0x6d, 0x70, + 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x73, 0x75, 0x62, 0x2f, 0x62, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x88, 0x04, 0x0a, 0x01, 0x4d, 0x12, 0x32, 0x0a, 0x02, + 0x6d, 0x32, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x4d, 0x32, 0x52, 0x02, 0x6d, 0x32, + 0x12, 0x21, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, + 0x74, 0x33, 0x32, 0x12, 0x21, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x74, + 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, + 0x66, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x46, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, + 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0a, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x4d, 0x2e, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x28, + 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x3a, 0x03, 0x64, 0x65, 0x66, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, + 0x75, 0x6c, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x2b, 0x0a, 0x08, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x69, 0x6e, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0xc3, 0x01, 0x0a, 0x0a, 0x53, 0x75, 0x62, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x36, 0x0a, 0x16, 0x73, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x5f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x14, 0x73, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x36, 0x0a, 0x16, + 0x73, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, + 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x14, + 0x73, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x49, + 0x6e, 0x74, 0x36, 0x34, 0x22, 0x2b, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x5f, 0x53, 0x75, 0x62, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x5f, + 0x53, 0x55, 0x42, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, + 0x00, 0x42, 0x18, 0x0a, 0x16, 0x73, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, + 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x15, 0x0a, 0x07, 0x53, + 0x75, 0x62, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x5f, 0x5a, 0x45, 0x52, 0x4f, + 0x10, 0x00, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x2a, 0x0d, 0x0a, 0x01, 0x45, 0x12, 0x08, 0x0a, 0x04, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, + 0x3a, 0x4b, 0x0a, 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x12, 0x22, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x4d, 0x32, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x45, 0x5a, + 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, + 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, + 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x2f, 0x73, 0x75, 0x62, +} + +var xxx_File_import_public_sub_a_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_sub_a_proto_rawdesc) diff --git a/protoc-gen-go/testdata/import_public/sub/b.pb.go b/protoc-gen-go/testdata/import_public/sub/b.pb.go index cb4ea17e8c..5e1598205c 100644 --- a/protoc-gen-go/testdata/import_public/sub/b.pb.go +++ b/protoc-gen-go/testdata/import_public/sub/b.pb.go @@ -4,16 +4,10 @@ package sub import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -31,7 +25,7 @@ func (m *M2) Reset() { *m = M2{} } func (m *M2) String() string { return proto.CompactTextString(m) } func (*M2) ProtoMessage() {} func (*M2) Descriptor() ([]byte, []int) { - return fileDescriptor_fc66afda3d7c2232, []int{0} + return xxx_File_import_public_sub_b_proto_rawdesc_gzipped, []int{0} } var extRange_M2 = []proto.ExtensionRange{ @@ -61,20 +55,22 @@ func (m *M2) XXX_DiscardUnknown() { var xxx_messageInfo_M2 proto.InternalMessageInfo func init() { + proto.RegisterFile("import_public/sub/b.proto", xxx_File_import_public_sub_b_proto_rawdesc_gzipped) proto.RegisterType((*M2)(nil), "goproto.test.import_public.sub.M2") } -func init() { proto.RegisterFile("import_public/sub/b.proto", fileDescriptor_fc66afda3d7c2232) } - -var fileDescriptor_fc66afda3d7c2232 = []byte{ - // 132 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, - 0x2f, 0x2a, 0x89, 0x2f, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xd6, 0x2f, 0x2e, 0x4d, 0xd2, 0x4f, 0xd2, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x4b, 0xcf, 0x07, 0x33, 0xf4, 0x4a, 0x52, 0x8b, 0x4b, - 0xf4, 0x50, 0xd4, 0xe9, 0x15, 0x97, 0x26, 0x29, 0xf1, 0x71, 0x31, 0xf9, 0x1a, 0x69, 0x71, 0x70, - 0x30, 0x0a, 0x34, 0x34, 0x34, 0x34, 0x30, 0x39, 0xb9, 0x46, 0x39, 0xa7, 0x67, 0x96, 0x64, 0x94, - 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0x4d, 0x48, - 0x2a, 0x4d, 0x83, 0x30, 0x92, 0x75, 0xd3, 0x53, 0xf3, 0x74, 0xd3, 0xf3, 0xf5, 0x41, 0x46, 0xa6, - 0x24, 0x96, 0x24, 0xea, 0x63, 0x58, 0x0f, 0x08, 0x00, 0x00, 0xff, 0xff, 0x87, 0x44, 0x22, 0x2d, - 0x92, 0x00, 0x00, 0x00, +var xxx_File_import_public_sub_b_proto_rawdesc = []byte{ + // 146 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, + 0x73, 0x75, 0x62, 0x2f, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x67, 0x6f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, + 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x22, 0x0e, 0x0a, 0x02, 0x4d, + 0x32, 0x2a, 0x08, 0x08, 0x01, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x42, 0x45, 0x5a, 0x43, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, + 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x73, + 0x75, 0x62, } + +var xxx_File_import_public_sub_b_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_sub_b_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/fmt/m.pb.go b/protoc-gen-go/testdata/imports/fmt/m.pb.go index 9f774fe064..3f11f89cea 100644 --- a/protoc-gen-go/testdata/imports/fmt/m.pb.go +++ b/protoc-gen-go/testdata/imports/fmt/m.pb.go @@ -4,16 +4,10 @@ package fmt import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -30,7 +24,7 @@ func (m *M) Reset() { *m = M{} } func (m *M) String() string { return proto.CompactTextString(m) } func (*M) ProtoMessage() {} func (*M) Descriptor() ([]byte, []int) { - return fileDescriptor_72c126fcd452e392, []int{0} + return xxx_File_imports_fmt_m_proto_rawdesc_gzipped, []int{0} } func (m *M) XXX_Unmarshal(b []byte) error { @@ -52,18 +46,19 @@ func (m *M) XXX_DiscardUnknown() { var xxx_messageInfo_M proto.InternalMessageInfo func init() { + proto.RegisterFile("imports/fmt/m.proto", xxx_File_imports_fmt_m_proto_rawdesc_gzipped) proto.RegisterType((*M)(nil), "fmt.M") } -func init() { proto.RegisterFile("imports/fmt/m.proto", fileDescriptor_72c126fcd452e392) } - -var fileDescriptor_72c126fcd452e392 = []byte{ - // 109 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xce, 0xcc, 0x2d, 0xc8, - 0x2f, 0x2a, 0x29, 0xd6, 0x4f, 0xcb, 0x2d, 0xd1, 0xcf, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, - 0x62, 0x4e, 0xcb, 0x2d, 0x51, 0x62, 0xe6, 0x62, 0xf4, 0x75, 0xb2, 0x8f, 0xb2, 0x4d, 0xcf, 0x2c, - 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x07, - 0x2b, 0x4a, 0x2a, 0x4d, 0x83, 0x30, 0x92, 0x75, 0xd3, 0x53, 0xf3, 0x74, 0xd3, 0xf3, 0xf5, 0x4b, - 0x52, 0x8b, 0x4b, 0x52, 0x12, 0x4b, 0x12, 0xf5, 0x91, 0x8c, 0x4c, 0x62, 0x03, 0xab, 0x31, 0x06, - 0x04, 0x00, 0x00, 0xff, 0xff, 0xc4, 0xc9, 0xee, 0xbe, 0x68, 0x00, 0x00, 0x00, +var xxx_File_imports_fmt_m_proto_rawdesc = []byte{ + // 104 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x13, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x66, 0x6d, 0x74, 0x2f, 0x6d, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x66, 0x6d, 0x74, 0x22, 0x03, 0x0a, 0x01, 0x4d, 0x42, + 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, + 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, + 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x66, 0x6d, 0x74, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } + +var xxx_File_imports_fmt_m_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_fmt_m_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go b/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go index 1cec006b9d..fc500797d1 100644 --- a/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go +++ b/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go @@ -4,16 +4,10 @@ package test_a_1 import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -39,7 +33,7 @@ func (x E1) String() string { } func (E1) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_c1091de3fa870a14, []int{0} + return xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped, []int{0} } type M1 struct { @@ -52,7 +46,7 @@ func (m *M1) Reset() { *m = M1{} } func (m *M1) String() string { return proto.CompactTextString(m) } func (*M1) ProtoMessage() {} func (*M1) Descriptor() ([]byte, []int) { - return fileDescriptor_c1091de3fa870a14, []int{0} + return xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped, []int{0} } func (m *M1) XXX_Unmarshal(b []byte) error { @@ -84,7 +78,7 @@ func (m *M1_1) Reset() { *m = M1_1{} } func (m *M1_1) String() string { return proto.CompactTextString(m) } func (*M1_1) ProtoMessage() {} func (*M1_1) Descriptor() ([]byte, []int) { - return fileDescriptor_c1091de3fa870a14, []int{1} + return xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped, []int{1} } func (m *M1_1) XXX_Unmarshal(b []byte) error { @@ -113,24 +107,25 @@ func (m *M1_1) GetM1() *M1 { } func init() { + proto.RegisterFile("imports/test_a_1/m1.proto", xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped) proto.RegisterEnum("test.a.E1", E1_name, E1_value) proto.RegisterType((*M1)(nil), "test.a.M1") proto.RegisterType((*M1_1)(nil), "test.a.M1_1") } -func init() { proto.RegisterFile("imports/test_a_1/m1.proto", fileDescriptor_c1091de3fa870a14) } - -var fileDescriptor_c1091de3fa870a14 = []byte{ - // 165 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, - 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8c, 0x37, 0xd4, 0xcf, 0x35, 0xd4, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x03, 0x09, 0xe9, 0x25, 0x2a, 0xb1, 0x70, 0x31, 0xf9, - 0x1a, 0x2a, 0x29, 0x71, 0xb1, 0xf8, 0x1a, 0xc6, 0x1b, 0x0a, 0x49, 0x71, 0x31, 0xe5, 0x1a, 0x4a, - 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x71, 0xe9, 0x41, 0x94, 0xe8, 0xf9, 0x1a, 0x06, 0x31, 0xe5, - 0x1a, 0x6a, 0x09, 0x72, 0x31, 0xb9, 0x1a, 0x0a, 0x71, 0x73, 0xb1, 0xbb, 0x1a, 0xc6, 0x47, 0xb9, - 0x06, 0xf9, 0x0b, 0x30, 0x38, 0xb9, 0x44, 0x39, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, - 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0xcd, 0x4f, 0x2a, 0x4d, 0x83, - 0x30, 0x92, 0x75, 0xd3, 0x53, 0xf3, 0x74, 0xd3, 0xf3, 0xc1, 0x4e, 0x48, 0x49, 0x2c, 0x49, 0xd4, - 0x47, 0x77, 0x53, 0x12, 0x1b, 0x58, 0xa1, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xcc, 0xae, 0xc9, - 0xcd, 0xae, 0x00, 0x00, 0x00, +var xxx_File_imports_test_a_1_m1_proto_rawdesc = []byte{ + // 174 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, + 0x5f, 0x31, 0x2f, 0x6d, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x74, 0x65, 0x73, + 0x74, 0x2e, 0x61, 0x22, 0x04, 0x0a, 0x02, 0x4d, 0x31, 0x22, 0x22, 0x0a, 0x04, 0x4d, 0x31, 0x5f, + 0x31, 0x12, 0x1a, 0x0a, 0x02, 0x6d, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x31, 0x52, 0x02, 0x6d, 0x31, 0x2a, 0x11, 0x0a, + 0x02, 0x45, 0x31, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x31, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, + 0x42, 0x44, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, + 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, + 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } + +var xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_a_1_m1_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go b/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go index 0563d580ca..de1d6bb2f1 100644 --- a/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go +++ b/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go @@ -4,16 +4,10 @@ package test_a_1 import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -30,7 +24,7 @@ func (m *M2) Reset() { *m = M2{} } func (m *M2) String() string { return proto.CompactTextString(m) } func (*M2) ProtoMessage() {} func (*M2) Descriptor() ([]byte, []int) { - return fileDescriptor_20cf27515c0d621c, []int{0} + return xxx_File_imports_test_a_1_m2_proto_rawdesc_gzipped, []int{0} } func (m *M2) XXX_Unmarshal(b []byte) error { @@ -52,19 +46,20 @@ func (m *M2) XXX_DiscardUnknown() { var xxx_messageInfo_M2 proto.InternalMessageInfo func init() { + proto.RegisterFile("imports/test_a_1/m2.proto", xxx_File_imports_test_a_1_m2_proto_rawdesc_gzipped) proto.RegisterType((*M2)(nil), "test.a.M2") } -func init() { proto.RegisterFile("imports/test_a_1/m2.proto", fileDescriptor_20cf27515c0d621c) } - -var fileDescriptor_20cf27515c0d621c = []byte{ - // 114 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, - 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8c, 0x37, 0xd4, 0xcf, 0x35, 0xd2, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x03, 0x09, 0xe9, 0x25, 0x2a, 0xb1, 0x70, 0x31, 0xf9, - 0x1a, 0x39, 0xb9, 0x44, 0x39, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, - 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0x15, 0x26, 0x95, 0xa6, 0x41, 0x18, 0xc9, 0xba, - 0xe9, 0xa9, 0x79, 0xba, 0xe9, 0xf9, 0x60, 0xb3, 0x52, 0x12, 0x4b, 0x12, 0xf5, 0xd1, 0x0d, 0x4f, - 0x62, 0x03, 0x2b, 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xe3, 0xe0, 0x7e, 0xc0, 0x77, 0x00, - 0x00, 0x00, +var xxx_File_imports_test_a_1_m2_proto_rawdesc = []byte{ + // 119 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, + 0x5f, 0x31, 0x2f, 0x6d, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x74, 0x65, 0x73, + 0x74, 0x2e, 0x61, 0x22, 0x04, 0x0a, 0x02, 0x4d, 0x32, 0x42, 0x44, 0x5a, 0x42, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, + 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, + 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } + +var xxx_File_imports_test_a_1_m2_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_a_1_m2_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go b/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go index cbc8430b07..d8836f0c73 100644 --- a/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go +++ b/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go @@ -4,16 +4,10 @@ package test_a_2 import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -30,7 +24,7 @@ func (m *M3) Reset() { *m = M3{} } func (m *M3) String() string { return proto.CompactTextString(m) } func (*M3) ProtoMessage() {} func (*M3) Descriptor() ([]byte, []int) { - return fileDescriptor_ff9d8f834875c9c5, []int{0} + return xxx_File_imports_test_a_2_m3_proto_rawdesc_gzipped, []int{0} } func (m *M3) XXX_Unmarshal(b []byte) error { @@ -52,19 +46,20 @@ func (m *M3) XXX_DiscardUnknown() { var xxx_messageInfo_M3 proto.InternalMessageInfo func init() { + proto.RegisterFile("imports/test_a_2/m3.proto", xxx_File_imports_test_a_2_m3_proto_rawdesc_gzipped) proto.RegisterType((*M3)(nil), "test.a.M3") } -func init() { proto.RegisterFile("imports/test_a_2/m3.proto", fileDescriptor_ff9d8f834875c9c5) } - -var fileDescriptor_ff9d8f834875c9c5 = []byte{ - // 114 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, - 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8c, 0x37, 0xd2, 0xcf, 0x35, 0xd6, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x03, 0x09, 0xe9, 0x25, 0x2a, 0xb1, 0x70, 0x31, 0xf9, - 0x1a, 0x3b, 0xb9, 0x44, 0x39, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, - 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0x15, 0x26, 0x95, 0xa6, 0x41, 0x18, 0xc9, 0xba, - 0xe9, 0xa9, 0x79, 0xba, 0xe9, 0xf9, 0x60, 0xb3, 0x52, 0x12, 0x4b, 0x12, 0xf5, 0xd1, 0x0d, 0x4f, - 0x62, 0x03, 0x2b, 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x23, 0x86, 0x27, 0x47, 0x77, 0x00, - 0x00, 0x00, +var xxx_File_imports_test_a_2_m3_proto_rawdesc = []byte{ + // 119 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, + 0x5f, 0x32, 0x2f, 0x6d, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x74, 0x65, 0x73, + 0x74, 0x2e, 0x61, 0x22, 0x04, 0x0a, 0x02, 0x4d, 0x33, 0x42, 0x44, 0x5a, 0x42, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, + 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, + 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x32, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } + +var xxx_File_imports_test_a_2_m3_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_a_2_m3_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go b/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go index 2771b839aa..8fc62698ee 100644 --- a/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go +++ b/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go @@ -4,16 +4,10 @@ package test_a_2 import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -30,7 +24,7 @@ func (m *M4) Reset() { *m = M4{} } func (m *M4) String() string { return proto.CompactTextString(m) } func (*M4) ProtoMessage() {} func (*M4) Descriptor() ([]byte, []int) { - return fileDescriptor_fdd24f82f6c5a786, []int{0} + return xxx_File_imports_test_a_2_m4_proto_rawdesc_gzipped, []int{0} } func (m *M4) XXX_Unmarshal(b []byte) error { @@ -52,19 +46,20 @@ func (m *M4) XXX_DiscardUnknown() { var xxx_messageInfo_M4 proto.InternalMessageInfo func init() { + proto.RegisterFile("imports/test_a_2/m4.proto", xxx_File_imports_test_a_2_m4_proto_rawdesc_gzipped) proto.RegisterType((*M4)(nil), "test.a.M4") } -func init() { proto.RegisterFile("imports/test_a_2/m4.proto", fileDescriptor_fdd24f82f6c5a786) } - -var fileDescriptor_fdd24f82f6c5a786 = []byte{ - // 114 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, - 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8c, 0x37, 0xd2, 0xcf, 0x35, 0xd1, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x03, 0x09, 0xe9, 0x25, 0x2a, 0xb1, 0x70, 0x31, 0xf9, - 0x9a, 0x38, 0xb9, 0x44, 0x39, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, - 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0x15, 0x26, 0x95, 0xa6, 0x41, 0x18, 0xc9, 0xba, - 0xe9, 0xa9, 0x79, 0xba, 0xe9, 0xf9, 0x60, 0xb3, 0x52, 0x12, 0x4b, 0x12, 0xf5, 0xd1, 0x0d, 0x4f, - 0x62, 0x03, 0x2b, 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x58, 0xcb, 0x10, 0xc8, 0x77, 0x00, - 0x00, 0x00, +var xxx_File_imports_test_a_2_m4_proto_rawdesc = []byte{ + // 119 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, + 0x5f, 0x32, 0x2f, 0x6d, 0x34, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x74, 0x65, 0x73, + 0x74, 0x2e, 0x61, 0x22, 0x04, 0x0a, 0x02, 0x4d, 0x34, 0x42, 0x44, 0x5a, 0x42, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, + 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, + 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x32, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } + +var xxx_File_imports_test_a_2_m4_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_a_2_m4_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go b/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go index 51592e7264..f74b49e627 100644 --- a/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go +++ b/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go @@ -4,16 +4,10 @@ package beta import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -30,7 +24,7 @@ func (m *M1) Reset() { *m = M1{} } func (m *M1) String() string { return proto.CompactTextString(m) } func (*M1) ProtoMessage() {} func (*M1) Descriptor() ([]byte, []int) { - return fileDescriptor_7f49573d035512a8, []int{0} + return xxx_File_imports_test_b_1_m1_proto_rawdesc_gzipped, []int{0} } func (m *M1) XXX_Unmarshal(b []byte) error { @@ -52,19 +46,21 @@ func (m *M1) XXX_DiscardUnknown() { var xxx_messageInfo_M1 proto.InternalMessageInfo func init() { + proto.RegisterFile("imports/test_b_1/m1.proto", xxx_File_imports_test_b_1_m1_proto_rawdesc_gzipped) proto.RegisterType((*M1)(nil), "test.b.part1.M1") } -func init() { proto.RegisterFile("imports/test_b_1/m1.proto", fileDescriptor_7f49573d035512a8) } - -var fileDescriptor_7f49573d035512a8 = []byte{ - // 125 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, - 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8a, 0x37, 0xd4, 0xcf, 0x35, 0xd4, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x09, 0xe9, 0x25, 0xe9, 0x15, 0x24, 0x16, 0x95, - 0x18, 0x2a, 0xb1, 0x70, 0x31, 0xf9, 0x1a, 0x3a, 0x79, 0x46, 0xb9, 0xa7, 0x67, 0x96, 0x64, 0x94, - 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0x95, 0x27, - 0x95, 0xa6, 0x41, 0x18, 0xc9, 0xba, 0xe9, 0xa9, 0x79, 0xba, 0xe9, 0xf9, 0x60, 0x13, 0x53, 0x12, - 0x4b, 0x12, 0xf5, 0xd1, 0xad, 0xb0, 0x4e, 0x4a, 0x2d, 0x49, 0x4c, 0x62, 0x03, 0xab, 0x36, 0x06, - 0x04, 0x00, 0x00, 0xff, 0xff, 0x4a, 0xf1, 0x3b, 0x7f, 0x82, 0x00, 0x00, 0x00, +var xxx_File_imports_test_b_1_m1_proto_rawdesc = []byte{ + // 130 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x62, + 0x5f, 0x31, 0x2f, 0x6d, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x74, 0x65, 0x73, + 0x74, 0x2e, 0x62, 0x2e, 0x70, 0x61, 0x72, 0x74, 0x31, 0x22, 0x04, 0x0a, 0x02, 0x4d, 0x31, 0x42, + 0x49, 0x5a, 0x47, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, + 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, + 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x62, 0x5f, 0x31, 0x3b, 0x62, 0x65, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } + +var xxx_File_imports_test_b_1_m1_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_b_1_m1_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go b/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go index f31fb0d273..f43a045c82 100644 --- a/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go +++ b/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go @@ -4,16 +4,10 @@ package beta import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -30,7 +24,7 @@ func (m *M2) Reset() { *m = M2{} } func (m *M2) String() string { return proto.CompactTextString(m) } func (*M2) ProtoMessage() {} func (*M2) Descriptor() ([]byte, []int) { - return fileDescriptor_a1becddceeb586f2, []int{0} + return xxx_File_imports_test_b_1_m2_proto_rawdesc_gzipped, []int{0} } func (m *M2) XXX_Unmarshal(b []byte) error { @@ -52,19 +46,21 @@ func (m *M2) XXX_DiscardUnknown() { var xxx_messageInfo_M2 proto.InternalMessageInfo func init() { + proto.RegisterFile("imports/test_b_1/m2.proto", xxx_File_imports_test_b_1_m2_proto_rawdesc_gzipped) proto.RegisterType((*M2)(nil), "test.b.part2.M2") } -func init() { proto.RegisterFile("imports/test_b_1/m2.proto", fileDescriptor_a1becddceeb586f2) } - -var fileDescriptor_a1becddceeb586f2 = []byte{ - // 125 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, - 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8a, 0x37, 0xd4, 0xcf, 0x35, 0xd2, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x09, 0xe9, 0x25, 0xe9, 0x15, 0x24, 0x16, 0x95, - 0x18, 0x29, 0xb1, 0x70, 0x31, 0xf9, 0x1a, 0x39, 0x79, 0x46, 0xb9, 0xa7, 0x67, 0x96, 0x64, 0x94, - 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0x95, 0x27, - 0x95, 0xa6, 0x41, 0x18, 0xc9, 0xba, 0xe9, 0xa9, 0x79, 0xba, 0xe9, 0xf9, 0x60, 0x13, 0x53, 0x12, - 0x4b, 0x12, 0xf5, 0xd1, 0xad, 0xb0, 0x4e, 0x4a, 0x2d, 0x49, 0x4c, 0x62, 0x03, 0xab, 0x36, 0x06, - 0x04, 0x00, 0x00, 0xff, 0xff, 0x44, 0x29, 0xbe, 0x6d, 0x82, 0x00, 0x00, 0x00, +var xxx_File_imports_test_b_1_m2_proto_rawdesc = []byte{ + // 130 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x62, + 0x5f, 0x31, 0x2f, 0x6d, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x74, 0x65, 0x73, + 0x74, 0x2e, 0x62, 0x2e, 0x70, 0x61, 0x72, 0x74, 0x32, 0x22, 0x04, 0x0a, 0x02, 0x4d, 0x32, 0x42, + 0x49, 0x5a, 0x47, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, + 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, + 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x62, 0x5f, 0x31, 0x3b, 0x62, 0x65, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } + +var xxx_File_imports_test_b_1_m2_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_b_1_m2_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go b/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go index 1fef9ea30a..ab5a5fcc26 100644 --- a/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go +++ b/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go @@ -4,17 +4,11 @@ package imports import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" test_a_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" - math "math" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -32,7 +26,7 @@ func (m *A1M1) Reset() { *m = A1M1{} } func (m *A1M1) String() string { return proto.CompactTextString(m) } func (*A1M1) ProtoMessage() {} func (*A1M1) Descriptor() ([]byte, []int) { - return fileDescriptor_3b904a47327455f3, []int{0} + return xxx_File_imports_test_import_a1m1_proto_rawdesc_gzipped, []int{0} } func (m *A1M1) XXX_Unmarshal(b []byte) error { @@ -61,21 +55,23 @@ func (m *A1M1) GetF() *test_a_1.M1 { } func init() { + proto.RegisterFile("imports/test_import_a1m1.proto", xxx_File_imports_test_import_a1m1_proto_rawdesc_gzipped) proto.RegisterType((*A1M1)(nil), "test.A1M1") } -func init() { proto.RegisterFile("imports/test_import_a1m1.proto", fileDescriptor_3b904a47327455f3) } - -var fileDescriptor_3b904a47327455f3 = []byte{ - // 149 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcb, 0xcc, 0x2d, 0xc8, - 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x87, 0x70, 0xe2, 0x13, 0x0d, 0x73, 0x0d, - 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x58, 0x40, 0xe2, 0x52, 0x92, 0x28, 0xaa, 0x12, 0xe3, - 0x0d, 0xf5, 0x61, 0x0a, 0x94, 0x14, 0xb8, 0x58, 0x1c, 0x0d, 0x7d, 0x0d, 0x85, 0x24, 0xb8, 0x18, - 0xd3, 0x24, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0xb8, 0xf4, 0x40, 0xca, 0xf4, 0x12, 0xf5, 0x7c, - 0x0d, 0x83, 0x18, 0xd3, 0x9c, 0xac, 0xa3, 0x2c, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, - 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0x73, 0x12, 0xf3, 0xd2, 0xf5, 0xc1, 0x9a, 0x93, 0x4a, 0xd3, 0x20, - 0x8c, 0x64, 0xdd, 0xf4, 0xd4, 0x3c, 0xdd, 0xf4, 0x7c, 0xb0, 0xf9, 0x29, 0x89, 0x25, 0x89, 0xfa, - 0x50, 0x0b, 0x93, 0xd8, 0xc0, 0xf2, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x84, 0x2f, 0x18, - 0x23, 0xa8, 0x00, 0x00, 0x00, +var xxx_File_imports_test_import_a1m1_proto_rawdesc = []byte{ + // 168 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x1e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x69, + 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x61, 0x31, 0x6d, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x04, 0x74, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x31, 0x2f, 0x6d, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x20, 0x0a, 0x04, 0x41, 0x31, 0x4d, 0x31, 0x12, 0x18, 0x0a, 0x01, 0x66, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x31, + 0x52, 0x01, 0x66, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, + 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } + +var xxx_File_imports_test_import_a1m1_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_import_a1m1_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go b/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go index 13d5dd6fb8..961d4d9e7f 100644 --- a/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go +++ b/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go @@ -4,17 +4,11 @@ package imports import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" test_a_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" - math "math" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -32,7 +26,7 @@ func (m *A1M2) Reset() { *m = A1M2{} } func (m *A1M2) String() string { return proto.CompactTextString(m) } func (*A1M2) ProtoMessage() {} func (*A1M2) Descriptor() ([]byte, []int) { - return fileDescriptor_bdb27b114687957d, []int{0} + return xxx_File_imports_test_import_a1m2_proto_rawdesc_gzipped, []int{0} } func (m *A1M2) XXX_Unmarshal(b []byte) error { @@ -61,21 +55,23 @@ func (m *A1M2) GetF() *test_a_1.M2 { } func init() { + proto.RegisterFile("imports/test_import_a1m2.proto", xxx_File_imports_test_import_a1m2_proto_rawdesc_gzipped) proto.RegisterType((*A1M2)(nil), "test.A1M2") } -func init() { proto.RegisterFile("imports/test_import_a1m2.proto", fileDescriptor_bdb27b114687957d) } - -var fileDescriptor_bdb27b114687957d = []byte{ - // 149 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcb, 0xcc, 0x2d, 0xc8, - 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x87, 0x70, 0xe2, 0x13, 0x0d, 0x73, 0x8d, - 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x58, 0x40, 0xe2, 0x52, 0x92, 0x28, 0xaa, 0x12, 0xe3, - 0x0d, 0xf5, 0x61, 0x0a, 0x94, 0x14, 0xb8, 0x58, 0x1c, 0x0d, 0x7d, 0x8d, 0x84, 0x24, 0xb8, 0x18, - 0xd3, 0x24, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0xb8, 0xf4, 0x40, 0xca, 0xf4, 0x12, 0xf5, 0x7c, - 0x8d, 0x82, 0x18, 0xd3, 0x9c, 0xac, 0xa3, 0x2c, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, - 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0x73, 0x12, 0xf3, 0xd2, 0xf5, 0xc1, 0x9a, 0x93, 0x4a, 0xd3, 0x20, - 0x8c, 0x64, 0xdd, 0xf4, 0xd4, 0x3c, 0xdd, 0xf4, 0x7c, 0xb0, 0xf9, 0x29, 0x89, 0x25, 0x89, 0xfa, - 0x50, 0x0b, 0x93, 0xd8, 0xc0, 0xf2, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x88, 0xfb, - 0xea, 0xa8, 0x00, 0x00, 0x00, +var xxx_File_imports_test_import_a1m2_proto_rawdesc = []byte{ + // 168 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x1e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x69, + 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x61, 0x31, 0x6d, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x04, 0x74, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x31, 0x2f, 0x6d, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x20, 0x0a, 0x04, 0x41, 0x31, 0x4d, 0x32, 0x12, 0x18, 0x0a, 0x01, 0x66, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x32, + 0x52, 0x01, 0x66, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, + 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } + +var xxx_File_imports_test_import_a1m2_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_import_a1m2_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_import_all.pb.go b/protoc-gen-go/testdata/imports/test_import_all.pb.go index 467051708f..df86e7ffff 100644 --- a/protoc-gen-go/testdata/imports/test_import_all.pb.go +++ b/protoc-gen-go/testdata/imports/test_import_all.pb.go @@ -4,20 +4,14 @@ package imports import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - fmt1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt" + protoapi "github.com/golang/protobuf/protoapi" + fmt "github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt" test_a_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" test_a_2 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2" test_b_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1" - math "math" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -31,7 +25,7 @@ type All struct { Am4 *test_a_2.M4 `protobuf:"bytes,4,opt,name=am4,proto3" json:"am4,omitempty"` Bm1 *test_b_1.M1 `protobuf:"bytes,5,opt,name=bm1,proto3" json:"bm1,omitempty"` Bm2 *test_b_1.M2 `protobuf:"bytes,6,opt,name=bm2,proto3" json:"bm2,omitempty"` - Fmt *fmt1.M `protobuf:"bytes,7,opt,name=fmt,proto3" json:"fmt,omitempty"` + Fmt *fmt.M `protobuf:"bytes,7,opt,name=fmt,proto3" json:"fmt,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -41,7 +35,7 @@ func (m *All) Reset() { *m = All{} } func (m *All) String() string { return proto.CompactTextString(m) } func (*All) ProtoMessage() {} func (*All) Descriptor() ([]byte, []int) { - return fileDescriptor_324466f0afc16f77, []int{0} + return xxx_File_imports_test_import_all_proto_rawdesc_gzipped, []int{0} } func (m *All) XXX_Unmarshal(b []byte) error { @@ -104,7 +98,7 @@ func (m *All) GetBm2() *test_b_1.M2 { return nil } -func (m *All) GetFmt() *fmt1.M { +func (m *All) GetFmt() *fmt.M { if m != nil { return m.Fmt } @@ -112,28 +106,45 @@ func (m *All) GetFmt() *fmt1.M { } func init() { + proto.RegisterFile("imports/test_import_all.proto", xxx_File_imports_test_import_all_proto_rawdesc_gzipped) proto.RegisterType((*All)(nil), "test.All") } -func init() { proto.RegisterFile("imports/test_import_all.proto", fileDescriptor_324466f0afc16f77) } - -var fileDescriptor_324466f0afc16f77 = []byte{ - // 258 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0xd0, 0xb1, 0x4e, 0xc3, 0x30, - 0x10, 0x06, 0x60, 0x15, 0x97, 0x20, 0x99, 0x05, 0x85, 0xc5, 0x20, 0x90, 0x50, 0x27, 0x96, 0xda, - 0xb2, 0x9d, 0x05, 0x31, 0xc1, 0xde, 0xa5, 0x23, 0x4b, 0x64, 0x97, 0xc6, 0x54, 0xf2, 0xd5, 0x51, - 0x7a, 0x7d, 0x5e, 0x5e, 0x05, 0xd9, 0x07, 0x12, 0x84, 0x66, 0x4b, 0xfe, 0xef, 0xb7, 0xce, 0x3e, - 0x7e, 0xbf, 0x83, 0x3e, 0x0d, 0x78, 0x50, 0xb8, 0x3d, 0x60, 0x4b, 0x3f, 0xad, 0x8b, 0x51, 0xf6, - 0x43, 0xc2, 0x54, 0xcf, 0x73, 0x7c, 0x7b, 0xf3, 0xa7, 0xe4, 0x5a, 0xad, 0x40, 0x53, 0xe1, 0x14, - 0x99, 0x09, 0x32, 0x0a, 0xec, 0x34, 0x35, 0x27, 0xc9, 0x4f, 0xcf, 0xf2, 0xbf, 0x67, 0x5d, 0xff, - 0x50, 0x07, 0xa8, 0x80, 0xc2, 0xc5, 0xe7, 0x8c, 0xb3, 0x97, 0x18, 0xeb, 0x3b, 0xce, 0x1c, 0x68, - 0x31, 0x7b, 0x98, 0x3d, 0x5e, 0x1a, 0x2e, 0xf3, 0x69, 0xe9, 0xe4, 0x4a, 0xaf, 0x73, 0x4c, 0x6a, - 0xc4, 0xd9, 0x48, 0x4d, 0x56, 0x43, 0x6a, 0x05, 0x1b, 0xa9, 0xcd, 0x6a, 0x49, 0x1b, 0x31, 0x1f, - 0x69, 0x93, 0xb5, 0xa9, 0x17, 0x9c, 0x79, 0xd0, 0xe2, 0xbc, 0xe8, 0x15, 0xa9, 0x97, 0xbd, 0x1b, - 0x50, 0x97, 0xe9, 0x1e, 0x34, 0x75, 0x8c, 0xa8, 0xfe, 0x77, 0x4c, 0xb9, 0x83, 0x07, 0x53, 0x0b, - 0xce, 0x3a, 0x40, 0x71, 0x51, 0x3a, 0x95, 0xec, 0x00, 0xe5, 0x6a, 0x9d, 0xa3, 0xd7, 0xe7, 0xb7, - 0xa7, 0xb0, 0xc3, 0x8f, 0xa3, 0x97, 0x9b, 0x04, 0x2a, 0xa4, 0xe8, 0xf6, 0x41, 0x95, 0xc7, 0xfb, - 0x63, 0x47, 0x1f, 0x9b, 0x65, 0xd8, 0xee, 0x97, 0x21, 0x95, 0xa5, 0xbd, 0x3b, 0x74, 0xea, 0x7b, - 0x55, 0xbe, 0x2a, 0x6e, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x95, 0x39, 0xa3, 0x82, 0x03, 0x02, - 0x00, 0x00, -} +var xxx_File_imports_test_import_all_proto_rawdesc = []byte{ + // 515 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x1d, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x69, + 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x61, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x04, 0x74, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x31, 0x2f, 0x6d, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, + 0x5f, 0x31, 0x2f, 0x6d, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x69, 0x6d, 0x70, + 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x32, 0x2f, 0x6d, 0x33, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x32, 0x2f, 0x6d, 0x34, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, + 0x62, 0x5f, 0x31, 0x2f, 0x6d, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x69, 0x6d, + 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x5f, 0x31, 0x2f, 0x6d, + 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, + 0x2f, 0x66, 0x6d, 0x74, 0x2f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdf, 0x01, 0x0a, + 0x03, 0x41, 0x6c, 0x6c, 0x12, 0x1c, 0x0a, 0x03, 0x61, 0x6d, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0a, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x31, 0x52, 0x03, 0x61, + 0x6d, 0x31, 0x12, 0x1c, 0x0a, 0x03, 0x61, 0x6d, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0a, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x32, 0x52, 0x03, 0x61, 0x6d, 0x32, + 0x12, 0x1c, 0x0a, 0x03, 0x61, 0x6d, 0x33, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x33, 0x52, 0x03, 0x61, 0x6d, 0x33, 0x12, 0x1c, + 0x0a, 0x03, 0x61, 0x6d, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x34, 0x52, 0x03, 0x61, 0x6d, 0x34, 0x12, 0x22, 0x0a, 0x03, + 0x62, 0x6d, 0x31, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x2e, 0x62, 0x2e, 0x70, 0x61, 0x72, 0x74, 0x31, 0x2e, 0x4d, 0x31, 0x52, 0x03, 0x62, 0x6d, 0x31, + 0x12, 0x22, 0x0a, 0x03, 0x62, 0x6d, 0x32, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x2e, 0x62, 0x2e, 0x70, 0x61, 0x72, 0x74, 0x32, 0x2e, 0x4d, 0x32, 0x52, + 0x03, 0x62, 0x6d, 0x32, 0x12, 0x18, 0x0a, 0x03, 0x66, 0x6d, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x06, 0x2e, 0x66, 0x6d, 0x74, 0x2e, 0x4d, 0x52, 0x03, 0x66, 0x6d, 0x74, 0x42, 0x3b, + 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, + 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var xxx_File_imports_test_import_all_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_import_all_proto_rawdesc) diff --git a/protoc-gen-go/testdata/multi/multi1.pb.go b/protoc-gen-go/testdata/multi/multi1.pb.go index 6ff8dd64bd..f15a4ceac5 100644 --- a/protoc-gen-go/testdata/multi/multi1.pb.go +++ b/protoc-gen-go/testdata/multi/multi1.pb.go @@ -4,16 +4,10 @@ package multitest import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -33,7 +27,7 @@ func (m *Multi1) Reset() { *m = Multi1{} } func (m *Multi1) String() string { return proto.CompactTextString(m) } func (*Multi1) ProtoMessage() {} func (*Multi1) Descriptor() ([]byte, []int) { - return fileDescriptor_e0bffc140cd1b1d9, []int{0} + return xxx_File_multi_multi1_proto_rawdesc_gzipped, []int{0} } func (m *Multi1) XXX_Unmarshal(b []byte) error { @@ -76,24 +70,31 @@ func (m *Multi1) GetHatType() Multi3_HatType { } func init() { + proto.RegisterFile("multi/multi1.proto", xxx_File_multi_multi1_proto_rawdesc_gzipped) proto.RegisterType((*Multi1)(nil), "multitest.Multi1") } -func init() { proto.RegisterFile("multi/multi1.proto", fileDescriptor_e0bffc140cd1b1d9) } - -var fileDescriptor_e0bffc140cd1b1d9 = []byte{ - // 200 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xca, 0x2d, 0xcd, 0x29, - 0xc9, 0xd4, 0x07, 0x93, 0x86, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x9c, 0x60, 0x5e, 0x49, - 0x6a, 0x71, 0x89, 0x14, 0xb2, 0xb4, 0x11, 0x44, 0x1a, 0x45, 0xcc, 0x18, 0x22, 0xa6, 0x34, 0x83, - 0x91, 0x8b, 0xcd, 0x17, 0x6c, 0x86, 0x90, 0x26, 0x17, 0x1b, 0x44, 0xb9, 0x04, 0xa3, 0x02, 0x93, - 0x06, 0xb7, 0x91, 0xa0, 0x1e, 0xdc, 0x38, 0x3d, 0xb0, 0x12, 0xa3, 0x20, 0xa8, 0x02, 0x21, 0x5d, - 0x2e, 0xd6, 0xe4, 0xfc, 0x9c, 0xfc, 0x22, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x3e, 0x23, 0x71, 0x0c, - 0x95, 0x7a, 0xce, 0x20, 0xe9, 0x20, 0x88, 0x2a, 0x21, 0x13, 0x2e, 0x8e, 0x8c, 0xc4, 0x92, 0xf8, - 0x92, 0xca, 0x82, 0x54, 0x09, 0x66, 0xb0, 0x0e, 0x49, 0x74, 0x1d, 0xc6, 0x7a, 0x1e, 0x89, 0x25, - 0x21, 0x95, 0x05, 0xa9, 0x41, 0xec, 0x19, 0x10, 0x86, 0x93, 0x73, 0x94, 0x63, 0x7a, 0x66, 0x49, - 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x4e, 0x62, 0x5e, 0xba, 0x3e, 0xd8, - 0xd5, 0x49, 0xa5, 0x69, 0x10, 0x46, 0xb2, 0x6e, 0x7a, 0x6a, 0x9e, 0x6e, 0x7a, 0xbe, 0x3e, 0xc8, - 0xa0, 0x94, 0xc4, 0x92, 0x44, 0x88, 0xe7, 0xac, 0xe1, 0x86, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, - 0x60, 0x7d, 0xfc, 0x9f, 0x27, 0x01, 0x00, 0x00, +var xxx_File_multi_multi1_proto_rawdesc = []byte{ + // 295 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x12, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x31, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x1a, + 0x12, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x32, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, + 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x98, 0x01, 0x0a, 0x06, 0x4d, 0x75, 0x6c, 0x74, + 0x69, 0x31, 0x12, 0x29, 0x0a, 0x06, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x32, 0x18, 0x01, 0x20, 0x02, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4d, + 0x75, 0x6c, 0x74, 0x69, 0x32, 0x52, 0x06, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x32, 0x12, 0x2d, 0x0a, + 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x6d, + 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x32, 0x2e, + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x34, 0x0a, 0x08, + 0x68, 0x61, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, + 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, + 0x33, 0x2e, 0x48, 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x68, 0x61, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, + 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x3b, 0x6d, 0x75, + 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, } + +var xxx_File_multi_multi1_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_multi_multi1_proto_rawdesc) diff --git a/protoc-gen-go/testdata/multi/multi2.pb.go b/protoc-gen-go/testdata/multi/multi2.pb.go index 2eb07ad1a8..021d480612 100644 --- a/protoc-gen-go/testdata/multi/multi2.pb.go +++ b/protoc-gen-go/testdata/multi/multi2.pb.go @@ -4,16 +4,10 @@ package multitest import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -60,7 +54,7 @@ func (x *Multi2_Color) UnmarshalJSON(data []byte) error { } func (Multi2_Color) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a2aebe588a0b2853, []int{0, 0} + return xxx_File_multi_multi2_proto_rawdesc_gzipped, []int{0, 0} } type Multi2 struct { @@ -75,7 +69,7 @@ func (m *Multi2) Reset() { *m = Multi2{} } func (m *Multi2) String() string { return proto.CompactTextString(m) } func (*Multi2) ProtoMessage() {} func (*Multi2) Descriptor() ([]byte, []int) { - return fileDescriptor_a2aebe588a0b2853, []int{0} + return xxx_File_multi_multi2_proto_rawdesc_gzipped, []int{0} } func (m *Multi2) XXX_Unmarshal(b []byte) error { @@ -111,25 +105,28 @@ func (m *Multi2) GetColor() Multi2_Color { } func init() { + proto.RegisterFile("multi/multi2.proto", xxx_File_multi_multi2_proto_rawdesc_gzipped) proto.RegisterEnum("multitest.Multi2_Color", Multi2_Color_name, Multi2_Color_value) proto.RegisterType((*Multi2)(nil), "multitest.Multi2") } -func init() { proto.RegisterFile("multi/multi2.proto", fileDescriptor_a2aebe588a0b2853) } - -var fileDescriptor_a2aebe588a0b2853 = []byte{ - // 202 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xca, 0x2d, 0xcd, 0x29, - 0xc9, 0xd4, 0x07, 0x93, 0x46, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x9c, 0x60, 0x5e, 0x49, - 0x6a, 0x71, 0x89, 0x52, 0x2b, 0x23, 0x17, 0x9b, 0x2f, 0x58, 0x4e, 0x48, 0x95, 0x8b, 0xaf, 0x28, - 0xb5, 0xb0, 0x34, 0xb3, 0x28, 0x35, 0x25, 0xbe, 0x2c, 0x31, 0xa7, 0x34, 0x55, 0x82, 0x51, 0x81, - 0x49, 0x83, 0x35, 0x88, 0x17, 0x26, 0x1a, 0x06, 0x12, 0x14, 0xd2, 0xe5, 0x62, 0x4d, 0xce, 0xcf, - 0xc9, 0x2f, 0x92, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x33, 0x12, 0xd7, 0x83, 0x1b, 0xa6, 0x07, 0x31, - 0x48, 0xcf, 0x19, 0x24, 0x1d, 0x04, 0x51, 0xa5, 0xa4, 0xca, 0xc5, 0x0a, 0xe6, 0x0b, 0x71, 0x70, - 0xb1, 0x38, 0xf9, 0x84, 0xba, 0x0a, 0x30, 0x0a, 0x71, 0x72, 0xb1, 0xba, 0x07, 0xb9, 0xba, 0xfa, - 0x09, 0x30, 0x09, 0xb1, 0x73, 0x31, 0x07, 0xb9, 0xba, 0x08, 0x30, 0x3b, 0x39, 0x47, 0x39, 0xa6, - 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, - 0xeb, 0x83, 0x5d, 0x9b, 0x54, 0x9a, 0x06, 0x61, 0x24, 0xeb, 0xa6, 0xa7, 0xe6, 0xe9, 0xa6, 0xe7, - 0xeb, 0x83, 0xec, 0x4a, 0x49, 0x2c, 0x49, 0x84, 0x78, 0xca, 0x1a, 0x6e, 0x3f, 0x20, 0x00, 0x00, - 0xff, 0xff, 0x49, 0x3b, 0x52, 0x44, 0xec, 0x00, 0x00, 0x00, -} +var xxx_File_multi_multi2_proto_rawdesc = []byte{ + // 236 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x12, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x32, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x22, + 0x85, 0x01, 0x0a, 0x06, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x32, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, + 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x02, + 0x28, 0x05, 0x52, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x17, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x75, 0x6c, + 0x74, 0x69, 0x32, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, + 0x22, 0x25, 0x0a, 0x05, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4c, 0x55, + 0x45, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x10, 0x02, 0x12, 0x07, + 0x0a, 0x03, 0x52, 0x45, 0x44, 0x10, 0x03, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, + 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x6d, 0x75, 0x6c, + 0x74, 0x69, 0x3b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, +} + +var xxx_File_multi_multi2_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_multi_multi2_proto_rawdesc) diff --git a/protoc-gen-go/testdata/multi/multi3.pb.go b/protoc-gen-go/testdata/multi/multi3.pb.go index 9fb771f512..e1dae49a1c 100644 --- a/protoc-gen-go/testdata/multi/multi3.pb.go +++ b/protoc-gen-go/testdata/multi/multi3.pb.go @@ -4,16 +4,10 @@ package multitest import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -57,7 +51,7 @@ func (x *Multi3_HatType) UnmarshalJSON(data []byte) error { } func (Multi3_HatType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_580398fc0bbeeaa7, []int{0, 0} + return xxx_File_multi_multi3_proto_rawdesc_gzipped, []int{0, 0} } type Multi3 struct { @@ -71,7 +65,7 @@ func (m *Multi3) Reset() { *m = Multi3{} } func (m *Multi3) String() string { return proto.CompactTextString(m) } func (*Multi3) ProtoMessage() {} func (*Multi3) Descriptor() ([]byte, []int) { - return fileDescriptor_580398fc0bbeeaa7, []int{0} + return xxx_File_multi_multi3_proto_rawdesc_gzipped, []int{0} } func (m *Multi3) XXX_Unmarshal(b []byte) error { @@ -100,23 +94,26 @@ func (m *Multi3) GetHatType() Multi3_HatType { } func init() { + proto.RegisterFile("multi/multi3.proto", xxx_File_multi_multi3_proto_rawdesc_gzipped) proto.RegisterEnum("multitest.Multi3_HatType", Multi3_HatType_name, Multi3_HatType_value) proto.RegisterType((*Multi3)(nil), "multitest.Multi3") } -func init() { proto.RegisterFile("multi/multi3.proto", fileDescriptor_580398fc0bbeeaa7) } - -var fileDescriptor_580398fc0bbeeaa7 = []byte{ - // 170 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xca, 0x2d, 0xcd, 0x29, - 0xc9, 0xd4, 0x07, 0x93, 0xc6, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x9c, 0x60, 0x5e, 0x49, - 0x6a, 0x71, 0x89, 0x52, 0x1c, 0x17, 0x9b, 0x2f, 0x58, 0x4a, 0xc8, 0x84, 0x8b, 0x23, 0x23, 0xb1, - 0x24, 0xbe, 0xa4, 0xb2, 0x20, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0xcf, 0x48, 0x52, 0x0f, 0xae, - 0x4e, 0x0f, 0xa2, 0x48, 0xcf, 0x23, 0xb1, 0x24, 0xa4, 0xb2, 0x20, 0x35, 0x88, 0x3d, 0x03, 0xc2, - 0x50, 0x92, 0xe3, 0x62, 0x87, 0x8a, 0x09, 0x71, 0x71, 0xb1, 0xb9, 0xb9, 0xba, 0xf8, 0x07, 0x39, - 0x0a, 0x30, 0x0a, 0xb1, 0x73, 0x31, 0xbb, 0xb9, 0x46, 0x09, 0x30, 0x39, 0x39, 0x47, 0x39, 0xa6, - 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, - 0xeb, 0x83, 0x5d, 0x91, 0x54, 0x9a, 0x06, 0x61, 0x24, 0xeb, 0xa6, 0xa7, 0xe6, 0xe9, 0xa6, 0xe7, - 0xeb, 0x83, 0x2c, 0x4a, 0x49, 0x2c, 0x49, 0x84, 0x38, 0xd6, 0x1a, 0x6e, 0x39, 0x20, 0x00, 0x00, - 0xff, 0xff, 0xd5, 0xa4, 0x1a, 0x0e, 0xc4, 0x00, 0x00, 0x00, -} +var xxx_File_multi_multi3_proto_rawdesc = []byte{ + // 196 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x12, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x33, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x22, + 0x5e, 0x0a, 0x06, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x33, 0x12, 0x34, 0x0a, 0x08, 0x68, 0x61, 0x74, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x6d, 0x75, + 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x33, 0x2e, 0x48, + 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x68, 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, + 0x1e, 0x0a, 0x07, 0x48, 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x45, + 0x44, 0x4f, 0x52, 0x41, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x46, 0x45, 0x5a, 0x10, 0x02, 0x42, + 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, + 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, + 0x64, 0x61, 0x74, 0x61, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x3b, 0x6d, 0x75, 0x6c, 0x74, 0x69, + 0x74, 0x65, 0x73, 0x74, +} + +var xxx_File_multi_multi3_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_multi_multi3_proto_rawdesc) diff --git a/protoc-gen-go/testdata/my_test/test.pb.go b/protoc-gen-go/testdata/my_test/test.pb.go index 66c05117da..d5902162e6 100644 --- a/protoc-gen-go/testdata/my_test/test.pb.go +++ b/protoc-gen-go/testdata/my_test/test.pb.go @@ -6,17 +6,12 @@ package test import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" _ "github.com/golang/protobuf/protoc-gen-go/testdata/multi" math "math" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -61,7 +56,7 @@ func (x *HatType) UnmarshalJSON(data []byte) error { } func (HatType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{0} + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{0} } // This enum represents days of the week. @@ -105,7 +100,7 @@ func (x *Days) UnmarshalJSON(data []byte) error { } func (Days) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{1} + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{1} } type Request_Color int32 @@ -148,7 +143,7 @@ func (x *Request_Color) UnmarshalJSON(data []byte) error { } func (Request_Color) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{0, 0} + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{0, 0} } type Reply_Entry_Game int32 @@ -188,7 +183,7 @@ func (x *Reply_Entry_Game) UnmarshalJSON(data []byte) error { } func (Reply_Entry_Game) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{1, 0, 0} + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{1, 0, 0} } // This is a message that might be sent somewhere. @@ -222,7 +217,7 @@ func (m *Request) Reset() { *m = Request{} } func (m *Request) String() string { return proto.CompactTextString(m) } func (*Request) ProtoMessage() {} func (*Request) Descriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{0} + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{0} } func (m *Request) XXX_Unmarshal(b []byte) error { @@ -361,45 +356,6 @@ func (m *Request) GetDoubleExp() float64 { return Default_Request_DoubleExp } -type Request_SomeGroup struct { - GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Request_SomeGroup) Reset() { *m = Request_SomeGroup{} } -func (m *Request_SomeGroup) String() string { return proto.CompactTextString(m) } -func (*Request_SomeGroup) ProtoMessage() {} -func (*Request_SomeGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{0, 0} -} - -func (m *Request_SomeGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Request_SomeGroup.Unmarshal(m, b) -} -func (m *Request_SomeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Request_SomeGroup.Marshal(b, m, deterministic) -} -func (m *Request_SomeGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_Request_SomeGroup.Merge(m, src) -} -func (m *Request_SomeGroup) XXX_Size() int { - return xxx_messageInfo_Request_SomeGroup.Size(m) -} -func (m *Request_SomeGroup) XXX_DiscardUnknown() { - xxx_messageInfo_Request_SomeGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_Request_SomeGroup proto.InternalMessageInfo - -func (m *Request_SomeGroup) GetGroupField() int32 { - if m != nil && m.GroupField != nil { - return *m.GroupField - } - return 0 -} - type Reply struct { Found []*Reply_Entry `protobuf:"bytes,1,rep,name=found" json:"found,omitempty"` CompactKeys []int32 `protobuf:"varint,2,rep,packed,name=compact_keys,json=compactKeys" json:"compact_keys,omitempty"` @@ -413,7 +369,7 @@ func (m *Reply) Reset() { *m = Reply{} } func (m *Reply) String() string { return proto.CompactTextString(m) } func (*Reply) ProtoMessage() {} func (*Reply) Descriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{1} + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{1} } var extRange_Reply = []proto.ExtensionRange{ @@ -456,63 +412,6 @@ func (m *Reply) GetCompactKeys() []int32 { return nil } -type Reply_Entry struct { - KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng" json:"key_that_needs_1234camel_CasIng,omitempty"` - Value *int64 `protobuf:"varint,2,opt,name=value,def=7" json:"value,omitempty"` - XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=MyFieldName2" json:"_my_field_name_2,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Reply_Entry) Reset() { *m = Reply_Entry{} } -func (m *Reply_Entry) String() string { return proto.CompactTextString(m) } -func (*Reply_Entry) ProtoMessage() {} -func (*Reply_Entry) Descriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{1, 0} -} - -func (m *Reply_Entry) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Reply_Entry.Unmarshal(m, b) -} -func (m *Reply_Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Reply_Entry.Marshal(b, m, deterministic) -} -func (m *Reply_Entry) XXX_Merge(src proto.Message) { - xxx_messageInfo_Reply_Entry.Merge(m, src) -} -func (m *Reply_Entry) XXX_Size() int { - return xxx_messageInfo_Reply_Entry.Size(m) -} -func (m *Reply_Entry) XXX_DiscardUnknown() { - xxx_messageInfo_Reply_Entry.DiscardUnknown(m) -} - -var xxx_messageInfo_Reply_Entry proto.InternalMessageInfo - -const Default_Reply_Entry_Value int64 = 7 - -func (m *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 { - if m != nil && m.KeyThatNeeds_1234Camel_CasIng != nil { - return *m.KeyThatNeeds_1234Camel_CasIng - } - return 0 -} - -func (m *Reply_Entry) GetValue() int64 { - if m != nil && m.Value != nil { - return *m.Value - } - return Default_Reply_Entry_Value -} - -func (m *Reply_Entry) GetXMyFieldName_2() int64 { - if m != nil && m.XMyFieldName_2 != nil { - return *m.XMyFieldName_2 - } - return 0 -} - type OtherBase struct { Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -525,7 +424,7 @@ func (m *OtherBase) Reset() { *m = OtherBase{} } func (m *OtherBase) String() string { return proto.CompactTextString(m) } func (*OtherBase) ProtoMessage() {} func (*OtherBase) Descriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{2} + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{2} } var extRange_OtherBase = []proto.ExtensionRange{ @@ -571,7 +470,7 @@ func (m *ReplyExtensions) Reset() { *m = ReplyExtensions{} } func (m *ReplyExtensions) String() string { return proto.CompactTextString(m) } func (*ReplyExtensions) ProtoMessage() {} func (*ReplyExtensions) Descriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{3} + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{3} } func (m *ReplyExtensions) XXX_Unmarshal(b []byte) error { @@ -592,33 +491,6 @@ func (m *ReplyExtensions) XXX_DiscardUnknown() { var xxx_messageInfo_ReplyExtensions proto.InternalMessageInfo -var E_ReplyExtensions_Time = &proto.ExtensionDesc{ - ExtendedType: (*Reply)(nil), - ExtensionType: (*float64)(nil), - Field: 101, - Name: "my.test.ReplyExtensions.time", - Tag: "fixed64,101,opt,name=time", - Filename: "my_test/test.proto", -} - -var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{ - ExtendedType: (*Reply)(nil), - ExtensionType: (*ReplyExtensions)(nil), - Field: 105, - Name: "my.test.ReplyExtensions.carrot", - Tag: "bytes,105,opt,name=carrot", - Filename: "my_test/test.proto", -} - -var E_ReplyExtensions_Donut = &proto.ExtensionDesc{ - ExtendedType: (*OtherBase)(nil), - ExtensionType: (*ReplyExtensions)(nil), - Field: 101, - Name: "my.test.ReplyExtensions.donut", - Tag: "bytes,101,opt,name=donut", - Filename: "my_test/test.proto", -} - type OtherReplyExtensions struct { Key *int32 `protobuf:"varint,1,opt,name=key" json:"key,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -630,7 +502,7 @@ func (m *OtherReplyExtensions) Reset() { *m = OtherReplyExtensions{} } func (m *OtherReplyExtensions) String() string { return proto.CompactTextString(m) } func (*OtherReplyExtensions) ProtoMessage() {} func (*OtherReplyExtensions) Descriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{4} + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{4} } func (m *OtherReplyExtensions) XXX_Unmarshal(b []byte) error { @@ -669,14 +541,7 @@ func (m *OldReply) Reset() { *m = OldReply{} } func (m *OldReply) String() string { return proto.CompactTextString(m) } func (*OldReply) ProtoMessage() {} func (*OldReply) Descriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{5} -} - -func (m *OldReply) MarshalJSON() ([]byte, error) { - return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions) -} -func (m *OldReply) UnmarshalJSON(buf []byte) error { - return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions) + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{5} } var extRange_OldReply = []proto.ExtensionRange{ @@ -730,7 +595,7 @@ func (m *Communique) Reset() { *m = Communique{} } func (m *Communique) String() string { return proto.CompactTextString(m) } func (*Communique) ProtoMessage() {} func (*Communique) Descriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{6} + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{6} } func (m *Communique) XXX_Unmarshal(b []byte) error { @@ -915,6 +780,102 @@ func (*Communique) XXX_OneofWrappers() []interface{} { } } +type Request_SomeGroup struct { + GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Request_SomeGroup) Reset() { *m = Request_SomeGroup{} } +func (m *Request_SomeGroup) String() string { return proto.CompactTextString(m) } +func (*Request_SomeGroup) ProtoMessage() {} +func (*Request_SomeGroup) Descriptor() ([]byte, []int) { + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{0, 0} +} + +func (m *Request_SomeGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Request_SomeGroup.Unmarshal(m, b) +} +func (m *Request_SomeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Request_SomeGroup.Marshal(b, m, deterministic) +} +func (m *Request_SomeGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_Request_SomeGroup.Merge(m, src) +} +func (m *Request_SomeGroup) XXX_Size() int { + return xxx_messageInfo_Request_SomeGroup.Size(m) +} +func (m *Request_SomeGroup) XXX_DiscardUnknown() { + xxx_messageInfo_Request_SomeGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_Request_SomeGroup proto.InternalMessageInfo + +func (m *Request_SomeGroup) GetGroupField() int32 { + if m != nil && m.GroupField != nil { + return *m.GroupField + } + return 0 +} + +type Reply_Entry struct { + KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng" json:"key_that_needs_1234camel_CasIng,omitempty"` + Value *int64 `protobuf:"varint,2,opt,name=value,def=7" json:"value,omitempty"` + XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=MyFieldName2" json:"_my_field_name_2,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Reply_Entry) Reset() { *m = Reply_Entry{} } +func (m *Reply_Entry) String() string { return proto.CompactTextString(m) } +func (*Reply_Entry) ProtoMessage() {} +func (*Reply_Entry) Descriptor() ([]byte, []int) { + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{1, 0} +} + +func (m *Reply_Entry) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Reply_Entry.Unmarshal(m, b) +} +func (m *Reply_Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Reply_Entry.Marshal(b, m, deterministic) +} +func (m *Reply_Entry) XXX_Merge(src proto.Message) { + xxx_messageInfo_Reply_Entry.Merge(m, src) +} +func (m *Reply_Entry) XXX_Size() int { + return xxx_messageInfo_Reply_Entry.Size(m) +} +func (m *Reply_Entry) XXX_DiscardUnknown() { + xxx_messageInfo_Reply_Entry.DiscardUnknown(m) +} + +var xxx_messageInfo_Reply_Entry proto.InternalMessageInfo + +const Default_Reply_Entry_Value int64 = 7 + +func (m *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 { + if m != nil && m.KeyThatNeeds_1234Camel_CasIng != nil { + return *m.KeyThatNeeds_1234Camel_CasIng + } + return 0 +} + +func (m *Reply_Entry) GetValue() int64 { + if m != nil && m.Value != nil { + return *m.Value + } + return Default_Reply_Entry_Value +} + +func (m *Reply_Entry) GetXMyFieldName_2() int64 { + if m != nil && m.XMyFieldName_2 != nil { + return *m.XMyFieldName_2 + } + return 0 +} + type Communique_SomeGroup struct { Member *string `protobuf:"bytes,15,opt,name=member" json:"member,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -926,7 +887,7 @@ func (m *Communique_SomeGroup) Reset() { *m = Communique_SomeGroup{} } func (m *Communique_SomeGroup) String() string { return proto.CompactTextString(m) } func (*Communique_SomeGroup) ProtoMessage() {} func (*Communique_SomeGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{6, 0} + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{6, 0} } func (m *Communique_SomeGroup) XXX_Unmarshal(b []byte) error { @@ -964,7 +925,7 @@ func (m *Communique_Delta) Reset() { *m = Communique_Delta{} } func (m *Communique_Delta) String() string { return proto.CompactTextString(m) } func (*Communique_Delta) ProtoMessage() {} func (*Communique_Delta) Descriptor() ([]byte, []int) { - return fileDescriptor_2c9b60a40d5131b9, []int{6, 1} + return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{6, 1} } func (m *Communique_Delta) XXX_Unmarshal(b []byte) error { @@ -1003,7 +964,35 @@ var E_Donut = &proto.ExtensionDesc{ Filename: "my_test/test.proto", } +var E_ReplyExtensions_Time = &proto.ExtensionDesc{ + ExtendedType: (*Reply)(nil), + ExtensionType: (*float64)(nil), + Field: 101, + Name: "my.test.ReplyExtensions.time", + Tag: "fixed64,101,opt,name=time", + Filename: "my_test/test.proto", +} + +var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{ + ExtendedType: (*Reply)(nil), + ExtensionType: (*ReplyExtensions)(nil), + Field: 105, + Name: "my.test.ReplyExtensions.carrot", + Tag: "bytes,105,opt,name=carrot", + Filename: "my_test/test.proto", +} + +var E_ReplyExtensions_Donut = &proto.ExtensionDesc{ + ExtendedType: (*OtherBase)(nil), + ExtensionType: (*ReplyExtensions)(nil), + Field: 101, + Name: "my.test.ReplyExtensions.donut", + Tag: "bytes,101,opt,name=donut", + Filename: "my_test/test.proto", +} + func init() { + proto.RegisterFile("my_test/test.proto", xxx_File_my_test_test_proto_rawdesc_gzipped) proto.RegisterEnum("my.test.HatType", HatType_name, HatType_value) proto.RegisterEnum("my.test.Days", Days_name, Days_value) proto.RegisterEnum("my.test.Request_Color", Request_Color_name, Request_Color_value) @@ -1011,97 +1000,159 @@ func init() { proto.RegisterType((*Request)(nil), "my.test.Request") proto.RegisterMapType((map[int64]*Reply)(nil), "my.test.Request.MsgMappingEntry") proto.RegisterMapType((map[int32]string)(nil), "my.test.Request.NameMappingEntry") - proto.RegisterType((*Request_SomeGroup)(nil), "my.test.Request.SomeGroup") proto.RegisterType((*Reply)(nil), "my.test.Reply") - proto.RegisterType((*Reply_Entry)(nil), "my.test.Reply.Entry") proto.RegisterType((*OtherBase)(nil), "my.test.OtherBase") - proto.RegisterExtension(E_ReplyExtensions_Time) - proto.RegisterExtension(E_ReplyExtensions_Carrot) - proto.RegisterExtension(E_ReplyExtensions_Donut) proto.RegisterType((*ReplyExtensions)(nil), "my.test.ReplyExtensions") proto.RegisterType((*OtherReplyExtensions)(nil), "my.test.OtherReplyExtensions") proto.RegisterType((*OldReply)(nil), "my.test.OldReply") proto.RegisterType((*Communique)(nil), "my.test.Communique") + proto.RegisterType((*Request_SomeGroup)(nil), "my.test.Request.SomeGroup") + proto.RegisterType((*Reply_Entry)(nil), "my.test.Reply.Entry") proto.RegisterType((*Communique_SomeGroup)(nil), "my.test.Communique.SomeGroup") proto.RegisterType((*Communique_Delta)(nil), "my.test.Communique.Delta") proto.RegisterExtension(E_Tag) proto.RegisterExtension(E_Donut) + proto.RegisterExtension(E_ReplyExtensions_Time) + proto.RegisterExtension(E_ReplyExtensions_Carrot) + proto.RegisterExtension(E_ReplyExtensions_Donut) } -func init() { proto.RegisterFile("my_test/test.proto", fileDescriptor_2c9b60a40d5131b9) } - -var fileDescriptor_2c9b60a40d5131b9 = []byte{ - // 1148 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x56, 0xcf, 0x6e, 0xdb, 0x46, - 0x13, 0x37, 0x49, 0x51, 0x7f, 0x46, 0xfe, 0x6c, 0x7e, 0x0b, 0xd7, 0x66, 0x55, 0x24, 0x61, 0x95, - 0xb8, 0x50, 0xdc, 0x46, 0x8e, 0xd5, 0x02, 0x4d, 0x55, 0x34, 0x88, 0x65, 0xc9, 0x71, 0x10, 0x5b, - 0x2e, 0x36, 0xce, 0xa1, 0xb9, 0x10, 0x6b, 0x69, 0x45, 0xb1, 0xd6, 0x92, 0x8c, 0xb8, 0x2c, 0xcc, - 0x9b, 0x9f, 0xa2, 0x7d, 0x8d, 0xde, 0xfb, 0x0c, 0x7d, 0x26, 0x17, 0x3b, 0xab, 0x48, 0xb2, 0x55, - 0x94, 0x07, 0x82, 0x33, 0xf3, 0x9b, 0xdf, 0xec, 0xce, 0xcc, 0xce, 0x12, 0x88, 0xc8, 0x7d, 0xc9, - 0x53, 0xb9, 0xaf, 0x5e, 0xcd, 0x64, 0x1a, 0xcb, 0x98, 0x94, 0x44, 0xde, 0x54, 0x62, 0x8d, 0x88, - 0x6c, 0x22, 0xc3, 0x7d, 0x7c, 0x1f, 0x68, 0x63, 0xfd, 0xef, 0x22, 0x94, 0x28, 0xff, 0x98, 0xf1, - 0x54, 0x12, 0x07, 0xac, 0x2b, 0x9e, 0xbb, 0x86, 0x67, 0x35, 0x2c, 0xaa, 0x3e, 0x49, 0x03, 0xac, - 0x71, 0xc6, 0x5d, 0xcb, 0x33, 0x1a, 0x1b, 0xad, 0xed, 0xe6, 0x8c, 0xa8, 0x39, 0x73, 0x68, 0x1e, - 0xc5, 0x93, 0x78, 0x4a, 0x15, 0x84, 0xec, 0x81, 0x35, 0x66, 0xd2, 0x2d, 0x20, 0xd2, 0x99, 0x23, - 0x4f, 0x98, 0xbc, 0xc8, 0x13, 0xde, 0x2e, 0x1e, 0xf7, 0xba, 0xe7, 0xf4, 0x90, 0x2a, 0x10, 0x79, - 0x04, 0xe5, 0x21, 0x67, 0xc3, 0x49, 0x18, 0x71, 0xb7, 0xe4, 0x19, 0x0d, 0xb3, 0x6d, 0x85, 0xd1, - 0x88, 0xce, 0x95, 0xe4, 0x05, 0x54, 0xd2, 0x58, 0xf0, 0x60, 0x1a, 0x67, 0x89, 0x5b, 0xf6, 0x8c, - 0x06, 0xb4, 0x6a, 0x2b, 0xc1, 0xdf, 0xc5, 0x82, 0xbf, 0x56, 0x08, 0xba, 0x00, 0x93, 0x2e, 0xac, - 0x47, 0x4c, 0x70, 0x5f, 0xb0, 0x24, 0x09, 0xa3, 0xc0, 0xdd, 0xf0, 0xac, 0x46, 0xb5, 0xf5, 0xe5, - 0x8a, 0x73, 0x9f, 0x09, 0x7e, 0xa6, 0x31, 0xbd, 0x48, 0x4e, 0x73, 0x5a, 0x8d, 0x16, 0x1a, 0x72, - 0x08, 0x55, 0x91, 0x06, 0x73, 0x92, 0x4d, 0x24, 0xf1, 0x56, 0x48, 0xce, 0xd2, 0xe0, 0x0e, 0x07, - 0x88, 0xb9, 0x82, 0x6c, 0x81, 0x3d, 0xe5, 0x29, 0x97, 0xee, 0xba, 0x67, 0x34, 0x6c, 0xaa, 0x05, - 0xb2, 0x03, 0xa5, 0x80, 0x4b, 0x5f, 0x65, 0xd9, 0xf1, 0x8c, 0x46, 0x85, 0x16, 0x03, 0x2e, 0xdf, - 0xf2, 0x9c, 0x3c, 0x06, 0x18, 0x4d, 0x62, 0x26, 0xfd, 0x28, 0x8c, 0x46, 0xee, 0x16, 0x26, 0xa5, - 0xf0, 0x4c, 0x65, 0xa5, 0x82, 0xfa, 0x7e, 0x18, 0x8d, 0x48, 0xfd, 0x13, 0x28, 0x51, 0xa0, 0xcf, - 0x16, 0x99, 0xd3, 0x98, 0x9f, 0x35, 0x46, 0x0b, 0x3e, 0xbf, 0x4e, 0xdc, 0x6d, 0x84, 0xd8, 0x07, - 0xfc, 0xeb, 0xe7, 0x3f, 0xd0, 0x32, 0xea, 0x7b, 0xd7, 0x09, 0xd9, 0x85, 0xea, 0x30, 0xce, 0x2e, - 0x27, 0x5c, 0x47, 0xdb, 0xf1, 0x8c, 0x86, 0x31, 0x8b, 0x06, 0xda, 0x80, 0xe1, 0x9e, 0xcc, 0x61, - 0x18, 0xcf, 0x45, 0x98, 0xb5, 0x84, 0xc2, 0x80, 0x4f, 0x61, 0x26, 0x61, 0xc4, 0xcf, 0x11, 0x04, - 0x07, 0xcf, 0x3f, 0x3d, 0xb4, 0xa2, 0xad, 0xbd, 0xeb, 0xa4, 0xf6, 0x0d, 0x54, 0xe6, 0x45, 0x23, - 0x8f, 0xa0, 0x8a, 0x25, 0xf3, 0x47, 0x21, 0x9f, 0x0c, 0xdd, 0x0a, 0xa6, 0x09, 0x50, 0x75, 0xac, - 0x34, 0xb5, 0x97, 0xe0, 0xdc, 0xaf, 0xd2, 0xa2, 0x43, 0x15, 0x18, 0x3b, 0x74, 0x0b, 0xec, 0xdf, - 0xd8, 0x24, 0xe3, 0xae, 0x89, 0xf9, 0xd4, 0x42, 0xdb, 0x7c, 0x61, 0xd4, 0xce, 0x60, 0xf3, 0x5e, - 0x81, 0x96, 0xdd, 0x89, 0x76, 0x7f, 0xb2, 0xec, 0x5e, 0x6d, 0x6d, 0x2c, 0xd5, 0x38, 0x99, 0xe4, - 0x4b, 0x74, 0xf5, 0x5d, 0xb0, 0xb1, 0xdd, 0x49, 0x09, 0x2c, 0xda, 0xeb, 0x3a, 0x6b, 0xa4, 0x02, - 0xf6, 0x6b, 0xda, 0xeb, 0xf5, 0x1d, 0x83, 0x94, 0xa1, 0xd0, 0x39, 0x7d, 0xdf, 0x73, 0xcc, 0xfa, - 0x1f, 0x26, 0xd8, 0xe8, 0x4b, 0xf6, 0xc0, 0x1e, 0xc5, 0x59, 0x34, 0xc4, 0xf3, 0x54, 0x6d, 0x6d, - 0xdd, 0xa5, 0x6e, 0xea, 0x96, 0xd1, 0x10, 0xb2, 0x0b, 0xeb, 0x83, 0x58, 0x24, 0x6c, 0x80, 0xbd, - 0x91, 0xba, 0xa6, 0x67, 0x35, 0xec, 0x8e, 0xe9, 0x18, 0xb4, 0x3a, 0xd3, 0xbf, 0xe5, 0x79, 0x5a, - 0xfb, 0xd3, 0x00, 0x5b, 0xef, 0xa4, 0x0b, 0x8f, 0xae, 0x78, 0xee, 0xcb, 0xb1, 0x6a, 0x19, 0xce, - 0x87, 0xa9, 0x7f, 0xd0, 0xfa, 0xf6, 0xbb, 0x01, 0x13, 0x7c, 0xe2, 0x1f, 0xb1, 0xf4, 0x4d, 0x14, - 0xb8, 0x86, 0x67, 0x36, 0x2c, 0xfa, 0xc5, 0x15, 0xcf, 0x2f, 0xc6, 0x4c, 0xf6, 0x15, 0x68, 0x8e, - 0xd1, 0x10, 0xb2, 0xb3, 0xbc, 0x7b, 0xab, 0x6d, 0x7c, 0x3f, 0xdb, 0x30, 0xf9, 0x0a, 0x1c, 0x5f, - 0xe4, 0xba, 0x34, 0x3e, 0x1e, 0xa8, 0x16, 0x0e, 0x01, 0x8b, 0xae, 0x9f, 0xe5, 0x58, 0x1e, 0x55, - 0x9a, 0x56, 0xdd, 0x83, 0xc2, 0x6b, 0x26, 0x38, 0x59, 0x87, 0xf2, 0xf1, 0xf9, 0xf9, 0x45, 0xe7, - 0xf0, 0xf4, 0xd4, 0x31, 0x08, 0x40, 0xf1, 0xa2, 0xd7, 0xef, 0xbf, 0x79, 0xe7, 0x98, 0x7b, 0xe5, - 0xf2, 0xd0, 0xb9, 0xb9, 0xb9, 0xb9, 0x31, 0xeb, 0x4f, 0xa1, 0x72, 0x2e, 0xc7, 0x7c, 0xda, 0x61, - 0x29, 0x27, 0x04, 0x0a, 0x8a, 0x16, 0x4b, 0x51, 0xa1, 0xf8, 0xbd, 0x04, 0xfd, 0xcb, 0x80, 0x4d, - 0xcc, 0x52, 0xef, 0x5a, 0xf2, 0x28, 0x0d, 0xe3, 0x28, 0x6d, 0xd5, 0xa1, 0x20, 0x43, 0xc1, 0xc9, - 0xbd, 0x12, 0xb9, 0x5c, 0x75, 0x1c, 0x45, 0x5b, 0xeb, 0x15, 0x14, 0x07, 0x6c, 0x3a, 0x8d, 0xe5, - 0x0a, 0x2a, 0xc4, 0xf2, 0xba, 0x77, 0xb5, 0x0b, 0x76, 0x3a, 0xf3, 0x6b, 0x75, 0xc0, 0x1e, 0xc6, - 0x51, 0x26, 0x09, 0x99, 0x43, 0xe7, 0x8b, 0xc6, 0x50, 0xff, 0x45, 0xa2, 0x5d, 0xeb, 0x0d, 0xd8, - 0x42, 0x9f, 0x7b, 0xe6, 0xd5, 0xe6, 0xad, 0xbb, 0x50, 0x3e, 0x9f, 0x0c, 0x11, 0x87, 0xbb, 0xbf, - 0xbd, 0xbd, 0xbd, 0x2d, 0xb5, 0xcd, 0xb2, 0x51, 0xff, 0xdd, 0x02, 0x38, 0x8a, 0x85, 0xc8, 0xa2, - 0xf0, 0x63, 0xc6, 0xc9, 0x43, 0xa8, 0x0a, 0x76, 0xc5, 0x7d, 0xc1, 0xfd, 0xc1, 0x54, 0x53, 0x94, - 0x69, 0x45, 0xa9, 0xce, 0xf8, 0xd1, 0x34, 0x27, 0x2e, 0x14, 0xa3, 0x4c, 0x5c, 0xf2, 0xa9, 0x6b, - 0x2b, 0xf6, 0x93, 0x35, 0x3a, 0x93, 0xc9, 0xd6, 0x2c, 0xd1, 0x45, 0x95, 0xe8, 0x93, 0x35, 0x9d, - 0x6a, 0xa5, 0x1d, 0x32, 0xc9, 0x70, 0xfa, 0xae, 0x2b, 0xad, 0x92, 0xc8, 0x0e, 0x14, 0x25, 0x17, - 0x89, 0x3f, 0xc0, 0x99, 0x6b, 0x9c, 0xac, 0x51, 0x5b, 0xc9, 0x47, 0x8a, 0x7e, 0xcc, 0xc3, 0x60, - 0x2c, 0xf1, 0x98, 0x9a, 0x8a, 0x5e, 0xcb, 0x64, 0x17, 0x6c, 0x19, 0x0f, 0x59, 0xee, 0x02, 0x0e, - 0xfe, 0xff, 0xcd, 0x73, 0xd3, 0x65, 0x79, 0x8a, 0x04, 0xca, 0x4a, 0xb6, 0xc1, 0x16, 0x2c, 0xbf, - 0xe4, 0x6e, 0x55, 0xad, 0x5c, 0xe9, 0x51, 0x54, 0xfa, 0x21, 0x9f, 0x48, 0x86, 0x53, 0xf2, 0xff, - 0x4a, 0x8f, 0x22, 0xa9, 0x83, 0x25, 0xd2, 0x00, 0x67, 0xe4, 0xca, 0xa1, 0x3c, 0x59, 0xa3, 0xca, - 0x48, 0x7e, 0x5a, 0xbe, 0x24, 0x36, 0xf0, 0x92, 0x78, 0x30, 0x47, 0x2e, 0x72, 0xb7, 0xb8, 0x27, - 0x4e, 0xd6, 0x96, 0x6e, 0x8a, 0xda, 0xe3, 0xe5, 0x61, 0xb4, 0x0d, 0x45, 0xc1, 0x31, 0x7f, 0x9b, - 0x7a, 0x2c, 0x6b, 0xa9, 0x56, 0x02, 0xbb, 0xab, 0x16, 0xd4, 0x29, 0x81, 0x9d, 0x45, 0x61, 0x1c, - 0xed, 0x3d, 0x84, 0xd2, 0xec, 0x4e, 0x53, 0x6d, 0xae, 0x6f, 0x35, 0xc7, 0x50, 0x43, 0xe1, 0xb8, - 0xf7, 0xc1, 0x31, 0xf7, 0x9a, 0x50, 0x50, 0x5b, 0x57, 0xc6, 0xb3, 0xf3, 0x7e, 0xf7, 0xf0, 0x17, - 0xc7, 0x20, 0x55, 0x28, 0x5d, 0xbc, 0xef, 0xbd, 0x53, 0x82, 0xa9, 0xa6, 0xc6, 0xe9, 0xfb, 0x7e, - 0xf7, 0x8d, 0x63, 0xd4, 0x4c, 0xc7, 0x68, 0x7b, 0x60, 0x49, 0x16, 0xac, 0xf4, 0x6b, 0x80, 0xcb, - 0x50, 0xa6, 0xf6, 0xd1, 0xa7, 0x96, 0xbc, 0x8f, 0xf9, 0x15, 0xb3, 0xf3, 0xe0, 0x6e, 0xa3, 0xfe, - 0x7b, 0x4f, 0x76, 0x5e, 0x7d, 0x78, 0x19, 0x84, 0x72, 0x9c, 0x5d, 0x36, 0x07, 0xb1, 0xd8, 0x0f, - 0xe2, 0x09, 0x8b, 0x82, 0x7d, 0xfc, 0x03, 0xb8, 0xcc, 0x46, 0xfa, 0x63, 0xf0, 0x2c, 0xe0, 0xd1, - 0xb3, 0x20, 0xc6, 0x5f, 0x07, 0xd5, 0x0f, 0xfb, 0xb3, 0x7f, 0x89, 0x1f, 0xd5, 0xeb, 0x9f, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x31, 0xff, 0x4e, 0x30, 0x5a, 0x08, 0x00, 0x00, -} +var xxx_File_my_test_test_proto_rawdesc = []byte{ + // 2138 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x12, 0x6d, 0x79, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x6d, + 0x75, 0x6c, 0x74, 0x69, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0xcd, 0x06, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x28, 0x0a, 0x03, 0x68, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x6d, + 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, + 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x03, 0x68, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x03, 0x68, 0x61, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x2e, 0x48, 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x06, 0x46, 0x45, 0x44, 0x4f, 0x52, 0x41, + 0x52, 0x03, 0x68, 0x61, 0x74, 0x12, 0x1f, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, + 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x03, 0x69, 0x6e, 0x66, 0x52, 0x08, 0x64, 0x65, + 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x73, 0x6f, 0x6d, 0x65, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0a, 0x32, 0x1a, 0x2e, 0x6d, 0x79, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x6f, 0x6d, 0x65, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x09, 0x73, 0x6f, 0x6d, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x12, 0x44, 0x0a, 0x0c, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, + 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x70, + 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x4d, + 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x41, 0x0a, 0x0b, 0x6d, 0x73, 0x67, 0x5f, 0x6d, 0x61, + 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6d, 0x79, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x73, + 0x67, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x6d, + 0x73, 0x67, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x73, + 0x65, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x65, 0x73, 0x65, 0x74, 0x12, + 0x17, 0x0a, 0x07, 0x67, 0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x67, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0a, 0x66, 0x6c, 0x6f, 0x61, + 0x74, 0x5f, 0x6e, 0x69, 0x6e, 0x66, 0x18, 0x14, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x04, 0x2d, 0x69, + 0x6e, 0x66, 0x52, 0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x4e, 0x69, 0x6e, 0x66, 0x12, 0x22, 0x0a, + 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x70, 0x69, 0x6e, 0x66, 0x18, 0x15, 0x20, 0x01, 0x28, + 0x02, 0x3a, 0x03, 0x69, 0x6e, 0x66, 0x52, 0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x50, 0x69, 0x6e, + 0x66, 0x12, 0x22, 0x0a, 0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x18, 0x16, + 0x20, 0x01, 0x28, 0x02, 0x3a, 0x05, 0x31, 0x65, 0x2b, 0x30, 0x39, 0x52, 0x08, 0x66, 0x6c, 0x6f, + 0x61, 0x74, 0x45, 0x78, 0x70, 0x12, 0x25, 0x0a, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, + 0x6e, 0x69, 0x6e, 0x66, 0x18, 0x17, 0x20, 0x01, 0x28, 0x01, 0x3a, 0x04, 0x2d, 0x69, 0x6e, 0x66, + 0x52, 0x0a, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x4e, 0x69, 0x6e, 0x66, 0x12, 0x24, 0x0a, 0x0b, + 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x70, 0x69, 0x6e, 0x66, 0x18, 0x18, 0x20, 0x01, 0x28, + 0x01, 0x3a, 0x03, 0x69, 0x6e, 0x66, 0x52, 0x0a, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x50, 0x69, + 0x6e, 0x66, 0x12, 0x29, 0x0a, 0x0a, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x65, 0x78, 0x70, + 0x18, 0x19, 0x20, 0x01, 0x28, 0x01, 0x3a, 0x0a, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x52, 0x09, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x45, 0x78, 0x70, 0x1a, 0x2c, 0x0a, + 0x09, 0x53, 0x6f, 0x6d, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x3e, 0x0a, 0x10, 0x4e, + 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4d, 0x0a, 0x0f, 0x4d, + 0x73, 0x67, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x12, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0e, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x25, 0x0a, 0x05, 0x43, 0x6f, + 0x6c, 0x6f, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, + 0x47, 0x52, 0x45, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4c, 0x55, 0x45, 0x10, + 0x02, 0x22, 0x97, 0x02, 0x0a, 0x05, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x66, + 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x79, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x05, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x25, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x61, + 0x63, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, + 0x01, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x1a, 0xb0, + 0x01, 0x0a, 0x05, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x44, 0x0a, 0x1f, 0x6b, 0x65, 0x79, 0x5f, + 0x74, 0x68, 0x61, 0x74, 0x5f, 0x6e, 0x65, 0x65, 0x64, 0x73, 0x5f, 0x31, 0x32, 0x33, 0x34, 0x63, + 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x43, 0x61, 0x73, 0x49, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x02, 0x28, + 0x03, 0x52, 0x1b, 0x6b, 0x65, 0x79, 0x54, 0x68, 0x61, 0x74, 0x4e, 0x65, 0x65, 0x64, 0x73, 0x31, + 0x32, 0x33, 0x34, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x43, 0x61, 0x73, 0x49, 0x6e, 0x67, 0x12, 0x17, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x3a, 0x01, 0x37, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x26, 0x0a, 0x10, 0x5f, 0x6d, 0x79, 0x5f, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0c, 0x4d, 0x79, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x32, 0x22, + 0x20, 0x0a, 0x04, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x4f, 0x4f, 0x54, 0x42, + 0x41, 0x4c, 0x4c, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x54, 0x45, 0x4e, 0x4e, 0x49, 0x53, 0x10, + 0x02, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x29, 0x0a, 0x09, 0x4f, + 0x74, 0x68, 0x65, 0x72, 0x42, 0x61, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x2a, 0x08, 0x08, 0x64, + 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xbb, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0x22, 0x0a, 0x04, 0x74, 0x69, + 0x6d, 0x65, 0x12, 0x0e, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x18, 0x65, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x32, 0x40, + 0x0a, 0x06, 0x63, 0x61, 0x72, 0x72, 0x6f, 0x74, 0x12, 0x0e, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x63, 0x61, 0x72, 0x72, 0x6f, 0x74, + 0x32, 0x42, 0x0a, 0x05, 0x64, 0x6f, 0x6e, 0x75, 0x74, 0x12, 0x12, 0x2e, 0x6d, 0x79, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x2e, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x42, 0x61, 0x73, 0x65, 0x18, 0x65, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x64, + 0x6f, 0x6e, 0x75, 0x74, 0x22, 0x28, 0x0a, 0x14, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x18, + 0x0a, 0x08, 0x4f, 0x6c, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x2a, 0x08, 0x08, 0x64, 0x10, 0xff, + 0xff, 0xff, 0xff, 0x07, 0x3a, 0x02, 0x08, 0x01, 0x22, 0x96, 0x03, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, + 0x6d, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x12, 0x1e, 0x0a, 0x0b, 0x6d, 0x61, 0x6b, 0x65, 0x5f, + 0x6d, 0x65, 0x5f, 0x63, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x6d, 0x61, + 0x6b, 0x65, 0x4d, 0x65, 0x43, 0x72, 0x79, 0x12, 0x18, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x12, 0x14, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x17, 0x0a, + 0x06, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, + 0x05, 0x74, 0x65, 0x6d, 0x70, 0x43, 0x12, 0x18, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x02, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x12, 0x25, 0x0a, 0x05, 0x74, 0x6f, 0x64, 0x61, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x0d, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x61, 0x79, 0x73, 0x48, 0x00, + 0x52, 0x05, 0x74, 0x6f, 0x64, 0x61, 0x79, 0x12, 0x16, 0x0a, 0x05, 0x6d, 0x61, 0x79, 0x62, 0x65, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x05, 0x6d, 0x61, 0x79, 0x62, 0x65, 0x12, + 0x16, 0x0a, 0x05, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x11, 0x48, 0x00, + 0x52, 0x05, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x22, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x10, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x48, 0x00, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x3d, 0x0a, 0x09, 0x73, + 0x6f, 0x6d, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0a, 0x32, 0x1d, + 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, + 0x71, 0x75, 0x65, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x48, 0x00, 0x52, + 0x09, 0x73, 0x6f, 0x6d, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, 0x23, 0x0a, 0x09, 0x53, 0x6f, + 0x6d, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x1a, + 0x07, 0x0a, 0x05, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x42, 0x07, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x6f, + 0x6e, 0x2a, 0x1e, 0x0a, 0x07, 0x48, 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, + 0x46, 0x45, 0x44, 0x4f, 0x52, 0x41, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x46, 0x45, 0x5a, 0x10, + 0x02, 0x2a, 0x2e, 0x0a, 0x04, 0x44, 0x61, 0x79, 0x73, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x4f, 0x4e, + 0x44, 0x41, 0x59, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x54, 0x55, 0x45, 0x53, 0x44, 0x41, 0x59, + 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x55, 0x4e, 0x44, 0x49, 0x10, 0x01, 0x1a, 0x02, 0x10, + 0x01, 0x3a, 0x20, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x12, 0x0e, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x18, 0x67, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x74, 0x61, 0x67, 0x3a, 0x43, 0x0a, 0x05, 0x64, 0x6f, 0x6e, 0x75, 0x74, 0x12, 0x0e, 0x2e, 0x6d, + 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x18, 0x6a, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4f, 0x74, 0x68, + 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x05, 0x64, 0x6f, 0x6e, 0x75, 0x74, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, + 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x6d, 0x79, + 0x5f, 0x74, 0x65, 0x73, 0x74, 0x3b, 0x74, 0x65, 0x73, 0x74, +} + +var xxx_File_my_test_test_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_my_test_test_proto_rawdesc) diff --git a/protoc-gen-go/testdata/proto3/proto3.pb.go b/protoc-gen-go/testdata/proto3/proto3.pb.go index a816962523..72ceca9a1d 100644 --- a/protoc-gen-go/testdata/proto3/proto3.pb.go +++ b/protoc-gen-go/testdata/proto3/proto3.pb.go @@ -4,16 +4,10 @@ package proto3 import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -48,7 +42,7 @@ func (x Request_Flavour) String() string { } func (Request_Flavour) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ab04eb4084a521db, []int{0, 0} + return xxx_File_proto3_proto3_proto_rawdesc_gzipped, []int{0, 0} } type Request struct { @@ -66,7 +60,7 @@ func (m *Request) Reset() { *m = Request{} } func (m *Request) String() string { return proto.CompactTextString(m) } func (*Request) ProtoMessage() {} func (*Request) Descriptor() ([]byte, []int) { - return fileDescriptor_ab04eb4084a521db, []int{0} + return xxx_File_proto3_proto3_proto_rawdesc_gzipped, []int{0} } func (m *Request) XXX_Unmarshal(b []byte) error { @@ -134,7 +128,7 @@ func (m *Book) Reset() { *m = Book{} } func (m *Book) String() string { return proto.CompactTextString(m) } func (*Book) ProtoMessage() {} func (*Book) Descriptor() ([]byte, []int) { - return fileDescriptor_ab04eb4084a521db, []int{1} + return xxx_File_proto3_proto3_proto_rawdesc_gzipped, []int{1} } func (m *Book) XXX_Unmarshal(b []byte) error { @@ -170,33 +164,38 @@ func (m *Book) GetRawData() []byte { } func init() { + proto.RegisterFile("proto3/proto3.proto", xxx_File_proto3_proto3_proto_rawdesc_gzipped) proto.RegisterEnum("proto3.Request_Flavour", Request_Flavour_name, Request_Flavour_value) proto.RegisterType((*Request)(nil), "proto3.Request") proto.RegisterType((*Book)(nil), "proto3.Book") } -func init() { proto.RegisterFile("proto3/proto3.proto", fileDescriptor_ab04eb4084a521db) } - -var fileDescriptor_ab04eb4084a521db = []byte{ - // 306 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x90, 0xcf, 0x4e, 0xf2, 0x40, - 0x14, 0xc5, 0x99, 0xfe, 0xf9, 0x80, 0xfb, 0xa1, 0x19, 0xaf, 0x26, 0x8e, 0x1b, 0x33, 0x61, 0xd5, - 0x0d, 0x25, 0xc1, 0x85, 0xc6, 0xb8, 0x11, 0x45, 0x25, 0x91, 0x60, 0x06, 0x89, 0x89, 0x1b, 0x33, - 0x85, 0xb1, 0x92, 0x42, 0x07, 0xcb, 0x54, 0xe2, 0xcb, 0xfa, 0x2c, 0xa6, 0x9d, 0xe2, 0xea, 0x9e, - 0x7b, 0xe7, 0xe4, 0x77, 0x32, 0x07, 0x0e, 0xd7, 0x99, 0x36, 0xfa, 0xac, 0x6b, 0x47, 0x58, 0x0e, - 0xfc, 0x67, 0xb7, 0xf6, 0x0f, 0x81, 0xba, 0x50, 0x9f, 0xb9, 0xda, 0x18, 0x44, 0xf0, 0x52, 0xb9, - 0x52, 0x8c, 0x70, 0x12, 0x34, 0x45, 0xa9, 0x91, 0x82, 0x9b, 0xa8, 0x6f, 0xe6, 0x70, 0x37, 0x70, - 0x45, 0x21, 0xb1, 0x03, 0xbe, 0x91, 0x1b, 0xa3, 0x98, 0xcb, 0x49, 0xb0, 0xdf, 0x3b, 0x0e, 0x2b, - 0x6e, 0x45, 0x09, 0xef, 0x96, 0xf2, 0x4b, 0xe7, 0x99, 0xb0, 0x2e, 0xe4, 0xe0, 0x45, 0x5a, 0x27, - 0xcc, 0xe3, 0x24, 0xf8, 0xdf, 0x6b, 0xed, 0xdc, 0x7d, 0xad, 0x13, 0x51, 0xbe, 0xe0, 0x29, 0x34, - 0xf2, 0x74, 0x2d, 0x67, 0x89, 0x9a, 0x33, 0xbf, 0xc8, 0xe9, 0x3b, 0xb4, 0x26, 0xfe, 0x6e, 0xed, - 0x2b, 0xa8, 0x57, 0x4c, 0x6c, 0x82, 0x3f, 0x79, 0x19, 0x0c, 0x9e, 0x69, 0x0d, 0x1b, 0xe0, 0x4d, - 0xc6, 0x53, 0x41, 0x49, 0x71, 0x9c, 0x8e, 0xae, 0x47, 0x43, 0xea, 0xe0, 0x01, 0xec, 0xdd, 0x8f, - 0x9f, 0x1e, 0x06, 0xe2, 0x71, 0x78, 0x33, 0x1c, 0x4f, 0x27, 0xd4, 0x6d, 0x9f, 0x83, 0x57, 0x64, - 0xe1, 0x11, 0xf8, 0x66, 0x61, 0x96, 0xbb, 0xdf, 0xd9, 0x05, 0x4f, 0xa0, 0x91, 0xc9, 0xed, 0xdb, - 0x5c, 0x1a, 0xc9, 0x1c, 0x4e, 0x82, 0x96, 0xa8, 0x67, 0x72, 0x7b, 0x2b, 0x8d, 0xec, 0x5f, 0xbe, - 0x5e, 0xc4, 0x0b, 0xf3, 0x91, 0x47, 0xe1, 0x4c, 0xaf, 0xba, 0xb1, 0x5e, 0xca, 0x34, 0xb6, 0x1d, - 0x46, 0xf9, 0xbb, 0x15, 0xb3, 0x4e, 0xac, 0xd2, 0x4e, 0xac, 0xbb, 0x46, 0x6d, 0x4c, 0xc1, 0xa8, - 0x3a, 0x8e, 0xaa, 0x76, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xec, 0x71, 0xee, 0xdb, 0x7b, 0x01, - 0x00, 0x00, -} +var xxx_File_proto3_proto3_proto_rawdesc = []byte{ + // 379 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x13, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x22, 0xde, 0x01, + 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x2d, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, + 0x46, 0x6c, 0x61, 0x76, 0x6f, 0x75, 0x72, 0x52, 0x05, 0x74, 0x61, 0x73, 0x74, 0x65, 0x12, 0x20, + 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, + 0x12, 0x1e, 0x0a, 0x08, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x05, 0x20, 0x03, + 0x28, 0x03, 0x42, 0x02, 0x10, 0x00, 0x52, 0x08, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, + 0x22, 0x3c, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x76, 0x6f, 0x75, 0x72, 0x12, 0x09, 0x0a, 0x05, 0x53, + 0x57, 0x45, 0x45, 0x54, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x4f, 0x55, 0x52, 0x10, 0x01, + 0x12, 0x09, 0x0a, 0x05, 0x55, 0x4d, 0x41, 0x4d, 0x49, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x47, + 0x4f, 0x50, 0x48, 0x45, 0x52, 0x4c, 0x49, 0x43, 0x49, 0x4f, 0x55, 0x53, 0x10, 0x03, 0x22, 0x37, + 0x0a, 0x04, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x08, + 0x72, 0x61, 0x77, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x72, 0x61, 0x77, 0x44, 0x61, 0x74, 0x61, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, + 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var xxx_File_proto3_proto3_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_proto3_proto3_proto_rawdesc) diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index 78ee523349..93dff5e96d 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -4,16 +4,10 @@ package any import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -140,7 +134,7 @@ func (m *Any) Reset() { *m = Any{} } func (m *Any) String() string { return proto.CompactTextString(m) } func (*Any) ProtoMessage() {} func (*Any) Descriptor() ([]byte, []int) { - return fileDescriptor_b53526c13ae22eb4, []int{0} + return xxx_File_google_protobuf_any_proto_rawdesc_gzipped, []int{0} } func (*Any) XXX_WellKnownType() string { return "Any" } @@ -178,23 +172,26 @@ func (m *Any) GetValue() []byte { } func init() { + proto.RegisterFile("google/protobuf/any.proto", xxx_File_google_protobuf_any_proto_rawdesc_gzipped) proto.RegisterType((*Any)(nil), "google.protobuf.Any") } -func init() { proto.RegisterFile("google/protobuf/any.proto", fileDescriptor_b53526c13ae22eb4) } - -var fileDescriptor_b53526c13ae22eb4 = []byte{ - // 185 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xcf, 0xcf, 0x4f, - 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcc, 0xab, 0xd4, - 0x03, 0x73, 0x84, 0xf8, 0x21, 0x52, 0x7a, 0x30, 0x29, 0x25, 0x33, 0x2e, 0x66, 0xc7, 0xbc, 0x4a, - 0x21, 0x49, 0x2e, 0x8e, 0x92, 0xca, 0x82, 0xd4, 0xf8, 0xd2, 0xa2, 0x1c, 0x09, 0x46, 0x05, 0x46, - 0x0d, 0xce, 0x20, 0x76, 0x10, 0x3f, 0xb4, 0x28, 0x47, 0x48, 0x84, 0x8b, 0xb5, 0x2c, 0x31, 0xa7, - 0x34, 0x55, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xc2, 0x71, 0xca, 0xe7, 0x12, 0x4e, 0xce, - 0xcf, 0xd5, 0x43, 0x33, 0xce, 0x89, 0xc3, 0x31, 0xaf, 0x32, 0x00, 0xc4, 0x09, 0x60, 0x8c, 0x52, - 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, - 0x4b, 0x47, 0xb8, 0xa8, 0x00, 0x64, 0x7a, 0x31, 0xc8, 0x61, 0x8b, 0x98, 0x98, 0xdd, 0x03, 0x9c, - 0x56, 0x31, 0xc9, 0xb9, 0x43, 0x8c, 0x0a, 0x80, 0x2a, 0xd1, 0x0b, 0x4f, 0xcd, 0xc9, 0xf1, 0xce, - 0xcb, 0x2f, 0xcf, 0x0b, 0x01, 0x29, 0x4d, 0x62, 0x03, 0xeb, 0x35, 0x06, 0x04, 0x00, 0x00, 0xff, - 0xff, 0x13, 0xf8, 0xe8, 0x42, 0xdd, 0x00, 0x00, 0x00, +var xxx_File_google_protobuf_any_proto_rawdesc = []byte{ + // 221 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x36, 0x0a, 0x03, + 0x41, 0x6e, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x42, 0x6f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x08, 0x41, 0x6e, 0x79, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0xa2, 0x02, + 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, + 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } + +var xxx_File_google_protobuf_any_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_any_proto_rawdesc) diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index 0d681ee21a..b1a8caea32 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -4,16 +4,10 @@ package duration import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -101,7 +95,7 @@ func (m *Duration) Reset() { *m = Duration{} } func (m *Duration) String() string { return proto.CompactTextString(m) } func (*Duration) ProtoMessage() {} func (*Duration) Descriptor() ([]byte, []int) { - return fileDescriptor_23597b2ebd7ac6c5, []int{0} + return xxx_File_google_protobuf_duration_proto_rawdesc_gzipped, []int{0} } func (*Duration) XXX_WellKnownType() string { return "Duration" } @@ -139,23 +133,28 @@ func (m *Duration) GetNanos() int32 { } func init() { + proto.RegisterFile("google/protobuf/duration.proto", xxx_File_google_protobuf_duration_proto_rawdesc_gzipped) proto.RegisterType((*Duration)(nil), "google.protobuf.Duration") } -func init() { proto.RegisterFile("google/protobuf/duration.proto", fileDescriptor_23597b2ebd7ac6c5) } - -var fileDescriptor_23597b2ebd7ac6c5 = []byte{ - // 190 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f, - 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0x29, 0x2d, 0x4a, - 0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0x56, - 0x5c, 0x1c, 0x2e, 0x50, 0x25, 0x42, 0x12, 0x5c, 0xec, 0xc5, 0xa9, 0xc9, 0xf9, 0x79, 0x29, 0xc5, - 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x30, 0xae, 0x90, 0x08, 0x17, 0x6b, 0x5e, 0x62, 0x5e, - 0x7e, 0xb1, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x84, 0xe3, 0x54, 0xc3, 0x25, 0x9c, 0x9c, - 0x9f, 0xab, 0x87, 0x66, 0xa4, 0x13, 0x2f, 0xcc, 0xc0, 0x00, 0x90, 0x48, 0x00, 0x63, 0x94, 0x56, - 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x4e, 0x62, 0x5e, - 0x3a, 0xc2, 0x7d, 0x05, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x70, 0x67, 0xfe, 0x60, 0x64, 0x5c, 0xc4, - 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0x62, 0x6e, 0x00, 0x54, 0xa9, 0x5e, 0x78, - 0x6a, 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x4b, 0x12, 0x1b, 0xd8, 0x0c, 0x63, - 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x84, 0x30, 0xff, 0xf3, 0x00, 0x00, 0x00, +var xxx_File_google_protobuf_duration_proto_rawdesc = []byte{ + // 243 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x22, 0x3a, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, + 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, + 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, 0x7c, 0x0a, + 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0d, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, + 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } + +var xxx_File_google_protobuf_duration_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_duration_proto_rawdesc) diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index b4eb03eccf..f88b0e6e7f 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -4,16 +4,10 @@ package empty import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -39,7 +33,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_900544acb223d5b8, []int{0} + return xxx_File_google_protobuf_empty_proto_rawdesc_gzipped, []int{0} } func (*Empty) XXX_WellKnownType() string { return "Empty" } @@ -63,21 +57,24 @@ func (m *Empty) XXX_DiscardUnknown() { var xxx_messageInfo_Empty proto.InternalMessageInfo func init() { + proto.RegisterFile("google/protobuf/empty.proto", xxx_File_google_protobuf_empty_proto_rawdesc_gzipped) proto.RegisterType((*Empty)(nil), "google.protobuf.Empty") } -func init() { proto.RegisterFile("google/protobuf/empty.proto", fileDescriptor_900544acb223d5b8) } - -var fileDescriptor_900544acb223d5b8 = []byte{ - // 148 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xcf, 0xcf, 0x4f, - 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcd, 0x2d, 0x28, - 0xa9, 0xd4, 0x03, 0x73, 0x85, 0xf8, 0x21, 0x92, 0x7a, 0x30, 0x49, 0x25, 0x76, 0x2e, 0x56, 0x57, - 0x90, 0xbc, 0x53, 0x19, 0x97, 0x70, 0x72, 0x7e, 0xae, 0x1e, 0x9a, 0xbc, 0x13, 0x17, 0x58, 0x36, - 0x00, 0xc4, 0x0d, 0x60, 0x8c, 0x52, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, - 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0x47, 0x58, 0x53, 0x50, 0x52, 0x59, 0x90, 0x5a, 0x0c, - 0xb1, 0xed, 0x07, 0x23, 0xe3, 0x22, 0x26, 0x66, 0xf7, 0x00, 0xa7, 0x55, 0x4c, 0x72, 0xee, 0x10, - 0x13, 0x03, 0xa0, 0xea, 0xf4, 0xc2, 0x53, 0x73, 0x72, 0xbc, 0xf3, 0xf2, 0xcb, 0xf3, 0x42, 0x40, - 0xea, 0x93, 0xd8, 0xc0, 0x06, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x64, 0xd4, 0xb3, 0xa6, - 0xb7, 0x00, 0x00, 0x00, +var xxx_File_google_protobuf_empty_proto_rawdesc = []byte{ + // 183 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x07, + 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x76, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0a, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, + 0x65, 0x6d, 0x70, 0x74, 0x79, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, + 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } + +var xxx_File_google_protobuf_empty_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_empty_proto_rawdesc) diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index c680c1d7c7..687d0bf202 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -4,16 +4,10 @@ package structpb import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -44,7 +38,7 @@ func (x NullValue) String() string { } func (NullValue) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_df322afd6c9fb402, []int{0} + return xxx_File_google_protobuf_struct_proto_rawdesc_gzipped, []int{0} } func (NullValue) XXX_WellKnownType() string { return "NullValue" } @@ -69,7 +63,7 @@ func (m *Struct) Reset() { *m = Struct{} } func (m *Struct) String() string { return proto.CompactTextString(m) } func (*Struct) ProtoMessage() {} func (*Struct) Descriptor() ([]byte, []int) { - return fileDescriptor_df322afd6c9fb402, []int{0} + return xxx_File_google_protobuf_struct_proto_rawdesc_gzipped, []int{0} } func (*Struct) XXX_WellKnownType() string { return "Struct" } @@ -131,7 +125,7 @@ func (m *Value) Reset() { *m = Value{} } func (m *Value) String() string { return proto.CompactTextString(m) } func (*Value) ProtoMessage() {} func (*Value) Descriptor() ([]byte, []int) { - return fileDescriptor_df322afd6c9fb402, []int{1} + return xxx_File_google_protobuf_struct_proto_rawdesc_gzipped, []int{1} } func (*Value) XXX_WellKnownType() string { return "Value" } @@ -270,7 +264,7 @@ func (m *ListValue) Reset() { *m = ListValue{} } func (m *ListValue) String() string { return proto.CompactTextString(m) } func (*ListValue) ProtoMessage() {} func (*ListValue) Descriptor() ([]byte, []int) { - return fileDescriptor_df322afd6c9fb402, []int{2} + return xxx_File_google_protobuf_struct_proto_rawdesc_gzipped, []int{2} } func (*ListValue) XXX_WellKnownType() string { return "ListValue" } @@ -301,6 +295,7 @@ func (m *ListValue) GetValues() []*Value { } func init() { + proto.RegisterFile("google/protobuf/struct.proto", xxx_File_google_protobuf_struct_proto_rawdesc_gzipped) proto.RegisterEnum("google.protobuf.NullValue", NullValue_name, NullValue_value) proto.RegisterType((*Struct)(nil), "google.protobuf.Struct") proto.RegisterMapType((map[string]*Value)(nil), "google.protobuf.Struct.FieldsEntry") @@ -308,35 +303,55 @@ func init() { proto.RegisterType((*ListValue)(nil), "google.protobuf.ListValue") } -func init() { proto.RegisterFile("google/protobuf/struct.proto", fileDescriptor_df322afd6c9fb402) } - -var fileDescriptor_df322afd6c9fb402 = []byte{ - // 417 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x8b, 0xd3, 0x40, - 0x14, 0xc7, 0x3b, 0xc9, 0x36, 0x98, 0x17, 0x59, 0x97, 0x11, 0xb4, 0xac, 0xa2, 0xa1, 0x7b, 0x09, - 0x22, 0x29, 0xd6, 0x8b, 0x18, 0x2f, 0x06, 0xd6, 0x5d, 0x30, 0x2c, 0x31, 0xba, 0x15, 0xbc, 0x94, - 0x26, 0x4d, 0x63, 0xe8, 0x74, 0x26, 0x24, 0x33, 0x4a, 0x8f, 0x7e, 0x0b, 0xcf, 0x1e, 0x3d, 0xfa, - 0xe9, 0x3c, 0xca, 0xcc, 0x24, 0xa9, 0xb4, 0xf4, 0x94, 0xbc, 0xf7, 0x7e, 0xef, 0x3f, 0xef, 0xff, - 0x66, 0xe0, 0x71, 0xc1, 0x58, 0x41, 0xf2, 0x49, 0x55, 0x33, 0xce, 0x52, 0xb1, 0x9a, 0x34, 0xbc, - 0x16, 0x19, 0xf7, 0x55, 0x8c, 0xef, 0xe9, 0xaa, 0xdf, 0x55, 0xc7, 0x3f, 0x11, 0x58, 0x1f, 0x15, - 0x81, 0x03, 0xb0, 0x56, 0x65, 0x4e, 0x96, 0xcd, 0x08, 0xb9, 0xa6, 0xe7, 0x4c, 0x2f, 0xfc, 0x3d, - 0xd8, 0xd7, 0xa0, 0xff, 0x4e, 0x51, 0x97, 0x94, 0xd7, 0xdb, 0xa4, 0x6d, 0x39, 0xff, 0x00, 0xce, - 0x7f, 0x69, 0x7c, 0x06, 0xe6, 0x3a, 0xdf, 0x8e, 0x90, 0x8b, 0x3c, 0x3b, 0x91, 0xbf, 0xf8, 0x39, - 0x0c, 0xbf, 0x2d, 0x88, 0xc8, 0x47, 0x86, 0x8b, 0x3c, 0x67, 0xfa, 0xe0, 0x40, 0x7c, 0x26, 0xab, - 0x89, 0x86, 0x5e, 0x1b, 0xaf, 0xd0, 0xf8, 0x8f, 0x01, 0x43, 0x95, 0xc4, 0x01, 0x00, 0x15, 0x84, - 0xcc, 0xb5, 0x80, 0x14, 0x3d, 0x9d, 0x9e, 0x1f, 0x08, 0xdc, 0x08, 0x42, 0x14, 0x7f, 0x3d, 0x48, - 0x6c, 0xda, 0x05, 0xf8, 0x02, 0xee, 0x52, 0xb1, 0x49, 0xf3, 0x7a, 0xbe, 0x3b, 0x1f, 0x5d, 0x0f, - 0x12, 0x47, 0x67, 0x7b, 0xa8, 0xe1, 0x75, 0x49, 0x8b, 0x16, 0x32, 0xe5, 0xe0, 0x12, 0xd2, 0x59, - 0x0d, 0x3d, 0x05, 0x48, 0x19, 0xeb, 0xc6, 0x38, 0x71, 0x91, 0x77, 0x47, 0x1e, 0x25, 0x73, 0x1a, - 0x78, 0xa3, 0x54, 0x44, 0xc6, 0x5b, 0x64, 0xa8, 0xac, 0x3e, 0x3c, 0xb2, 0xc7, 0x56, 0x5e, 0x64, - 0xbc, 0x77, 0x49, 0xca, 0xa6, 0xeb, 0xb5, 0x54, 0xef, 0xa1, 0xcb, 0xa8, 0x6c, 0x78, 0xef, 0x92, - 0x74, 0x41, 0x68, 0xc1, 0xc9, 0xba, 0xa4, 0xcb, 0x71, 0x00, 0x76, 0x4f, 0x60, 0x1f, 0x2c, 0x25, - 0xd6, 0xdd, 0xe8, 0xb1, 0xa5, 0xb7, 0xd4, 0xb3, 0x47, 0x60, 0xf7, 0x4b, 0xc4, 0xa7, 0x00, 0x37, - 0xb7, 0x51, 0x34, 0x9f, 0xbd, 0x8d, 0x6e, 0x2f, 0xcf, 0x06, 0xe1, 0x0f, 0x04, 0xf7, 0x33, 0xb6, - 0xd9, 0x97, 0x08, 0x1d, 0xed, 0x26, 0x96, 0x71, 0x8c, 0xbe, 0xbc, 0x28, 0x4a, 0xfe, 0x55, 0xa4, - 0x7e, 0xc6, 0x36, 0x93, 0x82, 0x91, 0x05, 0x2d, 0x76, 0x4f, 0xb1, 0xe2, 0xdb, 0x2a, 0x6f, 0xda, - 0x17, 0x19, 0xe8, 0x4f, 0x95, 0xfe, 0x45, 0xe8, 0x97, 0x61, 0x5e, 0xc5, 0xe1, 0x6f, 0xe3, 0xc9, - 0x95, 0x16, 0x8f, 0xbb, 0xf9, 0x3e, 0xe7, 0x84, 0xbc, 0xa7, 0xec, 0x3b, 0xfd, 0x24, 0x3b, 0x53, - 0x4b, 0x49, 0xbd, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x1b, 0x59, 0xf8, 0xe5, 0x02, 0x00, - 0x00, -} +var xxx_File_google_protobuf_struct_proto_rawdesc = []byte{ + // 741 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, + 0x98, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3b, 0x0a, 0x06, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x1a, 0x51, 0x0a, 0x0b, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb2, 0x02, 0x0a, 0x05, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, + 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62, + 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, + 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0c, + 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x73, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6c, 0x69, + 0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6c, 0x69, + 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, + 0x3b, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2e, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2a, 0x1b, 0x0a, 0x09, + 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x55, 0x4c, + 0x4c, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x00, 0x42, 0x81, 0x01, 0x0a, 0x13, 0x63, 0x6f, + 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x42, 0x0b, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x3b, 0x73, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, + 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var xxx_File_google_protobuf_struct_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_struct_proto_rawdesc) diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index 31cd846de9..f0a5280a2d 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -4,16 +4,10 @@ package timestamp import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -119,7 +113,7 @@ func (m *Timestamp) Reset() { *m = Timestamp{} } func (m *Timestamp) String() string { return proto.CompactTextString(m) } func (*Timestamp) ProtoMessage() {} func (*Timestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_292007bbfe81227e, []int{0} + return xxx_File_google_protobuf_timestamp_proto_rawdesc_gzipped, []int{0} } func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" } @@ -157,23 +151,28 @@ func (m *Timestamp) GetNanos() int32 { } func init() { + proto.RegisterFile("google/protobuf/timestamp.proto", xxx_File_google_protobuf_timestamp_proto_rawdesc_gzipped) proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp") } -func init() { proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor_292007bbfe81227e) } - -var fileDescriptor_292007bbfe81227e = []byte{ - // 191 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcf, 0xcf, 0x4f, - 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xc9, 0xcc, 0x4d, - 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0xd0, 0x03, 0x0b, 0x09, 0xf1, 0x43, 0x14, 0xe8, 0xc1, 0x14, 0x28, - 0x59, 0x73, 0x71, 0x86, 0xc0, 0xd4, 0x08, 0x49, 0x70, 0xb1, 0x17, 0xa7, 0x26, 0xe7, 0xe7, 0xa5, - 0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0xc1, 0xb8, 0x42, 0x22, 0x5c, 0xac, 0x79, 0x89, - 0x79, 0xf9, 0xc5, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xac, 0x41, 0x10, 0x8e, 0x53, 0x1d, 0x97, 0x70, - 0x72, 0x7e, 0xae, 0x1e, 0x9a, 0x99, 0x4e, 0x7c, 0x70, 0x13, 0x03, 0x40, 0x42, 0x01, 0x8c, 0x51, - 0xda, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0x39, 0x89, - 0x79, 0xe9, 0x08, 0x27, 0x16, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x23, 0x5c, 0xfa, 0x83, 0x91, 0x71, - 0x11, 0x13, 0xb3, 0x7b, 0x80, 0xd3, 0x2a, 0x26, 0x39, 0x77, 0x88, 0xc9, 0x01, 0x50, 0xb5, 0x7a, - 0xe1, 0xa9, 0x39, 0x39, 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x20, 0x3d, 0x49, 0x6c, 0x60, 0x43, - 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x77, 0x4a, 0x07, 0xf7, 0x00, 0x00, 0x00, +var xxx_File_google_protobuf_timestamp_proto_rawdesc = []byte{ + // 247 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, + 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, + 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, + 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, + 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } + +var xxx_File_google_protobuf_timestamp_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_timestamp_proto_rawdesc) diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index add19a1adb..cbc44449f9 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -4,16 +4,10 @@ package wrappers import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" + protoapi "github.com/golang/protobuf/protoapi" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -35,7 +29,7 @@ func (m *DoubleValue) Reset() { *m = DoubleValue{} } func (m *DoubleValue) String() string { return proto.CompactTextString(m) } func (*DoubleValue) ProtoMessage() {} func (*DoubleValue) Descriptor() ([]byte, []int) { - return fileDescriptor_5377b62bda767935, []int{0} + return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{0} } func (*DoubleValue) XXX_WellKnownType() string { return "DoubleValue" } @@ -80,7 +74,7 @@ func (m *FloatValue) Reset() { *m = FloatValue{} } func (m *FloatValue) String() string { return proto.CompactTextString(m) } func (*FloatValue) ProtoMessage() {} func (*FloatValue) Descriptor() ([]byte, []int) { - return fileDescriptor_5377b62bda767935, []int{1} + return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{1} } func (*FloatValue) XXX_WellKnownType() string { return "FloatValue" } @@ -125,7 +119,7 @@ func (m *Int64Value) Reset() { *m = Int64Value{} } func (m *Int64Value) String() string { return proto.CompactTextString(m) } func (*Int64Value) ProtoMessage() {} func (*Int64Value) Descriptor() ([]byte, []int) { - return fileDescriptor_5377b62bda767935, []int{2} + return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{2} } func (*Int64Value) XXX_WellKnownType() string { return "Int64Value" } @@ -170,7 +164,7 @@ func (m *UInt64Value) Reset() { *m = UInt64Value{} } func (m *UInt64Value) String() string { return proto.CompactTextString(m) } func (*UInt64Value) ProtoMessage() {} func (*UInt64Value) Descriptor() ([]byte, []int) { - return fileDescriptor_5377b62bda767935, []int{3} + return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{3} } func (*UInt64Value) XXX_WellKnownType() string { return "UInt64Value" } @@ -215,7 +209,7 @@ func (m *Int32Value) Reset() { *m = Int32Value{} } func (m *Int32Value) String() string { return proto.CompactTextString(m) } func (*Int32Value) ProtoMessage() {} func (*Int32Value) Descriptor() ([]byte, []int) { - return fileDescriptor_5377b62bda767935, []int{4} + return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{4} } func (*Int32Value) XXX_WellKnownType() string { return "Int32Value" } @@ -260,7 +254,7 @@ func (m *UInt32Value) Reset() { *m = UInt32Value{} } func (m *UInt32Value) String() string { return proto.CompactTextString(m) } func (*UInt32Value) ProtoMessage() {} func (*UInt32Value) Descriptor() ([]byte, []int) { - return fileDescriptor_5377b62bda767935, []int{5} + return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{5} } func (*UInt32Value) XXX_WellKnownType() string { return "UInt32Value" } @@ -305,7 +299,7 @@ func (m *BoolValue) Reset() { *m = BoolValue{} } func (m *BoolValue) String() string { return proto.CompactTextString(m) } func (*BoolValue) ProtoMessage() {} func (*BoolValue) Descriptor() ([]byte, []int) { - return fileDescriptor_5377b62bda767935, []int{6} + return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{6} } func (*BoolValue) XXX_WellKnownType() string { return "BoolValue" } @@ -350,7 +344,7 @@ func (m *StringValue) Reset() { *m = StringValue{} } func (m *StringValue) String() string { return proto.CompactTextString(m) } func (*StringValue) ProtoMessage() {} func (*StringValue) Descriptor() ([]byte, []int) { - return fileDescriptor_5377b62bda767935, []int{7} + return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{7} } func (*StringValue) XXX_WellKnownType() string { return "StringValue" } @@ -395,7 +389,7 @@ func (m *BytesValue) Reset() { *m = BytesValue{} } func (m *BytesValue) String() string { return proto.CompactTextString(m) } func (*BytesValue) ProtoMessage() {} func (*BytesValue) Descriptor() ([]byte, []int) { - return fileDescriptor_5377b62bda767935, []int{8} + return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{8} } func (*BytesValue) XXX_WellKnownType() string { return "BytesValue" } @@ -426,6 +420,7 @@ func (m *BytesValue) GetValue() []byte { } func init() { + proto.RegisterFile("google/protobuf/wrappers.proto", xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped) proto.RegisterType((*DoubleValue)(nil), "google.protobuf.DoubleValue") proto.RegisterType((*FloatValue)(nil), "google.protobuf.FloatValue") proto.RegisterType((*Int64Value)(nil), "google.protobuf.Int64Value") @@ -437,25 +432,40 @@ func init() { proto.RegisterType((*BytesValue)(nil), "google.protobuf.BytesValue") } -func init() { proto.RegisterFile("google/protobuf/wrappers.proto", fileDescriptor_5377b62bda767935) } - -var fileDescriptor_5377b62bda767935 = []byte{ - // 259 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f, - 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0x2f, 0x4a, 0x2c, - 0x28, 0x48, 0x2d, 0x2a, 0xd6, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0xca, - 0x5c, 0xdc, 0x2e, 0xf9, 0xa5, 0x49, 0x39, 0xa9, 0x61, 0x89, 0x39, 0xa5, 0xa9, 0x42, 0x22, 0x5c, - 0xac, 0x65, 0x20, 0x86, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x63, 0x10, 0x84, 0xa3, 0xa4, 0xc4, 0xc5, - 0xe5, 0x96, 0x93, 0x9f, 0x58, 0x82, 0x45, 0x0d, 0x13, 0x92, 0x1a, 0xcf, 0xbc, 0x12, 0x33, 0x13, - 0x2c, 0x6a, 0x98, 0x61, 0x6a, 0x94, 0xb9, 0xb8, 0x43, 0x71, 0x29, 0x62, 0x41, 0x35, 0xc8, 0xd8, - 0x08, 0x8b, 0x1a, 0x56, 0x34, 0x83, 0xb0, 0x2a, 0xe2, 0x85, 0x29, 0x52, 0xe4, 0xe2, 0x74, 0xca, - 0xcf, 0xcf, 0xc1, 0xa2, 0x84, 0x03, 0xc9, 0x9c, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0x74, 0x2c, 0x8a, - 0x38, 0x91, 0x1c, 0xe4, 0x54, 0x59, 0x92, 0x5a, 0x8c, 0x45, 0x0d, 0x0f, 0x54, 0x8d, 0x53, 0x0d, - 0x97, 0x70, 0x72, 0x7e, 0xae, 0x1e, 0x5a, 0xe8, 0x3a, 0xf1, 0x86, 0x43, 0x83, 0x3f, 0x00, 0x24, - 0x12, 0xc0, 0x18, 0xa5, 0x95, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f, - 0x9e, 0x9f, 0x93, 0x98, 0x97, 0x8e, 0x88, 0xaa, 0x82, 0x92, 0xca, 0x82, 0xd4, 0x62, 0x78, 0x8c, - 0xfd, 0x60, 0x64, 0x5c, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0x62, 0x6e, - 0x00, 0x54, 0xa9, 0x5e, 0x78, 0x6a, 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x4b, - 0x12, 0x1b, 0xd8, 0x0c, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x19, 0x6c, 0xb9, 0xb8, 0xfe, - 0x01, 0x00, 0x00, -} +var xxx_File_google_protobuf_wrappers_proto_rawdesc = []byte{ + // 510 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x22, 0x23, 0x0a, 0x0b, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x02, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x49, 0x6e, + 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x23, + 0x0a, 0x0b, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x23, 0x0a, 0x0b, 0x55, 0x49, 0x6e, 0x74, 0x33, + 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x21, 0x0a, 0x09, + 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x23, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x7c, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, + 0x0d, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0xf8, 0x01, 0x01, 0xa2, + 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, + 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_wrappers_proto_rawdesc) From e581f92ac622cd75f2ca72fb4ef8b57193357a16 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 11 Mar 2019 22:53:20 -0700 Subject: [PATCH 039/133] proto: deprecate ErrInternalBadWireType Nothing uses this error. Change-Id: I30e94c2b6f3c7865c40d8536d371c7e04b5af908 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167040 Reviewed-by: Herbie Ong --- proto/decode.go | 4 ---- proto/deprecated.go | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/proto/decode.go b/proto/decode.go index e0f52c754d..03db804418 100644 --- a/proto/decode.go +++ b/proto/decode.go @@ -17,10 +17,6 @@ import ( // 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. diff --git a/proto/deprecated.go b/proto/deprecated.go index 5aa7e6e754..da5b374dd3 100644 --- a/proto/deprecated.go +++ b/proto/deprecated.go @@ -10,6 +10,9 @@ import ( "github.com/golang/protobuf/protoapi" ) +// Deprecated: do not use. +var 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 } From f41bc14dc493edced6d73372ee2721834fb15ada Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 12 Mar 2019 16:29:15 -0700 Subject: [PATCH 040/133] test.bash: re-write integration test as a Go test This change: * upgrades the v2 dependency to the latest version * copies integration_test.go from v2 and deletes irrelevant code. * copies internal/cmd/generate-protos from v2 and deletes irrelevant code and modifies generateLocalProtos accordingly * deletes protoc-gen-go/testdata since this is covered in v2 * uses import public to alias the v2 version of the well-known types, plugin proto, and descriptor proto Change-Id: Ib1d4280afaca8a811b9ff57792e02b15b3b8f0ec Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167141 Reviewed-by: Herbie Ong --- Makefile | 22 - go.mod | 2 +- go.sum | 8 +- integration_test.go | 334 ++ internal/cmd/generate-protos/main.go | 157 + .../jsonpb_test_proto/more_test_objects.pb.go | 300 +- .../jsonpb_test_proto/more_test_objects.proto | 2 + jsonpb/jsonpb_test_proto/test_objects.pb.go | 713 ++-- jsonpb/jsonpb_test_proto/test_objects.proto | 2 + proto/proto3_proto/proto3.pb.go | 114 +- proto/proto3_proto/proto3.proto | 2 + proto/test_proto/test.pb.go | 539 +++ protoc-gen-go/descriptor/descriptor.pb.go | 3025 +---------------- protoc-gen-go/descriptor/descriptor.proto | 882 +---- protoc-gen-go/golden_test.go | 367 -- protoc-gen-go/plugin/plugin.pb.go | 392 +-- protoc-gen-go/plugin/plugin.proto | 166 +- .../testdata/deprecated/deprecated.pb.go | 280 -- .../testdata/deprecated/deprecated.proto | 74 - .../extension_base/extension_base.pb.go | 131 - .../extension_base/extension_base.proto | 48 - .../extension_extra/extension_extra.pb.go | 76 - .../extension_extra/extension_extra.proto | 40 - protoc-gen-go/testdata/extension_test.go | 179 - .../extension_user/extension_user.pb.go | 442 --- .../extension_user/extension_user.proto | 102 - protoc-gen-go/testdata/grpc/grpc.pb.go | 455 --- protoc-gen-go/testdata/grpc/grpc.proto | 61 - protoc-gen-go/testdata/import_public/a.pb.go | 140 - protoc-gen-go/testdata/import_public/a.proto | 45 - protoc-gen-go/testdata/import_public/b.pb.go | 90 - protoc-gen-go/testdata/import_public/b.proto | 43 - .../import_public/importing/importing.pb.go | 83 - .../import_public/importing/importing.proto | 43 - .../testdata/import_public/sub/a.pb.go | 427 --- .../testdata/import_public/sub/a.proto | 77 - .../testdata/import_public/sub/b.pb.go | 76 - .../testdata/import_public/sub/b.proto | 40 - protoc-gen-go/testdata/import_public_test.go | 37 - protoc-gen-go/testdata/imports/fmt/m.pb.go | 64 - protoc-gen-go/testdata/imports/fmt/m.proto | 35 - .../testdata/imports/test_a_1/m1.pb.go | 131 - .../testdata/imports/test_a_1/m1.proto | 44 - .../testdata/imports/test_a_1/m2.pb.go | 65 - .../testdata/imports/test_a_1/m2.proto | 35 - .../testdata/imports/test_a_2/m3.pb.go | 65 - .../testdata/imports/test_a_2/m3.proto | 35 - .../testdata/imports/test_a_2/m4.pb.go | 65 - .../testdata/imports/test_a_2/m4.proto | 35 - .../testdata/imports/test_b_1/m1.pb.go | 66 - .../testdata/imports/test_b_1/m1.proto | 35 - .../testdata/imports/test_b_1/m2.pb.go | 66 - .../testdata/imports/test_b_1/m2.proto | 35 - .../testdata/imports/test_import_a1m1.pb.go | 77 - .../testdata/imports/test_import_a1m1.proto | 42 - .../testdata/imports/test_import_a1m2.pb.go | 77 - .../testdata/imports/test_import_a1m2.proto | 42 - .../testdata/imports/test_import_all.pb.go | 150 - .../testdata/imports/test_import_all.proto | 58 - protoc-gen-go/testdata/main_test.go | 21 - protoc-gen-go/testdata/multi/multi1.pb.go | 100 - protoc-gen-go/testdata/multi/multi1.proto | 46 - protoc-gen-go/testdata/multi/multi2.pb.go | 132 - protoc-gen-go/testdata/multi/multi2.proto | 48 - protoc-gen-go/testdata/multi/multi3.pb.go | 119 - protoc-gen-go/testdata/multi/multi3.proto | 45 - protoc-gen-go/testdata/my_test/test.pb.go | 1158 ------- protoc-gen-go/testdata/my_test/test.proto | 165 - protoc-gen-go/testdata/proto3/proto3.pb.go | 201 -- protoc-gen-go/testdata/proto3/proto3.proto | 55 - ptypes/any/any.pb.go | 208 +- ptypes/any/any.proto | 153 +- ptypes/any_test.go | 2 +- ptypes/duration/duration.pb.go | 175 +- ptypes/duration/duration.proto | 116 +- ptypes/empty/empty.pb.go | 96 +- ptypes/empty/empty.proto | 51 +- ptypes/struct/struct.pb.go | 375 +- ptypes/struct/struct.proto | 95 +- ptypes/timestamp/timestamp.pb.go | 193 +- ptypes/timestamp/timestamp.proto | 134 +- ptypes/wrappers/wrappers.pb.go | 488 +-- ptypes/wrappers/wrappers.proto | 117 +- regenerate.bash | 8 + regenerate.sh | 52 - test.bash | 126 +- 86 files changed, 2227 insertions(+), 13490 deletions(-) delete mode 100644 Makefile create mode 100644 integration_test.go create mode 100644 internal/cmd/generate-protos/main.go delete mode 100644 protoc-gen-go/golden_test.go delete mode 100644 protoc-gen-go/testdata/deprecated/deprecated.pb.go delete mode 100644 protoc-gen-go/testdata/deprecated/deprecated.proto delete mode 100644 protoc-gen-go/testdata/extension_base/extension_base.pb.go delete mode 100644 protoc-gen-go/testdata/extension_base/extension_base.proto delete mode 100644 protoc-gen-go/testdata/extension_extra/extension_extra.pb.go delete mode 100644 protoc-gen-go/testdata/extension_extra/extension_extra.proto delete mode 100644 protoc-gen-go/testdata/extension_test.go delete mode 100644 protoc-gen-go/testdata/extension_user/extension_user.pb.go delete mode 100644 protoc-gen-go/testdata/extension_user/extension_user.proto delete mode 100644 protoc-gen-go/testdata/grpc/grpc.pb.go delete mode 100644 protoc-gen-go/testdata/grpc/grpc.proto delete mode 100644 protoc-gen-go/testdata/import_public/a.pb.go delete mode 100644 protoc-gen-go/testdata/import_public/a.proto delete mode 100644 protoc-gen-go/testdata/import_public/b.pb.go delete mode 100644 protoc-gen-go/testdata/import_public/b.proto delete mode 100644 protoc-gen-go/testdata/import_public/importing/importing.pb.go delete mode 100644 protoc-gen-go/testdata/import_public/importing/importing.proto delete mode 100644 protoc-gen-go/testdata/import_public/sub/a.pb.go delete mode 100644 protoc-gen-go/testdata/import_public/sub/a.proto delete mode 100644 protoc-gen-go/testdata/import_public/sub/b.pb.go delete mode 100644 protoc-gen-go/testdata/import_public/sub/b.proto delete mode 100644 protoc-gen-go/testdata/import_public_test.go delete mode 100644 protoc-gen-go/testdata/imports/fmt/m.pb.go delete mode 100644 protoc-gen-go/testdata/imports/fmt/m.proto delete mode 100644 protoc-gen-go/testdata/imports/test_a_1/m1.pb.go delete mode 100644 protoc-gen-go/testdata/imports/test_a_1/m1.proto delete mode 100644 protoc-gen-go/testdata/imports/test_a_1/m2.pb.go delete mode 100644 protoc-gen-go/testdata/imports/test_a_1/m2.proto delete mode 100644 protoc-gen-go/testdata/imports/test_a_2/m3.pb.go delete mode 100644 protoc-gen-go/testdata/imports/test_a_2/m3.proto delete mode 100644 protoc-gen-go/testdata/imports/test_a_2/m4.pb.go delete mode 100644 protoc-gen-go/testdata/imports/test_a_2/m4.proto delete mode 100644 protoc-gen-go/testdata/imports/test_b_1/m1.pb.go delete mode 100644 protoc-gen-go/testdata/imports/test_b_1/m1.proto delete mode 100644 protoc-gen-go/testdata/imports/test_b_1/m2.pb.go delete mode 100644 protoc-gen-go/testdata/imports/test_b_1/m2.proto delete mode 100644 protoc-gen-go/testdata/imports/test_import_a1m1.pb.go delete mode 100644 protoc-gen-go/testdata/imports/test_import_a1m1.proto delete mode 100644 protoc-gen-go/testdata/imports/test_import_a1m2.pb.go delete mode 100644 protoc-gen-go/testdata/imports/test_import_a1m2.proto delete mode 100644 protoc-gen-go/testdata/imports/test_import_all.pb.go delete mode 100644 protoc-gen-go/testdata/imports/test_import_all.proto delete mode 100644 protoc-gen-go/testdata/main_test.go delete mode 100644 protoc-gen-go/testdata/multi/multi1.pb.go delete mode 100644 protoc-gen-go/testdata/multi/multi1.proto delete mode 100644 protoc-gen-go/testdata/multi/multi2.pb.go delete mode 100644 protoc-gen-go/testdata/multi/multi2.proto delete mode 100644 protoc-gen-go/testdata/multi/multi3.pb.go delete mode 100644 protoc-gen-go/testdata/multi/multi3.proto delete mode 100644 protoc-gen-go/testdata/my_test/test.pb.go delete mode 100644 protoc-gen-go/testdata/my_test/test.proto delete mode 100644 protoc-gen-go/testdata/proto3/proto3.pb.go delete mode 100644 protoc-gen-go/testdata/proto3/proto3.proto create mode 100755 regenerate.bash delete mode 100755 regenerate.sh diff --git a/Makefile b/Makefile deleted file mode 100644 index f35d959f95..0000000000 --- a/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# 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. - -all: install - -install: - go install ./proto ./jsonpb ./ptypes ./protoc-gen-go - -test: - go test ./... ./protoc-gen-go/testdata - go test -tags purego ./... ./protoc-gen-go/testdata - go build ./protoc-gen-go/testdata/grpc/grpc.pb.go - -clean: - go clean ./... - -nuke: - go clean -i ./... - -regenerate: - ./regenerate.sh diff --git a/go.mod b/go.mod index cc7a70eaa4..22c87536b1 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/golang/protobuf -require github.com/golang/protobuf/v2 v2.0.0-20190311234237-8692540cce25 +require github.com/golang/protobuf/v2 v2.0.0-20190312230405-4989810018b7 diff --git a/go.sum b/go.sum index a51b4cbe43..9dd4c5b88e 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ github.com/golang/protobuf v1.2.1-0.20190311233832-968e039ade03/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf/v2 v2.0.0-20190311234237-8692540cce25 h1:OPot/6pIGOXutoEWwijGIyc0s72oha4VMKjoMKgSD84= -github.com/golang/protobuf/v2 v2.0.0-20190311234237-8692540cce25/go.mod h1:JBgB92qSNOVlmhtPbF3BkMlBy5KGJj+k0lo1MaNJhxE= -github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/golang/protobuf/v2 v2.0.0-20190312230405-4989810018b7 h1:aQENkYDAn/68ZfghmurTBhR18Q7/XWx1JpMaqFtP1GM= +github.com/golang/protobuf/v2 v2.0.0-20190312230405-4989810018b7/go.mod h1:euNorOscCho6jibQUfcx8TAp5HZXU5/+1xMsdtkc8lo= +github.com/google/go-cmp v0.2.1-0.20190228024137-c81281657ad9 h1:GDk30QdVXDf6i734280OeWAO9UCCjXLeWkLLyHQGUkI= +github.com/google/go-cmp v0.2.1-0.20190228024137-c81281657ad9/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= diff --git a/integration_test.go b/integration_test.go new file mode 100644 index 0000000000..f8fcadda3e --- /dev/null +++ b/integration_test.go @@ -0,0 +1,334 @@ +// 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. + +// +build ignore + +package main + +import ( + "archive/tar" + "bytes" + "compress/gzip" + "flag" + "fmt" + "io" + "io/ioutil" + "net/http" + "os" + "os/exec" + "path/filepath" + "regexp" + "runtime" + "strings" + "testing" + "time" +) + +var ( + regenerate = flag.Bool("regenerate", false, "regenerate files") + + protobufVersion = "3.7.0" + golangVersions = []string{"1.9.7", "1.10.8", "1.11.5", "1.12"} + golangLatest = golangVersions[len(golangVersions)-1] + + // purgeTimeout determines the maximum age of unused sub-directories. + purgeTimeout = 30 * 24 * time.Hour // 1 month + + // Variables initialized by mustInitDeps. + goPath string + modulePath string +) + +func Test(t *testing.T) { + mustInitDeps(t) + + if *regenerate { + t.Run("Generate", func(t *testing.T) { + fmt.Print(mustRunCommand(t, ".", "go", "run", "./internal/cmd/generate-protos", "-execute")) + files := strings.Split(strings.TrimSpace(mustRunCommand(t, ".", "git", "ls-files", "*.go")), "\n") + mustRunCommand(t, ".", append([]string{"gofmt", "-w"}, files...)...) + }) + t.SkipNow() + } + + for _, v := range golangVersions { + t.Run("Go"+v, func(t *testing.T) { + runGo := func(label, workDir string, args ...string) { + args[0] += v + t.Run(label, func(t *testing.T) { + t.Parallel() + mustRunCommand(t, workDir, args...) + }) + } + workDir := filepath.Join(goPath, "src", modulePath) + runGo("Build", workDir, "go", "build", "./...") + runGo("TestNormal", workDir, "go", "test", "-race", "./...") + }) + } + + t.Run("GeneratedGoFiles", func(t *testing.T) { + diff := mustRunCommand(t, ".", "go", "run", "./internal/cmd/generate-protos") + if strings.TrimSpace(diff) != "" { + t.Fatalf("stale generated files:\n%v", diff) + } + }) + t.Run("FormattedGoFiles", func(t *testing.T) { + files := strings.Split(strings.TrimSpace(mustRunCommand(t, ".", "git", "ls-files", "*.go")), "\n") + diff := mustRunCommand(t, ".", append([]string{"gofmt", "-d"}, files...)...) + if strings.TrimSpace(diff) != "" { + t.Fatalf("unformatted source files:\n%v", diff) + } + }) + t.Run("CommittedGitChanges", func(t *testing.T) { + diff := mustRunCommand(t, ".", "git", "diff", "--no-prefix", "HEAD") + if strings.TrimSpace(diff) != "" { + t.Fatalf("uncommitted changes:\n%v", diff) + } + }) + t.Run("TrackedGitFiles", func(t *testing.T) { + diff := mustRunCommand(t, ".", "git", "ls-files", "--others", "--exclude-standard") + if strings.TrimSpace(diff) != "" { + t.Fatalf("untracked files:\n%v", diff) + } + }) +} + +func mustInitDeps(t *testing.T) { + check := func(err error) { + t.Helper() + if err != nil { + t.Fatal(err) + } + } + + // Determine the directory to place the test directory. + repoRoot, err := os.Getwd() + check(err) + testDir := filepath.Join(repoRoot, ".cache") + check(os.MkdirAll(testDir, 0775)) + + // Travis-CI has a hard-coded timeout where it kills the test after + // 10 minutes of a lack of activity on stdout. + // We work around this restriction by periodically printing the timestamp. + ticker := time.NewTicker(5 * time.Minute) + done := make(chan struct{}) + go func() { + now := time.Now() + for { + select { + case t := <-ticker.C: + fmt.Printf("\tt=%0.fmin\n", t.Sub(now).Minutes()) + case <-done: + return + } + } + }() + defer close(done) + defer ticker.Stop() + + // Delete the current directory if non-empty, + // which only occurs if a dependency failed to initialize properly. + var workingDir string + defer func() { + if workingDir != "" { + os.RemoveAll(workingDir) // best-effort + } + }() + + // Delete other sub-directories that are no longer relevant. + defer func() { + subDirs := map[string]bool{"bin": true, "gocache": true, "gopath": true} + subDirs["protobuf-"+protobufVersion] = true + for _, v := range golangVersions { + subDirs["go"+v] = true + } + + now := time.Now() + fis, _ := ioutil.ReadDir(testDir) + for _, fi := range fis { + if subDirs[fi.Name()] { + os.Chtimes(filepath.Join(testDir, fi.Name()), now, now) // best-effort + continue + } + if now.Sub(fi.ModTime()) < purgeTimeout { + continue + } + fmt.Printf("delete %v\n", fi.Name()) + os.RemoveAll(filepath.Join(testDir, fi.Name())) // best-effort + } + }() + + // The bin directory contains symlinks to each tool by version. + // It is safe to delete this directory and run the test script from scratch. + binPath := filepath.Join(testDir, "bin") + check(os.RemoveAll(binPath)) + check(os.Mkdir(binPath, 0775)) + check(os.Setenv("PATH", binPath+":"+os.Getenv("PATH"))) + registerBinary := func(name, path string) { + check(os.Symlink(path, filepath.Join(binPath, name))) + } + + // Download and build the protobuf toolchain. + // We avoid downloading the pre-compiled binaries since they do not contain + // the conformance test runner. + workingDir = filepath.Join(testDir, "protobuf-"+protobufVersion) + if _, err := os.Stat(workingDir); err != nil { + fmt.Printf("download %v\n", filepath.Base(workingDir)) + url := fmt.Sprintf("https://github.com/google/protobuf/releases/download/v%v/protobuf-all-%v.tar.gz", protobufVersion, protobufVersion) + downloadArchive(check, workingDir, url, "protobuf-"+protobufVersion) + + fmt.Printf("build %v\n", filepath.Base(workingDir)) + mustRunCommand(t, workingDir, "./autogen.sh") + mustRunCommand(t, workingDir, "./configure") + mustRunCommand(t, workingDir, "make") + mustRunCommand(t, filepath.Join(workingDir, "conformance"), "make") + } + patchProtos(check, workingDir) + check(os.Setenv("PROTOBUF_ROOT", workingDir)) // for generate-protos + registerBinary("conform-test-runner", filepath.Join(workingDir, "conformance", "conformance-test-runner")) + registerBinary("protoc", filepath.Join(workingDir, "src", "protoc")) + workingDir = "" + + // Download each Go toolchain version. + for _, v := range golangVersions { + workingDir = filepath.Join(testDir, "go"+v) + if _, err := os.Stat(workingDir); err != nil { + fmt.Printf("download %v\n", filepath.Base(workingDir)) + url := fmt.Sprintf("https://dl.google.com/go/go%v.%v-%v.tar.gz", v, runtime.GOOS, runtime.GOARCH) + downloadArchive(check, workingDir, url, "go") + } + registerBinary("go"+v, filepath.Join(workingDir, "bin", "go")) + } + registerBinary("go", filepath.Join(testDir, "go"+golangLatest, "bin", "go")) + registerBinary("gofmt", filepath.Join(testDir, "go"+golangLatest, "bin", "gofmt")) + workingDir = "" + + // Travis-CI sets GOROOT, which confuses invocations of the Go toolchain. + // Explicitly clear GOROOT, so each toolchain uses their default GOROOT. + check(os.Unsetenv("GOROOT")) + + // Set a cache directory within the test directory. + check(os.Setenv("GOCACHE", filepath.Join(testDir, "gocache"))) + + // Setup GOPATH for pre-module support (i.e., go1.10 and earlier). + goPath = filepath.Join(testDir, "gopath") + modulePath = strings.TrimSpace(mustRunCommand(t, testDir, "go", "list", "-m", "-f", "{{.Path}}")) + check(os.RemoveAll(filepath.Join(goPath, "src"))) + check(os.MkdirAll(filepath.Join(goPath, "src", filepath.Dir(modulePath)), 0775)) + check(os.Symlink(repoRoot, filepath.Join(goPath, "src", modulePath))) + mustRunCommand(t, repoRoot, "go", "mod", "tidy") + mustRunCommand(t, repoRoot, "go", "mod", "vendor") + check(os.Setenv("GOPATH", goPath)) +} + +func downloadArchive(check func(error), dstPath, srcURL, skipPrefix string) { + check(os.RemoveAll(dstPath)) + + resp, err := http.Get(srcURL) + check(err) + defer resp.Body.Close() + + zr, err := gzip.NewReader(resp.Body) + check(err) + + tr := tar.NewReader(zr) + for { + h, err := tr.Next() + if err == io.EOF { + return + } + check(err) + + // Skip directories or files outside the prefix directory. + if len(skipPrefix) > 0 { + if !strings.HasPrefix(h.Name, skipPrefix) { + continue + } + if len(h.Name) > len(skipPrefix) && h.Name[len(skipPrefix)] != '/' { + continue + } + } + + path := strings.TrimPrefix(strings.TrimPrefix(h.Name, skipPrefix), "/") + path = filepath.Join(dstPath, filepath.FromSlash(path)) + mode := os.FileMode(h.Mode & 0777) + switch h.Typeflag { + case tar.TypeReg: + b, err := ioutil.ReadAll(tr) + check(err) + check(ioutil.WriteFile(path, b, mode)) + case tar.TypeDir: + check(os.Mkdir(path, mode)) + } + } +} + +// patchProtos patches proto files with v2 locations of Go packages. +// TODO: Commit these changes upstream. +func patchProtos(check func(error), repoRoot string) { + javaPackageRx := regexp.MustCompile(`^option\s+java_package\s*=\s*".*"\s*;\s*$`) + goPackageRx := regexp.MustCompile(`^option\s+go_package\s*=\s*".*"\s*;\s*$`) + files := map[string]string{ + "src/google/protobuf/any.proto": "github.com/golang/protobuf/v2/types/known;known_proto", + "src/google/protobuf/api.proto": "github.com/golang/protobuf/v2/types/known;known_proto", + "src/google/protobuf/duration.proto": "github.com/golang/protobuf/v2/types/known;known_proto", + "src/google/protobuf/empty.proto": "github.com/golang/protobuf/v2/types/known;known_proto", + "src/google/protobuf/field_mask.proto": "github.com/golang/protobuf/v2/types/known;known_proto", + "src/google/protobuf/source_context.proto": "github.com/golang/protobuf/v2/types/known;known_proto", + "src/google/protobuf/struct.proto": "github.com/golang/protobuf/v2/types/known;known_proto", + "src/google/protobuf/timestamp.proto": "github.com/golang/protobuf/v2/types/known;known_proto", + "src/google/protobuf/type.proto": "github.com/golang/protobuf/v2/types/known;known_proto", + "src/google/protobuf/wrappers.proto": "github.com/golang/protobuf/v2/types/known;known_proto", + "src/google/protobuf/descriptor.proto": "github.com/golang/protobuf/v2/types/descriptor;descriptor_proto", + "src/google/protobuf/compiler/plugin.proto": "github.com/golang/protobuf/v2/types/plugin;plugin_proto", + "conformance/conformance.proto": "github.com/golang/protobuf/v2/internal/testprotos/conformance;conformance_proto", + } + for pbpath, gopath := range files { + b, err := ioutil.ReadFile(filepath.Join(repoRoot, pbpath)) + check(err) + ss := strings.Split(string(b), "\n") + + // Locate java_package and (possible) go_package options. + javaPackageIdx, goPackageIdx := -1, -1 + for i, s := range ss { + if javaPackageIdx < 0 && javaPackageRx.MatchString(s) { + javaPackageIdx = i + } + if goPackageIdx < 0 && goPackageRx.MatchString(s) { + goPackageIdx = i + } + } + + // Ensure the proto file has the correct go_package option. + opt := `option go_package = "` + gopath + `";` + if goPackageIdx >= 0 { + if ss[goPackageIdx] == opt { + continue // no changes needed + } + ss[goPackageIdx] = opt + } else { + // Insert go_package option before java_package option. + ss = append(ss[:javaPackageIdx], append([]string{opt}, ss[javaPackageIdx:]...)...) + } + + fmt.Println("patch " + pbpath) + b = []byte(strings.Join(ss, "\n")) + check(ioutil.WriteFile(filepath.Join(repoRoot, pbpath), b, 0664)) + } +} + +func mustRunCommand(t *testing.T, dir string, args ...string) string { + t.Helper() + stdout := new(bytes.Buffer) + combined := new(bytes.Buffer) + cmd := exec.Command(args[0], args[1:]...) + cmd.Dir = dir + cmd.Env = append(os.Environ(), "PWD="+dir) + cmd.Stdout = io.MultiWriter(stdout, combined) + cmd.Stderr = combined + if err := cmd.Run(); err != nil { + t.Fatalf("executing (%v): %v\n%s", strings.Join(args, " "), err, combined.String()) + } + return stdout.String() +} diff --git a/internal/cmd/generate-protos/main.go b/internal/cmd/generate-protos/main.go new file mode 100644 index 0000000000..1ae8ebd202 --- /dev/null +++ b/internal/cmd/generate-protos/main.go @@ -0,0 +1,157 @@ +// 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. + +//go:generate go run . -execute + +package main + +import ( + "flag" + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "strings" + + gengo "github.com/golang/protobuf/v2/cmd/protoc-gen-go/internal_gengo" + "github.com/golang/protobuf/v2/protogen" +) + +func init() { + // When the environment variable RUN_AS_PROTOC_PLUGIN is set, + // we skip running main and instead act as a protoc plugin. + // This allows the binary to pass itself to protoc. + if os.Getenv("RUN_AS_PROTOC_PLUGIN") == "1" { + protogen.Run(nil, func(gen *protogen.Plugin) error { + for _, file := range gen.Files { + if file.Generate { + gengo.GenerateFile(gen, file) + } + } + return nil + }) + os.Exit(0) + } +} + +var ( + run bool + protoRoot string + repoRoot string + modulePath string +) + +func main() { + flag.BoolVar(&run, "execute", false, "Write generated files to destination.") + flag.StringVar(&protoRoot, "protoroot", os.Getenv("PROTOBUF_ROOT"), "The root of the protobuf source tree.") + flag.Parse() + if protoRoot == "" { + panic("protobuf source root is not set") + } + + // Determine repository root path. + out, err := exec.Command("git", "rev-parse", "--show-toplevel").CombinedOutput() + check(err) + repoRoot = strings.TrimSpace(string(out)) + + // Determine the module path. + cmd := exec.Command("go", "list", "-m", "-f", "{{.Path}}") + cmd.Dir = repoRoot + out, err = cmd.CombinedOutput() + check(err) + modulePath = strings.TrimSpace(string(out)) + + generateLocalProtos() +} + +func generateLocalProtos() { + tmpDir, err := ioutil.TempDir(repoRoot, "tmp") + check(err) + defer os.RemoveAll(tmpDir) + + // Generate all local proto files. + dirs := []struct { + path string + relative bool + }{ + {path: "jsonpb", relative: true}, + {path: "proto", relative: true}, + {path: "protoc-gen-go"}, + {path: "ptypes"}, + } + for _, d := range dirs { + srcDir := filepath.Join(repoRoot, filepath.FromSlash(d.path)) + filepath.Walk(srcDir, func(srcPath string, _ os.FileInfo, err error) error { + if !strings.HasSuffix(srcPath, ".proto") { + return nil + } + + var impPath, relPath string + if d.relative { + impPath = srcDir + + relPath, err = filepath.Rel(srcDir, srcPath) + check(err) + } else { + impPath = tmpDir + + relPath, err = filepath.Rel(repoRoot, srcPath) + check(err) + relPath = filepath.Join(filepath.FromSlash(modulePath), relPath) + + dstDir := filepath.Join(tmpDir, filepath.Dir(relPath)) + check(os.MkdirAll(dstDir, 0775)) + check(os.Link(srcPath, filepath.Join(tmpDir, relPath))) + } + + protoc("-I"+filepath.Join(protoRoot, "src"), "-I"+impPath, "--go_out="+tmpDir, relPath) + return nil + }) + } + + syncOutput(repoRoot, filepath.Join(tmpDir, filepath.FromSlash(modulePath))) +} + +func protoc(args ...string) { + cmd := exec.Command("protoc", "--plugin=protoc-gen-go="+os.Args[0]) + cmd.Args = append(cmd.Args, args...) + cmd.Env = append(os.Environ(), "RUN_AS_PROTOC_PLUGIN=1") + out, err := cmd.CombinedOutput() + if err != nil { + fmt.Println(args) + fmt.Printf("executing: %v\n%s\n", strings.Join(cmd.Args, " "), out) + } + check(err) +} + +func syncOutput(dstDir, srcDir string) { + filepath.Walk(srcDir, func(srcPath string, _ os.FileInfo, _ error) error { + if !strings.HasSuffix(srcPath, ".go") { + return nil + } + relPath, err := filepath.Rel(srcDir, srcPath) + check(err) + dstPath := filepath.Join(dstDir, relPath) + + if run { + fmt.Println("#", relPath) + b, err := ioutil.ReadFile(srcPath) + check(err) + check(os.MkdirAll(filepath.Dir(dstPath), 0775)) + check(ioutil.WriteFile(dstPath, b, 0664)) + } else { + cmd := exec.Command("diff", dstPath, srcPath, "-N", "-u") + cmd.Stdout = os.Stdout + cmd.Run() + } + return nil + }) +} + +func check(err error) { + if err != nil { + panic(err) + } +} diff --git a/jsonpb/jsonpb_test_proto/more_test_objects.pb.go b/jsonpb/jsonpb_test_proto/more_test_objects.pb.go index c19d859cc4..837afc3f6c 100644 --- a/jsonpb/jsonpb_test_proto/more_test_objects.pb.go +++ b/jsonpb/jsonpb_test_proto/more_test_objects.pb.go @@ -1,11 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: more_test_objects.proto +// source: jsonpb_test_proto/more_test_objects.proto package jsonpb import ( proto "github.com/golang/protobuf/proto" protoapi "github.com/golang/protobuf/protoapi" + protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" + reflect "reflect" ) // This is a compile-time assertion to ensure that this generated file @@ -22,6 +25,13 @@ const ( Numeral_ROMAN Numeral = 2 ) +func (e Numeral) Type() protoreflect.EnumType { + return xxx_File_jsonpb_test_proto_more_test_objects_proto_enumTypes[0] +} +func (e Numeral) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var Numeral_name = map[int32]string{ 0: "UNKNOWN", 1: "ARABIC", @@ -39,7 +49,7 @@ func (x Numeral) String() string { } func (Numeral) EnumDescriptor() ([]byte, []int) { - return xxx_File_more_test_objects_proto_rawdesc_gzipped, []int{0} + return xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped, []int{0} } type Simple3 struct { @@ -49,11 +59,14 @@ type Simple3 struct { XXX_sizecache int32 `json:"-"` } +func (m *Simple3) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[0].MessageOf(m) +} func (m *Simple3) Reset() { *m = Simple3{} } func (m *Simple3) String() string { return proto.CompactTextString(m) } func (*Simple3) ProtoMessage() {} func (*Simple3) Descriptor() ([]byte, []int) { - return xxx_File_more_test_objects_proto_rawdesc_gzipped, []int{0} + return xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped, []int{0} } func (m *Simple3) XXX_Unmarshal(b []byte) error { @@ -88,11 +101,14 @@ type SimpleSlice3 struct { XXX_sizecache int32 `json:"-"` } +func (m *SimpleSlice3) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[1].MessageOf(m) +} func (m *SimpleSlice3) Reset() { *m = SimpleSlice3{} } func (m *SimpleSlice3) String() string { return proto.CompactTextString(m) } func (*SimpleSlice3) ProtoMessage() {} func (*SimpleSlice3) Descriptor() ([]byte, []int) { - return xxx_File_more_test_objects_proto_rawdesc_gzipped, []int{1} + return xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped, []int{1} } func (m *SimpleSlice3) XXX_Unmarshal(b []byte) error { @@ -127,11 +143,14 @@ type SimpleMap3 struct { XXX_sizecache int32 `json:"-"` } +func (m *SimpleMap3) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[2].MessageOf(m) +} func (m *SimpleMap3) Reset() { *m = SimpleMap3{} } func (m *SimpleMap3) String() string { return proto.CompactTextString(m) } func (*SimpleMap3) ProtoMessage() {} func (*SimpleMap3) Descriptor() ([]byte, []int) { - return xxx_File_more_test_objects_proto_rawdesc_gzipped, []int{2} + return xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped, []int{2} } func (m *SimpleMap3) XXX_Unmarshal(b []byte) error { @@ -166,11 +185,14 @@ type SimpleNull3 struct { XXX_sizecache int32 `json:"-"` } +func (m *SimpleNull3) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[3].MessageOf(m) +} func (m *SimpleNull3) Reset() { *m = SimpleNull3{} } func (m *SimpleNull3) String() string { return proto.CompactTextString(m) } func (*SimpleNull3) ProtoMessage() {} func (*SimpleNull3) Descriptor() ([]byte, []int) { - return xxx_File_more_test_objects_proto_rawdesc_gzipped, []int{3} + return xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped, []int{3} } func (m *SimpleNull3) XXX_Unmarshal(b []byte) error { @@ -214,11 +236,14 @@ type Mappy struct { XXX_sizecache int32 `json:"-"` } +func (m *Mappy) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[4].MessageOf(m) +} func (m *Mappy) Reset() { *m = Mappy{} } func (m *Mappy) String() string { return proto.CompactTextString(m) } func (*Mappy) ProtoMessage() {} func (*Mappy) Descriptor() ([]byte, []int) { - return xxx_File_more_test_objects_proto_rawdesc_gzipped, []int{4} + return xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped, []int{4} } func (m *Mappy) XXX_Unmarshal(b []byte) error { @@ -310,7 +335,7 @@ func (m *Mappy) GetU64Booly() map[uint64]bool { } func init() { - proto.RegisterFile("more_test_objects.proto", xxx_File_more_test_objects_proto_rawdesc_gzipped) + proto.RegisterFile("jsonpb_test_proto/more_test_objects.proto", xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped) proto.RegisterEnum("jsonpb.Numeral", Numeral_name, Numeral_value) proto.RegisterType((*Simple3)(nil), "jsonpb.Simple3") proto.RegisterType((*SimpleSlice3)(nil), "jsonpb.SimpleSlice3") @@ -330,102 +355,171 @@ func init() { proto.RegisterMapType((map[uint64]bool)(nil), "jsonpb.Mappy.U64boolyEntry") } -var xxx_File_more_test_objects_proto_rawdesc = []byte{ - // 1499 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x17, 0x6d, 0x6f, 0x72, 0x65, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6a, 0x73, 0x6f, 0x6e, 0x70, - 0x62, 0x22, 0x1b, 0x0a, 0x07, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x33, 0x12, 0x10, 0x0a, 0x03, - 0x64, 0x75, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x64, 0x75, 0x62, 0x22, 0x26, - 0x0a, 0x0c, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x33, 0x12, 0x16, - 0x0a, 0x06, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, - 0x73, 0x6c, 0x69, 0x63, 0x65, 0x73, 0x22, 0x83, 0x01, 0x0a, 0x0a, 0x53, 0x69, 0x6d, 0x70, 0x6c, - 0x65, 0x4d, 0x61, 0x70, 0x33, 0x12, 0x39, 0x0a, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x79, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, - 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x61, 0x70, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x79, - 0x1a, 0x3a, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x36, 0x0a, 0x0b, - 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4e, 0x75, 0x6c, 0x6c, 0x33, 0x12, 0x27, 0x0a, 0x06, 0x73, - 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6a, 0x73, - 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x33, 0x52, 0x06, 0x73, 0x69, - 0x6d, 0x70, 0x6c, 0x65, 0x22, 0xfd, 0x08, 0x0a, 0x05, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x12, 0x2e, - 0x0a, 0x05, 0x6e, 0x75, 0x6d, 0x6d, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, - 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x4e, 0x75, 0x6d, - 0x6d, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6e, 0x75, 0x6d, 0x6d, 0x79, 0x12, 0x2e, - 0x0a, 0x05, 0x73, 0x74, 0x72, 0x72, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, - 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x53, 0x74, 0x72, - 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x73, 0x74, 0x72, 0x72, 0x79, 0x12, 0x2e, - 0x0a, 0x05, 0x6f, 0x62, 0x6a, 0x6a, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, - 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x4f, 0x62, 0x6a, - 0x6a, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6f, 0x62, 0x6a, 0x6a, 0x79, 0x12, 0x2e, - 0x0a, 0x05, 0x62, 0x75, 0x67, 0x67, 0x79, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, - 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x42, 0x75, 0x67, - 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x62, 0x75, 0x67, 0x67, 0x79, 0x12, 0x2e, - 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, - 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x42, 0x6f, 0x6f, - 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x12, 0x2e, - 0x0a, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x79, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, - 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x79, 0x12, 0x37, - 0x0a, 0x08, 0x73, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, - 0x53, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x73, - 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x12, 0x37, 0x0a, 0x08, 0x73, 0x36, 0x34, 0x62, 0x6f, - 0x6f, 0x6c, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, - 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x53, 0x36, 0x34, 0x62, 0x6f, 0x6f, 0x6c, - 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x73, 0x36, 0x34, 0x62, 0x6f, 0x6f, 0x6c, 0x79, - 0x12, 0x37, 0x0a, 0x08, 0x75, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x09, 0x20, 0x03, +var xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc = []byte{ + // 1579 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x29, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x6f, 0x72, 0x65, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6a, 0x73, 0x6f, + 0x6e, 0x70, 0x62, 0x22, 0x1b, 0x0a, 0x07, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x33, 0x12, 0x10, + 0x0a, 0x03, 0x64, 0x75, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x64, 0x75, 0x62, + 0x22, 0x26, 0x0a, 0x0c, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x33, + 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x06, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x73, 0x22, 0x83, 0x01, 0x0a, 0x0a, 0x53, 0x69, 0x6d, + 0x70, 0x6c, 0x65, 0x4d, 0x61, 0x70, 0x33, 0x12, 0x39, 0x0a, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, + 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x61, 0x70, 0x33, 0x2e, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x79, 0x1a, 0x3a, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x79, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x36, + 0x0a, 0x0b, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4e, 0x75, 0x6c, 0x6c, 0x33, 0x12, 0x27, 0x0a, + 0x06, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, + 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x33, 0x52, 0x06, + 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x22, 0xfd, 0x08, 0x0a, 0x05, 0x4d, 0x61, 0x70, 0x70, 0x79, + 0x12, 0x2e, 0x0a, 0x05, 0x6e, 0x75, 0x6d, 0x6d, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x4e, + 0x75, 0x6d, 0x6d, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6e, 0x75, 0x6d, 0x6d, 0x79, + 0x12, 0x2e, 0x0a, 0x05, 0x73, 0x74, 0x72, 0x72, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x53, + 0x74, 0x72, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x73, 0x74, 0x72, 0x72, 0x79, + 0x12, 0x2e, 0x0a, 0x05, 0x6f, 0x62, 0x6a, 0x6a, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x4f, + 0x62, 0x6a, 0x6a, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6f, 0x62, 0x6a, 0x6a, 0x79, + 0x12, 0x2e, 0x0a, 0x05, 0x62, 0x75, 0x67, 0x67, 0x79, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x42, + 0x75, 0x67, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x62, 0x75, 0x67, 0x67, 0x79, + 0x12, 0x2e, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x42, + 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x79, + 0x12, 0x2e, 0x0a, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x79, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x45, + 0x6e, 0x75, 0x6d, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x79, + 0x12, 0x37, 0x0a, 0x08, 0x73, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, - 0x79, 0x2e, 0x55, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x08, 0x75, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x12, 0x37, 0x0a, 0x08, 0x75, 0x36, 0x34, - 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6a, 0x73, - 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x55, 0x36, 0x34, 0x62, 0x6f, - 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x75, 0x36, 0x34, 0x62, 0x6f, 0x6f, - 0x6c, 0x79, 0x1a, 0x38, 0x0a, 0x0a, 0x4e, 0x75, 0x6d, 0x6d, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, - 0x53, 0x74, 0x72, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x49, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x6a, 0x79, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, - 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x33, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x42, 0x75, 0x67, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x42, - 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x49, 0x0a, 0x0a, 0x45, 0x6e, 0x75, 0x6d, 0x79, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4e, 0x75, - 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x1a, 0x3b, 0x0a, 0x0d, 0x53, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, + 0x79, 0x2e, 0x53, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x08, 0x73, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x12, 0x37, 0x0a, 0x08, 0x73, 0x36, 0x34, + 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6a, 0x73, + 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x53, 0x36, 0x34, 0x62, 0x6f, + 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x73, 0x36, 0x34, 0x62, 0x6f, 0x6f, + 0x6c, 0x79, 0x12, 0x37, 0x0a, 0x08, 0x75, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x09, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, + 0x70, 0x70, 0x79, 0x2e, 0x55, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x08, 0x75, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x12, 0x37, 0x0a, 0x08, 0x75, + 0x36, 0x34, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x55, 0x36, 0x34, + 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x75, 0x36, 0x34, 0x62, + 0x6f, 0x6f, 0x6c, 0x79, 0x1a, 0x38, 0x0a, 0x0a, 0x4e, 0x75, 0x6d, 0x6d, 0x79, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, + 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x49, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x6a, + 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, + 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x33, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x42, 0x75, 0x67, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, - 0x0d, 0x53, 0x36, 0x34, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x55, 0x33, - 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, + 0x0a, 0x42, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x55, 0x36, 0x34, 0x62, 0x6f, - 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x2d, 0x0a, 0x07, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x12, - 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, - 0x41, 0x52, 0x41, 0x42, 0x49, 0x43, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x4f, 0x4d, 0x41, - 0x4e, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x49, 0x0a, 0x0a, 0x45, 0x6e, 0x75, 0x6d, 0x79, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, + 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x53, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, + 0x3b, 0x0a, 0x0d, 0x53, 0x36, 0x34, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, + 0x55, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x55, 0x36, 0x34, + 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x2d, 0x0a, 0x07, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x61, + 0x6c, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, + 0x0a, 0x06, 0x41, 0x52, 0x41, 0x42, 0x49, 0x43, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x4f, + 0x4d, 0x41, 0x4e, 0x10, 0x02, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x70, + 0x62, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x6a, 0x73, 0x6f, + 0x6e, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc) + +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) + +var File_jsonpb_test_proto_more_test_objects_proto protoreflect.FileDescriptor + +var xxx_File_jsonpb_test_proto_more_test_objects_proto_enumTypes = make([]protoreflect.EnumType, 1) +var xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes = make([]protoimpl.MessageType, 16) +var xxx_File_jsonpb_test_proto_more_test_objects_proto_goTypes = []interface{}{ + (Numeral)(0), // 0: jsonpb.Numeral + (*Simple3)(nil), // 1: jsonpb.Simple3 + (*SimpleSlice3)(nil), // 2: jsonpb.SimpleSlice3 + (*SimpleMap3)(nil), // 3: jsonpb.SimpleMap3 + (*SimpleNull3)(nil), // 4: jsonpb.SimpleNull3 + (*Mappy)(nil), // 5: jsonpb.Mappy + nil, // 6: jsonpb.SimpleMap3.StringyEntry + nil, // 7: jsonpb.Mappy.NummyEntry + nil, // 8: jsonpb.Mappy.StrryEntry + nil, // 9: jsonpb.Mappy.ObjjyEntry + nil, // 10: jsonpb.Mappy.BuggyEntry + nil, // 11: jsonpb.Mappy.BoolyEntry + nil, // 12: jsonpb.Mappy.EnumyEntry + nil, // 13: jsonpb.Mappy.S32boolyEntry + nil, // 14: jsonpb.Mappy.S64boolyEntry + nil, // 15: jsonpb.Mappy.U32boolyEntry + nil, // 16: jsonpb.Mappy.U64boolyEntry +} +var xxx_File_jsonpb_test_proto_more_test_objects_proto_depIdxs = []int32{ + 6, // jsonpb.SimpleMap3.stringy:type_name -> jsonpb.SimpleMap3.StringyEntry + 1, // jsonpb.SimpleNull3.simple:type_name -> jsonpb.Simple3 + 7, // jsonpb.Mappy.nummy:type_name -> jsonpb.Mappy.NummyEntry + 8, // jsonpb.Mappy.strry:type_name -> jsonpb.Mappy.StrryEntry + 9, // jsonpb.Mappy.objjy:type_name -> jsonpb.Mappy.ObjjyEntry + 10, // jsonpb.Mappy.buggy:type_name -> jsonpb.Mappy.BuggyEntry + 11, // jsonpb.Mappy.booly:type_name -> jsonpb.Mappy.BoolyEntry + 12, // jsonpb.Mappy.enumy:type_name -> jsonpb.Mappy.EnumyEntry + 13, // jsonpb.Mappy.s32booly:type_name -> jsonpb.Mappy.S32boolyEntry + 14, // jsonpb.Mappy.s64booly:type_name -> jsonpb.Mappy.S64boolyEntry + 15, // jsonpb.Mappy.u32booly:type_name -> jsonpb.Mappy.U32boolyEntry + 16, // jsonpb.Mappy.u64booly:type_name -> jsonpb.Mappy.U64boolyEntry + 1, // jsonpb.Mappy.ObjjyEntry.value:type_name -> jsonpb.Simple3 + 0, // jsonpb.Mappy.EnumyEntry.value:type_name -> jsonpb.Numeral +} + +func init() { xxx_File_jsonpb_test_proto_more_test_objects_proto_init() } +func xxx_File_jsonpb_test_proto_more_test_objects_proto_init() { + if File_jsonpb_test_proto_more_test_objects_proto != nil { + return + } + messageTypes := make([]protoreflect.MessageType, 16) + File_jsonpb_test_proto_more_test_objects_proto = protoimpl.FileBuilder{ + RawDescriptor: xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc, + GoTypes: xxx_File_jsonpb_test_proto_more_test_objects_proto_goTypes, + DependencyIndexes: xxx_File_jsonpb_test_proto_more_test_objects_proto_depIdxs, + EnumOutputTypes: xxx_File_jsonpb_test_proto_more_test_objects_proto_enumTypes, + MessageOutputTypes: messageTypes, + }.Init() + messageGoTypes := xxx_File_jsonpb_test_proto_more_test_objects_proto_goTypes[1:][:16] + for i, mt := range messageTypes { + xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[i].GoType = reflect.TypeOf(messageGoTypes[i]) + xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[i].PBType = mt + } + xxx_File_jsonpb_test_proto_more_test_objects_proto_goTypes = nil + xxx_File_jsonpb_test_proto_more_test_objects_proto_depIdxs = nil } - -var xxx_File_more_test_objects_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_more_test_objects_proto_rawdesc) diff --git a/jsonpb/jsonpb_test_proto/more_test_objects.proto b/jsonpb/jsonpb_test_proto/more_test_objects.proto index d254fa5fae..abe98ef30e 100644 --- a/jsonpb/jsonpb_test_proto/more_test_objects.proto +++ b/jsonpb/jsonpb_test_proto/more_test_objects.proto @@ -31,6 +31,8 @@ syntax = "proto3"; +option go_package = "github.com/golang/protobuf/jsonpb/jsonpb_test_proto;jsonpb"; + package jsonpb; message Simple3 { diff --git a/jsonpb/jsonpb_test_proto/test_objects.pb.go b/jsonpb/jsonpb_test_proto/test_objects.pb.go index 8147573939..a892ec7a84 100644 --- a/jsonpb/jsonpb_test_proto/test_objects.pb.go +++ b/jsonpb/jsonpb_test_proto/test_objects.pb.go @@ -1,16 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: test_objects.proto +// source: jsonpb_test_proto/test_objects.proto package jsonpb import ( proto "github.com/golang/protobuf/proto" protoapi "github.com/golang/protobuf/protoapi" - any "github.com/golang/protobuf/ptypes/any" - duration "github.com/golang/protobuf/ptypes/duration" - _struct "github.com/golang/protobuf/ptypes/struct" - timestamp "github.com/golang/protobuf/ptypes/timestamp" - wrappers "github.com/golang/protobuf/ptypes/wrappers" + protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" + known "github.com/golang/protobuf/v2/types/known" + reflect "reflect" ) // This is a compile-time assertion to ensure that this generated file @@ -27,6 +26,13 @@ const ( Widget_BLUE Widget_Color = 2 ) +func (e Widget_Color) Type() protoreflect.EnumType { + return xxx_File_jsonpb_test_proto_test_objects_proto_enumTypes[0] +} +func (e Widget_Color) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var Widget_Color_name = map[int32]string{ 0: "RED", 1: "GREEN", @@ -59,7 +65,7 @@ func (x *Widget_Color) UnmarshalJSON(data []byte) error { } func (Widget_Color) EnumDescriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{3, 0} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{3, 0} } // Test message for holding primitive types. @@ -88,11 +94,14 @@ type Simple struct { XXX_sizecache int32 `json:"-"` } +func (m *Simple) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[0].MessageOf(m) +} func (m *Simple) Reset() { *m = Simple{} } func (m *Simple) String() string { return proto.CompactTextString(m) } func (*Simple) ProtoMessage() {} func (*Simple) Descriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{0} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{0} } func (m *Simple) XXX_Unmarshal(b []byte) error { @@ -259,11 +268,14 @@ type NonFinites struct { XXX_sizecache int32 `json:"-"` } +func (m *NonFinites) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[1].MessageOf(m) +} func (m *NonFinites) Reset() { *m = NonFinites{} } func (m *NonFinites) String() string { return proto.CompactTextString(m) } func (*NonFinites) ProtoMessage() {} func (*NonFinites) Descriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{1} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{1} } func (m *NonFinites) XXX_Unmarshal(b []byte) error { @@ -344,11 +356,14 @@ type Repeats struct { XXX_sizecache int32 `json:"-"` } +func (m *Repeats) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[2].MessageOf(m) +} func (m *Repeats) Reset() { *m = Repeats{} } func (m *Repeats) String() string { return proto.CompactTextString(m) } func (*Repeats) ProtoMessage() {} func (*Repeats) Descriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{2} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{2} } func (m *Repeats) XXX_Unmarshal(b []byte) error { @@ -459,11 +474,14 @@ type Widget struct { XXX_sizecache int32 `json:"-"` } +func (m *Widget) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[3].MessageOf(m) +} func (m *Widget) Reset() { *m = Widget{} } func (m *Widget) String() string { return proto.CompactTextString(m) } func (*Widget) ProtoMessage() {} func (*Widget) Descriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{3} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{3} } func (m *Widget) XXX_Unmarshal(b []byte) error { @@ -534,11 +552,14 @@ type Maps struct { XXX_sizecache int32 `json:"-"` } +func (m *Maps) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[4].MessageOf(m) +} func (m *Maps) Reset() { *m = Maps{} } func (m *Maps) String() string { return proto.CompactTextString(m) } func (*Maps) ProtoMessage() {} func (*Maps) Descriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{4} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{4} } func (m *Maps) XXX_Unmarshal(b []byte) error { @@ -586,11 +607,14 @@ type MsgWithOneof struct { XXX_sizecache int32 `json:"-"` } +func (m *MsgWithOneof) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[5].MessageOf(m) +} func (m *MsgWithOneof) Reset() { *m = MsgWithOneof{} } func (m *MsgWithOneof) String() string { return proto.CompactTextString(m) } func (*MsgWithOneof) ProtoMessage() {} func (*MsgWithOneof) Descriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{5} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{5} } func (m *MsgWithOneof) XXX_Unmarshal(b []byte) error { @@ -706,11 +730,14 @@ type Real struct { XXX_sizecache int32 `json:"-"` } +func (m *Real) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[6].MessageOf(m) +} func (m *Real) Reset() { *m = Real{} } func (m *Real) String() string { return proto.CompactTextString(m) } func (*Real) ProtoMessage() {} func (*Real) Descriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{6} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{6} } var extRange_Real = []proto.ExtensionRange{ @@ -754,11 +781,14 @@ type Complex struct { XXX_sizecache int32 `json:"-"` } +func (m *Complex) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[7].MessageOf(m) +} func (m *Complex) Reset() { *m = Complex{} } func (m *Complex) String() string { return proto.CompactTextString(m) } func (*Complex) ProtoMessage() {} func (*Complex) Descriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{7} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{7} } var extRange_Complex = []proto.ExtensionRange{ @@ -795,31 +825,34 @@ func (m *Complex) GetImaginary() float64 { } type KnownTypes struct { - An *any.Any `protobuf:"bytes,14,opt,name=an" json:"an,omitempty"` - Dur *duration.Duration `protobuf:"bytes,1,opt,name=dur" json:"dur,omitempty"` - St *_struct.Struct `protobuf:"bytes,12,opt,name=st" json:"st,omitempty"` - Ts *timestamp.Timestamp `protobuf:"bytes,2,opt,name=ts" json:"ts,omitempty"` - Lv *_struct.ListValue `protobuf:"bytes,15,opt,name=lv" json:"lv,omitempty"` - Val *_struct.Value `protobuf:"bytes,16,opt,name=val" json:"val,omitempty"` - Dbl *wrappers.DoubleValue `protobuf:"bytes,3,opt,name=dbl" json:"dbl,omitempty"` - Flt *wrappers.FloatValue `protobuf:"bytes,4,opt,name=flt" json:"flt,omitempty"` - I64 *wrappers.Int64Value `protobuf:"bytes,5,opt,name=i64" json:"i64,omitempty"` - U64 *wrappers.UInt64Value `protobuf:"bytes,6,opt,name=u64" json:"u64,omitempty"` - I32 *wrappers.Int32Value `protobuf:"bytes,7,opt,name=i32" json:"i32,omitempty"` - U32 *wrappers.UInt32Value `protobuf:"bytes,8,opt,name=u32" json:"u32,omitempty"` - Bool *wrappers.BoolValue `protobuf:"bytes,9,opt,name=bool" json:"bool,omitempty"` - Str *wrappers.StringValue `protobuf:"bytes,10,opt,name=str" json:"str,omitempty"` - Bytes *wrappers.BytesValue `protobuf:"bytes,11,opt,name=bytes" json:"bytes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + An *known.Any `protobuf:"bytes,14,opt,name=an" json:"an,omitempty"` + Dur *known.Duration `protobuf:"bytes,1,opt,name=dur" json:"dur,omitempty"` + St *known.Struct `protobuf:"bytes,12,opt,name=st" json:"st,omitempty"` + Ts *known.Timestamp `protobuf:"bytes,2,opt,name=ts" json:"ts,omitempty"` + Lv *known.ListValue `protobuf:"bytes,15,opt,name=lv" json:"lv,omitempty"` + Val *known.Value `protobuf:"bytes,16,opt,name=val" json:"val,omitempty"` + Dbl *known.DoubleValue `protobuf:"bytes,3,opt,name=dbl" json:"dbl,omitempty"` + Flt *known.FloatValue `protobuf:"bytes,4,opt,name=flt" json:"flt,omitempty"` + I64 *known.Int64Value `protobuf:"bytes,5,opt,name=i64" json:"i64,omitempty"` + U64 *known.UInt64Value `protobuf:"bytes,6,opt,name=u64" json:"u64,omitempty"` + I32 *known.Int32Value `protobuf:"bytes,7,opt,name=i32" json:"i32,omitempty"` + U32 *known.UInt32Value `protobuf:"bytes,8,opt,name=u32" json:"u32,omitempty"` + Bool *known.BoolValue `protobuf:"bytes,9,opt,name=bool" json:"bool,omitempty"` + Str *known.StringValue `protobuf:"bytes,10,opt,name=str" json:"str,omitempty"` + Bytes *known.BytesValue `protobuf:"bytes,11,opt,name=bytes" json:"bytes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *KnownTypes) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[8].MessageOf(m) } - func (m *KnownTypes) Reset() { *m = KnownTypes{} } func (m *KnownTypes) String() string { return proto.CompactTextString(m) } func (*KnownTypes) ProtoMessage() {} func (*KnownTypes) Descriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{8} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{8} } func (m *KnownTypes) XXX_Unmarshal(b []byte) error { @@ -840,105 +873,105 @@ func (m *KnownTypes) XXX_DiscardUnknown() { var xxx_messageInfo_KnownTypes proto.InternalMessageInfo -func (m *KnownTypes) GetAn() *any.Any { +func (m *KnownTypes) GetAn() *known.Any { if m != nil { return m.An } return nil } -func (m *KnownTypes) GetDur() *duration.Duration { +func (m *KnownTypes) GetDur() *known.Duration { if m != nil { return m.Dur } return nil } -func (m *KnownTypes) GetSt() *_struct.Struct { +func (m *KnownTypes) GetSt() *known.Struct { if m != nil { return m.St } return nil } -func (m *KnownTypes) GetTs() *timestamp.Timestamp { +func (m *KnownTypes) GetTs() *known.Timestamp { if m != nil { return m.Ts } return nil } -func (m *KnownTypes) GetLv() *_struct.ListValue { +func (m *KnownTypes) GetLv() *known.ListValue { if m != nil { return m.Lv } return nil } -func (m *KnownTypes) GetVal() *_struct.Value { +func (m *KnownTypes) GetVal() *known.Value { if m != nil { return m.Val } return nil } -func (m *KnownTypes) GetDbl() *wrappers.DoubleValue { +func (m *KnownTypes) GetDbl() *known.DoubleValue { if m != nil { return m.Dbl } return nil } -func (m *KnownTypes) GetFlt() *wrappers.FloatValue { +func (m *KnownTypes) GetFlt() *known.FloatValue { if m != nil { return m.Flt } return nil } -func (m *KnownTypes) GetI64() *wrappers.Int64Value { +func (m *KnownTypes) GetI64() *known.Int64Value { if m != nil { return m.I64 } return nil } -func (m *KnownTypes) GetU64() *wrappers.UInt64Value { +func (m *KnownTypes) GetU64() *known.UInt64Value { if m != nil { return m.U64 } return nil } -func (m *KnownTypes) GetI32() *wrappers.Int32Value { +func (m *KnownTypes) GetI32() *known.Int32Value { if m != nil { return m.I32 } return nil } -func (m *KnownTypes) GetU32() *wrappers.UInt32Value { +func (m *KnownTypes) GetU32() *known.UInt32Value { if m != nil { return m.U32 } return nil } -func (m *KnownTypes) GetBool() *wrappers.BoolValue { +func (m *KnownTypes) GetBool() *known.BoolValue { if m != nil { return m.Bool } return nil } -func (m *KnownTypes) GetStr() *wrappers.StringValue { +func (m *KnownTypes) GetStr() *known.StringValue { if m != nil { return m.Str } return nil } -func (m *KnownTypes) GetBytes() *wrappers.BytesValue { +func (m *KnownTypes) GetBytes() *known.BytesValue { if m != nil { return m.Bytes } @@ -953,11 +986,14 @@ type MsgWithRequired struct { XXX_sizecache int32 `json:"-"` } +func (m *MsgWithRequired) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[9].MessageOf(m) +} func (m *MsgWithRequired) Reset() { *m = MsgWithRequired{} } func (m *MsgWithRequired) String() string { return proto.CompactTextString(m) } func (*MsgWithRequired) ProtoMessage() {} func (*MsgWithRequired) Descriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{9} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{9} } func (m *MsgWithRequired) XXX_Unmarshal(b []byte) error { @@ -994,11 +1030,14 @@ type MsgWithIndirectRequired struct { XXX_sizecache int32 `json:"-"` } +func (m *MsgWithIndirectRequired) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[10].MessageOf(m) +} func (m *MsgWithIndirectRequired) Reset() { *m = MsgWithIndirectRequired{} } func (m *MsgWithIndirectRequired) String() string { return proto.CompactTextString(m) } func (*MsgWithIndirectRequired) ProtoMessage() {} func (*MsgWithIndirectRequired) Descriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{10} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{10} } func (m *MsgWithIndirectRequired) XXX_Unmarshal(b []byte) error { @@ -1047,11 +1086,14 @@ type MsgWithRequiredBytes struct { XXX_sizecache int32 `json:"-"` } +func (m *MsgWithRequiredBytes) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[11].MessageOf(m) +} func (m *MsgWithRequiredBytes) Reset() { *m = MsgWithRequiredBytes{} } func (m *MsgWithRequiredBytes) String() string { return proto.CompactTextString(m) } func (*MsgWithRequiredBytes) ProtoMessage() {} func (*MsgWithRequiredBytes) Descriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{11} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{11} } func (m *MsgWithRequiredBytes) XXX_Unmarshal(b []byte) error { @@ -1080,17 +1122,20 @@ func (m *MsgWithRequiredBytes) GetByts() []byte { } type MsgWithRequiredWKT struct { - Str *wrappers.StringValue `protobuf:"bytes,1,req,name=str" json:"str,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Str *known.StringValue `protobuf:"bytes,1,req,name=str" json:"str,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } +func (m *MsgWithRequiredWKT) ProtoReflect() protoreflect.Message { + return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[12].MessageOf(m) +} func (m *MsgWithRequiredWKT) Reset() { *m = MsgWithRequiredWKT{} } func (m *MsgWithRequiredWKT) String() string { return proto.CompactTextString(m) } func (*MsgWithRequiredWKT) ProtoMessage() {} func (*MsgWithRequiredWKT) Descriptor() ([]byte, []int) { - return xxx_File_test_objects_proto_rawdesc_gzipped, []int{12} + return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{12} } func (m *MsgWithRequiredWKT) XXX_Unmarshal(b []byte) error { @@ -1111,7 +1156,7 @@ func (m *MsgWithRequiredWKT) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWithRequiredWKT proto.InternalMessageInfo -func (m *MsgWithRequiredWKT) GetStr() *wrappers.StringValue { +func (m *MsgWithRequiredWKT) GetStr() *known.StringValue { if m != nil { return m.Str } @@ -1124,7 +1169,7 @@ var E_Name = &proto.ExtensionDesc{ Field: 124, Name: "jsonpb.name", Tag: "bytes,124,opt,name=name", - Filename: "test_objects.proto", + Filename: "jsonpb_test_proto/test_objects.proto", } var E_Extm = &proto.ExtensionDesc{ @@ -1133,7 +1178,7 @@ var E_Extm = &proto.ExtensionDesc{ Field: 125, Name: "jsonpb.extm", Tag: "bytes,125,opt,name=extm", - Filename: "test_objects.proto", + Filename: "jsonpb_test_proto/test_objects.proto", } var E_Complex_RealExtension = &proto.ExtensionDesc{ @@ -1142,11 +1187,11 @@ var E_Complex_RealExtension = &proto.ExtensionDesc{ Field: 123, Name: "jsonpb.Complex.real_extension", Tag: "bytes,123,opt,name=real_extension", - Filename: "test_objects.proto", + Filename: "jsonpb_test_proto/test_objects.proto", } func init() { - proto.RegisterFile("test_objects.proto", xxx_File_test_objects_proto_rawdesc_gzipped) + proto.RegisterFile("jsonpb_test_proto/test_objects.proto", xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped) proto.RegisterEnum("jsonpb.Widget_Color", Widget_Color_name, Widget_Color_value) proto.RegisterType((*Simple)(nil), "jsonpb.Simple") proto.RegisterType((*NonFinites)(nil), "jsonpb.NonFinites") @@ -1169,221 +1214,331 @@ func init() { proto.RegisterExtension(E_Complex_RealExtension) } -var xxx_File_test_objects_proto_rawdesc = []byte{ - // 3393 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x12, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x1a, 0x19, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, - 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x04, 0x0a, 0x06, 0x53, 0x69, 0x6d, 0x70, 0x6c, - 0x65, 0x12, 0x15, 0x0a, 0x06, 0x6f, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x05, 0x6f, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x5f, 0x69, 0x6e, - 0x74, 0x33, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6f, 0x49, 0x6e, 0x74, 0x33, - 0x32, 0x12, 0x1e, 0x0a, 0x0b, 0x6f, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x73, 0x74, 0x72, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x53, 0x74, - 0x72, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x06, 0x6f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1e, 0x0a, 0x0b, 0x6f, 0x5f, - 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x09, 0x6f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, - 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6f, 0x55, - 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, - 0x32, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6f, 0x55, 0x69, - 0x6e, 0x74, 0x33, 0x32, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x75, 0x69, 0x6e, - 0x74, 0x36, 0x34, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6f, 0x55, 0x69, 0x6e, 0x74, - 0x36, 0x34, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x73, - 0x74, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x6f, 0x55, 0x69, 0x6e, 0x74, 0x36, - 0x34, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x11, 0x52, 0x07, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, - 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x73, 0x74, 0x72, 0x18, - 0x0b, 0x20, 0x01, 0x28, 0x11, 0x52, 0x0a, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x53, 0x74, - 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x0c, 0x20, - 0x01, 0x28, 0x12, 0x52, 0x07, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x20, 0x0a, 0x0c, - 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x0d, 0x20, 0x01, - 0x28, 0x12, 0x52, 0x0a, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x12, 0x17, - 0x0a, 0x07, 0x6f, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x02, 0x52, - 0x06, 0x6f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x1e, 0x0a, 0x0b, 0x6f, 0x5f, 0x66, 0x6c, 0x6f, - 0x61, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x02, 0x52, 0x09, 0x6f, 0x46, - 0x6c, 0x6f, 0x61, 0x74, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x64, 0x6f, 0x75, - 0x62, 0x6c, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6f, 0x44, 0x6f, 0x75, 0x62, - 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x73, - 0x74, 0x72, 0x18, 0x11, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6f, 0x44, 0x6f, 0x75, 0x62, 0x6c, - 0x65, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, - 0x17, 0x0a, 0x07, 0x6f, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x06, 0x6f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x92, 0x01, 0x0a, 0x0a, 0x4e, 0x6f, 0x6e, - 0x46, 0x69, 0x6e, 0x69, 0x74, 0x65, 0x73, 0x12, 0x13, 0x0a, 0x05, 0x66, 0x5f, 0x6e, 0x61, 0x6e, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x04, 0x66, 0x4e, 0x61, 0x6e, 0x12, 0x15, 0x0a, 0x06, - 0x66, 0x5f, 0x70, 0x69, 0x6e, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x66, 0x50, - 0x69, 0x6e, 0x66, 0x12, 0x15, 0x0a, 0x06, 0x66, 0x5f, 0x6e, 0x69, 0x6e, 0x66, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x02, 0x52, 0x05, 0x66, 0x4e, 0x69, 0x6e, 0x66, 0x12, 0x13, 0x0a, 0x05, 0x64, 0x5f, - 0x6e, 0x61, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x64, 0x4e, 0x61, 0x6e, 0x12, - 0x15, 0x0a, 0x06, 0x64, 0x5f, 0x70, 0x69, 0x6e, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, - 0x05, 0x64, 0x50, 0x69, 0x6e, 0x66, 0x12, 0x15, 0x0a, 0x06, 0x64, 0x5f, 0x6e, 0x69, 0x6e, 0x66, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x64, 0x4e, 0x69, 0x6e, 0x66, 0x22, 0xa6, 0x02, - 0x0a, 0x07, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x5f, 0x62, - 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x08, 0x52, 0x05, 0x72, 0x42, 0x6f, 0x6f, 0x6c, - 0x12, 0x17, 0x0a, 0x07, 0x72, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x05, 0x52, 0x06, 0x72, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x5f, 0x69, - 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x72, 0x49, 0x6e, 0x74, - 0x36, 0x34, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0d, 0x52, 0x07, 0x72, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x19, 0x0a, - 0x08, 0x72, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x05, 0x20, 0x03, 0x28, 0x04, 0x52, - 0x07, 0x72, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x69, - 0x6e, 0x74, 0x33, 0x32, 0x18, 0x06, 0x20, 0x03, 0x28, 0x11, 0x52, 0x07, 0x72, 0x53, 0x69, 0x6e, - 0x74, 0x33, 0x32, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, - 0x07, 0x20, 0x03, 0x28, 0x12, 0x52, 0x07, 0x72, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x17, - 0x0a, 0x07, 0x72, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x03, 0x28, 0x02, 0x52, - 0x06, 0x72, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x64, 0x6f, 0x75, - 0x62, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x01, 0x52, 0x07, 0x72, 0x44, 0x6f, 0x75, 0x62, - 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x0a, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x17, 0x0a, - 0x07, 0x72, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, - 0x72, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0xb6, 0x02, 0x0a, 0x06, 0x57, 0x69, 0x64, 0x67, 0x65, - 0x74, 0x12, 0x2a, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, +var xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc = []byte{ + // 3473 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x24, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x1a, 0x19, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, + 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, + 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x04, 0x0a, 0x06, 0x53, 0x69, 0x6d, + 0x70, 0x6c, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x6f, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x05, 0x6f, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x5f, + 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6f, 0x49, 0x6e, + 0x74, 0x33, 0x32, 0x12, 0x1e, 0x0a, 0x0b, 0x6f, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x73, + 0x74, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6f, 0x49, 0x6e, 0x74, 0x33, 0x32, + 0x53, 0x74, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1e, 0x0a, 0x0b, + 0x6f, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x6f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, + 0x6f, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, + 0x6f, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x75, 0x69, 0x6e, + 0x74, 0x33, 0x32, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6f, + 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x75, + 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6f, 0x55, 0x69, + 0x6e, 0x74, 0x36, 0x34, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, + 0x5f, 0x73, 0x74, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x6f, 0x55, 0x69, 0x6e, + 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, + 0x33, 0x32, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x11, 0x52, 0x07, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x33, + 0x32, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x73, 0x74, + 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x11, 0x52, 0x0a, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, + 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, + 0x0c, 0x20, 0x01, 0x28, 0x12, 0x52, 0x07, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x20, + 0x0a, 0x0c, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x0d, + 0x20, 0x01, 0x28, 0x12, 0x52, 0x0a, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, + 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, + 0x02, 0x52, 0x06, 0x6f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x1e, 0x0a, 0x0b, 0x6f, 0x5f, 0x66, + 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x02, 0x52, 0x09, + 0x6f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x64, + 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6f, 0x44, 0x6f, + 0x75, 0x62, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, + 0x5f, 0x73, 0x74, 0x72, 0x18, 0x11, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6f, 0x44, 0x6f, 0x75, + 0x62, 0x6c, 0x65, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x73, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x13, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x06, 0x6f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x92, 0x01, 0x0a, 0x0a, 0x4e, + 0x6f, 0x6e, 0x46, 0x69, 0x6e, 0x69, 0x74, 0x65, 0x73, 0x12, 0x13, 0x0a, 0x05, 0x66, 0x5f, 0x6e, + 0x61, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x04, 0x66, 0x4e, 0x61, 0x6e, 0x12, 0x15, + 0x0a, 0x06, 0x66, 0x5f, 0x70, 0x69, 0x6e, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, + 0x66, 0x50, 0x69, 0x6e, 0x66, 0x12, 0x15, 0x0a, 0x06, 0x66, 0x5f, 0x6e, 0x69, 0x6e, 0x66, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x66, 0x4e, 0x69, 0x6e, 0x66, 0x12, 0x13, 0x0a, 0x05, + 0x64, 0x5f, 0x6e, 0x61, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x64, 0x4e, 0x61, + 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x64, 0x5f, 0x70, 0x69, 0x6e, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x05, 0x64, 0x50, 0x69, 0x6e, 0x66, 0x12, 0x15, 0x0a, 0x06, 0x64, 0x5f, 0x6e, 0x69, + 0x6e, 0x66, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x64, 0x4e, 0x69, 0x6e, 0x66, 0x22, + 0xa6, 0x02, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x12, 0x15, 0x0a, 0x06, 0x72, + 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x08, 0x52, 0x05, 0x72, 0x42, 0x6f, + 0x6f, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x05, 0x52, 0x06, 0x72, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x17, 0x0a, 0x07, 0x72, + 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x72, 0x49, + 0x6e, 0x74, 0x36, 0x34, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x07, 0x72, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, + 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x05, 0x20, 0x03, 0x28, + 0x04, 0x52, 0x07, 0x72, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, + 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x06, 0x20, 0x03, 0x28, 0x11, 0x52, 0x07, 0x72, 0x53, + 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, + 0x34, 0x18, 0x07, 0x20, 0x03, 0x28, 0x12, 0x52, 0x07, 0x72, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, + 0x12, 0x17, 0x0a, 0x07, 0x72, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x03, 0x28, + 0x02, 0x52, 0x06, 0x72, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x64, + 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x01, 0x52, 0x07, 0x72, 0x44, 0x6f, + 0x75, 0x62, 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, + 0x17, 0x0a, 0x07, 0x72, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0c, + 0x52, 0x06, 0x72, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0xb6, 0x02, 0x0a, 0x06, 0x57, 0x69, 0x64, + 0x67, 0x65, 0x74, 0x12, 0x2a, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, + 0x65, 0x74, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, + 0x2d, 0x0a, 0x07, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, - 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x2d, 0x0a, - 0x07, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x14, - 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x2e, 0x43, - 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x06, 0x72, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x26, 0x0a, 0x06, - 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6a, - 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x06, 0x73, 0x69, - 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x29, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, - 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, - 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x07, 0x72, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x12, - 0x29, 0x0a, 0x07, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, - 0x73, 0x52, 0x07, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x09, 0x72, 0x5f, - 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x52, 0x08, - 0x72, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x22, 0x25, 0x0a, 0x05, 0x43, 0x6f, 0x6c, 0x6f, - 0x72, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, - 0x45, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x22, - 0x94, 0x02, 0x0a, 0x04, 0x4d, 0x61, 0x70, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x6d, 0x5f, 0x69, 0x6e, - 0x74, 0x36, 0x34, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x73, 0x2e, 0x4d, 0x49, 0x6e, 0x74, - 0x36, 0x34, 0x53, 0x74, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x49, 0x6e, 0x74, - 0x36, 0x34, 0x53, 0x74, 0x72, 0x12, 0x41, 0x0a, 0x0d, 0x6d, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, - 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6a, - 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x73, 0x2e, 0x4d, 0x42, 0x6f, 0x6f, 0x6c, - 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x6d, 0x42, 0x6f, - 0x6f, 0x6c, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x49, 0x6e, 0x74, - 0x36, 0x34, 0x53, 0x74, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4e, 0x0a, 0x10, 0x4d, 0x42, 0x6f, 0x6f, 0x6c, 0x53, - 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6a, 0x73, - 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd1, 0x01, 0x0a, 0x0c, 0x4d, 0x73, 0x67, 0x57, 0x69, - 0x74, 0x68, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, - 0x18, 0x0a, 0x06, 0x73, 0x61, 0x6c, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, - 0x00, 0x52, 0x06, 0x73, 0x61, 0x6c, 0x61, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x07, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x23, 0x0a, 0x0c, 0x68, 0x6f, 0x6d, 0x65, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x68, - 0x6f, 0x6d, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x45, 0x0a, 0x11, 0x6d, 0x73, - 0x67, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, - 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x48, 0x00, - 0x52, 0x0f, 0x6d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x64, 0x42, 0x07, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x22, 0x26, 0x0a, 0x04, 0x52, 0x65, - 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, 0x80, 0x80, - 0x80, 0x02, 0x22, 0x77, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x12, 0x1c, 0x0a, - 0x09, 0x69, 0x6d, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x2a, 0x08, 0x08, 0x64, 0x10, - 0x80, 0x80, 0x80, 0x80, 0x02, 0x32, 0x44, 0x0a, 0x0e, 0x72, 0x65, 0x61, 0x6c, 0x5f, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0c, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, - 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x18, 0x7b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6a, 0x73, - 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x52, 0x0d, 0x72, 0x65, - 0x61, 0x6c, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xba, 0x05, 0x0a, 0x0a, - 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x02, 0x61, 0x6e, - 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x02, 0x61, 0x6e, - 0x12, 0x2b, 0x0a, 0x03, 0x64, 0x75, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x64, 0x75, 0x72, 0x12, 0x27, 0x0a, - 0x02, 0x73, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x52, 0x02, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x02, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x02, - 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x28, - 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x12, 0x2e, 0x0a, 0x03, 0x64, 0x62, 0x6c, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x03, 0x64, 0x62, 0x6c, 0x12, 0x2d, 0x0a, 0x03, 0x66, 0x6c, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x03, 0x66, 0x6c, 0x74, 0x12, 0x2d, 0x0a, 0x03, 0x69, 0x36, 0x34, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x03, 0x69, 0x36, 0x34, 0x12, 0x2e, 0x0a, 0x03, 0x75, 0x36, 0x34, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x03, 0x75, 0x36, 0x34, 0x12, 0x2d, 0x0a, 0x03, 0x69, 0x33, 0x32, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x03, 0x69, 0x33, 0x32, 0x12, 0x2e, 0x0a, 0x03, 0x75, 0x33, 0x32, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x03, 0x75, 0x33, 0x32, 0x12, 0x2e, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x2e, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x03, 0x73, 0x74, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0x23, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x57, - 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, - 0x74, 0x72, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x03, 0x73, 0x74, 0x72, 0x22, 0xa2, 0x02, - 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x64, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x04, 0x73, 0x75, 0x62, - 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, - 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, - 0x52, 0x04, 0x73, 0x75, 0x62, 0x6d, 0x12, 0x4a, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, - 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x64, 0x69, 0x72, 0x65, - 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x2e, 0x4d, 0x61, 0x70, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, + 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x06, 0x72, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x26, + 0x0a, 0x06, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, + 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x06, + 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x29, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x69, 0x6d, 0x70, + 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, + 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x07, 0x72, 0x53, 0x69, 0x6d, 0x70, 0x6c, + 0x65, 0x12, 0x29, 0x0a, 0x07, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x18, 0x14, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, + 0x61, 0x74, 0x73, 0x52, 0x07, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x09, + 0x72, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, + 0x52, 0x08, 0x72, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x22, 0x25, 0x0a, 0x05, 0x43, 0x6f, + 0x6c, 0x6f, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, + 0x47, 0x52, 0x45, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4c, 0x55, 0x45, 0x10, + 0x02, 0x22, 0x94, 0x02, 0x0a, 0x04, 0x4d, 0x61, 0x70, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x6d, 0x5f, + 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1b, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x73, 0x2e, 0x4d, 0x49, + 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x49, + 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x12, 0x41, 0x0a, 0x0d, 0x6d, 0x5f, 0x62, 0x6f, 0x6f, + 0x6c, 0x5f, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, + 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x73, 0x2e, 0x4d, 0x42, 0x6f, + 0x6f, 0x6c, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x6d, + 0x42, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x49, + 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4e, 0x0a, 0x10, 0x4d, 0x42, 0x6f, 0x6f, + 0x6c, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, + 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd1, 0x01, 0x0a, 0x0c, 0x4d, 0x73, 0x67, + 0x57, 0x69, 0x74, 0x68, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x69, 0x74, + 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, + 0x65, 0x12, 0x18, 0x0a, 0x06, 0x73, 0x61, 0x6c, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x48, 0x00, 0x52, 0x06, 0x73, 0x61, 0x6c, 0x61, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x07, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x23, 0x0a, 0x0c, 0x68, 0x6f, 0x6d, 0x65, 0x5f, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x0b, 0x68, 0x6f, 0x6d, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x45, 0x0a, 0x11, + 0x6d, 0x73, 0x67, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, + 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, - 0x52, 0x0a, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x54, 0x0a, 0x0d, - 0x4d, 0x61, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, - 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x22, 0x2a, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, - 0x75, 0x69, 0x72, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x79, - 0x74, 0x73, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x79, 0x74, 0x73, 0x22, 0x44, - 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x64, 0x57, 0x4b, 0x54, 0x12, 0x2e, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x02, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x03, 0x73, 0x74, 0x72, 0x3a, 0x20, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0c, 0x2e, 0x6a, - 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x18, 0x7c, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x39, 0x0a, 0x04, 0x65, 0x78, 0x74, 0x6d, 0x12, 0x0c, - 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x18, 0x7d, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, - 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x52, 0x04, 0x65, 0x78, 0x74, - 0x6d, -} - -var xxx_File_test_objects_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_test_objects_proto_rawdesc) + 0x48, 0x00, 0x52, 0x0f, 0x6d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, + 0x72, 0x65, 0x64, 0x42, 0x07, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x22, 0x26, 0x0a, 0x04, + 0x52, 0x65, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, + 0x80, 0x80, 0x80, 0x02, 0x22, 0x77, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x12, + 0x1c, 0x0a, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x2a, 0x08, 0x08, + 0x64, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x32, 0x44, 0x0a, 0x0e, 0x72, 0x65, 0x61, 0x6c, 0x5f, + 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0c, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, + 0x70, 0x62, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x18, 0x7b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, + 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x52, 0x0d, + 0x72, 0x65, 0x61, 0x6c, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xba, 0x05, + 0x0a, 0x0a, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x02, + 0x61, 0x6e, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x02, + 0x61, 0x6e, 0x12, 0x2b, 0x0a, 0x03, 0x64, 0x75, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x64, 0x75, 0x72, 0x12, + 0x27, 0x0a, 0x02, 0x73, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, + 0x72, 0x75, 0x63, 0x74, 0x52, 0x02, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x02, 0x74, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x52, 0x02, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x02, 0x6c, 0x76, + 0x12, 0x28, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x12, 0x2e, 0x0a, 0x03, 0x64, 0x62, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x03, 0x64, 0x62, 0x6c, 0x12, 0x2d, 0x0a, 0x03, 0x66, 0x6c, + 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x52, 0x03, 0x66, 0x6c, 0x74, 0x12, 0x2d, 0x0a, 0x03, 0x69, 0x36, 0x34, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x03, 0x69, 0x36, 0x34, 0x12, 0x2e, 0x0a, 0x03, 0x75, 0x36, 0x34, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x03, 0x75, 0x36, 0x34, 0x12, 0x2d, 0x0a, 0x03, 0x69, 0x33, 0x32, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x52, 0x03, 0x69, 0x33, 0x32, 0x12, 0x2e, 0x0a, 0x03, 0x75, 0x33, 0x32, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x52, 0x03, 0x75, 0x33, 0x32, 0x12, 0x2e, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x2e, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x52, 0x03, 0x73, 0x74, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0x23, 0x0a, 0x0f, 0x4d, 0x73, + 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x10, 0x0a, + 0x03, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x03, 0x73, 0x74, 0x72, 0x22, + 0xa2, 0x02, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x64, 0x69, 0x72, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x04, 0x73, + 0x75, 0x62, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, + 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, + 0x65, 0x64, 0x52, 0x04, 0x73, 0x75, 0x62, 0x6d, 0x12, 0x4a, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6a, 0x73, + 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x64, 0x69, + 0x72, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x2e, 0x4d, 0x61, 0x70, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, + 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, + 0x65, 0x64, 0x52, 0x0a, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x54, + 0x0a, 0x0d, 0x4d, 0x61, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x22, 0x2a, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, + 0x62, 0x79, 0x74, 0x73, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x79, 0x74, 0x73, + 0x22, 0x44, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, + 0x72, 0x65, 0x64, 0x57, 0x4b, 0x54, 0x12, 0x2e, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, + 0x02, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x03, 0x73, 0x74, 0x72, 0x3a, 0x20, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0c, + 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x18, 0x7c, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x39, 0x0a, 0x04, 0x65, 0x78, 0x74, 0x6d, + 0x12, 0x0c, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x18, 0x7d, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x73, + 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x52, 0x04, 0x65, + 0x78, 0x74, 0x6d, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x5f, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x6a, 0x73, 0x6f, 0x6e, 0x70, + 0x62, +} + +var xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc) + +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) + +var File_jsonpb_test_proto_test_objects_proto protoreflect.FileDescriptor + +var xxx_File_jsonpb_test_proto_test_objects_proto_enumTypes = make([]protoreflect.EnumType, 1) +var xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes = make([]protoimpl.MessageType, 16) +var xxx_File_jsonpb_test_proto_test_objects_proto_goTypes = []interface{}{ + (Widget_Color)(0), // 0: jsonpb.Widget.Color + (*Simple)(nil), // 1: jsonpb.Simple + (*NonFinites)(nil), // 2: jsonpb.NonFinites + (*Repeats)(nil), // 3: jsonpb.Repeats + (*Widget)(nil), // 4: jsonpb.Widget + (*Maps)(nil), // 5: jsonpb.Maps + (*MsgWithOneof)(nil), // 6: jsonpb.MsgWithOneof + (*Real)(nil), // 7: jsonpb.Real + (*Complex)(nil), // 8: jsonpb.Complex + (*KnownTypes)(nil), // 9: jsonpb.KnownTypes + (*MsgWithRequired)(nil), // 10: jsonpb.MsgWithRequired + (*MsgWithIndirectRequired)(nil), // 11: jsonpb.MsgWithIndirectRequired + (*MsgWithRequiredBytes)(nil), // 12: jsonpb.MsgWithRequiredBytes + (*MsgWithRequiredWKT)(nil), // 13: jsonpb.MsgWithRequiredWKT + nil, // 14: jsonpb.Maps.MInt64StrEntry + nil, // 15: jsonpb.Maps.MBoolSimpleEntry + nil, // 16: jsonpb.MsgWithIndirectRequired.MapFieldEntry + (*known.Any)(nil), // 17: google.protobuf.Any + (*known.Duration)(nil), // 18: google.protobuf.Duration + (*known.Struct)(nil), // 19: google.protobuf.Struct + (*known.Timestamp)(nil), // 20: google.protobuf.Timestamp + (*known.ListValue)(nil), // 21: google.protobuf.ListValue + (*known.Value)(nil), // 22: google.protobuf.Value + (*known.DoubleValue)(nil), // 23: google.protobuf.DoubleValue + (*known.FloatValue)(nil), // 24: google.protobuf.FloatValue + (*known.Int64Value)(nil), // 25: google.protobuf.Int64Value + (*known.UInt64Value)(nil), // 26: google.protobuf.UInt64Value + (*known.Int32Value)(nil), // 27: google.protobuf.Int32Value + (*known.UInt32Value)(nil), // 28: google.protobuf.UInt32Value + (*known.BoolValue)(nil), // 29: google.protobuf.BoolValue + (*known.StringValue)(nil), // 30: google.protobuf.StringValue + (*known.BytesValue)(nil), // 31: google.protobuf.BytesValue +} +var xxx_File_jsonpb_test_proto_test_objects_proto_depIdxs = []int32{ + 7, // jsonpb.name:extendee -> jsonpb.Real + 7, // jsonpb.extm:extendee -> jsonpb.Real + 7, // jsonpb.Complex.real_extension:extendee -> jsonpb.Real + 0, // jsonpb.Widget.color:type_name -> jsonpb.Widget.Color + 0, // jsonpb.Widget.r_color:type_name -> jsonpb.Widget.Color + 1, // jsonpb.Widget.simple:type_name -> jsonpb.Simple + 1, // jsonpb.Widget.r_simple:type_name -> jsonpb.Simple + 3, // jsonpb.Widget.repeats:type_name -> jsonpb.Repeats + 3, // jsonpb.Widget.r_repeats:type_name -> jsonpb.Repeats + 14, // jsonpb.Maps.m_int64_str:type_name -> jsonpb.Maps.MInt64StrEntry + 15, // jsonpb.Maps.m_bool_simple:type_name -> jsonpb.Maps.MBoolSimpleEntry + 10, // jsonpb.MsgWithOneof.msg_with_required:type_name -> jsonpb.MsgWithRequired + 17, // jsonpb.KnownTypes.an:type_name -> google.protobuf.Any + 18, // jsonpb.KnownTypes.dur:type_name -> google.protobuf.Duration + 19, // jsonpb.KnownTypes.st:type_name -> google.protobuf.Struct + 20, // jsonpb.KnownTypes.ts:type_name -> google.protobuf.Timestamp + 21, // jsonpb.KnownTypes.lv:type_name -> google.protobuf.ListValue + 22, // jsonpb.KnownTypes.val:type_name -> google.protobuf.Value + 23, // jsonpb.KnownTypes.dbl:type_name -> google.protobuf.DoubleValue + 24, // jsonpb.KnownTypes.flt:type_name -> google.protobuf.FloatValue + 25, // jsonpb.KnownTypes.i64:type_name -> google.protobuf.Int64Value + 26, // jsonpb.KnownTypes.u64:type_name -> google.protobuf.UInt64Value + 27, // jsonpb.KnownTypes.i32:type_name -> google.protobuf.Int32Value + 28, // jsonpb.KnownTypes.u32:type_name -> google.protobuf.UInt32Value + 29, // jsonpb.KnownTypes.bool:type_name -> google.protobuf.BoolValue + 30, // jsonpb.KnownTypes.str:type_name -> google.protobuf.StringValue + 31, // jsonpb.KnownTypes.bytes:type_name -> google.protobuf.BytesValue + 10, // jsonpb.MsgWithIndirectRequired.subm:type_name -> jsonpb.MsgWithRequired + 16, // jsonpb.MsgWithIndirectRequired.map_field:type_name -> jsonpb.MsgWithIndirectRequired.MapFieldEntry + 10, // jsonpb.MsgWithIndirectRequired.slice_field:type_name -> jsonpb.MsgWithRequired + 30, // jsonpb.MsgWithRequiredWKT.str:type_name -> google.protobuf.StringValue + 1, // jsonpb.Maps.MBoolSimpleEntry.value:type_name -> jsonpb.Simple + 10, // jsonpb.MsgWithIndirectRequired.MapFieldEntry.value:type_name -> jsonpb.MsgWithRequired + 10, // jsonpb.extm:type_name -> jsonpb.MsgWithRequired + 8, // jsonpb.Complex.real_extension:type_name -> jsonpb.Complex +} + +func init() { xxx_File_jsonpb_test_proto_test_objects_proto_init() } +func xxx_File_jsonpb_test_proto_test_objects_proto_init() { + if File_jsonpb_test_proto_test_objects_proto != nil { + return + } + messageTypes := make([]protoreflect.MessageType, 16) + extensionTypes := make([]protoreflect.ExtensionType, 3) + File_jsonpb_test_proto_test_objects_proto = protoimpl.FileBuilder{ + RawDescriptor: xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc, + GoTypes: xxx_File_jsonpb_test_proto_test_objects_proto_goTypes, + DependencyIndexes: xxx_File_jsonpb_test_proto_test_objects_proto_depIdxs, + EnumOutputTypes: xxx_File_jsonpb_test_proto_test_objects_proto_enumTypes, + MessageOutputTypes: messageTypes, + ExtensionOutputTypes: extensionTypes, + }.Init() + messageGoTypes := xxx_File_jsonpb_test_proto_test_objects_proto_goTypes[1:][:16] + for i, mt := range messageTypes { + xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[i].GoType = reflect.TypeOf(messageGoTypes[i]) + xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[i].PBType = mt + } + E_Name.Type = extensionTypes[0] + E_Extm.Type = extensionTypes[1] + E_Complex_RealExtension.Type = extensionTypes[2] + xxx_File_jsonpb_test_proto_test_objects_proto_goTypes = nil + xxx_File_jsonpb_test_proto_test_objects_proto_depIdxs = nil +} diff --git a/jsonpb/jsonpb_test_proto/test_objects.proto b/jsonpb/jsonpb_test_proto/test_objects.proto index e01386e7d4..943303ed7c 100644 --- a/jsonpb/jsonpb_test_proto/test_objects.proto +++ b/jsonpb/jsonpb_test_proto/test_objects.proto @@ -31,6 +31,8 @@ syntax = "proto2"; +option go_package = "github.com/golang/protobuf/jsonpb/jsonpb_test_proto;jsonpb"; + import "google/protobuf/any.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/struct.proto"; diff --git a/proto/proto3_proto/proto3.pb.go b/proto/proto3_proto/proto3.pb.go index ab5f52c04a..11fde28170 100644 --- a/proto/proto3_proto/proto3.pb.go +++ b/proto/proto3_proto/proto3.pb.go @@ -7,7 +7,10 @@ import ( proto "github.com/golang/protobuf/proto" test_proto "github.com/golang/protobuf/proto/test_proto" protoapi "github.com/golang/protobuf/protoapi" - any "github.com/golang/protobuf/ptypes/any" + protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" + known "github.com/golang/protobuf/v2/types/known" + reflect "reflect" ) // This is a compile-time assertion to ensure that this generated file @@ -25,6 +28,13 @@ const ( Message_BILL_BAILEY Message_Humour = 3 ) +func (e Message_Humour) Type() protoreflect.EnumType { + return xxx_File_proto3_proto_proto3_proto_enumTypes[0] +} +func (e Message_Humour) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var Message_Humour_name = map[int32]string{ 0: "UNKNOWN", 1: "PUNS", @@ -62,8 +72,8 @@ type Message struct { Terrain map[string]*Nested `protobuf:"bytes,10,rep,name=terrain,proto3" json:"terrain,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Proto2Field *test_proto.SubDefaults `protobuf:"bytes,11,opt,name=proto2_field,json=proto2Field,proto3" json:"proto2_field,omitempty"` Proto2Value map[string]*test_proto.SubDefaults `protobuf:"bytes,13,rep,name=proto2_value,json=proto2Value,proto3" json:"proto2_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Anything *any.Any `protobuf:"bytes,14,opt,name=anything,proto3" json:"anything,omitempty"` - ManyThings []*any.Any `protobuf:"bytes,15,rep,name=many_things,json=manyThings,proto3" json:"many_things,omitempty"` + Anything *known.Any `protobuf:"bytes,14,opt,name=anything,proto3" json:"anything,omitempty"` + ManyThings []*known.Any `protobuf:"bytes,15,rep,name=many_things,json=manyThings,proto3" json:"many_things,omitempty"` Submessage *Message `protobuf:"bytes,17,opt,name=submessage,proto3" json:"submessage,omitempty"` Children []*Message `protobuf:"bytes,18,rep,name=children,proto3" json:"children,omitempty"` StringMap map[string]string `protobuf:"bytes,20,rep,name=string_map,json=stringMap,proto3" json:"string_map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` @@ -72,6 +82,9 @@ type Message struct { XXX_sizecache int32 `json:"-"` } +func (m *Message) ProtoReflect() protoreflect.Message { + return xxx_File_proto3_proto_proto3_proto_messageTypes[0].MessageOf(m) +} func (m *Message) Reset() { *m = Message{} } func (m *Message) String() string { return proto.CompactTextString(m) } func (*Message) ProtoMessage() {} @@ -195,14 +208,14 @@ func (m *Message) GetProto2Value() map[string]*test_proto.SubDefaults { return nil } -func (m *Message) GetAnything() *any.Any { +func (m *Message) GetAnything() *known.Any { if m != nil { return m.Anything } return nil } -func (m *Message) GetManyThings() []*any.Any { +func (m *Message) GetManyThings() []*known.Any { if m != nil { return m.ManyThings } @@ -238,6 +251,9 @@ type Nested struct { XXX_sizecache int32 `json:"-"` } +func (m *Nested) ProtoReflect() protoreflect.Message { + return xxx_File_proto3_proto_proto3_proto_messageTypes[1].MessageOf(m) +} func (m *Nested) Reset() { *m = Nested{} } func (m *Nested) String() string { return proto.CompactTextString(m) } func (*Nested) ProtoMessage() {} @@ -284,6 +300,9 @@ type MessageWithMap struct { XXX_sizecache int32 `json:"-"` } +func (m *MessageWithMap) ProtoReflect() protoreflect.Message { + return xxx_File_proto3_proto_proto3_proto_messageTypes[2].MessageOf(m) +} func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } func (*MessageWithMap) ProtoMessage() {} @@ -323,6 +342,9 @@ type IntMap struct { XXX_sizecache int32 `json:"-"` } +func (m *IntMap) ProtoReflect() protoreflect.Message { + return xxx_File_proto3_proto_proto3_proto_messageTypes[3].MessageOf(m) +} func (m *IntMap) Reset() { *m = IntMap{} } func (m *IntMap) String() string { return proto.CompactTextString(m) } func (*IntMap) ProtoMessage() {} @@ -362,6 +384,9 @@ type IntMaps struct { XXX_sizecache int32 `json:"-"` } +func (m *IntMaps) ProtoReflect() protoreflect.Message { + return xxx_File_proto3_proto_proto3_proto_messageTypes[4].MessageOf(m) +} func (m *IntMaps) Reset() { *m = IntMaps{} } func (m *IntMaps) String() string { return proto.CompactTextString(m) } func (*IntMaps) ProtoMessage() {} @@ -407,6 +432,9 @@ type TestUTF8 struct { XXX_sizecache int32 `json:"-"` } +func (m *TestUTF8) ProtoReflect() protoreflect.Message { + return xxx_File_proto3_proto_proto3_proto_messageTypes[5].MessageOf(m) +} func (m *TestUTF8) Reset() { *m = TestUTF8{} } func (m *TestUTF8) String() string { return proto.CompactTextString(m) } func (*TestUTF8) ProtoMessage() {} @@ -510,7 +538,7 @@ func init() { } var xxx_File_proto3_proto_proto3_proto_rawdesc = []byte{ - // 1987 bytes of the wire-encoded FileDescriptorProto + // 2036 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x19, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, @@ -634,8 +662,78 @@ var xxx_File_proto3_proto_proto3_proto_rawdesc = []byte{ 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x42, 0x2f, 0x5a, 0x2d, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_proto3_proto_proto3_proto_rawdesc) + +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) + +var File_proto3_proto_proto3_proto protoreflect.FileDescriptor + +var xxx_File_proto3_proto_proto3_proto_enumTypes = make([]protoreflect.EnumType, 1) +var xxx_File_proto3_proto_proto3_proto_messageTypes = make([]protoimpl.MessageType, 13) +var xxx_File_proto3_proto_proto3_proto_goTypes = []interface{}{ + (Message_Humour)(0), // 0: proto3_proto.Message.Humour + (*Message)(nil), // 1: proto3_proto.Message + (*Nested)(nil), // 2: proto3_proto.Nested + (*MessageWithMap)(nil), // 3: proto3_proto.MessageWithMap + (*IntMap)(nil), // 4: proto3_proto.IntMap + (*IntMaps)(nil), // 5: proto3_proto.IntMaps + (*TestUTF8)(nil), // 6: proto3_proto.TestUTF8 + nil, // 7: proto3_proto.Message.TerrainEntry + nil, // 8: proto3_proto.Message.Proto2ValueEntry + nil, // 9: proto3_proto.Message.StringMapEntry + nil, // 10: proto3_proto.MessageWithMap.ByteMappingEntry + nil, // 11: proto3_proto.IntMap.RttEntry + nil, // 12: proto3_proto.TestUTF8.MapKeyEntry + nil, // 13: proto3_proto.TestUTF8.MapValueEntry + (*test_proto.SubDefaults)(nil), // 14: test_proto.SubDefaults + (*known.Any)(nil), // 15: google.protobuf.Any +} +var xxx_File_proto3_proto_proto3_proto_depIdxs = []int32{ + 0, // proto3_proto.Message.hilarity:type_name -> proto3_proto.Message.Humour + 2, // proto3_proto.Message.nested:type_name -> proto3_proto.Nested + 0, // proto3_proto.Message.r_funny:type_name -> proto3_proto.Message.Humour + 7, // proto3_proto.Message.terrain:type_name -> proto3_proto.Message.TerrainEntry + 14, // proto3_proto.Message.proto2_field:type_name -> test_proto.SubDefaults + 8, // proto3_proto.Message.proto2_value:type_name -> proto3_proto.Message.Proto2ValueEntry + 15, // proto3_proto.Message.anything:type_name -> google.protobuf.Any + 15, // proto3_proto.Message.many_things:type_name -> google.protobuf.Any + 1, // proto3_proto.Message.submessage:type_name -> proto3_proto.Message + 1, // proto3_proto.Message.children:type_name -> proto3_proto.Message + 9, // proto3_proto.Message.string_map:type_name -> proto3_proto.Message.StringMapEntry + 10, // proto3_proto.MessageWithMap.byte_mapping:type_name -> proto3_proto.MessageWithMap.ByteMappingEntry + 11, // proto3_proto.IntMap.rtt:type_name -> proto3_proto.IntMap.RttEntry + 4, // proto3_proto.IntMaps.maps:type_name -> proto3_proto.IntMap + 12, // proto3_proto.TestUTF8.map_key:type_name -> proto3_proto.TestUTF8.MapKeyEntry + 13, // proto3_proto.TestUTF8.map_value:type_name -> proto3_proto.TestUTF8.MapValueEntry + 2, // proto3_proto.Message.TerrainEntry.value:type_name -> proto3_proto.Nested + 14, // proto3_proto.Message.Proto2ValueEntry.value:type_name -> test_proto.SubDefaults +} + +func init() { xxx_File_proto3_proto_proto3_proto_init() } +func xxx_File_proto3_proto_proto3_proto_init() { + if File_proto3_proto_proto3_proto != nil { + return + } + messageTypes := make([]protoreflect.MessageType, 13) + File_proto3_proto_proto3_proto = protoimpl.FileBuilder{ + RawDescriptor: xxx_File_proto3_proto_proto3_proto_rawdesc, + GoTypes: xxx_File_proto3_proto_proto3_proto_goTypes, + DependencyIndexes: xxx_File_proto3_proto_proto3_proto_depIdxs, + EnumOutputTypes: xxx_File_proto3_proto_proto3_proto_enumTypes, + MessageOutputTypes: messageTypes, + }.Init() + messageGoTypes := xxx_File_proto3_proto_proto3_proto_goTypes[1:][:13] + for i, mt := range messageTypes { + xxx_File_proto3_proto_proto3_proto_messageTypes[i].GoType = reflect.TypeOf(messageGoTypes[i]) + xxx_File_proto3_proto_proto3_proto_messageTypes[i].PBType = mt + } + xxx_File_proto3_proto_proto3_proto_goTypes = nil + xxx_File_proto3_proto_proto3_proto_depIdxs = nil +} diff --git a/proto/proto3_proto/proto3.proto b/proto/proto3_proto/proto3.proto index 6adea22fdc..a6341481ed 100644 --- a/proto/proto3_proto/proto3.proto +++ b/proto/proto3_proto/proto3.proto @@ -31,6 +31,8 @@ syntax = "proto3"; +option go_package = "github.com/golang/protobuf/proto/proto3_proto"; + import "google/protobuf/any.proto"; import "test_proto/test.proto"; diff --git a/proto/test_proto/test.pb.go b/proto/test_proto/test.pb.go index 4b450dbdde..3bf88ca4f4 100644 --- a/proto/test_proto/test.pb.go +++ b/proto/test_proto/test.pb.go @@ -6,7 +6,10 @@ package test_proto import ( proto "github.com/golang/protobuf/proto" protoapi "github.com/golang/protobuf/protoapi" + protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" math "math" + reflect "reflect" ) // This is a compile-time assertion to ensure that this generated file @@ -21,6 +24,13 @@ const ( FOO_FOO1 FOO = 1 ) +func (e FOO) Type() protoreflect.EnumType { + return xxx_File_test_proto_test_proto_enumTypes[0] +} +func (e FOO) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var FOO_name = map[int32]string{ 1: "FOO1", } @@ -75,6 +85,13 @@ const ( GoTest_FUNCTION GoTest_KIND = 12 ) +func (e GoTest_KIND) Type() protoreflect.EnumType { + return xxx_File_test_proto_test_proto_enumTypes[1] +} +func (e GoTest_KIND) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var GoTest_KIND_name = map[int32]string{ 0: "VOID", 1: "BOOL", @@ -138,6 +155,13 @@ const ( MyMessage_BLUE MyMessage_Color = 2 ) +func (e MyMessage_Color) Type() protoreflect.EnumType { + return xxx_File_test_proto_test_proto_enumTypes[2] +} +func (e MyMessage_Color) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var MyMessage_Color_name = map[int32]string{ 0: "RED", 1: "GREEN", @@ -181,6 +205,13 @@ const ( DefaultsMessage_TWO DefaultsMessage_DefaultsEnum = 2 ) +func (e DefaultsMessage_DefaultsEnum) Type() protoreflect.EnumType { + return xxx_File_test_proto_test_proto_enumTypes[3] +} +func (e DefaultsMessage_DefaultsEnum) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var DefaultsMessage_DefaultsEnum_name = map[int32]string{ 0: "ZERO", 1: "ONE", @@ -224,6 +255,13 @@ const ( Defaults_BLUE Defaults_Color = 2 ) +func (e Defaults_Color) Type() protoreflect.EnumType { + return xxx_File_test_proto_test_proto_enumTypes[4] +} +func (e Defaults_Color) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var Defaults_Color_name = map[int32]string{ 0: "RED", 1: "GREEN", @@ -265,6 +303,13 @@ const ( RepeatedEnum_RED RepeatedEnum_Color = 1 ) +func (e RepeatedEnum_Color) Type() protoreflect.EnumType { + return xxx_File_test_proto_test_proto_enumTypes[5] +} +func (e RepeatedEnum_Color) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(e) +} + var RepeatedEnum_Color_name = map[int32]string{ 1: "RED", } @@ -303,6 +348,9 @@ type GoEnum struct { XXX_sizecache int32 `json:"-"` } +func (m *GoEnum) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[0].MessageOf(m) +} func (m *GoEnum) Reset() { *m = GoEnum{} } func (m *GoEnum) String() string { return proto.CompactTextString(m) } func (*GoEnum) ProtoMessage() {} @@ -343,6 +391,9 @@ type GoTestField struct { XXX_sizecache int32 `json:"-"` } +func (m *GoTestField) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[1].MessageOf(m) +} func (m *GoTestField) Reset() { *m = GoTestField{} } func (m *GoTestField) String() string { return proto.CompactTextString(m) } func (*GoTestField) ProtoMessage() {} @@ -477,6 +528,9 @@ type GoTest struct { XXX_sizecache int32 `json:"-"` } +func (m *GoTest) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[2].MessageOf(m) +} func (m *GoTest) Reset() { *m = GoTest{} } func (m *GoTest) String() string { return proto.CompactTextString(m) } func (*GoTest) ProtoMessage() {} @@ -1102,6 +1156,9 @@ type GoTestRequiredGroupField struct { XXX_sizecache int32 `json:"-"` } +func (m *GoTestRequiredGroupField) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[3].MessageOf(m) +} func (m *GoTestRequiredGroupField) Reset() { *m = GoTestRequiredGroupField{} } func (m *GoTestRequiredGroupField) String() string { return proto.CompactTextString(m) } func (*GoTestRequiredGroupField) ProtoMessage() {} @@ -1148,6 +1205,9 @@ type GoSkipTest struct { XXX_sizecache int32 `json:"-"` } +func (m *GoSkipTest) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[4].MessageOf(m) +} func (m *GoSkipTest) Reset() { *m = GoSkipTest{} } func (m *GoSkipTest) String() string { return proto.CompactTextString(m) } func (*GoSkipTest) ProtoMessage() {} @@ -1217,6 +1277,9 @@ type NonPackedTest struct { XXX_sizecache int32 `json:"-"` } +func (m *NonPackedTest) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[5].MessageOf(m) +} func (m *NonPackedTest) Reset() { *m = NonPackedTest{} } func (m *NonPackedTest) String() string { return proto.CompactTextString(m) } func (*NonPackedTest) ProtoMessage() {} @@ -1256,6 +1319,9 @@ type PackedTest struct { XXX_sizecache int32 `json:"-"` } +func (m *PackedTest) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[6].MessageOf(m) +} func (m *PackedTest) Reset() { *m = PackedTest{} } func (m *PackedTest) String() string { return proto.CompactTextString(m) } func (*PackedTest) ProtoMessage() {} @@ -1296,6 +1362,9 @@ type MaxTag struct { XXX_sizecache int32 `json:"-"` } +func (m *MaxTag) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[7].MessageOf(m) +} func (m *MaxTag) Reset() { *m = MaxTag{} } func (m *MaxTag) String() string { return proto.CompactTextString(m) } func (*MaxTag) ProtoMessage() {} @@ -1336,6 +1405,9 @@ type OldMessage struct { XXX_sizecache int32 `json:"-"` } +func (m *OldMessage) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[8].MessageOf(m) +} func (m *OldMessage) Reset() { *m = OldMessage{} } func (m *OldMessage) String() string { return proto.CompactTextString(m) } func (*OldMessage) ProtoMessage() {} @@ -1386,6 +1458,9 @@ type NewMessage struct { XXX_sizecache int32 `json:"-"` } +func (m *NewMessage) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[9].MessageOf(m) +} func (m *NewMessage) Reset() { *m = NewMessage{} } func (m *NewMessage) String() string { return proto.CompactTextString(m) } func (*NewMessage) ProtoMessage() {} @@ -1434,6 +1509,9 @@ type InnerMessage struct { XXX_sizecache int32 `json:"-"` } +func (m *InnerMessage) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[10].MessageOf(m) +} func (m *InnerMessage) Reset() { *m = InnerMessage{} } func (m *InnerMessage) String() string { return proto.CompactTextString(m) } func (*InnerMessage) ProtoMessage() {} @@ -1493,6 +1571,9 @@ type OtherMessage struct { XXX_sizecache int32 `json:"-"` } +func (m *OtherMessage) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[11].MessageOf(m) +} func (m *OtherMessage) Reset() { *m = OtherMessage{} } func (m *OtherMessage) String() string { return proto.CompactTextString(m) } func (*OtherMessage) ProtoMessage() {} @@ -1561,6 +1642,9 @@ type RequiredInnerMessage struct { XXX_sizecache int32 `json:"-"` } +func (m *RequiredInnerMessage) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[12].MessageOf(m) +} func (m *RequiredInnerMessage) Reset() { *m = RequiredInnerMessage{} } func (m *RequiredInnerMessage) String() string { return proto.CompactTextString(m) } func (*RequiredInnerMessage) ProtoMessage() {} @@ -1613,6 +1697,9 @@ type MyMessage struct { XXX_sizecache int32 `json:"-"` } +func (m *MyMessage) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[13].MessageOf(m) +} func (m *MyMessage) Reset() { *m = MyMessage{} } func (m *MyMessage) String() string { return proto.CompactTextString(m) } func (*MyMessage) ProtoMessage() {} @@ -1738,6 +1825,9 @@ type Ext struct { XXX_sizecache int32 `json:"-"` } +func (m *Ext) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[14].MessageOf(m) +} func (m *Ext) Reset() { *m = Ext{} } func (m *Ext) String() string { return proto.CompactTextString(m) } func (*Ext) ProtoMessage() {} @@ -1786,6 +1876,9 @@ type ComplexExtension struct { XXX_sizecache int32 `json:"-"` } +func (m *ComplexExtension) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[15].MessageOf(m) +} func (m *ComplexExtension) Reset() { *m = ComplexExtension{} } func (m *ComplexExtension) String() string { return proto.CompactTextString(m) } func (*ComplexExtension) ProtoMessage() {} @@ -1839,6 +1932,9 @@ type DefaultsMessage struct { XXX_sizecache int32 `json:"-"` } +func (m *DefaultsMessage) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[16].MessageOf(m) +} func (m *DefaultsMessage) Reset() { *m = DefaultsMessage{} } func (m *DefaultsMessage) String() string { return proto.CompactTextString(m) } func (*DefaultsMessage) ProtoMessage() {} @@ -1879,6 +1975,9 @@ type MyMessageSet struct { XXX_sizecache int32 `json:"-"` } +func (m *MyMessageSet) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[17].MessageOf(m) +} func (m *MyMessageSet) Reset() { *m = MyMessageSet{} } func (m *MyMessageSet) String() string { return proto.CompactTextString(m) } func (*MyMessageSet) ProtoMessage() {} @@ -1918,6 +2017,9 @@ type Empty struct { XXX_sizecache int32 `json:"-"` } +func (m *Empty) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[18].MessageOf(m) +} func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} @@ -1950,6 +2052,9 @@ type MessageList struct { XXX_sizecache int32 `json:"-"` } +func (m *MessageList) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[19].MessageOf(m) +} func (m *MessageList) Reset() { *m = MessageList{} } func (m *MessageList) String() string { return proto.CompactTextString(m) } func (*MessageList) ProtoMessage() {} @@ -1990,6 +2095,9 @@ type Strings struct { XXX_sizecache int32 `json:"-"` } +func (m *Strings) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[20].MessageOf(m) +} func (m *Strings) Reset() { *m = Strings{} } func (m *Strings) String() string { return proto.CompactTextString(m) } func (*Strings) ProtoMessage() {} @@ -2059,6 +2167,9 @@ type Defaults struct { XXX_sizecache int32 `json:"-"` } +func (m *Defaults) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[21].MessageOf(m) +} func (m *Defaults) Reset() { *m = Defaults{} } func (m *Defaults) String() string { return proto.CompactTextString(m) } func (*Defaults) ProtoMessage() {} @@ -2247,6 +2358,9 @@ type SubDefaults struct { XXX_sizecache int32 `json:"-"` } +func (m *SubDefaults) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[22].MessageOf(m) +} func (m *SubDefaults) Reset() { *m = SubDefaults{} } func (m *SubDefaults) String() string { return proto.CompactTextString(m) } func (*SubDefaults) ProtoMessage() {} @@ -2288,6 +2402,9 @@ type RepeatedEnum struct { XXX_sizecache int32 `json:"-"` } +func (m *RepeatedEnum) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[23].MessageOf(m) +} func (m *RepeatedEnum) Reset() { *m = RepeatedEnum{} } func (m *RepeatedEnum) String() string { return proto.CompactTextString(m) } func (*RepeatedEnum) ProtoMessage() {} @@ -2333,6 +2450,9 @@ type MoreRepeated struct { XXX_sizecache int32 `json:"-"` } +func (m *MoreRepeated) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[24].MessageOf(m) +} func (m *MoreRepeated) Reset() { *m = MoreRepeated{} } func (m *MoreRepeated) String() string { return proto.CompactTextString(m) } func (*MoreRepeated) ProtoMessage() {} @@ -2414,6 +2534,9 @@ type GroupOld struct { XXX_sizecache int32 `json:"-"` } +func (m *GroupOld) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[25].MessageOf(m) +} func (m *GroupOld) Reset() { *m = GroupOld{} } func (m *GroupOld) String() string { return proto.CompactTextString(m) } func (*GroupOld) ProtoMessage() {} @@ -2453,6 +2576,9 @@ type GroupNew struct { XXX_sizecache int32 `json:"-"` } +func (m *GroupNew) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[26].MessageOf(m) +} func (m *GroupNew) Reset() { *m = GroupNew{} } func (m *GroupNew) String() string { return proto.CompactTextString(m) } func (*GroupNew) ProtoMessage() {} @@ -2493,6 +2619,9 @@ type FloatingPoint struct { XXX_sizecache int32 `json:"-"` } +func (m *FloatingPoint) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[27].MessageOf(m) +} func (m *FloatingPoint) Reset() { *m = FloatingPoint{} } func (m *FloatingPoint) String() string { return proto.CompactTextString(m) } func (*FloatingPoint) ProtoMessage() {} @@ -2542,6 +2671,9 @@ type MessageWithMap struct { XXX_sizecache int32 `json:"-"` } +func (m *MessageWithMap) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[28].MessageOf(m) +} func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } func (*MessageWithMap) ProtoMessage() {} @@ -2623,6 +2755,9 @@ type Oneof struct { XXX_sizecache int32 `json:"-"` } +func (m *Oneof) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[29].MessageOf(m) +} func (m *Oneof) Reset() { *m = Oneof{} } func (m *Oneof) String() string { return proto.CompactTextString(m) } func (*Oneof) ProtoMessage() {} @@ -2945,6 +3080,9 @@ type Communique struct { XXX_sizecache int32 `json:"-"` } +func (m *Communique) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[30].MessageOf(m) +} func (m *Communique) Reset() { *m = Communique{} } func (m *Communique) String() string { return proto.CompactTextString(m) } func (*Communique) ProtoMessage() {} @@ -3091,6 +3229,9 @@ type TestUTF8 struct { XXX_sizecache int32 `json:"-"` } +func (m *TestUTF8) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[31].MessageOf(m) +} func (m *TestUTF8) Reset() { *m = TestUTF8{} } func (m *TestUTF8) String() string { return proto.CompactTextString(m) } func (*TestUTF8) ProtoMessage() {} @@ -3183,6 +3324,9 @@ type GoTest_RequiredGroup struct { XXX_sizecache int32 `json:"-"` } +func (m *GoTest_RequiredGroup) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[32].MessageOf(m) +} func (m *GoTest_RequiredGroup) Reset() { *m = GoTest_RequiredGroup{} } func (m *GoTest_RequiredGroup) String() string { return proto.CompactTextString(m) } func (*GoTest_RequiredGroup) ProtoMessage() {} @@ -3222,6 +3366,9 @@ type GoTest_RepeatedGroup struct { XXX_sizecache int32 `json:"-"` } +func (m *GoTest_RepeatedGroup) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[33].MessageOf(m) +} func (m *GoTest_RepeatedGroup) Reset() { *m = GoTest_RepeatedGroup{} } func (m *GoTest_RepeatedGroup) String() string { return proto.CompactTextString(m) } func (*GoTest_RepeatedGroup) ProtoMessage() {} @@ -3261,6 +3408,9 @@ type GoTest_OptionalGroup struct { XXX_sizecache int32 `json:"-"` } +func (m *GoTest_OptionalGroup) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[34].MessageOf(m) +} func (m *GoTest_OptionalGroup) Reset() { *m = GoTest_OptionalGroup{} } func (m *GoTest_OptionalGroup) String() string { return proto.CompactTextString(m) } func (*GoTest_OptionalGroup) ProtoMessage() {} @@ -3300,6 +3450,9 @@ type GoTestRequiredGroupField_Group struct { XXX_sizecache int32 `json:"-"` } +func (m *GoTestRequiredGroupField_Group) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[35].MessageOf(m) +} func (m *GoTestRequiredGroupField_Group) Reset() { *m = GoTestRequiredGroupField_Group{} } func (m *GoTestRequiredGroupField_Group) String() string { return proto.CompactTextString(m) } func (*GoTestRequiredGroupField_Group) ProtoMessage() {} @@ -3340,6 +3493,9 @@ type GoSkipTest_SkipGroup struct { XXX_sizecache int32 `json:"-"` } +func (m *GoSkipTest_SkipGroup) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[36].MessageOf(m) +} func (m *GoSkipTest_SkipGroup) Reset() { *m = GoSkipTest_SkipGroup{} } func (m *GoSkipTest_SkipGroup) String() string { return proto.CompactTextString(m) } func (*GoSkipTest_SkipGroup) ProtoMessage() {} @@ -3386,6 +3542,9 @@ type OldMessage_Nested struct { XXX_sizecache int32 `json:"-"` } +func (m *OldMessage_Nested) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[37].MessageOf(m) +} func (m *OldMessage_Nested) Reset() { *m = OldMessage_Nested{} } func (m *OldMessage_Nested) String() string { return proto.CompactTextString(m) } func (*OldMessage_Nested) ProtoMessage() {} @@ -3426,6 +3585,9 @@ type NewMessage_Nested struct { XXX_sizecache int32 `json:"-"` } +func (m *NewMessage_Nested) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[38].MessageOf(m) +} func (m *NewMessage_Nested) Reset() { *m = NewMessage_Nested{} } func (m *NewMessage_Nested) String() string { return proto.CompactTextString(m) } func (*NewMessage_Nested) ProtoMessage() {} @@ -3472,6 +3634,9 @@ type MyMessage_SomeGroup struct { XXX_sizecache int32 `json:"-"` } +func (m *MyMessage_SomeGroup) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[39].MessageOf(m) +} func (m *MyMessage_SomeGroup) Reset() { *m = MyMessage_SomeGroup{} } func (m *MyMessage_SomeGroup) String() string { return proto.CompactTextString(m) } func (*MyMessage_SomeGroup) ProtoMessage() {} @@ -3512,6 +3677,9 @@ type MessageList_Message struct { XXX_sizecache int32 `json:"-"` } +func (m *MessageList_Message) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[41].MessageOf(m) +} func (m *MessageList_Message) Reset() { *m = MessageList_Message{} } func (m *MessageList_Message) String() string { return proto.CompactTextString(m) } func (*MessageList_Message) ProtoMessage() {} @@ -3558,6 +3726,9 @@ type GroupOld_G struct { XXX_sizecache int32 `json:"-"` } +func (m *GroupOld_G) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[42].MessageOf(m) +} func (m *GroupOld_G) Reset() { *m = GroupOld_G{} } func (m *GroupOld_G) String() string { return proto.CompactTextString(m) } func (*GroupOld_G) ProtoMessage() {} @@ -3598,6 +3769,9 @@ type GroupNew_G struct { XXX_sizecache int32 `json:"-"` } +func (m *GroupNew_G) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[43].MessageOf(m) +} func (m *GroupNew_G) Reset() { *m = GroupNew_G{} } func (m *GroupNew_G) String() string { return proto.CompactTextString(m) } func (*GroupNew_G) ProtoMessage() {} @@ -3644,6 +3818,9 @@ type Oneof_F_Group struct { XXX_sizecache int32 `json:"-"` } +func (m *Oneof_F_Group) ProtoReflect() protoreflect.Message { + return xxx_File_test_proto_test_proto_messageTypes[48].MessageOf(m) +} func (m *Oneof_F_Group) Reset() { *m = Oneof_F_Group{} } func (m *Oneof_F_Group) String() string { return proto.CompactTextString(m) } func (*Oneof_F_Group) ProtoMessage() {} @@ -5629,3 +5806,365 @@ var xxx_File_test_proto_test_proto_rawdesc = []byte{ } var xxx_File_test_proto_test_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_test_proto_test_proto_rawdesc) + +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) + +var File_test_proto_test_proto protoreflect.FileDescriptor + +var xxx_File_test_proto_test_proto_enumTypes = make([]protoreflect.EnumType, 6) +var xxx_File_test_proto_test_proto_messageTypes = make([]protoimpl.MessageType, 51) +var xxx_File_test_proto_test_proto_goTypes = []interface{}{ + (FOO)(0), // 0: test_proto.FOO + (GoTest_KIND)(0), // 1: test_proto.GoTest.KIND + (MyMessage_Color)(0), // 2: test_proto.MyMessage.Color + (DefaultsMessage_DefaultsEnum)(0), // 3: test_proto.DefaultsMessage.DefaultsEnum + (Defaults_Color)(0), // 4: test_proto.Defaults.Color + (RepeatedEnum_Color)(0), // 5: test_proto.RepeatedEnum.Color + (*GoEnum)(nil), // 6: test_proto.GoEnum + (*GoTestField)(nil), // 7: test_proto.GoTestField + (*GoTest)(nil), // 8: test_proto.GoTest + (*GoTestRequiredGroupField)(nil), // 9: test_proto.GoTestRequiredGroupField + (*GoSkipTest)(nil), // 10: test_proto.GoSkipTest + (*NonPackedTest)(nil), // 11: test_proto.NonPackedTest + (*PackedTest)(nil), // 12: test_proto.PackedTest + (*MaxTag)(nil), // 13: test_proto.MaxTag + (*OldMessage)(nil), // 14: test_proto.OldMessage + (*NewMessage)(nil), // 15: test_proto.NewMessage + (*InnerMessage)(nil), // 16: test_proto.InnerMessage + (*OtherMessage)(nil), // 17: test_proto.OtherMessage + (*RequiredInnerMessage)(nil), // 18: test_proto.RequiredInnerMessage + (*MyMessage)(nil), // 19: test_proto.MyMessage + (*Ext)(nil), // 20: test_proto.Ext + (*ComplexExtension)(nil), // 21: test_proto.ComplexExtension + (*DefaultsMessage)(nil), // 22: test_proto.DefaultsMessage + (*MyMessageSet)(nil), // 23: test_proto.MyMessageSet + (*Empty)(nil), // 24: test_proto.Empty + (*MessageList)(nil), // 25: test_proto.MessageList + (*Strings)(nil), // 26: test_proto.Strings + (*Defaults)(nil), // 27: test_proto.Defaults + (*SubDefaults)(nil), // 28: test_proto.SubDefaults + (*RepeatedEnum)(nil), // 29: test_proto.RepeatedEnum + (*MoreRepeated)(nil), // 30: test_proto.MoreRepeated + (*GroupOld)(nil), // 31: test_proto.GroupOld + (*GroupNew)(nil), // 32: test_proto.GroupNew + (*FloatingPoint)(nil), // 33: test_proto.FloatingPoint + (*MessageWithMap)(nil), // 34: test_proto.MessageWithMap + (*Oneof)(nil), // 35: test_proto.Oneof + (*Communique)(nil), // 36: test_proto.Communique + (*TestUTF8)(nil), // 37: test_proto.TestUTF8 + (*GoTest_RequiredGroup)(nil), // 38: test_proto.GoTest.RequiredGroup + (*GoTest_RepeatedGroup)(nil), // 39: test_proto.GoTest.RepeatedGroup + (*GoTest_OptionalGroup)(nil), // 40: test_proto.GoTest.OptionalGroup + (*GoTestRequiredGroupField_Group)(nil), // 41: test_proto.GoTestRequiredGroupField.Group + (*GoSkipTest_SkipGroup)(nil), // 42: test_proto.GoSkipTest.SkipGroup + (*OldMessage_Nested)(nil), // 43: test_proto.OldMessage.Nested + (*NewMessage_Nested)(nil), // 44: test_proto.NewMessage.Nested + (*MyMessage_SomeGroup)(nil), // 45: test_proto.MyMessage.SomeGroup + nil, // 46: test_proto.Ext.MapFieldEntry + (*MessageList_Message)(nil), // 47: test_proto.MessageList.Message + (*GroupOld_G)(nil), // 48: test_proto.GroupOld.G + (*GroupNew_G)(nil), // 49: test_proto.GroupNew.G + nil, // 50: test_proto.MessageWithMap.NameMappingEntry + nil, // 51: test_proto.MessageWithMap.MsgMappingEntry + nil, // 52: test_proto.MessageWithMap.ByteMappingEntry + nil, // 53: test_proto.MessageWithMap.StrToStrEntry + (*Oneof_F_Group)(nil), // 54: test_proto.Oneof.F_Group + nil, // 55: test_proto.TestUTF8.MapKeyEntry + nil, // 56: test_proto.TestUTF8.MapValueEntry +} +var xxx_File_test_proto_test_proto_depIdxs = []int32{ + 19, // test_proto.greeting:extendee -> test_proto.MyMessage + 17, // test_proto.complex:extendee -> test_proto.OtherMessage + 17, // test_proto.r_complex:extendee -> test_proto.OtherMessage + 22, // test_proto.no_default_double:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_float:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_int32:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_int64:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_uint32:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_uint64:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_sint32:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_sint64:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_fixed32:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_fixed64:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_sfixed32:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_sfixed64:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_bool:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_string:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_bytes:extendee -> test_proto.DefaultsMessage + 22, // test_proto.no_default_enum:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_double:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_float:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_int32:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_int64:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_uint32:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_uint64:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_sint32:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_sint64:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_fixed32:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_fixed64:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_sfixed32:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_sfixed64:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_bool:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_string:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_bytes:extendee -> test_proto.DefaultsMessage + 22, // test_proto.default_enum:extendee -> test_proto.DefaultsMessage + 23, // test_proto.x201:extendee -> test_proto.MyMessageSet + 23, // test_proto.x202:extendee -> test_proto.MyMessageSet + 23, // test_proto.x203:extendee -> test_proto.MyMessageSet + 23, // test_proto.x204:extendee -> test_proto.MyMessageSet + 23, // test_proto.x205:extendee -> test_proto.MyMessageSet + 23, // test_proto.x206:extendee -> test_proto.MyMessageSet + 23, // test_proto.x207:extendee -> test_proto.MyMessageSet + 23, // test_proto.x208:extendee -> test_proto.MyMessageSet + 23, // test_proto.x209:extendee -> test_proto.MyMessageSet + 23, // test_proto.x210:extendee -> test_proto.MyMessageSet + 23, // test_proto.x211:extendee -> test_proto.MyMessageSet + 23, // test_proto.x212:extendee -> test_proto.MyMessageSet + 23, // test_proto.x213:extendee -> test_proto.MyMessageSet + 23, // test_proto.x214:extendee -> test_proto.MyMessageSet + 23, // test_proto.x215:extendee -> test_proto.MyMessageSet + 23, // test_proto.x216:extendee -> test_proto.MyMessageSet + 23, // test_proto.x217:extendee -> test_proto.MyMessageSet + 23, // test_proto.x218:extendee -> test_proto.MyMessageSet + 23, // test_proto.x219:extendee -> test_proto.MyMessageSet + 23, // test_proto.x220:extendee -> test_proto.MyMessageSet + 23, // test_proto.x221:extendee -> test_proto.MyMessageSet + 23, // test_proto.x222:extendee -> test_proto.MyMessageSet + 23, // test_proto.x223:extendee -> test_proto.MyMessageSet + 23, // test_proto.x224:extendee -> test_proto.MyMessageSet + 23, // test_proto.x225:extendee -> test_proto.MyMessageSet + 23, // test_proto.x226:extendee -> test_proto.MyMessageSet + 23, // test_proto.x227:extendee -> test_proto.MyMessageSet + 23, // test_proto.x228:extendee -> test_proto.MyMessageSet + 23, // test_proto.x229:extendee -> test_proto.MyMessageSet + 23, // test_proto.x230:extendee -> test_proto.MyMessageSet + 23, // test_proto.x231:extendee -> test_proto.MyMessageSet + 23, // test_proto.x232:extendee -> test_proto.MyMessageSet + 23, // test_proto.x233:extendee -> test_proto.MyMessageSet + 23, // test_proto.x234:extendee -> test_proto.MyMessageSet + 23, // test_proto.x235:extendee -> test_proto.MyMessageSet + 23, // test_proto.x236:extendee -> test_proto.MyMessageSet + 23, // test_proto.x237:extendee -> test_proto.MyMessageSet + 23, // test_proto.x238:extendee -> test_proto.MyMessageSet + 23, // test_proto.x239:extendee -> test_proto.MyMessageSet + 23, // test_proto.x240:extendee -> test_proto.MyMessageSet + 23, // test_proto.x241:extendee -> test_proto.MyMessageSet + 23, // test_proto.x242:extendee -> test_proto.MyMessageSet + 23, // test_proto.x243:extendee -> test_proto.MyMessageSet + 23, // test_proto.x244:extendee -> test_proto.MyMessageSet + 23, // test_proto.x245:extendee -> test_proto.MyMessageSet + 23, // test_proto.x246:extendee -> test_proto.MyMessageSet + 23, // test_proto.x247:extendee -> test_proto.MyMessageSet + 23, // test_proto.x248:extendee -> test_proto.MyMessageSet + 23, // test_proto.x249:extendee -> test_proto.MyMessageSet + 23, // test_proto.x250:extendee -> test_proto.MyMessageSet + 19, // test_proto.Ext.more:extendee -> test_proto.MyMessage + 19, // test_proto.Ext.text:extendee -> test_proto.MyMessage + 19, // test_proto.Ext.number:extendee -> test_proto.MyMessage + 0, // test_proto.GoEnum.foo:type_name -> test_proto.FOO + 1, // test_proto.GoTest.Kind:type_name -> test_proto.GoTest.KIND + 7, // test_proto.GoTest.RequiredField:type_name -> test_proto.GoTestField + 7, // test_proto.GoTest.RepeatedField:type_name -> test_proto.GoTestField + 7, // test_proto.GoTest.OptionalField:type_name -> test_proto.GoTestField + 38, // test_proto.GoTest.requiredgroup:type_name -> test_proto.GoTest.RequiredGroup + 39, // test_proto.GoTest.repeatedgroup:type_name -> test_proto.GoTest.RepeatedGroup + 40, // test_proto.GoTest.optionalgroup:type_name -> test_proto.GoTest.OptionalGroup + 41, // test_proto.GoTestRequiredGroupField.group:type_name -> test_proto.GoTestRequiredGroupField.Group + 42, // test_proto.GoSkipTest.skipgroup:type_name -> test_proto.GoSkipTest.SkipGroup + 43, // test_proto.OldMessage.nested:type_name -> test_proto.OldMessage.Nested + 44, // test_proto.NewMessage.nested:type_name -> test_proto.NewMessage.Nested + 16, // test_proto.OtherMessage.inner:type_name -> test_proto.InnerMessage + 16, // test_proto.RequiredInnerMessage.leo_finally_won_an_oscar:type_name -> test_proto.InnerMessage + 16, // test_proto.MyMessage.inner:type_name -> test_proto.InnerMessage + 17, // test_proto.MyMessage.others:type_name -> test_proto.OtherMessage + 18, // test_proto.MyMessage.we_must_go_deeper:type_name -> test_proto.RequiredInnerMessage + 16, // test_proto.MyMessage.rep_inner:type_name -> test_proto.InnerMessage + 2, // test_proto.MyMessage.bikeshed:type_name -> test_proto.MyMessage.Color + 45, // test_proto.MyMessage.somegroup:type_name -> test_proto.MyMessage.SomeGroup + 46, // test_proto.Ext.map_field:type_name -> test_proto.Ext.MapFieldEntry + 47, // test_proto.MessageList.message:type_name -> test_proto.MessageList.Message + 4, // test_proto.Defaults.F_Enum:type_name -> test_proto.Defaults.Color + 28, // test_proto.Defaults.sub:type_name -> test_proto.SubDefaults + 5, // test_proto.RepeatedEnum.color:type_name -> test_proto.RepeatedEnum.Color + 48, // test_proto.GroupOld.g:type_name -> test_proto.GroupOld.G + 49, // test_proto.GroupNew.g:type_name -> test_proto.GroupNew.G + 50, // test_proto.MessageWithMap.name_mapping:type_name -> test_proto.MessageWithMap.NameMappingEntry + 51, // test_proto.MessageWithMap.msg_mapping:type_name -> test_proto.MessageWithMap.MsgMappingEntry + 52, // test_proto.MessageWithMap.byte_mapping:type_name -> test_proto.MessageWithMap.ByteMappingEntry + 53, // test_proto.MessageWithMap.str_to_str:type_name -> test_proto.MessageWithMap.StrToStrEntry + 2, // test_proto.Oneof.F_Enum:type_name -> test_proto.MyMessage.Color + 7, // test_proto.Oneof.F_Message:type_name -> test_proto.GoTestField + 54, // test_proto.Oneof.f_group:type_name -> test_proto.Oneof.F_Group + 2, // test_proto.Communique.col:type_name -> test_proto.MyMessage.Color + 26, // test_proto.Communique.msg:type_name -> test_proto.Strings + 55, // test_proto.TestUTF8.map_key:type_name -> test_proto.TestUTF8.MapKeyEntry + 56, // test_proto.TestUTF8.map_value:type_name -> test_proto.TestUTF8.MapValueEntry + 33, // test_proto.MessageWithMap.MsgMappingEntry.value:type_name -> test_proto.FloatingPoint + 21, // test_proto.complex:type_name -> test_proto.ComplexExtension + 21, // test_proto.r_complex:type_name -> test_proto.ComplexExtension + 3, // test_proto.no_default_enum:type_name -> test_proto.DefaultsMessage.DefaultsEnum + 3, // test_proto.default_enum:type_name -> test_proto.DefaultsMessage.DefaultsEnum + 24, // test_proto.x201:type_name -> test_proto.Empty + 24, // test_proto.x202:type_name -> test_proto.Empty + 24, // test_proto.x203:type_name -> test_proto.Empty + 24, // test_proto.x204:type_name -> test_proto.Empty + 24, // test_proto.x205:type_name -> test_proto.Empty + 24, // test_proto.x206:type_name -> test_proto.Empty + 24, // test_proto.x207:type_name -> test_proto.Empty + 24, // test_proto.x208:type_name -> test_proto.Empty + 24, // test_proto.x209:type_name -> test_proto.Empty + 24, // test_proto.x210:type_name -> test_proto.Empty + 24, // test_proto.x211:type_name -> test_proto.Empty + 24, // test_proto.x212:type_name -> test_proto.Empty + 24, // test_proto.x213:type_name -> test_proto.Empty + 24, // test_proto.x214:type_name -> test_proto.Empty + 24, // test_proto.x215:type_name -> test_proto.Empty + 24, // test_proto.x216:type_name -> test_proto.Empty + 24, // test_proto.x217:type_name -> test_proto.Empty + 24, // test_proto.x218:type_name -> test_proto.Empty + 24, // test_proto.x219:type_name -> test_proto.Empty + 24, // test_proto.x220:type_name -> test_proto.Empty + 24, // test_proto.x221:type_name -> test_proto.Empty + 24, // test_proto.x222:type_name -> test_proto.Empty + 24, // test_proto.x223:type_name -> test_proto.Empty + 24, // test_proto.x224:type_name -> test_proto.Empty + 24, // test_proto.x225:type_name -> test_proto.Empty + 24, // test_proto.x226:type_name -> test_proto.Empty + 24, // test_proto.x227:type_name -> test_proto.Empty + 24, // test_proto.x228:type_name -> test_proto.Empty + 24, // test_proto.x229:type_name -> test_proto.Empty + 24, // test_proto.x230:type_name -> test_proto.Empty + 24, // test_proto.x231:type_name -> test_proto.Empty + 24, // test_proto.x232:type_name -> test_proto.Empty + 24, // test_proto.x233:type_name -> test_proto.Empty + 24, // test_proto.x234:type_name -> test_proto.Empty + 24, // test_proto.x235:type_name -> test_proto.Empty + 24, // test_proto.x236:type_name -> test_proto.Empty + 24, // test_proto.x237:type_name -> test_proto.Empty + 24, // test_proto.x238:type_name -> test_proto.Empty + 24, // test_proto.x239:type_name -> test_proto.Empty + 24, // test_proto.x240:type_name -> test_proto.Empty + 24, // test_proto.x241:type_name -> test_proto.Empty + 24, // test_proto.x242:type_name -> test_proto.Empty + 24, // test_proto.x243:type_name -> test_proto.Empty + 24, // test_proto.x244:type_name -> test_proto.Empty + 24, // test_proto.x245:type_name -> test_proto.Empty + 24, // test_proto.x246:type_name -> test_proto.Empty + 24, // test_proto.x247:type_name -> test_proto.Empty + 24, // test_proto.x248:type_name -> test_proto.Empty + 24, // test_proto.x249:type_name -> test_proto.Empty + 24, // test_proto.x250:type_name -> test_proto.Empty + 20, // test_proto.Ext.more:type_name -> test_proto.Ext +} + +func init() { xxx_File_test_proto_test_proto_init() } +func xxx_File_test_proto_test_proto_init() { + if File_test_proto_test_proto != nil { + return + } + messageTypes := make([]protoreflect.MessageType, 51) + extensionTypes := make([]protoreflect.ExtensionType, 88) + File_test_proto_test_proto = protoimpl.FileBuilder{ + RawDescriptor: xxx_File_test_proto_test_proto_rawdesc, + GoTypes: xxx_File_test_proto_test_proto_goTypes, + DependencyIndexes: xxx_File_test_proto_test_proto_depIdxs, + EnumOutputTypes: xxx_File_test_proto_test_proto_enumTypes, + MessageOutputTypes: messageTypes, + ExtensionOutputTypes: extensionTypes, + }.Init() + messageGoTypes := xxx_File_test_proto_test_proto_goTypes[6:][:51] + for i, mt := range messageTypes { + xxx_File_test_proto_test_proto_messageTypes[i].GoType = reflect.TypeOf(messageGoTypes[i]) + xxx_File_test_proto_test_proto_messageTypes[i].PBType = mt + } + E_Greeting.Type = extensionTypes[0] + E_Complex.Type = extensionTypes[1] + E_RComplex.Type = extensionTypes[2] + E_NoDefaultDouble.Type = extensionTypes[3] + E_NoDefaultFloat.Type = extensionTypes[4] + E_NoDefaultInt32.Type = extensionTypes[5] + E_NoDefaultInt64.Type = extensionTypes[6] + E_NoDefaultUint32.Type = extensionTypes[7] + E_NoDefaultUint64.Type = extensionTypes[8] + E_NoDefaultSint32.Type = extensionTypes[9] + E_NoDefaultSint64.Type = extensionTypes[10] + E_NoDefaultFixed32.Type = extensionTypes[11] + E_NoDefaultFixed64.Type = extensionTypes[12] + E_NoDefaultSfixed32.Type = extensionTypes[13] + E_NoDefaultSfixed64.Type = extensionTypes[14] + E_NoDefaultBool.Type = extensionTypes[15] + E_NoDefaultString.Type = extensionTypes[16] + E_NoDefaultBytes.Type = extensionTypes[17] + E_NoDefaultEnum.Type = extensionTypes[18] + E_DefaultDouble.Type = extensionTypes[19] + E_DefaultFloat.Type = extensionTypes[20] + E_DefaultInt32.Type = extensionTypes[21] + E_DefaultInt64.Type = extensionTypes[22] + E_DefaultUint32.Type = extensionTypes[23] + E_DefaultUint64.Type = extensionTypes[24] + E_DefaultSint32.Type = extensionTypes[25] + E_DefaultSint64.Type = extensionTypes[26] + E_DefaultFixed32.Type = extensionTypes[27] + E_DefaultFixed64.Type = extensionTypes[28] + E_DefaultSfixed32.Type = extensionTypes[29] + E_DefaultSfixed64.Type = extensionTypes[30] + E_DefaultBool.Type = extensionTypes[31] + E_DefaultString.Type = extensionTypes[32] + E_DefaultBytes.Type = extensionTypes[33] + E_DefaultEnum.Type = extensionTypes[34] + E_X201.Type = extensionTypes[35] + E_X202.Type = extensionTypes[36] + E_X203.Type = extensionTypes[37] + E_X204.Type = extensionTypes[38] + E_X205.Type = extensionTypes[39] + E_X206.Type = extensionTypes[40] + E_X207.Type = extensionTypes[41] + E_X208.Type = extensionTypes[42] + E_X209.Type = extensionTypes[43] + E_X210.Type = extensionTypes[44] + E_X211.Type = extensionTypes[45] + E_X212.Type = extensionTypes[46] + E_X213.Type = extensionTypes[47] + E_X214.Type = extensionTypes[48] + E_X215.Type = extensionTypes[49] + E_X216.Type = extensionTypes[50] + E_X217.Type = extensionTypes[51] + E_X218.Type = extensionTypes[52] + E_X219.Type = extensionTypes[53] + E_X220.Type = extensionTypes[54] + E_X221.Type = extensionTypes[55] + E_X222.Type = extensionTypes[56] + E_X223.Type = extensionTypes[57] + E_X224.Type = extensionTypes[58] + E_X225.Type = extensionTypes[59] + E_X226.Type = extensionTypes[60] + E_X227.Type = extensionTypes[61] + E_X228.Type = extensionTypes[62] + E_X229.Type = extensionTypes[63] + E_X230.Type = extensionTypes[64] + E_X231.Type = extensionTypes[65] + E_X232.Type = extensionTypes[66] + E_X233.Type = extensionTypes[67] + E_X234.Type = extensionTypes[68] + E_X235.Type = extensionTypes[69] + E_X236.Type = extensionTypes[70] + E_X237.Type = extensionTypes[71] + E_X238.Type = extensionTypes[72] + E_X239.Type = extensionTypes[73] + E_X240.Type = extensionTypes[74] + E_X241.Type = extensionTypes[75] + E_X242.Type = extensionTypes[76] + E_X243.Type = extensionTypes[77] + E_X244.Type = extensionTypes[78] + E_X245.Type = extensionTypes[79] + E_X246.Type = extensionTypes[80] + E_X247.Type = extensionTypes[81] + E_X248.Type = extensionTypes[82] + E_X249.Type = extensionTypes[83] + E_X250.Type = extensionTypes[84] + E_Ext_More.Type = extensionTypes[85] + E_Ext_Text.Type = extensionTypes[86] + E_Ext_Number.Type = extensionTypes[87] + xxx_File_test_proto_test_proto_goTypes = nil + xxx_File_test_proto_test_proto_depIdxs = nil +} diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index 7fb952c6b1..03e0a7ba43 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -1,2946 +1,199 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/protobuf/descriptor.proto +// source: github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto package descriptor import ( + proto "github.com/golang/protobuf/proto" protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" - prototype "github.com/golang/protobuf/v2/reflect/prototype" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" - reflect "reflect" + descriptor "github.com/golang/protobuf/v2/types/descriptor" ) -type FieldDescriptorProto_Type int32 +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -const ( - // 0 is reserved for errors. - // Order is weird for historical reasons. - FieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1 - FieldDescriptorProto_TYPE_FLOAT FieldDescriptorProto_Type = 2 - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - // negative values are likely. - FieldDescriptorProto_TYPE_INT64 FieldDescriptorProto_Type = 3 - FieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4 - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - // negative values are likely. - FieldDescriptorProto_TYPE_INT32 FieldDescriptorProto_Type = 5 - FieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6 - FieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7 - FieldDescriptorProto_TYPE_BOOL FieldDescriptorProto_Type = 8 - FieldDescriptorProto_TYPE_STRING FieldDescriptorProto_Type = 9 - // Tag-delimited aggregate. - // Group type is deprecated and not supported in proto3. However, Proto3 - // implementations should still be able to parse the group wire format and - // treat group fields as unknown fields. - FieldDescriptorProto_TYPE_GROUP FieldDescriptorProto_Type = 10 - FieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 - // New in version 2. - FieldDescriptorProto_TYPE_BYTES FieldDescriptorProto_Type = 12 - FieldDescriptorProto_TYPE_UINT32 FieldDescriptorProto_Type = 13 - FieldDescriptorProto_TYPE_ENUM FieldDescriptorProto_Type = 14 - FieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15 - FieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16 - FieldDescriptorProto_TYPE_SINT32 FieldDescriptorProto_Type = 17 - FieldDescriptorProto_TYPE_SINT64 FieldDescriptorProto_Type = 18 -) - -func (e FieldDescriptorProto_Type) Type() protoreflect.EnumType { - return xxx_File_google_protobuf_descriptor_proto_enumTypes[0] -} -func (e FieldDescriptorProto_Type) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - -var FieldDescriptorProto_Type_name = map[int32]string{ - 1: "TYPE_DOUBLE", - 2: "TYPE_FLOAT", - 3: "TYPE_INT64", - 4: "TYPE_UINT64", - 5: "TYPE_INT32", - 6: "TYPE_FIXED64", - 7: "TYPE_FIXED32", - 8: "TYPE_BOOL", - 9: "TYPE_STRING", - 10: "TYPE_GROUP", - 11: "TYPE_MESSAGE", - 12: "TYPE_BYTES", - 13: "TYPE_UINT32", - 14: "TYPE_ENUM", - 15: "TYPE_SFIXED32", - 16: "TYPE_SFIXED64", - 17: "TYPE_SINT32", - 18: "TYPE_SINT64", -} - -var FieldDescriptorProto_Type_value = map[string]int32{ - "TYPE_DOUBLE": 1, - "TYPE_FLOAT": 2, - "TYPE_INT64": 3, - "TYPE_UINT64": 4, - "TYPE_INT32": 5, - "TYPE_FIXED64": 6, - "TYPE_FIXED32": 7, - "TYPE_BOOL": 8, - "TYPE_STRING": 9, - "TYPE_GROUP": 10, - "TYPE_MESSAGE": 11, - "TYPE_BYTES": 12, - "TYPE_UINT32": 13, - "TYPE_ENUM": 14, - "TYPE_SFIXED32": 15, - "TYPE_SFIXED64": 16, - "TYPE_SINT32": 17, - "TYPE_SINT64": 18, -} - -func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type { - p := new(FieldDescriptorProto_Type) - *p = x - return p -} - -func (x FieldDescriptorProto_Type) String() string { - return protoapi.EnumName(FieldDescriptorProto_Type_name, int32(x)) -} - -func (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error { - value, err := protoapi.UnmarshalJSONEnum(FieldDescriptorProto_Type_value, data, "FieldDescriptorProto_Type") - if err != nil { - return err - } - *x = FieldDescriptorProto_Type(value) - return nil -} - -func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{4, 0} -} - -type FieldDescriptorProto_Label int32 - -const ( - // 0 is reserved for errors - FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1 - FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2 - FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3 -) - -func (e FieldDescriptorProto_Label) Type() protoreflect.EnumType { - return xxx_File_google_protobuf_descriptor_proto_enumTypes[1] -} -func (e FieldDescriptorProto_Label) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - -var FieldDescriptorProto_Label_name = map[int32]string{ - 1: "LABEL_OPTIONAL", - 2: "LABEL_REQUIRED", - 3: "LABEL_REPEATED", -} - -var FieldDescriptorProto_Label_value = map[string]int32{ - "LABEL_OPTIONAL": 1, - "LABEL_REQUIRED": 2, - "LABEL_REPEATED": 3, -} - -func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label { - p := new(FieldDescriptorProto_Label) - *p = x - return p -} - -func (x FieldDescriptorProto_Label) String() string { - return protoapi.EnumName(FieldDescriptorProto_Label_name, int32(x)) -} - -func (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error { - value, err := protoapi.UnmarshalJSONEnum(FieldDescriptorProto_Label_value, data, "FieldDescriptorProto_Label") - if err != nil { - return err - } - *x = FieldDescriptorProto_Label(value) - return nil -} - -func (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{4, 1} -} - -// Generated classes can be optimized for speed or code size. -type FileOptions_OptimizeMode int32 - -const ( - FileOptions_SPEED FileOptions_OptimizeMode = 1 - // etc. - FileOptions_CODE_SIZE FileOptions_OptimizeMode = 2 - FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 -) - -func (e FileOptions_OptimizeMode) Type() protoreflect.EnumType { - return xxx_File_google_protobuf_descriptor_proto_enumTypes[2] -} -func (e FileOptions_OptimizeMode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - -var FileOptions_OptimizeMode_name = map[int32]string{ - 1: "SPEED", - 2: "CODE_SIZE", - 3: "LITE_RUNTIME", -} - -var FileOptions_OptimizeMode_value = map[string]int32{ - "SPEED": 1, - "CODE_SIZE": 2, - "LITE_RUNTIME": 3, -} - -func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode { - p := new(FileOptions_OptimizeMode) - *p = x - return p -} - -func (x FileOptions_OptimizeMode) String() string { - return protoapi.EnumName(FileOptions_OptimizeMode_name, int32(x)) -} - -func (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error { - value, err := protoapi.UnmarshalJSONEnum(FileOptions_OptimizeMode_value, data, "FileOptions_OptimizeMode") - if err != nil { - return err - } - *x = FileOptions_OptimizeMode(value) - return nil -} - -func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{10, 0} -} - -type FieldOptions_CType int32 - -const ( - // Default mode. - FieldOptions_STRING FieldOptions_CType = 0 - FieldOptions_CORD FieldOptions_CType = 1 - FieldOptions_STRING_PIECE FieldOptions_CType = 2 -) - -func (e FieldOptions_CType) Type() protoreflect.EnumType { - return xxx_File_google_protobuf_descriptor_proto_enumTypes[3] -} -func (e FieldOptions_CType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - -var FieldOptions_CType_name = map[int32]string{ - 0: "STRING", - 1: "CORD", - 2: "STRING_PIECE", -} - -var FieldOptions_CType_value = map[string]int32{ - "STRING": 0, - "CORD": 1, - "STRING_PIECE": 2, -} - -func (x FieldOptions_CType) Enum() *FieldOptions_CType { - p := new(FieldOptions_CType) - *p = x - return p -} - -func (x FieldOptions_CType) String() string { - return protoapi.EnumName(FieldOptions_CType_name, int32(x)) -} - -func (x *FieldOptions_CType) UnmarshalJSON(data []byte) error { - value, err := protoapi.UnmarshalJSONEnum(FieldOptions_CType_value, data, "FieldOptions_CType") - if err != nil { - return err - } - *x = FieldOptions_CType(value) - return nil -} - -func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{12, 0} -} - -type FieldOptions_JSType int32 - -const ( - // Use the default type. - FieldOptions_JS_NORMAL FieldOptions_JSType = 0 - // Use JavaScript strings. - FieldOptions_JS_STRING FieldOptions_JSType = 1 - // Use JavaScript numbers. - FieldOptions_JS_NUMBER FieldOptions_JSType = 2 -) - -func (e FieldOptions_JSType) Type() protoreflect.EnumType { - return xxx_File_google_protobuf_descriptor_proto_enumTypes[4] -} -func (e FieldOptions_JSType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - -var FieldOptions_JSType_name = map[int32]string{ - 0: "JS_NORMAL", - 1: "JS_STRING", - 2: "JS_NUMBER", -} - -var FieldOptions_JSType_value = map[string]int32{ - "JS_NORMAL": 0, - "JS_STRING": 1, - "JS_NUMBER": 2, -} - -func (x FieldOptions_JSType) Enum() *FieldOptions_JSType { - p := new(FieldOptions_JSType) - *p = x - return p -} - -func (x FieldOptions_JSType) String() string { - return protoapi.EnumName(FieldOptions_JSType_name, int32(x)) -} - -func (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error { - value, err := protoapi.UnmarshalJSONEnum(FieldOptions_JSType_value, data, "FieldOptions_JSType") - if err != nil { - return err - } - *x = FieldOptions_JSType(value) - return nil -} - -func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{12, 1} -} - -// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, -// or neither? HTTP based RPC implementation may choose GET verb for safe -// methods, and PUT verb for idempotent methods instead of the default POST. -type MethodOptions_IdempotencyLevel int32 - -const ( - MethodOptions_IDEMPOTENCY_UNKNOWN MethodOptions_IdempotencyLevel = 0 - MethodOptions_NO_SIDE_EFFECTS MethodOptions_IdempotencyLevel = 1 - MethodOptions_IDEMPOTENT MethodOptions_IdempotencyLevel = 2 -) - -func (e MethodOptions_IdempotencyLevel) Type() protoreflect.EnumType { - return xxx_File_google_protobuf_descriptor_proto_enumTypes[5] -} -func (e MethodOptions_IdempotencyLevel) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - -var MethodOptions_IdempotencyLevel_name = map[int32]string{ - 0: "IDEMPOTENCY_UNKNOWN", - 1: "NO_SIDE_EFFECTS", - 2: "IDEMPOTENT", -} - -var MethodOptions_IdempotencyLevel_value = map[string]int32{ - "IDEMPOTENCY_UNKNOWN": 0, - "NO_SIDE_EFFECTS": 1, - "IDEMPOTENT": 2, -} - -func (x MethodOptions_IdempotencyLevel) Enum() *MethodOptions_IdempotencyLevel { - p := new(MethodOptions_IdempotencyLevel) - *p = x - return p -} - -func (x MethodOptions_IdempotencyLevel) String() string { - return protoapi.EnumName(MethodOptions_IdempotencyLevel_name, int32(x)) -} - -func (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(data []byte) error { - value, err := protoapi.UnmarshalJSONEnum(MethodOptions_IdempotencyLevel_value, data, "MethodOptions_IdempotencyLevel") - if err != nil { - return err - } - *x = MethodOptions_IdempotencyLevel(value) - return nil -} - -func (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{17, 0} -} - -// The protocol compiler can output a FileDescriptorSet containing the .proto -// files it parses. -type FileDescriptorSet struct { - File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FileDescriptorSet) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[0].MessageOf(m) -} -func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} } -func (m *FileDescriptorSet) String() string { return protoapi.CompactTextString(m) } -func (*FileDescriptorSet) ProtoMessage() {} -func (*FileDescriptorSet) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{0} -} - -func (m *FileDescriptorSet) GetFile() []*FileDescriptorProto { - if m != nil { - return m.File - } - return nil -} - -// Describes a complete .proto file. -type FileDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` - // Names of files imported by this file. - Dependency []string `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"` - // Indexes of the public imported files in the dependency list above. - PublicDependency []int32 `protobuf:"varint,10,rep,name=public_dependency,json=publicDependency" json:"public_dependency,omitempty"` - // Indexes of the weak imported files in the dependency list. - // For Google-internal migration only. Do not use. - WeakDependency []int32 `protobuf:"varint,11,rep,name=weak_dependency,json=weakDependency" json:"weak_dependency,omitempty"` - // All top-level definitions in this file. - MessageType []*DescriptorProto `protobuf:"bytes,4,rep,name=message_type,json=messageType" json:"message_type,omitempty"` - EnumType []*EnumDescriptorProto `protobuf:"bytes,5,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` - Service []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"` - Extension []*FieldDescriptorProto `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"` - Options *FileOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` - // This field contains optional information about the original source code. - // You may safely remove this entire field without harming runtime - // functionality of the descriptors -- the information is needed only by - // development tools. - SourceCodeInfo *SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` - // The syntax of the proto file. - // The supported values are "proto2" and "proto3". - Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FileDescriptorProto) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[1].MessageOf(m) -} -func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} } -func (m *FileDescriptorProto) String() string { return protoapi.CompactTextString(m) } -func (*FileDescriptorProto) ProtoMessage() {} -func (*FileDescriptorProto) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{1} -} - -func (m *FileDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *FileDescriptorProto) GetPackage() string { - if m != nil && m.Package != nil { - return *m.Package - } - return "" -} - -func (m *FileDescriptorProto) GetDependency() []string { - if m != nil { - return m.Dependency - } - return nil -} - -func (m *FileDescriptorProto) GetPublicDependency() []int32 { - if m != nil { - return m.PublicDependency - } - return nil -} - -func (m *FileDescriptorProto) GetWeakDependency() []int32 { - if m != nil { - return m.WeakDependency - } - return nil -} - -func (m *FileDescriptorProto) GetMessageType() []*DescriptorProto { - if m != nil { - return m.MessageType - } - return nil -} - -func (m *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto { - if m != nil { - return m.EnumType - } - return nil -} - -func (m *FileDescriptorProto) GetService() []*ServiceDescriptorProto { - if m != nil { - return m.Service - } - return nil -} - -func (m *FileDescriptorProto) GetExtension() []*FieldDescriptorProto { - if m != nil { - return m.Extension - } - return nil -} - -func (m *FileDescriptorProto) GetOptions() *FileOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo { - if m != nil { - return m.SourceCodeInfo - } - return nil -} - -func (m *FileDescriptorProto) GetSyntax() string { - if m != nil && m.Syntax != nil { - return *m.Syntax - } - return "" -} - -// Describes a message type. -type DescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Field []*FieldDescriptorProto `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"` - Extension []*FieldDescriptorProto `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"` - NestedType []*DescriptorProto `protobuf:"bytes,3,rep,name=nested_type,json=nestedType" json:"nested_type,omitempty"` - EnumType []*EnumDescriptorProto `protobuf:"bytes,4,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` - ExtensionRange []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range,json=extensionRange" json:"extension_range,omitempty"` - OneofDecl []*OneofDescriptorProto `protobuf:"bytes,8,rep,name=oneof_decl,json=oneofDecl" json:"oneof_decl,omitempty"` - Options *MessageOptions `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"` - ReservedRange []*DescriptorProto_ReservedRange `protobuf:"bytes,9,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` - // Reserved field names, which may not be used by fields in the same message. - // A given name may only be reserved once. - ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DescriptorProto) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[2].MessageOf(m) -} -func (m *DescriptorProto) Reset() { *m = DescriptorProto{} } -func (m *DescriptorProto) String() string { return protoapi.CompactTextString(m) } -func (*DescriptorProto) ProtoMessage() {} -func (*DescriptorProto) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{2} -} - -func (m *DescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *DescriptorProto) GetField() []*FieldDescriptorProto { - if m != nil { - return m.Field - } - return nil -} - -func (m *DescriptorProto) GetExtension() []*FieldDescriptorProto { - if m != nil { - return m.Extension - } - return nil -} - -func (m *DescriptorProto) GetNestedType() []*DescriptorProto { - if m != nil { - return m.NestedType - } - return nil -} - -func (m *DescriptorProto) GetEnumType() []*EnumDescriptorProto { - if m != nil { - return m.EnumType - } - return nil -} - -func (m *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange { - if m != nil { - return m.ExtensionRange - } - return nil -} - -func (m *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto { - if m != nil { - return m.OneofDecl - } - return nil -} - -func (m *DescriptorProto) GetOptions() *MessageOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange { - if m != nil { - return m.ReservedRange - } - return nil -} - -func (m *DescriptorProto) GetReservedName() []string { - if m != nil { - return m.ReservedName - } - return nil -} - -type ExtensionRangeOptions struct { - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - protoapi.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExtensionRangeOptions) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[3].MessageOf(m) -} -func (m *ExtensionRangeOptions) Reset() { *m = ExtensionRangeOptions{} } -func (m *ExtensionRangeOptions) String() string { return protoapi.CompactTextString(m) } -func (*ExtensionRangeOptions) ProtoMessage() {} -func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{3} -} - -var extRange_ExtensionRangeOptions = []protoapi.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*ExtensionRangeOptions) ExtensionRangeArray() []protoapi.ExtensionRange { - return extRange_ExtensionRangeOptions -} - -func (m *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -// Describes a field within a message. -type FieldDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Number *int32 `protobuf:"varint,3,opt,name=number" json:"number,omitempty"` - Label *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label" json:"label,omitempty"` - // If type_name is set, this need not be set. If both this and type_name - // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - Type *FieldDescriptorProto_Type `protobuf:"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type" json:"type,omitempty"` - // For message and enum types, this is the name of the type. If the name - // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - // rules are used to find the type (i.e. first the nested types within this - // message are searched, then within the parent, on up to the root - // namespace). - TypeName *string `protobuf:"bytes,6,opt,name=type_name,json=typeName" json:"type_name,omitempty"` - // For extensions, this is the name of the type being extended. It is - // resolved in the same manner as type_name. - Extendee *string `protobuf:"bytes,2,opt,name=extendee" json:"extendee,omitempty"` - // For numeric types, contains the original text representation of the value. - // For booleans, "true" or "false". - // For strings, contains the default text contents (not escaped in any way). - // For bytes, contains the C escaped value. All bytes >= 128 are escaped. - // TODO(kenton): Base-64 encode? - DefaultValue *string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"` - // If set, gives the index of a oneof in the containing type's oneof_decl - // list. This field is a member of that oneof. - OneofIndex *int32 `protobuf:"varint,9,opt,name=oneof_index,json=oneofIndex" json:"oneof_index,omitempty"` - // JSON name of this field. The value is set by protocol compiler. If the - // user has set a "json_name" option on this field, that option's value - // will be used. Otherwise, it's deduced from the field's name by converting - // it to camelCase. - JsonName *string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"` - Options *FieldOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FieldDescriptorProto) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[4].MessageOf(m) -} -func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} } -func (m *FieldDescriptorProto) String() string { return protoapi.CompactTextString(m) } -func (*FieldDescriptorProto) ProtoMessage() {} -func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{4} -} - -func (m *FieldDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *FieldDescriptorProto) GetNumber() int32 { - if m != nil && m.Number != nil { - return *m.Number - } - return 0 -} - -func (m *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label { - if m != nil && m.Label != nil { - return *m.Label - } - return FieldDescriptorProto_LABEL_OPTIONAL -} - -func (m *FieldDescriptorProto) GetType() FieldDescriptorProto_Type { - if m != nil && m.Type != nil { - return *m.Type - } - return FieldDescriptorProto_TYPE_DOUBLE -} - -func (m *FieldDescriptorProto) GetTypeName() string { - if m != nil && m.TypeName != nil { - return *m.TypeName - } - return "" -} - -func (m *FieldDescriptorProto) GetExtendee() string { - if m != nil && m.Extendee != nil { - return *m.Extendee - } - return "" -} - -func (m *FieldDescriptorProto) GetDefaultValue() string { - if m != nil && m.DefaultValue != nil { - return *m.DefaultValue - } - return "" -} - -func (m *FieldDescriptorProto) GetOneofIndex() int32 { - if m != nil && m.OneofIndex != nil { - return *m.OneofIndex - } - return 0 -} - -func (m *FieldDescriptorProto) GetJsonName() string { - if m != nil && m.JsonName != nil { - return *m.JsonName - } - return "" -} - -func (m *FieldDescriptorProto) GetOptions() *FieldOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a oneof. -type OneofDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OneofDescriptorProto) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[5].MessageOf(m) -} -func (m *OneofDescriptorProto) Reset() { *m = OneofDescriptorProto{} } -func (m *OneofDescriptorProto) String() string { return protoapi.CompactTextString(m) } -func (*OneofDescriptorProto) ProtoMessage() {} -func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{5} -} - -func (m *OneofDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *OneofDescriptorProto) GetOptions() *OneofOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes an enum type. -type EnumDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` - Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - // Range of reserved numeric values. Reserved numeric values may not be used - // by enum values in the same enum declaration. Reserved ranges may not - // overlap. - ReservedRange []*EnumDescriptorProto_EnumReservedRange `protobuf:"bytes,4,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` - // Reserved enum value names, which may not be reused. A given name may only - // be reserved once. - ReservedName []string `protobuf:"bytes,5,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumDescriptorProto) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[6].MessageOf(m) -} -func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} } -func (m *EnumDescriptorProto) String() string { return protoapi.CompactTextString(m) } -func (*EnumDescriptorProto) ProtoMessage() {} -func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{6} -} - -func (m *EnumDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto { - if m != nil { - return m.Value - } - return nil -} - -func (m *EnumDescriptorProto) GetOptions() *EnumOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *EnumDescriptorProto) GetReservedRange() []*EnumDescriptorProto_EnumReservedRange { - if m != nil { - return m.ReservedRange - } - return nil -} - -func (m *EnumDescriptorProto) GetReservedName() []string { - if m != nil { - return m.ReservedName - } - return nil -} - -// Describes a value within an enum. -type EnumValueDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` - Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumValueDescriptorProto) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[7].MessageOf(m) -} -func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} } -func (m *EnumValueDescriptorProto) String() string { return protoapi.CompactTextString(m) } -func (*EnumValueDescriptorProto) ProtoMessage() {} -func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{7} -} - -func (m *EnumValueDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *EnumValueDescriptorProto) GetNumber() int32 { - if m != nil && m.Number != nil { - return *m.Number - } - return 0 -} - -func (m *EnumValueDescriptorProto) GetOptions() *EnumValueOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a service. -type ServiceDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` - Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ServiceDescriptorProto) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[8].MessageOf(m) -} -func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} } -func (m *ServiceDescriptorProto) String() string { return protoapi.CompactTextString(m) } -func (*ServiceDescriptorProto) ProtoMessage() {} -func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{8} -} - -func (m *ServiceDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto { - if m != nil { - return m.Method - } - return nil -} - -func (m *ServiceDescriptorProto) GetOptions() *ServiceOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a method of a service. -type MethodDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - // Input and output type names. These are resolved in the same way as - // FieldDescriptorProto.type_name, but must refer to a message type. - InputType *string `protobuf:"bytes,2,opt,name=input_type,json=inputType" json:"input_type,omitempty"` - OutputType *string `protobuf:"bytes,3,opt,name=output_type,json=outputType" json:"output_type,omitempty"` - Options *MethodOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"` - // Identifies if client streams multiple client messages - ClientStreaming *bool `protobuf:"varint,5,opt,name=client_streaming,json=clientStreaming,def=0" json:"client_streaming,omitempty"` - // Identifies if server streams multiple server messages - ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MethodDescriptorProto) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[9].MessageOf(m) -} -func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} } -func (m *MethodDescriptorProto) String() string { return protoapi.CompactTextString(m) } -func (*MethodDescriptorProto) ProtoMessage() {} -func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{9} -} - -const Default_MethodDescriptorProto_ClientStreaming bool = false -const Default_MethodDescriptorProto_ServerStreaming bool = false - -func (m *MethodDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *MethodDescriptorProto) GetInputType() string { - if m != nil && m.InputType != nil { - return *m.InputType - } - return "" -} - -func (m *MethodDescriptorProto) GetOutputType() string { - if m != nil && m.OutputType != nil { - return *m.OutputType - } - return "" -} - -func (m *MethodDescriptorProto) GetOptions() *MethodOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *MethodDescriptorProto) GetClientStreaming() bool { - if m != nil && m.ClientStreaming != nil { - return *m.ClientStreaming - } - return Default_MethodDescriptorProto_ClientStreaming -} - -func (m *MethodDescriptorProto) GetServerStreaming() bool { - if m != nil && m.ServerStreaming != nil { - return *m.ServerStreaming - } - return Default_MethodDescriptorProto_ServerStreaming -} - -type FileOptions struct { - // Sets the Java package where classes generated from this .proto will be - // placed. By default, the proto package is used, but this is often - // inappropriate because proto packages do not normally start with backwards - // domain names. - JavaPackage *string `protobuf:"bytes,1,opt,name=java_package,json=javaPackage" json:"java_package,omitempty"` - // If set, all the classes from the .proto file are wrapped in a single - // outer class with the given name. This applies to both Proto1 - // (equivalent to the old "--one_java_file" option) and Proto2 (where - // a .proto always translates to a single class, but you may want to - // explicitly choose the class name). - JavaOuterClassname *string `protobuf:"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname" json:"java_outer_classname,omitempty"` - // If set true, then the Java code generator will generate a separate .java - // file for each top-level message, enum, and service defined in the .proto - // file. Thus, these types will *not* be nested inside the outer class - // named by java_outer_classname. However, the outer class will still be - // generated to contain the file's getDescriptor() method as well as any - // top-level extensions defined in the file. - JavaMultipleFiles *bool `protobuf:"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0" json:"java_multiple_files,omitempty"` - // This option does nothing. - JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"` // Deprecated: Do not use. - // If set true, then the Java2 code generator will generate code that - // throws an exception whenever an attempt is made to assign a non-UTF-8 - // byte sequence to a string field. - // Message reflection will do the same. - // However, an extension field still accepts non-UTF-8 byte sequences. - // This option has no effect on when used with the lite runtime. - JavaStringCheckUtf8 *bool `protobuf:"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0" json:"java_string_check_utf8,omitempty"` - OptimizeFor *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"` - // Sets the Go package where structs generated from this .proto will be - // placed. If omitted, the Go package will be derived from the following: - // - The basename of the package import path, if provided. - // - Otherwise, the package statement in the .proto file, if present. - // - Otherwise, the basename of the .proto file, without extension. - GoPackage *string `protobuf:"bytes,11,opt,name=go_package,json=goPackage" json:"go_package,omitempty"` - // Should generic services be generated in each language? "Generic" services - // are not specific to any particular RPC system. They are generated by the - // main code generators in each language (without additional plugins). - // Generic services were the only kind of service generation supported by - // early versions of google.protobuf. - // - // Generic services are now considered deprecated in favor of using plugins - // that generate code specific to your particular RPC system. Therefore, - // these default to false. Old code which depends on generic services should - // explicitly set them to true. - CcGenericServices *bool `protobuf:"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0" json:"cc_generic_services,omitempty"` - JavaGenericServices *bool `protobuf:"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0" json:"java_generic_services,omitempty"` - PyGenericServices *bool `protobuf:"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0" json:"py_generic_services,omitempty"` - PhpGenericServices *bool `protobuf:"varint,42,opt,name=php_generic_services,json=phpGenericServices,def=0" json:"php_generic_services,omitempty"` - // Is this file deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for everything in the file, or it will be completely ignored; in the very - // least, this is a formalization for deprecating files. - Deprecated *bool `protobuf:"varint,23,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // Enables the use of arenas for the proto messages in this file. This applies - // only to generated classes for C++. - CcEnableArenas *bool `protobuf:"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=0" json:"cc_enable_arenas,omitempty"` - // Sets the objective c class prefix which is prepended to all objective c - // generated classes from this .proto. There is no default. - ObjcClassPrefix *string `protobuf:"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix" json:"objc_class_prefix,omitempty"` - // Namespace for generated classes; defaults to the package. - CsharpNamespace *string `protobuf:"bytes,37,opt,name=csharp_namespace,json=csharpNamespace" json:"csharp_namespace,omitempty"` - // By default Swift generators will take the proto package and CamelCase it - // replacing '.' with underscore and use that to prefix the types/symbols - // defined. When this options is provided, they will use this value instead - // to prefix the types/symbols defined. - SwiftPrefix *string `protobuf:"bytes,39,opt,name=swift_prefix,json=swiftPrefix" json:"swift_prefix,omitempty"` - // Sets the php class prefix which is prepended to all php generated classes - // from this .proto. Default is empty. - PhpClassPrefix *string `protobuf:"bytes,40,opt,name=php_class_prefix,json=phpClassPrefix" json:"php_class_prefix,omitempty"` - // Use this option to change the namespace of php generated classes. Default - // is empty. When this option is empty, the package name will be used for - // determining the namespace. - PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"` - // Use this option to change the namespace of php generated metadata classes. - // Default is empty. When this option is empty, the proto file name will be used - // for determining the namespace. - PhpMetadataNamespace *string `protobuf:"bytes,44,opt,name=php_metadata_namespace,json=phpMetadataNamespace" json:"php_metadata_namespace,omitempty"` - // Use this option to change the package of ruby generated classes. Default - // is empty. When this option is not set, the package name will be used for - // determining the ruby package. - RubyPackage *string `protobuf:"bytes,45,opt,name=ruby_package,json=rubyPackage" json:"ruby_package,omitempty"` - // The parser stores options it doesn't recognize here. - // See the documentation for the "Options" section above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - protoapi.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FileOptions) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[10].MessageOf(m) -} -func (m *FileOptions) Reset() { *m = FileOptions{} } -func (m *FileOptions) String() string { return protoapi.CompactTextString(m) } -func (*FileOptions) ProtoMessage() {} -func (*FileOptions) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{10} -} - -var extRange_FileOptions = []protoapi.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*FileOptions) ExtensionRangeArray() []protoapi.ExtensionRange { - return extRange_FileOptions -} - -const Default_FileOptions_JavaMultipleFiles bool = false -const Default_FileOptions_JavaStringCheckUtf8 bool = false -const Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED -const Default_FileOptions_CcGenericServices bool = false -const Default_FileOptions_JavaGenericServices bool = false -const Default_FileOptions_PyGenericServices bool = false -const Default_FileOptions_PhpGenericServices bool = false -const Default_FileOptions_Deprecated bool = false -const Default_FileOptions_CcEnableArenas bool = false - -func (m *FileOptions) GetJavaPackage() string { - if m != nil && m.JavaPackage != nil { - return *m.JavaPackage - } - return "" -} - -func (m *FileOptions) GetJavaOuterClassname() string { - if m != nil && m.JavaOuterClassname != nil { - return *m.JavaOuterClassname - } - return "" -} - -func (m *FileOptions) GetJavaMultipleFiles() bool { - if m != nil && m.JavaMultipleFiles != nil { - return *m.JavaMultipleFiles - } - return Default_FileOptions_JavaMultipleFiles -} - -// Deprecated: Do not use. -func (m *FileOptions) GetJavaGenerateEqualsAndHash() bool { - if m != nil && m.JavaGenerateEqualsAndHash != nil { - return *m.JavaGenerateEqualsAndHash - } - return false -} - -func (m *FileOptions) GetJavaStringCheckUtf8() bool { - if m != nil && m.JavaStringCheckUtf8 != nil { - return *m.JavaStringCheckUtf8 - } - return Default_FileOptions_JavaStringCheckUtf8 -} - -func (m *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode { - if m != nil && m.OptimizeFor != nil { - return *m.OptimizeFor - } - return Default_FileOptions_OptimizeFor -} - -func (m *FileOptions) GetGoPackage() string { - if m != nil && m.GoPackage != nil { - return *m.GoPackage - } - return "" -} - -func (m *FileOptions) GetCcGenericServices() bool { - if m != nil && m.CcGenericServices != nil { - return *m.CcGenericServices - } - return Default_FileOptions_CcGenericServices -} - -func (m *FileOptions) GetJavaGenericServices() bool { - if m != nil && m.JavaGenericServices != nil { - return *m.JavaGenericServices - } - return Default_FileOptions_JavaGenericServices -} - -func (m *FileOptions) GetPyGenericServices() bool { - if m != nil && m.PyGenericServices != nil { - return *m.PyGenericServices - } - return Default_FileOptions_PyGenericServices -} - -func (m *FileOptions) GetPhpGenericServices() bool { - if m != nil && m.PhpGenericServices != nil { - return *m.PhpGenericServices - } - return Default_FileOptions_PhpGenericServices -} - -func (m *FileOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_FileOptions_Deprecated -} - -func (m *FileOptions) GetCcEnableArenas() bool { - if m != nil && m.CcEnableArenas != nil { - return *m.CcEnableArenas - } - return Default_FileOptions_CcEnableArenas -} - -func (m *FileOptions) GetObjcClassPrefix() string { - if m != nil && m.ObjcClassPrefix != nil { - return *m.ObjcClassPrefix - } - return "" -} - -func (m *FileOptions) GetCsharpNamespace() string { - if m != nil && m.CsharpNamespace != nil { - return *m.CsharpNamespace - } - return "" -} - -func (m *FileOptions) GetSwiftPrefix() string { - if m != nil && m.SwiftPrefix != nil { - return *m.SwiftPrefix - } - return "" -} - -func (m *FileOptions) GetPhpClassPrefix() string { - if m != nil && m.PhpClassPrefix != nil { - return *m.PhpClassPrefix - } - return "" -} - -func (m *FileOptions) GetPhpNamespace() string { - if m != nil && m.PhpNamespace != nil { - return *m.PhpNamespace - } - return "" -} - -func (m *FileOptions) GetPhpMetadataNamespace() string { - if m != nil && m.PhpMetadataNamespace != nil { - return *m.PhpMetadataNamespace - } - return "" -} - -func (m *FileOptions) GetRubyPackage() string { - if m != nil && m.RubyPackage != nil { - return *m.RubyPackage - } - return "" -} - -func (m *FileOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type MessageOptions struct { - // Set true to use the old proto1 MessageSet wire format for extensions. - // This is provided for backwards-compatibility with the MessageSet wire - // format. You should not use this for any other reason: It's less - // efficient, has fewer features, and is more complicated. - // - // The message must be defined exactly as follows: - // message Foo { - // option message_set_wire_format = true; - // extensions 4 to max; - // } - // Note that the message cannot have any defined fields; MessageSets only - // have extensions. - // - // All extensions of your type must be singular messages; e.g. they cannot - // be int32s, enums, or repeated messages. - // - // Because this is an option, the above two restrictions are not enforced by - // the protocol compiler. - MessageSetWireFormat *bool `protobuf:"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0" json:"message_set_wire_format,omitempty"` - // Disables the generation of the standard "descriptor()" accessor, which can - // conflict with a field of the same name. This is meant to make migration - // from proto1 easier; new code should avoid fields named "descriptor". - NoStandardDescriptorAccessor *bool `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0" json:"no_standard_descriptor_accessor,omitempty"` - // Is this message deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the message, or it will be completely ignored; in the very least, - // this is a formalization for deprecating messages. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // Whether the message is an automatically generated map entry type for the - // maps field. - // - // For maps fields: - // map map_field = 1; - // The parsed descriptor looks like: - // message MapFieldEntry { - // option map_entry = true; - // optional KeyType key = 1; - // optional ValueType value = 2; - // } - // repeated MapFieldEntry map_field = 1; - // - // Implementations may choose not to generate the map_entry=true message, but - // use a native map in the target language to hold the keys and values. - // The reflection APIs in such implementions still need to work as - // if the field is a repeated message field. - // - // NOTE: Do not set the option in .proto files. Always use the maps syntax - // instead. The option should only be implicitly set by the proto compiler - // parser. - MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - protoapi.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MessageOptions) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[11].MessageOf(m) -} -func (m *MessageOptions) Reset() { *m = MessageOptions{} } -func (m *MessageOptions) String() string { return protoapi.CompactTextString(m) } -func (*MessageOptions) ProtoMessage() {} -func (*MessageOptions) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{11} -} - -var extRange_MessageOptions = []protoapi.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*MessageOptions) ExtensionRangeArray() []protoapi.ExtensionRange { - return extRange_MessageOptions -} - -const Default_MessageOptions_MessageSetWireFormat bool = false -const Default_MessageOptions_NoStandardDescriptorAccessor bool = false -const Default_MessageOptions_Deprecated bool = false - -func (m *MessageOptions) GetMessageSetWireFormat() bool { - if m != nil && m.MessageSetWireFormat != nil { - return *m.MessageSetWireFormat - } - return Default_MessageOptions_MessageSetWireFormat -} - -func (m *MessageOptions) GetNoStandardDescriptorAccessor() bool { - if m != nil && m.NoStandardDescriptorAccessor != nil { - return *m.NoStandardDescriptorAccessor - } - return Default_MessageOptions_NoStandardDescriptorAccessor -} - -func (m *MessageOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_MessageOptions_Deprecated -} - -func (m *MessageOptions) GetMapEntry() bool { - if m != nil && m.MapEntry != nil { - return *m.MapEntry - } - return false -} - -func (m *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type FieldOptions struct { - // The ctype option instructs the C++ code generator to use a different - // representation of the field than it normally would. See the specific - // options below. This option is not yet implemented in the open source - // release -- sorry, we'll try to include it in a future version! - Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"` - // The packed option can be enabled for repeated primitive fields to enable - // a more efficient representation on the wire. Rather than repeatedly - // writing the tag and type for each element, the entire array is encoded as - // a single length-delimited blob. In proto3, only explicit setting it to - // false will avoid using packed encoding. - Packed *bool `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"` - // The jstype option determines the JavaScript type used for values of the - // field. The option is permitted only for 64 bit integral and fixed types - // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - // is represented as JavaScript string, which avoids loss of precision that - // can happen when a large value is converted to a floating point JavaScript. - // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - // use the JavaScript "number" type. The behavior of the default option - // JS_NORMAL is implementation dependent. - // - // This option is an enum to permit additional types to be added, e.g. - // goog.math.Integer. - Jstype *FieldOptions_JSType `protobuf:"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0" json:"jstype,omitempty"` - // Should this field be parsed lazily? Lazy applies only to message-type - // fields. It means that when the outer message is initially parsed, the - // inner message's contents will not be parsed but instead stored in encoded - // form. The inner message will actually be parsed when it is first accessed. - // - // This is only a hint. Implementations are free to choose whether to use - // eager or lazy parsing regardless of the value of this option. However, - // setting this option true suggests that the protocol author believes that - // using lazy parsing on this field is worth the additional bookkeeping - // overhead typically needed to implement it. - // - // This option does not affect the public interface of any generated code; - // all method signatures remain the same. Furthermore, thread-safety of the - // interface is not affected by this option; const methods remain safe to - // call from multiple threads concurrently, while non-const methods continue - // to require exclusive access. - // - // - // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outer message - // may return true even if the inner message has missing required fields. - // This is necessary because otherwise the inner message would have to be - // parsed in order to perform the check, defeating the purpose of lazy - // parsing. An implementation which chooses not to check required fields - // must be consistent about it. That is, for any particular sub-message, the - // implementation must either *always* check its required fields, or *never* - // check its required fields, regardless of whether or not the message has - // been parsed. - Lazy *bool `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"` - // Is this field deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for accessors, or it will be completely ignored; in the very least, this - // is a formalization for deprecating fields. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // For Google-internal migration only. Do not use. - Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - protoapi.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FieldOptions) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[12].MessageOf(m) -} -func (m *FieldOptions) Reset() { *m = FieldOptions{} } -func (m *FieldOptions) String() string { return protoapi.CompactTextString(m) } -func (*FieldOptions) ProtoMessage() {} -func (*FieldOptions) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{12} -} - -var extRange_FieldOptions = []protoapi.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*FieldOptions) ExtensionRangeArray() []protoapi.ExtensionRange { - return extRange_FieldOptions -} - -const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING -const Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL -const Default_FieldOptions_Lazy bool = false -const Default_FieldOptions_Deprecated bool = false -const Default_FieldOptions_Weak bool = false - -func (m *FieldOptions) GetCtype() FieldOptions_CType { - if m != nil && m.Ctype != nil { - return *m.Ctype - } - return Default_FieldOptions_Ctype -} - -func (m *FieldOptions) GetPacked() bool { - if m != nil && m.Packed != nil { - return *m.Packed - } - return false -} - -func (m *FieldOptions) GetJstype() FieldOptions_JSType { - if m != nil && m.Jstype != nil { - return *m.Jstype - } - return Default_FieldOptions_Jstype -} - -func (m *FieldOptions) GetLazy() bool { - if m != nil && m.Lazy != nil { - return *m.Lazy - } - return Default_FieldOptions_Lazy -} - -func (m *FieldOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_FieldOptions_Deprecated -} - -func (m *FieldOptions) GetWeak() bool { - if m != nil && m.Weak != nil { - return *m.Weak - } - return Default_FieldOptions_Weak -} - -func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type OneofOptions struct { - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - protoapi.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OneofOptions) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[13].MessageOf(m) -} -func (m *OneofOptions) Reset() { *m = OneofOptions{} } -func (m *OneofOptions) String() string { return protoapi.CompactTextString(m) } -func (*OneofOptions) ProtoMessage() {} -func (*OneofOptions) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{13} -} - -var extRange_OneofOptions = []protoapi.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*OneofOptions) ExtensionRangeArray() []protoapi.ExtensionRange { - return extRange_OneofOptions -} - -func (m *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type EnumOptions struct { - // Set this option to true to allow mapping different tag names to the same - // value. - AllowAlias *bool `protobuf:"varint,2,opt,name=allow_alias,json=allowAlias" json:"allow_alias,omitempty"` - // Is this enum deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum, or it will be completely ignored; in the very least, this - // is a formalization for deprecating enums. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - protoapi.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumOptions) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[14].MessageOf(m) -} -func (m *EnumOptions) Reset() { *m = EnumOptions{} } -func (m *EnumOptions) String() string { return protoapi.CompactTextString(m) } -func (*EnumOptions) ProtoMessage() {} -func (*EnumOptions) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{14} -} - -var extRange_EnumOptions = []protoapi.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*EnumOptions) ExtensionRangeArray() []protoapi.ExtensionRange { - return extRange_EnumOptions -} - -const Default_EnumOptions_Deprecated bool = false - -func (m *EnumOptions) GetAllowAlias() bool { - if m != nil && m.AllowAlias != nil { - return *m.AllowAlias - } - return false -} - -func (m *EnumOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_EnumOptions_Deprecated -} - -func (m *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type EnumValueOptions struct { - // Is this enum value deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum value, or it will be completely ignored; in the very least, - // this is a formalization for deprecating enum values. - Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - protoapi.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumValueOptions) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[15].MessageOf(m) -} -func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} } -func (m *EnumValueOptions) String() string { return protoapi.CompactTextString(m) } -func (*EnumValueOptions) ProtoMessage() {} -func (*EnumValueOptions) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{15} -} - -var extRange_EnumValueOptions = []protoapi.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*EnumValueOptions) ExtensionRangeArray() []protoapi.ExtensionRange { - return extRange_EnumValueOptions -} - -const Default_EnumValueOptions_Deprecated bool = false - -func (m *EnumValueOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_EnumValueOptions_Deprecated -} - -func (m *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type ServiceOptions struct { - // Is this service deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the service, or it will be completely ignored; in the very least, - // this is a formalization for deprecating services. - Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - protoapi.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +// Symbols defined in public import of google/protobuf/descriptor.proto + +type FieldDescriptorProto_Type = descriptor.FieldDescriptorProto_Type -func (m *ServiceOptions) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[16].MessageOf(m) -} -func (m *ServiceOptions) Reset() { *m = ServiceOptions{} } -func (m *ServiceOptions) String() string { return protoapi.CompactTextString(m) } -func (*ServiceOptions) ProtoMessage() {} -func (*ServiceOptions) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{16} -} - -var extRange_ServiceOptions = []protoapi.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*ServiceOptions) ExtensionRangeArray() []protoapi.ExtensionRange { - return extRange_ServiceOptions -} - -const Default_ServiceOptions_Deprecated bool = false - -func (m *ServiceOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_ServiceOptions_Deprecated -} - -func (m *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type MethodOptions struct { - // Is this method deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the method, or it will be completely ignored; in the very least, - // this is a formalization for deprecating methods. - Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - protoapi.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MethodOptions) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[17].MessageOf(m) -} -func (m *MethodOptions) Reset() { *m = MethodOptions{} } -func (m *MethodOptions) String() string { return protoapi.CompactTextString(m) } -func (*MethodOptions) ProtoMessage() {} -func (*MethodOptions) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{17} -} - -var extRange_MethodOptions = []protoapi.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*MethodOptions) ExtensionRangeArray() []protoapi.ExtensionRange { - return extRange_MethodOptions -} - -const Default_MethodOptions_Deprecated bool = false -const Default_MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN - -func (m *MethodOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_MethodOptions_Deprecated -} - -func (m *MethodOptions) GetIdempotencyLevel() MethodOptions_IdempotencyLevel { - if m != nil && m.IdempotencyLevel != nil { - return *m.IdempotencyLevel - } - return Default_MethodOptions_IdempotencyLevel -} - -func (m *MethodOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -// A message representing a option the parser does not recognize. This only -// appears in options protos created by the compiler::Parser class. -// DescriptorPool resolves these when building Descriptor objects. Therefore, -// options protos in descriptor objects (e.g. returned by Descriptor::options(), -// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -// in them. -type UninterpretedOption struct { - Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` - // The value of the uninterpreted option, in whatever type the tokenizer - // identified it as during parsing. Exactly one of these should be set. - IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` - PositiveIntValue *uint64 `protobuf:"varint,4,opt,name=positive_int_value,json=positiveIntValue" json:"positive_int_value,omitempty"` - NegativeIntValue *int64 `protobuf:"varint,5,opt,name=negative_int_value,json=negativeIntValue" json:"negative_int_value,omitempty"` - DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` - StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` - AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UninterpretedOption) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[18].MessageOf(m) -} -func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} } -func (m *UninterpretedOption) String() string { return protoapi.CompactTextString(m) } -func (*UninterpretedOption) ProtoMessage() {} -func (*UninterpretedOption) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{18} -} - -func (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart { - if m != nil { - return m.Name - } - return nil -} - -func (m *UninterpretedOption) GetIdentifierValue() string { - if m != nil && m.IdentifierValue != nil { - return *m.IdentifierValue - } - return "" -} - -func (m *UninterpretedOption) GetPositiveIntValue() uint64 { - if m != nil && m.PositiveIntValue != nil { - return *m.PositiveIntValue - } - return 0 -} - -func (m *UninterpretedOption) GetNegativeIntValue() int64 { - if m != nil && m.NegativeIntValue != nil { - return *m.NegativeIntValue - } - return 0 -} - -func (m *UninterpretedOption) GetDoubleValue() float64 { - if m != nil && m.DoubleValue != nil { - return *m.DoubleValue - } - return 0 -} - -func (m *UninterpretedOption) GetStringValue() []byte { - if m != nil { - return m.StringValue - } - return nil -} - -func (m *UninterpretedOption) GetAggregateValue() string { - if m != nil && m.AggregateValue != nil { - return *m.AggregateValue - } - return "" -} - -// Encapsulates information about the original source file from which a -// FileDescriptorProto was generated. -type SourceCodeInfo struct { - // A Location identifies a piece of source code in a .proto file which - // corresponds to a particular definition. This information is intended - // to be useful to IDEs, code indexers, documentation generators, and similar - // tools. - // - // For example, say we have a file like: - // message Foo { - // optional string foo = 1; - // } - // Let's look at just the field definition: - // optional string foo = 1; - // ^ ^^ ^^ ^ ^^^ - // a bc de f ghi - // We have the following locations: - // span path represents - // [a,i) [ 4, 0, 2, 0 ] The whole field definition. - // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - // - // Notes: - // - A location may refer to a repeated field itself (i.e. not to any - // particular index within it). This is used whenever a set of elements are - // logically enclosed in a single code segment. For example, an entire - // extend block (possibly containing multiple extension definitions) will - // have an outer location whose path refers to the "extensions" repeated - // field without an index. - // - Multiple locations may have the same path. This happens when a single - // logical declaration is spread out across multiple places. The most - // obvious example is the "extend" block again -- there may be multiple - // extend blocks in the same scope, each of which will have the same path. - // - A location's span is not always a subset of its parent's span. For - // example, the "extendee" of an extension declaration appears at the - // beginning of the "extend" block and is shared by all extensions within - // the block. - // - Just because a location's span is a subset of some other location's span - // does not mean that it is a descendent. For example, a "group" defines - // both a type and a field in a single declaration. Thus, the locations - // corresponding to the type and field and their components will overlap. - // - Code which tries to interpret locations should probably be designed to - // ignore those that it doesn't understand, as more types of locations could - // be recorded in the future. - Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SourceCodeInfo) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[19].MessageOf(m) -} -func (m *SourceCodeInfo) Reset() { *m = SourceCodeInfo{} } -func (m *SourceCodeInfo) String() string { return protoapi.CompactTextString(m) } -func (*SourceCodeInfo) ProtoMessage() {} -func (*SourceCodeInfo) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{19} -} - -func (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { - if m != nil { - return m.Location - } - return nil -} +const FieldDescriptorProto_TYPE_DOUBLE = descriptor.FieldDescriptorProto_TYPE_DOUBLE +const FieldDescriptorProto_TYPE_FLOAT = descriptor.FieldDescriptorProto_TYPE_FLOAT +const FieldDescriptorProto_TYPE_INT64 = descriptor.FieldDescriptorProto_TYPE_INT64 +const FieldDescriptorProto_TYPE_UINT64 = descriptor.FieldDescriptorProto_TYPE_UINT64 +const FieldDescriptorProto_TYPE_INT32 = descriptor.FieldDescriptorProto_TYPE_INT32 +const FieldDescriptorProto_TYPE_FIXED64 = descriptor.FieldDescriptorProto_TYPE_FIXED64 +const FieldDescriptorProto_TYPE_FIXED32 = descriptor.FieldDescriptorProto_TYPE_FIXED32 +const FieldDescriptorProto_TYPE_BOOL = descriptor.FieldDescriptorProto_TYPE_BOOL +const FieldDescriptorProto_TYPE_STRING = descriptor.FieldDescriptorProto_TYPE_STRING +const FieldDescriptorProto_TYPE_GROUP = descriptor.FieldDescriptorProto_TYPE_GROUP +const FieldDescriptorProto_TYPE_MESSAGE = descriptor.FieldDescriptorProto_TYPE_MESSAGE +const FieldDescriptorProto_TYPE_BYTES = descriptor.FieldDescriptorProto_TYPE_BYTES +const FieldDescriptorProto_TYPE_UINT32 = descriptor.FieldDescriptorProto_TYPE_UINT32 +const FieldDescriptorProto_TYPE_ENUM = descriptor.FieldDescriptorProto_TYPE_ENUM +const FieldDescriptorProto_TYPE_SFIXED32 = descriptor.FieldDescriptorProto_TYPE_SFIXED32 +const FieldDescriptorProto_TYPE_SFIXED64 = descriptor.FieldDescriptorProto_TYPE_SFIXED64 +const FieldDescriptorProto_TYPE_SINT32 = descriptor.FieldDescriptorProto_TYPE_SINT32 +const FieldDescriptorProto_TYPE_SINT64 = descriptor.FieldDescriptorProto_TYPE_SINT64 -// Describes the relationship between generated code and its original source -// file. A GeneratedCodeInfo message is associated with only one generated -// source file, but may contain references to different source .proto files. -type GeneratedCodeInfo struct { - // An Annotation connects some span of text in generated code to an element - // of its generating .proto file. - Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +var FieldDescriptorProto_Type_name = descriptor.FieldDescriptorProto_Type_name +var FieldDescriptorProto_Type_value = descriptor.FieldDescriptorProto_Type_value -func (m *GeneratedCodeInfo) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[20].MessageOf(m) -} -func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } -func (m *GeneratedCodeInfo) String() string { return protoapi.CompactTextString(m) } -func (*GeneratedCodeInfo) ProtoMessage() {} -func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{20} -} +type FieldDescriptorProto_Label = descriptor.FieldDescriptorProto_Label -func (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { - if m != nil { - return m.Annotation - } - return nil -} +const FieldDescriptorProto_LABEL_OPTIONAL = descriptor.FieldDescriptorProto_LABEL_OPTIONAL +const FieldDescriptorProto_LABEL_REQUIRED = descriptor.FieldDescriptorProto_LABEL_REQUIRED +const FieldDescriptorProto_LABEL_REPEATED = descriptor.FieldDescriptorProto_LABEL_REPEATED -type DescriptorProto_ExtensionRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +var FieldDescriptorProto_Label_name = descriptor.FieldDescriptorProto_Label_name +var FieldDescriptorProto_Label_value = descriptor.FieldDescriptorProto_Label_value -func (m *DescriptorProto_ExtensionRange) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[21].MessageOf(m) -} -func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} } -func (m *DescriptorProto_ExtensionRange) String() string { return protoapi.CompactTextString(m) } -func (*DescriptorProto_ExtensionRange) ProtoMessage() {} -func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{2, 0} -} +type FileOptions_OptimizeMode = descriptor.FileOptions_OptimizeMode -func (m *DescriptorProto_ExtensionRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} +const FileOptions_SPEED = descriptor.FileOptions_SPEED +const FileOptions_CODE_SIZE = descriptor.FileOptions_CODE_SIZE +const FileOptions_LITE_RUNTIME = descriptor.FileOptions_LITE_RUNTIME -func (m *DescriptorProto_ExtensionRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} +var FileOptions_OptimizeMode_name = descriptor.FileOptions_OptimizeMode_name +var FileOptions_OptimizeMode_value = descriptor.FileOptions_OptimizeMode_value -func (m *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions { - if m != nil { - return m.Options - } - return nil -} +type FieldOptions_CType = descriptor.FieldOptions_CType -// Range of reserved tag numbers. Reserved tag numbers may not be used by -// fields or extension ranges in the same message. Reserved ranges may -// not overlap. -type DescriptorProto_ReservedRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +const FieldOptions_STRING = descriptor.FieldOptions_STRING +const FieldOptions_CORD = descriptor.FieldOptions_CORD +const FieldOptions_STRING_PIECE = descriptor.FieldOptions_STRING_PIECE -func (m *DescriptorProto_ReservedRange) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[22].MessageOf(m) -} -func (m *DescriptorProto_ReservedRange) Reset() { *m = DescriptorProto_ReservedRange{} } -func (m *DescriptorProto_ReservedRange) String() string { return protoapi.CompactTextString(m) } -func (*DescriptorProto_ReservedRange) ProtoMessage() {} -func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{2, 1} -} +var FieldOptions_CType_name = descriptor.FieldOptions_CType_name +var FieldOptions_CType_value = descriptor.FieldOptions_CType_value -func (m *DescriptorProto_ReservedRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} +type FieldOptions_JSType = descriptor.FieldOptions_JSType -func (m *DescriptorProto_ReservedRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} +const FieldOptions_JS_NORMAL = descriptor.FieldOptions_JS_NORMAL +const FieldOptions_JS_STRING = descriptor.FieldOptions_JS_STRING +const FieldOptions_JS_NUMBER = descriptor.FieldOptions_JS_NUMBER -// Range of reserved numeric values. Reserved values may not be used by -// entries in the same enum. Reserved ranges may not overlap. -// -// Note that this is distinct from DescriptorProto.ReservedRange in that it -// is inclusive such that it can appropriately represent the entire int32 -// domain. -type EnumDescriptorProto_EnumReservedRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +var FieldOptions_JSType_name = descriptor.FieldOptions_JSType_name +var FieldOptions_JSType_value = descriptor.FieldOptions_JSType_value -func (m *EnumDescriptorProto_EnumReservedRange) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[23].MessageOf(m) -} -func (m *EnumDescriptorProto_EnumReservedRange) Reset() { *m = EnumDescriptorProto_EnumReservedRange{} } -func (m *EnumDescriptorProto_EnumReservedRange) String() string { return protoapi.CompactTextString(m) } -func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} -func (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{6, 0} -} +type MethodOptions_IdempotencyLevel = descriptor.MethodOptions_IdempotencyLevel -func (m *EnumDescriptorProto_EnumReservedRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} +const MethodOptions_IDEMPOTENCY_UNKNOWN = descriptor.MethodOptions_IDEMPOTENCY_UNKNOWN +const MethodOptions_NO_SIDE_EFFECTS = descriptor.MethodOptions_NO_SIDE_EFFECTS +const MethodOptions_IDEMPOTENT = descriptor.MethodOptions_IDEMPOTENT -func (m *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} +var MethodOptions_IdempotencyLevel_name = descriptor.MethodOptions_IdempotencyLevel_name +var MethodOptions_IdempotencyLevel_value = descriptor.MethodOptions_IdempotencyLevel_value -// The name of the uninterpreted option. Each string represents a segment in -// a dot-separated name. is_extension is true iff a segment represents an -// extension (denoted with parentheses in options specs in .proto files). -// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents -// "foo.(bar.baz).qux". -type UninterpretedOption_NamePart struct { - NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` - IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +type FileDescriptorSet = descriptor.FileDescriptorSet +type FileDescriptorProto = descriptor.FileDescriptorProto +type DescriptorProto = descriptor.DescriptorProto +type ExtensionRangeOptions = descriptor.ExtensionRangeOptions +type FieldDescriptorProto = descriptor.FieldDescriptorProto +type OneofDescriptorProto = descriptor.OneofDescriptorProto +type EnumDescriptorProto = descriptor.EnumDescriptorProto +type EnumValueDescriptorProto = descriptor.EnumValueDescriptorProto +type ServiceDescriptorProto = descriptor.ServiceDescriptorProto +type MethodDescriptorProto = descriptor.MethodDescriptorProto -func (m *UninterpretedOption_NamePart) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[24].MessageOf(m) -} -func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} } -func (m *UninterpretedOption_NamePart) String() string { return protoapi.CompactTextString(m) } -func (*UninterpretedOption_NamePart) ProtoMessage() {} -func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{18, 0} -} +const Default_MethodDescriptorProto_ClientStreaming = descriptor.Default_MethodDescriptorProto_ClientStreaming +const Default_MethodDescriptorProto_ServerStreaming = descriptor.Default_MethodDescriptorProto_ServerStreaming -func (m *UninterpretedOption_NamePart) GetNamePart() string { - if m != nil && m.NamePart != nil { - return *m.NamePart - } - return "" -} +type FileOptions = descriptor.FileOptions -func (m *UninterpretedOption_NamePart) GetIsExtension() bool { - if m != nil && m.IsExtension != nil { - return *m.IsExtension - } - return false -} +const Default_FileOptions_JavaMultipleFiles = descriptor.Default_FileOptions_JavaMultipleFiles +const Default_FileOptions_JavaStringCheckUtf8 = descriptor.Default_FileOptions_JavaStringCheckUtf8 +const Default_FileOptions_OptimizeFor = descriptor.Default_FileOptions_OptimizeFor +const Default_FileOptions_CcGenericServices = descriptor.Default_FileOptions_CcGenericServices +const Default_FileOptions_JavaGenericServices = descriptor.Default_FileOptions_JavaGenericServices +const Default_FileOptions_PyGenericServices = descriptor.Default_FileOptions_PyGenericServices +const Default_FileOptions_PhpGenericServices = descriptor.Default_FileOptions_PhpGenericServices +const Default_FileOptions_Deprecated = descriptor.Default_FileOptions_Deprecated +const Default_FileOptions_CcEnableArenas = descriptor.Default_FileOptions_CcEnableArenas -type SourceCodeInfo_Location struct { - // Identifies which part of the FileDescriptorProto was defined at this - // location. - // - // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition. For - // example, this path: - // [ 4, 3, 2, 7, 1 ] - // refers to: - // file.message_type(3) // 4, 3 - // .field(7) // 2, 7 - // .name() // 1 - // This is because FileDescriptorProto.message_type has field number 4: - // repeated DescriptorProto message_type = 4; - // and DescriptorProto.field has field number 2: - // repeated FieldDescriptorProto field = 2; - // and FieldDescriptorProto.name has field number 1: - // optional string name = 1; - // - // Thus, the above path gives the location of a field name. If we removed - // the last element: - // [ 4, 3, 2, 7 ] - // this path refers to the whole field declaration (from the beginning - // of the label to the terminating semicolon). - Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` - // Always has exactly three or four elements: start line, start column, - // end line (optional, otherwise assumed same as start line), end column. - // These are packed into a single field for efficiency. Note that line - // and column numbers are zero-based -- typically you will want to add - // 1 to each before displaying to a user. - Span []int32 `protobuf:"varint,2,rep,packed,name=span" json:"span,omitempty"` - // If this SourceCodeInfo represents a complete declaration, these are any - // comments appearing before and after the declaration which appear to be - // attached to the declaration. - // - // A series of line comments appearing on consecutive lines, with no other - // tokens appearing on those lines, will be treated as a single comment. - // - // leading_detached_comments will keep paragraphs of comments that appear - // before (but not connected to) the current element. Each paragraph, - // separated by empty lines, will be one comment element in the repeated - // field. - // - // Only the comment content is provided; comment markers (e.g. //) are - // stripped out. For block comments, leading whitespace and an asterisk - // will be stripped from the beginning of each line other than the first. - // Newlines are included in the output. - // - // Examples: - // - // optional int32 foo = 1; // Comment attached to foo. - // // Comment attached to bar. - // optional int32 bar = 2; - // - // optional string baz = 3; - // // Comment attached to baz. - // // Another line attached to baz. - // - // // Comment attached to qux. - // // - // // Another line attached to qux. - // optional double qux = 4; - // - // // Detached comment for corge. This is not leading or trailing comments - // // to qux or corge because there are blank lines separating it from - // // both. - // - // // Detached comment for corge paragraph 2. - // - // optional string corge = 5; - // /* Block comment attached - // * to corge. Leading asterisks - // * will be removed. */ - // /* Block comment attached to - // * grault. */ - // optional int32 grault = 6; - // - // // ignored detached comments. - LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` - TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` - LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +type MessageOptions = descriptor.MessageOptions -func (m *SourceCodeInfo_Location) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[25].MessageOf(m) -} -func (m *SourceCodeInfo_Location) Reset() { *m = SourceCodeInfo_Location{} } -func (m *SourceCodeInfo_Location) String() string { return protoapi.CompactTextString(m) } -func (*SourceCodeInfo_Location) ProtoMessage() {} -func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{19, 0} -} +const Default_MessageOptions_MessageSetWireFormat = descriptor.Default_MessageOptions_MessageSetWireFormat +const Default_MessageOptions_NoStandardDescriptorAccessor = descriptor.Default_MessageOptions_NoStandardDescriptorAccessor +const Default_MessageOptions_Deprecated = descriptor.Default_MessageOptions_Deprecated -func (m *SourceCodeInfo_Location) GetPath() []int32 { - if m != nil { - return m.Path - } - return nil -} +type FieldOptions = descriptor.FieldOptions -func (m *SourceCodeInfo_Location) GetSpan() []int32 { - if m != nil { - return m.Span - } - return nil -} +const Default_FieldOptions_Ctype = descriptor.Default_FieldOptions_Ctype +const Default_FieldOptions_Jstype = descriptor.Default_FieldOptions_Jstype +const Default_FieldOptions_Lazy = descriptor.Default_FieldOptions_Lazy +const Default_FieldOptions_Deprecated = descriptor.Default_FieldOptions_Deprecated +const Default_FieldOptions_Weak = descriptor.Default_FieldOptions_Weak -func (m *SourceCodeInfo_Location) GetLeadingComments() string { - if m != nil && m.LeadingComments != nil { - return *m.LeadingComments - } - return "" -} +type OneofOptions = descriptor.OneofOptions +type EnumOptions = descriptor.EnumOptions -func (m *SourceCodeInfo_Location) GetTrailingComments() string { - if m != nil && m.TrailingComments != nil { - return *m.TrailingComments - } - return "" -} +const Default_EnumOptions_Deprecated = descriptor.Default_EnumOptions_Deprecated -func (m *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { - if m != nil { - return m.LeadingDetachedComments - } - return nil -} +type EnumValueOptions = descriptor.EnumValueOptions -type GeneratedCodeInfo_Annotation struct { - // Identifies the element in the original source .proto file. This field - // is formatted the same as SourceCodeInfo.Location.path. - Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` - // Identifies the filesystem path to the original source .proto. - SourceFile *string `protobuf:"bytes,2,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"` - // Identifies the starting offset in bytes in the generated code - // that relates to the identified object. - Begin *int32 `protobuf:"varint,3,opt,name=begin" json:"begin,omitempty"` - // Identifies the ending offset in bytes in the generated code that - // relates to the identified offset. The end offset should be one past - // the last relevant byte (so the length of the text = end - begin). - End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +const Default_EnumValueOptions_Deprecated = descriptor.Default_EnumValueOptions_Deprecated -func (m *GeneratedCodeInfo_Annotation) ProtoReflect() protoreflect.Message { - return xxx_File_google_protobuf_descriptor_proto_messageTypes[26].MessageOf(m) -} -func (m *GeneratedCodeInfo_Annotation) Reset() { *m = GeneratedCodeInfo_Annotation{} } -func (m *GeneratedCodeInfo_Annotation) String() string { return protoapi.CompactTextString(m) } -func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} -func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{20, 0} -} +type ServiceOptions = descriptor.ServiceOptions -func (m *GeneratedCodeInfo_Annotation) GetPath() []int32 { - if m != nil { - return m.Path - } - return nil -} +const Default_ServiceOptions_Deprecated = descriptor.Default_ServiceOptions_Deprecated -func (m *GeneratedCodeInfo_Annotation) GetSourceFile() string { - if m != nil && m.SourceFile != nil { - return *m.SourceFile - } - return "" -} +type MethodOptions = descriptor.MethodOptions -func (m *GeneratedCodeInfo_Annotation) GetBegin() int32 { - if m != nil && m.Begin != nil { - return *m.Begin - } - return 0 -} +const Default_MethodOptions_Deprecated = descriptor.Default_MethodOptions_Deprecated +const Default_MethodOptions_IdempotencyLevel = descriptor.Default_MethodOptions_IdempotencyLevel -func (m *GeneratedCodeInfo_Annotation) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} +type UninterpretedOption = descriptor.UninterpretedOption +type SourceCodeInfo = descriptor.SourceCodeInfo +type GeneratedCodeInfo = descriptor.GeneratedCodeInfo +type DescriptorProto_ExtensionRange = descriptor.DescriptorProto_ExtensionRange +type DescriptorProto_ReservedRange = descriptor.DescriptorProto_ReservedRange +type EnumDescriptorProto_EnumReservedRange = descriptor.EnumDescriptorProto_EnumReservedRange +type UninterpretedOption_NamePart = descriptor.UninterpretedOption_NamePart +type SourceCodeInfo_Location = descriptor.SourceCodeInfo_Location +type GeneratedCodeInfo_Annotation = descriptor.GeneratedCodeInfo_Annotation func init() { - protoapi.RegisterFile("google/protobuf/descriptor.proto", xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped) - protoapi.RegisterEnum("google.protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value) - protoapi.RegisterEnum("google.protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value) - protoapi.RegisterEnum("google.protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value) - protoapi.RegisterEnum("google.protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value) - protoapi.RegisterEnum("google.protobuf.FieldOptions_JSType", FieldOptions_JSType_name, FieldOptions_JSType_value) - protoapi.RegisterEnum("google.protobuf.MethodOptions_IdempotencyLevel", MethodOptions_IdempotencyLevel_name, MethodOptions_IdempotencyLevel_value) - protoapi.RegisterType((*FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") - protoapi.RegisterType((*FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") - protoapi.RegisterType((*DescriptorProto)(nil), "google.protobuf.DescriptorProto") - protoapi.RegisterType((*ExtensionRangeOptions)(nil), "google.protobuf.ExtensionRangeOptions") - protoapi.RegisterType((*FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") - protoapi.RegisterType((*OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") - protoapi.RegisterType((*EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") - protoapi.RegisterType((*EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") - protoapi.RegisterType((*ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") - protoapi.RegisterType((*MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") - protoapi.RegisterType((*FileOptions)(nil), "google.protobuf.FileOptions") - protoapi.RegisterType((*MessageOptions)(nil), "google.protobuf.MessageOptions") - protoapi.RegisterType((*FieldOptions)(nil), "google.protobuf.FieldOptions") - protoapi.RegisterType((*OneofOptions)(nil), "google.protobuf.OneofOptions") - protoapi.RegisterType((*EnumOptions)(nil), "google.protobuf.EnumOptions") - protoapi.RegisterType((*EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") - protoapi.RegisterType((*ServiceOptions)(nil), "google.protobuf.ServiceOptions") - protoapi.RegisterType((*MethodOptions)(nil), "google.protobuf.MethodOptions") - protoapi.RegisterType((*UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") - protoapi.RegisterType((*SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") - protoapi.RegisterType((*GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") - protoapi.RegisterType((*DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") - protoapi.RegisterType((*DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") - protoapi.RegisterType((*EnumDescriptorProto_EnumReservedRange)(nil), "google.protobuf.EnumDescriptorProto.EnumReservedRange") - protoapi.RegisterType((*UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") - protoapi.RegisterType((*SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") - protoapi.RegisterType((*GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") + proto.RegisterFile("github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto", xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc_gzipped) } -var xxx_File_google_protobuf_descriptor_proto_rawdesc = []byte{ - // 7579 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x22, 0x4d, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x04, 0x66, 0x69, - 0x6c, 0x65, 0x22, 0xe4, 0x04, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65, - 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, - 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x70, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0a, 0x20, - 0x03, 0x28, 0x05, 0x52, 0x10, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x70, 0x65, 0x6e, - 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x65, 0x61, 0x6b, 0x5f, 0x64, 0x65, - 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0e, - 0x77, 0x65, 0x61, 0x6b, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x43, - 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e, - 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36, - 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x49, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, - 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x22, 0xb9, 0x06, 0x0a, 0x0f, 0x44, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x43, - 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74, - 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, - 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x65, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x05, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x52, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x64, 0x65, 0x63, - 0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, - 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x63, 0x6c, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, - 0x1a, 0x7a, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x40, 0x0a, 0x07, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x37, 0x0a, 0x0d, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x7c, 0x0a, 0x15, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, - 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, - 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, - 0x80, 0x80, 0x02, 0x22, 0x98, 0x06, 0x0a, 0x14, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, - 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, - 0x61, 0x62, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x3e, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74, - 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x64, 0x65, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, - 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, - 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x73, - 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6a, - 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x22, 0xb6, 0x02, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x06, 0x12, 0x10, 0x0a, - 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x07, 0x12, - 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x08, 0x12, 0x0f, - 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x09, 0x12, - 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x0a, 0x12, - 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, - 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, - 0x0c, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, - 0x10, 0x0d, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, - 0x0e, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, - 0x33, 0x32, 0x10, 0x0f, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, - 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x10, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x11, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x12, 0x22, 0x43, 0x0a, 0x05, 0x4c, 0x61, 0x62, - 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, - 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, - 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, - 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x50, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x63, - 0x0a, 0x14, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, - 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x22, 0xe3, 0x02, 0x0a, 0x13, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x3f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x36, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, - 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5d, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, - 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x3b, 0x0a, 0x11, - 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x45, 0x6e, - 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, - 0xa7, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, - 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x39, - 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x89, 0x02, 0x0a, 0x15, 0x4d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, - 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x75, 0x74, - 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x30, 0x0a, 0x10, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, - 0x73, 0x65, 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x69, 0x6e, 0x67, 0x12, 0x30, 0x0a, 0x10, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, - 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, - 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x22, 0x92, 0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, - 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6a, 0x61, 0x76, - 0x61, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x6a, 0x61, 0x76, 0x61, - 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6a, 0x61, 0x76, 0x61, 0x4f, 0x75, 0x74, 0x65, - 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x6a, 0x61, - 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, - 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, - 0x6a, 0x61, 0x76, 0x61, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x65, - 0x73, 0x12, 0x44, 0x0a, 0x1d, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x5f, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x68, 0x61, - 0x73, 0x68, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x19, 0x6a, 0x61, - 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x73, - 0x41, 0x6e, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3a, 0x0a, 0x16, 0x6a, 0x61, 0x76, 0x61, 0x5f, - 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x75, 0x74, 0x66, - 0x38, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, - 0x6a, 0x61, 0x76, 0x61, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, - 0x74, 0x66, 0x38, 0x12, 0x53, 0x0a, 0x0c, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, - 0x66, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, - 0x4d, 0x6f, 0x64, 0x65, 0x3a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x52, 0x0b, 0x6f, 0x70, 0x74, - 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x46, 0x6f, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x5f, 0x70, - 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, - 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x63, 0x63, 0x5f, 0x67, 0x65, - 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x10, - 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x63, 0x63, 0x47, - 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x39, - 0x0a, 0x15, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, - 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, - 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x13, 0x70, 0x79, 0x5f, - 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, - 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x70, - 0x79, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, - 0x12, 0x37, 0x0a, 0x14, 0x70, 0x68, 0x70, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x2a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, - 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x12, 0x70, 0x68, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, - 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, - 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, - 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x12, 0x2f, 0x0a, 0x10, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, - 0x65, 0x6e, 0x61, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, - 0x65, 0x52, 0x0e, 0x63, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x72, 0x65, 0x6e, 0x61, - 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, - 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x24, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6f, 0x62, - 0x6a, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x29, 0x0a, - 0x10, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x4e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x77, 0x69, 0x66, - 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x27, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x73, 0x77, 0x69, 0x66, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x28, 0x0a, 0x10, 0x70, - 0x68, 0x70, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, - 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x68, 0x70, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, - 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x68, 0x70, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x29, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x68, - 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x70, 0x68, - 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x18, 0x2c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x70, 0x68, 0x70, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x75, 0x62, 0x79, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, - 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x75, 0x62, 0x79, 0x50, 0x61, 0x63, 0x6b, - 0x61, 0x67, 0x65, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, - 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, - 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x0a, - 0x0c, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x09, 0x0a, - 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x44, 0x45, - 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x49, 0x54, 0x45, 0x5f, - 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x03, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, - 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x26, 0x10, 0x27, 0x22, 0xd1, 0x02, 0x0a, 0x0e, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, - 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, - 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, - 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, - 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4c, 0x0a, 0x1f, 0x6e, - 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x1c, 0x6e, 0x6f, 0x53, - 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, - 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, - 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x58, 0x0a, - 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, - 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, - 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, - 0x80, 0x02, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0xe2, - 0x03, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x41, 0x0a, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, - 0x79, 0x70, 0x65, 0x3a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, - 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, - 0x3a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x25, - 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, - 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, - 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, - 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, - 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2f, 0x0a, 0x05, 0x43, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, - 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x44, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, - 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, 0x43, 0x45, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x06, 0x4a, - 0x53, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, - 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, - 0x47, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, - 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, - 0x04, 0x10, 0x05, 0x22, 0x73, 0x0a, 0x0c, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, - 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, - 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, - 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xc0, 0x01, 0x0a, 0x0b, 0x45, 0x6e, 0x75, - 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, - 0x77, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, - 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, - 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, - 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, - 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, - 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, - 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0x9e, 0x01, 0x0a, 0x10, - 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, - 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9c, 0x01, 0x0a, - 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, - 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, - 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, - 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, - 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xe0, 0x02, 0x0a, 0x0d, - 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, - 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, - 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, - 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x11, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, - 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, - 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, - 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x22, 0x50, 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, - 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, - 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, - 0x0a, 0x0f, 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, - 0x53, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, - 0x54, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9a, - 0x03, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, - 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x50, - 0x61, 0x72, 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, - 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x10, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, - 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, - 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, - 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, - 0x4a, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, - 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, - 0x6e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x65, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, - 0x69, 0x73, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa7, 0x02, 0x0a, 0x0e, - 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, - 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, - 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, - 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, 0x61, - 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, 0x61, - 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, 0x61, - 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, - 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, - 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, 0x61, - 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, - 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, 0x65, - 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd1, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a, 0x61, - 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, - 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x6d, 0x0a, 0x0a, 0x41, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, - 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x42, 0x8f, 0x01, 0x0a, 0x13, 0x63, 0x6f, - 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x3b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, - 0x1a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, +var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc = []byte{ + // 172 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, + 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x3b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x00, } -var xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_descriptor_proto_rawdesc) +var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) -var File_google_protobuf_descriptor_proto protoreflect.FileDescriptor +var File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto protoreflect.FileDescriptor -var xxx_File_google_protobuf_descriptor_proto_enumTypes = make([]protoreflect.EnumType, 6) -var xxx_File_google_protobuf_descriptor_proto_messageTypes = make([]protoimpl.MessageType, 27) -var xxx_File_google_protobuf_descriptor_proto_goTypes = []interface{}{ - (FieldDescriptorProto_Type)(0), // 0: google.protobuf.FieldDescriptorProto.Type - (FieldDescriptorProto_Label)(0), // 1: google.protobuf.FieldDescriptorProto.Label - (FileOptions_OptimizeMode)(0), // 2: google.protobuf.FileOptions.OptimizeMode - (FieldOptions_CType)(0), // 3: google.protobuf.FieldOptions.CType - (FieldOptions_JSType)(0), // 4: google.protobuf.FieldOptions.JSType - (MethodOptions_IdempotencyLevel)(0), // 5: google.protobuf.MethodOptions.IdempotencyLevel - (*FileDescriptorSet)(nil), // 6: google.protobuf.FileDescriptorSet - (*FileDescriptorProto)(nil), // 7: google.protobuf.FileDescriptorProto - (*DescriptorProto)(nil), // 8: google.protobuf.DescriptorProto - (*ExtensionRangeOptions)(nil), // 9: google.protobuf.ExtensionRangeOptions - (*FieldDescriptorProto)(nil), // 10: google.protobuf.FieldDescriptorProto - (*OneofDescriptorProto)(nil), // 11: google.protobuf.OneofDescriptorProto - (*EnumDescriptorProto)(nil), // 12: google.protobuf.EnumDescriptorProto - (*EnumValueDescriptorProto)(nil), // 13: google.protobuf.EnumValueDescriptorProto - (*ServiceDescriptorProto)(nil), // 14: google.protobuf.ServiceDescriptorProto - (*MethodDescriptorProto)(nil), // 15: google.protobuf.MethodDescriptorProto - (*FileOptions)(nil), // 16: google.protobuf.FileOptions - (*MessageOptions)(nil), // 17: google.protobuf.MessageOptions - (*FieldOptions)(nil), // 18: google.protobuf.FieldOptions - (*OneofOptions)(nil), // 19: google.protobuf.OneofOptions - (*EnumOptions)(nil), // 20: google.protobuf.EnumOptions - (*EnumValueOptions)(nil), // 21: google.protobuf.EnumValueOptions - (*ServiceOptions)(nil), // 22: google.protobuf.ServiceOptions - (*MethodOptions)(nil), // 23: google.protobuf.MethodOptions - (*UninterpretedOption)(nil), // 24: google.protobuf.UninterpretedOption - (*SourceCodeInfo)(nil), // 25: google.protobuf.SourceCodeInfo - (*GeneratedCodeInfo)(nil), // 26: google.protobuf.GeneratedCodeInfo - (*DescriptorProto_ExtensionRange)(nil), // 27: google.protobuf.DescriptorProto.ExtensionRange - (*DescriptorProto_ReservedRange)(nil), // 28: google.protobuf.DescriptorProto.ReservedRange - (*EnumDescriptorProto_EnumReservedRange)(nil), // 29: google.protobuf.EnumDescriptorProto.EnumReservedRange - (*UninterpretedOption_NamePart)(nil), // 30: google.protobuf.UninterpretedOption.NamePart - (*SourceCodeInfo_Location)(nil), // 31: google.protobuf.SourceCodeInfo.Location - (*GeneratedCodeInfo_Annotation)(nil), // 32: google.protobuf.GeneratedCodeInfo.Annotation -} -var xxx_File_google_protobuf_descriptor_proto_depIdxs = []int32{ - 7, // google.protobuf.FileDescriptorSet.file:type_name -> google.protobuf.FileDescriptorProto - 8, // google.protobuf.FileDescriptorProto.message_type:type_name -> google.protobuf.DescriptorProto - 12, // google.protobuf.FileDescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto - 14, // google.protobuf.FileDescriptorProto.service:type_name -> google.protobuf.ServiceDescriptorProto - 10, // google.protobuf.FileDescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto - 16, // google.protobuf.FileDescriptorProto.options:type_name -> google.protobuf.FileOptions - 25, // google.protobuf.FileDescriptorProto.source_code_info:type_name -> google.protobuf.SourceCodeInfo - 10, // google.protobuf.DescriptorProto.field:type_name -> google.protobuf.FieldDescriptorProto - 10, // google.protobuf.DescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto - 8, // google.protobuf.DescriptorProto.nested_type:type_name -> google.protobuf.DescriptorProto - 12, // google.protobuf.DescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto - 27, // google.protobuf.DescriptorProto.extension_range:type_name -> google.protobuf.DescriptorProto.ExtensionRange - 11, // google.protobuf.DescriptorProto.oneof_decl:type_name -> google.protobuf.OneofDescriptorProto - 17, // google.protobuf.DescriptorProto.options:type_name -> google.protobuf.MessageOptions - 28, // google.protobuf.DescriptorProto.reserved_range:type_name -> google.protobuf.DescriptorProto.ReservedRange - 24, // google.protobuf.ExtensionRangeOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 1, // google.protobuf.FieldDescriptorProto.label:type_name -> google.protobuf.FieldDescriptorProto.Label - 0, // google.protobuf.FieldDescriptorProto.type:type_name -> google.protobuf.FieldDescriptorProto.Type - 18, // google.protobuf.FieldDescriptorProto.options:type_name -> google.protobuf.FieldOptions - 19, // google.protobuf.OneofDescriptorProto.options:type_name -> google.protobuf.OneofOptions - 13, // google.protobuf.EnumDescriptorProto.value:type_name -> google.protobuf.EnumValueDescriptorProto - 20, // google.protobuf.EnumDescriptorProto.options:type_name -> google.protobuf.EnumOptions - 29, // google.protobuf.EnumDescriptorProto.reserved_range:type_name -> google.protobuf.EnumDescriptorProto.EnumReservedRange - 21, // google.protobuf.EnumValueDescriptorProto.options:type_name -> google.protobuf.EnumValueOptions - 15, // google.protobuf.ServiceDescriptorProto.method:type_name -> google.protobuf.MethodDescriptorProto - 22, // google.protobuf.ServiceDescriptorProto.options:type_name -> google.protobuf.ServiceOptions - 23, // google.protobuf.MethodDescriptorProto.options:type_name -> google.protobuf.MethodOptions - 2, // google.protobuf.FileOptions.optimize_for:type_name -> google.protobuf.FileOptions.OptimizeMode - 24, // google.protobuf.FileOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 24, // google.protobuf.MessageOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 3, // google.protobuf.FieldOptions.ctype:type_name -> google.protobuf.FieldOptions.CType - 4, // google.protobuf.FieldOptions.jstype:type_name -> google.protobuf.FieldOptions.JSType - 24, // google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 24, // google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 24, // google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 24, // google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 24, // google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 5, // google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel - 24, // google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 30, // google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart - 31, // google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location - 32, // google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation - 9, // google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions -} +var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = []interface{}{} +var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = []int32{} -func init() { xxx_File_google_protobuf_descriptor_proto_init() } -func xxx_File_google_protobuf_descriptor_proto_init() { - if File_google_protobuf_descriptor_proto != nil { +func init() { xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_init() } +func xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_init() { + if File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto != nil { return } - messageTypes := make([]protoreflect.MessageType, 27) - File_google_protobuf_descriptor_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_google_protobuf_descriptor_proto_rawdesc, - GoTypes: xxx_File_google_protobuf_descriptor_proto_goTypes, - DependencyIndexes: xxx_File_google_protobuf_descriptor_proto_depIdxs, - EnumOutputTypes: xxx_File_google_protobuf_descriptor_proto_enumTypes, - MessageOutputTypes: messageTypes, + File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto = protoimpl.FileBuilder{ + RawDescriptor: xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc, + GoTypes: xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes, + DependencyIndexes: xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs, }.Init() - messageGoTypes := xxx_File_google_protobuf_descriptor_proto_goTypes[6:][:27] - for i, mt := range messageTypes { - xxx_File_google_protobuf_descriptor_proto_messageTypes[i].GoType = reflect.TypeOf(messageGoTypes[i]) - xxx_File_google_protobuf_descriptor_proto_messageTypes[i].PBType = mt - } - prototype.X.RegisterExtensionRangeOptions((*ExtensionRangeOptions)(nil)) - prototype.X.RegisterFileOptions((*FileOptions)(nil)) - prototype.X.RegisterMessageOptions((*MessageOptions)(nil)) - prototype.X.RegisterFieldOptions((*FieldOptions)(nil)) - prototype.X.RegisterOneofOptions((*OneofOptions)(nil)) - prototype.X.RegisterEnumOptions((*EnumOptions)(nil)) - prototype.X.RegisterEnumValueOptions((*EnumValueOptions)(nil)) - prototype.X.RegisterServiceOptions((*ServiceOptions)(nil)) - prototype.X.RegisterMethodOptions((*MethodOptions)(nil)) - xxx_File_google_protobuf_descriptor_proto_goTypes = nil - xxx_File_google_protobuf_descriptor_proto_depIdxs = nil + xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = nil + xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = nil } diff --git a/protoc-gen-go/descriptor/descriptor.proto b/protoc-gen-go/descriptor/descriptor.proto index ed08fcbc54..c75b4ea950 100644 --- a/protoc-gen-go/descriptor/descriptor.proto +++ b/protoc-gen-go/descriptor/descriptor.proto @@ -1,883 +1,3 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. -// -// The messages in this file describe the definitions found in .proto files. -// A valid .proto file can be translated directly to a FileDescriptorProto -// without any other information (e.g. without reading its imports). - - syntax = "proto2"; - -package google.protobuf; option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "DescriptorProtos"; -option csharp_namespace = "Google.Protobuf.Reflection"; -option objc_class_prefix = "GPB"; -option cc_enable_arenas = true; - -// descriptor.proto must be optimized for speed because reflection-based -// algorithms don't work during bootstrapping. -option optimize_for = SPEED; - -// The protocol compiler can output a FileDescriptorSet containing the .proto -// files it parses. -message FileDescriptorSet { - repeated FileDescriptorProto file = 1; -} - -// Describes a complete .proto file. -message FileDescriptorProto { - optional string name = 1; // file name, relative to root of source tree - optional string package = 2; // e.g. "foo", "foo.bar", etc. - - // Names of files imported by this file. - repeated string dependency = 3; - // Indexes of the public imported files in the dependency list above. - repeated int32 public_dependency = 10; - // Indexes of the weak imported files in the dependency list. - // For Google-internal migration only. Do not use. - repeated int32 weak_dependency = 11; - - // All top-level definitions in this file. - repeated DescriptorProto message_type = 4; - repeated EnumDescriptorProto enum_type = 5; - repeated ServiceDescriptorProto service = 6; - repeated FieldDescriptorProto extension = 7; - - optional FileOptions options = 8; - - // This field contains optional information about the original source code. - // You may safely remove this entire field without harming runtime - // functionality of the descriptors -- the information is needed only by - // development tools. - optional SourceCodeInfo source_code_info = 9; - - // The syntax of the proto file. - // The supported values are "proto2" and "proto3". - optional string syntax = 12; -} - -// Describes a message type. -message DescriptorProto { - optional string name = 1; - - repeated FieldDescriptorProto field = 2; - repeated FieldDescriptorProto extension = 6; - - repeated DescriptorProto nested_type = 3; - repeated EnumDescriptorProto enum_type = 4; - - message ExtensionRange { - optional int32 start = 1; - optional int32 end = 2; - - optional ExtensionRangeOptions options = 3; - } - repeated ExtensionRange extension_range = 5; - - repeated OneofDescriptorProto oneof_decl = 8; - - optional MessageOptions options = 7; - - // Range of reserved tag numbers. Reserved tag numbers may not be used by - // fields or extension ranges in the same message. Reserved ranges may - // not overlap. - message ReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. - } - repeated ReservedRange reserved_range = 9; - // Reserved field names, which may not be used by fields in the same message. - // A given name may only be reserved once. - repeated string reserved_name = 10; -} - -message ExtensionRangeOptions { - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -// Describes a field within a message. -message FieldDescriptorProto { - enum Type { - // 0 is reserved for errors. - // Order is weird for historical reasons. - TYPE_DOUBLE = 1; - TYPE_FLOAT = 2; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - // negative values are likely. - TYPE_INT64 = 3; - TYPE_UINT64 = 4; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - // negative values are likely. - TYPE_INT32 = 5; - TYPE_FIXED64 = 6; - TYPE_FIXED32 = 7; - TYPE_BOOL = 8; - TYPE_STRING = 9; - // Tag-delimited aggregate. - // Group type is deprecated and not supported in proto3. However, Proto3 - // implementations should still be able to parse the group wire format and - // treat group fields as unknown fields. - TYPE_GROUP = 10; - TYPE_MESSAGE = 11; // Length-delimited aggregate. - - // New in version 2. - TYPE_BYTES = 12; - TYPE_UINT32 = 13; - TYPE_ENUM = 14; - TYPE_SFIXED32 = 15; - TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; // Uses ZigZag encoding. - TYPE_SINT64 = 18; // Uses ZigZag encoding. - }; - - enum Label { - // 0 is reserved for errors - LABEL_OPTIONAL = 1; - LABEL_REQUIRED = 2; - LABEL_REPEATED = 3; - }; - - optional string name = 1; - optional int32 number = 3; - optional Label label = 4; - - // If type_name is set, this need not be set. If both this and type_name - // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - optional Type type = 5; - - // For message and enum types, this is the name of the type. If the name - // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - // rules are used to find the type (i.e. first the nested types within this - // message are searched, then within the parent, on up to the root - // namespace). - optional string type_name = 6; - - // For extensions, this is the name of the type being extended. It is - // resolved in the same manner as type_name. - optional string extendee = 2; - - // For numeric types, contains the original text representation of the value. - // For booleans, "true" or "false". - // For strings, contains the default text contents (not escaped in any way). - // For bytes, contains the C escaped value. All bytes >= 128 are escaped. - // TODO(kenton): Base-64 encode? - optional string default_value = 7; - - // If set, gives the index of a oneof in the containing type's oneof_decl - // list. This field is a member of that oneof. - optional int32 oneof_index = 9; - - // JSON name of this field. The value is set by protocol compiler. If the - // user has set a "json_name" option on this field, that option's value - // will be used. Otherwise, it's deduced from the field's name by converting - // it to camelCase. - optional string json_name = 10; - - optional FieldOptions options = 8; -} - -// Describes a oneof. -message OneofDescriptorProto { - optional string name = 1; - optional OneofOptions options = 2; -} - -// Describes an enum type. -message EnumDescriptorProto { - optional string name = 1; - - repeated EnumValueDescriptorProto value = 2; - - optional EnumOptions options = 3; - - // Range of reserved numeric values. Reserved values may not be used by - // entries in the same enum. Reserved ranges may not overlap. - // - // Note that this is distinct from DescriptorProto.ReservedRange in that it - // is inclusive such that it can appropriately represent the entire int32 - // domain. - message EnumReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Inclusive. - } - - // Range of reserved numeric values. Reserved numeric values may not be used - // by enum values in the same enum declaration. Reserved ranges may not - // overlap. - repeated EnumReservedRange reserved_range = 4; - - // Reserved enum value names, which may not be reused. A given name may only - // be reserved once. - repeated string reserved_name = 5; -} - -// Describes a value within an enum. -message EnumValueDescriptorProto { - optional string name = 1; - optional int32 number = 2; - - optional EnumValueOptions options = 3; -} - -// Describes a service. -message ServiceDescriptorProto { - optional string name = 1; - repeated MethodDescriptorProto method = 2; - - optional ServiceOptions options = 3; -} - -// Describes a method of a service. -message MethodDescriptorProto { - optional string name = 1; - - // Input and output type names. These are resolved in the same way as - // FieldDescriptorProto.type_name, but must refer to a message type. - optional string input_type = 2; - optional string output_type = 3; - - optional MethodOptions options = 4; - - // Identifies if client streams multiple client messages - optional bool client_streaming = 5 [default=false]; - // Identifies if server streams multiple server messages - optional bool server_streaming = 6 [default=false]; -} - - -// =================================================================== -// Options - -// Each of the definitions above may have "options" attached. These are -// just annotations which may cause code to be generated slightly differently -// or may contain hints for code that manipulates protocol messages. -// -// Clients may define custom options as extensions of the *Options messages. -// These extensions may not yet be known at parsing time, so the parser cannot -// store the values in them. Instead it stores them in a field in the *Options -// message called uninterpreted_option. This field must have the same name -// across all *Options messages. We then use this field to populate the -// extensions when we build a descriptor, at which point all protos have been -// parsed and so all extensions are known. -// -// Extension numbers for custom options may be chosen as follows: -// * For options which will only be used within a single application or -// organization, or for experimental options, use field numbers 50000 -// through 99999. It is up to you to ensure that you do not use the -// same number for multiple options. -// * For options which will be published and used publicly by multiple -// independent entities, e-mail protobuf-global-extension-registry@google.com -// to reserve extension numbers. Simply provide your project name (e.g. -// Objective-C plugin) and your project website (if available) -- there's no -// need to explain how you intend to use them. Usually you only need one -// extension number. You can declare multiple options with only one extension -// number by putting them in a sub-message. See the Custom Options section of -// the docs for examples: -// https://developers.google.com/protocol-buffers/docs/proto#options -// If this turns out to be popular, a web service will be set up -// to automatically assign option numbers. - - -message FileOptions { - - // Sets the Java package where classes generated from this .proto will be - // placed. By default, the proto package is used, but this is often - // inappropriate because proto packages do not normally start with backwards - // domain names. - optional string java_package = 1; - - - // If set, all the classes from the .proto file are wrapped in a single - // outer class with the given name. This applies to both Proto1 - // (equivalent to the old "--one_java_file" option) and Proto2 (where - // a .proto always translates to a single class, but you may want to - // explicitly choose the class name). - optional string java_outer_classname = 8; - - // If set true, then the Java code generator will generate a separate .java - // file for each top-level message, enum, and service defined in the .proto - // file. Thus, these types will *not* be nested inside the outer class - // named by java_outer_classname. However, the outer class will still be - // generated to contain the file's getDescriptor() method as well as any - // top-level extensions defined in the file. - optional bool java_multiple_files = 10 [default=false]; - - // This option does nothing. - optional bool java_generate_equals_and_hash = 20 [deprecated=true]; - - // If set true, then the Java2 code generator will generate code that - // throws an exception whenever an attempt is made to assign a non-UTF-8 - // byte sequence to a string field. - // Message reflection will do the same. - // However, an extension field still accepts non-UTF-8 byte sequences. - // This option has no effect on when used with the lite runtime. - optional bool java_string_check_utf8 = 27 [default=false]; - - - // Generated classes can be optimized for speed or code size. - enum OptimizeMode { - SPEED = 1; // Generate complete code for parsing, serialization, - // etc. - CODE_SIZE = 2; // Use ReflectionOps to implement these methods. - LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. - } - optional OptimizeMode optimize_for = 9 [default=SPEED]; - - // Sets the Go package where structs generated from this .proto will be - // placed. If omitted, the Go package will be derived from the following: - // - The basename of the package import path, if provided. - // - Otherwise, the package statement in the .proto file, if present. - // - Otherwise, the basename of the .proto file, without extension. - optional string go_package = 11; - - - - // Should generic services be generated in each language? "Generic" services - // are not specific to any particular RPC system. They are generated by the - // main code generators in each language (without additional plugins). - // Generic services were the only kind of service generation supported by - // early versions of google.protobuf. - // - // Generic services are now considered deprecated in favor of using plugins - // that generate code specific to your particular RPC system. Therefore, - // these default to false. Old code which depends on generic services should - // explicitly set them to true. - optional bool cc_generic_services = 16 [default=false]; - optional bool java_generic_services = 17 [default=false]; - optional bool py_generic_services = 18 [default=false]; - optional bool php_generic_services = 42 [default=false]; - - // Is this file deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for everything in the file, or it will be completely ignored; in the very - // least, this is a formalization for deprecating files. - optional bool deprecated = 23 [default=false]; - - // Enables the use of arenas for the proto messages in this file. This applies - // only to generated classes for C++. - optional bool cc_enable_arenas = 31 [default=false]; - - - // Sets the objective c class prefix which is prepended to all objective c - // generated classes from this .proto. There is no default. - optional string objc_class_prefix = 36; - - // Namespace for generated classes; defaults to the package. - optional string csharp_namespace = 37; - - // By default Swift generators will take the proto package and CamelCase it - // replacing '.' with underscore and use that to prefix the types/symbols - // defined. When this options is provided, they will use this value instead - // to prefix the types/symbols defined. - optional string swift_prefix = 39; - - // Sets the php class prefix which is prepended to all php generated classes - // from this .proto. Default is empty. - optional string php_class_prefix = 40; - - // Use this option to change the namespace of php generated classes. Default - // is empty. When this option is empty, the package name will be used for - // determining the namespace. - optional string php_namespace = 41; - - - // Use this option to change the namespace of php generated metadata classes. - // Default is empty. When this option is empty, the proto file name will be used - // for determining the namespace. - optional string php_metadata_namespace = 44; - - // Use this option to change the package of ruby generated classes. Default - // is empty. When this option is not set, the package name will be used for - // determining the ruby package. - optional string ruby_package = 45; - - // The parser stores options it doesn't recognize here. - // See the documentation for the "Options" section above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. - // See the documentation for the "Options" section above. - extensions 1000 to max; - - reserved 38; -} - -message MessageOptions { - // Set true to use the old proto1 MessageSet wire format for extensions. - // This is provided for backwards-compatibility with the MessageSet wire - // format. You should not use this for any other reason: It's less - // efficient, has fewer features, and is more complicated. - // - // The message must be defined exactly as follows: - // message Foo { - // option message_set_wire_format = true; - // extensions 4 to max; - // } - // Note that the message cannot have any defined fields; MessageSets only - // have extensions. - // - // All extensions of your type must be singular messages; e.g. they cannot - // be int32s, enums, or repeated messages. - // - // Because this is an option, the above two restrictions are not enforced by - // the protocol compiler. - optional bool message_set_wire_format = 1 [default=false]; - - // Disables the generation of the standard "descriptor()" accessor, which can - // conflict with a field of the same name. This is meant to make migration - // from proto1 easier; new code should avoid fields named "descriptor". - optional bool no_standard_descriptor_accessor = 2 [default=false]; - - // Is this message deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the message, or it will be completely ignored; in the very least, - // this is a formalization for deprecating messages. - optional bool deprecated = 3 [default=false]; - - // Whether the message is an automatically generated map entry type for the - // maps field. - // - // For maps fields: - // map map_field = 1; - // The parsed descriptor looks like: - // message MapFieldEntry { - // option map_entry = true; - // optional KeyType key = 1; - // optional ValueType value = 2; - // } - // repeated MapFieldEntry map_field = 1; - // - // Implementations may choose not to generate the map_entry=true message, but - // use a native map in the target language to hold the keys and values. - // The reflection APIs in such implementions still need to work as - // if the field is a repeated message field. - // - // NOTE: Do not set the option in .proto files. Always use the maps syntax - // instead. The option should only be implicitly set by the proto compiler - // parser. - optional bool map_entry = 7; - - reserved 8; // javalite_serializable - reserved 9; // javanano_as_lite - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message FieldOptions { - // The ctype option instructs the C++ code generator to use a different - // representation of the field than it normally would. See the specific - // options below. This option is not yet implemented in the open source - // release -- sorry, we'll try to include it in a future version! - optional CType ctype = 1 [default = STRING]; - enum CType { - // Default mode. - STRING = 0; - - CORD = 1; - - STRING_PIECE = 2; - } - // The packed option can be enabled for repeated primitive fields to enable - // a more efficient representation on the wire. Rather than repeatedly - // writing the tag and type for each element, the entire array is encoded as - // a single length-delimited blob. In proto3, only explicit setting it to - // false will avoid using packed encoding. - optional bool packed = 2; - - // The jstype option determines the JavaScript type used for values of the - // field. The option is permitted only for 64 bit integral and fixed types - // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - // is represented as JavaScript string, which avoids loss of precision that - // can happen when a large value is converted to a floating point JavaScript. - // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - // use the JavaScript "number" type. The behavior of the default option - // JS_NORMAL is implementation dependent. - // - // This option is an enum to permit additional types to be added, e.g. - // goog.math.Integer. - optional JSType jstype = 6 [default = JS_NORMAL]; - enum JSType { - // Use the default type. - JS_NORMAL = 0; - - // Use JavaScript strings. - JS_STRING = 1; - - // Use JavaScript numbers. - JS_NUMBER = 2; - } - - // Should this field be parsed lazily? Lazy applies only to message-type - // fields. It means that when the outer message is initially parsed, the - // inner message's contents will not be parsed but instead stored in encoded - // form. The inner message will actually be parsed when it is first accessed. - // - // This is only a hint. Implementations are free to choose whether to use - // eager or lazy parsing regardless of the value of this option. However, - // setting this option true suggests that the protocol author believes that - // using lazy parsing on this field is worth the additional bookkeeping - // overhead typically needed to implement it. - // - // This option does not affect the public interface of any generated code; - // all method signatures remain the same. Furthermore, thread-safety of the - // interface is not affected by this option; const methods remain safe to - // call from multiple threads concurrently, while non-const methods continue - // to require exclusive access. - // - // - // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outer message - // may return true even if the inner message has missing required fields. - // This is necessary because otherwise the inner message would have to be - // parsed in order to perform the check, defeating the purpose of lazy - // parsing. An implementation which chooses not to check required fields - // must be consistent about it. That is, for any particular sub-message, the - // implementation must either *always* check its required fields, or *never* - // check its required fields, regardless of whether or not the message has - // been parsed. - optional bool lazy = 5 [default=false]; - - // Is this field deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for accessors, or it will be completely ignored; in the very least, this - // is a formalization for deprecating fields. - optional bool deprecated = 3 [default=false]; - - // For Google-internal migration only. Do not use. - optional bool weak = 10 [default=false]; - - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; - - reserved 4; // removed jtype -} - -message OneofOptions { - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumOptions { - - // Set this option to true to allow mapping different tag names to the same - // value. - optional bool allow_alias = 2; - - // Is this enum deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum, or it will be completely ignored; in the very least, this - // is a formalization for deprecating enums. - optional bool deprecated = 3 [default=false]; - - reserved 5; // javanano_as_lite - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumValueOptions { - // Is this enum value deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum value, or it will be completely ignored; in the very least, - // this is a formalization for deprecating enum values. - optional bool deprecated = 1 [default=false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message ServiceOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this service deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the service, or it will be completely ignored; in the very least, - // this is a formalization for deprecating services. - optional bool deprecated = 33 [default=false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message MethodOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this method deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the method, or it will be completely ignored; in the very least, - // this is a formalization for deprecating methods. - optional bool deprecated = 33 [default=false]; - - // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, - // or neither? HTTP based RPC implementation may choose GET verb for safe - // methods, and PUT verb for idempotent methods instead of the default POST. - enum IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = 0; - NO_SIDE_EFFECTS = 1; // implies idempotent - IDEMPOTENT = 2; // idempotent, but may have side effects - } - optional IdempotencyLevel idempotency_level = - 34 [default=IDEMPOTENCY_UNKNOWN]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - - -// A message representing a option the parser does not recognize. This only -// appears in options protos created by the compiler::Parser class. -// DescriptorPool resolves these when building Descriptor objects. Therefore, -// options protos in descriptor objects (e.g. returned by Descriptor::options(), -// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -// in them. -message UninterpretedOption { - // The name of the uninterpreted option. Each string represents a segment in - // a dot-separated name. is_extension is true iff a segment represents an - // extension (denoted with parentheses in options specs in .proto files). - // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - // "foo.(bar.baz).qux". - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } - repeated NamePart name = 2; - - // The value of the uninterpreted option, in whatever type the tokenizer - // identified it as during parsing. Exactly one of these should be set. - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; -} - -// =================================================================== -// Optional source code info - -// Encapsulates information about the original source file from which a -// FileDescriptorProto was generated. -message SourceCodeInfo { - // A Location identifies a piece of source code in a .proto file which - // corresponds to a particular definition. This information is intended - // to be useful to IDEs, code indexers, documentation generators, and similar - // tools. - // - // For example, say we have a file like: - // message Foo { - // optional string foo = 1; - // } - // Let's look at just the field definition: - // optional string foo = 1; - // ^ ^^ ^^ ^ ^^^ - // a bc de f ghi - // We have the following locations: - // span path represents - // [a,i) [ 4, 0, 2, 0 ] The whole field definition. - // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - // - // Notes: - // - A location may refer to a repeated field itself (i.e. not to any - // particular index within it). This is used whenever a set of elements are - // logically enclosed in a single code segment. For example, an entire - // extend block (possibly containing multiple extension definitions) will - // have an outer location whose path refers to the "extensions" repeated - // field without an index. - // - Multiple locations may have the same path. This happens when a single - // logical declaration is spread out across multiple places. The most - // obvious example is the "extend" block again -- there may be multiple - // extend blocks in the same scope, each of which will have the same path. - // - A location's span is not always a subset of its parent's span. For - // example, the "extendee" of an extension declaration appears at the - // beginning of the "extend" block and is shared by all extensions within - // the block. - // - Just because a location's span is a subset of some other location's span - // does not mean that it is a descendent. For example, a "group" defines - // both a type and a field in a single declaration. Thus, the locations - // corresponding to the type and field and their components will overlap. - // - Code which tries to interpret locations should probably be designed to - // ignore those that it doesn't understand, as more types of locations could - // be recorded in the future. - repeated Location location = 1; - message Location { - // Identifies which part of the FileDescriptorProto was defined at this - // location. - // - // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition. For - // example, this path: - // [ 4, 3, 2, 7, 1 ] - // refers to: - // file.message_type(3) // 4, 3 - // .field(7) // 2, 7 - // .name() // 1 - // This is because FileDescriptorProto.message_type has field number 4: - // repeated DescriptorProto message_type = 4; - // and DescriptorProto.field has field number 2: - // repeated FieldDescriptorProto field = 2; - // and FieldDescriptorProto.name has field number 1: - // optional string name = 1; - // - // Thus, the above path gives the location of a field name. If we removed - // the last element: - // [ 4, 3, 2, 7 ] - // this path refers to the whole field declaration (from the beginning - // of the label to the terminating semicolon). - repeated int32 path = 1 [packed=true]; - - // Always has exactly three or four elements: start line, start column, - // end line (optional, otherwise assumed same as start line), end column. - // These are packed into a single field for efficiency. Note that line - // and column numbers are zero-based -- typically you will want to add - // 1 to each before displaying to a user. - repeated int32 span = 2 [packed=true]; - - // If this SourceCodeInfo represents a complete declaration, these are any - // comments appearing before and after the declaration which appear to be - // attached to the declaration. - // - // A series of line comments appearing on consecutive lines, with no other - // tokens appearing on those lines, will be treated as a single comment. - // - // leading_detached_comments will keep paragraphs of comments that appear - // before (but not connected to) the current element. Each paragraph, - // separated by empty lines, will be one comment element in the repeated - // field. - // - // Only the comment content is provided; comment markers (e.g. //) are - // stripped out. For block comments, leading whitespace and an asterisk - // will be stripped from the beginning of each line other than the first. - // Newlines are included in the output. - // - // Examples: - // - // optional int32 foo = 1; // Comment attached to foo. - // // Comment attached to bar. - // optional int32 bar = 2; - // - // optional string baz = 3; - // // Comment attached to baz. - // // Another line attached to baz. - // - // // Comment attached to qux. - // // - // // Another line attached to qux. - // optional double qux = 4; - // - // // Detached comment for corge. This is not leading or trailing comments - // // to qux or corge because there are blank lines separating it from - // // both. - // - // // Detached comment for corge paragraph 2. - // - // optional string corge = 5; - // /* Block comment attached - // * to corge. Leading asterisks - // * will be removed. */ - // /* Block comment attached to - // * grault. */ - // optional int32 grault = 6; - // - // // ignored detached comments. - optional string leading_comments = 3; - optional string trailing_comments = 4; - repeated string leading_detached_comments = 6; - } -} - -// Describes the relationship between generated code and its original source -// file. A GeneratedCodeInfo message is associated with only one generated -// source file, but may contain references to different source .proto files. -message GeneratedCodeInfo { - // An Annotation connects some span of text in generated code to an element - // of its generating .proto file. - repeated Annotation annotation = 1; - message Annotation { - // Identifies the element in the original source .proto file. This field - // is formatted the same as SourceCodeInfo.Location.path. - repeated int32 path = 1 [packed=true]; - - // Identifies the filesystem path to the original source .proto. - optional string source_file = 2; - - // Identifies the starting offset in bytes in the generated code - // that relates to the identified object. - optional int32 begin = 3; - - // Identifies the ending offset in bytes in the generated code that - // relates to the identified offset. The end offset should be one past - // the last relevant byte (so the length of the text = end - begin). - optional int32 end = 4; - } -} +import public "google/protobuf/descriptor.proto"; diff --git a/protoc-gen-go/golden_test.go b/protoc-gen-go/golden_test.go deleted file mode 100644 index 3e99b4b65a..0000000000 --- a/protoc-gen-go/golden_test.go +++ /dev/null @@ -1,367 +0,0 @@ -// 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 main - -import ( - "bytes" - "flag" - "go/build" - "go/parser" - "go/token" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "regexp" - "runtime" - "strings" - "testing" -) - -// Set --regenerate to regenerate the golden files. -var regenerate = flag.Bool("regenerate", false, "regenerate golden files") - -// When the environment variable RUN_AS_PROTOC_GEN_GO is set, we skip running -// tests and instead act as protoc-gen-go. This allows the test binary to -// pass itself to protoc. -func init() { - if os.Getenv("RUN_AS_PROTOC_GEN_GO") != "" { - main() - os.Exit(0) - } -} - -func TestGolden(t *testing.T) { - workdir, err := ioutil.TempDir("", "proto-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(workdir) - - // Find all the proto files we need to compile. We assume that each directory - // contains the files for a single package. - supportTypeAliases := hasReleaseTag("go1.9") - packages := map[string][]string{} - err = filepath.Walk("testdata", func(path string, info os.FileInfo, err error) error { - if filepath.Base(path) == "import_public" && !supportTypeAliases { - // Public imports require type alias support. - return filepath.SkipDir - } - if !strings.HasSuffix(path, ".proto") { - return nil - } - dir := filepath.Dir(path) - packages[dir] = append(packages[dir], path) - return nil - }) - if err != nil { - t.Fatal(err) - } - - // Compile each package, using this binary as protoc-gen-go. - for _, sources := range packages { - args := []string{"-Itestdata", "--go_out=plugins=grpc,paths=source_relative:" + workdir} - args = append(args, sources...) - protoc(t, args) - } - - // Compare each generated file to the golden version. - filepath.Walk(workdir, func(genPath string, info os.FileInfo, _ error) error { - if info.IsDir() { - return nil - } - - // For each generated file, figure out the path to the corresponding - // golden file in the testdata directory. - relPath, err := filepath.Rel(workdir, genPath) - if err != nil { - t.Errorf("filepath.Rel(%q, %q): %v", workdir, genPath, err) - return nil - } - if filepath.SplitList(relPath)[0] == ".." { - t.Errorf("generated file %q is not relative to %q", genPath, workdir) - } - goldenPath := filepath.Join("testdata", relPath) - - got, err := ioutil.ReadFile(genPath) - if err != nil { - t.Error(err) - return nil - } - if *regenerate { - // If --regenerate set, just rewrite the golden files. - err := ioutil.WriteFile(goldenPath, got, 0666) - if err != nil { - t.Error(err) - } - return nil - } - - want, err := ioutil.ReadFile(goldenPath) - if err != nil { - t.Error(err) - return nil - } - - want = fdescRE.ReplaceAll(want, nil) - got = fdescRE.ReplaceAll(got, nil) - if bytes.Equal(got, want) { - return nil - } - - cmd := exec.Command("diff", "-u", goldenPath, genPath) - out, _ := cmd.CombinedOutput() - t.Errorf("golden file differs: %v\n%v", relPath, string(out)) - return nil - }) -} - -var fdescRE = regexp.MustCompile(`(?ms)^var fileDescriptor.*}`) - -// Source files used by TestParameters. -const ( - aProto = ` -syntax = "proto3"; -package test.alpha; -option go_package = "package/alpha"; -import "beta/b.proto"; -message M { test.beta.M field = 1; }` - - bProto = ` -syntax = "proto3"; -package test.beta; -// no go_package option -message M {}` -) - -func TestParameters(t *testing.T) { - for _, test := range []struct { - parameters string - wantFiles map[string]bool - wantImportsA map[string]bool - wantPackageA string - wantPackageB string - }{{ - parameters: "", - wantFiles: map[string]bool{ - "package/alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - wantPackageA: "alpha", - wantPackageB: "test_beta", - wantImportsA: map[string]bool{ - "github.com/golang/protobuf/proto": true, - "beta": true, - }, - }, { - parameters: "import_prefix=prefix", - wantFiles: map[string]bool{ - "package/alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - wantPackageA: "alpha", - wantPackageB: "test_beta", - wantImportsA: map[string]bool{ - // This really doesn't seem like useful behavior. - "prefixgithub.com/golang/protobuf/proto": true, - "prefixbeta": true, - }, - }, { - // import_path only affects the 'package' line. - parameters: "import_path=import/path/of/pkg", - wantPackageA: "alpha", - wantPackageB: "pkg", - wantFiles: map[string]bool{ - "package/alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - }, { - parameters: "Mbeta/b.proto=package/gamma", - wantFiles: map[string]bool{ - "package/alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - wantPackageA: "alpha", - wantPackageB: "test_beta", - wantImportsA: map[string]bool{ - "github.com/golang/protobuf/proto": true, - // Rewritten by the M parameter. - "package/gamma": true, - }, - }, { - parameters: "import_prefix=prefix,Mbeta/b.proto=package/gamma", - wantFiles: map[string]bool{ - "package/alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - wantPackageA: "alpha", - wantPackageB: "test_beta", - wantImportsA: map[string]bool{ - // import_prefix applies after M. - "prefixpackage/gamma": true, - }, - }, { - parameters: "paths=source_relative", - wantFiles: map[string]bool{ - "alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - wantPackageA: "alpha", - wantPackageB: "test_beta", - }, { - parameters: "paths=source_relative,import_prefix=prefix", - wantFiles: map[string]bool{ - // import_prefix doesn't affect filenames. - "alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - wantPackageA: "alpha", - wantPackageB: "test_beta", - }} { - name := test.parameters - if name == "" { - name = "defaults" - } - // TODO: Switch to t.Run when we no longer support Go 1.6. - t.Logf("TEST: %v", name) - workdir, err := ioutil.TempDir("", "proto-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(workdir) - - for _, dir := range []string{"alpha", "beta", "out"} { - if err := os.MkdirAll(filepath.Join(workdir, dir), 0777); err != nil { - t.Fatal(err) - } - } - - if err := ioutil.WriteFile(filepath.Join(workdir, "alpha", "a.proto"), []byte(aProto), 0666); err != nil { - t.Fatal(err) - } - - if err := ioutil.WriteFile(filepath.Join(workdir, "beta", "b.proto"), []byte(bProto), 0666); err != nil { - t.Fatal(err) - } - - protoc(t, []string{ - "-I" + workdir, - "--go_out=" + test.parameters + ":" + filepath.Join(workdir, "out"), - filepath.Join(workdir, "alpha", "a.proto"), - }) - protoc(t, []string{ - "-I" + workdir, - "--go_out=" + test.parameters + ":" + filepath.Join(workdir, "out"), - filepath.Join(workdir, "beta", "b.proto"), - }) - - contents := make(map[string]string) - gotFiles := make(map[string]bool) - outdir := filepath.Join(workdir, "out") - filepath.Walk(outdir, func(p string, info os.FileInfo, _ error) error { - if info.IsDir() { - return nil - } - base := filepath.Base(p) - if base == "a.pb.go" || base == "b.pb.go" { - b, err := ioutil.ReadFile(p) - if err != nil { - t.Fatal(err) - } - contents[base] = string(b) - } - relPath, _ := filepath.Rel(outdir, p) - gotFiles[relPath] = true - return nil - }) - for got := range gotFiles { - if runtime.GOOS == "windows" { - got = filepath.ToSlash(got) - } - if !test.wantFiles[got] { - t.Errorf("unexpected output file: %v", got) - } - } - for want := range test.wantFiles { - if runtime.GOOS == "windows" { - want = filepath.FromSlash(want) - } - if !gotFiles[want] { - t.Errorf("missing output file: %v", want) - } - } - gotPackageA, gotImports, err := parseFile(contents["a.pb.go"]) - if err != nil { - t.Fatal(err) - } - gotPackageB, _, err := parseFile(contents["b.pb.go"]) - if err != nil { - t.Fatal(err) - } - if got, want := gotPackageA, test.wantPackageA; want != got { - t.Errorf("output file a.pb.go is package %q, want %q", got, want) - } - if got, want := gotPackageB, test.wantPackageB; want != got { - t.Errorf("output file b.pb.go is package %q, want %q", got, want) - } - missingImport := false - WantImport: - for want := range test.wantImportsA { - for _, imp := range gotImports { - if `"`+want+`"` == imp { - continue WantImport - } - } - t.Errorf("output file a.pb.go does not contain expected import %q", want) - missingImport = true - } - if missingImport { - t.Error("got imports:") - for _, imp := range gotImports { - t.Errorf(" %v", imp) - } - } - } -} - -// parseFile returns a file's package name and a list of all packages it imports. -func parseFile(source string) (packageName string, imports []string, err error) { - fset := token.NewFileSet() - f, err := parser.ParseFile(fset, "", source, parser.ImportsOnly) - if err != nil { - return "", nil, err - } - for _, imp := range f.Imports { - imports = append(imports, imp.Path.Value) - } - return f.Name.Name, imports, nil -} - -func protoc(t *testing.T, args []string) { - cmd := exec.Command("protoc", "--plugin=protoc-gen-go="+os.Args[0]) - cmd.Args = append(cmd.Args, args...) - // We set the RUN_AS_PROTOC_GEN_GO environment variable to indicate that - // the subprocess should act as a proto compiler rather than a test. - cmd.Env = append(os.Environ(), "RUN_AS_PROTOC_GEN_GO=1") - out, err := cmd.CombinedOutput() - if len(out) > 0 || err != nil { - t.Log("RUNNING: ", strings.Join(cmd.Args, " ")) - } - if len(out) > 0 { - t.Log(string(out)) - } - if err != nil { - t.Fatalf("protoc: %v", err) - } -} - -func hasReleaseTag(want string) bool { - for _, tag := range build.Default.ReleaseTags { - if tag == want { - return true - } - } - return false -} diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index 61bfc10e02..4c904de651 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -1,369 +1,67 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/protobuf/compiler/plugin.proto +// source: github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto -/* -Package plugin_go is a generated protocol buffer package. - -It is generated from these files: - google/protobuf/compiler/plugin.proto - -It has these top-level messages: - Version - CodeGeneratorRequest - CodeGeneratorResponse -*/ package plugin_go -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import google_protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +import ( + proto "github.com/golang/protobuf/proto" + protoapi "github.com/golang/protobuf/protoapi" + protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" + plugin "github.com/golang/protobuf/v2/types/plugin" +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -// The version number of protocol compiler. -type Version struct { - Major *int32 `protobuf:"varint,1,opt,name=major" json:"major,omitempty"` - Minor *int32 `protobuf:"varint,2,opt,name=minor" json:"minor,omitempty"` - Patch *int32 `protobuf:"varint,3,opt,name=patch" json:"patch,omitempty"` - // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should - // be empty for mainline stable releases. - Suffix *string `protobuf:"bytes,4,opt,name=suffix" json:"suffix,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Version) Reset() { *m = Version{} } -func (m *Version) String() string { return proto.CompactTextString(m) } -func (*Version) ProtoMessage() {} -func (*Version) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } -func (m *Version) Unmarshal(b []byte) error { - return xxx_messageInfo_Version.Unmarshal(m, b) -} -func (m *Version) Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Version.Marshal(b, m, deterministic) -} -func (dst *Version) XXX_Merge(src proto.Message) { - xxx_messageInfo_Version.Merge(dst, src) -} -func (m *Version) XXX_Size() int { - return xxx_messageInfo_Version.Size(m) -} -func (m *Version) XXX_DiscardUnknown() { - xxx_messageInfo_Version.DiscardUnknown(m) -} - -var xxx_messageInfo_Version proto.InternalMessageInfo - -func (m *Version) GetMajor() int32 { - if m != nil && m.Major != nil { - return *m.Major - } - return 0 -} - -func (m *Version) GetMinor() int32 { - if m != nil && m.Minor != nil { - return *m.Minor - } - return 0 -} - -func (m *Version) GetPatch() int32 { - if m != nil && m.Patch != nil { - return *m.Patch - } - return 0 -} - -func (m *Version) GetSuffix() string { - if m != nil && m.Suffix != nil { - return *m.Suffix - } - return "" -} - -// An encoded CodeGeneratorRequest is written to the plugin's stdin. -type CodeGeneratorRequest struct { - // The .proto files that were explicitly listed on the command-line. The - // code generator should generate code only for these files. Each file's - // descriptor will be included in proto_file, below. - FileToGenerate []string `protobuf:"bytes,1,rep,name=file_to_generate,json=fileToGenerate" json:"file_to_generate,omitempty"` - // The generator parameter passed on the command-line. - Parameter *string `protobuf:"bytes,2,opt,name=parameter" json:"parameter,omitempty"` - // FileDescriptorProtos for all files in files_to_generate and everything - // they import. The files will appear in topological order, so each file - // appears before any file that imports it. - // - // protoc guarantees that all proto_files will be written after - // the fields above, even though this is not technically guaranteed by the - // protobuf wire format. This theoretically could allow a plugin to stream - // in the FileDescriptorProtos and handle them one by one rather than read - // the entire set into memory at once. However, as of this writing, this - // is not similarly optimized on protoc's end -- it will store all fields in - // memory at once before sending them to the plugin. - // - // Type names of fields and extensions in the FileDescriptorProto are always - // fully qualified. - ProtoFile []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file,json=protoFile" json:"proto_file,omitempty"` - // The version number of protocol compiler. - CompilerVersion *Version `protobuf:"bytes,3,opt,name=compiler_version,json=compilerVersion" json:"compiler_version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CodeGeneratorRequest) Reset() { *m = CodeGeneratorRequest{} } -func (m *CodeGeneratorRequest) String() string { return proto.CompactTextString(m) } -func (*CodeGeneratorRequest) ProtoMessage() {} -func (*CodeGeneratorRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } -func (m *CodeGeneratorRequest) Unmarshal(b []byte) error { - return xxx_messageInfo_CodeGeneratorRequest.Unmarshal(m, b) -} -func (m *CodeGeneratorRequest) Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CodeGeneratorRequest.Marshal(b, m, deterministic) -} -func (dst *CodeGeneratorRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CodeGeneratorRequest.Merge(dst, src) -} -func (m *CodeGeneratorRequest) XXX_Size() int { - return xxx_messageInfo_CodeGeneratorRequest.Size(m) -} -func (m *CodeGeneratorRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CodeGeneratorRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CodeGeneratorRequest proto.InternalMessageInfo - -func (m *CodeGeneratorRequest) GetFileToGenerate() []string { - if m != nil { - return m.FileToGenerate - } - return nil -} +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -func (m *CodeGeneratorRequest) GetParameter() string { - if m != nil && m.Parameter != nil { - return *m.Parameter - } - return "" -} - -func (m *CodeGeneratorRequest) GetProtoFile() []*google_protobuf.FileDescriptorProto { - if m != nil { - return m.ProtoFile - } - return nil -} - -func (m *CodeGeneratorRequest) GetCompilerVersion() *Version { - if m != nil { - return m.CompilerVersion - } - return nil -} - -// The plugin writes an encoded CodeGeneratorResponse to stdout. -type CodeGeneratorResponse struct { - // Error message. If non-empty, code generation failed. The plugin process - // should exit with status code zero even if it reports an error in this way. - // - // This should be used to indicate errors in .proto files which prevent the - // code generator from generating correct code. Errors which indicate a - // problem in protoc itself -- such as the input CodeGeneratorRequest being - // unparseable -- should be reported by writing a message to stderr and - // exiting with a non-zero status code. - Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` - File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +// Symbols defined in public import of google/protobuf/compiler/plugin.proto -func (m *CodeGeneratorResponse) Reset() { *m = CodeGeneratorResponse{} } -func (m *CodeGeneratorResponse) String() string { return proto.CompactTextString(m) } -func (*CodeGeneratorResponse) ProtoMessage() {} -func (*CodeGeneratorResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } -func (m *CodeGeneratorResponse) Unmarshal(b []byte) error { - return xxx_messageInfo_CodeGeneratorResponse.Unmarshal(m, b) -} -func (m *CodeGeneratorResponse) Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CodeGeneratorResponse.Marshal(b, m, deterministic) -} -func (dst *CodeGeneratorResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CodeGeneratorResponse.Merge(dst, src) -} -func (m *CodeGeneratorResponse) XXX_Size() int { - return xxx_messageInfo_CodeGeneratorResponse.Size(m) -} -func (m *CodeGeneratorResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CodeGeneratorResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CodeGeneratorResponse proto.InternalMessageInfo - -func (m *CodeGeneratorResponse) GetError() string { - if m != nil && m.Error != nil { - return *m.Error - } - return "" -} +type Version = plugin.Version +type CodeGeneratorRequest = plugin.CodeGeneratorRequest +type CodeGeneratorResponse = plugin.CodeGeneratorResponse +type CodeGeneratorResponse_File = plugin.CodeGeneratorResponse_File -func (m *CodeGeneratorResponse) GetFile() []*CodeGeneratorResponse_File { - if m != nil { - return m.File - } - return nil +func init() { + proto.RegisterFile("github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto", xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc_gzipped) } -// Represents a single generated file. -type CodeGeneratorResponse_File struct { - // The file name, relative to the output directory. The name must not - // contain "." or ".." components and must be relative, not be absolute (so, - // the file cannot lie outside the output directory). "/" must be used as - // the path separator, not "\". - // - // If the name is omitted, the content will be appended to the previous - // file. This allows the generator to break large files into small chunks, - // and allows the generated text to be streamed back to protoc so that large - // files need not reside completely in memory at one time. Note that as of - // this writing protoc does not optimize for this -- it will read the entire - // CodeGeneratorResponse before writing files to disk. - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - // If non-empty, indicates that the named file should already exist, and the - // content here is to be inserted into that file at a defined insertion - // point. This feature allows a code generator to extend the output - // produced by another code generator. The original generator may provide - // insertion points by placing special annotations in the file that look - // like: - // @@protoc_insertion_point(NAME) - // The annotation can have arbitrary text before and after it on the line, - // which allows it to be placed in a comment. NAME should be replaced with - // an identifier naming the point -- this is what other generators will use - // as the insertion_point. Code inserted at this point will be placed - // immediately above the line containing the insertion point (thus multiple - // insertions to the same point will come out in the order they were added). - // The double-@ is intended to make it unlikely that the generated code - // could contain things that look like insertion points by accident. - // - // For example, the C++ code generator places the following line in the - // .pb.h files that it generates: - // // @@protoc_insertion_point(namespace_scope) - // This line appears within the scope of the file's package namespace, but - // outside of any particular class. Another plugin can then specify the - // insertion_point "namespace_scope" to generate additional classes or - // other declarations that should be placed in this scope. - // - // Note that if the line containing the insertion point begins with - // whitespace, the same whitespace will be added to every line of the - // inserted text. This is useful for languages like Python, where - // indentation matters. In these languages, the insertion point comment - // should be indented the same amount as any inserted code will need to be - // in order to work correctly in that context. - // - // The code generator that generates the initial file and the one which - // inserts into it must both run as part of a single invocation of protoc. - // Code generators are executed in the order in which they appear on the - // command line. - // - // If |insertion_point| is present, |name| must also be present. - InsertionPoint *string `protobuf:"bytes,2,opt,name=insertion_point,json=insertionPoint" json:"insertion_point,omitempty"` - // The file contents. - Content *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc = []byte{ + // 164 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x25, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, + 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, + 0x6f, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x3b, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, + 0x67, 0x6f, 0x50, 0x00, } -func (m *CodeGeneratorResponse_File) Reset() { *m = CodeGeneratorResponse_File{} } -func (m *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(m) } -func (*CodeGeneratorResponse_File) ProtoMessage() {} -func (*CodeGeneratorResponse_File) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } -func (m *CodeGeneratorResponse_File) Unmarshal(b []byte) error { - return xxx_messageInfo_CodeGeneratorResponse_File.Unmarshal(m, b) -} -func (m *CodeGeneratorResponse_File) Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CodeGeneratorResponse_File.Marshal(b, m, deterministic) -} -func (dst *CodeGeneratorResponse_File) XXX_Merge(src proto.Message) { - xxx_messageInfo_CodeGeneratorResponse_File.Merge(dst, src) -} -func (m *CodeGeneratorResponse_File) XXX_Size() int { - return xxx_messageInfo_CodeGeneratorResponse_File.Size(m) -} -func (m *CodeGeneratorResponse_File) XXX_DiscardUnknown() { - xxx_messageInfo_CodeGeneratorResponse_File.DiscardUnknown(m) -} +var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc) -var xxx_messageInfo_CodeGeneratorResponse_File proto.InternalMessageInfo +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) -func (m *CodeGeneratorResponse_File) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} +var File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto protoreflect.FileDescriptor -func (m *CodeGeneratorResponse_File) GetInsertionPoint() string { - if m != nil && m.InsertionPoint != nil { - return *m.InsertionPoint - } - return "" -} +var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = []interface{}{} +var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = []int32{} -func (m *CodeGeneratorResponse_File) GetContent() string { - if m != nil && m.Content != nil { - return *m.Content +func init() { xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init() } +func xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init() { + if File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto != nil { + return } - return "" -} - -func init() { - proto.RegisterType((*Version)(nil), "google.protobuf.compiler.Version") - proto.RegisterType((*CodeGeneratorRequest)(nil), "google.protobuf.compiler.CodeGeneratorRequest") - proto.RegisterType((*CodeGeneratorResponse)(nil), "google.protobuf.compiler.CodeGeneratorResponse") - proto.RegisterType((*CodeGeneratorResponse_File)(nil), "google.protobuf.compiler.CodeGeneratorResponse.File") -} - -func init() { proto.RegisterFile("google/protobuf/compiler/plugin.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 417 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcf, 0x6a, 0x14, 0x41, - 0x10, 0xc6, 0x19, 0x77, 0x63, 0x98, 0x8a, 0x64, 0x43, 0x13, 0xa5, 0x09, 0x39, 0x8c, 0x8b, 0xe2, - 0x5c, 0x32, 0x0b, 0xc1, 0x8b, 0x78, 0x4b, 0x44, 0x3d, 0x78, 0x58, 0x1a, 0xf1, 0x20, 0xc8, 0x30, - 0x99, 0xd4, 0x74, 0x5a, 0x66, 0xba, 0xc6, 0xee, 0x1e, 0xf1, 0x49, 0x7d, 0x0f, 0xdf, 0x40, 0xfa, - 0xcf, 0x24, 0xb2, 0xb8, 0xa7, 0xee, 0xef, 0x57, 0xd5, 0xd5, 0x55, 0x1f, 0x05, 0x2f, 0x25, 0x91, - 0xec, 0x71, 0x33, 0x1a, 0x72, 0x74, 0x33, 0x75, 0x9b, 0x96, 0x86, 0x51, 0xf5, 0x68, 0x36, 0x63, - 0x3f, 0x49, 0xa5, 0xab, 0x10, 0x60, 0x3c, 0xa6, 0x55, 0x73, 0x5a, 0x35, 0xa7, 0x9d, 0x15, 0xbb, - 0x05, 0x6e, 0xd1, 0xb6, 0x46, 0x8d, 0x8e, 0x4c, 0xcc, 0x5e, 0xb7, 0x70, 0xf8, 0x05, 0x8d, 0x55, - 0xa4, 0xd9, 0x29, 0x1c, 0x0c, 0xcd, 0x77, 0x32, 0x3c, 0x2b, 0xb2, 0xf2, 0x40, 0x44, 0x11, 0xa8, - 0xd2, 0x64, 0xf8, 0xa3, 0x44, 0xbd, 0xf0, 0x74, 0x6c, 0x5c, 0x7b, 0xc7, 0x17, 0x91, 0x06, 0xc1, - 0x9e, 0xc1, 0x63, 0x3b, 0x75, 0x9d, 0xfa, 0xc5, 0x97, 0x45, 0x56, 0xe6, 0x22, 0xa9, 0xf5, 0x9f, - 0x0c, 0x4e, 0xaf, 0xe9, 0x16, 0x3f, 0xa0, 0x46, 0xd3, 0x38, 0x32, 0x02, 0x7f, 0x4c, 0x68, 0x1d, - 0x2b, 0xe1, 0xa4, 0x53, 0x3d, 0xd6, 0x8e, 0x6a, 0x19, 0x63, 0xc8, 0xb3, 0x62, 0x51, 0xe6, 0xe2, - 0xd8, 0xf3, 0xcf, 0x94, 0x5e, 0x20, 0x3b, 0x87, 0x7c, 0x6c, 0x4c, 0x33, 0xa0, 0xc3, 0xd8, 0x4a, - 0x2e, 0x1e, 0x00, 0xbb, 0x06, 0x08, 0xe3, 0xd4, 0xfe, 0x15, 0x5f, 0x15, 0x8b, 0xf2, 0xe8, 0xf2, - 0x45, 0xb5, 0x6b, 0xcb, 0x7b, 0xd5, 0xe3, 0xbb, 0x7b, 0x03, 0xb6, 0x1e, 0x8b, 0x3c, 0x44, 0x7d, - 0x84, 0x7d, 0x82, 0x93, 0xd9, 0xb8, 0xfa, 0x67, 0xf4, 0x24, 0x8c, 0x77, 0x74, 0xf9, 0xbc, 0xda, - 0xe7, 0x70, 0x95, 0xcc, 0x13, 0xab, 0x99, 0x24, 0xb0, 0xfe, 0x9d, 0xc1, 0xd3, 0x9d, 0x99, 0xed, - 0x48, 0xda, 0xa2, 0xf7, 0x0e, 0x8d, 0x49, 0x3e, 0xe7, 0x22, 0x0a, 0xf6, 0x11, 0x96, 0xff, 0x34, - 0xff, 0x7a, 0xff, 0x8f, 0xff, 0x2d, 0x1a, 0x66, 0x13, 0xa1, 0xc2, 0xd9, 0x37, 0x58, 0x86, 0x79, - 0x18, 0x2c, 0x75, 0x33, 0x60, 0xfa, 0x26, 0xdc, 0xd9, 0x2b, 0x58, 0x29, 0x6d, 0xd1, 0x38, 0x45, - 0xba, 0x1e, 0x49, 0x69, 0x97, 0xcc, 0x3c, 0xbe, 0xc7, 0x5b, 0x4f, 0x19, 0x87, 0xc3, 0x96, 0xb4, - 0x43, 0xed, 0xf8, 0x2a, 0x24, 0xcc, 0xf2, 0x4a, 0xc2, 0x79, 0x4b, 0xc3, 0xde, 0xfe, 0xae, 0x9e, - 0x6c, 0xc3, 0x6e, 0x06, 0x7b, 0xed, 0xd7, 0x37, 0x52, 0xb9, 0xbb, 0xe9, 0xc6, 0x87, 0x37, 0x92, - 0xfa, 0x46, 0xcb, 0x87, 0x65, 0x0c, 0x97, 0xf6, 0x42, 0xa2, 0xbe, 0x90, 0x94, 0x56, 0xfa, 0x6d, - 0x3c, 0x6a, 0x49, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x15, 0x40, 0xc5, 0xfe, 0x02, 0x00, - 0x00, + File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto = protoimpl.FileBuilder{ + RawDescriptor: xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc, + GoTypes: xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes, + DependencyIndexes: xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs, + }.Init() + xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = nil + xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = nil } diff --git a/protoc-gen-go/plugin/plugin.proto b/protoc-gen-go/plugin/plugin.proto index 5b5574529e..75b380bc06 100644 --- a/protoc-gen-go/plugin/plugin.proto +++ b/protoc-gen-go/plugin/plugin.proto @@ -1,167 +1,3 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - -// Author: kenton@google.com (Kenton Varda) -// -// WARNING: The plugin interface is currently EXPERIMENTAL and is subject to -// change. -// -// protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is -// just a program that reads a CodeGeneratorRequest from stdin and writes a -// CodeGeneratorResponse to stdout. -// -// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead -// of dealing with the raw protocol defined here. -// -// A plugin executable needs only to be placed somewhere in the path. The -// plugin should be named "protoc-gen-$NAME", and will then be used when the -// flag "--${NAME}_out" is passed to protoc. - syntax = "proto2"; -package google.protobuf.compiler; -option java_package = "com.google.protobuf.compiler"; -option java_outer_classname = "PluginProtos"; - option go_package = "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go"; - -import "google/protobuf/descriptor.proto"; - -// The version number of protocol compiler. -message Version { - optional int32 major = 1; - optional int32 minor = 2; - optional int32 patch = 3; - // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should - // be empty for mainline stable releases. - optional string suffix = 4; -} - -// An encoded CodeGeneratorRequest is written to the plugin's stdin. -message CodeGeneratorRequest { - // The .proto files that were explicitly listed on the command-line. The - // code generator should generate code only for these files. Each file's - // descriptor will be included in proto_file, below. - repeated string file_to_generate = 1; - - // The generator parameter passed on the command-line. - optional string parameter = 2; - - // FileDescriptorProtos for all files in files_to_generate and everything - // they import. The files will appear in topological order, so each file - // appears before any file that imports it. - // - // protoc guarantees that all proto_files will be written after - // the fields above, even though this is not technically guaranteed by the - // protobuf wire format. This theoretically could allow a plugin to stream - // in the FileDescriptorProtos and handle them one by one rather than read - // the entire set into memory at once. However, as of this writing, this - // is not similarly optimized on protoc's end -- it will store all fields in - // memory at once before sending them to the plugin. - // - // Type names of fields and extensions in the FileDescriptorProto are always - // fully qualified. - repeated FileDescriptorProto proto_file = 15; - - // The version number of protocol compiler. - optional Version compiler_version = 3; - -} - -// The plugin writes an encoded CodeGeneratorResponse to stdout. -message CodeGeneratorResponse { - // Error message. If non-empty, code generation failed. The plugin process - // should exit with status code zero even if it reports an error in this way. - // - // This should be used to indicate errors in .proto files which prevent the - // code generator from generating correct code. Errors which indicate a - // problem in protoc itself -- such as the input CodeGeneratorRequest being - // unparseable -- should be reported by writing a message to stderr and - // exiting with a non-zero status code. - optional string error = 1; - - // Represents a single generated file. - message File { - // The file name, relative to the output directory. The name must not - // contain "." or ".." components and must be relative, not be absolute (so, - // the file cannot lie outside the output directory). "/" must be used as - // the path separator, not "\". - // - // If the name is omitted, the content will be appended to the previous - // file. This allows the generator to break large files into small chunks, - // and allows the generated text to be streamed back to protoc so that large - // files need not reside completely in memory at one time. Note that as of - // this writing protoc does not optimize for this -- it will read the entire - // CodeGeneratorResponse before writing files to disk. - optional string name = 1; - - // If non-empty, indicates that the named file should already exist, and the - // content here is to be inserted into that file at a defined insertion - // point. This feature allows a code generator to extend the output - // produced by another code generator. The original generator may provide - // insertion points by placing special annotations in the file that look - // like: - // @@protoc_insertion_point(NAME) - // The annotation can have arbitrary text before and after it on the line, - // which allows it to be placed in a comment. NAME should be replaced with - // an identifier naming the point -- this is what other generators will use - // as the insertion_point. Code inserted at this point will be placed - // immediately above the line containing the insertion point (thus multiple - // insertions to the same point will come out in the order they were added). - // The double-@ is intended to make it unlikely that the generated code - // could contain things that look like insertion points by accident. - // - // For example, the C++ code generator places the following line in the - // .pb.h files that it generates: - // // @@protoc_insertion_point(namespace_scope) - // This line appears within the scope of the file's package namespace, but - // outside of any particular class. Another plugin can then specify the - // insertion_point "namespace_scope" to generate additional classes or - // other declarations that should be placed in this scope. - // - // Note that if the line containing the insertion point begins with - // whitespace, the same whitespace will be added to every line of the - // inserted text. This is useful for languages like Python, where - // indentation matters. In these languages, the insertion point comment - // should be indented the same amount as any inserted code will need to be - // in order to work correctly in that context. - // - // The code generator that generates the initial file and the one which - // inserts into it must both run as part of a single invocation of protoc. - // Code generators are executed in the order in which they appear on the - // command line. - // - // If |insertion_point| is present, |name| must also be present. - optional string insertion_point = 2; - - // The file contents. - optional string content = 15; - } - repeated File file = 15; -} +import public "google/protobuf/compiler/plugin.proto"; diff --git a/protoc-gen-go/testdata/deprecated/deprecated.pb.go b/protoc-gen-go/testdata/deprecated/deprecated.pb.go deleted file mode 100644 index 63b52dfb77..0000000000 --- a/protoc-gen-go/testdata/deprecated/deprecated.pb.go +++ /dev/null @@ -1,280 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// deprecated/deprecated.proto is a deprecated file. - -// package deprecated contains only deprecated messages and services. - -package deprecated - -import ( - context "context" - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" - grpc "google.golang.org/grpc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// DeprecatedEnum contains deprecated values. -type DeprecatedEnum int32 // Deprecated: Do not use. -const ( - // DEPRECATED is the iota value of this enum. - DeprecatedEnum_DEPRECATED DeprecatedEnum = 0 // Deprecated: Do not use. -) - -var DeprecatedEnum_name = map[int32]string{ - 0: "DEPRECATED", -} - -var DeprecatedEnum_value = map[string]int32{ - "DEPRECATED": 0, -} - -func (x DeprecatedEnum) String() string { - return proto.EnumName(DeprecatedEnum_name, int32(x)) -} - -func (DeprecatedEnum) EnumDescriptor() ([]byte, []int) { - return xxx_File_deprecated_deprecated_proto_rawdesc_gzipped, []int{0} -} - -// DeprecatedRequest is a request to DeprecatedCall. -// -// Deprecated: Do not use. -type DeprecatedRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeprecatedRequest) Reset() { *m = DeprecatedRequest{} } -func (m *DeprecatedRequest) String() string { return proto.CompactTextString(m) } -func (*DeprecatedRequest) ProtoMessage() {} -func (*DeprecatedRequest) Descriptor() ([]byte, []int) { - return xxx_File_deprecated_deprecated_proto_rawdesc_gzipped, []int{0} -} - -func (m *DeprecatedRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeprecatedRequest.Unmarshal(m, b) -} -func (m *DeprecatedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeprecatedRequest.Marshal(b, m, deterministic) -} -func (m *DeprecatedRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeprecatedRequest.Merge(m, src) -} -func (m *DeprecatedRequest) XXX_Size() int { - return xxx_messageInfo_DeprecatedRequest.Size(m) -} -func (m *DeprecatedRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeprecatedRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DeprecatedRequest proto.InternalMessageInfo - -// Deprecated: Do not use. -type DeprecatedResponse struct { - // DeprecatedField contains a DeprecatedEnum. - DeprecatedField DeprecatedEnum `protobuf:"varint,1,opt,name=deprecated_field,json=deprecatedField,proto3,enum=deprecated.DeprecatedEnum" json:"deprecated_field,omitempty"` // Deprecated: Do not use. - // DeprecatedOneof contains a deprecated field. - // - // Types that are valid to be assigned to DeprecatedOneof: - // DeprecatedOneofField is a deprecated field. - // *DeprecatedResponse_DeprecatedOneofField - DeprecatedOneof isDeprecatedResponse_DeprecatedOneof `protobuf_oneof:"deprecated_oneof"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeprecatedResponse) Reset() { *m = DeprecatedResponse{} } -func (m *DeprecatedResponse) String() string { return proto.CompactTextString(m) } -func (*DeprecatedResponse) ProtoMessage() {} -func (*DeprecatedResponse) Descriptor() ([]byte, []int) { - return xxx_File_deprecated_deprecated_proto_rawdesc_gzipped, []int{1} -} - -func (m *DeprecatedResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeprecatedResponse.Unmarshal(m, b) -} -func (m *DeprecatedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeprecatedResponse.Marshal(b, m, deterministic) -} -func (m *DeprecatedResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeprecatedResponse.Merge(m, src) -} -func (m *DeprecatedResponse) XXX_Size() int { - return xxx_messageInfo_DeprecatedResponse.Size(m) -} -func (m *DeprecatedResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeprecatedResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DeprecatedResponse proto.InternalMessageInfo - -// Deprecated: Do not use. -func (m *DeprecatedResponse) GetDeprecatedField() DeprecatedEnum { - if m != nil { - return m.DeprecatedField - } - return DeprecatedEnum_DEPRECATED -} - -type isDeprecatedResponse_DeprecatedOneof interface { - isDeprecatedResponse_DeprecatedOneof() -} - -type DeprecatedResponse_DeprecatedOneofField struct { - DeprecatedOneofField string `protobuf:"bytes,2,opt,name=deprecated_oneof_field,json=deprecatedOneofField,proto3,oneof"` -} - -func (*DeprecatedResponse_DeprecatedOneofField) isDeprecatedResponse_DeprecatedOneof() {} - -func (m *DeprecatedResponse) GetDeprecatedOneof() isDeprecatedResponse_DeprecatedOneof { - if m != nil { - return m.DeprecatedOneof - } - return nil -} - -// Deprecated: Do not use. -func (m *DeprecatedResponse) GetDeprecatedOneofField() string { - if x, ok := m.GetDeprecatedOneof().(*DeprecatedResponse_DeprecatedOneofField); ok { - return x.DeprecatedOneofField - } - return "" -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*DeprecatedResponse) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*DeprecatedResponse_DeprecatedOneofField)(nil), - } -} - -func init() { - proto.RegisterFile("deprecated/deprecated.proto", xxx_File_deprecated_deprecated_proto_rawdesc_gzipped) - proto.RegisterEnum("deprecated.DeprecatedEnum", DeprecatedEnum_name, DeprecatedEnum_value) - proto.RegisterType((*DeprecatedRequest)(nil), "deprecated.DeprecatedRequest") - proto.RegisterType((*DeprecatedResponse)(nil), "deprecated.DeprecatedResponse") -} - -var xxx_File_deprecated_deprecated_proto_rawdesc = []byte{ - // 477 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x1b, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x2f, 0x64, 0x65, 0x70, - 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x64, - 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x22, 0x17, 0x0a, 0x11, 0x44, 0x65, 0x70, - 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x3a, 0x02, - 0x18, 0x01, 0x22, 0xb3, 0x01, 0x0a, 0x12, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, - 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x10, 0x64, 0x65, 0x70, - 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6e, 0x75, 0x6d, 0x42, - 0x02, 0x18, 0x01, 0x52, 0x0f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x12, 0x3a, 0x0a, 0x16, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, - 0x65, 0x64, 0x5f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x48, 0x00, 0x52, 0x14, 0x64, 0x65, 0x70, 0x72, - 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x3a, 0x02, 0x18, 0x01, 0x42, 0x12, 0x0a, 0x10, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, - 0x65, 0x64, 0x5f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2a, 0x28, 0x0a, 0x0e, 0x44, 0x65, 0x70, 0x72, - 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x0a, 0x44, 0x45, - 0x50, 0x52, 0x45, 0x43, 0x41, 0x54, 0x45, 0x44, 0x10, 0x00, 0x1a, 0x02, 0x08, 0x01, 0x1a, 0x02, - 0x18, 0x01, 0x32, 0x6e, 0x0a, 0x11, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x54, 0x0a, 0x0e, 0x44, 0x65, 0x70, 0x72, 0x65, - 0x63, 0x61, 0x74, 0x65, 0x64, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x1d, 0x2e, 0x64, 0x65, 0x70, 0x72, - 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, - 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x64, 0x65, 0x70, 0x72, 0x65, - 0x63, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x1a, 0x03, 0x88, - 0x02, 0x01, 0x42, 0x41, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, - 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, - 0x65, 0x64, 0xb8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var xxx_File_deprecated_deprecated_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_deprecated_deprecated_proto_rawdesc) - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// DeprecatedServiceClient is the client API for DeprecatedService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -// -// Deprecated: Do not use. -type DeprecatedServiceClient interface { - // DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse. - DeprecatedCall(ctx context.Context, in *DeprecatedRequest, opts ...grpc.CallOption) (*DeprecatedResponse, error) -} - -type deprecatedServiceClient struct { - cc *grpc.ClientConn -} - -// Deprecated: Do not use. -func NewDeprecatedServiceClient(cc *grpc.ClientConn) DeprecatedServiceClient { - return &deprecatedServiceClient{cc} -} - -// Deprecated: Do not use. -func (c *deprecatedServiceClient) DeprecatedCall(ctx context.Context, in *DeprecatedRequest, opts ...grpc.CallOption) (*DeprecatedResponse, error) { - out := new(DeprecatedResponse) - err := c.cc.Invoke(ctx, "/deprecated.DeprecatedService/DeprecatedCall", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// DeprecatedServiceServer is the server API for DeprecatedService service. -// -// Deprecated: Do not use. -type DeprecatedServiceServer interface { - // DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse. - DeprecatedCall(context.Context, *DeprecatedRequest) (*DeprecatedResponse, error) -} - -// Deprecated: Do not use. -func RegisterDeprecatedServiceServer(s *grpc.Server, srv DeprecatedServiceServer) { - s.RegisterService(&_DeprecatedService_serviceDesc, srv) -} - -func _DeprecatedService_DeprecatedCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeprecatedRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DeprecatedServiceServer).DeprecatedCall(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/deprecated.DeprecatedService/DeprecatedCall", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DeprecatedServiceServer).DeprecatedCall(ctx, req.(*DeprecatedRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _DeprecatedService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "deprecated.DeprecatedService", - HandlerType: (*DeprecatedServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "DeprecatedCall", - Handler: _DeprecatedService_DeprecatedCall_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "deprecated/deprecated.proto", -} diff --git a/protoc-gen-go/testdata/deprecated/deprecated.proto b/protoc-gen-go/testdata/deprecated/deprecated.proto deleted file mode 100644 index 192b15822a..0000000000 --- a/protoc-gen-go/testdata/deprecated/deprecated.proto +++ /dev/null @@ -1,74 +0,0 @@ -// 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. - -syntax = "proto3"; - -// package deprecated contains only deprecated messages and services. -package deprecated; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/deprecated"; - -option deprecated = true; // file-level deprecation - -// DeprecatedRequest is a request to DeprecatedCall. -message DeprecatedRequest { - option deprecated = true; -} - -message DeprecatedResponse { - // comment for DeprecatedResponse is omitted to guarantee deprecation - // message doesn't append unnecessary comments. - option deprecated = true; - // DeprecatedField contains a DeprecatedEnum. - DeprecatedEnum deprecated_field = 1 [deprecated=true]; - // DeprecatedOneof contains a deprecated field. - oneof deprecated_oneof { - // DeprecatedOneofField is a deprecated field. - string deprecated_oneof_field = 2 [deprecated=true]; - } -} - -// DeprecatedEnum contains deprecated values. -enum DeprecatedEnum { - option deprecated = true; - // DEPRECATED is the iota value of this enum. - DEPRECATED = 0 [deprecated=true]; -} - -// DeprecatedService is for making DeprecatedCalls -service DeprecatedService { - option deprecated = true; - - // DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse. - rpc DeprecatedCall(DeprecatedRequest) returns (DeprecatedResponse) { - option deprecated = true; - } -} diff --git a/protoc-gen-go/testdata/extension_base/extension_base.pb.go b/protoc-gen-go/testdata/extension_base/extension_base.pb.go deleted file mode 100644 index 1267fcfb77..0000000000 --- a/protoc-gen-go/testdata/extension_base/extension_base.pb.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: extension_base/extension_base.proto - -package extension_base - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type BaseMessage struct { - Height *int32 `protobuf:"varint,1,opt,name=height" json:"height,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BaseMessage) Reset() { *m = BaseMessage{} } -func (m *BaseMessage) String() string { return proto.CompactTextString(m) } -func (*BaseMessage) ProtoMessage() {} -func (*BaseMessage) Descriptor() ([]byte, []int) { - return xxx_File_extension_base_extension_base_proto_rawdesc_gzipped, []int{0} -} - -var extRange_BaseMessage = []proto.ExtensionRange{ - {Start: 4, End: 9}, - {Start: 16, End: 536870911}, -} - -func (*BaseMessage) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_BaseMessage -} - -func (m *BaseMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BaseMessage.Unmarshal(m, b) -} -func (m *BaseMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BaseMessage.Marshal(b, m, deterministic) -} -func (m *BaseMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_BaseMessage.Merge(m, src) -} -func (m *BaseMessage) XXX_Size() int { - return xxx_messageInfo_BaseMessage.Size(m) -} -func (m *BaseMessage) XXX_DiscardUnknown() { - xxx_messageInfo_BaseMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_BaseMessage proto.InternalMessageInfo - -func (m *BaseMessage) GetHeight() int32 { - if m != nil && m.Height != nil { - return *m.Height - } - return 0 -} - -// Another message that may be extended, using message_set_wire_format. -type OldStyleMessage struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `protobuf_messageset:"1" json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OldStyleMessage) Reset() { *m = OldStyleMessage{} } -func (m *OldStyleMessage) String() string { return proto.CompactTextString(m) } -func (*OldStyleMessage) ProtoMessage() {} -func (*OldStyleMessage) Descriptor() ([]byte, []int) { - return xxx_File_extension_base_extension_base_proto_rawdesc_gzipped, []int{1} -} - -var extRange_OldStyleMessage = []proto.ExtensionRange{ - {Start: 100, End: 2147483646}, -} - -func (*OldStyleMessage) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_OldStyleMessage -} - -func (m *OldStyleMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OldStyleMessage.Unmarshal(m, b) -} -func (m *OldStyleMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OldStyleMessage.Marshal(b, m, deterministic) -} -func (m *OldStyleMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_OldStyleMessage.Merge(m, src) -} -func (m *OldStyleMessage) XXX_Size() int { - return xxx_messageInfo_OldStyleMessage.Size(m) -} -func (m *OldStyleMessage) XXX_DiscardUnknown() { - xxx_messageInfo_OldStyleMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_OldStyleMessage proto.InternalMessageInfo - -func init() { - proto.RegisterFile("extension_base/extension_base.proto", xxx_File_extension_base_extension_base_proto_rawdesc_gzipped) - proto.RegisterType((*BaseMessage)(nil), "extension_base.BaseMessage") - proto.RegisterType((*OldStyleMessage)(nil), "extension_base.OldStyleMessage") -} - -var xxx_File_extension_base_extension_base_proto_rawdesc = []byte{ - // 209 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x23, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, - 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x5f, 0x62, 0x61, 0x73, 0x65, 0x22, 0x35, 0x0a, 0x0b, 0x42, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x2a, 0x04, 0x08, 0x04, - 0x10, 0x0a, 0x2a, 0x08, 0x08, 0x10, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x1f, 0x0a, 0x0f, - 0x4f, 0x6c, 0x64, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, - 0x08, 0x08, 0x64, 0x10, 0xff, 0xff, 0xff, 0xff, 0x07, 0x3a, 0x02, 0x08, 0x01, 0x42, 0x42, 0x5a, - 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, - 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, - 0x74, 0x61, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, - 0x65, -} - -var xxx_File_extension_base_extension_base_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_extension_base_extension_base_proto_rawdesc) diff --git a/protoc-gen-go/testdata/extension_base/extension_base.proto b/protoc-gen-go/testdata/extension_base/extension_base.proto deleted file mode 100644 index 0ba74def8b..0000000000 --- a/protoc-gen-go/testdata/extension_base/extension_base.proto +++ /dev/null @@ -1,48 +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. - -syntax = "proto2"; - -package extension_base; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/extension_base"; - -message BaseMessage { - optional int32 height = 1; - extensions 4 to 9; - extensions 16 to max; -} - -// Another message that may be extended, using message_set_wire_format. -message OldStyleMessage { - option message_set_wire_format = true; - extensions 100 to max; -} diff --git a/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go b/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go deleted file mode 100644 index c5afa2f046..0000000000 --- a/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: extension_extra/extension_extra.proto - -package extension_extra - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type ExtraMessage struct { - Width *int32 `protobuf:"varint,1,opt,name=width" json:"width,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExtraMessage) Reset() { *m = ExtraMessage{} } -func (m *ExtraMessage) String() string { return proto.CompactTextString(m) } -func (*ExtraMessage) ProtoMessage() {} -func (*ExtraMessage) Descriptor() ([]byte, []int) { - return xxx_File_extension_extra_extension_extra_proto_rawdesc_gzipped, []int{0} -} - -func (m *ExtraMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExtraMessage.Unmarshal(m, b) -} -func (m *ExtraMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExtraMessage.Marshal(b, m, deterministic) -} -func (m *ExtraMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExtraMessage.Merge(m, src) -} -func (m *ExtraMessage) XXX_Size() int { - return xxx_messageInfo_ExtraMessage.Size(m) -} -func (m *ExtraMessage) XXX_DiscardUnknown() { - xxx_messageInfo_ExtraMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_ExtraMessage proto.InternalMessageInfo - -func (m *ExtraMessage) GetWidth() int32 { - if m != nil && m.Width != nil { - return *m.Width - } - return 0 -} - -func init() { - proto.RegisterFile("extension_extra/extension_extra.proto", xxx_File_extension_extra_extension_extra_proto_rawdesc_gzipped) - proto.RegisterType((*ExtraMessage)(nil), "extension_extra.ExtraMessage") -} - -var xxx_File_extension_extra_extension_extra_proto_rawdesc = []byte{ - // 163 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x25, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x72, - 0x61, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x72, - 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x24, 0x0a, 0x0c, 0x45, 0x78, 0x74, 0x72, - 0x61, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, - 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x42, 0x43, - 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, - 0x61, 0x74, 0x61, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, - 0x74, 0x72, 0x61, -} - -var xxx_File_extension_extra_extension_extra_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_extension_extra_extension_extra_proto_rawdesc) diff --git a/protoc-gen-go/testdata/extension_extra/extension_extra.proto b/protoc-gen-go/testdata/extension_extra/extension_extra.proto deleted file mode 100644 index 1dd03e70b9..0000000000 --- a/protoc-gen-go/testdata/extension_extra/extension_extra.proto +++ /dev/null @@ -1,40 +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. - -syntax = "proto2"; - -package extension_extra; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra"; - -message ExtraMessage { - optional int32 width = 1; -} diff --git a/protoc-gen-go/testdata/extension_test.go b/protoc-gen-go/testdata/extension_test.go deleted file mode 100644 index 2e0ff4e3da..0000000000 --- a/protoc-gen-go/testdata/extension_test.go +++ /dev/null @@ -1,179 +0,0 @@ -// 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. - -// Test that we can use protocol buffers that use extensions. - -package testdata - -import ( - "bytes" - "regexp" - "testing" - - "github.com/golang/protobuf/proto" - base "github.com/golang/protobuf/protoc-gen-go/testdata/extension_base" - user "github.com/golang/protobuf/protoc-gen-go/testdata/extension_user" -) - -func TestSingleFieldExtension(t *testing.T) { - bm := &base.BaseMessage{ - Height: proto.Int32(178), - } - - // Use extension within scope of another type. - vol := proto.Uint32(11) - err := proto.SetExtension(bm, user.E_LoudMessage_Volume, vol) - if err != nil { - t.Fatal("Failed setting extension:", err) - } - buf, err := proto.Marshal(bm) - if err != nil { - t.Fatal("Failed encoding message with extension:", err) - } - bm_new := new(base.BaseMessage) - if err := proto.Unmarshal(buf, bm_new); err != nil { - t.Fatal("Failed decoding message with extension:", err) - } - if !proto.HasExtension(bm_new, user.E_LoudMessage_Volume) { - t.Fatal("Decoded message didn't contain extension.") - } - vol_out, err := proto.GetExtension(bm_new, user.E_LoudMessage_Volume) - if err != nil { - t.Fatal("Failed getting extension:", err) - } - if v := vol_out.(*uint32); *v != *vol { - t.Errorf("vol_out = %v, expected %v", *v, *vol) - } - proto.ClearExtension(bm_new, user.E_LoudMessage_Volume) - if proto.HasExtension(bm_new, user.E_LoudMessage_Volume) { - t.Fatal("Failed clearing extension.") - } -} - -func TestMessageExtension(t *testing.T) { - bm := &base.BaseMessage{ - Height: proto.Int32(179), - } - - // Use extension that is itself a message. - um := &user.UserMessage{ - Name: proto.String("Dave"), - Rank: proto.String("Major"), - } - err := proto.SetExtension(bm, user.E_LoginMessage_UserMessage, um) - if err != nil { - t.Fatal("Failed setting extension:", err) - } - buf, err := proto.Marshal(bm) - if err != nil { - t.Fatal("Failed encoding message with extension:", err) - } - bm_new := new(base.BaseMessage) - if err := proto.Unmarshal(buf, bm_new); err != nil { - t.Fatal("Failed decoding message with extension:", err) - } - if !proto.HasExtension(bm_new, user.E_LoginMessage_UserMessage) { - t.Fatal("Decoded message didn't contain extension.") - } - um_out, err := proto.GetExtension(bm_new, user.E_LoginMessage_UserMessage) - if err != nil { - t.Fatal("Failed getting extension:", err) - } - if n := um_out.(*user.UserMessage).Name; *n != *um.Name { - t.Errorf("um_out.Name = %q, expected %q", *n, *um.Name) - } - if r := um_out.(*user.UserMessage).Rank; *r != *um.Rank { - t.Errorf("um_out.Rank = %q, expected %q", *r, *um.Rank) - } - proto.ClearExtension(bm_new, user.E_LoginMessage_UserMessage) - if proto.HasExtension(bm_new, user.E_LoginMessage_UserMessage) { - t.Fatal("Failed clearing extension.") - } -} - -func TestTopLevelExtension(t *testing.T) { - bm := &base.BaseMessage{ - Height: proto.Int32(179), - } - - width := proto.Int32(17) - err := proto.SetExtension(bm, user.E_Width, width) - if err != nil { - t.Fatal("Failed setting extension:", err) - } - buf, err := proto.Marshal(bm) - if err != nil { - t.Fatal("Failed encoding message with extension:", err) - } - bm_new := new(base.BaseMessage) - if err := proto.Unmarshal(buf, bm_new); err != nil { - t.Fatal("Failed decoding message with extension:", err) - } - if !proto.HasExtension(bm_new, user.E_Width) { - t.Fatal("Decoded message didn't contain extension.") - } - width_out, err := proto.GetExtension(bm_new, user.E_Width) - if err != nil { - t.Fatal("Failed getting extension:", err) - } - if w := width_out.(*int32); *w != *width { - t.Errorf("width_out = %v, expected %v", *w, *width) - } - proto.ClearExtension(bm_new, user.E_Width) - if proto.HasExtension(bm_new, user.E_Width) { - t.Fatal("Failed clearing extension.") - } -} - -func TestMessageSetWireFormat(t *testing.T) { - osm := new(base.OldStyleMessage) - osp := &user.OldStyleParcel{ - Name: proto.String("Dave"), - Height: proto.Int32(178), - } - - err := proto.SetExtension(osm, user.E_OldStyleParcel_MessageSetExtension, osp) - if err != nil { - t.Fatal("Failed setting extension:", err) - } - - buf, err := proto.Marshal(osm) - if err != nil { - t.Fatal("Failed encoding message:", err) - } - - // Data generated from Python implementation. - expected := []byte{ - 11, 16, 209, 15, 26, 9, 10, 4, 68, 97, 118, 101, 16, 178, 1, 12, - } - - if !bytes.Equal(expected, buf) { - t.Errorf("Encoding mismatch.\nwant %+v\n got %+v", expected, buf) - } - - // Check that it is restored correctly. - osm = new(base.OldStyleMessage) - if err := proto.Unmarshal(buf, osm); err != nil { - t.Fatal("Failed decoding message:", err) - } - osp_out, err := proto.GetExtension(osm, user.E_OldStyleParcel_MessageSetExtension) - if err != nil { - t.Fatal("Failed getting extension:", err) - } - osp = osp_out.(*user.OldStyleParcel) - if *osp.Name != "Dave" || *osp.Height != 178 { - t.Errorf("Retrieved extension from decoded message is not correct: %+v", osp) - } -} - -func main() { - // simpler than rigging up gotest - testing.Main(regexp.MatchString, []testing.InternalTest{ - {"TestSingleFieldExtension", TestSingleFieldExtension}, - {"TestMessageExtension", TestMessageExtension}, - {"TestTopLevelExtension", TestTopLevelExtension}, - }, - []testing.InternalBenchmark{}, - []testing.InternalExample{}) -} diff --git a/protoc-gen-go/testdata/extension_user/extension_user.pb.go b/protoc-gen-go/testdata/extension_user/extension_user.pb.go deleted file mode 100644 index c4accf1790..0000000000 --- a/protoc-gen-go/testdata/extension_user/extension_user.pb.go +++ /dev/null @@ -1,442 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: extension_user/extension_user.proto - -package extension_user - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" - extension_base "github.com/golang/protobuf/protoc-gen-go/testdata/extension_base" - extension_extra "github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type UserMessage struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Rank *string `protobuf:"bytes,2,opt,name=rank" json:"rank,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UserMessage) Reset() { *m = UserMessage{} } -func (m *UserMessage) String() string { return proto.CompactTextString(m) } -func (*UserMessage) ProtoMessage() {} -func (*UserMessage) Descriptor() ([]byte, []int) { - return xxx_File_extension_user_extension_user_proto_rawdesc_gzipped, []int{0} -} - -func (m *UserMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserMessage.Unmarshal(m, b) -} -func (m *UserMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserMessage.Marshal(b, m, deterministic) -} -func (m *UserMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserMessage.Merge(m, src) -} -func (m *UserMessage) XXX_Size() int { - return xxx_messageInfo_UserMessage.Size(m) -} -func (m *UserMessage) XXX_DiscardUnknown() { - xxx_messageInfo_UserMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_UserMessage proto.InternalMessageInfo - -func (m *UserMessage) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *UserMessage) GetRank() string { - if m != nil && m.Rank != nil { - return *m.Rank - } - return "" -} - -// Extend inside the scope of another type -type LoudMessage struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LoudMessage) Reset() { *m = LoudMessage{} } -func (m *LoudMessage) String() string { return proto.CompactTextString(m) } -func (*LoudMessage) ProtoMessage() {} -func (*LoudMessage) Descriptor() ([]byte, []int) { - return xxx_File_extension_user_extension_user_proto_rawdesc_gzipped, []int{1} -} - -var extRange_LoudMessage = []proto.ExtensionRange{ - {Start: 100, End: 536870911}, -} - -func (*LoudMessage) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_LoudMessage -} - -func (m *LoudMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LoudMessage.Unmarshal(m, b) -} -func (m *LoudMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LoudMessage.Marshal(b, m, deterministic) -} -func (m *LoudMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_LoudMessage.Merge(m, src) -} -func (m *LoudMessage) XXX_Size() int { - return xxx_messageInfo_LoudMessage.Size(m) -} -func (m *LoudMessage) XXX_DiscardUnknown() { - xxx_messageInfo_LoudMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_LoudMessage proto.InternalMessageInfo - -// Extend inside the scope of another type, using a message. -type LoginMessage struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LoginMessage) Reset() { *m = LoginMessage{} } -func (m *LoginMessage) String() string { return proto.CompactTextString(m) } -func (*LoginMessage) ProtoMessage() {} -func (*LoginMessage) Descriptor() ([]byte, []int) { - return xxx_File_extension_user_extension_user_proto_rawdesc_gzipped, []int{2} -} - -func (m *LoginMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LoginMessage.Unmarshal(m, b) -} -func (m *LoginMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LoginMessage.Marshal(b, m, deterministic) -} -func (m *LoginMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_LoginMessage.Merge(m, src) -} -func (m *LoginMessage) XXX_Size() int { - return xxx_messageInfo_LoginMessage.Size(m) -} -func (m *LoginMessage) XXX_DiscardUnknown() { - xxx_messageInfo_LoginMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_LoginMessage proto.InternalMessageInfo - -type Detail struct { - Color *string `protobuf:"bytes,1,opt,name=color" json:"color,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Detail) Reset() { *m = Detail{} } -func (m *Detail) String() string { return proto.CompactTextString(m) } -func (*Detail) ProtoMessage() {} -func (*Detail) Descriptor() ([]byte, []int) { - return xxx_File_extension_user_extension_user_proto_rawdesc_gzipped, []int{3} -} - -func (m *Detail) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Detail.Unmarshal(m, b) -} -func (m *Detail) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Detail.Marshal(b, m, deterministic) -} -func (m *Detail) XXX_Merge(src proto.Message) { - xxx_messageInfo_Detail.Merge(m, src) -} -func (m *Detail) XXX_Size() int { - return xxx_messageInfo_Detail.Size(m) -} -func (m *Detail) XXX_DiscardUnknown() { - xxx_messageInfo_Detail.DiscardUnknown(m) -} - -var xxx_messageInfo_Detail proto.InternalMessageInfo - -func (m *Detail) GetColor() string { - if m != nil && m.Color != nil { - return *m.Color - } - return "" -} - -// An extension of an extension -type Announcement struct { - Words *string `protobuf:"bytes,1,opt,name=words" json:"words,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Announcement) Reset() { *m = Announcement{} } -func (m *Announcement) String() string { return proto.CompactTextString(m) } -func (*Announcement) ProtoMessage() {} -func (*Announcement) Descriptor() ([]byte, []int) { - return xxx_File_extension_user_extension_user_proto_rawdesc_gzipped, []int{4} -} - -func (m *Announcement) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Announcement.Unmarshal(m, b) -} -func (m *Announcement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Announcement.Marshal(b, m, deterministic) -} -func (m *Announcement) XXX_Merge(src proto.Message) { - xxx_messageInfo_Announcement.Merge(m, src) -} -func (m *Announcement) XXX_Size() int { - return xxx_messageInfo_Announcement.Size(m) -} -func (m *Announcement) XXX_DiscardUnknown() { - xxx_messageInfo_Announcement.DiscardUnknown(m) -} - -var xxx_messageInfo_Announcement proto.InternalMessageInfo - -func (m *Announcement) GetWords() string { - if m != nil && m.Words != nil { - return *m.Words - } - return "" -} - -// Something that can be put in a message set. -type OldStyleParcel struct { - Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` - Height *int32 `protobuf:"varint,2,opt,name=height" json:"height,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OldStyleParcel) Reset() { *m = OldStyleParcel{} } -func (m *OldStyleParcel) String() string { return proto.CompactTextString(m) } -func (*OldStyleParcel) ProtoMessage() {} -func (*OldStyleParcel) Descriptor() ([]byte, []int) { - return xxx_File_extension_user_extension_user_proto_rawdesc_gzipped, []int{5} -} - -func (m *OldStyleParcel) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OldStyleParcel.Unmarshal(m, b) -} -func (m *OldStyleParcel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OldStyleParcel.Marshal(b, m, deterministic) -} -func (m *OldStyleParcel) XXX_Merge(src proto.Message) { - xxx_messageInfo_OldStyleParcel.Merge(m, src) -} -func (m *OldStyleParcel) XXX_Size() int { - return xxx_messageInfo_OldStyleParcel.Size(m) -} -func (m *OldStyleParcel) XXX_DiscardUnknown() { - xxx_messageInfo_OldStyleParcel.DiscardUnknown(m) -} - -var xxx_messageInfo_OldStyleParcel proto.InternalMessageInfo - -func (m *OldStyleParcel) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *OldStyleParcel) GetHeight() int32 { - if m != nil && m.Height != nil { - return *m.Height - } - return 0 -} - -var E_UserMessage = &proto.ExtensionDesc{ - ExtendedType: (*extension_base.BaseMessage)(nil), - ExtensionType: (*UserMessage)(nil), - Field: 5, - Name: "extension_user.user_message", - Tag: "bytes,5,opt,name=user_message", - Filename: "extension_user/extension_user.proto", -} - -var E_ExtraMessage = &proto.ExtensionDesc{ - ExtendedType: (*extension_base.BaseMessage)(nil), - ExtensionType: (*extension_extra.ExtraMessage)(nil), - Field: 9, - Name: "extension_user.extra_message", - Tag: "bytes,9,opt,name=extra_message", - Filename: "extension_user/extension_user.proto", -} - -var E_Width = &proto.ExtensionDesc{ - ExtendedType: (*extension_base.BaseMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 6, - Name: "extension_user.width", - Tag: "varint,6,opt,name=width", - Filename: "extension_user/extension_user.proto", -} - -var E_Area = &proto.ExtensionDesc{ - ExtendedType: (*extension_base.BaseMessage)(nil), - ExtensionType: (*int64)(nil), - Field: 7, - Name: "extension_user.area", - Tag: "varint,7,opt,name=area", - Filename: "extension_user/extension_user.proto", -} - -var E_Detail = &proto.ExtensionDesc{ - ExtendedType: (*extension_base.BaseMessage)(nil), - ExtensionType: ([]*Detail)(nil), - Field: 17, - Name: "extension_user.detail", - Tag: "bytes,17,rep,name=detail", - Filename: "extension_user/extension_user.proto", -} - -var E_LoudMessage_Volume = &proto.ExtensionDesc{ - ExtendedType: (*extension_base.BaseMessage)(nil), - ExtensionType: (*uint32)(nil), - Field: 8, - Name: "extension_user.LoudMessage.volume", - Tag: "varint,8,opt,name=volume", - Filename: "extension_user/extension_user.proto", -} - -var E_LoginMessage_UserMessage = &proto.ExtensionDesc{ - ExtendedType: (*extension_base.BaseMessage)(nil), - ExtensionType: (*UserMessage)(nil), - Field: 16, - Name: "extension_user.LoginMessage.user_message", - Tag: "bytes,16,opt,name=user_message", - Filename: "extension_user/extension_user.proto", -} - -var E_Announcement_LoudExt = &proto.ExtensionDesc{ - ExtendedType: (*LoudMessage)(nil), - ExtensionType: (*Announcement)(nil), - Field: 100, - Name: "extension_user.Announcement.loud_ext", - Tag: "bytes,100,opt,name=loud_ext", - Filename: "extension_user/extension_user.proto", -} - -var E_OldStyleParcel_MessageSetExtension = &proto.ExtensionDesc{ - ExtendedType: (*extension_base.OldStyleMessage)(nil), - ExtensionType: (*OldStyleParcel)(nil), - Field: 2001, - Name: "extension_user.OldStyleParcel", - Tag: "bytes,2001,opt,name=message_set_extension", - Filename: "extension_user/extension_user.proto", -} - -func init() { - proto.RegisterFile("extension_user/extension_user.proto", xxx_File_extension_user_extension_user_proto_rawdesc_gzipped) - proto.RegisterType((*UserMessage)(nil), "extension_user.UserMessage") - proto.RegisterType((*LoudMessage)(nil), "extension_user.LoudMessage") - proto.RegisterType((*LoginMessage)(nil), "extension_user.LoginMessage") - proto.RegisterType((*Detail)(nil), "extension_user.Detail") - proto.RegisterType((*Announcement)(nil), "extension_user.Announcement") - proto.RegisterType((*OldStyleParcel)(nil), "extension_user.OldStyleParcel") - proto.RegisterExtension(E_UserMessage) - proto.RegisterExtension(E_ExtraMessage) - proto.RegisterExtension(E_Width) - proto.RegisterExtension(E_Area) - proto.RegisterExtension(E_Detail) - proto.RegisterExtension(E_LoudMessage_Volume) - proto.RegisterExtension(E_LoginMessage_UserMessage) - proto.RegisterExtension(E_Announcement_LoudExt) - proto.RegisterExtension(E_OldStyleParcel_MessageSetExtension) -} - -var xxx_File_extension_user_extension_user_proto_rawdesc = []byte{ - // 1143 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x23, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, - 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x5f, 0x75, 0x73, 0x65, 0x72, 0x1a, 0x23, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, - 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x25, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x2f, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x35, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x22, 0x4c, 0x0a, 0x0b, 0x4c, 0x6f, 0x75, 0x64, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, 0x80, 0x80, 0x80, - 0x02, 0x32, 0x33, 0x0a, 0x06, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x1b, 0x2e, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, - 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, - 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x22, 0x6b, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x5b, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x22, 0x1e, 0x0a, 0x06, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, - 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, - 0x6c, 0x6f, 0x72, 0x22, 0x7a, 0x0a, 0x0c, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x32, 0x54, 0x0a, 0x08, 0x6c, 0x6f, 0x75, - 0x64, 0x5f, 0x65, 0x78, 0x74, 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x75, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, - 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x78, 0x74, 0x22, - 0xb2, 0x01, 0x0a, 0x0e, 0x4f, 0x6c, 0x64, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x50, 0x61, 0x72, 0x63, - 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x32, 0x74, - 0x0a, 0x15, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x4f, 0x6c, 0x64, 0x53, 0x74, 0x79, 0x6c, - 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xd1, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1e, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, - 0x2e, 0x4f, 0x6c, 0x64, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x50, 0x61, 0x72, 0x63, 0x65, 0x6c, 0x52, - 0x13, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x5b, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x3a, 0x5f, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, - 0x61, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x72, 0x61, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x3a, 0x31, 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12, 0x1b, 0x2e, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, - 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x77, 0x69, 0x64, 0x74, 0x68, 0x3a, 0x2f, 0x0a, 0x04, 0x61, 0x72, 0x65, 0x61, 0x12, 0x1b, 0x2e, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x42, - 0x61, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x04, 0x61, 0x72, 0x65, 0x61, 0x3a, 0x4b, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, - 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x73, - 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x11, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, - 0x75, 0x73, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x64, 0x65, 0x74, - 0x61, 0x69, 0x6c, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, - 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, -} - -var xxx_File_extension_user_extension_user_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_extension_user_extension_user_proto_rawdesc) diff --git a/protoc-gen-go/testdata/extension_user/extension_user.proto b/protoc-gen-go/testdata/extension_user/extension_user.proto deleted file mode 100644 index 033c186c03..0000000000 --- a/protoc-gen-go/testdata/extension_user/extension_user.proto +++ /dev/null @@ -1,102 +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. - -syntax = "proto2"; - -import "extension_base/extension_base.proto"; -import "extension_extra/extension_extra.proto"; - -package extension_user; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/extension_user"; - -message UserMessage { - optional string name = 1; - optional string rank = 2; -} - -// Extend with a message -extend extension_base.BaseMessage { - optional UserMessage user_message = 5; -} - -// Extend with a foreign message -extend extension_base.BaseMessage { - optional extension_extra.ExtraMessage extra_message = 9; -} - -// Extend with some primitive types -extend extension_base.BaseMessage { - optional int32 width = 6; - optional int64 area = 7; -} - -// Extend inside the scope of another type -message LoudMessage { - extend extension_base.BaseMessage { - optional uint32 volume = 8; - } - extensions 100 to max; -} - -// Extend inside the scope of another type, using a message. -message LoginMessage { - extend extension_base.BaseMessage { - optional UserMessage user_message = 16; - } -} - -// Extend with a repeated field -extend extension_base.BaseMessage { - repeated Detail detail = 17; -} - -message Detail { - optional string color = 1; -} - -// An extension of an extension -message Announcement { - optional string words = 1; - extend LoudMessage { - optional Announcement loud_ext = 100; - } -} - -// Something that can be put in a message set. -message OldStyleParcel { - extend extension_base.OldStyleMessage { - optional OldStyleParcel message_set_extension = 2001; - } - - required string name = 1; - optional int32 height = 2; -} diff --git a/protoc-gen-go/testdata/grpc/grpc.pb.go b/protoc-gen-go/testdata/grpc/grpc.pb.go deleted file mode 100644 index fcc46e79cf..0000000000 --- a/protoc-gen-go/testdata/grpc/grpc.pb.go +++ /dev/null @@ -1,455 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: grpc/grpc.proto - -package testing - -import ( - context "context" - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" - grpc "google.golang.org/grpc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type SimpleRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } -func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } -func (*SimpleRequest) ProtoMessage() {} -func (*SimpleRequest) Descriptor() ([]byte, []int) { - return xxx_File_grpc_grpc_proto_rawdesc_gzipped, []int{0} -} - -func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) -} -func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic) -} -func (m *SimpleRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleRequest.Merge(m, src) -} -func (m *SimpleRequest) XXX_Size() int { - return xxx_messageInfo_SimpleRequest.Size(m) -} -func (m *SimpleRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SimpleRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo - -type SimpleResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } -func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } -func (*SimpleResponse) ProtoMessage() {} -func (*SimpleResponse) Descriptor() ([]byte, []int) { - return xxx_File_grpc_grpc_proto_rawdesc_gzipped, []int{1} -} - -func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) -} -func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic) -} -func (m *SimpleResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleResponse.Merge(m, src) -} -func (m *SimpleResponse) XXX_Size() int { - return xxx_messageInfo_SimpleResponse.Size(m) -} -func (m *SimpleResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SimpleResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo - -type StreamMsg struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StreamMsg) Reset() { *m = StreamMsg{} } -func (m *StreamMsg) String() string { return proto.CompactTextString(m) } -func (*StreamMsg) ProtoMessage() {} -func (*StreamMsg) Descriptor() ([]byte, []int) { - return xxx_File_grpc_grpc_proto_rawdesc_gzipped, []int{2} -} - -func (m *StreamMsg) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamMsg.Unmarshal(m, b) -} -func (m *StreamMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamMsg.Marshal(b, m, deterministic) -} -func (m *StreamMsg) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamMsg.Merge(m, src) -} -func (m *StreamMsg) XXX_Size() int { - return xxx_messageInfo_StreamMsg.Size(m) -} -func (m *StreamMsg) XXX_DiscardUnknown() { - xxx_messageInfo_StreamMsg.DiscardUnknown(m) -} - -var xxx_messageInfo_StreamMsg proto.InternalMessageInfo - -type StreamMsg2 struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StreamMsg2) Reset() { *m = StreamMsg2{} } -func (m *StreamMsg2) String() string { return proto.CompactTextString(m) } -func (*StreamMsg2) ProtoMessage() {} -func (*StreamMsg2) Descriptor() ([]byte, []int) { - return xxx_File_grpc_grpc_proto_rawdesc_gzipped, []int{3} -} - -func (m *StreamMsg2) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamMsg2.Unmarshal(m, b) -} -func (m *StreamMsg2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamMsg2.Marshal(b, m, deterministic) -} -func (m *StreamMsg2) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamMsg2.Merge(m, src) -} -func (m *StreamMsg2) XXX_Size() int { - return xxx_messageInfo_StreamMsg2.Size(m) -} -func (m *StreamMsg2) XXX_DiscardUnknown() { - xxx_messageInfo_StreamMsg2.DiscardUnknown(m) -} - -var xxx_messageInfo_StreamMsg2 proto.InternalMessageInfo - -func init() { - proto.RegisterFile("grpc/grpc.proto", xxx_File_grpc_grpc_proto_rawdesc_gzipped) - proto.RegisterType((*SimpleRequest)(nil), "grpc.testing.SimpleRequest") - proto.RegisterType((*SimpleResponse)(nil), "grpc.testing.SimpleResponse") - proto.RegisterType((*StreamMsg)(nil), "grpc.testing.StreamMsg") - proto.RegisterType((*StreamMsg2)(nil), "grpc.testing.StreamMsg2") -} - -var xxx_File_grpc_grpc_proto_rawdesc = []byte{ - // 450 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x0f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x0c, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x22, - 0x0f, 0x0a, 0x0d, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x0b, 0x0a, 0x09, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x22, - 0x0c, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x32, 0x32, 0x98, 0x02, - 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x43, - 0x61, 0x6c, 0x6c, 0x12, 0x1b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, - 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1c, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, - 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, - 0x0a, 0x0a, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1b, 0x2e, 0x67, - 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x6d, 0x70, - 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, - 0x73, 0x67, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x08, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x12, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x1a, 0x1c, 0x2e, 0x67, 0x72, 0x70, 0x63, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x3d, 0x0a, 0x04, 0x42, 0x69, 0x64, - 0x69, 0x12, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, - 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x1a, 0x18, 0x2e, 0x67, 0x72, 0x70, - 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x4d, 0x73, 0x67, 0x32, 0x28, 0x01, 0x30, 0x01, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, - 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x3b, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var xxx_File_grpc_grpc_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_grpc_grpc_proto_rawdesc) - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// TestClient is the client API for Test service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type TestClient interface { - UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) - // This RPC streams from the server only. - Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) - // This RPC streams from the client. - Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) - // This one streams in both directions. - Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) -} - -type testClient struct { - cc *grpc.ClientConn -} - -func NewTestClient(cc *grpc.ClientConn) TestClient { - return &testClient{cc} -} - -func (c *testClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { - out := new(SimpleResponse) - err := c.cc.Invoke(ctx, "/grpc.testing.Test/UnaryCall", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *testClient) Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[0], "/grpc.testing.Test/Downstream", opts...) - if err != nil { - return nil, err - } - x := &testDownstreamClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Test_DownstreamClient interface { - Recv() (*StreamMsg, error) - grpc.ClientStream -} - -type testDownstreamClient struct { - grpc.ClientStream -} - -func (x *testDownstreamClient) Recv() (*StreamMsg, error) { - m := new(StreamMsg) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *testClient) Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[1], "/grpc.testing.Test/Upstream", opts...) - if err != nil { - return nil, err - } - x := &testUpstreamClient{stream} - return x, nil -} - -type Test_UpstreamClient interface { - Send(*StreamMsg) error - CloseAndRecv() (*SimpleResponse, error) - grpc.ClientStream -} - -type testUpstreamClient struct { - grpc.ClientStream -} - -func (x *testUpstreamClient) Send(m *StreamMsg) error { - return x.ClientStream.SendMsg(m) -} - -func (x *testUpstreamClient) CloseAndRecv() (*SimpleResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(SimpleResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *testClient) Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) { - stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[2], "/grpc.testing.Test/Bidi", opts...) - if err != nil { - return nil, err - } - x := &testBidiClient{stream} - return x, nil -} - -type Test_BidiClient interface { - Send(*StreamMsg) error - Recv() (*StreamMsg2, error) - grpc.ClientStream -} - -type testBidiClient struct { - grpc.ClientStream -} - -func (x *testBidiClient) Send(m *StreamMsg) error { - return x.ClientStream.SendMsg(m) -} - -func (x *testBidiClient) Recv() (*StreamMsg2, error) { - m := new(StreamMsg2) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// TestServer is the server API for Test service. -type TestServer interface { - UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) - // This RPC streams from the server only. - Downstream(*SimpleRequest, Test_DownstreamServer) error - // This RPC streams from the client. - Upstream(Test_UpstreamServer) error - // This one streams in both directions. - Bidi(Test_BidiServer) error -} - -func RegisterTestServer(s *grpc.Server, srv TestServer) { - s.RegisterService(&_Test_serviceDesc, srv) -} - -func _Test_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SimpleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TestServer).UnaryCall(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/grpc.testing.Test/UnaryCall", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TestServer).UnaryCall(ctx, req.(*SimpleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Test_Downstream_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(SimpleRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(TestServer).Downstream(m, &testDownstreamServer{stream}) -} - -type Test_DownstreamServer interface { - Send(*StreamMsg) error - grpc.ServerStream -} - -type testDownstreamServer struct { - grpc.ServerStream -} - -func (x *testDownstreamServer) Send(m *StreamMsg) error { - return x.ServerStream.SendMsg(m) -} - -func _Test_Upstream_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TestServer).Upstream(&testUpstreamServer{stream}) -} - -type Test_UpstreamServer interface { - SendAndClose(*SimpleResponse) error - Recv() (*StreamMsg, error) - grpc.ServerStream -} - -type testUpstreamServer struct { - grpc.ServerStream -} - -func (x *testUpstreamServer) SendAndClose(m *SimpleResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *testUpstreamServer) Recv() (*StreamMsg, error) { - m := new(StreamMsg) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Test_Bidi_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TestServer).Bidi(&testBidiServer{stream}) -} - -type Test_BidiServer interface { - Send(*StreamMsg2) error - Recv() (*StreamMsg, error) - grpc.ServerStream -} - -type testBidiServer struct { - grpc.ServerStream -} - -func (x *testBidiServer) Send(m *StreamMsg2) error { - return x.ServerStream.SendMsg(m) -} - -func (x *testBidiServer) Recv() (*StreamMsg, error) { - m := new(StreamMsg) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -var _Test_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.testing.Test", - HandlerType: (*TestServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "UnaryCall", - Handler: _Test_UnaryCall_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Downstream", - Handler: _Test_Downstream_Handler, - ServerStreams: true, - }, - { - StreamName: "Upstream", - Handler: _Test_Upstream_Handler, - ClientStreams: true, - }, - { - StreamName: "Bidi", - Handler: _Test_Bidi_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "grpc/grpc.proto", -} diff --git a/protoc-gen-go/testdata/grpc/grpc.proto b/protoc-gen-go/testdata/grpc/grpc.proto deleted file mode 100644 index 0e5c64a91e..0000000000 --- a/protoc-gen-go/testdata/grpc/grpc.proto +++ /dev/null @@ -1,61 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2015 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. - -syntax = "proto3"; - -package grpc.testing; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/grpc;testing"; - -message SimpleRequest { -} - -message SimpleResponse { -} - -message StreamMsg { -} - -message StreamMsg2 { -} - -service Test { - rpc UnaryCall(SimpleRequest) returns (SimpleResponse); - - // This RPC streams from the server only. - rpc Downstream(SimpleRequest) returns (stream StreamMsg); - - // This RPC streams from the client. - rpc Upstream(stream StreamMsg) returns (SimpleResponse); - - // This one streams in both directions. - rpc Bidi(stream StreamMsg) returns (stream StreamMsg2); -} diff --git a/protoc-gen-go/testdata/import_public/a.pb.go b/protoc-gen-go/testdata/import_public/a.pb.go deleted file mode 100644 index 9bc29a859f..0000000000 --- a/protoc-gen-go/testdata/import_public/a.pb.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: import_public/a.proto - -package import_public - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" - sub "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// Symbols defined in public import of import_public/sub/a.proto - -type E = sub.E - -const E_ZERO = sub.E_ZERO - -var E_name = sub.E_name -var E_value = sub.E_value - -type M_Subenum = sub.M_Subenum - -const M_M_ZERO = sub.M_M_ZERO - -var M_Subenum_name = sub.M_Subenum_name -var M_Subenum_value = sub.M_Subenum_value - -type M_Submessage_Submessage_Subenum = sub.M_Submessage_Submessage_Subenum - -const M_Submessage_M_SUBMESSAGE_ZERO = sub.M_Submessage_M_SUBMESSAGE_ZERO - -var M_Submessage_Submessage_Subenum_name = sub.M_Submessage_Submessage_Subenum_name -var M_Submessage_Submessage_Subenum_value = sub.M_Submessage_Submessage_Subenum_value - -type M = sub.M - -const Default_M_DefaultField = sub.Default_M_DefaultField - -type M_OneofInt32 = sub.M_OneofInt32 -type M_OneofInt64 = sub.M_OneofInt64 -type M_Grouping = sub.M_Grouping -type M_Submessage = sub.M_Submessage -type M_Submessage_SubmessageOneofInt32 = sub.M_Submessage_SubmessageOneofInt32 -type M_Submessage_SubmessageOneofInt64 = sub.M_Submessage_SubmessageOneofInt64 - -var E_ExtensionField = sub.E_ExtensionField - -type Public struct { - M *sub.M `protobuf:"bytes,1,opt,name=m" json:"m,omitempty"` - E *sub.E `protobuf:"varint,2,opt,name=e,enum=goproto.test.import_public.sub.E" json:"e,omitempty"` - Local *Local `protobuf:"bytes,3,opt,name=local" json:"local,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Public) Reset() { *m = Public{} } -func (m *Public) String() string { return proto.CompactTextString(m) } -func (*Public) ProtoMessage() {} -func (*Public) Descriptor() ([]byte, []int) { - return xxx_File_import_public_a_proto_rawdesc_gzipped, []int{0} -} - -func (m *Public) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Public.Unmarshal(m, b) -} -func (m *Public) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Public.Marshal(b, m, deterministic) -} -func (m *Public) XXX_Merge(src proto.Message) { - xxx_messageInfo_Public.Merge(m, src) -} -func (m *Public) XXX_Size() int { - return xxx_messageInfo_Public.Size(m) -} -func (m *Public) XXX_DiscardUnknown() { - xxx_messageInfo_Public.DiscardUnknown(m) -} - -var xxx_messageInfo_Public proto.InternalMessageInfo - -func (m *Public) GetM() *sub.M { - if m != nil { - return m.M - } - return nil -} - -func (m *Public) GetE() sub.E { - if m != nil && m.E != nil { - return *m.E - } - return sub.E_ZERO -} - -func (m *Public) GetLocal() *Local { - if m != nil { - return m.Local - } - return nil -} - -func init() { - proto.RegisterFile("import_public/a.proto", xxx_File_import_public_a_proto_rawdesc_gzipped) - proto.RegisterType((*Public)(nil), "goproto.test.import_public.Public") -} - -var xxx_File_import_public_a_proto_rawdesc = []byte{ - // 338 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x15, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, - 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x2f, 0x73, 0x75, 0x62, 0x2f, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, - 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x62, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa3, 0x01, 0x0a, 0x06, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x12, 0x2f, 0x0a, 0x01, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, - 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x4d, 0x52, 0x01, - 0x6d, 0x12, 0x2f, 0x0a, 0x01, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x67, - 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, - 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x45, 0x52, - 0x01, 0x65, 0x12, 0x37, 0x0a, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x4c, - 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x42, 0x41, 0x5a, 0x3f, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, - 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, - 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x50, 0x00, - 0x50, 0x01, -} - -var xxx_File_import_public_a_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_a_proto_rawdesc) diff --git a/protoc-gen-go/testdata/import_public/a.proto b/protoc-gen-go/testdata/import_public/a.proto deleted file mode 100644 index 9a4e7c0234..0000000000 --- a/protoc-gen-go/testdata/import_public/a.proto +++ /dev/null @@ -1,45 +0,0 @@ -// 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. - -syntax = "proto2"; - -package goproto.test.import_public; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public"; - -import public "import_public/sub/a.proto"; // Different Go package. -import public "import_public/b.proto"; // Same Go package. - -message Public { - optional goproto.test.import_public.sub.M m = 1; - optional goproto.test.import_public.sub.E e = 2; - optional Local local = 3; -} diff --git a/protoc-gen-go/testdata/import_public/b.pb.go b/protoc-gen-go/testdata/import_public/b.pb.go deleted file mode 100644 index f9f447e954..0000000000 --- a/protoc-gen-go/testdata/import_public/b.pb.go +++ /dev/null @@ -1,90 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: import_public/b.proto - -package import_public - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" - sub "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type Local struct { - M *sub.M `protobuf:"bytes,1,opt,name=m" json:"m,omitempty"` - E *sub.E `protobuf:"varint,2,opt,name=e,enum=goproto.test.import_public.sub.E" json:"e,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Local) Reset() { *m = Local{} } -func (m *Local) String() string { return proto.CompactTextString(m) } -func (*Local) ProtoMessage() {} -func (*Local) Descriptor() ([]byte, []int) { - return xxx_File_import_public_b_proto_rawdesc_gzipped, []int{0} -} - -func (m *Local) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Local.Unmarshal(m, b) -} -func (m *Local) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Local.Marshal(b, m, deterministic) -} -func (m *Local) XXX_Merge(src proto.Message) { - xxx_messageInfo_Local.Merge(m, src) -} -func (m *Local) XXX_Size() int { - return xxx_messageInfo_Local.Size(m) -} -func (m *Local) XXX_DiscardUnknown() { - xxx_messageInfo_Local.DiscardUnknown(m) -} - -var xxx_messageInfo_Local proto.InternalMessageInfo - -func (m *Local) GetM() *sub.M { - if m != nil { - return m.M - } - return nil -} - -func (m *Local) GetE() sub.E { - if m != nil && m.E != nil { - return *m.E - } - return sub.E_ZERO -} - -func init() { - proto.RegisterFile("import_public/b.proto", xxx_File_import_public_b_proto_rawdesc_gzipped) - proto.RegisterType((*Local)(nil), "goproto.test.import_public.Local") -} - -var xxx_File_import_public_b_proto_rawdesc = []byte{ - // 252 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x15, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, - 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x2f, 0x73, 0x75, 0x62, 0x2f, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x69, - 0x0a, 0x05, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x12, 0x2f, 0x0a, 0x01, 0x6d, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, - 0x73, 0x75, 0x62, 0x2e, 0x4d, 0x52, 0x01, 0x6d, 0x12, 0x2f, 0x0a, 0x01, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x45, 0x52, 0x01, 0x65, 0x42, 0x41, 0x5a, 0x3f, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, - 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, - 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, -} - -var xxx_File_import_public_b_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_b_proto_rawdesc) diff --git a/protoc-gen-go/testdata/import_public/b.proto b/protoc-gen-go/testdata/import_public/b.proto deleted file mode 100644 index 424306ebd6..0000000000 --- a/protoc-gen-go/testdata/import_public/b.proto +++ /dev/null @@ -1,43 +0,0 @@ -// 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. - -syntax = "proto2"; - -package goproto.test.import_public; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public"; - -import "import_public/sub/a.proto"; - -message Local { - optional goproto.test.import_public.sub.M m = 1; - optional goproto.test.import_public.sub.E e = 2; -} diff --git a/protoc-gen-go/testdata/import_public/importing/importing.pb.go b/protoc-gen-go/testdata/import_public/importing/importing.pb.go deleted file mode 100644 index d902c930da..0000000000 --- a/protoc-gen-go/testdata/import_public/importing/importing.pb.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: import_public/importing/importing.proto - -package importing - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" - _ "github.com/golang/protobuf/protoc-gen-go/testdata/import_public" - sub "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type M struct { - // Message type defined in a file publicly imported by a file we import. - M *sub.M `protobuf:"bytes,1,opt,name=m" json:"m,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *M) Reset() { *m = M{} } -func (m *M) String() string { return proto.CompactTextString(m) } -func (*M) ProtoMessage() {} -func (*M) Descriptor() ([]byte, []int) { - return xxx_File_import_public_importing_importing_proto_rawdesc_gzipped, []int{0} -} - -func (m *M) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_M.Unmarshal(m, b) -} -func (m *M) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_M.Marshal(b, m, deterministic) -} -func (m *M) XXX_Merge(src proto.Message) { - xxx_messageInfo_M.Merge(m, src) -} -func (m *M) XXX_Size() int { - return xxx_messageInfo_M.Size(m) -} -func (m *M) XXX_DiscardUnknown() { - xxx_messageInfo_M.DiscardUnknown(m) -} - -var xxx_messageInfo_M proto.InternalMessageInfo - -func (m *M) GetM() *sub.M { - if m != nil { - return m.M - } - return nil -} - -func init() { - proto.RegisterFile("import_public/importing/importing.proto", xxx_File_import_public_importing_importing_proto_rawdesc_gzipped) - proto.RegisterType((*M)(nil), "goproto.test.import_public.importing.M") -} - -var xxx_File_import_public_importing_importing_proto_rawdesc = []byte{ - // 233 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x27, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, - 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, - 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x24, 0x67, 0x6f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x1a, - 0x15, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x61, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x01, 0x4d, 0x12, 0x2f, 0x0a, 0x01, 0x6d, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x4d, 0x52, 0x01, 0x6d, 0x42, 0x4b, 0x5a, 0x49, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, - 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, - 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, - 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, -} - -var xxx_File_import_public_importing_importing_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_importing_importing_proto_rawdesc) diff --git a/protoc-gen-go/testdata/import_public/importing/importing.proto b/protoc-gen-go/testdata/import_public/importing/importing.proto deleted file mode 100644 index fc78f5f100..0000000000 --- a/protoc-gen-go/testdata/import_public/importing/importing.proto +++ /dev/null @@ -1,43 +0,0 @@ -// 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. - -syntax = "proto2"; - -package goproto.test.import_public.importing; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/importing"; - -import "import_public/a.proto"; - -message M { - // Message type defined in a file publicly imported by a file we import. - optional goproto.test.import_public.sub.M m = 1; -} diff --git a/protoc-gen-go/testdata/import_public/sub/a.pb.go b/protoc-gen-go/testdata/import_public/sub/a.pb.go deleted file mode 100644 index 1d88e1ae1d..0000000000 --- a/protoc-gen-go/testdata/import_public/sub/a.pb.go +++ /dev/null @@ -1,427 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: import_public/sub/a.proto - -package sub - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type E int32 - -const ( - E_ZERO E = 0 -) - -var E_name = map[int32]string{ - 0: "ZERO", -} - -var E_value = map[string]int32{ - "ZERO": 0, -} - -func (x E) Enum() *E { - p := new(E) - *p = x - return p -} - -func (x E) String() string { - return proto.EnumName(E_name, int32(x)) -} - -func (x *E) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(E_value, data, "E") - if err != nil { - return err - } - *x = E(value) - return nil -} - -func (E) EnumDescriptor() ([]byte, []int) { - return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0} -} - -type M_Subenum int32 - -const ( - M_M_ZERO M_Subenum = 0 -) - -var M_Subenum_name = map[int32]string{ - 0: "M_ZERO", -} - -var M_Subenum_value = map[string]int32{ - "M_ZERO": 0, -} - -func (x M_Subenum) Enum() *M_Subenum { - p := new(M_Subenum) - *p = x - return p -} - -func (x M_Subenum) String() string { - return proto.EnumName(M_Subenum_name, int32(x)) -} - -func (x *M_Subenum) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(M_Subenum_value, data, "M_Subenum") - if err != nil { - return err - } - *x = M_Subenum(value) - return nil -} - -func (M_Subenum) EnumDescriptor() ([]byte, []int) { - return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0, 0} -} - -type M_Submessage_Submessage_Subenum int32 - -const ( - M_Submessage_M_SUBMESSAGE_ZERO M_Submessage_Submessage_Subenum = 0 -) - -var M_Submessage_Submessage_Subenum_name = map[int32]string{ - 0: "M_SUBMESSAGE_ZERO", -} - -var M_Submessage_Submessage_Subenum_value = map[string]int32{ - "M_SUBMESSAGE_ZERO": 0, -} - -func (x M_Submessage_Submessage_Subenum) Enum() *M_Submessage_Submessage_Subenum { - p := new(M_Submessage_Submessage_Subenum) - *p = x - return p -} - -func (x M_Submessage_Submessage_Subenum) String() string { - return proto.EnumName(M_Submessage_Submessage_Subenum_name, int32(x)) -} - -func (x *M_Submessage_Submessage_Subenum) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(M_Submessage_Submessage_Subenum_value, data, "M_Submessage_Submessage_Subenum") - if err != nil { - return err - } - *x = M_Submessage_Submessage_Subenum(value) - return nil -} - -func (M_Submessage_Submessage_Subenum) EnumDescriptor() ([]byte, []int) { - return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0, 1, 0} -} - -type M struct { - // Field using a type in the same Go package, but a different source file. - M2 *M2 `protobuf:"bytes,1,opt,name=m2" json:"m2,omitempty"` - // Types that are valid to be assigned to OneofField: - // *M_OneofInt32 - // *M_OneofInt64 - OneofField isM_OneofField `protobuf_oneof:"oneof_field"` - Grouping *M_Grouping `protobuf:"group,4,opt,name=Grouping,json=grouping" json:"grouping,omitempty"` - DefaultField *string `protobuf:"bytes,6,opt,name=default_field,json=defaultField,def=def" json:"default_field,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *M) Reset() { *m = M{} } -func (m *M) String() string { return proto.CompactTextString(m) } -func (*M) ProtoMessage() {} -func (*M) Descriptor() ([]byte, []int) { - return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0} -} - -func (m *M) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_M.Unmarshal(m, b) -} -func (m *M) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_M.Marshal(b, m, deterministic) -} -func (m *M) XXX_Merge(src proto.Message) { - xxx_messageInfo_M.Merge(m, src) -} -func (m *M) XXX_Size() int { - return xxx_messageInfo_M.Size(m) -} -func (m *M) XXX_DiscardUnknown() { - xxx_messageInfo_M.DiscardUnknown(m) -} - -var xxx_messageInfo_M proto.InternalMessageInfo - -const Default_M_DefaultField string = "def" - -func (m *M) GetM2() *M2 { - if m != nil { - return m.M2 - } - return nil -} - -type isM_OneofField interface { - isM_OneofField() -} - -type M_OneofInt32 struct { - OneofInt32 int32 `protobuf:"varint,2,opt,name=oneof_int32,json=oneofInt32,oneof"` -} - -type M_OneofInt64 struct { - OneofInt64 int64 `protobuf:"varint,3,opt,name=oneof_int64,json=oneofInt64,oneof"` -} - -func (*M_OneofInt32) isM_OneofField() {} - -func (*M_OneofInt64) isM_OneofField() {} - -func (m *M) GetOneofField() isM_OneofField { - if m != nil { - return m.OneofField - } - return nil -} - -func (m *M) GetOneofInt32() int32 { - if x, ok := m.GetOneofField().(*M_OneofInt32); ok { - return x.OneofInt32 - } - return 0 -} - -func (m *M) GetOneofInt64() int64 { - if x, ok := m.GetOneofField().(*M_OneofInt64); ok { - return x.OneofInt64 - } - return 0 -} - -func (m *M) GetGrouping() *M_Grouping { - if m != nil { - return m.Grouping - } - return nil -} - -func (m *M) GetDefaultField() string { - if m != nil && m.DefaultField != nil { - return *m.DefaultField - } - return Default_M_DefaultField -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*M) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*M_OneofInt32)(nil), - (*M_OneofInt64)(nil), - } -} - -type M_Grouping struct { - GroupField *string `protobuf:"bytes,5,opt,name=group_field,json=groupField" json:"group_field,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *M_Grouping) Reset() { *m = M_Grouping{} } -func (m *M_Grouping) String() string { return proto.CompactTextString(m) } -func (*M_Grouping) ProtoMessage() {} -func (*M_Grouping) Descriptor() ([]byte, []int) { - return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0, 0} -} - -func (m *M_Grouping) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_M_Grouping.Unmarshal(m, b) -} -func (m *M_Grouping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_M_Grouping.Marshal(b, m, deterministic) -} -func (m *M_Grouping) XXX_Merge(src proto.Message) { - xxx_messageInfo_M_Grouping.Merge(m, src) -} -func (m *M_Grouping) XXX_Size() int { - return xxx_messageInfo_M_Grouping.Size(m) -} -func (m *M_Grouping) XXX_DiscardUnknown() { - xxx_messageInfo_M_Grouping.DiscardUnknown(m) -} - -var xxx_messageInfo_M_Grouping proto.InternalMessageInfo - -func (m *M_Grouping) GetGroupField() string { - if m != nil && m.GroupField != nil { - return *m.GroupField - } - return "" -} - -type M_Submessage struct { - // Types that are valid to be assigned to SubmessageOneofField: - // *M_Submessage_SubmessageOneofInt32 - // *M_Submessage_SubmessageOneofInt64 - SubmessageOneofField isM_Submessage_SubmessageOneofField `protobuf_oneof:"submessage_oneof_field"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *M_Submessage) Reset() { *m = M_Submessage{} } -func (m *M_Submessage) String() string { return proto.CompactTextString(m) } -func (*M_Submessage) ProtoMessage() {} -func (*M_Submessage) Descriptor() ([]byte, []int) { - return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0, 1} -} - -func (m *M_Submessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_M_Submessage.Unmarshal(m, b) -} -func (m *M_Submessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_M_Submessage.Marshal(b, m, deterministic) -} -func (m *M_Submessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_M_Submessage.Merge(m, src) -} -func (m *M_Submessage) XXX_Size() int { - return xxx_messageInfo_M_Submessage.Size(m) -} -func (m *M_Submessage) XXX_DiscardUnknown() { - xxx_messageInfo_M_Submessage.DiscardUnknown(m) -} - -var xxx_messageInfo_M_Submessage proto.InternalMessageInfo - -type isM_Submessage_SubmessageOneofField interface { - isM_Submessage_SubmessageOneofField() -} - -type M_Submessage_SubmessageOneofInt32 struct { - SubmessageOneofInt32 int32 `protobuf:"varint,1,opt,name=submessage_oneof_int32,json=submessageOneofInt32,oneof"` -} - -type M_Submessage_SubmessageOneofInt64 struct { - SubmessageOneofInt64 int64 `protobuf:"varint,2,opt,name=submessage_oneof_int64,json=submessageOneofInt64,oneof"` -} - -func (*M_Submessage_SubmessageOneofInt32) isM_Submessage_SubmessageOneofField() {} - -func (*M_Submessage_SubmessageOneofInt64) isM_Submessage_SubmessageOneofField() {} - -func (m *M_Submessage) GetSubmessageOneofField() isM_Submessage_SubmessageOneofField { - if m != nil { - return m.SubmessageOneofField - } - return nil -} - -func (m *M_Submessage) GetSubmessageOneofInt32() int32 { - if x, ok := m.GetSubmessageOneofField().(*M_Submessage_SubmessageOneofInt32); ok { - return x.SubmessageOneofInt32 - } - return 0 -} - -func (m *M_Submessage) GetSubmessageOneofInt64() int64 { - if x, ok := m.GetSubmessageOneofField().(*M_Submessage_SubmessageOneofInt64); ok { - return x.SubmessageOneofInt64 - } - return 0 -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*M_Submessage) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*M_Submessage_SubmessageOneofInt32)(nil), - (*M_Submessage_SubmessageOneofInt64)(nil), - } -} - -var E_ExtensionField = &proto.ExtensionDesc{ - ExtendedType: (*M2)(nil), - ExtensionType: (*string)(nil), - Field: 1, - Name: "goproto.test.import_public.sub.extension_field", - Tag: "bytes,1,opt,name=extension_field", - Filename: "import_public/sub/a.proto", -} - -func init() { - proto.RegisterFile("import_public/sub/a.proto", xxx_File_import_public_sub_a_proto_rawdesc_gzipped) - proto.RegisterEnum("goproto.test.import_public.sub.E", E_name, E_value) - proto.RegisterEnum("goproto.test.import_public.sub.M_Subenum", M_Subenum_name, M_Subenum_value) - proto.RegisterEnum("goproto.test.import_public.sub.M_Submessage_Submessage_Subenum", M_Submessage_Submessage_Subenum_name, M_Submessage_Submessage_Subenum_value) - proto.RegisterType((*M)(nil), "goproto.test.import_public.sub.M") - proto.RegisterType((*M_Grouping)(nil), "goproto.test.import_public.sub.M.Grouping") - proto.RegisterType((*M_Submessage)(nil), "goproto.test.import_public.sub.M.Submessage") - proto.RegisterExtension(E_ExtensionField) -} - -var xxx_File_import_public_sub_a_proto_rawdesc = []byte{ - // 772 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, - 0x73, 0x75, 0x62, 0x2f, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x67, 0x6f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, - 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x1a, 0x19, 0x69, 0x6d, 0x70, - 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x73, 0x75, 0x62, 0x2f, 0x62, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x88, 0x04, 0x0a, 0x01, 0x4d, 0x12, 0x32, 0x0a, 0x02, - 0x6d, 0x32, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x4d, 0x32, 0x52, 0x02, 0x6d, 0x32, - 0x12, 0x21, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, - 0x74, 0x33, 0x32, 0x12, 0x21, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x74, - 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, - 0x66, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x46, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, - 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0a, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x4d, 0x2e, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x28, - 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x3a, 0x03, 0x64, 0x65, 0x66, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x2b, 0x0a, 0x08, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x69, 0x6e, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, - 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0xc3, 0x01, 0x0a, 0x0a, 0x53, 0x75, 0x62, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x36, 0x0a, 0x16, 0x73, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x5f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x14, 0x73, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x36, 0x0a, 0x16, - 0x73, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, - 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x14, - 0x73, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x49, - 0x6e, 0x74, 0x36, 0x34, 0x22, 0x2b, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x5f, 0x53, 0x75, 0x62, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x5f, - 0x53, 0x55, 0x42, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, - 0x00, 0x42, 0x18, 0x0a, 0x16, 0x73, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, - 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x15, 0x0a, 0x07, 0x53, - 0x75, 0x62, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x5f, 0x5a, 0x45, 0x52, 0x4f, - 0x10, 0x00, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x2a, 0x0d, 0x0a, 0x01, 0x45, 0x12, 0x08, 0x0a, 0x04, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, - 0x3a, 0x4b, 0x0a, 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x12, 0x22, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x4d, 0x32, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x45, 0x5a, - 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, - 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, - 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x2f, 0x73, 0x75, 0x62, -} - -var xxx_File_import_public_sub_a_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_sub_a_proto_rawdesc) diff --git a/protoc-gen-go/testdata/import_public/sub/a.proto b/protoc-gen-go/testdata/import_public/sub/a.proto deleted file mode 100644 index 8f8895b2be..0000000000 --- a/protoc-gen-go/testdata/import_public/sub/a.proto +++ /dev/null @@ -1,77 +0,0 @@ -// 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. - -syntax = "proto2"; - -package goproto.test.import_public.sub; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub"; - -import "import_public/sub/b.proto"; - -message M { - // Field using a type in the same Go package, but a different source file. - optional M2 m2 = 1; - - oneof oneof_field { - int32 oneof_int32 = 2; - int64 oneof_int64 = 3; - } - - optional group Grouping = 4 { - optional string group_field = 5; - } - - optional string default_field = 6 [default="def"]; - - message Submessage { - enum Submessage_Subenum { - M_SUBMESSAGE_ZERO = 0; - } - - oneof submessage_oneof_field { - int32 submessage_oneof_int32 = 1; - int64 submessage_oneof_int64 = 2; - } - } - - enum Subenum { - M_ZERO = 0; - } -} - -enum E { - ZERO = 0; -} - -extend M2 { - optional string extension_field = 1; -} diff --git a/protoc-gen-go/testdata/import_public/sub/b.pb.go b/protoc-gen-go/testdata/import_public/sub/b.pb.go deleted file mode 100644 index 5e1598205c..0000000000 --- a/protoc-gen-go/testdata/import_public/sub/b.pb.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: import_public/sub/b.proto - -package sub - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type M2 struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *M2) Reset() { *m = M2{} } -func (m *M2) String() string { return proto.CompactTextString(m) } -func (*M2) ProtoMessage() {} -func (*M2) Descriptor() ([]byte, []int) { - return xxx_File_import_public_sub_b_proto_rawdesc_gzipped, []int{0} -} - -var extRange_M2 = []proto.ExtensionRange{ - {Start: 1, End: 536870911}, -} - -func (*M2) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_M2 -} - -func (m *M2) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_M2.Unmarshal(m, b) -} -func (m *M2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_M2.Marshal(b, m, deterministic) -} -func (m *M2) XXX_Merge(src proto.Message) { - xxx_messageInfo_M2.Merge(m, src) -} -func (m *M2) XXX_Size() int { - return xxx_messageInfo_M2.Size(m) -} -func (m *M2) XXX_DiscardUnknown() { - xxx_messageInfo_M2.DiscardUnknown(m) -} - -var xxx_messageInfo_M2 proto.InternalMessageInfo - -func init() { - proto.RegisterFile("import_public/sub/b.proto", xxx_File_import_public_sub_b_proto_rawdesc_gzipped) - proto.RegisterType((*M2)(nil), "goproto.test.import_public.sub.M2") -} - -var xxx_File_import_public_sub_b_proto_rawdesc = []byte{ - // 146 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, - 0x73, 0x75, 0x62, 0x2f, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x67, 0x6f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, - 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x73, 0x75, 0x62, 0x22, 0x0e, 0x0a, 0x02, 0x4d, - 0x32, 0x2a, 0x08, 0x08, 0x01, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x42, 0x45, 0x5a, 0x43, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, - 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, - 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x73, - 0x75, 0x62, -} - -var xxx_File_import_public_sub_b_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_sub_b_proto_rawdesc) diff --git a/protoc-gen-go/testdata/import_public/sub/b.proto b/protoc-gen-go/testdata/import_public/sub/b.proto deleted file mode 100644 index 0b1b27cff8..0000000000 --- a/protoc-gen-go/testdata/import_public/sub/b.proto +++ /dev/null @@ -1,40 +0,0 @@ -// 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. - -syntax = "proto2"; - -package goproto.test.import_public.sub; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub"; - -message M2 { - extensions 1 to max; -} diff --git a/protoc-gen-go/testdata/import_public_test.go b/protoc-gen-go/testdata/import_public_test.go deleted file mode 100644 index cd0689cf9e..0000000000 --- a/protoc-gen-go/testdata/import_public_test.go +++ /dev/null @@ -1,37 +0,0 @@ -// 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 testdata - -import ( - "testing" - - mainpb "github.com/golang/protobuf/protoc-gen-go/testdata/import_public" - subpb "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub" -) - -func TestImportPublicLink(t *testing.T) { - // mainpb.[ME] should be interchangable with subpb.[ME]. - var _ mainpb.M = subpb.M{} - var _ mainpb.E = subpb.E(0) - _ = &mainpb.Public{ - M: &mainpb.M{}, - E: mainpb.E_ZERO.Enum(), - Local: &mainpb.Local{ - M: &mainpb.M{}, - E: mainpb.E_ZERO.Enum(), - }, - } - _ = &mainpb.Public{ - M: &subpb.M{}, - E: subpb.E_ZERO.Enum(), - Local: &mainpb.Local{ - M: &subpb.M{}, - E: subpb.E_ZERO.Enum(), - }, - } - _ = &mainpb.M{ - M2: &subpb.M2{}, - } -} diff --git a/protoc-gen-go/testdata/imports/fmt/m.pb.go b/protoc-gen-go/testdata/imports/fmt/m.pb.go deleted file mode 100644 index 3f11f89cea..0000000000 --- a/protoc-gen-go/testdata/imports/fmt/m.pb.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: imports/fmt/m.proto - -package fmt - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type M struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *M) Reset() { *m = M{} } -func (m *M) String() string { return proto.CompactTextString(m) } -func (*M) ProtoMessage() {} -func (*M) Descriptor() ([]byte, []int) { - return xxx_File_imports_fmt_m_proto_rawdesc_gzipped, []int{0} -} - -func (m *M) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_M.Unmarshal(m, b) -} -func (m *M) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_M.Marshal(b, m, deterministic) -} -func (m *M) XXX_Merge(src proto.Message) { - xxx_messageInfo_M.Merge(m, src) -} -func (m *M) XXX_Size() int { - return xxx_messageInfo_M.Size(m) -} -func (m *M) XXX_DiscardUnknown() { - xxx_messageInfo_M.DiscardUnknown(m) -} - -var xxx_messageInfo_M proto.InternalMessageInfo - -func init() { - proto.RegisterFile("imports/fmt/m.proto", xxx_File_imports_fmt_m_proto_rawdesc_gzipped) - proto.RegisterType((*M)(nil), "fmt.M") -} - -var xxx_File_imports_fmt_m_proto_rawdesc = []byte{ - // 104 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x13, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x66, 0x6d, 0x74, 0x2f, 0x6d, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x66, 0x6d, 0x74, 0x22, 0x03, 0x0a, 0x01, 0x4d, 0x42, - 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, - 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, - 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x66, 0x6d, 0x74, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var xxx_File_imports_fmt_m_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_fmt_m_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/fmt/m.proto b/protoc-gen-go/testdata/imports/fmt/m.proto deleted file mode 100644 index 142d8cfac3..0000000000 --- a/protoc-gen-go/testdata/imports/fmt/m.proto +++ /dev/null @@ -1,35 +0,0 @@ -// 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. - -syntax = "proto3"; -package fmt; -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt"; -message M {} diff --git a/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go b/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go deleted file mode 100644 index fc500797d1..0000000000 --- a/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: imports/test_a_1/m1.proto - -package test_a_1 - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type E1 int32 - -const ( - E1_E1_ZERO E1 = 0 -) - -var E1_name = map[int32]string{ - 0: "E1_ZERO", -} - -var E1_value = map[string]int32{ - "E1_ZERO": 0, -} - -func (x E1) String() string { - return proto.EnumName(E1_name, int32(x)) -} - -func (E1) EnumDescriptor() ([]byte, []int) { - return xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped, []int{0} -} - -type M1 struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *M1) Reset() { *m = M1{} } -func (m *M1) String() string { return proto.CompactTextString(m) } -func (*M1) ProtoMessage() {} -func (*M1) Descriptor() ([]byte, []int) { - return xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped, []int{0} -} - -func (m *M1) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_M1.Unmarshal(m, b) -} -func (m *M1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_M1.Marshal(b, m, deterministic) -} -func (m *M1) XXX_Merge(src proto.Message) { - xxx_messageInfo_M1.Merge(m, src) -} -func (m *M1) XXX_Size() int { - return xxx_messageInfo_M1.Size(m) -} -func (m *M1) XXX_DiscardUnknown() { - xxx_messageInfo_M1.DiscardUnknown(m) -} - -var xxx_messageInfo_M1 proto.InternalMessageInfo - -type M1_1 struct { - M1 *M1 `protobuf:"bytes,1,opt,name=m1,proto3" json:"m1,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *M1_1) Reset() { *m = M1_1{} } -func (m *M1_1) String() string { return proto.CompactTextString(m) } -func (*M1_1) ProtoMessage() {} -func (*M1_1) Descriptor() ([]byte, []int) { - return xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped, []int{1} -} - -func (m *M1_1) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_M1_1.Unmarshal(m, b) -} -func (m *M1_1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_M1_1.Marshal(b, m, deterministic) -} -func (m *M1_1) XXX_Merge(src proto.Message) { - xxx_messageInfo_M1_1.Merge(m, src) -} -func (m *M1_1) XXX_Size() int { - return xxx_messageInfo_M1_1.Size(m) -} -func (m *M1_1) XXX_DiscardUnknown() { - xxx_messageInfo_M1_1.DiscardUnknown(m) -} - -var xxx_messageInfo_M1_1 proto.InternalMessageInfo - -func (m *M1_1) GetM1() *M1 { - if m != nil { - return m.M1 - } - return nil -} - -func init() { - proto.RegisterFile("imports/test_a_1/m1.proto", xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped) - proto.RegisterEnum("test.a.E1", E1_name, E1_value) - proto.RegisterType((*M1)(nil), "test.a.M1") - proto.RegisterType((*M1_1)(nil), "test.a.M1_1") -} - -var xxx_File_imports_test_a_1_m1_proto_rawdesc = []byte{ - // 174 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, - 0x5f, 0x31, 0x2f, 0x6d, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x74, 0x65, 0x73, - 0x74, 0x2e, 0x61, 0x22, 0x04, 0x0a, 0x02, 0x4d, 0x31, 0x22, 0x22, 0x0a, 0x04, 0x4d, 0x31, 0x5f, - 0x31, 0x12, 0x1a, 0x0a, 0x02, 0x6d, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x31, 0x52, 0x02, 0x6d, 0x31, 0x2a, 0x11, 0x0a, - 0x02, 0x45, 0x31, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x31, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, - 0x42, 0x44, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, - 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, - 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_a_1_m1_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_a_1/m1.proto b/protoc-gen-go/testdata/imports/test_a_1/m1.proto deleted file mode 100644 index da54c1ee4e..0000000000 --- a/protoc-gen-go/testdata/imports/test_a_1/m1.proto +++ /dev/null @@ -1,44 +0,0 @@ -// 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. - -syntax = "proto3"; -package test.a; -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1"; - -message M1 {} - -message M1_1 { - M1 m1 = 1; -} - -enum E1 { - E1_ZERO = 0; -} diff --git a/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go b/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go deleted file mode 100644 index de1d6bb2f1..0000000000 --- a/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: imports/test_a_1/m2.proto - -package test_a_1 - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type M2 struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *M2) Reset() { *m = M2{} } -func (m *M2) String() string { return proto.CompactTextString(m) } -func (*M2) ProtoMessage() {} -func (*M2) Descriptor() ([]byte, []int) { - return xxx_File_imports_test_a_1_m2_proto_rawdesc_gzipped, []int{0} -} - -func (m *M2) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_M2.Unmarshal(m, b) -} -func (m *M2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_M2.Marshal(b, m, deterministic) -} -func (m *M2) XXX_Merge(src proto.Message) { - xxx_messageInfo_M2.Merge(m, src) -} -func (m *M2) XXX_Size() int { - return xxx_messageInfo_M2.Size(m) -} -func (m *M2) XXX_DiscardUnknown() { - xxx_messageInfo_M2.DiscardUnknown(m) -} - -var xxx_messageInfo_M2 proto.InternalMessageInfo - -func init() { - proto.RegisterFile("imports/test_a_1/m2.proto", xxx_File_imports_test_a_1_m2_proto_rawdesc_gzipped) - proto.RegisterType((*M2)(nil), "test.a.M2") -} - -var xxx_File_imports_test_a_1_m2_proto_rawdesc = []byte{ - // 119 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, - 0x5f, 0x31, 0x2f, 0x6d, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x74, 0x65, 0x73, - 0x74, 0x2e, 0x61, 0x22, 0x04, 0x0a, 0x02, 0x4d, 0x32, 0x42, 0x44, 0x5a, 0x42, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, - 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, - 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var xxx_File_imports_test_a_1_m2_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_a_1_m2_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_a_1/m2.proto b/protoc-gen-go/testdata/imports/test_a_1/m2.proto deleted file mode 100644 index 49499dc9c4..0000000000 --- a/protoc-gen-go/testdata/imports/test_a_1/m2.proto +++ /dev/null @@ -1,35 +0,0 @@ -// 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. - -syntax = "proto3"; -package test.a; -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1"; -message M2 {} diff --git a/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go b/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go deleted file mode 100644 index d8836f0c73..0000000000 --- a/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: imports/test_a_2/m3.proto - -package test_a_2 - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type M3 struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *M3) Reset() { *m = M3{} } -func (m *M3) String() string { return proto.CompactTextString(m) } -func (*M3) ProtoMessage() {} -func (*M3) Descriptor() ([]byte, []int) { - return xxx_File_imports_test_a_2_m3_proto_rawdesc_gzipped, []int{0} -} - -func (m *M3) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_M3.Unmarshal(m, b) -} -func (m *M3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_M3.Marshal(b, m, deterministic) -} -func (m *M3) XXX_Merge(src proto.Message) { - xxx_messageInfo_M3.Merge(m, src) -} -func (m *M3) XXX_Size() int { - return xxx_messageInfo_M3.Size(m) -} -func (m *M3) XXX_DiscardUnknown() { - xxx_messageInfo_M3.DiscardUnknown(m) -} - -var xxx_messageInfo_M3 proto.InternalMessageInfo - -func init() { - proto.RegisterFile("imports/test_a_2/m3.proto", xxx_File_imports_test_a_2_m3_proto_rawdesc_gzipped) - proto.RegisterType((*M3)(nil), "test.a.M3") -} - -var xxx_File_imports_test_a_2_m3_proto_rawdesc = []byte{ - // 119 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, - 0x5f, 0x32, 0x2f, 0x6d, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x74, 0x65, 0x73, - 0x74, 0x2e, 0x61, 0x22, 0x04, 0x0a, 0x02, 0x4d, 0x33, 0x42, 0x44, 0x5a, 0x42, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, - 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, - 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x32, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var xxx_File_imports_test_a_2_m3_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_a_2_m3_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_a_2/m3.proto b/protoc-gen-go/testdata/imports/test_a_2/m3.proto deleted file mode 100644 index 5e811ef848..0000000000 --- a/protoc-gen-go/testdata/imports/test_a_2/m3.proto +++ /dev/null @@ -1,35 +0,0 @@ -// 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. - -syntax = "proto3"; -package test.a; -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2"; -message M3 {} diff --git a/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go b/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go deleted file mode 100644 index 8fc62698ee..0000000000 --- a/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: imports/test_a_2/m4.proto - -package test_a_2 - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type M4 struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *M4) Reset() { *m = M4{} } -func (m *M4) String() string { return proto.CompactTextString(m) } -func (*M4) ProtoMessage() {} -func (*M4) Descriptor() ([]byte, []int) { - return xxx_File_imports_test_a_2_m4_proto_rawdesc_gzipped, []int{0} -} - -func (m *M4) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_M4.Unmarshal(m, b) -} -func (m *M4) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_M4.Marshal(b, m, deterministic) -} -func (m *M4) XXX_Merge(src proto.Message) { - xxx_messageInfo_M4.Merge(m, src) -} -func (m *M4) XXX_Size() int { - return xxx_messageInfo_M4.Size(m) -} -func (m *M4) XXX_DiscardUnknown() { - xxx_messageInfo_M4.DiscardUnknown(m) -} - -var xxx_messageInfo_M4 proto.InternalMessageInfo - -func init() { - proto.RegisterFile("imports/test_a_2/m4.proto", xxx_File_imports_test_a_2_m4_proto_rawdesc_gzipped) - proto.RegisterType((*M4)(nil), "test.a.M4") -} - -var xxx_File_imports_test_a_2_m4_proto_rawdesc = []byte{ - // 119 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, - 0x5f, 0x32, 0x2f, 0x6d, 0x34, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x74, 0x65, 0x73, - 0x74, 0x2e, 0x61, 0x22, 0x04, 0x0a, 0x02, 0x4d, 0x34, 0x42, 0x44, 0x5a, 0x42, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, - 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, - 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x32, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var xxx_File_imports_test_a_2_m4_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_a_2_m4_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_a_2/m4.proto b/protoc-gen-go/testdata/imports/test_a_2/m4.proto deleted file mode 100644 index 8f8fe3e125..0000000000 --- a/protoc-gen-go/testdata/imports/test_a_2/m4.proto +++ /dev/null @@ -1,35 +0,0 @@ -// 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. - -syntax = "proto3"; -package test.a; -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2"; -message M4 {} diff --git a/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go b/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go deleted file mode 100644 index f74b49e627..0000000000 --- a/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: imports/test_b_1/m1.proto - -package beta - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type M1 struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *M1) Reset() { *m = M1{} } -func (m *M1) String() string { return proto.CompactTextString(m) } -func (*M1) ProtoMessage() {} -func (*M1) Descriptor() ([]byte, []int) { - return xxx_File_imports_test_b_1_m1_proto_rawdesc_gzipped, []int{0} -} - -func (m *M1) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_M1.Unmarshal(m, b) -} -func (m *M1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_M1.Marshal(b, m, deterministic) -} -func (m *M1) XXX_Merge(src proto.Message) { - xxx_messageInfo_M1.Merge(m, src) -} -func (m *M1) XXX_Size() int { - return xxx_messageInfo_M1.Size(m) -} -func (m *M1) XXX_DiscardUnknown() { - xxx_messageInfo_M1.DiscardUnknown(m) -} - -var xxx_messageInfo_M1 proto.InternalMessageInfo - -func init() { - proto.RegisterFile("imports/test_b_1/m1.proto", xxx_File_imports_test_b_1_m1_proto_rawdesc_gzipped) - proto.RegisterType((*M1)(nil), "test.b.part1.M1") -} - -var xxx_File_imports_test_b_1_m1_proto_rawdesc = []byte{ - // 130 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x62, - 0x5f, 0x31, 0x2f, 0x6d, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x74, 0x65, 0x73, - 0x74, 0x2e, 0x62, 0x2e, 0x70, 0x61, 0x72, 0x74, 0x31, 0x22, 0x04, 0x0a, 0x02, 0x4d, 0x31, 0x42, - 0x49, 0x5a, 0x47, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, - 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, - 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x62, 0x5f, 0x31, 0x3b, 0x62, 0x65, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var xxx_File_imports_test_b_1_m1_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_b_1_m1_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_b_1/m1.proto b/protoc-gen-go/testdata/imports/test_b_1/m1.proto deleted file mode 100644 index 2c35ec4ae1..0000000000 --- a/protoc-gen-go/testdata/imports/test_b_1/m1.proto +++ /dev/null @@ -1,35 +0,0 @@ -// 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. - -syntax = "proto3"; -package test.b.part1; -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1;beta"; -message M1 {} diff --git a/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go b/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go deleted file mode 100644 index f43a045c82..0000000000 --- a/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: imports/test_b_1/m2.proto - -package beta - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type M2 struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *M2) Reset() { *m = M2{} } -func (m *M2) String() string { return proto.CompactTextString(m) } -func (*M2) ProtoMessage() {} -func (*M2) Descriptor() ([]byte, []int) { - return xxx_File_imports_test_b_1_m2_proto_rawdesc_gzipped, []int{0} -} - -func (m *M2) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_M2.Unmarshal(m, b) -} -func (m *M2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_M2.Marshal(b, m, deterministic) -} -func (m *M2) XXX_Merge(src proto.Message) { - xxx_messageInfo_M2.Merge(m, src) -} -func (m *M2) XXX_Size() int { - return xxx_messageInfo_M2.Size(m) -} -func (m *M2) XXX_DiscardUnknown() { - xxx_messageInfo_M2.DiscardUnknown(m) -} - -var xxx_messageInfo_M2 proto.InternalMessageInfo - -func init() { - proto.RegisterFile("imports/test_b_1/m2.proto", xxx_File_imports_test_b_1_m2_proto_rawdesc_gzipped) - proto.RegisterType((*M2)(nil), "test.b.part2.M2") -} - -var xxx_File_imports_test_b_1_m2_proto_rawdesc = []byte{ - // 130 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x62, - 0x5f, 0x31, 0x2f, 0x6d, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x74, 0x65, 0x73, - 0x74, 0x2e, 0x62, 0x2e, 0x70, 0x61, 0x72, 0x74, 0x32, 0x22, 0x04, 0x0a, 0x02, 0x4d, 0x32, 0x42, - 0x49, 0x5a, 0x47, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, - 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, - 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x62, 0x5f, 0x31, 0x3b, 0x62, 0x65, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var xxx_File_imports_test_b_1_m2_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_b_1_m2_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_b_1/m2.proto b/protoc-gen-go/testdata/imports/test_b_1/m2.proto deleted file mode 100644 index 13723be415..0000000000 --- a/protoc-gen-go/testdata/imports/test_b_1/m2.proto +++ /dev/null @@ -1,35 +0,0 @@ -// 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. - -syntax = "proto3"; -package test.b.part2; -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1;beta"; -message M2 {} diff --git a/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go b/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go deleted file mode 100644 index ab5a5fcc26..0000000000 --- a/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go +++ /dev/null @@ -1,77 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: imports/test_import_a1m1.proto - -package imports - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" - test_a_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type A1M1 struct { - F *test_a_1.M1 `protobuf:"bytes,1,opt,name=f,proto3" json:"f,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *A1M1) Reset() { *m = A1M1{} } -func (m *A1M1) String() string { return proto.CompactTextString(m) } -func (*A1M1) ProtoMessage() {} -func (*A1M1) Descriptor() ([]byte, []int) { - return xxx_File_imports_test_import_a1m1_proto_rawdesc_gzipped, []int{0} -} - -func (m *A1M1) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_A1M1.Unmarshal(m, b) -} -func (m *A1M1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_A1M1.Marshal(b, m, deterministic) -} -func (m *A1M1) XXX_Merge(src proto.Message) { - xxx_messageInfo_A1M1.Merge(m, src) -} -func (m *A1M1) XXX_Size() int { - return xxx_messageInfo_A1M1.Size(m) -} -func (m *A1M1) XXX_DiscardUnknown() { - xxx_messageInfo_A1M1.DiscardUnknown(m) -} - -var xxx_messageInfo_A1M1 proto.InternalMessageInfo - -func (m *A1M1) GetF() *test_a_1.M1 { - if m != nil { - return m.F - } - return nil -} - -func init() { - proto.RegisterFile("imports/test_import_a1m1.proto", xxx_File_imports_test_import_a1m1_proto_rawdesc_gzipped) - proto.RegisterType((*A1M1)(nil), "test.A1M1") -} - -var xxx_File_imports_test_import_a1m1_proto_rawdesc = []byte{ - // 168 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x1e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x69, - 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x61, 0x31, 0x6d, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x04, 0x74, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x31, 0x2f, 0x6d, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x20, 0x0a, 0x04, 0x41, 0x31, 0x4d, 0x31, 0x12, 0x18, 0x0a, 0x01, 0x66, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x31, - 0x52, 0x01, 0x66, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, - 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var xxx_File_imports_test_import_a1m1_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_import_a1m1_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_import_a1m1.proto b/protoc-gen-go/testdata/imports/test_import_a1m1.proto deleted file mode 100644 index abf07f2a45..0000000000 --- a/protoc-gen-go/testdata/imports/test_import_a1m1.proto +++ /dev/null @@ -1,42 +0,0 @@ -// 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. - -syntax = "proto3"; - -package test; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports"; - -import "imports/test_a_1/m1.proto"; - -message A1M1 { - test.a.M1 f = 1; -} diff --git a/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go b/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go deleted file mode 100644 index 961d4d9e7f..0000000000 --- a/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go +++ /dev/null @@ -1,77 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: imports/test_import_a1m2.proto - -package imports - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" - test_a_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type A1M2 struct { - F *test_a_1.M2 `protobuf:"bytes,1,opt,name=f,proto3" json:"f,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *A1M2) Reset() { *m = A1M2{} } -func (m *A1M2) String() string { return proto.CompactTextString(m) } -func (*A1M2) ProtoMessage() {} -func (*A1M2) Descriptor() ([]byte, []int) { - return xxx_File_imports_test_import_a1m2_proto_rawdesc_gzipped, []int{0} -} - -func (m *A1M2) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_A1M2.Unmarshal(m, b) -} -func (m *A1M2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_A1M2.Marshal(b, m, deterministic) -} -func (m *A1M2) XXX_Merge(src proto.Message) { - xxx_messageInfo_A1M2.Merge(m, src) -} -func (m *A1M2) XXX_Size() int { - return xxx_messageInfo_A1M2.Size(m) -} -func (m *A1M2) XXX_DiscardUnknown() { - xxx_messageInfo_A1M2.DiscardUnknown(m) -} - -var xxx_messageInfo_A1M2 proto.InternalMessageInfo - -func (m *A1M2) GetF() *test_a_1.M2 { - if m != nil { - return m.F - } - return nil -} - -func init() { - proto.RegisterFile("imports/test_import_a1m2.proto", xxx_File_imports_test_import_a1m2_proto_rawdesc_gzipped) - proto.RegisterType((*A1M2)(nil), "test.A1M2") -} - -var xxx_File_imports_test_import_a1m2_proto_rawdesc = []byte{ - // 168 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x1e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x69, - 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x61, 0x31, 0x6d, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x04, 0x74, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x31, 0x2f, 0x6d, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x20, 0x0a, 0x04, 0x41, 0x31, 0x4d, 0x32, 0x12, 0x18, 0x0a, 0x01, 0x66, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x32, - 0x52, 0x01, 0x66, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, - 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var xxx_File_imports_test_import_a1m2_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_import_a1m2_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_import_a1m2.proto b/protoc-gen-go/testdata/imports/test_import_a1m2.proto deleted file mode 100644 index 5c53950dad..0000000000 --- a/protoc-gen-go/testdata/imports/test_import_a1m2.proto +++ /dev/null @@ -1,42 +0,0 @@ -// 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. - -syntax = "proto3"; - -package test; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports"; - -import "imports/test_a_1/m2.proto"; - -message A1M2 { - test.a.M2 f = 1; -} diff --git a/protoc-gen-go/testdata/imports/test_import_all.pb.go b/protoc-gen-go/testdata/imports/test_import_all.pb.go deleted file mode 100644 index df86e7ffff..0000000000 --- a/protoc-gen-go/testdata/imports/test_import_all.pb.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: imports/test_import_all.proto - -package imports - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" - fmt "github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt" - test_a_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" - test_a_2 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2" - test_b_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type All struct { - Am1 *test_a_1.M1 `protobuf:"bytes,1,opt,name=am1,proto3" json:"am1,omitempty"` - Am2 *test_a_1.M2 `protobuf:"bytes,2,opt,name=am2,proto3" json:"am2,omitempty"` - Am3 *test_a_2.M3 `protobuf:"bytes,3,opt,name=am3,proto3" json:"am3,omitempty"` - Am4 *test_a_2.M4 `protobuf:"bytes,4,opt,name=am4,proto3" json:"am4,omitempty"` - Bm1 *test_b_1.M1 `protobuf:"bytes,5,opt,name=bm1,proto3" json:"bm1,omitempty"` - Bm2 *test_b_1.M2 `protobuf:"bytes,6,opt,name=bm2,proto3" json:"bm2,omitempty"` - Fmt *fmt.M `protobuf:"bytes,7,opt,name=fmt,proto3" json:"fmt,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *All) Reset() { *m = All{} } -func (m *All) String() string { return proto.CompactTextString(m) } -func (*All) ProtoMessage() {} -func (*All) Descriptor() ([]byte, []int) { - return xxx_File_imports_test_import_all_proto_rawdesc_gzipped, []int{0} -} - -func (m *All) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_All.Unmarshal(m, b) -} -func (m *All) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_All.Marshal(b, m, deterministic) -} -func (m *All) XXX_Merge(src proto.Message) { - xxx_messageInfo_All.Merge(m, src) -} -func (m *All) XXX_Size() int { - return xxx_messageInfo_All.Size(m) -} -func (m *All) XXX_DiscardUnknown() { - xxx_messageInfo_All.DiscardUnknown(m) -} - -var xxx_messageInfo_All proto.InternalMessageInfo - -func (m *All) GetAm1() *test_a_1.M1 { - if m != nil { - return m.Am1 - } - return nil -} - -func (m *All) GetAm2() *test_a_1.M2 { - if m != nil { - return m.Am2 - } - return nil -} - -func (m *All) GetAm3() *test_a_2.M3 { - if m != nil { - return m.Am3 - } - return nil -} - -func (m *All) GetAm4() *test_a_2.M4 { - if m != nil { - return m.Am4 - } - return nil -} - -func (m *All) GetBm1() *test_b_1.M1 { - if m != nil { - return m.Bm1 - } - return nil -} - -func (m *All) GetBm2() *test_b_1.M2 { - if m != nil { - return m.Bm2 - } - return nil -} - -func (m *All) GetFmt() *fmt.M { - if m != nil { - return m.Fmt - } - return nil -} - -func init() { - proto.RegisterFile("imports/test_import_all.proto", xxx_File_imports_test_import_all_proto_rawdesc_gzipped) - proto.RegisterType((*All)(nil), "test.All") -} - -var xxx_File_imports_test_import_all_proto_rawdesc = []byte{ - // 515 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x1d, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x69, - 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x61, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x04, 0x74, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x31, 0x2f, 0x6d, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, - 0x5f, 0x31, 0x2f, 0x6d, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x69, 0x6d, 0x70, - 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x32, 0x2f, 0x6d, 0x33, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x5f, 0x32, 0x2f, 0x6d, 0x34, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x19, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, - 0x62, 0x5f, 0x31, 0x2f, 0x6d, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x69, 0x6d, - 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x5f, 0x31, 0x2f, 0x6d, - 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, - 0x2f, 0x66, 0x6d, 0x74, 0x2f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdf, 0x01, 0x0a, - 0x03, 0x41, 0x6c, 0x6c, 0x12, 0x1c, 0x0a, 0x03, 0x61, 0x6d, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0a, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x31, 0x52, 0x03, 0x61, - 0x6d, 0x31, 0x12, 0x1c, 0x0a, 0x03, 0x61, 0x6d, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0a, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x32, 0x52, 0x03, 0x61, 0x6d, 0x32, - 0x12, 0x1c, 0x0a, 0x03, 0x61, 0x6d, 0x33, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x33, 0x52, 0x03, 0x61, 0x6d, 0x33, 0x12, 0x1c, - 0x0a, 0x03, 0x61, 0x6d, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x2e, 0x61, 0x2e, 0x4d, 0x34, 0x52, 0x03, 0x61, 0x6d, 0x34, 0x12, 0x22, 0x0a, 0x03, - 0x62, 0x6d, 0x31, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x2e, 0x62, 0x2e, 0x70, 0x61, 0x72, 0x74, 0x31, 0x2e, 0x4d, 0x31, 0x52, 0x03, 0x62, 0x6d, 0x31, - 0x12, 0x22, 0x0a, 0x03, 0x62, 0x6d, 0x32, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x2e, 0x62, 0x2e, 0x70, 0x61, 0x72, 0x74, 0x32, 0x2e, 0x4d, 0x32, 0x52, - 0x03, 0x62, 0x6d, 0x32, 0x12, 0x18, 0x0a, 0x03, 0x66, 0x6d, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x06, 0x2e, 0x66, 0x6d, 0x74, 0x2e, 0x4d, 0x52, 0x03, 0x66, 0x6d, 0x74, 0x42, 0x3b, - 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, - 0x61, 0x74, 0x61, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var xxx_File_imports_test_import_all_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_import_all_proto_rawdesc) diff --git a/protoc-gen-go/testdata/imports/test_import_all.proto b/protoc-gen-go/testdata/imports/test_import_all.proto deleted file mode 100644 index 582d722e3b..0000000000 --- a/protoc-gen-go/testdata/imports/test_import_all.proto +++ /dev/null @@ -1,58 +0,0 @@ -// 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. - -syntax = "proto3"; - -package test; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports"; - -// test_a_1/m*.proto are in the same Go package and proto package. -// test_a_*/*.proto are in different Go packages, but the same proto package. -// test_b_1/*.proto are in the same Go package, but different proto packages. -// fmt/m.proto has a package name which conflicts with "fmt". -import "imports/test_a_1/m1.proto"; -import "imports/test_a_1/m2.proto"; -import "imports/test_a_2/m3.proto"; -import "imports/test_a_2/m4.proto"; -import "imports/test_b_1/m1.proto"; -import "imports/test_b_1/m2.proto"; -import "imports/fmt/m.proto"; - -message All { - test.a.M1 am1 = 1; - test.a.M2 am2 = 2; - test.a.M3 am3 = 3; - test.a.M4 am4 = 4; - test.b.part1.M1 bm1 = 5; - test.b.part2.M2 bm2 = 6; - fmt.M fmt = 7; -} diff --git a/protoc-gen-go/testdata/main_test.go b/protoc-gen-go/testdata/main_test.go deleted file mode 100644 index ffa5419f29..0000000000 --- a/protoc-gen-go/testdata/main_test.go +++ /dev/null @@ -1,21 +0,0 @@ -// 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. - -// A simple binary to link together the protocol buffers in this test. - -package testdata - -import ( - "testing" - - importspb "github.com/golang/protobuf/protoc-gen-go/testdata/imports" - multipb "github.com/golang/protobuf/protoc-gen-go/testdata/multi" - mytestpb "github.com/golang/protobuf/protoc-gen-go/testdata/my_test" -) - -func TestLink(t *testing.T) { - _ = &multipb.Multi1{} - _ = &mytestpb.Request{} - _ = &importspb.All{} -} diff --git a/protoc-gen-go/testdata/multi/multi1.pb.go b/protoc-gen-go/testdata/multi/multi1.pb.go deleted file mode 100644 index f15a4ceac5..0000000000 --- a/protoc-gen-go/testdata/multi/multi1.pb.go +++ /dev/null @@ -1,100 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: multi/multi1.proto - -package multitest - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type Multi1 struct { - Multi2 *Multi2 `protobuf:"bytes,1,req,name=multi2" json:"multi2,omitempty"` - Color *Multi2_Color `protobuf:"varint,2,opt,name=color,enum=multitest.Multi2_Color" json:"color,omitempty"` - HatType *Multi3_HatType `protobuf:"varint,3,opt,name=hat_type,json=hatType,enum=multitest.Multi3_HatType" json:"hat_type,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Multi1) Reset() { *m = Multi1{} } -func (m *Multi1) String() string { return proto.CompactTextString(m) } -func (*Multi1) ProtoMessage() {} -func (*Multi1) Descriptor() ([]byte, []int) { - return xxx_File_multi_multi1_proto_rawdesc_gzipped, []int{0} -} - -func (m *Multi1) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Multi1.Unmarshal(m, b) -} -func (m *Multi1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Multi1.Marshal(b, m, deterministic) -} -func (m *Multi1) XXX_Merge(src proto.Message) { - xxx_messageInfo_Multi1.Merge(m, src) -} -func (m *Multi1) XXX_Size() int { - return xxx_messageInfo_Multi1.Size(m) -} -func (m *Multi1) XXX_DiscardUnknown() { - xxx_messageInfo_Multi1.DiscardUnknown(m) -} - -var xxx_messageInfo_Multi1 proto.InternalMessageInfo - -func (m *Multi1) GetMulti2() *Multi2 { - if m != nil { - return m.Multi2 - } - return nil -} - -func (m *Multi1) GetColor() Multi2_Color { - if m != nil && m.Color != nil { - return *m.Color - } - return Multi2_BLUE -} - -func (m *Multi1) GetHatType() Multi3_HatType { - if m != nil && m.HatType != nil { - return *m.HatType - } - return Multi3_FEDORA -} - -func init() { - proto.RegisterFile("multi/multi1.proto", xxx_File_multi_multi1_proto_rawdesc_gzipped) - proto.RegisterType((*Multi1)(nil), "multitest.Multi1") -} - -var xxx_File_multi_multi1_proto_rawdesc = []byte{ - // 295 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x12, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x31, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x1a, - 0x12, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x32, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, - 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x98, 0x01, 0x0a, 0x06, 0x4d, 0x75, 0x6c, 0x74, - 0x69, 0x31, 0x12, 0x29, 0x0a, 0x06, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x32, 0x18, 0x01, 0x20, 0x02, - 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4d, - 0x75, 0x6c, 0x74, 0x69, 0x32, 0x52, 0x06, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x32, 0x12, 0x2d, 0x0a, - 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x6d, - 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x32, 0x2e, - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x34, 0x0a, 0x08, - 0x68, 0x61, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, - 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, - 0x33, 0x2e, 0x48, 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x68, 0x61, 0x74, 0x54, 0x79, - 0x70, 0x65, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, - 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x3b, 0x6d, 0x75, - 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, -} - -var xxx_File_multi_multi1_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_multi_multi1_proto_rawdesc) diff --git a/protoc-gen-go/testdata/multi/multi1.proto b/protoc-gen-go/testdata/multi/multi1.proto deleted file mode 100644 index d3a32041e2..0000000000 --- a/protoc-gen-go/testdata/multi/multi1.proto +++ /dev/null @@ -1,46 +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. - -syntax = "proto2"; - -import "multi/multi2.proto"; -import "multi/multi3.proto"; - -package multitest; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/multi;multitest"; - -message Multi1 { - required Multi2 multi2 = 1; - optional Multi2.Color color = 2; - optional Multi3.HatType hat_type = 3; -} - diff --git a/protoc-gen-go/testdata/multi/multi2.pb.go b/protoc-gen-go/testdata/multi/multi2.pb.go deleted file mode 100644 index 021d480612..0000000000 --- a/protoc-gen-go/testdata/multi/multi2.pb.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: multi/multi2.proto - -package multitest - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type Multi2_Color int32 - -const ( - Multi2_BLUE Multi2_Color = 1 - Multi2_GREEN Multi2_Color = 2 - Multi2_RED Multi2_Color = 3 -) - -var Multi2_Color_name = map[int32]string{ - 1: "BLUE", - 2: "GREEN", - 3: "RED", -} - -var Multi2_Color_value = map[string]int32{ - "BLUE": 1, - "GREEN": 2, - "RED": 3, -} - -func (x Multi2_Color) Enum() *Multi2_Color { - p := new(Multi2_Color) - *p = x - return p -} - -func (x Multi2_Color) String() string { - return proto.EnumName(Multi2_Color_name, int32(x)) -} - -func (x *Multi2_Color) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Multi2_Color_value, data, "Multi2_Color") - if err != nil { - return err - } - *x = Multi2_Color(value) - return nil -} - -func (Multi2_Color) EnumDescriptor() ([]byte, []int) { - return xxx_File_multi_multi2_proto_rawdesc_gzipped, []int{0, 0} -} - -type Multi2 struct { - RequiredValue *int32 `protobuf:"varint,1,req,name=required_value,json=requiredValue" json:"required_value,omitempty"` - Color *Multi2_Color `protobuf:"varint,2,opt,name=color,enum=multitest.Multi2_Color" json:"color,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Multi2) Reset() { *m = Multi2{} } -func (m *Multi2) String() string { return proto.CompactTextString(m) } -func (*Multi2) ProtoMessage() {} -func (*Multi2) Descriptor() ([]byte, []int) { - return xxx_File_multi_multi2_proto_rawdesc_gzipped, []int{0} -} - -func (m *Multi2) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Multi2.Unmarshal(m, b) -} -func (m *Multi2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Multi2.Marshal(b, m, deterministic) -} -func (m *Multi2) XXX_Merge(src proto.Message) { - xxx_messageInfo_Multi2.Merge(m, src) -} -func (m *Multi2) XXX_Size() int { - return xxx_messageInfo_Multi2.Size(m) -} -func (m *Multi2) XXX_DiscardUnknown() { - xxx_messageInfo_Multi2.DiscardUnknown(m) -} - -var xxx_messageInfo_Multi2 proto.InternalMessageInfo - -func (m *Multi2) GetRequiredValue() int32 { - if m != nil && m.RequiredValue != nil { - return *m.RequiredValue - } - return 0 -} - -func (m *Multi2) GetColor() Multi2_Color { - if m != nil && m.Color != nil { - return *m.Color - } - return Multi2_BLUE -} - -func init() { - proto.RegisterFile("multi/multi2.proto", xxx_File_multi_multi2_proto_rawdesc_gzipped) - proto.RegisterEnum("multitest.Multi2_Color", Multi2_Color_name, Multi2_Color_value) - proto.RegisterType((*Multi2)(nil), "multitest.Multi2") -} - -var xxx_File_multi_multi2_proto_rawdesc = []byte{ - // 236 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x12, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x32, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x22, - 0x85, 0x01, 0x0a, 0x06, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x32, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, - 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x02, - 0x28, 0x05, 0x52, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x17, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x75, 0x6c, - 0x74, 0x69, 0x32, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, - 0x22, 0x25, 0x0a, 0x05, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4c, 0x55, - 0x45, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x10, 0x02, 0x12, 0x07, - 0x0a, 0x03, 0x52, 0x45, 0x44, 0x10, 0x03, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, - 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x6d, 0x75, 0x6c, - 0x74, 0x69, 0x3b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, -} - -var xxx_File_multi_multi2_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_multi_multi2_proto_rawdesc) diff --git a/protoc-gen-go/testdata/multi/multi2.proto b/protoc-gen-go/testdata/multi/multi2.proto deleted file mode 100644 index ec5b431e39..0000000000 --- a/protoc-gen-go/testdata/multi/multi2.proto +++ /dev/null @@ -1,48 +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. - -syntax = "proto2"; - -package multitest; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/multi;multitest"; - -message Multi2 { - required int32 required_value = 1; - - enum Color { - BLUE = 1; - GREEN = 2; - RED = 3; - }; - optional Color color = 2; -} - diff --git a/protoc-gen-go/testdata/multi/multi3.pb.go b/protoc-gen-go/testdata/multi/multi3.pb.go deleted file mode 100644 index e1dae49a1c..0000000000 --- a/protoc-gen-go/testdata/multi/multi3.pb.go +++ /dev/null @@ -1,119 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: multi/multi3.proto - -package multitest - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type Multi3_HatType int32 - -const ( - Multi3_FEDORA Multi3_HatType = 1 - Multi3_FEZ Multi3_HatType = 2 -) - -var Multi3_HatType_name = map[int32]string{ - 1: "FEDORA", - 2: "FEZ", -} - -var Multi3_HatType_value = map[string]int32{ - "FEDORA": 1, - "FEZ": 2, -} - -func (x Multi3_HatType) Enum() *Multi3_HatType { - p := new(Multi3_HatType) - *p = x - return p -} - -func (x Multi3_HatType) String() string { - return proto.EnumName(Multi3_HatType_name, int32(x)) -} - -func (x *Multi3_HatType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Multi3_HatType_value, data, "Multi3_HatType") - if err != nil { - return err - } - *x = Multi3_HatType(value) - return nil -} - -func (Multi3_HatType) EnumDescriptor() ([]byte, []int) { - return xxx_File_multi_multi3_proto_rawdesc_gzipped, []int{0, 0} -} - -type Multi3 struct { - HatType *Multi3_HatType `protobuf:"varint,1,opt,name=hat_type,json=hatType,enum=multitest.Multi3_HatType" json:"hat_type,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Multi3) Reset() { *m = Multi3{} } -func (m *Multi3) String() string { return proto.CompactTextString(m) } -func (*Multi3) ProtoMessage() {} -func (*Multi3) Descriptor() ([]byte, []int) { - return xxx_File_multi_multi3_proto_rawdesc_gzipped, []int{0} -} - -func (m *Multi3) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Multi3.Unmarshal(m, b) -} -func (m *Multi3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Multi3.Marshal(b, m, deterministic) -} -func (m *Multi3) XXX_Merge(src proto.Message) { - xxx_messageInfo_Multi3.Merge(m, src) -} -func (m *Multi3) XXX_Size() int { - return xxx_messageInfo_Multi3.Size(m) -} -func (m *Multi3) XXX_DiscardUnknown() { - xxx_messageInfo_Multi3.DiscardUnknown(m) -} - -var xxx_messageInfo_Multi3 proto.InternalMessageInfo - -func (m *Multi3) GetHatType() Multi3_HatType { - if m != nil && m.HatType != nil { - return *m.HatType - } - return Multi3_FEDORA -} - -func init() { - proto.RegisterFile("multi/multi3.proto", xxx_File_multi_multi3_proto_rawdesc_gzipped) - proto.RegisterEnum("multitest.Multi3_HatType", Multi3_HatType_name, Multi3_HatType_value) - proto.RegisterType((*Multi3)(nil), "multitest.Multi3") -} - -var xxx_File_multi_multi3_proto_rawdesc = []byte{ - // 196 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x12, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x33, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x22, - 0x5e, 0x0a, 0x06, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x33, 0x12, 0x34, 0x0a, 0x08, 0x68, 0x61, 0x74, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x6d, 0x75, - 0x6c, 0x74, 0x69, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x33, 0x2e, 0x48, - 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x68, 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, - 0x1e, 0x0a, 0x07, 0x48, 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x45, - 0x44, 0x4f, 0x52, 0x41, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x46, 0x45, 0x5a, 0x10, 0x02, 0x42, - 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, - 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, - 0x64, 0x61, 0x74, 0x61, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x3b, 0x6d, 0x75, 0x6c, 0x74, 0x69, - 0x74, 0x65, 0x73, 0x74, -} - -var xxx_File_multi_multi3_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_multi_multi3_proto_rawdesc) diff --git a/protoc-gen-go/testdata/multi/multi3.proto b/protoc-gen-go/testdata/multi/multi3.proto deleted file mode 100644 index 8690b88150..0000000000 --- a/protoc-gen-go/testdata/multi/multi3.proto +++ /dev/null @@ -1,45 +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. - -syntax = "proto2"; - -package multitest; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/multi;multitest"; - -message Multi3 { - enum HatType { - FEDORA = 1; - FEZ = 2; - }; - optional HatType hat_type = 1; -} - diff --git a/protoc-gen-go/testdata/my_test/test.pb.go b/protoc-gen-go/testdata/my_test/test.pb.go deleted file mode 100644 index d5902162e6..0000000000 --- a/protoc-gen-go/testdata/my_test/test.pb.go +++ /dev/null @@ -1,1158 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: my_test/test.proto - -// This package holds interesting messages. - -package test - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" - _ "github.com/golang/protobuf/protoc-gen-go/testdata/multi" - math "math" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type HatType int32 - -const ( - // deliberately skipping 0 - HatType_FEDORA HatType = 1 - HatType_FEZ HatType = 2 -) - -var HatType_name = map[int32]string{ - 1: "FEDORA", - 2: "FEZ", -} - -var HatType_value = map[string]int32{ - "FEDORA": 1, - "FEZ": 2, -} - -func (x HatType) Enum() *HatType { - p := new(HatType) - *p = x - return p -} - -func (x HatType) String() string { - return proto.EnumName(HatType_name, int32(x)) -} - -func (x *HatType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(HatType_value, data, "HatType") - if err != nil { - return err - } - *x = HatType(value) - return nil -} - -func (HatType) EnumDescriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{0} -} - -// This enum represents days of the week. -type Days int32 - -const ( - Days_MONDAY Days = 1 - Days_TUESDAY Days = 2 - Days_LUNDI Days = 1 -) - -var Days_name = map[int32]string{ - 1: "MONDAY", - 2: "TUESDAY", - // Duplicate value: 1: "LUNDI", -} - -var Days_value = map[string]int32{ - "MONDAY": 1, - "TUESDAY": 2, - "LUNDI": 1, -} - -func (x Days) Enum() *Days { - p := new(Days) - *p = x - return p -} - -func (x Days) String() string { - return proto.EnumName(Days_name, int32(x)) -} - -func (x *Days) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Days_value, data, "Days") - if err != nil { - return err - } - *x = Days(value) - return nil -} - -func (Days) EnumDescriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{1} -} - -type Request_Color int32 - -const ( - Request_RED Request_Color = 0 - Request_GREEN Request_Color = 1 - Request_BLUE Request_Color = 2 -) - -var Request_Color_name = map[int32]string{ - 0: "RED", - 1: "GREEN", - 2: "BLUE", -} - -var Request_Color_value = map[string]int32{ - "RED": 0, - "GREEN": 1, - "BLUE": 2, -} - -func (x Request_Color) Enum() *Request_Color { - p := new(Request_Color) - *p = x - return p -} - -func (x Request_Color) String() string { - return proto.EnumName(Request_Color_name, int32(x)) -} - -func (x *Request_Color) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Request_Color_value, data, "Request_Color") - if err != nil { - return err - } - *x = Request_Color(value) - return nil -} - -func (Request_Color) EnumDescriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{0, 0} -} - -type Reply_Entry_Game int32 - -const ( - Reply_Entry_FOOTBALL Reply_Entry_Game = 1 - Reply_Entry_TENNIS Reply_Entry_Game = 2 -) - -var Reply_Entry_Game_name = map[int32]string{ - 1: "FOOTBALL", - 2: "TENNIS", -} - -var Reply_Entry_Game_value = map[string]int32{ - "FOOTBALL": 1, - "TENNIS": 2, -} - -func (x Reply_Entry_Game) Enum() *Reply_Entry_Game { - p := new(Reply_Entry_Game) - *p = x - return p -} - -func (x Reply_Entry_Game) String() string { - return proto.EnumName(Reply_Entry_Game_name, int32(x)) -} - -func (x *Reply_Entry_Game) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Reply_Entry_Game_value, data, "Reply_Entry_Game") - if err != nil { - return err - } - *x = Reply_Entry_Game(value) - return nil -} - -func (Reply_Entry_Game) EnumDescriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{1, 0, 0} -} - -// This is a message that might be sent somewhere. -type Request struct { - Key []int64 `protobuf:"varint,1,rep,name=key" json:"key,omitempty"` - // optional imp.ImportedMessage imported_message = 2; - Hue *Request_Color `protobuf:"varint,3,opt,name=hue,enum=my.test.Request_Color" json:"hue,omitempty"` - Hat *HatType `protobuf:"varint,4,opt,name=hat,enum=my.test.HatType,def=1" json:"hat,omitempty"` - // optional imp.ImportedMessage.Owner owner = 6; - Deadline *float32 `protobuf:"fixed32,7,opt,name=deadline,def=inf" json:"deadline,omitempty"` - Somegroup *Request_SomeGroup `protobuf:"group,8,opt,name=SomeGroup,json=somegroup" json:"somegroup,omitempty"` - // This is a map field. It will generate map[int32]string. - NameMapping map[int32]string `protobuf:"bytes,14,rep,name=name_mapping,json=nameMapping" json:"name_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - // This is a map field whose value type is a message. - MsgMapping map[int64]*Reply `protobuf:"bytes,15,rep,name=msg_mapping,json=msgMapping" json:"msg_mapping,omitempty" protobuf_key:"zigzag64,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - Reset_ *int32 `protobuf:"varint,12,opt,name=reset" json:"reset,omitempty"` - // This field should not conflict with any getters. - GetKey_ *string `protobuf:"bytes,16,opt,name=get_key,json=getKey" json:"get_key,omitempty"` - FloatNinf *float32 `protobuf:"fixed32,20,opt,name=float_ninf,json=floatNinf,def=-inf" json:"float_ninf,omitempty"` - FloatPinf *float32 `protobuf:"fixed32,21,opt,name=float_pinf,json=floatPinf,def=inf" json:"float_pinf,omitempty"` - FloatExp *float32 `protobuf:"fixed32,22,opt,name=float_exp,json=floatExp,def=1e+09" json:"float_exp,omitempty"` - DoubleNinf *float64 `protobuf:"fixed64,23,opt,name=double_ninf,json=doubleNinf,def=-inf" json:"double_ninf,omitempty"` - DoublePinf *float64 `protobuf:"fixed64,24,opt,name=double_pinf,json=doublePinf,def=inf" json:"double_pinf,omitempty"` - DoubleExp *float64 `protobuf:"fixed64,25,opt,name=double_exp,json=doubleExp,def=1e+09" json:"double_exp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Request) Reset() { *m = Request{} } -func (m *Request) String() string { return proto.CompactTextString(m) } -func (*Request) ProtoMessage() {} -func (*Request) Descriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{0} -} - -func (m *Request) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Request.Unmarshal(m, b) -} -func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Request.Marshal(b, m, deterministic) -} -func (m *Request) XXX_Merge(src proto.Message) { - xxx_messageInfo_Request.Merge(m, src) -} -func (m *Request) XXX_Size() int { - return xxx_messageInfo_Request.Size(m) -} -func (m *Request) XXX_DiscardUnknown() { - xxx_messageInfo_Request.DiscardUnknown(m) -} - -var xxx_messageInfo_Request proto.InternalMessageInfo - -const Default_Request_Hat HatType = HatType_FEDORA - -var Default_Request_Deadline float32 = float32(math.Inf(1)) -var Default_Request_FloatNinf float32 = float32(math.Inf(-1)) -var Default_Request_FloatPinf float32 = float32(math.Inf(1)) - -const Default_Request_FloatExp float32 = 1e+09 - -var Default_Request_DoubleNinf float64 = math.Inf(-1) -var Default_Request_DoublePinf float64 = math.Inf(1) - -const Default_Request_DoubleExp float64 = 1e+09 - -func (m *Request) GetKey() []int64 { - if m != nil { - return m.Key - } - return nil -} - -func (m *Request) GetHue() Request_Color { - if m != nil && m.Hue != nil { - return *m.Hue - } - return Request_RED -} - -func (m *Request) GetHat() HatType { - if m != nil && m.Hat != nil { - return *m.Hat - } - return Default_Request_Hat -} - -func (m *Request) GetDeadline() float32 { - if m != nil && m.Deadline != nil { - return *m.Deadline - } - return Default_Request_Deadline -} - -func (m *Request) GetSomegroup() *Request_SomeGroup { - if m != nil { - return m.Somegroup - } - return nil -} - -func (m *Request) GetNameMapping() map[int32]string { - if m != nil { - return m.NameMapping - } - return nil -} - -func (m *Request) GetMsgMapping() map[int64]*Reply { - if m != nil { - return m.MsgMapping - } - return nil -} - -func (m *Request) GetReset_() int32 { - if m != nil && m.Reset_ != nil { - return *m.Reset_ - } - return 0 -} - -func (m *Request) GetGetKey_() string { - if m != nil && m.GetKey_ != nil { - return *m.GetKey_ - } - return "" -} - -func (m *Request) GetFloatNinf() float32 { - if m != nil && m.FloatNinf != nil { - return *m.FloatNinf - } - return Default_Request_FloatNinf -} - -func (m *Request) GetFloatPinf() float32 { - if m != nil && m.FloatPinf != nil { - return *m.FloatPinf - } - return Default_Request_FloatPinf -} - -func (m *Request) GetFloatExp() float32 { - if m != nil && m.FloatExp != nil { - return *m.FloatExp - } - return Default_Request_FloatExp -} - -func (m *Request) GetDoubleNinf() float64 { - if m != nil && m.DoubleNinf != nil { - return *m.DoubleNinf - } - return Default_Request_DoubleNinf -} - -func (m *Request) GetDoublePinf() float64 { - if m != nil && m.DoublePinf != nil { - return *m.DoublePinf - } - return Default_Request_DoublePinf -} - -func (m *Request) GetDoubleExp() float64 { - if m != nil && m.DoubleExp != nil { - return *m.DoubleExp - } - return Default_Request_DoubleExp -} - -type Reply struct { - Found []*Reply_Entry `protobuf:"bytes,1,rep,name=found" json:"found,omitempty"` - CompactKeys []int32 `protobuf:"varint,2,rep,packed,name=compact_keys,json=compactKeys" json:"compact_keys,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Reply) Reset() { *m = Reply{} } -func (m *Reply) String() string { return proto.CompactTextString(m) } -func (*Reply) ProtoMessage() {} -func (*Reply) Descriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{1} -} - -var extRange_Reply = []proto.ExtensionRange{ - {Start: 100, End: 536870911}, -} - -func (*Reply) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_Reply -} - -func (m *Reply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Reply.Unmarshal(m, b) -} -func (m *Reply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Reply.Marshal(b, m, deterministic) -} -func (m *Reply) XXX_Merge(src proto.Message) { - xxx_messageInfo_Reply.Merge(m, src) -} -func (m *Reply) XXX_Size() int { - return xxx_messageInfo_Reply.Size(m) -} -func (m *Reply) XXX_DiscardUnknown() { - xxx_messageInfo_Reply.DiscardUnknown(m) -} - -var xxx_messageInfo_Reply proto.InternalMessageInfo - -func (m *Reply) GetFound() []*Reply_Entry { - if m != nil { - return m.Found - } - return nil -} - -func (m *Reply) GetCompactKeys() []int32 { - if m != nil { - return m.CompactKeys - } - return nil -} - -type OtherBase struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OtherBase) Reset() { *m = OtherBase{} } -func (m *OtherBase) String() string { return proto.CompactTextString(m) } -func (*OtherBase) ProtoMessage() {} -func (*OtherBase) Descriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{2} -} - -var extRange_OtherBase = []proto.ExtensionRange{ - {Start: 100, End: 536870911}, -} - -func (*OtherBase) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_OtherBase -} - -func (m *OtherBase) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OtherBase.Unmarshal(m, b) -} -func (m *OtherBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OtherBase.Marshal(b, m, deterministic) -} -func (m *OtherBase) XXX_Merge(src proto.Message) { - xxx_messageInfo_OtherBase.Merge(m, src) -} -func (m *OtherBase) XXX_Size() int { - return xxx_messageInfo_OtherBase.Size(m) -} -func (m *OtherBase) XXX_DiscardUnknown() { - xxx_messageInfo_OtherBase.DiscardUnknown(m) -} - -var xxx_messageInfo_OtherBase proto.InternalMessageInfo - -func (m *OtherBase) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -type ReplyExtensions struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ReplyExtensions) Reset() { *m = ReplyExtensions{} } -func (m *ReplyExtensions) String() string { return proto.CompactTextString(m) } -func (*ReplyExtensions) ProtoMessage() {} -func (*ReplyExtensions) Descriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{3} -} - -func (m *ReplyExtensions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReplyExtensions.Unmarshal(m, b) -} -func (m *ReplyExtensions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReplyExtensions.Marshal(b, m, deterministic) -} -func (m *ReplyExtensions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReplyExtensions.Merge(m, src) -} -func (m *ReplyExtensions) XXX_Size() int { - return xxx_messageInfo_ReplyExtensions.Size(m) -} -func (m *ReplyExtensions) XXX_DiscardUnknown() { - xxx_messageInfo_ReplyExtensions.DiscardUnknown(m) -} - -var xxx_messageInfo_ReplyExtensions proto.InternalMessageInfo - -type OtherReplyExtensions struct { - Key *int32 `protobuf:"varint,1,opt,name=key" json:"key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OtherReplyExtensions) Reset() { *m = OtherReplyExtensions{} } -func (m *OtherReplyExtensions) String() string { return proto.CompactTextString(m) } -func (*OtherReplyExtensions) ProtoMessage() {} -func (*OtherReplyExtensions) Descriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{4} -} - -func (m *OtherReplyExtensions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OtherReplyExtensions.Unmarshal(m, b) -} -func (m *OtherReplyExtensions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OtherReplyExtensions.Marshal(b, m, deterministic) -} -func (m *OtherReplyExtensions) XXX_Merge(src proto.Message) { - xxx_messageInfo_OtherReplyExtensions.Merge(m, src) -} -func (m *OtherReplyExtensions) XXX_Size() int { - return xxx_messageInfo_OtherReplyExtensions.Size(m) -} -func (m *OtherReplyExtensions) XXX_DiscardUnknown() { - xxx_messageInfo_OtherReplyExtensions.DiscardUnknown(m) -} - -var xxx_messageInfo_OtherReplyExtensions proto.InternalMessageInfo - -func (m *OtherReplyExtensions) GetKey() int32 { - if m != nil && m.Key != nil { - return *m.Key - } - return 0 -} - -type OldReply struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `protobuf_messageset:"1" json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OldReply) Reset() { *m = OldReply{} } -func (m *OldReply) String() string { return proto.CompactTextString(m) } -func (*OldReply) ProtoMessage() {} -func (*OldReply) Descriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{5} -} - -var extRange_OldReply = []proto.ExtensionRange{ - {Start: 100, End: 2147483646}, -} - -func (*OldReply) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_OldReply -} - -func (m *OldReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OldReply.Unmarshal(m, b) -} -func (m *OldReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OldReply.Marshal(b, m, deterministic) -} -func (m *OldReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_OldReply.Merge(m, src) -} -func (m *OldReply) XXX_Size() int { - return xxx_messageInfo_OldReply.Size(m) -} -func (m *OldReply) XXX_DiscardUnknown() { - xxx_messageInfo_OldReply.DiscardUnknown(m) -} - -var xxx_messageInfo_OldReply proto.InternalMessageInfo - -type Communique struct { - MakeMeCry *bool `protobuf:"varint,1,opt,name=make_me_cry,json=makeMeCry" json:"make_me_cry,omitempty"` - // This is a oneof, called "union". - // - // Types that are valid to be assigned to Union: - // *Communique_Number - // *Communique_Name - // *Communique_Data - // *Communique_TempC - // *Communique_Height - // *Communique_Today - // *Communique_Maybe - // *Communique_Delta_ - // *Communique_Msg - // *Communique_Somegroup - Union isCommunique_Union `protobuf_oneof:"union"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Communique) Reset() { *m = Communique{} } -func (m *Communique) String() string { return proto.CompactTextString(m) } -func (*Communique) ProtoMessage() {} -func (*Communique) Descriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{6} -} - -func (m *Communique) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Communique.Unmarshal(m, b) -} -func (m *Communique) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Communique.Marshal(b, m, deterministic) -} -func (m *Communique) XXX_Merge(src proto.Message) { - xxx_messageInfo_Communique.Merge(m, src) -} -func (m *Communique) XXX_Size() int { - return xxx_messageInfo_Communique.Size(m) -} -func (m *Communique) XXX_DiscardUnknown() { - xxx_messageInfo_Communique.DiscardUnknown(m) -} - -var xxx_messageInfo_Communique proto.InternalMessageInfo - -func (m *Communique) GetMakeMeCry() bool { - if m != nil && m.MakeMeCry != nil { - return *m.MakeMeCry - } - return false -} - -type isCommunique_Union interface { - isCommunique_Union() -} - -type Communique_Number struct { - Number int32 `protobuf:"varint,5,opt,name=number,oneof"` -} - -type Communique_Name struct { - Name string `protobuf:"bytes,6,opt,name=name,oneof"` -} - -type Communique_Data struct { - Data []byte `protobuf:"bytes,7,opt,name=data,oneof"` -} - -type Communique_TempC struct { - TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof"` -} - -type Communique_Height struct { - Height float32 `protobuf:"fixed32,9,opt,name=height,oneof"` -} - -type Communique_Today struct { - Today Days `protobuf:"varint,10,opt,name=today,enum=my.test.Days,oneof"` -} - -type Communique_Maybe struct { - Maybe bool `protobuf:"varint,11,opt,name=maybe,oneof"` -} - -type Communique_Delta_ struct { - Delta int32 `protobuf:"zigzag32,12,opt,name=delta,oneof"` -} - -type Communique_Msg struct { - Msg *Reply `protobuf:"bytes,16,opt,name=msg,oneof"` -} - -type Communique_Somegroup struct { - Somegroup *Communique_SomeGroup `protobuf:"group,14,opt,name=SomeGroup,json=somegroup,oneof"` -} - -func (*Communique_Number) isCommunique_Union() {} - -func (*Communique_Name) isCommunique_Union() {} - -func (*Communique_Data) isCommunique_Union() {} - -func (*Communique_TempC) isCommunique_Union() {} - -func (*Communique_Height) isCommunique_Union() {} - -func (*Communique_Today) isCommunique_Union() {} - -func (*Communique_Maybe) isCommunique_Union() {} - -func (*Communique_Delta_) isCommunique_Union() {} - -func (*Communique_Msg) isCommunique_Union() {} - -func (*Communique_Somegroup) isCommunique_Union() {} - -func (m *Communique) GetUnion() isCommunique_Union { - if m != nil { - return m.Union - } - return nil -} - -func (m *Communique) GetNumber() int32 { - if x, ok := m.GetUnion().(*Communique_Number); ok { - return x.Number - } - return 0 -} - -func (m *Communique) GetName() string { - if x, ok := m.GetUnion().(*Communique_Name); ok { - return x.Name - } - return "" -} - -func (m *Communique) GetData() []byte { - if x, ok := m.GetUnion().(*Communique_Data); ok { - return x.Data - } - return nil -} - -func (m *Communique) GetTempC() float64 { - if x, ok := m.GetUnion().(*Communique_TempC); ok { - return x.TempC - } - return 0 -} - -func (m *Communique) GetHeight() float32 { - if x, ok := m.GetUnion().(*Communique_Height); ok { - return x.Height - } - return 0 -} - -func (m *Communique) GetToday() Days { - if x, ok := m.GetUnion().(*Communique_Today); ok { - return x.Today - } - return Days_MONDAY -} - -func (m *Communique) GetMaybe() bool { - if x, ok := m.GetUnion().(*Communique_Maybe); ok { - return x.Maybe - } - return false -} - -func (m *Communique) GetDelta() int32 { - if x, ok := m.GetUnion().(*Communique_Delta_); ok { - return x.Delta - } - return 0 -} - -func (m *Communique) GetMsg() *Reply { - if x, ok := m.GetUnion().(*Communique_Msg); ok { - return x.Msg - } - return nil -} - -func (m *Communique) GetSomegroup() *Communique_SomeGroup { - if x, ok := m.GetUnion().(*Communique_Somegroup); ok { - return x.Somegroup - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Communique) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Communique_Number)(nil), - (*Communique_Name)(nil), - (*Communique_Data)(nil), - (*Communique_TempC)(nil), - (*Communique_Height)(nil), - (*Communique_Today)(nil), - (*Communique_Maybe)(nil), - (*Communique_Delta_)(nil), - (*Communique_Msg)(nil), - (*Communique_Somegroup)(nil), - } -} - -type Request_SomeGroup struct { - GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Request_SomeGroup) Reset() { *m = Request_SomeGroup{} } -func (m *Request_SomeGroup) String() string { return proto.CompactTextString(m) } -func (*Request_SomeGroup) ProtoMessage() {} -func (*Request_SomeGroup) Descriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{0, 0} -} - -func (m *Request_SomeGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Request_SomeGroup.Unmarshal(m, b) -} -func (m *Request_SomeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Request_SomeGroup.Marshal(b, m, deterministic) -} -func (m *Request_SomeGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_Request_SomeGroup.Merge(m, src) -} -func (m *Request_SomeGroup) XXX_Size() int { - return xxx_messageInfo_Request_SomeGroup.Size(m) -} -func (m *Request_SomeGroup) XXX_DiscardUnknown() { - xxx_messageInfo_Request_SomeGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_Request_SomeGroup proto.InternalMessageInfo - -func (m *Request_SomeGroup) GetGroupField() int32 { - if m != nil && m.GroupField != nil { - return *m.GroupField - } - return 0 -} - -type Reply_Entry struct { - KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng" json:"key_that_needs_1234camel_CasIng,omitempty"` - Value *int64 `protobuf:"varint,2,opt,name=value,def=7" json:"value,omitempty"` - XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=MyFieldName2" json:"_my_field_name_2,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Reply_Entry) Reset() { *m = Reply_Entry{} } -func (m *Reply_Entry) String() string { return proto.CompactTextString(m) } -func (*Reply_Entry) ProtoMessage() {} -func (*Reply_Entry) Descriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{1, 0} -} - -func (m *Reply_Entry) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Reply_Entry.Unmarshal(m, b) -} -func (m *Reply_Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Reply_Entry.Marshal(b, m, deterministic) -} -func (m *Reply_Entry) XXX_Merge(src proto.Message) { - xxx_messageInfo_Reply_Entry.Merge(m, src) -} -func (m *Reply_Entry) XXX_Size() int { - return xxx_messageInfo_Reply_Entry.Size(m) -} -func (m *Reply_Entry) XXX_DiscardUnknown() { - xxx_messageInfo_Reply_Entry.DiscardUnknown(m) -} - -var xxx_messageInfo_Reply_Entry proto.InternalMessageInfo - -const Default_Reply_Entry_Value int64 = 7 - -func (m *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 { - if m != nil && m.KeyThatNeeds_1234Camel_CasIng != nil { - return *m.KeyThatNeeds_1234Camel_CasIng - } - return 0 -} - -func (m *Reply_Entry) GetValue() int64 { - if m != nil && m.Value != nil { - return *m.Value - } - return Default_Reply_Entry_Value -} - -func (m *Reply_Entry) GetXMyFieldName_2() int64 { - if m != nil && m.XMyFieldName_2 != nil { - return *m.XMyFieldName_2 - } - return 0 -} - -type Communique_SomeGroup struct { - Member *string `protobuf:"bytes,15,opt,name=member" json:"member,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Communique_SomeGroup) Reset() { *m = Communique_SomeGroup{} } -func (m *Communique_SomeGroup) String() string { return proto.CompactTextString(m) } -func (*Communique_SomeGroup) ProtoMessage() {} -func (*Communique_SomeGroup) Descriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{6, 0} -} - -func (m *Communique_SomeGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Communique_SomeGroup.Unmarshal(m, b) -} -func (m *Communique_SomeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Communique_SomeGroup.Marshal(b, m, deterministic) -} -func (m *Communique_SomeGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_Communique_SomeGroup.Merge(m, src) -} -func (m *Communique_SomeGroup) XXX_Size() int { - return xxx_messageInfo_Communique_SomeGroup.Size(m) -} -func (m *Communique_SomeGroup) XXX_DiscardUnknown() { - xxx_messageInfo_Communique_SomeGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_Communique_SomeGroup proto.InternalMessageInfo - -func (m *Communique_SomeGroup) GetMember() string { - if m != nil && m.Member != nil { - return *m.Member - } - return "" -} - -type Communique_Delta struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Communique_Delta) Reset() { *m = Communique_Delta{} } -func (m *Communique_Delta) String() string { return proto.CompactTextString(m) } -func (*Communique_Delta) ProtoMessage() {} -func (*Communique_Delta) Descriptor() ([]byte, []int) { - return xxx_File_my_test_test_proto_rawdesc_gzipped, []int{6, 1} -} - -func (m *Communique_Delta) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Communique_Delta.Unmarshal(m, b) -} -func (m *Communique_Delta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Communique_Delta.Marshal(b, m, deterministic) -} -func (m *Communique_Delta) XXX_Merge(src proto.Message) { - xxx_messageInfo_Communique_Delta.Merge(m, src) -} -func (m *Communique_Delta) XXX_Size() int { - return xxx_messageInfo_Communique_Delta.Size(m) -} -func (m *Communique_Delta) XXX_DiscardUnknown() { - xxx_messageInfo_Communique_Delta.DiscardUnknown(m) -} - -var xxx_messageInfo_Communique_Delta proto.InternalMessageInfo - -var E_Tag = &proto.ExtensionDesc{ - ExtendedType: (*Reply)(nil), - ExtensionType: (*string)(nil), - Field: 103, - Name: "my.test.tag", - Tag: "bytes,103,opt,name=tag", - Filename: "my_test/test.proto", -} - -var E_Donut = &proto.ExtensionDesc{ - ExtendedType: (*Reply)(nil), - ExtensionType: (*OtherReplyExtensions)(nil), - Field: 106, - Name: "my.test.donut", - Tag: "bytes,106,opt,name=donut", - Filename: "my_test/test.proto", -} - -var E_ReplyExtensions_Time = &proto.ExtensionDesc{ - ExtendedType: (*Reply)(nil), - ExtensionType: (*float64)(nil), - Field: 101, - Name: "my.test.ReplyExtensions.time", - Tag: "fixed64,101,opt,name=time", - Filename: "my_test/test.proto", -} - -var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{ - ExtendedType: (*Reply)(nil), - ExtensionType: (*ReplyExtensions)(nil), - Field: 105, - Name: "my.test.ReplyExtensions.carrot", - Tag: "bytes,105,opt,name=carrot", - Filename: "my_test/test.proto", -} - -var E_ReplyExtensions_Donut = &proto.ExtensionDesc{ - ExtendedType: (*OtherBase)(nil), - ExtensionType: (*ReplyExtensions)(nil), - Field: 101, - Name: "my.test.ReplyExtensions.donut", - Tag: "bytes,101,opt,name=donut", - Filename: "my_test/test.proto", -} - -func init() { - proto.RegisterFile("my_test/test.proto", xxx_File_my_test_test_proto_rawdesc_gzipped) - proto.RegisterEnum("my.test.HatType", HatType_name, HatType_value) - proto.RegisterEnum("my.test.Days", Days_name, Days_value) - proto.RegisterEnum("my.test.Request_Color", Request_Color_name, Request_Color_value) - proto.RegisterEnum("my.test.Reply_Entry_Game", Reply_Entry_Game_name, Reply_Entry_Game_value) - proto.RegisterType((*Request)(nil), "my.test.Request") - proto.RegisterMapType((map[int64]*Reply)(nil), "my.test.Request.MsgMappingEntry") - proto.RegisterMapType((map[int32]string)(nil), "my.test.Request.NameMappingEntry") - proto.RegisterType((*Reply)(nil), "my.test.Reply") - proto.RegisterType((*OtherBase)(nil), "my.test.OtherBase") - proto.RegisterType((*ReplyExtensions)(nil), "my.test.ReplyExtensions") - proto.RegisterType((*OtherReplyExtensions)(nil), "my.test.OtherReplyExtensions") - proto.RegisterType((*OldReply)(nil), "my.test.OldReply") - proto.RegisterType((*Communique)(nil), "my.test.Communique") - proto.RegisterType((*Request_SomeGroup)(nil), "my.test.Request.SomeGroup") - proto.RegisterType((*Reply_Entry)(nil), "my.test.Reply.Entry") - proto.RegisterType((*Communique_SomeGroup)(nil), "my.test.Communique.SomeGroup") - proto.RegisterType((*Communique_Delta)(nil), "my.test.Communique.Delta") - proto.RegisterExtension(E_Tag) - proto.RegisterExtension(E_Donut) - proto.RegisterExtension(E_ReplyExtensions_Time) - proto.RegisterExtension(E_ReplyExtensions_Carrot) - proto.RegisterExtension(E_ReplyExtensions_Donut) -} - -var xxx_File_my_test_test_proto_rawdesc = []byte{ - // 2138 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x12, 0x6d, 0x79, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x6d, - 0x75, 0x6c, 0x74, 0x69, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xcd, 0x06, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x28, 0x0a, 0x03, 0x68, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x6d, - 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, - 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x03, 0x68, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x03, 0x68, 0x61, 0x74, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x2e, 0x48, 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x06, 0x46, 0x45, 0x44, 0x4f, 0x52, 0x41, - 0x52, 0x03, 0x68, 0x61, 0x74, 0x12, 0x1f, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, - 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x03, 0x69, 0x6e, 0x66, 0x52, 0x08, 0x64, 0x65, - 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x73, 0x6f, 0x6d, 0x65, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0a, 0x32, 0x1a, 0x2e, 0x6d, 0x79, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x6f, 0x6d, 0x65, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x09, 0x73, 0x6f, 0x6d, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, - 0x12, 0x44, 0x0a, 0x0c, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, - 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x70, - 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x4d, - 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x41, 0x0a, 0x0b, 0x6d, 0x73, 0x67, 0x5f, 0x6d, 0x61, - 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6d, 0x79, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x73, - 0x67, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x6d, - 0x73, 0x67, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x73, - 0x65, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x65, 0x73, 0x65, 0x74, 0x12, - 0x17, 0x0a, 0x07, 0x67, 0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x67, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0a, 0x66, 0x6c, 0x6f, 0x61, - 0x74, 0x5f, 0x6e, 0x69, 0x6e, 0x66, 0x18, 0x14, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x04, 0x2d, 0x69, - 0x6e, 0x66, 0x52, 0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x4e, 0x69, 0x6e, 0x66, 0x12, 0x22, 0x0a, - 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x70, 0x69, 0x6e, 0x66, 0x18, 0x15, 0x20, 0x01, 0x28, - 0x02, 0x3a, 0x03, 0x69, 0x6e, 0x66, 0x52, 0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x50, 0x69, 0x6e, - 0x66, 0x12, 0x22, 0x0a, 0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x18, 0x16, - 0x20, 0x01, 0x28, 0x02, 0x3a, 0x05, 0x31, 0x65, 0x2b, 0x30, 0x39, 0x52, 0x08, 0x66, 0x6c, 0x6f, - 0x61, 0x74, 0x45, 0x78, 0x70, 0x12, 0x25, 0x0a, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, - 0x6e, 0x69, 0x6e, 0x66, 0x18, 0x17, 0x20, 0x01, 0x28, 0x01, 0x3a, 0x04, 0x2d, 0x69, 0x6e, 0x66, - 0x52, 0x0a, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x4e, 0x69, 0x6e, 0x66, 0x12, 0x24, 0x0a, 0x0b, - 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x70, 0x69, 0x6e, 0x66, 0x18, 0x18, 0x20, 0x01, 0x28, - 0x01, 0x3a, 0x03, 0x69, 0x6e, 0x66, 0x52, 0x0a, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x50, 0x69, - 0x6e, 0x66, 0x12, 0x29, 0x0a, 0x0a, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x65, 0x78, 0x70, - 0x18, 0x19, 0x20, 0x01, 0x28, 0x01, 0x3a, 0x0a, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x52, 0x09, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x45, 0x78, 0x70, 0x1a, 0x2c, 0x0a, - 0x09, 0x53, 0x6f, 0x6d, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x3e, 0x0a, 0x10, 0x4e, - 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4d, 0x0a, 0x0f, 0x4d, - 0x73, 0x67, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x12, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x25, 0x0a, 0x05, 0x43, 0x6f, - 0x6c, 0x6f, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x47, 0x52, 0x45, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4c, 0x55, 0x45, 0x10, - 0x02, 0x22, 0x97, 0x02, 0x0a, 0x05, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x66, - 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x79, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x05, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x25, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x61, - 0x63, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, - 0x01, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x1a, 0xb0, - 0x01, 0x0a, 0x05, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x44, 0x0a, 0x1f, 0x6b, 0x65, 0x79, 0x5f, - 0x74, 0x68, 0x61, 0x74, 0x5f, 0x6e, 0x65, 0x65, 0x64, 0x73, 0x5f, 0x31, 0x32, 0x33, 0x34, 0x63, - 0x61, 0x6d, 0x65, 0x6c, 0x5f, 0x43, 0x61, 0x73, 0x49, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x02, 0x28, - 0x03, 0x52, 0x1b, 0x6b, 0x65, 0x79, 0x54, 0x68, 0x61, 0x74, 0x4e, 0x65, 0x65, 0x64, 0x73, 0x31, - 0x32, 0x33, 0x34, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x43, 0x61, 0x73, 0x49, 0x6e, 0x67, 0x12, 0x17, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x3a, 0x01, 0x37, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x26, 0x0a, 0x10, 0x5f, 0x6d, 0x79, 0x5f, 0x66, - 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x0c, 0x4d, 0x79, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x32, 0x22, - 0x20, 0x0a, 0x04, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x4f, 0x4f, 0x54, 0x42, - 0x41, 0x4c, 0x4c, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x54, 0x45, 0x4e, 0x4e, 0x49, 0x53, 0x10, - 0x02, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x29, 0x0a, 0x09, 0x4f, - 0x74, 0x68, 0x65, 0x72, 0x42, 0x61, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x2a, 0x08, 0x08, 0x64, - 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xbb, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0x22, 0x0a, 0x04, 0x74, 0x69, - 0x6d, 0x65, 0x12, 0x0e, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x18, 0x65, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x32, 0x40, - 0x0a, 0x06, 0x63, 0x61, 0x72, 0x72, 0x6f, 0x74, 0x12, 0x0e, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, - 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x63, 0x61, 0x72, 0x72, 0x6f, 0x74, - 0x32, 0x42, 0x0a, 0x05, 0x64, 0x6f, 0x6e, 0x75, 0x74, 0x12, 0x12, 0x2e, 0x6d, 0x79, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x2e, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x42, 0x61, 0x73, 0x65, 0x18, 0x65, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x64, - 0x6f, 0x6e, 0x75, 0x74, 0x22, 0x28, 0x0a, 0x14, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x18, - 0x0a, 0x08, 0x4f, 0x6c, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x2a, 0x08, 0x08, 0x64, 0x10, 0xff, - 0xff, 0xff, 0xff, 0x07, 0x3a, 0x02, 0x08, 0x01, 0x22, 0x96, 0x03, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, - 0x6d, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x12, 0x1e, 0x0a, 0x0b, 0x6d, 0x61, 0x6b, 0x65, 0x5f, - 0x6d, 0x65, 0x5f, 0x63, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x6d, 0x61, - 0x6b, 0x65, 0x4d, 0x65, 0x43, 0x72, 0x79, 0x12, 0x18, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x12, 0x14, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x17, 0x0a, - 0x06, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, - 0x05, 0x74, 0x65, 0x6d, 0x70, 0x43, 0x12, 0x18, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x18, 0x09, 0x20, 0x01, 0x28, 0x02, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x12, 0x25, 0x0a, 0x05, 0x74, 0x6f, 0x64, 0x61, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x0d, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x61, 0x79, 0x73, 0x48, 0x00, - 0x52, 0x05, 0x74, 0x6f, 0x64, 0x61, 0x79, 0x12, 0x16, 0x0a, 0x05, 0x6d, 0x61, 0x79, 0x62, 0x65, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x05, 0x6d, 0x61, 0x79, 0x62, 0x65, 0x12, - 0x16, 0x0a, 0x05, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x11, 0x48, 0x00, - 0x52, 0x05, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x22, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x10, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x48, 0x00, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x3d, 0x0a, 0x09, 0x73, - 0x6f, 0x6d, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0a, 0x32, 0x1d, - 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, - 0x71, 0x75, 0x65, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x48, 0x00, 0x52, - 0x09, 0x73, 0x6f, 0x6d, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, 0x23, 0x0a, 0x09, 0x53, 0x6f, - 0x6d, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x1a, - 0x07, 0x0a, 0x05, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x42, 0x07, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x6f, - 0x6e, 0x2a, 0x1e, 0x0a, 0x07, 0x48, 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, - 0x46, 0x45, 0x44, 0x4f, 0x52, 0x41, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x46, 0x45, 0x5a, 0x10, - 0x02, 0x2a, 0x2e, 0x0a, 0x04, 0x44, 0x61, 0x79, 0x73, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x4f, 0x4e, - 0x44, 0x41, 0x59, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x54, 0x55, 0x45, 0x53, 0x44, 0x41, 0x59, - 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x55, 0x4e, 0x44, 0x49, 0x10, 0x01, 0x1a, 0x02, 0x10, - 0x01, 0x3a, 0x20, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x12, 0x0e, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x18, 0x67, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x74, 0x61, 0x67, 0x3a, 0x43, 0x0a, 0x05, 0x64, 0x6f, 0x6e, 0x75, 0x74, 0x12, 0x0e, 0x2e, 0x6d, - 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x18, 0x6a, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6d, 0x79, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4f, 0x74, 0x68, - 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x73, 0x52, 0x05, 0x64, 0x6f, 0x6e, 0x75, 0x74, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, - 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x6d, 0x79, - 0x5f, 0x74, 0x65, 0x73, 0x74, 0x3b, 0x74, 0x65, 0x73, 0x74, -} - -var xxx_File_my_test_test_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_my_test_test_proto_rawdesc) diff --git a/protoc-gen-go/testdata/my_test/test.proto b/protoc-gen-go/testdata/my_test/test.proto deleted file mode 100644 index 64fcdca391..0000000000 --- a/protoc-gen-go/testdata/my_test/test.proto +++ /dev/null @@ -1,165 +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. - -syntax = "proto2"; - -// This package holds interesting messages. -package my.test; // dotted package name - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/my_test;test"; - -//import "imp.proto"; -import "multi/multi1.proto"; // unused import - -enum HatType { - // deliberately skipping 0 - FEDORA = 1; - FEZ = 2; -} - -// This enum represents days of the week. -enum Days { - option allow_alias = true; - - MONDAY = 1; - TUESDAY = 2; - LUNDI = 1; // same value as MONDAY -} - -// This is a message that might be sent somewhere. -message Request { - enum Color { - RED = 0; - GREEN = 1; - BLUE = 2; - } - repeated int64 key = 1; -// optional imp.ImportedMessage imported_message = 2; - optional Color hue = 3; // no default - optional HatType hat = 4 [default=FEDORA]; -// optional imp.ImportedMessage.Owner owner = 6; - optional float deadline = 7 [default=inf]; - optional group SomeGroup = 8 { - optional int32 group_field = 9; - } - - // These foreign types are in imp2.proto, - // which is publicly imported by imp.proto. -// optional imp.PubliclyImportedMessage pub = 10; -// optional imp.PubliclyImportedEnum pub_enum = 13 [default=HAIR]; - - - // This is a map field. It will generate map[int32]string. - map name_mapping = 14; - // This is a map field whose value type is a message. - map msg_mapping = 15; - - optional int32 reset = 12; - // This field should not conflict with any getters. - optional string get_key = 16; - - optional float float_ninf = 20 [default=-inf]; - optional float float_pinf = 21 [default=inf]; - optional float float_exp = 22 [default=1e9]; - optional double double_ninf = 23 [default=-inf]; - optional double double_pinf = 24 [default=inf]; - optional double double_exp = 25 [default=1e9]; -} - -message Reply { - message Entry { - required int64 key_that_needs_1234camel_CasIng = 1; - optional int64 value = 2 [default=7]; - optional int64 _my_field_name_2 = 3; - enum Game { - FOOTBALL = 1; - TENNIS = 2; - } - } - repeated Entry found = 1; - repeated int32 compact_keys = 2 [packed=true]; - extensions 100 to max; -} - -message OtherBase { - optional string name = 1; - extensions 100 to max; -} - -message ReplyExtensions { - extend Reply { - optional double time = 101; - optional ReplyExtensions carrot = 105; - } - extend OtherBase { - optional ReplyExtensions donut = 101; - } -} - -message OtherReplyExtensions { - optional int32 key = 1; -} - -// top-level extension -extend Reply { - optional string tag = 103; - optional OtherReplyExtensions donut = 106; -// optional imp.ImportedMessage elephant = 107; // extend with message from another file. -} - -message OldReply { - // Extensions will be encoded in MessageSet wire format. - option message_set_wire_format = true; - extensions 100 to max; -} - -message Communique { - optional bool make_me_cry = 1; - - // This is a oneof, called "union". - oneof union { - int32 number = 5; - string name = 6; - bytes data = 7; - double temp_c = 8; - float height = 9; - Days today = 10; - bool maybe = 11; - sint32 delta = 12; // name will conflict with Delta below - Reply msg = 16; // requires two bytes to encode field tag - group SomeGroup = 14 { - optional string member = 15; - } - } - - message Delta {} -} - diff --git a/protoc-gen-go/testdata/proto3/proto3.pb.go b/protoc-gen-go/testdata/proto3/proto3.pb.go deleted file mode 100644 index 72ceca9a1d..0000000000 --- a/protoc-gen-go/testdata/proto3/proto3.pb.go +++ /dev/null @@ -1,201 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: proto3/proto3.proto - -package proto3 - -import ( - proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type Request_Flavour int32 - -const ( - Request_SWEET Request_Flavour = 0 - Request_SOUR Request_Flavour = 1 - Request_UMAMI Request_Flavour = 2 - Request_GOPHERLICIOUS Request_Flavour = 3 -) - -var Request_Flavour_name = map[int32]string{ - 0: "SWEET", - 1: "SOUR", - 2: "UMAMI", - 3: "GOPHERLICIOUS", -} - -var Request_Flavour_value = map[string]int32{ - "SWEET": 0, - "SOUR": 1, - "UMAMI": 2, - "GOPHERLICIOUS": 3, -} - -func (x Request_Flavour) String() string { - return proto.EnumName(Request_Flavour_name, int32(x)) -} - -func (Request_Flavour) EnumDescriptor() ([]byte, []int) { - return xxx_File_proto3_proto3_proto_rawdesc_gzipped, []int{0, 0} -} - -type Request struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Key []int64 `protobuf:"varint,2,rep,packed,name=key,proto3" json:"key,omitempty"` - Taste Request_Flavour `protobuf:"varint,3,opt,name=taste,proto3,enum=proto3.Request_Flavour" json:"taste,omitempty"` - Book *Book `protobuf:"bytes,4,opt,name=book,proto3" json:"book,omitempty"` - Unpacked []int64 `protobuf:"varint,5,rep,name=unpacked,proto3" json:"unpacked,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Request) Reset() { *m = Request{} } -func (m *Request) String() string { return proto.CompactTextString(m) } -func (*Request) ProtoMessage() {} -func (*Request) Descriptor() ([]byte, []int) { - return xxx_File_proto3_proto3_proto_rawdesc_gzipped, []int{0} -} - -func (m *Request) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Request.Unmarshal(m, b) -} -func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Request.Marshal(b, m, deterministic) -} -func (m *Request) XXX_Merge(src proto.Message) { - xxx_messageInfo_Request.Merge(m, src) -} -func (m *Request) XXX_Size() int { - return xxx_messageInfo_Request.Size(m) -} -func (m *Request) XXX_DiscardUnknown() { - xxx_messageInfo_Request.DiscardUnknown(m) -} - -var xxx_messageInfo_Request proto.InternalMessageInfo - -func (m *Request) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Request) GetKey() []int64 { - if m != nil { - return m.Key - } - return nil -} - -func (m *Request) GetTaste() Request_Flavour { - if m != nil { - return m.Taste - } - return Request_SWEET -} - -func (m *Request) GetBook() *Book { - if m != nil { - return m.Book - } - return nil -} - -func (m *Request) GetUnpacked() []int64 { - if m != nil { - return m.Unpacked - } - return nil -} - -type Book struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - RawData []byte `protobuf:"bytes,2,opt,name=raw_data,json=rawData,proto3" json:"raw_data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Book) Reset() { *m = Book{} } -func (m *Book) String() string { return proto.CompactTextString(m) } -func (*Book) ProtoMessage() {} -func (*Book) Descriptor() ([]byte, []int) { - return xxx_File_proto3_proto3_proto_rawdesc_gzipped, []int{1} -} - -func (m *Book) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Book.Unmarshal(m, b) -} -func (m *Book) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Book.Marshal(b, m, deterministic) -} -func (m *Book) XXX_Merge(src proto.Message) { - xxx_messageInfo_Book.Merge(m, src) -} -func (m *Book) XXX_Size() int { - return xxx_messageInfo_Book.Size(m) -} -func (m *Book) XXX_DiscardUnknown() { - xxx_messageInfo_Book.DiscardUnknown(m) -} - -var xxx_messageInfo_Book proto.InternalMessageInfo - -func (m *Book) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *Book) GetRawData() []byte { - if m != nil { - return m.RawData - } - return nil -} - -func init() { - proto.RegisterFile("proto3/proto3.proto", xxx_File_proto3_proto3_proto_rawdesc_gzipped) - proto.RegisterEnum("proto3.Request_Flavour", Request_Flavour_name, Request_Flavour_value) - proto.RegisterType((*Request)(nil), "proto3.Request") - proto.RegisterType((*Book)(nil), "proto3.Book") -} - -var xxx_File_proto3_proto3_proto_rawdesc = []byte{ - // 379 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x13, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x22, 0xde, 0x01, - 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x2d, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, - 0x46, 0x6c, 0x61, 0x76, 0x6f, 0x75, 0x72, 0x52, 0x05, 0x74, 0x61, 0x73, 0x74, 0x65, 0x12, 0x20, - 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, - 0x12, 0x1e, 0x0a, 0x08, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x05, 0x20, 0x03, - 0x28, 0x03, 0x42, 0x02, 0x10, 0x00, 0x52, 0x08, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, - 0x22, 0x3c, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x76, 0x6f, 0x75, 0x72, 0x12, 0x09, 0x0a, 0x05, 0x53, - 0x57, 0x45, 0x45, 0x54, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x4f, 0x55, 0x52, 0x10, 0x01, - 0x12, 0x09, 0x0a, 0x05, 0x55, 0x4d, 0x41, 0x4d, 0x49, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x47, - 0x4f, 0x50, 0x48, 0x45, 0x52, 0x4c, 0x49, 0x43, 0x49, 0x4f, 0x55, 0x53, 0x10, 0x03, 0x22, 0x37, - 0x0a, 0x04, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x08, - 0x72, 0x61, 0x77, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, - 0x72, 0x61, 0x77, 0x44, 0x61, 0x74, 0x61, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, - 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var xxx_File_proto3_proto3_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_proto3_proto3_proto_rawdesc) diff --git a/protoc-gen-go/testdata/proto3/proto3.proto b/protoc-gen-go/testdata/proto3/proto3.proto deleted file mode 100644 index 79954e4e25..0000000000 --- a/protoc-gen-go/testdata/proto3/proto3.proto +++ /dev/null @@ -1,55 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2014 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. - -syntax = "proto3"; - -package proto3; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/proto3"; - -message Request { - enum Flavour { - SWEET = 0; - SOUR = 1; - UMAMI = 2; - GOPHERLICIOUS = 3; - } - string name = 1; - repeated int64 key = 2; - Flavour taste = 3; - Book book = 4; - repeated int64 unpacked = 5 [packed=false]; -} - -message Book { - string title = 1; - bytes raw_data = 2; -} diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index 93dff5e96d..372c515146 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -1,11 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/protobuf/any.proto +// source: github.com/golang/protobuf/ptypes/any/any.proto package any import ( proto "github.com/golang/protobuf/proto" protoapi "github.com/golang/protobuf/protoapi" + protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" + known "github.com/golang/protobuf/v2/types/known" ) // This is a compile-time assertion to ensure that this generated file @@ -14,184 +17,45 @@ import ( // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// `Any` contains an arbitrary serialized protocol buffer message along with a -// URL that describes the type of the serialized message. -// -// Protobuf library provides support to pack/unpack Any values in the form -// of utility functions or additional generated methods of the Any type. -// -// Example 1: Pack and unpack a message in C++. -// -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } -// -// Example 2: Pack and unpack a message in Java. -// -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } -// -// Example 3: Pack and unpack a message in Python. -// -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... -// -// Example 4: Pack and unpack a message in Go -// -// foo := &pb.Foo{...} -// any, err := ptypes.MarshalAny(foo) -// ... -// foo := &pb.Foo{} -// if err := ptypes.UnmarshalAny(any, foo); err != nil { -// ... -// } -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// -// JSON -// ==== -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -// -type Any struct { - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - // - TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - // Must be a valid serialized protocol buffer of the above specified type. - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Any) Reset() { *m = Any{} } -func (m *Any) String() string { return proto.CompactTextString(m) } -func (*Any) ProtoMessage() {} -func (*Any) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_any_proto_rawdesc_gzipped, []int{0} -} +// Symbols defined in public import of google/protobuf/any.proto -func (*Any) XXX_WellKnownType() string { return "Any" } +type Any = known.Any -func (m *Any) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Any.Unmarshal(m, b) -} -func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Any.Marshal(b, m, deterministic) -} -func (m *Any) XXX_Merge(src proto.Message) { - xxx_messageInfo_Any.Merge(m, src) -} -func (m *Any) XXX_Size() int { - return xxx_messageInfo_Any.Size(m) +func init() { + proto.RegisterFile("github.com/golang/protobuf/ptypes/any/any.proto", xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc_gzipped) } -func (m *Any) XXX_DiscardUnknown() { - xxx_messageInfo_Any.DiscardUnknown(m) + +var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc = []byte{ + // 127 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x27, 0x5a, 0x25, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, + 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_messageInfo_Any proto.InternalMessageInfo +var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc) -func (m *Any) GetTypeUrl() string { - if m != nil { - return m.TypeUrl - } - return "" -} +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) -func (m *Any) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} +var File_github_com_golang_protobuf_ptypes_any_any_proto protoreflect.FileDescriptor -func init() { - proto.RegisterFile("google/protobuf/any.proto", xxx_File_google_protobuf_any_proto_rawdesc_gzipped) - proto.RegisterType((*Any)(nil), "google.protobuf.Any") -} +var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = []interface{}{} +var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{} -var xxx_File_google_protobuf_any_proto_rawdesc = []byte{ - // 221 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x36, 0x0a, 0x03, - 0x41, 0x6e, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x42, 0x6f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x08, 0x41, 0x6e, 0x79, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0xa2, 0x02, - 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, - 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +func init() { xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_init() } +func xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_init() { + if File_github_com_golang_protobuf_ptypes_any_any_proto != nil { + return + } + File_github_com_golang_protobuf_ptypes_any_any_proto = protoimpl.FileBuilder{ + RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc, + GoTypes: xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_goTypes, + DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs, + }.Init() + xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = nil + xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = nil } - -var xxx_File_google_protobuf_any_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_any_proto_rawdesc) diff --git a/ptypes/any/any.proto b/ptypes/any/any.proto index 4932942558..ecfd3e1f9d 100644 --- a/ptypes/any/any.proto +++ b/ptypes/any/any.proto @@ -1,154 +1,3 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option go_package = "github.com/golang/protobuf/ptypes/any"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "AnyProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - -// `Any` contains an arbitrary serialized protocol buffer message along with a -// URL that describes the type of the serialized message. -// -// Protobuf library provides support to pack/unpack Any values in the form -// of utility functions or additional generated methods of the Any type. -// -// Example 1: Pack and unpack a message in C++. -// -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } -// -// Example 2: Pack and unpack a message in Java. -// -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } -// -// Example 3: Pack and unpack a message in Python. -// -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... -// -// Example 4: Pack and unpack a message in Go -// -// foo := &pb.Foo{...} -// any, err := ptypes.MarshalAny(foo) -// ... -// foo := &pb.Foo{} -// if err := ptypes.UnmarshalAny(any, foo); err != nil { -// ... -// } -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// -// JSON -// ==== -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -// -message Any { - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - // - string type_url = 1; - - // Must be a valid serialized protocol buffer of the above specified type. - bytes value = 2; -} +import public "google/protobuf/any.proto"; diff --git a/ptypes/any_test.go b/ptypes/any_test.go index 053ab43b62..a7ea3c0087 100644 --- a/ptypes/any_test.go +++ b/ptypes/any_test.go @@ -99,7 +99,7 @@ func TestEmpty(t *testing.T) { // that's a valid type_url for a message which shouldn't be linked into this // test binary. We want an error. - a.TypeUrl = "type.googleapis.com/google.protobuf.FieldMask" + a.TypeUrl = "type.googleapis.com/google.protobuf.compiler.Version" if _, err := Empty(a); err == nil { t.Errorf("got no error for an attempt to create a message of type %q, which shouldn't be linked in", a.TypeUrl) } diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index b1a8caea32..0f8d740358 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -1,11 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/protobuf/duration.proto +// source: github.com/golang/protobuf/ptypes/duration/duration.proto package duration import ( proto "github.com/golang/protobuf/proto" protoapi "github.com/golang/protobuf/protoapi" + protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" + known "github.com/golang/protobuf/v2/types/known" ) // This is a compile-time assertion to ensure that this generated file @@ -14,147 +17,47 @@ import ( // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// A Duration represents a signed, fixed-length span of time represented -// as a count of seconds and fractions of seconds at nanosecond -// resolution. It is independent of any calendar and concepts like "day" -// or "month". It is related to Timestamp in that the difference between -// two Timestamp values is a Duration and it can be added or subtracted -// from a Timestamp. Range is approximately +-10,000 years. -// -// # Examples -// -// Example 1: Compute Duration from two Timestamps in pseudo code. -// -// Timestamp start = ...; -// Timestamp end = ...; -// Duration duration = ...; -// -// duration.seconds = end.seconds - start.seconds; -// duration.nanos = end.nanos - start.nanos; -// -// if (duration.seconds < 0 && duration.nanos > 0) { -// duration.seconds += 1; -// duration.nanos -= 1000000000; -// } else if (durations.seconds > 0 && duration.nanos < 0) { -// duration.seconds -= 1; -// duration.nanos += 1000000000; -// } -// -// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. -// -// Timestamp start = ...; -// Duration duration = ...; -// Timestamp end = ...; -// -// end.seconds = start.seconds + duration.seconds; -// end.nanos = start.nanos + duration.nanos; -// -// if (end.nanos < 0) { -// end.seconds -= 1; -// end.nanos += 1000000000; -// } else if (end.nanos >= 1000000000) { -// end.seconds += 1; -// end.nanos -= 1000000000; -// } -// -// Example 3: Compute Duration from datetime.timedelta in Python. -// -// td = datetime.timedelta(days=3, minutes=10) -// duration = Duration() -// duration.FromTimedelta(td) -// -// # JSON Mapping -// -// In JSON format, the Duration type is encoded as a string rather than an -// object, where the string ends in the suffix "s" (indicating seconds) and -// is preceded by the number of seconds, with nanoseconds expressed as -// fractional seconds. For example, 3 seconds with 0 nanoseconds should be -// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should -// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 -// microsecond should be expressed in JSON format as "3.000001s". -// -// -type Duration struct { - // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. Note: these bounds are computed from: - // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - // Signed fractions of a second at nanosecond resolution of the span - // of time. Durations less than one second are represented with a 0 - // `seconds` field and a positive or negative `nanos` field. For durations - // of one second or more, a non-zero value for the `nanos` field must be - // of the same sign as the `seconds` field. Must be from -999,999,999 - // to +999,999,999 inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Duration) Reset() { *m = Duration{} } -func (m *Duration) String() string { return proto.CompactTextString(m) } -func (*Duration) ProtoMessage() {} -func (*Duration) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_duration_proto_rawdesc_gzipped, []int{0} -} +// Symbols defined in public import of google/protobuf/duration.proto -func (*Duration) XXX_WellKnownType() string { return "Duration" } +type Duration = known.Duration -func (m *Duration) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Duration.Unmarshal(m, b) -} -func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Duration.Marshal(b, m, deterministic) -} -func (m *Duration) XXX_Merge(src proto.Message) { - xxx_messageInfo_Duration.Merge(m, src) -} -func (m *Duration) XXX_Size() int { - return xxx_messageInfo_Duration.Size(m) -} -func (m *Duration) XXX_DiscardUnknown() { - xxx_messageInfo_Duration.DiscardUnknown(m) +func init() { + proto.RegisterFile("github.com/golang/protobuf/ptypes/duration/duration.proto", xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc_gzipped) +} + +var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc = []byte{ + // 147 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x64, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x2c, 0x5a, 0x2a, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } -var xxx_messageInfo_Duration proto.InternalMessageInfo +var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc) -func (m *Duration) GetSeconds() int64 { - if m != nil { - return m.Seconds - } - return 0 -} +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) -func (m *Duration) GetNanos() int32 { - if m != nil { - return m.Nanos - } - return 0 -} +var File_github_com_golang_protobuf_ptypes_duration_duration_proto protoreflect.FileDescriptor -func init() { - proto.RegisterFile("google/protobuf/duration.proto", xxx_File_google_protobuf_duration_proto_rawdesc_gzipped) - proto.RegisterType((*Duration)(nil), "google.protobuf.Duration") -} +var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = []interface{}{} +var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = []int32{} -var xxx_File_google_protobuf_duration_proto_rawdesc = []byte{ - // 243 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x22, 0x3a, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, - 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, - 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, 0x7c, 0x0a, - 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0d, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, - 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, +func init() { xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_init() } +func xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_init() { + if File_github_com_golang_protobuf_ptypes_duration_duration_proto != nil { + return + } + File_github_com_golang_protobuf_ptypes_duration_duration_proto = protoimpl.FileBuilder{ + RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc, + GoTypes: xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes, + DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs, + }.Init() + xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = nil + xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = nil } - -var xxx_File_google_protobuf_duration_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_duration_proto_rawdesc) diff --git a/ptypes/duration/duration.proto b/ptypes/duration/duration.proto index 975fce41aa..1c9153e8c7 100644 --- a/ptypes/duration/duration.proto +++ b/ptypes/duration/duration.proto @@ -1,117 +1,3 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option cc_enable_arenas = true; option go_package = "github.com/golang/protobuf/ptypes/duration"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "DurationProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - -// A Duration represents a signed, fixed-length span of time represented -// as a count of seconds and fractions of seconds at nanosecond -// resolution. It is independent of any calendar and concepts like "day" -// or "month". It is related to Timestamp in that the difference between -// two Timestamp values is a Duration and it can be added or subtracted -// from a Timestamp. Range is approximately +-10,000 years. -// -// # Examples -// -// Example 1: Compute Duration from two Timestamps in pseudo code. -// -// Timestamp start = ...; -// Timestamp end = ...; -// Duration duration = ...; -// -// duration.seconds = end.seconds - start.seconds; -// duration.nanos = end.nanos - start.nanos; -// -// if (duration.seconds < 0 && duration.nanos > 0) { -// duration.seconds += 1; -// duration.nanos -= 1000000000; -// } else if (durations.seconds > 0 && duration.nanos < 0) { -// duration.seconds -= 1; -// duration.nanos += 1000000000; -// } -// -// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. -// -// Timestamp start = ...; -// Duration duration = ...; -// Timestamp end = ...; -// -// end.seconds = start.seconds + duration.seconds; -// end.nanos = start.nanos + duration.nanos; -// -// if (end.nanos < 0) { -// end.seconds -= 1; -// end.nanos += 1000000000; -// } else if (end.nanos >= 1000000000) { -// end.seconds += 1; -// end.nanos -= 1000000000; -// } -// -// Example 3: Compute Duration from datetime.timedelta in Python. -// -// td = datetime.timedelta(days=3, minutes=10) -// duration = Duration() -// duration.FromTimedelta(td) -// -// # JSON Mapping -// -// In JSON format, the Duration type is encoded as a string rather than an -// object, where the string ends in the suffix "s" (indicating seconds) and -// is preceded by the number of seconds, with nanoseconds expressed as -// fractional seconds. For example, 3 seconds with 0 nanoseconds should be -// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should -// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 -// microsecond should be expressed in JSON format as "3.000001s". -// -// -message Duration { - - // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. Note: these bounds are computed from: - // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - int64 seconds = 1; - - // Signed fractions of a second at nanosecond resolution of the span - // of time. Durations less than one second are represented with a 0 - // `seconds` field and a positive or negative `nanos` field. For durations - // of one second or more, a non-zero value for the `nanos` field must be - // of the same sign as the `seconds` field. Must be from -999,999,999 - // to +999,999,999 inclusive. - int32 nanos = 2; -} +import public "google/protobuf/duration.proto"; diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index f88b0e6e7f..45f35dff33 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -1,11 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/protobuf/empty.proto +// source: github.com/golang/protobuf/ptypes/empty/empty.proto package empty import ( proto "github.com/golang/protobuf/proto" protoapi "github.com/golang/protobuf/protoapi" + protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" + known "github.com/golang/protobuf/v2/types/known" ) // This is a compile-time assertion to ensure that this generated file @@ -14,67 +17,46 @@ import ( // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// A generic empty message that you can re-use to avoid defining duplicated -// empty messages in your APIs. A typical example is to use it as the request -// or the response type of an API method. For instance: -// -// service Foo { -// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -// } -// -// The JSON representation for `Empty` is empty JSON object `{}`. -type Empty struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +// Symbols defined in public import of google/protobuf/empty.proto + +type Empty = known.Empty -func (m *Empty) Reset() { *m = Empty{} } -func (m *Empty) String() string { return proto.CompactTextString(m) } -func (*Empty) ProtoMessage() {} -func (*Empty) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_empty_proto_rawdesc_gzipped, []int{0} +func init() { + proto.RegisterFile("github.com/golang/protobuf/ptypes/empty/empty.proto", xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc_gzipped) +} + +var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc = []byte{ + // 135 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x00, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func (*Empty) XXX_WellKnownType() string { return "Empty" } +var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc) -func (m *Empty) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Empty.Unmarshal(m, b) -} -func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Empty.Marshal(b, m, deterministic) -} -func (m *Empty) XXX_Merge(src proto.Message) { - xxx_messageInfo_Empty.Merge(m, src) -} -func (m *Empty) XXX_Size() int { - return xxx_messageInfo_Empty.Size(m) -} -func (m *Empty) XXX_DiscardUnknown() { - xxx_messageInfo_Empty.DiscardUnknown(m) -} +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) -var xxx_messageInfo_Empty proto.InternalMessageInfo +var File_github_com_golang_protobuf_ptypes_empty_empty_proto protoreflect.FileDescriptor -func init() { - proto.RegisterFile("google/protobuf/empty.proto", xxx_File_google_protobuf_empty_proto_rawdesc_gzipped) - proto.RegisterType((*Empty)(nil), "google.protobuf.Empty") -} +var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = []interface{}{} +var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = []int32{} -var xxx_File_google_protobuf_empty_proto_rawdesc = []byte{ - // 183 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x07, - 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x76, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0a, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, - 0x65, 0x6d, 0x70, 0x74, 0x79, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, - 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +func init() { xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_init() } +func xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_init() { + if File_github_com_golang_protobuf_ptypes_empty_empty_proto != nil { + return + } + File_github_com_golang_protobuf_ptypes_empty_empty_proto = protoimpl.FileBuilder{ + RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc, + GoTypes: xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes, + DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs, + }.Init() + xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = nil + xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = nil } - -var xxx_File_google_protobuf_empty_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_empty_proto_rawdesc) diff --git a/ptypes/empty/empty.proto b/ptypes/empty/empty.proto index 03cacd2330..b63cbd8a9c 100644 --- a/ptypes/empty/empty.proto +++ b/ptypes/empty/empty.proto @@ -1,52 +1,3 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option go_package = "github.com/golang/protobuf/ptypes/empty"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "EmptyProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; -option cc_enable_arenas = true; - -// A generic empty message that you can re-use to avoid defining duplicated -// empty messages in your APIs. A typical example is to use it as the request -// or the response type of an API method. For instance: -// -// service Foo { -// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -// } -// -// The JSON representation for `Empty` is empty JSON object `{}`. -message Empty {} +import public "google/protobuf/empty.proto"; diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index 687d0bf202..0d71b8dab1 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -1,11 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/protobuf/struct.proto +// source: github.com/golang/protobuf/ptypes/struct/struct.proto package structpb import ( proto "github.com/golang/protobuf/proto" protoapi "github.com/golang/protobuf/protoapi" + protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" + known "github.com/golang/protobuf/v2/types/known" ) // This is a compile-time assertion to ensure that this generated file @@ -14,344 +17,62 @@ import ( // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// `NullValue` is a singleton enumeration to represent the null value for the -// `Value` type union. -// -// The JSON representation for `NullValue` is JSON `null`. -type NullValue int32 +// Symbols defined in public import of google/protobuf/struct.proto -const ( - // Null value. - NullValue_NULL_VALUE NullValue = 0 -) - -var NullValue_name = map[int32]string{ - 0: "NULL_VALUE", -} - -var NullValue_value = map[string]int32{ - "NULL_VALUE": 0, -} - -func (x NullValue) String() string { - return proto.EnumName(NullValue_name, int32(x)) -} - -func (NullValue) EnumDescriptor() ([]byte, []int) { - return xxx_File_google_protobuf_struct_proto_rawdesc_gzipped, []int{0} -} - -func (NullValue) XXX_WellKnownType() string { return "NullValue" } - -// `Struct` represents a structured data value, consisting of fields -// which map to dynamically typed values. In some languages, `Struct` -// might be supported by a native representation. For example, in -// scripting languages like JS a struct is represented as an -// object. The details of that representation are described together -// with the proto support for the language. -// -// The JSON representation for `Struct` is JSON object. -type Struct struct { - // Unordered map of dynamically typed values. - Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Struct) Reset() { *m = Struct{} } -func (m *Struct) String() string { return proto.CompactTextString(m) } -func (*Struct) ProtoMessage() {} -func (*Struct) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_struct_proto_rawdesc_gzipped, []int{0} -} - -func (*Struct) XXX_WellKnownType() string { return "Struct" } - -func (m *Struct) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Struct.Unmarshal(m, b) -} -func (m *Struct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Struct.Marshal(b, m, deterministic) -} -func (m *Struct) XXX_Merge(src proto.Message) { - xxx_messageInfo_Struct.Merge(m, src) -} -func (m *Struct) XXX_Size() int { - return xxx_messageInfo_Struct.Size(m) -} -func (m *Struct) XXX_DiscardUnknown() { - xxx_messageInfo_Struct.DiscardUnknown(m) -} - -var xxx_messageInfo_Struct proto.InternalMessageInfo - -func (m *Struct) GetFields() map[string]*Value { - if m != nil { - return m.Fields - } - return nil -} - -// `Value` represents a dynamically typed value which can be either -// null, a number, a string, a boolean, a recursive struct value, or a -// list of values. A producer of value is expected to set one of that -// variants, absence of any variant indicates an error. -// -// The JSON representation for `Value` is JSON value. -type Value struct { - // The kind of value. - // - // Types that are valid to be assigned to Kind: - // Represents a null value. - // *Value_NullValue - // Represents a double value. - // *Value_NumberValue - // Represents a string value. - // *Value_StringValue - // Represents a boolean value. - // *Value_BoolValue - // Represents a structured value. - // *Value_StructValue - // Represents a repeated `Value`. - // *Value_ListValue - Kind isValue_Kind `protobuf_oneof:"kind"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Value) Reset() { *m = Value{} } -func (m *Value) String() string { return proto.CompactTextString(m) } -func (*Value) ProtoMessage() {} -func (*Value) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_struct_proto_rawdesc_gzipped, []int{1} -} +type NullValue = known.NullValue -func (*Value) XXX_WellKnownType() string { return "Value" } - -func (m *Value) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Value.Unmarshal(m, b) -} -func (m *Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Value.Marshal(b, m, deterministic) -} -func (m *Value) XXX_Merge(src proto.Message) { - xxx_messageInfo_Value.Merge(m, src) -} -func (m *Value) XXX_Size() int { - return xxx_messageInfo_Value.Size(m) -} -func (m *Value) XXX_DiscardUnknown() { - xxx_messageInfo_Value.DiscardUnknown(m) -} +const NullValue_NULL_VALUE = known.NullValue_NULL_VALUE -var xxx_messageInfo_Value proto.InternalMessageInfo +var NullValue_name = known.NullValue_name +var NullValue_value = known.NullValue_value -type isValue_Kind interface { - isValue_Kind() -} - -type Value_NullValue struct { - NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"` -} - -type Value_NumberValue struct { - NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"` -} - -type Value_StringValue struct { - StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` -} - -type Value_BoolValue struct { - BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` -} - -type Value_StructValue struct { - StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"` -} +type Struct = known.Struct +type Value = known.Value +type Value_NullValue = known.Value_NullValue +type Value_NumberValue = known.Value_NumberValue +type Value_StringValue = known.Value_StringValue +type Value_BoolValue = known.Value_BoolValue +type Value_StructValue = known.Value_StructValue +type Value_ListValue = known.Value_ListValue +type ListValue = known.ListValue -type Value_ListValue struct { - ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof"` -} - -func (*Value_NullValue) isValue_Kind() {} - -func (*Value_NumberValue) isValue_Kind() {} - -func (*Value_StringValue) isValue_Kind() {} - -func (*Value_BoolValue) isValue_Kind() {} - -func (*Value_StructValue) isValue_Kind() {} - -func (*Value_ListValue) isValue_Kind() {} - -func (m *Value) GetKind() isValue_Kind { - if m != nil { - return m.Kind - } - return nil -} - -func (m *Value) GetNullValue() NullValue { - if x, ok := m.GetKind().(*Value_NullValue); ok { - return x.NullValue - } - return NullValue_NULL_VALUE -} - -func (m *Value) GetNumberValue() float64 { - if x, ok := m.GetKind().(*Value_NumberValue); ok { - return x.NumberValue - } - return 0 -} - -func (m *Value) GetStringValue() string { - if x, ok := m.GetKind().(*Value_StringValue); ok { - return x.StringValue - } - return "" -} - -func (m *Value) GetBoolValue() bool { - if x, ok := m.GetKind().(*Value_BoolValue); ok { - return x.BoolValue - } - return false -} - -func (m *Value) GetStructValue() *Struct { - if x, ok := m.GetKind().(*Value_StructValue); ok { - return x.StructValue - } - return nil -} - -func (m *Value) GetListValue() *ListValue { - if x, ok := m.GetKind().(*Value_ListValue); ok { - return x.ListValue - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Value) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Value_NullValue)(nil), - (*Value_NumberValue)(nil), - (*Value_StringValue)(nil), - (*Value_BoolValue)(nil), - (*Value_StructValue)(nil), - (*Value_ListValue)(nil), - } +func init() { + proto.RegisterFile("github.com/golang/protobuf/ptypes/struct/struct.proto", xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc_gzipped) } -// `ListValue` is a wrapper around a repeated field of values. -// -// The JSON representation for `ListValue` is JSON array. -type ListValue struct { - // Repeated field of dynamically typed values. - Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc = []byte{ + // 148 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x3b, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x70, 0x62, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } -func (m *ListValue) Reset() { *m = ListValue{} } -func (m *ListValue) String() string { return proto.CompactTextString(m) } -func (*ListValue) ProtoMessage() {} -func (*ListValue) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_struct_proto_rawdesc_gzipped, []int{2} -} +var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc) -func (*ListValue) XXX_WellKnownType() string { return "ListValue" } +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) -func (m *ListValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListValue.Unmarshal(m, b) -} -func (m *ListValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListValue.Marshal(b, m, deterministic) -} -func (m *ListValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListValue.Merge(m, src) -} -func (m *ListValue) XXX_Size() int { - return xxx_messageInfo_ListValue.Size(m) -} -func (m *ListValue) XXX_DiscardUnknown() { - xxx_messageInfo_ListValue.DiscardUnknown(m) -} +var File_github_com_golang_protobuf_ptypes_struct_struct_proto protoreflect.FileDescriptor -var xxx_messageInfo_ListValue proto.InternalMessageInfo +var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = []interface{}{} +var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = []int32{} -func (m *ListValue) GetValues() []*Value { - if m != nil { - return m.Values +func init() { xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_init() } +func xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_init() { + if File_github_com_golang_protobuf_ptypes_struct_struct_proto != nil { + return } - return nil + File_github_com_golang_protobuf_ptypes_struct_struct_proto = protoimpl.FileBuilder{ + RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc, + GoTypes: xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes, + DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs, + }.Init() + xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = nil + xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = nil } - -func init() { - proto.RegisterFile("google/protobuf/struct.proto", xxx_File_google_protobuf_struct_proto_rawdesc_gzipped) - proto.RegisterEnum("google.protobuf.NullValue", NullValue_name, NullValue_value) - proto.RegisterType((*Struct)(nil), "google.protobuf.Struct") - proto.RegisterMapType((map[string]*Value)(nil), "google.protobuf.Struct.FieldsEntry") - proto.RegisterType((*Value)(nil), "google.protobuf.Value") - proto.RegisterType((*ListValue)(nil), "google.protobuf.ListValue") -} - -var xxx_File_google_protobuf_struct_proto_rawdesc = []byte{ - // 741 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, - 0x98, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3b, 0x0a, 0x06, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x1a, 0x51, 0x0a, 0x0b, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb2, 0x02, 0x0a, 0x05, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, - 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62, - 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, - 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0c, - 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x73, - 0x74, 0x72, 0x75, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6c, 0x69, - 0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6c, 0x69, - 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, - 0x3b, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2e, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2a, 0x1b, 0x0a, 0x09, - 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x55, 0x4c, - 0x4c, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x00, 0x42, 0x81, 0x01, 0x0a, 0x13, 0x63, 0x6f, - 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x42, 0x0b, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x3b, 0x73, 0x74, 0x72, 0x75, 0x63, - 0x74, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, - 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var xxx_File_google_protobuf_struct_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_struct_proto_rawdesc) diff --git a/ptypes/struct/struct.proto b/ptypes/struct/struct.proto index 7d7808e7fb..6072bd27fc 100644 --- a/ptypes/struct/struct.proto +++ b/ptypes/struct/struct.proto @@ -1,96 +1,3 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option cc_enable_arenas = true; option go_package = "github.com/golang/protobuf/ptypes/struct;structpb"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "StructProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - - -// `Struct` represents a structured data value, consisting of fields -// which map to dynamically typed values. In some languages, `Struct` -// might be supported by a native representation. For example, in -// scripting languages like JS a struct is represented as an -// object. The details of that representation are described together -// with the proto support for the language. -// -// The JSON representation for `Struct` is JSON object. -message Struct { - // Unordered map of dynamically typed values. - map fields = 1; -} - -// `Value` represents a dynamically typed value which can be either -// null, a number, a string, a boolean, a recursive struct value, or a -// list of values. A producer of value is expected to set one of that -// variants, absence of any variant indicates an error. -// -// The JSON representation for `Value` is JSON value. -message Value { - // The kind of value. - oneof kind { - // Represents a null value. - NullValue null_value = 1; - // Represents a double value. - double number_value = 2; - // Represents a string value. - string string_value = 3; - // Represents a boolean value. - bool bool_value = 4; - // Represents a structured value. - Struct struct_value = 5; - // Represents a repeated `Value`. - ListValue list_value = 6; - } -} - -// `NullValue` is a singleton enumeration to represent the null value for the -// `Value` type union. -// -// The JSON representation for `NullValue` is JSON `null`. -enum NullValue { - // Null value. - NULL_VALUE = 0; -} - -// `ListValue` is a wrapper around a repeated field of values. -// -// The JSON representation for `ListValue` is JSON array. -message ListValue { - // Repeated field of dynamically typed values. - repeated Value values = 1; -} +import public "google/protobuf/struct.proto"; diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index f0a5280a2d..1f26667319 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -1,11 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/protobuf/timestamp.proto +// source: github.com/golang/protobuf/ptypes/timestamp/timestamp.proto package timestamp import ( proto "github.com/golang/protobuf/proto" protoapi "github.com/golang/protobuf/protoapi" + protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" + known "github.com/golang/protobuf/v2/types/known" ) // This is a compile-time assertion to ensure that this generated file @@ -14,165 +17,47 @@ import ( // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// A Timestamp represents a point in time independent of any time zone -// or calendar, represented as seconds and fractions of seconds at -// nanosecond resolution in UTC Epoch time. It is encoded using the -// Proleptic Gregorian Calendar which extends the Gregorian calendar -// backwards to year one. It is encoded assuming all minutes are 60 -// seconds long, i.e. leap seconds are "smeared" so that no leap second -// table is needed for interpretation. Range is from -// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. -// By restricting to that range, we ensure that we can convert to -// and from RFC 3339 date strings. -// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). -// -// # Examples -// -// Example 1: Compute Timestamp from POSIX `time()`. -// -// Timestamp timestamp; -// timestamp.set_seconds(time(NULL)); -// timestamp.set_nanos(0); -// -// Example 2: Compute Timestamp from POSIX `gettimeofday()`. -// -// struct timeval tv; -// gettimeofday(&tv, NULL); -// -// Timestamp timestamp; -// timestamp.set_seconds(tv.tv_sec); -// timestamp.set_nanos(tv.tv_usec * 1000); -// -// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. -// -// FILETIME ft; -// GetSystemTimeAsFileTime(&ft); -// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; -// -// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z -// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. -// Timestamp timestamp; -// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); -// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); -// -// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. -// -// long millis = System.currentTimeMillis(); -// -// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) -// .setNanos((int) ((millis % 1000) * 1000000)).build(); -// -// -// Example 5: Compute Timestamp from current time in Python. -// -// timestamp = Timestamp() -// timestamp.GetCurrentTime() -// -// # JSON Mapping -// -// In JSON format, the Timestamp type is encoded as a string in the -// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the -// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" -// where {year} is always expressed using four digits while {month}, {day}, -// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional -// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), -// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -// is required. A proto3 JSON serializer should always use UTC (as indicated by -// "Z") when printing the Timestamp type and a proto3 JSON parser should be -// able to accept both UTC and other timezones (as indicated by an offset). -// -// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past -// 01:30 UTC on January 15, 2017. -// -// In JavaScript, one can convert a Date object to this format using the -// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString] -// method. In Python, a standard `datetime.datetime` object can be converted -// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) -// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one -// can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime-- -// ) to obtain a formatter capable of generating timestamps in this format. -// -// -type Timestamp struct { - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 - // inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Timestamp) Reset() { *m = Timestamp{} } -func (m *Timestamp) String() string { return proto.CompactTextString(m) } -func (*Timestamp) ProtoMessage() {} -func (*Timestamp) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_timestamp_proto_rawdesc_gzipped, []int{0} -} +// Symbols defined in public import of google/protobuf/timestamp.proto -func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" } +type Timestamp = known.Timestamp -func (m *Timestamp) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Timestamp.Unmarshal(m, b) -} -func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic) -} -func (m *Timestamp) XXX_Merge(src proto.Message) { - xxx_messageInfo_Timestamp.Merge(m, src) -} -func (m *Timestamp) XXX_Size() int { - return xxx_messageInfo_Timestamp.Size(m) -} -func (m *Timestamp) XXX_DiscardUnknown() { - xxx_messageInfo_Timestamp.DiscardUnknown(m) +func init() { + proto.RegisterFile("github.com/golang/protobuf/ptypes/timestamp/timestamp.proto", xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc_gzipped) +} + +var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc = []byte{ + // 151 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2f, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x2d, + 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x50, 0x00, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_messageInfo_Timestamp proto.InternalMessageInfo +var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc) -func (m *Timestamp) GetSeconds() int64 { - if m != nil { - return m.Seconds - } - return 0 -} +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) -func (m *Timestamp) GetNanos() int32 { - if m != nil { - return m.Nanos - } - return 0 -} +var File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto protoreflect.FileDescriptor -func init() { - proto.RegisterFile("google/protobuf/timestamp.proto", xxx_File_google_protobuf_timestamp_proto_rawdesc_gzipped) - proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp") -} +var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = []interface{}{} +var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = []int32{} -var xxx_File_google_protobuf_timestamp_proto_rawdesc = []byte{ - // 247 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, - 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, - 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, - 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, - 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +func init() { xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() } +func xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() { + if File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto != nil { + return + } + File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto = protoimpl.FileBuilder{ + RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc, + GoTypes: xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes, + DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs, + }.Init() + xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = nil + xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = nil } - -var xxx_File_google_protobuf_timestamp_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_timestamp_proto_rawdesc) diff --git a/ptypes/timestamp/timestamp.proto b/ptypes/timestamp/timestamp.proto index eafb3fa03a..eb1accdf63 100644 --- a/ptypes/timestamp/timestamp.proto +++ b/ptypes/timestamp/timestamp.proto @@ -1,135 +1,3 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option cc_enable_arenas = true; option go_package = "github.com/golang/protobuf/ptypes/timestamp"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "TimestampProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - -// A Timestamp represents a point in time independent of any time zone -// or calendar, represented as seconds and fractions of seconds at -// nanosecond resolution in UTC Epoch time. It is encoded using the -// Proleptic Gregorian Calendar which extends the Gregorian calendar -// backwards to year one. It is encoded assuming all minutes are 60 -// seconds long, i.e. leap seconds are "smeared" so that no leap second -// table is needed for interpretation. Range is from -// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. -// By restricting to that range, we ensure that we can convert to -// and from RFC 3339 date strings. -// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). -// -// # Examples -// -// Example 1: Compute Timestamp from POSIX `time()`. -// -// Timestamp timestamp; -// timestamp.set_seconds(time(NULL)); -// timestamp.set_nanos(0); -// -// Example 2: Compute Timestamp from POSIX `gettimeofday()`. -// -// struct timeval tv; -// gettimeofday(&tv, NULL); -// -// Timestamp timestamp; -// timestamp.set_seconds(tv.tv_sec); -// timestamp.set_nanos(tv.tv_usec * 1000); -// -// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. -// -// FILETIME ft; -// GetSystemTimeAsFileTime(&ft); -// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; -// -// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z -// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. -// Timestamp timestamp; -// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); -// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); -// -// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. -// -// long millis = System.currentTimeMillis(); -// -// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) -// .setNanos((int) ((millis % 1000) * 1000000)).build(); -// -// -// Example 5: Compute Timestamp from current time in Python. -// -// timestamp = Timestamp() -// timestamp.GetCurrentTime() -// -// # JSON Mapping -// -// In JSON format, the Timestamp type is encoded as a string in the -// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the -// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" -// where {year} is always expressed using four digits while {month}, {day}, -// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional -// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), -// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -// is required. A proto3 JSON serializer should always use UTC (as indicated by -// "Z") when printing the Timestamp type and a proto3 JSON parser should be -// able to accept both UTC and other timezones (as indicated by an offset). -// -// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past -// 01:30 UTC on January 15, 2017. -// -// In JavaScript, one can convert a Date object to this format using the -// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString] -// method. In Python, a standard `datetime.datetime` object can be converted -// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) -// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one -// can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime-- -// ) to obtain a formatter capable of generating timestamps in this format. -// -// -message Timestamp { - - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - int64 seconds = 1; - - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 - // inclusive. - int32 nanos = 2; -} +import public "google/protobuf/timestamp.proto"; diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index cbc44449f9..87282953a7 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -1,11 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/protobuf/wrappers.proto +// source: github.com/golang/protobuf/ptypes/wrappers/wrappers.proto package wrappers import ( proto "github.com/golang/protobuf/proto" protoapi "github.com/golang/protobuf/protoapi" + protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" + known "github.com/golang/protobuf/v2/types/known" ) // This is a compile-time assertion to ensure that this generated file @@ -14,458 +17,55 @@ import ( // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Wrapper message for `double`. -// -// The JSON representation for `DoubleValue` is JSON number. -type DoubleValue struct { - // The double value. - Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DoubleValue) Reset() { *m = DoubleValue{} } -func (m *DoubleValue) String() string { return proto.CompactTextString(m) } -func (*DoubleValue) ProtoMessage() {} -func (*DoubleValue) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{0} -} - -func (*DoubleValue) XXX_WellKnownType() string { return "DoubleValue" } - -func (m *DoubleValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DoubleValue.Unmarshal(m, b) -} -func (m *DoubleValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DoubleValue.Marshal(b, m, deterministic) -} -func (m *DoubleValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_DoubleValue.Merge(m, src) -} -func (m *DoubleValue) XXX_Size() int { - return xxx_messageInfo_DoubleValue.Size(m) -} -func (m *DoubleValue) XXX_DiscardUnknown() { - xxx_messageInfo_DoubleValue.DiscardUnknown(m) -} - -var xxx_messageInfo_DoubleValue proto.InternalMessageInfo - -func (m *DoubleValue) GetValue() float64 { - if m != nil { - return m.Value - } - return 0 -} - -// Wrapper message for `float`. -// -// The JSON representation for `FloatValue` is JSON number. -type FloatValue struct { - // The float value. - Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FloatValue) Reset() { *m = FloatValue{} } -func (m *FloatValue) String() string { return proto.CompactTextString(m) } -func (*FloatValue) ProtoMessage() {} -func (*FloatValue) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{1} -} - -func (*FloatValue) XXX_WellKnownType() string { return "FloatValue" } - -func (m *FloatValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FloatValue.Unmarshal(m, b) -} -func (m *FloatValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FloatValue.Marshal(b, m, deterministic) -} -func (m *FloatValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_FloatValue.Merge(m, src) -} -func (m *FloatValue) XXX_Size() int { - return xxx_messageInfo_FloatValue.Size(m) -} -func (m *FloatValue) XXX_DiscardUnknown() { - xxx_messageInfo_FloatValue.DiscardUnknown(m) -} - -var xxx_messageInfo_FloatValue proto.InternalMessageInfo - -func (m *FloatValue) GetValue() float32 { - if m != nil { - return m.Value - } - return 0 -} - -// Wrapper message for `int64`. -// -// The JSON representation for `Int64Value` is JSON string. -type Int64Value struct { - // The int64 value. - Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Int64Value) Reset() { *m = Int64Value{} } -func (m *Int64Value) String() string { return proto.CompactTextString(m) } -func (*Int64Value) ProtoMessage() {} -func (*Int64Value) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{2} -} +// Symbols defined in public import of google/protobuf/wrappers.proto -func (*Int64Value) XXX_WellKnownType() string { return "Int64Value" } +type DoubleValue = known.DoubleValue +type FloatValue = known.FloatValue +type Int64Value = known.Int64Value +type UInt64Value = known.UInt64Value +type Int32Value = known.Int32Value +type UInt32Value = known.UInt32Value +type BoolValue = known.BoolValue +type StringValue = known.StringValue +type BytesValue = known.BytesValue -func (m *Int64Value) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Int64Value.Unmarshal(m, b) -} -func (m *Int64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Int64Value.Marshal(b, m, deterministic) -} -func (m *Int64Value) XXX_Merge(src proto.Message) { - xxx_messageInfo_Int64Value.Merge(m, src) -} -func (m *Int64Value) XXX_Size() int { - return xxx_messageInfo_Int64Value.Size(m) -} -func (m *Int64Value) XXX_DiscardUnknown() { - xxx_messageInfo_Int64Value.DiscardUnknown(m) -} - -var xxx_messageInfo_Int64Value proto.InternalMessageInfo - -func (m *Int64Value) GetValue() int64 { - if m != nil { - return m.Value - } - return 0 -} - -// Wrapper message for `uint64`. -// -// The JSON representation for `UInt64Value` is JSON string. -type UInt64Value struct { - // The uint64 value. - Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UInt64Value) Reset() { *m = UInt64Value{} } -func (m *UInt64Value) String() string { return proto.CompactTextString(m) } -func (*UInt64Value) ProtoMessage() {} -func (*UInt64Value) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{3} -} - -func (*UInt64Value) XXX_WellKnownType() string { return "UInt64Value" } - -func (m *UInt64Value) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UInt64Value.Unmarshal(m, b) -} -func (m *UInt64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UInt64Value.Marshal(b, m, deterministic) -} -func (m *UInt64Value) XXX_Merge(src proto.Message) { - xxx_messageInfo_UInt64Value.Merge(m, src) -} -func (m *UInt64Value) XXX_Size() int { - return xxx_messageInfo_UInt64Value.Size(m) -} -func (m *UInt64Value) XXX_DiscardUnknown() { - xxx_messageInfo_UInt64Value.DiscardUnknown(m) -} - -var xxx_messageInfo_UInt64Value proto.InternalMessageInfo - -func (m *UInt64Value) GetValue() uint64 { - if m != nil { - return m.Value - } - return 0 -} - -// Wrapper message for `int32`. -// -// The JSON representation for `Int32Value` is JSON number. -type Int32Value struct { - // The int32 value. - Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Int32Value) Reset() { *m = Int32Value{} } -func (m *Int32Value) String() string { return proto.CompactTextString(m) } -func (*Int32Value) ProtoMessage() {} -func (*Int32Value) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{4} -} - -func (*Int32Value) XXX_WellKnownType() string { return "Int32Value" } - -func (m *Int32Value) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Int32Value.Unmarshal(m, b) -} -func (m *Int32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Int32Value.Marshal(b, m, deterministic) -} -func (m *Int32Value) XXX_Merge(src proto.Message) { - xxx_messageInfo_Int32Value.Merge(m, src) -} -func (m *Int32Value) XXX_Size() int { - return xxx_messageInfo_Int32Value.Size(m) -} -func (m *Int32Value) XXX_DiscardUnknown() { - xxx_messageInfo_Int32Value.DiscardUnknown(m) -} - -var xxx_messageInfo_Int32Value proto.InternalMessageInfo - -func (m *Int32Value) GetValue() int32 { - if m != nil { - return m.Value - } - return 0 -} - -// Wrapper message for `uint32`. -// -// The JSON representation for `UInt32Value` is JSON number. -type UInt32Value struct { - // The uint32 value. - Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UInt32Value) Reset() { *m = UInt32Value{} } -func (m *UInt32Value) String() string { return proto.CompactTextString(m) } -func (*UInt32Value) ProtoMessage() {} -func (*UInt32Value) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{5} -} - -func (*UInt32Value) XXX_WellKnownType() string { return "UInt32Value" } - -func (m *UInt32Value) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UInt32Value.Unmarshal(m, b) -} -func (m *UInt32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UInt32Value.Marshal(b, m, deterministic) -} -func (m *UInt32Value) XXX_Merge(src proto.Message) { - xxx_messageInfo_UInt32Value.Merge(m, src) -} -func (m *UInt32Value) XXX_Size() int { - return xxx_messageInfo_UInt32Value.Size(m) -} -func (m *UInt32Value) XXX_DiscardUnknown() { - xxx_messageInfo_UInt32Value.DiscardUnknown(m) -} - -var xxx_messageInfo_UInt32Value proto.InternalMessageInfo - -func (m *UInt32Value) GetValue() uint32 { - if m != nil { - return m.Value - } - return 0 -} - -// Wrapper message for `bool`. -// -// The JSON representation for `BoolValue` is JSON `true` and `false`. -type BoolValue struct { - // The bool value. - Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BoolValue) Reset() { *m = BoolValue{} } -func (m *BoolValue) String() string { return proto.CompactTextString(m) } -func (*BoolValue) ProtoMessage() {} -func (*BoolValue) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{6} -} - -func (*BoolValue) XXX_WellKnownType() string { return "BoolValue" } - -func (m *BoolValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BoolValue.Unmarshal(m, b) -} -func (m *BoolValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BoolValue.Marshal(b, m, deterministic) -} -func (m *BoolValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_BoolValue.Merge(m, src) -} -func (m *BoolValue) XXX_Size() int { - return xxx_messageInfo_BoolValue.Size(m) -} -func (m *BoolValue) XXX_DiscardUnknown() { - xxx_messageInfo_BoolValue.DiscardUnknown(m) -} - -var xxx_messageInfo_BoolValue proto.InternalMessageInfo - -func (m *BoolValue) GetValue() bool { - if m != nil { - return m.Value - } - return false -} - -// Wrapper message for `string`. -// -// The JSON representation for `StringValue` is JSON string. -type StringValue struct { - // The string value. - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StringValue) Reset() { *m = StringValue{} } -func (m *StringValue) String() string { return proto.CompactTextString(m) } -func (*StringValue) ProtoMessage() {} -func (*StringValue) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{7} -} - -func (*StringValue) XXX_WellKnownType() string { return "StringValue" } - -func (m *StringValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StringValue.Unmarshal(m, b) -} -func (m *StringValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StringValue.Marshal(b, m, deterministic) -} -func (m *StringValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_StringValue.Merge(m, src) -} -func (m *StringValue) XXX_Size() int { - return xxx_messageInfo_StringValue.Size(m) -} -func (m *StringValue) XXX_DiscardUnknown() { - xxx_messageInfo_StringValue.DiscardUnknown(m) -} - -var xxx_messageInfo_StringValue proto.InternalMessageInfo - -func (m *StringValue) GetValue() string { - if m != nil { - return m.Value - } - return "" +func init() { + proto.RegisterFile("github.com/golang/protobuf/ptypes/wrappers/wrappers.proto", xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc_gzipped) } -// Wrapper message for `bytes`. -// -// The JSON representation for `BytesValue` is JSON string. -type BytesValue struct { - // The bytes value. - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc = []byte{ + // 147 bytes of the wire-encoded FileDescriptorProto + 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2f, 0x77, 0x72, 0x61, + 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, + 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x2c, 0x5a, 0x2a, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } -func (m *BytesValue) Reset() { *m = BytesValue{} } -func (m *BytesValue) String() string { return proto.CompactTextString(m) } -func (*BytesValue) ProtoMessage() {} -func (*BytesValue) Descriptor() ([]byte, []int) { - return xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped, []int{8} -} +var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc) -func (*BytesValue) XXX_WellKnownType() string { return "BytesValue" } +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) -func (m *BytesValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BytesValue.Unmarshal(m, b) -} -func (m *BytesValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BytesValue.Marshal(b, m, deterministic) -} -func (m *BytesValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_BytesValue.Merge(m, src) -} -func (m *BytesValue) XXX_Size() int { - return xxx_messageInfo_BytesValue.Size(m) -} -func (m *BytesValue) XXX_DiscardUnknown() { - xxx_messageInfo_BytesValue.DiscardUnknown(m) -} +var File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto protoreflect.FileDescriptor -var xxx_messageInfo_BytesValue proto.InternalMessageInfo +var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = []interface{}{} +var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = []int32{} -func (m *BytesValue) GetValue() []byte { - if m != nil { - return m.Value +func init() { xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() } +func xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() { + if File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto != nil { + return } - return nil -} - -func init() { - proto.RegisterFile("google/protobuf/wrappers.proto", xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped) - proto.RegisterType((*DoubleValue)(nil), "google.protobuf.DoubleValue") - proto.RegisterType((*FloatValue)(nil), "google.protobuf.FloatValue") - proto.RegisterType((*Int64Value)(nil), "google.protobuf.Int64Value") - proto.RegisterType((*UInt64Value)(nil), "google.protobuf.UInt64Value") - proto.RegisterType((*Int32Value)(nil), "google.protobuf.Int32Value") - proto.RegisterType((*UInt32Value)(nil), "google.protobuf.UInt32Value") - proto.RegisterType((*BoolValue)(nil), "google.protobuf.BoolValue") - proto.RegisterType((*StringValue)(nil), "google.protobuf.StringValue") - proto.RegisterType((*BytesValue)(nil), "google.protobuf.BytesValue") + File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto = protoimpl.FileBuilder{ + RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc, + GoTypes: xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes, + DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs, + }.Init() + xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = nil + xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = nil } - -var xxx_File_google_protobuf_wrappers_proto_rawdesc = []byte{ - // 510 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x22, 0x23, 0x0a, 0x0b, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x02, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x49, 0x6e, - 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x23, - 0x0a, 0x0b, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x23, 0x0a, 0x0b, 0x55, 0x49, 0x6e, 0x74, 0x33, - 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x21, 0x0a, 0x09, - 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x23, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x7c, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, - 0x0d, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0xf8, 0x01, 0x01, 0xa2, - 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, - 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var xxx_File_google_protobuf_wrappers_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_google_protobuf_wrappers_proto_rawdesc) diff --git a/ptypes/wrappers/wrappers.proto b/ptypes/wrappers/wrappers.proto index 01947639ac..b977dfd55d 100644 --- a/ptypes/wrappers/wrappers.proto +++ b/ptypes/wrappers/wrappers.proto @@ -1,118 +1,3 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - -// Wrappers for primitive (non-message) types. These types are useful -// for embedding primitives in the `google.protobuf.Any` type and for places -// where we need to distinguish between the absence of a primitive -// typed field and its default value. - syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option cc_enable_arenas = true; option go_package = "github.com/golang/protobuf/ptypes/wrappers"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "WrappersProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - -// Wrapper message for `double`. -// -// The JSON representation for `DoubleValue` is JSON number. -message DoubleValue { - // The double value. - double value = 1; -} - -// Wrapper message for `float`. -// -// The JSON representation for `FloatValue` is JSON number. -message FloatValue { - // The float value. - float value = 1; -} - -// Wrapper message for `int64`. -// -// The JSON representation for `Int64Value` is JSON string. -message Int64Value { - // The int64 value. - int64 value = 1; -} - -// Wrapper message for `uint64`. -// -// The JSON representation for `UInt64Value` is JSON string. -message UInt64Value { - // The uint64 value. - uint64 value = 1; -} - -// Wrapper message for `int32`. -// -// The JSON representation for `Int32Value` is JSON number. -message Int32Value { - // The int32 value. - int32 value = 1; -} - -// Wrapper message for `uint32`. -// -// The JSON representation for `UInt32Value` is JSON number. -message UInt32Value { - // The uint32 value. - uint32 value = 1; -} - -// Wrapper message for `bool`. -// -// The JSON representation for `BoolValue` is JSON `true` and `false`. -message BoolValue { - // The bool value. - bool value = 1; -} - -// Wrapper message for `string`. -// -// The JSON representation for `StringValue` is JSON string. -message StringValue { - // The string value. - string value = 1; -} - -// Wrapper message for `bytes`. -// -// The JSON representation for `BytesValue` is JSON string. -message BytesValue { - // The bytes value. - bytes value = 1; -} +import public "google/protobuf/wrappers.proto"; diff --git a/regenerate.bash b/regenerate.bash new file mode 100755 index 0000000000..71f7cdd0b4 --- /dev/null +++ b/regenerate.bash @@ -0,0 +1,8 @@ +#!/bin/bash +# 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. + +cd "$(git rev-parse --show-toplevel)" +go test -v -mod=vendor -timeout=60m -count=1 integration_test.go "$@" -regenerate +exit $? diff --git a/regenerate.sh b/regenerate.sh deleted file mode 100755 index db0a0d661f..0000000000 --- a/regenerate.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -set -e - -# Install the working tree's protoc-gen-gen in a tempdir. -tmpdir=$(mktemp -d -t regen-wkt.XXXXXX) -trap 'rm -rf $tmpdir' EXIT -mkdir -p $tmpdir/bin -PATH=$tmpdir/bin:$PATH -GOBIN=$tmpdir/bin go install ./protoc-gen-go - -# Public imports require at least Go 1.9. -supportTypeAliases="" -if go list -f '{{context.ReleaseTags}}' runtime | grep -q go1.9; then - supportTypeAliases=1 -fi - -# Generate various test protos. -PROTO_DIRS=( - jsonpb/jsonpb_test_proto - proto - protoc-gen-go/testdata -) -for dir in ${PROTO_DIRS[@]}; do - for p in `find $dir -name "*.proto"`; do - if [[ $p == */import_public/* && ! $supportTypeAliases ]]; then - echo "# $p (skipped)" - continue; - fi - echo "# $p" - protoc -I$dir --go_out=plugins=grpc,paths=source_relative:$dir $p - done -done - -# Deriving the location of the source protos from the path to the -# protoc binary may be a bit odd, but this is what protoc itself does. -PROTO_INCLUDE=$(dirname $(dirname $(which protoc)))/include - -# Well-known types. -WKT_PROTOS=(any duration empty struct timestamp wrappers) -for p in ${WKT_PROTOS[@]}; do - echo "# google/protobuf/$p.proto" - protoc --go_out=paths=source_relative:$tmpdir google/protobuf/$p.proto - cp $tmpdir/google/protobuf/$p.pb.go ptypes/$p - cp $PROTO_INCLUDE/google/protobuf/$p.proto ptypes/$p -done - -# descriptor.proto. -echo "# google/protobuf/descriptor.proto" -protoc --go_out=paths=source_relative:$tmpdir google/protobuf/descriptor.proto -cp $tmpdir/google/protobuf/descriptor.pb.go protoc-gen-go/descriptor -cp $PROTO_INCLUDE/google/protobuf/descriptor.proto protoc-gen-go/descriptor diff --git a/test.bash b/test.bash index 718cc39870..b225be61ad 100755 --- a/test.bash +++ b/test.bash @@ -3,126 +3,6 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -function print() { echo -e "\x1b[1m> $@\x1b[0m"; } - -# The test directory contains the Go and protobuf toolchains used for testing. -# The bin directory contains symlinks to each tool by version. -# It is safe to delete this directory and run the test script from scratch. -TEST_DIR=$REPO_ROOT/.cache -mkdir -p $TEST_DIR/bin -function register_binary() { - rm -f $TEST_DIR/bin/$1 # best-effort delete - ln -s $TEST_DIR/$2 $TEST_DIR/bin/$1 -} -export PATH=$TEST_DIR/bin:$PATH -cd $TEST_DIR # install toolchains relative to test directory - -# Download and build the protobuf toolchain. -# We avoid downloading the pre-compiled binaries since they do not contain -# the conformance test runner. -PROTOBUF_VERSION=3.6.1 -PROTOBUF_DIR="protobuf-$PROTOBUF_VERSION" -if [ ! -d $PROTOBUF_DIR ]; then - print "download and build $PROTOBUF_DIR" - (curl -s -L https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/protobuf-all-$PROTOBUF_VERSION.tar.gz | tar -zxf -) || exit 1 - (cd $PROTOBUF_DIR && ./configure && make && cd conformance && make) || exit 1 -fi -register_binary conformance-test-runner $PROTOBUF_DIR/conformance/conformance-test-runner -register_binary protoc $PROTOBUF_DIR/src/protoc -# Allow protoc to find google/protobuf/*.proto. -rm -rf $PROTOBUF_DIR/src/include -mkdir -p $PROTOBUF_DIR/src/include -ln -s ../google $PROTOBUF_DIR/src/include/google - -# Download each Go toolchain version. -GO_LATEST=go1.11.2 -GO_VERSIONS=(go1.9.7 go1.10.5 $GO_LATEST) -for GO_VERSION in ${GO_VERSIONS[@]}; do - if [ ! -d $GO_VERSION ]; then - print "download $GO_VERSION" - GOOS=$(uname | tr '[:upper:]' '[:lower:]') - (mkdir $GO_VERSION && curl -s -L https://dl.google.com/go/$GO_VERSION.$GOOS-amd64.tar.gz | tar -zxf - -C $GO_VERSION --strip-components 1) || exit 1 - fi - register_binary $GO_VERSION $GO_VERSION/bin/go -done -register_binary go $GO_LATEST/bin/go -register_binary gofmt $GO_LATEST/bin/gofmt - -# Travis-CI sets GOROOT, which confuses later invocations of the Go toolchains. -# Explicitly clear GOROOT, so each toolchain uses their default GOROOT. -unset GOROOT - -# Setup GOPATH for pre-module support. -export GOPATH=$TEST_DIR/gopath -MODULE_PATH=$(cd $REPO_ROOT && go list -m -f "{{.Path}}") -rm -rf gopath/src # best-effort delete -mkdir -p gopath/src/$(dirname $MODULE_PATH) -(cd gopath/src/$(dirname $MODULE_PATH) && ln -s $REPO_ROOT $(basename $MODULE_PATH)) - -# Download dependencies using modules. -# For pre-module support, dump the dependencies in a vendor directory. -(cd $REPO_ROOT && go mod tidy && go mod vendor) || exit 1 - -# Run tests across every supported version of Go. -LABELS=() -PIDS=() -OUTS=() -function cleanup() { for OUT in ${OUTS[@]}; do rm $OUT; done; } -trap cleanup EXIT -for GO_VERSION in ${GO_VERSIONS[@]}; do - # Run the go command in a background process. - function go() { - # Use a per-version Go cache to work around bugs in Go build caching. - # See https://golang.org/issue/26883 - GO_CACHE="$TEST_DIR/cache.$GO_VERSION" - LABELS+=("$(echo "$GO_VERSION $@")") - OUT=$(mktemp) - (cd $GOPATH/src/$MODULE_PATH && GOCACHE=$GO_CACHE $GO_VERSION "$@" &> $OUT) & - PIDS+=($!) - OUTS+=($OUT) - } - - go build ./... - go test -race ./... - go test -race -tags purego ./... - go test -race -tags proto1_legacy ./... - - unset go # to avoid confusing later invocations of "go" -done - -# Wait for all processes to finish. -RET=0 -for I in ${!PIDS[@]}; do - print "${LABELS[$I]}" - if ! wait ${PIDS[$I]}; then - cat ${OUTS[$I]} # only output upon error - RET=1 - fi -done - -# Run commands that produce output when there is a failure. -function check() { - OUT=$(cd $REPO_ROOT && "$@" 2>&1) - if [ ! -z "$OUT" ]; then - print "$@" - echo "$OUT" - RET=1 - fi -} - -# Check for stale or unformatted source files. -check gofmt -d $(cd $REPO_ROOT && git ls-files '*.go') - -# Check for changed or untracked files. -check git diff --no-prefix HEAD -check git ls-files --others --exclude-standard - -# Print termination status. -if [ $RET -eq 0 ]; then - echo -e "\x1b[32;1mPASS\x1b[0m" -else - echo -e "\x1b[31;1mFAIL\x1b[0m" -fi -exit $RET +cd "$(git rev-parse --show-toplevel)" +go test -v -mod=vendor -timeout=60m -count=1 integration_test.go "$@" +exit $? From f9c5a9b06d1a20a3ff7bdf7656f218db3925d7ea Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 12 Mar 2019 19:48:32 -0700 Subject: [PATCH 041/133] .travis.yml: specify distribution Change-Id: I046ede4e1062553c5b4bb496b983c3f206f8485e Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167277 Reviewed-by: Joe Tsai --- .gitignore | 19 +------------------ .travis.yml | 1 + 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 3113235f96..5c986d1c57 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,3 @@ .cache vendor - -.DS_Store -*.[568ao] -*.ao -*.so -*.pyc -._* -.nfs.* -[568a].out -*~ -*.orig -core -_obj -_test -_testmain.go - -# Conformance test output and transient files. -conformance/failing_tests.txt +cmd/protoc-gen-go/protoc-gen-go diff --git a/.travis.yml b/.travis.yml index 0aec6a31bf..ae7591ac03 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +dist: xenial script: - ./test.bash cache: From 7c7c772857c15b033301c7c92d7358926f22d343 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 12 Mar 2019 20:28:02 -0700 Subject: [PATCH 042/133] protoc-gen-go/plugin: delete plugin.pb.golden Change-Id: If6cd752e92dfdac6f5a1d4baf4277982b238b675 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167278 Reviewed-by: Joe Tsai --- protoc-gen-go/plugin/plugin.pb.golden | 83 --------------------------- 1 file changed, 83 deletions(-) delete mode 100644 protoc-gen-go/plugin/plugin.pb.golden diff --git a/protoc-gen-go/plugin/plugin.pb.golden b/protoc-gen-go/plugin/plugin.pb.golden deleted file mode 100644 index 8953d0ff82..0000000000 --- a/protoc-gen-go/plugin/plugin.pb.golden +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by protoc-gen-go. -// source: google/protobuf/compiler/plugin.proto -// DO NOT EDIT! - -package google_protobuf_compiler - -import proto "github.com/golang/protobuf/proto" -import "math" -import google_protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor" - -// Reference proto and math imports to suppress error if they are not otherwise used. -var _ = proto.GetString -var _ = math.Inf - -type CodeGeneratorRequest struct { - FileToGenerate []string `protobuf:"bytes,1,rep,name=file_to_generate" json:"file_to_generate,omitempty"` - Parameter *string `protobuf:"bytes,2,opt,name=parameter" json:"parameter,omitempty"` - ProtoFile []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file" json:"proto_file,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (this *CodeGeneratorRequest) Reset() { *this = CodeGeneratorRequest{} } -func (this *CodeGeneratorRequest) String() string { return proto.CompactTextString(this) } -func (*CodeGeneratorRequest) ProtoMessage() {} - -func (this *CodeGeneratorRequest) GetParameter() string { - if this != nil && this.Parameter != nil { - return *this.Parameter - } - return "" -} - -type CodeGeneratorResponse struct { - Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` - File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (this *CodeGeneratorResponse) Reset() { *this = CodeGeneratorResponse{} } -func (this *CodeGeneratorResponse) String() string { return proto.CompactTextString(this) } -func (*CodeGeneratorResponse) ProtoMessage() {} - -func (this *CodeGeneratorResponse) GetError() string { - if this != nil && this.Error != nil { - return *this.Error - } - return "" -} - -type CodeGeneratorResponse_File struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - InsertionPoint *string `protobuf:"bytes,2,opt,name=insertion_point" json:"insertion_point,omitempty"` - Content *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (this *CodeGeneratorResponse_File) Reset() { *this = CodeGeneratorResponse_File{} } -func (this *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(this) } -func (*CodeGeneratorResponse_File) ProtoMessage() {} - -func (this *CodeGeneratorResponse_File) GetName() string { - if this != nil && this.Name != nil { - return *this.Name - } - return "" -} - -func (this *CodeGeneratorResponse_File) GetInsertionPoint() string { - if this != nil && this.InsertionPoint != nil { - return *this.InsertionPoint - } - return "" -} - -func (this *CodeGeneratorResponse_File) GetContent() string { - if this != nil && this.Content != nil { - return *this.Content - } - return "" -} - -func init() { -} From d3786a266248bfc63bd81d943ed4af6fb2f6b5c2 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 13 Mar 2019 03:38:35 -0700 Subject: [PATCH 043/133] protoc-gen-go/generator: print deprecation warning at init Change-Id: I1917b96cfc472963eaf63e2a2272e1832dd4ebb8 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167379 Reviewed-by: Damien Neil --- protoc-gen-go/generator/generator.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 03950d95b1..e711c2046d 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -38,6 +38,13 @@ import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" ) +func init() { + fmt.Fprint(os.Stderr, + "WARNING: Package github.com/golang/protobuf/protoc-gen-go/generator is deprecated.\n"+ + "\tA future release of golang/protobuf will delete this package,\n"+ + "\twhich has long been excluded from the compatibility promise.\n\n") +} + // generatedCodeVersion indicates a version of the generated code. // It is incremented whenever an incompatibility between the generated code and // proto package is introduced; the generated code references From 2c64b6c2af22330408ea1190a80288e304f13216 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 14 Mar 2019 17:11:15 -0700 Subject: [PATCH 044/133] internal/proto: implement SetDefaults with reflection We cannot start replacing the implementation of v1 directly with reflection since the scaffolding to avoid cyclic dependencies on descriptor proto is not yet complete. However, we can start re-writing functionality in a seperate package as if they were replacing the version in the proto package. For the time being, we just copy-paste the relevant tests in the proto package to ensure the behavior is the same in both implementations. Change-Id: Ibc9360edb4c8f43bbe60359b848bb2f998c22bf9 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167761 Reviewed-by: Herbie Ong --- internal/proto/common.go | 17 +++++++ internal/proto/defaults.go | 65 +++++++++++++++++++++++++++ proto/all_test.go | 90 ++++++++++++++++++++++++++++++++++++++ proto/proto3_test.go | 32 ++++++++++++++ 4 files changed, 204 insertions(+) create mode 100644 internal/proto/common.go create mode 100644 internal/proto/defaults.go diff --git a/internal/proto/common.go b/internal/proto/common.go new file mode 100644 index 0000000000..7258baedbe --- /dev/null +++ b/internal/proto/common.go @@ -0,0 +1,17 @@ +// 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 + +// TODO: This file exists to provide the illusion to other source files that +// they live within the real proto package by providing functions and types +// that they would otherwise be able to call directly. + +import ( + "github.com/golang/protobuf/proto" + + _ "github.com/golang/protobuf/v2/runtime/protolegacy" +) + +type Message = proto.Message diff --git a/internal/proto/defaults.go b/internal/proto/defaults.go new file mode 100644 index 0000000000..580d76252d --- /dev/null +++ b/internal/proto/defaults.go @@ -0,0 +1,65 @@ +// 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 ( + pref "github.com/golang/protobuf/v2/reflect/protoreflect" + "github.com/golang/protobuf/v2/runtime/protoimpl" +) + +// SetDefaults sets unset protocol buffer fields to their default values. +// It only modifies fields that are both unset and have defined defaults. +// It recursively sets default values in any non-nil sub-messages. +// It does not descend into extension fields that are sub-messages. +func SetDefaults(m Message) { + setDefaults(protoimpl.X.MessageOf(m)) +} + +func setDefaults(m pref.Message) { + fieldTypes := m.Type().Fields() + knownFields := m.KnownFields() + for i := 0; i < fieldTypes.Len(); i++ { + fd := fieldTypes.Get(i) + num := fd.Number() + if !knownFields.Has(num) { + if fd.HasDefault() { + v := fd.Default() + if fd.Kind() == pref.BytesKind { + v = pref.ValueOf(append([]byte(nil), v.Bytes()...)) // copy the default bytes + } + knownFields.Set(num, v) + } + continue + } + switch { + // Handle singular message. + case fd.Cardinality() != pref.Repeated: + if k := fd.Kind(); k == pref.MessageKind || k == pref.GroupKind { + setDefaults(knownFields.Get(num).Message()) + } + // Handle list of messages. + case !fd.IsMap(): + if k := fd.Kind(); k == pref.MessageKind || k == pref.GroupKind { + ls := knownFields.Get(num).List() + for i := 0; i < ls.Len(); i++ { + setDefaults(ls.Get(i).Message()) + } + } + // Handle map of messages. + default: + k := fd.MessageType().Fields().ByNumber(2).Kind() + if k == pref.MessageKind || k == pref.GroupKind { + ms := knownFields.Get(num).Map() + ms.Range(func(_ pref.MapKey, v pref.Value) bool { + setDefaults(v.Message()) + return true + }) + } + } + } + + // NOTE: Historically, this function has never set the defaults for + // extension fields, nor recursively visited sub-messages of such fields. +} diff --git a/proto/all_test.go b/proto/all_test.go index a16c05613d..abd3ce094f 100644 --- a/proto/all_test.go +++ b/proto/all_test.go @@ -18,6 +18,7 @@ import ( "testing" "time" + protoV1a "github.com/golang/protobuf/internal/proto" . "github.com/golang/protobuf/proto" pb3 "github.com/golang/protobuf/proto/proto3_proto" . "github.com/golang/protobuf/proto/test_proto" @@ -1371,6 +1372,38 @@ func TestAllSetDefaults(t *testing.T) { } } +func TestAllSetDefaults2(t *testing.T) { + // Exercise SetDefaults with all scalar field types. + m := &Defaults{ + // NaN != NaN, so override that here. + F_Nan: Float32(1.7), + } + expected := &Defaults{ + F_Bool: Bool(true), + F_Int32: Int32(32), + F_Int64: Int64(64), + F_Fixed32: Uint32(320), + F_Fixed64: Uint64(640), + F_Uint32: Uint32(3200), + F_Uint64: Uint64(6400), + F_Float: Float32(314159), + F_Double: Float64(271828), + F_String: String(`hello, "world!"` + "\n"), + F_Bytes: []byte("Bignose"), + F_Sint32: Int32(-32), + F_Sint64: Int64(-64), + F_Enum: Defaults_GREEN.Enum(), + F_Pinf: Float32(float32(math.Inf(1))), + F_Ninf: Float32(float32(math.Inf(-1))), + F_Nan: Float32(1.7), + StrZero: String(""), + } + protoV1a.SetDefaults(m) + if !Equal(m, expected) { + t.Errorf("SetDefaults failed\n got %v\nwant %v", m, expected) + } +} + func TestSetDefaultsWithSetField(t *testing.T) { // Check that a set value is not overridden. m := &Defaults{ @@ -1382,6 +1415,17 @@ func TestSetDefaultsWithSetField(t *testing.T) { } } +func TestSetDefaultsWithSetField2(t *testing.T) { + // Check that a set value is not overridden. + m := &Defaults{ + F_Int32: Int32(12), + } + protoV1a.SetDefaults(m) + if v := m.GetF_Int32(); v != 12 { + t.Errorf("m.FInt32 = %v, want 12", v) + } +} + func TestSetDefaultsWithSubMessage(t *testing.T) { m := &OtherMessage{ Key: Int64(123), @@ -1402,6 +1446,26 @@ func TestSetDefaultsWithSubMessage(t *testing.T) { } } +func TestSetDefaultsWithSubMessage2(t *testing.T) { + m := &OtherMessage{ + Key: Int64(123), + Inner: &InnerMessage{ + Host: String("gopher"), + }, + } + expected := &OtherMessage{ + Key: Int64(123), + Inner: &InnerMessage{ + Host: String("gopher"), + Port: Int32(4000), + }, + } + protoV1a.SetDefaults(m) + if !Equal(m, expected) { + t.Errorf("\n got %v\nwant %v", m, expected) + } +} + func TestSetDefaultsWithRepeatedSubMessage(t *testing.T) { m := &MyMessage{ RepInner: []*InnerMessage{{}}, @@ -1417,6 +1481,21 @@ func TestSetDefaultsWithRepeatedSubMessage(t *testing.T) { } } +func TestSetDefaultsWithRepeatedSubMessage2(t *testing.T) { + m := &MyMessage{ + RepInner: []*InnerMessage{{}}, + } + expected := &MyMessage{ + RepInner: []*InnerMessage{{ + Port: Int32(4000), + }}, + } + protoV1a.SetDefaults(m) + if !Equal(m, expected) { + t.Errorf("\n got %v\nwant %v", m, expected) + } +} + func TestSetDefaultWithRepeatedNonMessage(t *testing.T) { m := &MyMessage{ Pet: []string{"turtle", "wombat"}, @@ -1428,6 +1507,17 @@ func TestSetDefaultWithRepeatedNonMessage(t *testing.T) { } } +func TestSetDefaultWithRepeatedNonMessage2(t *testing.T) { + m := &MyMessage{ + Pet: []string{"turtle", "wombat"}, + } + expected := Clone(m) + protoV1a.SetDefaults(m) + if !Equal(m, expected) { + t.Errorf("\n got %v\nwant %v", m, expected) + } +} + func TestMaximumTagNumber(t *testing.T) { m := &MaxTag{ LastField: String("natural goat essence"), diff --git a/proto/proto3_test.go b/proto/proto3_test.go index 943ca20326..a09f0fb946 100644 --- a/proto/proto3_test.go +++ b/proto/proto3_test.go @@ -8,6 +8,7 @@ import ( "bytes" "testing" + protoV1a "github.com/golang/protobuf/internal/proto" "github.com/golang/protobuf/proto" pb "github.com/golang/protobuf/proto/proto3_proto" tpb "github.com/golang/protobuf/proto/test_proto" @@ -108,6 +109,37 @@ func TestProto3SetDefaults(t *testing.T) { } } +func TestProto3SetDefaults2(t *testing.T) { + in := &pb.Message{ + Terrain: map[string]*pb.Nested{ + "meadow": new(pb.Nested), + }, + Proto2Field: new(tpb.SubDefaults), + Proto2Value: map[string]*tpb.SubDefaults{ + "badlands": new(tpb.SubDefaults), + }, + } + + got := proto.Clone(in).(*pb.Message) + protoV1a.SetDefaults(got) + + // There are no defaults in proto3. Everything should be the zero value, but + // we need to remember to set defaults for nested proto2 messages. + want := &pb.Message{ + Terrain: map[string]*pb.Nested{ + "meadow": new(pb.Nested), + }, + Proto2Field: &tpb.SubDefaults{N: proto.Int64(7)}, + Proto2Value: map[string]*tpb.SubDefaults{ + "badlands": &tpb.SubDefaults{N: proto.Int64(7)}, + }, + } + + if !proto.Equal(got, want) { + t.Errorf("with in = %v\nproto.SetDefaults(in) =>\ngot %v\nwant %v", in, got, want) + } +} + func TestUnknownFieldPreservation(t *testing.T) { b1 := "\x0a\x05David" // Known tag 1 b2 := "\xc2\x0c\x06Google" // Unknown tag 200 From 2d5f4c3ffda0683501a888b6b6be885a04c84d0a Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 14 Mar 2019 17:50:41 -0700 Subject: [PATCH 045/133] internal/proto: implement DiscardUnknown with reflection Change-Id: Ida73c810353bde868bcd7cf2ea40098695695458 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167738 Reviewed-by: Herbie Ong --- internal/proto/discard.go | 76 +++++++++++++++++++++++++++++++++++++++ proto/all_test.go | 22 ++++++++++++ proto/discard_test.go | 39 ++++++++++++++------ 3 files changed, 126 insertions(+), 11 deletions(-) create mode 100644 internal/proto/discard.go diff --git a/internal/proto/discard.go b/internal/proto/discard.go new file mode 100644 index 0000000000..f995cad702 --- /dev/null +++ b/internal/proto/discard.go @@ -0,0 +1,76 @@ +// 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 ( + pref "github.com/golang/protobuf/v2/reflect/protoreflect" + "github.com/golang/protobuf/v2/runtime/protoimpl" +) + +// DiscardUnknown recursively discards all unknown fields from this message +// and all embedded messages. +// +// When unmarshaling a message with unrecognized fields, the tags and values +// of such fields are preserved in the Message. This allows a later call to +// 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 == nil { + return + } + discardUnknown(protoimpl.X.MessageOf(m)) +} + +func discardUnknown(m pref.Message) { + fieldTypes := m.Type().Fields() + knownFields := m.KnownFields() + knownFields.Range(func(num pref.FieldNumber, val pref.Value) bool { + fd := fieldTypes.ByNumber(num) + if fd == nil { + fd = knownFields.ExtensionTypes().ByNumber(num) + } + switch { + // Handle singular message. + case fd.Cardinality() != pref.Repeated: + if k := fd.Kind(); k == pref.MessageKind || k == pref.GroupKind { + discardUnknown(knownFields.Get(num).Message()) + } + // Handle list of messages. + case !fd.IsMap(): + if k := fd.Kind(); k == pref.MessageKind || k == pref.GroupKind { + ls := knownFields.Get(num).List() + for i := 0; i < ls.Len(); i++ { + discardUnknown(ls.Get(i).Message()) + } + } + // Handle map of messages. + default: + k := fd.MessageType().Fields().ByNumber(2).Kind() + if k == pref.MessageKind || k == pref.GroupKind { + ms := knownFields.Get(num).Map() + ms.Range(func(_ pref.MapKey, v pref.Value) bool { + discardUnknown(v.Message()) + return true + }) + } + } + return true + }) + + extRanges := m.Type().ExtensionRanges() + unknownFields := m.UnknownFields() + unknownFields.Range(func(num pref.FieldNumber, _ pref.RawFields) bool { + // NOTE: Historically, this function did not discard unknown fields + // that were within the extension field ranges. + if !extRanges.Has(num) { + unknownFields.Set(num, nil) + } + return true + }) +} diff --git a/proto/all_test.go b/proto/all_test.go index abd3ce094f..247101119f 100644 --- a/proto/all_test.go +++ b/proto/all_test.go @@ -1170,6 +1170,28 @@ func TestBadWireTypeUnknown(t *testing.T) { } } +func TestBadWireTypeUnknown2(t *testing.T) { + var b []byte + fmt.Sscanf("0a01780d00000000080b101612036161611521000000202c220362626225370000002203636363214200000000000000584d5a036464645900000000000056405d63000000", "%x", &b) + + m := new(MyMessage) + if err := Unmarshal(b, m); err != nil { + t.Errorf("unexpected Unmarshal error: %v", err) + } + + var unknown []byte + fmt.Sscanf("0a01780d0000000010161521000000202c2537000000214200000000000000584d5a036464645d63000000", "%x", &unknown) + if !bytes.Equal(m.XXX_unrecognized, unknown) { + t.Errorf("unknown bytes mismatch:\ngot %x\nwant %x", m.XXX_unrecognized, unknown) + } + protoV1a.DiscardUnknown(m) + + want := &MyMessage{Count: Int32(11), Name: String("aaa"), Pet: []string{"bbb", "ccc"}, Bigfloat: Float64(88)} + if !Equal(m, want) { + t.Errorf("message mismatch:\ngot %v\nwant %v", m, want) + } +} + func encodeDecode(t *testing.T, in, out Message, msg string) { buf, err := Marshal(in) if err != nil { diff --git a/proto/discard_test.go b/proto/discard_test.go index d2dd3aafb4..1f4b6eba9e 100644 --- a/proto/discard_test.go +++ b/proto/discard_test.go @@ -7,12 +7,15 @@ package proto_test import ( "testing" + protoV1a "github.com/golang/protobuf/internal/proto" "github.com/golang/protobuf/proto" proto3pb "github.com/golang/protobuf/proto/proto3_proto" pb "github.com/golang/protobuf/proto/test_proto" ) +const rawFields = "\x2d\xc3\xd2\xe1\xf0" + func TestDiscardUnknown(t *testing.T) { tests := []struct { desc string @@ -27,8 +30,8 @@ func TestDiscardUnknown(t *testing.T) { desc: "Nested", in: &proto3pb.Message{ Name: "Aaron", - Nested: &proto3pb.Nested{Cute: true, XXX_unrecognized: []byte("blah")}, - XXX_unrecognized: []byte("blah"), + Nested: &proto3pb.Nested{Cute: true, XXX_unrecognized: []byte(rawFields)}, + XXX_unrecognized: []byte(rawFields), }, want: &proto3pb.Message{ Name: "Aaron", @@ -39,10 +42,10 @@ func TestDiscardUnknown(t *testing.T) { in: &proto3pb.Message{ Name: "Aaron", Children: []*proto3pb.Message{ - {Name: "Sarah", XXX_unrecognized: []byte("blah")}, - {Name: "Abraham", XXX_unrecognized: []byte("blah")}, + {Name: "Sarah", XXX_unrecognized: []byte(rawFields)}, + {Name: "Abraham", XXX_unrecognized: []byte(rawFields)}, }, - XXX_unrecognized: []byte("blah"), + XXX_unrecognized: []byte(rawFields), }, want: &proto3pb.Message{ Name: "Aaron", @@ -56,9 +59,9 @@ func TestDiscardUnknown(t *testing.T) { in: &pb.Communique{ Union: &pb.Communique_Msg{&pb.Strings{ StringField: proto.String("123"), - XXX_unrecognized: []byte("blah"), + XXX_unrecognized: []byte(rawFields), }}, - XXX_unrecognized: []byte("blah"), + XXX_unrecognized: []byte(rawFields), }, want: &pb.Communique{ Union: &pb.Communique_Msg{&pb.Strings{StringField: proto.String("123")}}, @@ -68,7 +71,7 @@ func TestDiscardUnknown(t *testing.T) { in: &pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{ 0x4002: &pb.FloatingPoint{ Exact: proto.Bool(true), - XXX_unrecognized: []byte("blah"), + XXX_unrecognized: []byte(rawFields), }, }}, want: &pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{ @@ -81,13 +84,13 @@ func TestDiscardUnknown(t *testing.T) { Count: proto.Int32(42), Somegroup: &pb.MyMessage_SomeGroup{ GroupField: proto.Int32(6), - XXX_unrecognized: []byte("blah"), + XXX_unrecognized: []byte(rawFields), }, - XXX_unrecognized: []byte("blah"), + XXX_unrecognized: []byte(rawFields), } proto.SetExtension(m, pb.E_Ext_More, &pb.Ext{ Data: proto.String("extension"), - XXX_unrecognized: []byte("blah"), + XXX_unrecognized: []byte(rawFields), }) return m }(), @@ -101,6 +104,20 @@ func TestDiscardUnknown(t *testing.T) { }(), }} + // Test the reflection code path. + for _, tt := range tests { + // Clone the input so that we don't alter the original. + in := tt.in + if in != nil { + in = proto.Clone(tt.in) + } + + protoV1a.DiscardUnknown(tt.in) + if !proto.Equal(tt.in, tt.want) { + t.Errorf("test %s, expected unknown fields to be discarded\ngot %v\nwant %v", tt.desc, tt.in, tt.want) + } + } + // Test the legacy code path. for _, tt := range tests { // Clone the input so that we don't alter the original. From 2c2f4d6105f786fc56c1954ccf6a1e0e8ef7d147 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 13 Mar 2019 15:04:11 -0700 Subject: [PATCH 046/133] proto: remove some dead code Change-Id: Iee170bcc8b2f26c0d4fd2d0b2f839671d9d37576 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167460 Reviewed-by: Herbie Ong --- proto/properties.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/proto/properties.go b/proto/properties.go index 07e6d4221d..538137a9c1 100644 --- a/proto/properties.go +++ b/proto/properties.go @@ -18,8 +18,6 @@ import ( "sync" ) -const debug bool = false - // Constants that identify the encoding of a value on the wire. const ( WireVarint = 0 @@ -351,13 +349,6 @@ func getPropertiesLocked(t reflect.Type) *StructProperties { } prop.Prop[i] = p prop.order[i] = i - if debug { - print(i, " ", f.Name, " ", t.String(), " ") - if p.Tag > 0 { - print(p.String()) - } - print("\n") - } } // Re-order prop.order. From 7128c2e1180ffb130d4706075f1a16944c99d2e2 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 15 Mar 2019 09:53:14 -0700 Subject: [PATCH 047/133] proto: simplify the documentation The current docstring is unnecessarily complicated. Simply mention what the package is primarily for and then point users to a better written manual on using Go protobufs. Change-Id: I63d0580d1573ebfc1dc88b8bad326d7f1e030b88 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167765 Reviewed-by: Herbie Ong --- proto/lib.go | 235 +-------------------------------------------------- 1 file changed, 3 insertions(+), 232 deletions(-) diff --git a/proto/lib.go b/proto/lib.go index 51e88fd206..3106066c6d 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -2,238 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -/* -Package proto converts data structures to and from the wire format of -protocol buffers. It works in concert with the Go source code generated -for .proto files by the protocol compiler. - -A summary of the properties of the protocol buffer interface -for a protocol buffer variable v: - - - Names are turned from camel_case to CamelCase for export. - - There are no methods on v to set fields; just treat - them as structure fields. - - There are getters that return a field's value if set, - and return the field's default value if unset. - The getters work even if the receiver is a nil message. - - The zero value for a struct is its correct initialization state. - All desired fields must be set before marshaling. - - A Reset() method will restore a protobuf struct to its zero state. - - Non-repeated fields are pointers to the values; nil means unset. - That is, optional or required field int32 f becomes F *int32. - - Repeated fields are slices. - - Helper functions are available to aid the setting of fields. - msg.Foo = proto.String("hello") // set field - - Constants are defined to hold the default values of all fields that - have them. They have the form Default_StructName_FieldName. - Because the getter methods handle defaulted values, - direct use of these constants should be rare. - - Enums are given type names and maps from names to values. - Enum values are prefixed by the enclosing message's name, or by the - enum's type name if it is a top-level enum. Enum types have a String - method, and a Enum method to assist in message construction. - - Nested messages, groups and enums have type names prefixed with the name of - the surrounding message type. - - Extensions are given descriptor names that start with E_, - followed by an underscore-delimited list of the nested messages - that contain it (if any) followed by the CamelCased name of the - extension field itself. HasExtension, ClearExtension, GetExtension - and SetExtension are functions for manipulating extensions. - - Oneof field sets are given a single field in their message, - with distinguished wrapper types for each possible field value. - - Marshal and Unmarshal are functions to encode and decode the wire format. - -When the .proto file specifies `syntax="proto3"`, there are some differences: - - - Non-repeated fields of non-message type are values instead of pointers. - - Enum types do not get an Enum method. - -The simplest way to describe this is to see an example. -Given file test.proto, containing - - package example; - - enum FOO { X = 17; } - - message Test { - required string label = 1; - optional int32 type = 2 [default=77]; - repeated int64 reps = 3; - optional group OptionalGroup = 4 { - required string RequiredField = 5; - } - oneof union { - int32 number = 6; - string name = 7; - } - } - -The resulting file, test.pb.go, is: - - package example - - import proto "github.com/golang/protobuf/proto" - import math "math" - - type FOO int32 - const ( - FOO_X FOO = 17 - ) - var FOO_name = map[int32]string{ - 17: "X", - } - var FOO_value = map[string]int32{ - "X": 17, - } - - func (x FOO) Enum() *FOO { - p := new(FOO) - *p = x - return p - } - func (x FOO) String() string { - return proto.EnumName(FOO_name, int32(x)) - } - func (x *FOO) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FOO_value, data) - if err != nil { - return err - } - *x = FOO(value) - return nil - } - - type Test struct { - Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"` - Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"` - Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"` - Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"` - // Types that are valid to be assigned to Union: - // *Test_Number - // *Test_Name - Union isTest_Union `protobuf_oneof:"union"` - XXX_unrecognized []byte `json:"-"` - } - func (m *Test) Reset() { *m = Test{} } - func (m *Test) String() string { return proto.CompactTextString(m) } - func (*Test) ProtoMessage() {} - - type isTest_Union interface { - isTest_Union() - } - - type Test_Number struct { - Number int32 `protobuf:"varint,6,opt,name=number"` - } - type Test_Name struct { - Name string `protobuf:"bytes,7,opt,name=name"` - } - - func (*Test_Number) isTest_Union() {} - func (*Test_Name) isTest_Union() {} - - func (m *Test) GetUnion() isTest_Union { - if m != nil { - return m.Union - } - return nil - } - const Default_Test_Type int32 = 77 - - func (m *Test) GetLabel() string { - if m != nil && m.Label != nil { - return *m.Label - } - return "" - } - - func (m *Test) GetType() int32 { - if m != nil && m.Type != nil { - return *m.Type - } - return Default_Test_Type - } - - func (m *Test) GetOptionalgroup() *Test_OptionalGroup { - if m != nil { - return m.Optionalgroup - } - return nil - } - - type Test_OptionalGroup struct { - RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"` - } - func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} } - func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) } - - func (m *Test_OptionalGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" - } - - func (m *Test) GetNumber() int32 { - if x, ok := m.GetUnion().(*Test_Number); ok { - return x.Number - } - return 0 - } - - func (m *Test) GetName() string { - if x, ok := m.GetUnion().(*Test_Name); ok { - return x.Name - } - return "" - } - - func init() { - proto.RegisterEnum("example.FOO", FOO_name, FOO_value) - } - -To create and play with a Test object: - - package main - - import ( - "log" - - "github.com/golang/protobuf/proto" - pb "./example.pb" - ) - - func main() { - test := &pb.Test{ - Label: proto.String("hello"), - Type: proto.Int32(17), - Reps: []int64{1, 2, 3}, - Optionalgroup: &pb.Test_OptionalGroup{ - RequiredField: proto.String("good bye"), - }, - Union: &pb.Test_Name{"fred"}, - } - data, err := proto.Marshal(test) - if err != nil { - log.Fatal("marshaling error: ", err) - } - newTest := &pb.Test{} - err = proto.Unmarshal(data, newTest) - if err != nil { - log.Fatal("unmarshaling error: ", err) - } - // Now test and newTest contain the same data. - if test.GetLabel() != newTest.GetLabel() { - log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel()) - } - // Use a type switch to determine which oneof was set. - switch u := test.Union.(type) { - case *pb.Test_Number: // u.Number contains the number. - case *pb.Test_Name: // u.Name contains the string. - } - // etc. - } -*/ +// Package proto marshals and unmarshals protocol buffer messages as the +// wire-format and text-format. For more information, see: +// https://developers.google.com/protocol-buffers/docs/gotutorial package proto import ( From 59febcf6dd09e669ab0588b25cd2e608c3d57054 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 15 Mar 2019 12:00:28 -0700 Subject: [PATCH 048/133] proto: add hooks.go to switch-over to the new implementation Using the proto_reimpl build tag, we can control whether we go through the current logic or the re-implemented logic. This allows us to re-use all of the current tests with little to no modification to test the new implementation. Change-Id: I6d6beec05b859014f63193bf2c7530afa49eccd4 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167767 Reviewed-by: Herbie Ong --- integration_test.go | 1 + internal/proto/common.go | 4 +- proto/all_test.go | 112 --------------------------------------- proto/discard.go | 7 +++ proto/discard_test.go | 48 ----------------- proto/hooks.go | 14 +++++ proto/lib.go | 6 +++ proto/proto3_test.go | 32 ----------- 8 files changed, 30 insertions(+), 194 deletions(-) create mode 100644 proto/hooks.go diff --git a/integration_test.go b/integration_test.go index f8fcadda3e..ba6d3ceb84 100644 --- a/integration_test.go +++ b/integration_test.go @@ -64,6 +64,7 @@ func Test(t *testing.T) { workDir := filepath.Join(goPath, "src", modulePath) runGo("Build", workDir, "go", "build", "./...") runGo("TestNormal", workDir, "go", "test", "-race", "./...") + runGo("TestReimpl", workDir, "go", "test", "-race", "-tags", "proto_reimpl", "./...") }) } diff --git a/internal/proto/common.go b/internal/proto/common.go index 7258baedbe..f8ec49617f 100644 --- a/internal/proto/common.go +++ b/internal/proto/common.go @@ -9,9 +9,9 @@ package proto // that they would otherwise be able to call directly. import ( - "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/protoapi" _ "github.com/golang/protobuf/v2/runtime/protolegacy" ) -type Message = proto.Message +type Message = protoapi.Message diff --git a/proto/all_test.go b/proto/all_test.go index 247101119f..a16c05613d 100644 --- a/proto/all_test.go +++ b/proto/all_test.go @@ -18,7 +18,6 @@ import ( "testing" "time" - protoV1a "github.com/golang/protobuf/internal/proto" . "github.com/golang/protobuf/proto" pb3 "github.com/golang/protobuf/proto/proto3_proto" . "github.com/golang/protobuf/proto/test_proto" @@ -1170,28 +1169,6 @@ func TestBadWireTypeUnknown(t *testing.T) { } } -func TestBadWireTypeUnknown2(t *testing.T) { - var b []byte - fmt.Sscanf("0a01780d00000000080b101612036161611521000000202c220362626225370000002203636363214200000000000000584d5a036464645900000000000056405d63000000", "%x", &b) - - m := new(MyMessage) - if err := Unmarshal(b, m); err != nil { - t.Errorf("unexpected Unmarshal error: %v", err) - } - - var unknown []byte - fmt.Sscanf("0a01780d0000000010161521000000202c2537000000214200000000000000584d5a036464645d63000000", "%x", &unknown) - if !bytes.Equal(m.XXX_unrecognized, unknown) { - t.Errorf("unknown bytes mismatch:\ngot %x\nwant %x", m.XXX_unrecognized, unknown) - } - protoV1a.DiscardUnknown(m) - - want := &MyMessage{Count: Int32(11), Name: String("aaa"), Pet: []string{"bbb", "ccc"}, Bigfloat: Float64(88)} - if !Equal(m, want) { - t.Errorf("message mismatch:\ngot %v\nwant %v", m, want) - } -} - func encodeDecode(t *testing.T, in, out Message, msg string) { buf, err := Marshal(in) if err != nil { @@ -1394,38 +1371,6 @@ func TestAllSetDefaults(t *testing.T) { } } -func TestAllSetDefaults2(t *testing.T) { - // Exercise SetDefaults with all scalar field types. - m := &Defaults{ - // NaN != NaN, so override that here. - F_Nan: Float32(1.7), - } - expected := &Defaults{ - F_Bool: Bool(true), - F_Int32: Int32(32), - F_Int64: Int64(64), - F_Fixed32: Uint32(320), - F_Fixed64: Uint64(640), - F_Uint32: Uint32(3200), - F_Uint64: Uint64(6400), - F_Float: Float32(314159), - F_Double: Float64(271828), - F_String: String(`hello, "world!"` + "\n"), - F_Bytes: []byte("Bignose"), - F_Sint32: Int32(-32), - F_Sint64: Int64(-64), - F_Enum: Defaults_GREEN.Enum(), - F_Pinf: Float32(float32(math.Inf(1))), - F_Ninf: Float32(float32(math.Inf(-1))), - F_Nan: Float32(1.7), - StrZero: String(""), - } - protoV1a.SetDefaults(m) - if !Equal(m, expected) { - t.Errorf("SetDefaults failed\n got %v\nwant %v", m, expected) - } -} - func TestSetDefaultsWithSetField(t *testing.T) { // Check that a set value is not overridden. m := &Defaults{ @@ -1437,17 +1382,6 @@ func TestSetDefaultsWithSetField(t *testing.T) { } } -func TestSetDefaultsWithSetField2(t *testing.T) { - // Check that a set value is not overridden. - m := &Defaults{ - F_Int32: Int32(12), - } - protoV1a.SetDefaults(m) - if v := m.GetF_Int32(); v != 12 { - t.Errorf("m.FInt32 = %v, want 12", v) - } -} - func TestSetDefaultsWithSubMessage(t *testing.T) { m := &OtherMessage{ Key: Int64(123), @@ -1468,26 +1402,6 @@ func TestSetDefaultsWithSubMessage(t *testing.T) { } } -func TestSetDefaultsWithSubMessage2(t *testing.T) { - m := &OtherMessage{ - Key: Int64(123), - Inner: &InnerMessage{ - Host: String("gopher"), - }, - } - expected := &OtherMessage{ - Key: Int64(123), - Inner: &InnerMessage{ - Host: String("gopher"), - Port: Int32(4000), - }, - } - protoV1a.SetDefaults(m) - if !Equal(m, expected) { - t.Errorf("\n got %v\nwant %v", m, expected) - } -} - func TestSetDefaultsWithRepeatedSubMessage(t *testing.T) { m := &MyMessage{ RepInner: []*InnerMessage{{}}, @@ -1503,21 +1417,6 @@ func TestSetDefaultsWithRepeatedSubMessage(t *testing.T) { } } -func TestSetDefaultsWithRepeatedSubMessage2(t *testing.T) { - m := &MyMessage{ - RepInner: []*InnerMessage{{}}, - } - expected := &MyMessage{ - RepInner: []*InnerMessage{{ - Port: Int32(4000), - }}, - } - protoV1a.SetDefaults(m) - if !Equal(m, expected) { - t.Errorf("\n got %v\nwant %v", m, expected) - } -} - func TestSetDefaultWithRepeatedNonMessage(t *testing.T) { m := &MyMessage{ Pet: []string{"turtle", "wombat"}, @@ -1529,17 +1428,6 @@ func TestSetDefaultWithRepeatedNonMessage(t *testing.T) { } } -func TestSetDefaultWithRepeatedNonMessage2(t *testing.T) { - m := &MyMessage{ - Pet: []string{"turtle", "wombat"}, - } - expected := Clone(m) - protoV1a.SetDefaults(m) - if !Equal(m, expected) { - t.Errorf("\n got %v\nwant %v", m, expected) - } -} - func TestMaximumTagNumber(t *testing.T) { m := &MaxTag{ LastField: String("natural goat essence"), diff --git a/proto/discard.go b/proto/discard.go index c850e0905b..fe5a1409b5 100644 --- a/proto/discard.go +++ b/proto/discard.go @@ -18,6 +18,8 @@ type generatedDiscarder interface { XXX_DiscardUnknown() } +var discardUnknownAlt func(Message) // populated by hooks.go + // DiscardUnknown recursively discards all unknown fields from this message // and all embedded messages. // @@ -30,6 +32,11 @@ type generatedDiscarder interface { // 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 discardUnknownAlt != nil { + discardUnknownAlt(m) + return + } + if m, ok := m.(generatedDiscarder); ok { m.XXX_DiscardUnknown() return diff --git a/proto/discard_test.go b/proto/discard_test.go index 1f4b6eba9e..1c9dab94cd 100644 --- a/proto/discard_test.go +++ b/proto/discard_test.go @@ -7,7 +7,6 @@ package proto_test import ( "testing" - protoV1a "github.com/golang/protobuf/internal/proto" "github.com/golang/protobuf/proto" proto3pb "github.com/golang/protobuf/proto/proto3_proto" @@ -104,39 +103,6 @@ func TestDiscardUnknown(t *testing.T) { }(), }} - // Test the reflection code path. - for _, tt := range tests { - // Clone the input so that we don't alter the original. - in := tt.in - if in != nil { - in = proto.Clone(tt.in) - } - - protoV1a.DiscardUnknown(tt.in) - if !proto.Equal(tt.in, tt.want) { - t.Errorf("test %s, expected unknown fields to be discarded\ngot %v\nwant %v", tt.desc, tt.in, tt.want) - } - } - - // Test the legacy code path. - for _, tt := range tests { - // Clone the input so that we don't alter the original. - in := tt.in - if in != nil { - in = proto.Clone(tt.in) - } - - var m LegacyMessage - m.Message, _ = in.(*proto3pb.Message) - m.Communique, _ = in.(*pb.Communique) - m.MessageWithMap, _ = in.(*pb.MessageWithMap) - m.MyMessage, _ = in.(*pb.MyMessage) - proto.DiscardUnknown(&m) - if !proto.Equal(in, tt.want) { - t.Errorf("test %s/Legacy, expected unknown fields to be discarded\ngot %v\nwant %v", tt.desc, in, tt.want) - } - } - for _, tt := range tests { proto.DiscardUnknown(tt.in) if !proto.Equal(tt.in, tt.want) { @@ -144,17 +110,3 @@ func TestDiscardUnknown(t *testing.T) { } } } - -// LegacyMessage is a proto.Message that has several nested messages. -// This does not have the XXX_DiscardUnknown method and so forces DiscardUnknown -// to use the legacy fallback logic. -type LegacyMessage struct { - Message *proto3pb.Message - Communique *pb.Communique - MessageWithMap *pb.MessageWithMap - MyMessage *pb.MyMessage -} - -func (m *LegacyMessage) Reset() { *m = LegacyMessage{} } -func (m *LegacyMessage) String() string { return proto.CompactTextString(m) } -func (*LegacyMessage) ProtoMessage() {} diff --git a/proto/hooks.go b/proto/hooks.go new file mode 100644 index 0000000000..cd4da7d205 --- /dev/null +++ b/proto/hooks.go @@ -0,0 +1,14 @@ +// 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. + +// +build proto_reimpl + +package proto + +import "github.com/golang/protobuf/internal/proto" + +func init() { + setDefaultsAlt = proto.SetDefaults + discardUnknownAlt = proto.DiscardUnknown +} diff --git a/proto/lib.go b/proto/lib.go index 3106066c6d..a35f5dbbd3 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -309,10 +309,16 @@ out: p.index = index } +var setDefaultsAlt func(Message) // populated by hooks.go + // SetDefaults sets unset protocol buffer fields to their default values. // It only modifies fields that are both unset and have defined defaults. // It recursively sets default values in any non-nil sub-messages. func SetDefaults(pb Message) { + if setDefaultsAlt != nil { + setDefaultsAlt(pb) + return + } setDefaults(reflect.ValueOf(pb), true, false) } diff --git a/proto/proto3_test.go b/proto/proto3_test.go index a09f0fb946..943ca20326 100644 --- a/proto/proto3_test.go +++ b/proto/proto3_test.go @@ -8,7 +8,6 @@ import ( "bytes" "testing" - protoV1a "github.com/golang/protobuf/internal/proto" "github.com/golang/protobuf/proto" pb "github.com/golang/protobuf/proto/proto3_proto" tpb "github.com/golang/protobuf/proto/test_proto" @@ -109,37 +108,6 @@ func TestProto3SetDefaults(t *testing.T) { } } -func TestProto3SetDefaults2(t *testing.T) { - in := &pb.Message{ - Terrain: map[string]*pb.Nested{ - "meadow": new(pb.Nested), - }, - Proto2Field: new(tpb.SubDefaults), - Proto2Value: map[string]*tpb.SubDefaults{ - "badlands": new(tpb.SubDefaults), - }, - } - - got := proto.Clone(in).(*pb.Message) - protoV1a.SetDefaults(got) - - // There are no defaults in proto3. Everything should be the zero value, but - // we need to remember to set defaults for nested proto2 messages. - want := &pb.Message{ - Terrain: map[string]*pb.Nested{ - "meadow": new(pb.Nested), - }, - Proto2Field: &tpb.SubDefaults{N: proto.Int64(7)}, - Proto2Value: map[string]*tpb.SubDefaults{ - "badlands": &tpb.SubDefaults{N: proto.Int64(7)}, - }, - } - - if !proto.Equal(got, want) { - t.Errorf("with in = %v\nproto.SetDefaults(in) =>\ngot %v\nwant %v", in, got, want) - } -} - func TestUnknownFieldPreservation(t *testing.T) { b1 := "\x0a\x05David" // Known tag 1 b2 := "\xc2\x0c\x06Google" // Unknown tag 200 From 3360b7d83946f6b67d7ac0c47416fdd6876b7e6a Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 15 Mar 2019 12:35:34 -0700 Subject: [PATCH 049/133] all: regenerate test protos using v1.3.1 It turns out that we actually should not update these files precisely because we should be testing the legacy code paths that occur before the addition of the v2 reflection APIs. These were generated with protoc v3.6.1 and protoc-gen-go v1.3.1 Change-Id: I10cb335abb9b5aa930b34d5df82faf4c4e03a1ad Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167768 Reviewed-by: Herbie Ong --- internal/cmd/generate-protos/main.go | 27 +- .../jsonpb_test_proto/more_test_objects.pb.go | 255 +- jsonpb/jsonpb_test_proto/test_objects.pb.go | 617 +--- proto/proto3_proto/proto3.pb.go | 322 +- proto/test_proto/test.pb.go | 3268 +++++------------ 5 files changed, 1331 insertions(+), 3158 deletions(-) diff --git a/internal/cmd/generate-protos/main.go b/internal/cmd/generate-protos/main.go index 1ae8ebd202..8db856c710 100644 --- a/internal/cmd/generate-protos/main.go +++ b/internal/cmd/generate-protos/main.go @@ -73,11 +73,8 @@ func generateLocalProtos() { // Generate all local proto files. dirs := []struct { - path string - relative bool + path string }{ - {path: "jsonpb", relative: true}, - {path: "proto", relative: true}, {path: "protoc-gen-go"}, {path: "ptypes"}, } @@ -88,23 +85,15 @@ func generateLocalProtos() { return nil } - var impPath, relPath string - if d.relative { - impPath = srcDir + impPath := tmpDir - relPath, err = filepath.Rel(srcDir, srcPath) - check(err) - } else { - impPath = tmpDir - - relPath, err = filepath.Rel(repoRoot, srcPath) - check(err) - relPath = filepath.Join(filepath.FromSlash(modulePath), relPath) + relPath, err := filepath.Rel(repoRoot, srcPath) + check(err) + relPath = filepath.Join(filepath.FromSlash(modulePath), relPath) - dstDir := filepath.Join(tmpDir, filepath.Dir(relPath)) - check(os.MkdirAll(dstDir, 0775)) - check(os.Link(srcPath, filepath.Join(tmpDir, relPath))) - } + dstDir := filepath.Join(tmpDir, filepath.Dir(relPath)) + check(os.MkdirAll(dstDir, 0775)) + check(os.Link(srcPath, filepath.Join(tmpDir, relPath))) protoc("-I"+filepath.Join(protoRoot, "src"), "-I"+impPath, "--go_out="+tmpDir, relPath) return nil diff --git a/jsonpb/jsonpb_test_proto/more_test_objects.pb.go b/jsonpb/jsonpb_test_proto/more_test_objects.pb.go index 837afc3f6c..bfc473bcf2 100644 --- a/jsonpb/jsonpb_test_proto/more_test_objects.pb.go +++ b/jsonpb/jsonpb_test_proto/more_test_objects.pb.go @@ -4,13 +4,16 @@ package jsonpb import ( + fmt "fmt" proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" - protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" - protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" - reflect "reflect" + math "math" ) +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -25,13 +28,6 @@ const ( Numeral_ROMAN Numeral = 2 ) -func (e Numeral) Type() protoreflect.EnumType { - return xxx_File_jsonpb_test_proto_more_test_objects_proto_enumTypes[0] -} -func (e Numeral) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - var Numeral_name = map[int32]string{ 0: "UNKNOWN", 1: "ARABIC", @@ -49,7 +45,7 @@ func (x Numeral) String() string { } func (Numeral) EnumDescriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped, []int{0} + return fileDescriptor_59defc22c5ce96e7, []int{0} } type Simple3 struct { @@ -59,14 +55,11 @@ type Simple3 struct { XXX_sizecache int32 `json:"-"` } -func (m *Simple3) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[0].MessageOf(m) -} func (m *Simple3) Reset() { *m = Simple3{} } func (m *Simple3) String() string { return proto.CompactTextString(m) } func (*Simple3) ProtoMessage() {} func (*Simple3) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped, []int{0} + return fileDescriptor_59defc22c5ce96e7, []int{0} } func (m *Simple3) XXX_Unmarshal(b []byte) error { @@ -101,14 +94,11 @@ type SimpleSlice3 struct { XXX_sizecache int32 `json:"-"` } -func (m *SimpleSlice3) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[1].MessageOf(m) -} func (m *SimpleSlice3) Reset() { *m = SimpleSlice3{} } func (m *SimpleSlice3) String() string { return proto.CompactTextString(m) } func (*SimpleSlice3) ProtoMessage() {} func (*SimpleSlice3) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped, []int{1} + return fileDescriptor_59defc22c5ce96e7, []int{1} } func (m *SimpleSlice3) XXX_Unmarshal(b []byte) error { @@ -143,14 +133,11 @@ type SimpleMap3 struct { XXX_sizecache int32 `json:"-"` } -func (m *SimpleMap3) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[2].MessageOf(m) -} func (m *SimpleMap3) Reset() { *m = SimpleMap3{} } func (m *SimpleMap3) String() string { return proto.CompactTextString(m) } func (*SimpleMap3) ProtoMessage() {} func (*SimpleMap3) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped, []int{2} + return fileDescriptor_59defc22c5ce96e7, []int{2} } func (m *SimpleMap3) XXX_Unmarshal(b []byte) error { @@ -185,14 +172,11 @@ type SimpleNull3 struct { XXX_sizecache int32 `json:"-"` } -func (m *SimpleNull3) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[3].MessageOf(m) -} func (m *SimpleNull3) Reset() { *m = SimpleNull3{} } func (m *SimpleNull3) String() string { return proto.CompactTextString(m) } func (*SimpleNull3) ProtoMessage() {} func (*SimpleNull3) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped, []int{3} + return fileDescriptor_59defc22c5ce96e7, []int{3} } func (m *SimpleNull3) XXX_Unmarshal(b []byte) error { @@ -236,14 +220,11 @@ type Mappy struct { XXX_sizecache int32 `json:"-"` } -func (m *Mappy) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[4].MessageOf(m) -} func (m *Mappy) Reset() { *m = Mappy{} } func (m *Mappy) String() string { return proto.CompactTextString(m) } func (*Mappy) ProtoMessage() {} func (*Mappy) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped, []int{4} + return fileDescriptor_59defc22c5ce96e7, []int{4} } func (m *Mappy) XXX_Unmarshal(b []byte) error { @@ -335,7 +316,6 @@ func (m *Mappy) GetU64Booly() map[uint64]bool { } func init() { - proto.RegisterFile("jsonpb_test_proto/more_test_objects.proto", xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped) proto.RegisterEnum("jsonpb.Numeral", Numeral_name, Numeral_value) proto.RegisterType((*Simple3)(nil), "jsonpb.Simple3") proto.RegisterType((*SimpleSlice3)(nil), "jsonpb.SimpleSlice3") @@ -355,171 +335,46 @@ func init() { proto.RegisterMapType((map[uint64]bool)(nil), "jsonpb.Mappy.U64boolyEntry") } -var xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc = []byte{ - // 1579 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x29, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x6f, 0x72, 0x65, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6a, 0x73, 0x6f, - 0x6e, 0x70, 0x62, 0x22, 0x1b, 0x0a, 0x07, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x33, 0x12, 0x10, - 0x0a, 0x03, 0x64, 0x75, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x64, 0x75, 0x62, - 0x22, 0x26, 0x0a, 0x0c, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x33, - 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x06, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x73, 0x22, 0x83, 0x01, 0x0a, 0x0a, 0x53, 0x69, 0x6d, - 0x70, 0x6c, 0x65, 0x4d, 0x61, 0x70, 0x33, 0x12, 0x39, 0x0a, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, - 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x61, 0x70, 0x33, 0x2e, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x79, 0x1a, 0x3a, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x79, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x36, - 0x0a, 0x0b, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4e, 0x75, 0x6c, 0x6c, 0x33, 0x12, 0x27, 0x0a, - 0x06, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x33, 0x52, 0x06, - 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x22, 0xfd, 0x08, 0x0a, 0x05, 0x4d, 0x61, 0x70, 0x70, 0x79, - 0x12, 0x2e, 0x0a, 0x05, 0x6e, 0x75, 0x6d, 0x6d, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x4e, - 0x75, 0x6d, 0x6d, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6e, 0x75, 0x6d, 0x6d, 0x79, - 0x12, 0x2e, 0x0a, 0x05, 0x73, 0x74, 0x72, 0x72, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x53, - 0x74, 0x72, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x73, 0x74, 0x72, 0x72, 0x79, - 0x12, 0x2e, 0x0a, 0x05, 0x6f, 0x62, 0x6a, 0x6a, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x4f, - 0x62, 0x6a, 0x6a, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6f, 0x62, 0x6a, 0x6a, 0x79, - 0x12, 0x2e, 0x0a, 0x05, 0x62, 0x75, 0x67, 0x67, 0x79, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x42, - 0x75, 0x67, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x62, 0x75, 0x67, 0x67, 0x79, - 0x12, 0x2e, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x42, - 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x79, - 0x12, 0x2e, 0x0a, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x79, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x45, - 0x6e, 0x75, 0x6d, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x79, - 0x12, 0x37, 0x0a, 0x08, 0x73, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x07, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, - 0x79, 0x2e, 0x53, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x08, 0x73, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x12, 0x37, 0x0a, 0x08, 0x73, 0x36, 0x34, - 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6a, 0x73, - 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x53, 0x36, 0x34, 0x62, 0x6f, - 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x73, 0x36, 0x34, 0x62, 0x6f, 0x6f, - 0x6c, 0x79, 0x12, 0x37, 0x0a, 0x08, 0x75, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x09, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, - 0x70, 0x70, 0x79, 0x2e, 0x55, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x08, 0x75, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x12, 0x37, 0x0a, 0x08, 0x75, - 0x36, 0x34, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x79, 0x2e, 0x55, 0x36, 0x34, - 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x75, 0x36, 0x34, 0x62, - 0x6f, 0x6f, 0x6c, 0x79, 0x1a, 0x38, 0x0a, 0x0a, 0x4e, 0x75, 0x6d, 0x6d, 0x79, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, - 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x49, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x6a, - 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, - 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x33, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x42, 0x75, 0x67, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, - 0x0a, 0x42, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x49, 0x0a, 0x0a, 0x45, 0x6e, 0x75, 0x6d, 0x79, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, - 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x53, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, - 0x3b, 0x0a, 0x0d, 0x53, 0x36, 0x34, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, - 0x55, 0x33, 0x32, 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x55, 0x36, 0x34, - 0x62, 0x6f, 0x6f, 0x6c, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x2d, 0x0a, 0x07, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x61, - 0x6c, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, - 0x0a, 0x06, 0x41, 0x52, 0x41, 0x42, 0x49, 0x43, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x4f, - 0x4d, 0x41, 0x4e, 0x10, 0x02, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x70, - 0x62, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x6a, 0x73, 0x6f, - 0x6e, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc) - -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) - -var File_jsonpb_test_proto_more_test_objects_proto protoreflect.FileDescriptor - -var xxx_File_jsonpb_test_proto_more_test_objects_proto_enumTypes = make([]protoreflect.EnumType, 1) -var xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes = make([]protoimpl.MessageType, 16) -var xxx_File_jsonpb_test_proto_more_test_objects_proto_goTypes = []interface{}{ - (Numeral)(0), // 0: jsonpb.Numeral - (*Simple3)(nil), // 1: jsonpb.Simple3 - (*SimpleSlice3)(nil), // 2: jsonpb.SimpleSlice3 - (*SimpleMap3)(nil), // 3: jsonpb.SimpleMap3 - (*SimpleNull3)(nil), // 4: jsonpb.SimpleNull3 - (*Mappy)(nil), // 5: jsonpb.Mappy - nil, // 6: jsonpb.SimpleMap3.StringyEntry - nil, // 7: jsonpb.Mappy.NummyEntry - nil, // 8: jsonpb.Mappy.StrryEntry - nil, // 9: jsonpb.Mappy.ObjjyEntry - nil, // 10: jsonpb.Mappy.BuggyEntry - nil, // 11: jsonpb.Mappy.BoolyEntry - nil, // 12: jsonpb.Mappy.EnumyEntry - nil, // 13: jsonpb.Mappy.S32boolyEntry - nil, // 14: jsonpb.Mappy.S64boolyEntry - nil, // 15: jsonpb.Mappy.U32boolyEntry - nil, // 16: jsonpb.Mappy.U64boolyEntry -} -var xxx_File_jsonpb_test_proto_more_test_objects_proto_depIdxs = []int32{ - 6, // jsonpb.SimpleMap3.stringy:type_name -> jsonpb.SimpleMap3.StringyEntry - 1, // jsonpb.SimpleNull3.simple:type_name -> jsonpb.Simple3 - 7, // jsonpb.Mappy.nummy:type_name -> jsonpb.Mappy.NummyEntry - 8, // jsonpb.Mappy.strry:type_name -> jsonpb.Mappy.StrryEntry - 9, // jsonpb.Mappy.objjy:type_name -> jsonpb.Mappy.ObjjyEntry - 10, // jsonpb.Mappy.buggy:type_name -> jsonpb.Mappy.BuggyEntry - 11, // jsonpb.Mappy.booly:type_name -> jsonpb.Mappy.BoolyEntry - 12, // jsonpb.Mappy.enumy:type_name -> jsonpb.Mappy.EnumyEntry - 13, // jsonpb.Mappy.s32booly:type_name -> jsonpb.Mappy.S32boolyEntry - 14, // jsonpb.Mappy.s64booly:type_name -> jsonpb.Mappy.S64boolyEntry - 15, // jsonpb.Mappy.u32booly:type_name -> jsonpb.Mappy.U32boolyEntry - 16, // jsonpb.Mappy.u64booly:type_name -> jsonpb.Mappy.U64boolyEntry - 1, // jsonpb.Mappy.ObjjyEntry.value:type_name -> jsonpb.Simple3 - 0, // jsonpb.Mappy.EnumyEntry.value:type_name -> jsonpb.Numeral -} - -func init() { xxx_File_jsonpb_test_proto_more_test_objects_proto_init() } -func xxx_File_jsonpb_test_proto_more_test_objects_proto_init() { - if File_jsonpb_test_proto_more_test_objects_proto != nil { - return - } - messageTypes := make([]protoreflect.MessageType, 16) - File_jsonpb_test_proto_more_test_objects_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_jsonpb_test_proto_more_test_objects_proto_rawdesc, - GoTypes: xxx_File_jsonpb_test_proto_more_test_objects_proto_goTypes, - DependencyIndexes: xxx_File_jsonpb_test_proto_more_test_objects_proto_depIdxs, - EnumOutputTypes: xxx_File_jsonpb_test_proto_more_test_objects_proto_enumTypes, - MessageOutputTypes: messageTypes, - }.Init() - messageGoTypes := xxx_File_jsonpb_test_proto_more_test_objects_proto_goTypes[1:][:16] - for i, mt := range messageTypes { - xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[i].GoType = reflect.TypeOf(messageGoTypes[i]) - xxx_File_jsonpb_test_proto_more_test_objects_proto_messageTypes[i].PBType = mt - } - xxx_File_jsonpb_test_proto_more_test_objects_proto_goTypes = nil - xxx_File_jsonpb_test_proto_more_test_objects_proto_depIdxs = nil +func init() { + proto.RegisterFile("jsonpb_test_proto/more_test_objects.proto", fileDescriptor_59defc22c5ce96e7) +} + +var fileDescriptor_59defc22c5ce96e7 = []byte{ + // 567 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0xdf, 0x8b, 0xd3, 0x4e, + 0x14, 0xc5, 0xbf, 0x69, 0x37, 0x69, 0x7b, 0xbb, 0xfb, 0xb5, 0x0c, 0x22, 0xa1, 0xfb, 0xe0, 0x12, + 0x50, 0x57, 0xc1, 0x04, 0x1a, 0x59, 0xd7, 0xae, 0x2f, 0xad, 0xec, 0xc3, 0x22, 0x4d, 0x21, 0xa5, + 0x08, 0xbe, 0x2c, 0x49, 0x8d, 0xb1, 0x35, 0xc9, 0x84, 0x24, 0x23, 0xe4, 0xd9, 0xbf, 0x5b, 0x90, + 0xf9, 0x91, 0x4d, 0x52, 0xa7, 0x54, 0xdf, 0xe6, 0xce, 0xf9, 0x9c, 0xdc, 0x33, 0x33, 0x97, 0x16, + 0x5e, 0xee, 0x72, 0x9c, 0xa4, 0xfe, 0x7d, 0x11, 0xe4, 0xc5, 0x7d, 0x9a, 0xe1, 0x02, 0x5b, 0x31, + 0xce, 0x02, 0x5e, 0x63, 0x7f, 0x17, 0x6c, 0x8a, 0xdc, 0x64, 0xfb, 0x48, 0xe3, 0xa8, 0x71, 0x0e, + 0xbd, 0xd5, 0x36, 0x4e, 0xa3, 0xc0, 0x46, 0x23, 0xe8, 0x7e, 0x21, 0xbe, 0xae, 0x5c, 0x28, 0x97, + 0x8a, 0x4b, 0x97, 0xc6, 0x73, 0x38, 0xe5, 0xe2, 0x2a, 0xda, 0x6e, 0x02, 0x1b, 0x3d, 0x01, 0x2d, + 0xa7, 0xab, 0x5c, 0x57, 0x2e, 0xba, 0x97, 0x03, 0x57, 0x54, 0xc6, 0x4f, 0x05, 0x80, 0x83, 0x0b, + 0x2f, 0xb5, 0xd1, 0x3b, 0xe8, 0xe5, 0x45, 0xb6, 0x4d, 0xc2, 0x92, 0x71, 0xc3, 0xc9, 0x53, 0x93, + 0x77, 0x33, 0x6b, 0xc8, 0x5c, 0x71, 0xe2, 0x36, 0x29, 0xb2, 0xd2, 0xad, 0xf8, 0xf1, 0x14, 0x4e, + 0x9b, 0x02, 0xcd, 0xf4, 0x3d, 0x28, 0x59, 0xa6, 0x81, 0x4b, 0x97, 0xe8, 0x31, 0xa8, 0x3f, 0xbc, + 0x88, 0x04, 0x7a, 0x87, 0xed, 0xf1, 0x62, 0xda, 0xb9, 0x56, 0x8c, 0x2b, 0x18, 0xf2, 0xef, 0x3b, + 0x24, 0x8a, 0x6c, 0xf4, 0x02, 0xb4, 0x9c, 0x95, 0xcc, 0x3d, 0x9c, 0x3c, 0x6a, 0x87, 0xb0, 0x5d, + 0x21, 0x1b, 0xbf, 0xfa, 0xa0, 0x2e, 0xbc, 0x34, 0x2d, 0x91, 0x09, 0x6a, 0x42, 0xe2, 0xb8, 0x8a, + 0xad, 0x57, 0x0e, 0xa6, 0x9a, 0x0e, 0x95, 0x78, 0x5e, 0x8e, 0x51, 0x3e, 0x2f, 0xb2, 0xac, 0xd4, + 0x3b, 0x32, 0x7e, 0x45, 0x25, 0xc1, 0x33, 0x8c, 0xf2, 0xd8, 0xdf, 0xed, 0x4a, 0xbd, 0x2b, 0xe3, + 0x97, 0x54, 0x12, 0x3c, 0xc3, 0x28, 0xef, 0x93, 0x30, 0x2c, 0xf5, 0x13, 0x19, 0x3f, 0xa7, 0x92, + 0xe0, 0x19, 0xc6, 0x78, 0x8c, 0xa3, 0x52, 0x57, 0xa5, 0x3c, 0x95, 0x2a, 0x9e, 0xae, 0x29, 0x1f, + 0x24, 0x24, 0x2e, 0x75, 0x4d, 0xc6, 0xdf, 0x52, 0x49, 0xf0, 0x0c, 0x43, 0x6f, 0xa1, 0x9f, 0xdb, + 0x13, 0xde, 0xa2, 0xc7, 0x2c, 0xe7, 0x7b, 0x47, 0x16, 0x2a, 0x77, 0x3d, 0xc0, 0xcc, 0x78, 0xf5, + 0x86, 0x1b, 0xfb, 0x52, 0xa3, 0x50, 0x2b, 0xa3, 0x28, 0xa9, 0x91, 0x54, 0x1d, 0x07, 0x32, 0xe3, + 0xba, 0xdd, 0x91, 0x34, 0x3a, 0x92, 0xaa, 0x23, 0x48, 0x8d, 0xed, 0x8e, 0x15, 0x3c, 0xbe, 0x06, + 0xa8, 0x1f, 0xba, 0x39, 0x7f, 0x5d, 0xc9, 0xfc, 0xa9, 0x8d, 0xf9, 0xa3, 0xce, 0xfa, 0xc9, 0xff, + 0x65, 0x72, 0xc7, 0x77, 0x00, 0xf5, 0xe3, 0x37, 0x9d, 0x2a, 0x77, 0x3e, 0x6b, 0x3a, 0x25, 0x93, + 0xdc, 0x0e, 0x51, 0xcf, 0xc5, 0xb1, 0xf8, 0x83, 0x7d, 0xe7, 0xc3, 0x85, 0x34, 0x9d, 0x7d, 0x89, + 0xb3, 0xbf, 0x17, 0xbf, 0x9e, 0x15, 0xc9, 0xc1, 0x5b, 0xf1, 0xff, 0xaf, 0xe3, 0x3b, 0x24, 0x0e, + 0x32, 0x2f, 0x6a, 0x7e, 0xea, 0x06, 0xce, 0x5a, 0x33, 0x24, 0xb9, 0x8c, 0xc3, 0x39, 0xa8, 0xb9, + 0xf9, 0xaa, 0xc7, 0x8e, 0xbf, 0x6f, 0x5e, 0x1f, 0xea, 0x7c, 0xf6, 0x37, 0xe6, 0x43, 0x9d, 0x4f, + 0x8e, 0x98, 0x5f, 0xbd, 0x86, 0x9e, 0xb8, 0x09, 0x34, 0x84, 0xde, 0xda, 0xf9, 0xe8, 0x2c, 0x3f, + 0x39, 0xa3, 0xff, 0x10, 0x80, 0x36, 0x73, 0x67, 0xf3, 0xbb, 0x0f, 0x23, 0x05, 0x0d, 0x40, 0x75, + 0x97, 0x8b, 0x99, 0x33, 0xea, 0xcc, 0xdf, 0x7f, 0x9e, 0x86, 0xdb, 0xe2, 0x1b, 0xf1, 0xcd, 0x0d, + 0x8e, 0xad, 0x10, 0x47, 0x5e, 0x12, 0x5a, 0xec, 0x47, 0xdd, 0x27, 0x5f, 0x2d, 0x7e, 0xb5, 0xd6, + 0x1f, 0x7f, 0x04, 0x37, 0x7c, 0xc7, 0xd7, 0x58, 0x65, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xd5, + 0x45, 0xc4, 0x18, 0x2b, 0x06, 0x00, 0x00, } diff --git a/jsonpb/jsonpb_test_proto/test_objects.pb.go b/jsonpb/jsonpb_test_proto/test_objects.pb.go index a892ec7a84..5522376c0d 100644 --- a/jsonpb/jsonpb_test_proto/test_objects.pb.go +++ b/jsonpb/jsonpb_test_proto/test_objects.pb.go @@ -4,14 +4,21 @@ package jsonpb import ( + fmt "fmt" proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" - protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" - protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" - known "github.com/golang/protobuf/v2/types/known" - reflect "reflect" + any "github.com/golang/protobuf/ptypes/any" + duration "github.com/golang/protobuf/ptypes/duration" + _struct "github.com/golang/protobuf/ptypes/struct" + timestamp "github.com/golang/protobuf/ptypes/timestamp" + wrappers "github.com/golang/protobuf/ptypes/wrappers" + math "math" ) +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -26,13 +33,6 @@ const ( Widget_BLUE Widget_Color = 2 ) -func (e Widget_Color) Type() protoreflect.EnumType { - return xxx_File_jsonpb_test_proto_test_objects_proto_enumTypes[0] -} -func (e Widget_Color) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - var Widget_Color_name = map[int32]string{ 0: "RED", 1: "GREEN", @@ -65,7 +65,7 @@ func (x *Widget_Color) UnmarshalJSON(data []byte) error { } func (Widget_Color) EnumDescriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{3, 0} + return fileDescriptor_6b3d96f97365f06c, []int{3, 0} } // Test message for holding primitive types. @@ -94,14 +94,11 @@ type Simple struct { XXX_sizecache int32 `json:"-"` } -func (m *Simple) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[0].MessageOf(m) -} func (m *Simple) Reset() { *m = Simple{} } func (m *Simple) String() string { return proto.CompactTextString(m) } func (*Simple) ProtoMessage() {} func (*Simple) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{0} + return fileDescriptor_6b3d96f97365f06c, []int{0} } func (m *Simple) XXX_Unmarshal(b []byte) error { @@ -268,14 +265,11 @@ type NonFinites struct { XXX_sizecache int32 `json:"-"` } -func (m *NonFinites) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[1].MessageOf(m) -} func (m *NonFinites) Reset() { *m = NonFinites{} } func (m *NonFinites) String() string { return proto.CompactTextString(m) } func (*NonFinites) ProtoMessage() {} func (*NonFinites) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{1} + return fileDescriptor_6b3d96f97365f06c, []int{1} } func (m *NonFinites) XXX_Unmarshal(b []byte) error { @@ -356,14 +350,11 @@ type Repeats struct { XXX_sizecache int32 `json:"-"` } -func (m *Repeats) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[2].MessageOf(m) -} func (m *Repeats) Reset() { *m = Repeats{} } func (m *Repeats) String() string { return proto.CompactTextString(m) } func (*Repeats) ProtoMessage() {} func (*Repeats) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{2} + return fileDescriptor_6b3d96f97365f06c, []int{2} } func (m *Repeats) XXX_Unmarshal(b []byte) error { @@ -474,14 +465,11 @@ type Widget struct { XXX_sizecache int32 `json:"-"` } -func (m *Widget) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[3].MessageOf(m) -} func (m *Widget) Reset() { *m = Widget{} } func (m *Widget) String() string { return proto.CompactTextString(m) } func (*Widget) ProtoMessage() {} func (*Widget) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{3} + return fileDescriptor_6b3d96f97365f06c, []int{3} } func (m *Widget) XXX_Unmarshal(b []byte) error { @@ -552,14 +540,11 @@ type Maps struct { XXX_sizecache int32 `json:"-"` } -func (m *Maps) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[4].MessageOf(m) -} func (m *Maps) Reset() { *m = Maps{} } func (m *Maps) String() string { return proto.CompactTextString(m) } func (*Maps) ProtoMessage() {} func (*Maps) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{4} + return fileDescriptor_6b3d96f97365f06c, []int{4} } func (m *Maps) XXX_Unmarshal(b []byte) error { @@ -607,14 +592,11 @@ type MsgWithOneof struct { XXX_sizecache int32 `json:"-"` } -func (m *MsgWithOneof) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[5].MessageOf(m) -} func (m *MsgWithOneof) Reset() { *m = MsgWithOneof{} } func (m *MsgWithOneof) String() string { return proto.CompactTextString(m) } func (*MsgWithOneof) ProtoMessage() {} func (*MsgWithOneof) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{5} + return fileDescriptor_6b3d96f97365f06c, []int{5} } func (m *MsgWithOneof) XXX_Unmarshal(b []byte) error { @@ -730,14 +712,11 @@ type Real struct { XXX_sizecache int32 `json:"-"` } -func (m *Real) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[6].MessageOf(m) -} func (m *Real) Reset() { *m = Real{} } func (m *Real) String() string { return proto.CompactTextString(m) } func (*Real) ProtoMessage() {} func (*Real) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{6} + return fileDescriptor_6b3d96f97365f06c, []int{6} } var extRange_Real = []proto.ExtensionRange{ @@ -781,14 +760,11 @@ type Complex struct { XXX_sizecache int32 `json:"-"` } -func (m *Complex) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[7].MessageOf(m) -} func (m *Complex) Reset() { *m = Complex{} } func (m *Complex) String() string { return proto.CompactTextString(m) } func (*Complex) ProtoMessage() {} func (*Complex) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{7} + return fileDescriptor_6b3d96f97365f06c, []int{7} } var extRange_Complex = []proto.ExtensionRange{ @@ -824,35 +800,41 @@ func (m *Complex) GetImaginary() float64 { return 0 } +var E_Complex_RealExtension = &proto.ExtensionDesc{ + ExtendedType: (*Real)(nil), + ExtensionType: (*Complex)(nil), + Field: 123, + Name: "jsonpb.Complex.real_extension", + Tag: "bytes,123,opt,name=real_extension", + Filename: "jsonpb_test_proto/test_objects.proto", +} + type KnownTypes struct { - An *known.Any `protobuf:"bytes,14,opt,name=an" json:"an,omitempty"` - Dur *known.Duration `protobuf:"bytes,1,opt,name=dur" json:"dur,omitempty"` - St *known.Struct `protobuf:"bytes,12,opt,name=st" json:"st,omitempty"` - Ts *known.Timestamp `protobuf:"bytes,2,opt,name=ts" json:"ts,omitempty"` - Lv *known.ListValue `protobuf:"bytes,15,opt,name=lv" json:"lv,omitempty"` - Val *known.Value `protobuf:"bytes,16,opt,name=val" json:"val,omitempty"` - Dbl *known.DoubleValue `protobuf:"bytes,3,opt,name=dbl" json:"dbl,omitempty"` - Flt *known.FloatValue `protobuf:"bytes,4,opt,name=flt" json:"flt,omitempty"` - I64 *known.Int64Value `protobuf:"bytes,5,opt,name=i64" json:"i64,omitempty"` - U64 *known.UInt64Value `protobuf:"bytes,6,opt,name=u64" json:"u64,omitempty"` - I32 *known.Int32Value `protobuf:"bytes,7,opt,name=i32" json:"i32,omitempty"` - U32 *known.UInt32Value `protobuf:"bytes,8,opt,name=u32" json:"u32,omitempty"` - Bool *known.BoolValue `protobuf:"bytes,9,opt,name=bool" json:"bool,omitempty"` - Str *known.StringValue `protobuf:"bytes,10,opt,name=str" json:"str,omitempty"` - Bytes *known.BytesValue `protobuf:"bytes,11,opt,name=bytes" json:"bytes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *KnownTypes) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[8].MessageOf(m) + An *any.Any `protobuf:"bytes,14,opt,name=an" json:"an,omitempty"` + Dur *duration.Duration `protobuf:"bytes,1,opt,name=dur" json:"dur,omitempty"` + St *_struct.Struct `protobuf:"bytes,12,opt,name=st" json:"st,omitempty"` + Ts *timestamp.Timestamp `protobuf:"bytes,2,opt,name=ts" json:"ts,omitempty"` + Lv *_struct.ListValue `protobuf:"bytes,15,opt,name=lv" json:"lv,omitempty"` + Val *_struct.Value `protobuf:"bytes,16,opt,name=val" json:"val,omitempty"` + Dbl *wrappers.DoubleValue `protobuf:"bytes,3,opt,name=dbl" json:"dbl,omitempty"` + Flt *wrappers.FloatValue `protobuf:"bytes,4,opt,name=flt" json:"flt,omitempty"` + I64 *wrappers.Int64Value `protobuf:"bytes,5,opt,name=i64" json:"i64,omitempty"` + U64 *wrappers.UInt64Value `protobuf:"bytes,6,opt,name=u64" json:"u64,omitempty"` + I32 *wrappers.Int32Value `protobuf:"bytes,7,opt,name=i32" json:"i32,omitempty"` + U32 *wrappers.UInt32Value `protobuf:"bytes,8,opt,name=u32" json:"u32,omitempty"` + Bool *wrappers.BoolValue `protobuf:"bytes,9,opt,name=bool" json:"bool,omitempty"` + Str *wrappers.StringValue `protobuf:"bytes,10,opt,name=str" json:"str,omitempty"` + Bytes *wrappers.BytesValue `protobuf:"bytes,11,opt,name=bytes" json:"bytes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } + func (m *KnownTypes) Reset() { *m = KnownTypes{} } func (m *KnownTypes) String() string { return proto.CompactTextString(m) } func (*KnownTypes) ProtoMessage() {} func (*KnownTypes) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{8} + return fileDescriptor_6b3d96f97365f06c, []int{8} } func (m *KnownTypes) XXX_Unmarshal(b []byte) error { @@ -873,105 +855,105 @@ func (m *KnownTypes) XXX_DiscardUnknown() { var xxx_messageInfo_KnownTypes proto.InternalMessageInfo -func (m *KnownTypes) GetAn() *known.Any { +func (m *KnownTypes) GetAn() *any.Any { if m != nil { return m.An } return nil } -func (m *KnownTypes) GetDur() *known.Duration { +func (m *KnownTypes) GetDur() *duration.Duration { if m != nil { return m.Dur } return nil } -func (m *KnownTypes) GetSt() *known.Struct { +func (m *KnownTypes) GetSt() *_struct.Struct { if m != nil { return m.St } return nil } -func (m *KnownTypes) GetTs() *known.Timestamp { +func (m *KnownTypes) GetTs() *timestamp.Timestamp { if m != nil { return m.Ts } return nil } -func (m *KnownTypes) GetLv() *known.ListValue { +func (m *KnownTypes) GetLv() *_struct.ListValue { if m != nil { return m.Lv } return nil } -func (m *KnownTypes) GetVal() *known.Value { +func (m *KnownTypes) GetVal() *_struct.Value { if m != nil { return m.Val } return nil } -func (m *KnownTypes) GetDbl() *known.DoubleValue { +func (m *KnownTypes) GetDbl() *wrappers.DoubleValue { if m != nil { return m.Dbl } return nil } -func (m *KnownTypes) GetFlt() *known.FloatValue { +func (m *KnownTypes) GetFlt() *wrappers.FloatValue { if m != nil { return m.Flt } return nil } -func (m *KnownTypes) GetI64() *known.Int64Value { +func (m *KnownTypes) GetI64() *wrappers.Int64Value { if m != nil { return m.I64 } return nil } -func (m *KnownTypes) GetU64() *known.UInt64Value { +func (m *KnownTypes) GetU64() *wrappers.UInt64Value { if m != nil { return m.U64 } return nil } -func (m *KnownTypes) GetI32() *known.Int32Value { +func (m *KnownTypes) GetI32() *wrappers.Int32Value { if m != nil { return m.I32 } return nil } -func (m *KnownTypes) GetU32() *known.UInt32Value { +func (m *KnownTypes) GetU32() *wrappers.UInt32Value { if m != nil { return m.U32 } return nil } -func (m *KnownTypes) GetBool() *known.BoolValue { +func (m *KnownTypes) GetBool() *wrappers.BoolValue { if m != nil { return m.Bool } return nil } -func (m *KnownTypes) GetStr() *known.StringValue { +func (m *KnownTypes) GetStr() *wrappers.StringValue { if m != nil { return m.Str } return nil } -func (m *KnownTypes) GetBytes() *known.BytesValue { +func (m *KnownTypes) GetBytes() *wrappers.BytesValue { if m != nil { return m.Bytes } @@ -986,14 +968,11 @@ type MsgWithRequired struct { XXX_sizecache int32 `json:"-"` } -func (m *MsgWithRequired) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[9].MessageOf(m) -} func (m *MsgWithRequired) Reset() { *m = MsgWithRequired{} } func (m *MsgWithRequired) String() string { return proto.CompactTextString(m) } func (*MsgWithRequired) ProtoMessage() {} func (*MsgWithRequired) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{9} + return fileDescriptor_6b3d96f97365f06c, []int{9} } func (m *MsgWithRequired) XXX_Unmarshal(b []byte) error { @@ -1030,14 +1009,11 @@ type MsgWithIndirectRequired struct { XXX_sizecache int32 `json:"-"` } -func (m *MsgWithIndirectRequired) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[10].MessageOf(m) -} func (m *MsgWithIndirectRequired) Reset() { *m = MsgWithIndirectRequired{} } func (m *MsgWithIndirectRequired) String() string { return proto.CompactTextString(m) } func (*MsgWithIndirectRequired) ProtoMessage() {} func (*MsgWithIndirectRequired) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{10} + return fileDescriptor_6b3d96f97365f06c, []int{10} } func (m *MsgWithIndirectRequired) XXX_Unmarshal(b []byte) error { @@ -1086,14 +1062,11 @@ type MsgWithRequiredBytes struct { XXX_sizecache int32 `json:"-"` } -func (m *MsgWithRequiredBytes) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[11].MessageOf(m) -} func (m *MsgWithRequiredBytes) Reset() { *m = MsgWithRequiredBytes{} } func (m *MsgWithRequiredBytes) String() string { return proto.CompactTextString(m) } func (*MsgWithRequiredBytes) ProtoMessage() {} func (*MsgWithRequiredBytes) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{11} + return fileDescriptor_6b3d96f97365f06c, []int{11} } func (m *MsgWithRequiredBytes) XXX_Unmarshal(b []byte) error { @@ -1122,20 +1095,17 @@ func (m *MsgWithRequiredBytes) GetByts() []byte { } type MsgWithRequiredWKT struct { - Str *known.StringValue `protobuf:"bytes,1,req,name=str" json:"str,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Str *wrappers.StringValue `protobuf:"bytes,1,req,name=str" json:"str,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *MsgWithRequiredWKT) ProtoReflect() protoreflect.Message { - return xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[12].MessageOf(m) -} func (m *MsgWithRequiredWKT) Reset() { *m = MsgWithRequiredWKT{} } func (m *MsgWithRequiredWKT) String() string { return proto.CompactTextString(m) } func (*MsgWithRequiredWKT) ProtoMessage() {} func (*MsgWithRequiredWKT) Descriptor() ([]byte, []int) { - return xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped, []int{12} + return fileDescriptor_6b3d96f97365f06c, []int{12} } func (m *MsgWithRequiredWKT) XXX_Unmarshal(b []byte) error { @@ -1156,7 +1126,7 @@ func (m *MsgWithRequiredWKT) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWithRequiredWKT proto.InternalMessageInfo -func (m *MsgWithRequiredWKT) GetStr() *known.StringValue { +func (m *MsgWithRequiredWKT) GetStr() *wrappers.StringValue { if m != nil { return m.Str } @@ -1181,17 +1151,7 @@ var E_Extm = &proto.ExtensionDesc{ Filename: "jsonpb_test_proto/test_objects.proto", } -var E_Complex_RealExtension = &proto.ExtensionDesc{ - ExtendedType: (*Real)(nil), - ExtensionType: (*Complex)(nil), - Field: 123, - Name: "jsonpb.Complex.real_extension", - Tag: "bytes,123,opt,name=real_extension", - Filename: "jsonpb_test_proto/test_objects.proto", -} - func init() { - proto.RegisterFile("jsonpb_test_proto/test_objects.proto", xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped) proto.RegisterEnum("jsonpb.Widget_Color", Widget_Color_name, Widget_Color_value) proto.RegisterType((*Simple)(nil), "jsonpb.Simple") proto.RegisterType((*NonFinites)(nil), "jsonpb.NonFinites") @@ -1202,6 +1162,7 @@ func init() { proto.RegisterMapType((map[int64]string)(nil), "jsonpb.Maps.MInt64StrEntry") proto.RegisterType((*MsgWithOneof)(nil), "jsonpb.MsgWithOneof") proto.RegisterType((*Real)(nil), "jsonpb.Real") + proto.RegisterExtension(E_Complex_RealExtension) proto.RegisterType((*Complex)(nil), "jsonpb.Complex") proto.RegisterType((*KnownTypes)(nil), "jsonpb.KnownTypes") proto.RegisterType((*MsgWithRequired)(nil), "jsonpb.MsgWithRequired") @@ -1211,334 +1172,106 @@ func init() { proto.RegisterType((*MsgWithRequiredWKT)(nil), "jsonpb.MsgWithRequiredWKT") proto.RegisterExtension(E_Name) proto.RegisterExtension(E_Extm) - proto.RegisterExtension(E_Complex_RealExtension) } -var xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc = []byte{ - // 3473 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x24, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x1a, 0x19, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, - 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, - 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, - 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x04, 0x0a, 0x06, 0x53, 0x69, 0x6d, - 0x70, 0x6c, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x6f, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x05, 0x6f, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x5f, - 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6f, 0x49, 0x6e, - 0x74, 0x33, 0x32, 0x12, 0x1e, 0x0a, 0x0b, 0x6f, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x73, - 0x74, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6f, 0x49, 0x6e, 0x74, 0x33, 0x32, - 0x53, 0x74, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1e, 0x0a, 0x0b, - 0x6f, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x6f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, - 0x6f, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, - 0x6f, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x75, 0x69, 0x6e, - 0x74, 0x33, 0x32, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6f, - 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x75, - 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6f, 0x55, 0x69, - 0x6e, 0x74, 0x36, 0x34, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, - 0x5f, 0x73, 0x74, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x6f, 0x55, 0x69, 0x6e, - 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, - 0x33, 0x32, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x11, 0x52, 0x07, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x33, - 0x32, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x73, 0x74, - 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x11, 0x52, 0x0a, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, - 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, - 0x0c, 0x20, 0x01, 0x28, 0x12, 0x52, 0x07, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x20, - 0x0a, 0x0c, 0x6f, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x0d, - 0x20, 0x01, 0x28, 0x12, 0x52, 0x0a, 0x6f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, - 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, - 0x02, 0x52, 0x06, 0x6f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x1e, 0x0a, 0x0b, 0x6f, 0x5f, 0x66, - 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x02, 0x52, 0x09, - 0x6f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x64, - 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6f, 0x44, 0x6f, - 0x75, 0x62, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, - 0x5f, 0x73, 0x74, 0x72, 0x18, 0x11, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6f, 0x44, 0x6f, 0x75, - 0x62, 0x6c, 0x65, 0x53, 0x74, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x5f, 0x73, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x13, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x06, 0x6f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x92, 0x01, 0x0a, 0x0a, 0x4e, - 0x6f, 0x6e, 0x46, 0x69, 0x6e, 0x69, 0x74, 0x65, 0x73, 0x12, 0x13, 0x0a, 0x05, 0x66, 0x5f, 0x6e, - 0x61, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x04, 0x66, 0x4e, 0x61, 0x6e, 0x12, 0x15, - 0x0a, 0x06, 0x66, 0x5f, 0x70, 0x69, 0x6e, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, - 0x66, 0x50, 0x69, 0x6e, 0x66, 0x12, 0x15, 0x0a, 0x06, 0x66, 0x5f, 0x6e, 0x69, 0x6e, 0x66, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x66, 0x4e, 0x69, 0x6e, 0x66, 0x12, 0x13, 0x0a, 0x05, - 0x64, 0x5f, 0x6e, 0x61, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x64, 0x4e, 0x61, - 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x64, 0x5f, 0x70, 0x69, 0x6e, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x05, 0x64, 0x50, 0x69, 0x6e, 0x66, 0x12, 0x15, 0x0a, 0x06, 0x64, 0x5f, 0x6e, 0x69, - 0x6e, 0x66, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x64, 0x4e, 0x69, 0x6e, 0x66, 0x22, - 0xa6, 0x02, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x12, 0x15, 0x0a, 0x06, 0x72, - 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x08, 0x52, 0x05, 0x72, 0x42, 0x6f, - 0x6f, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x05, 0x52, 0x06, 0x72, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x17, 0x0a, 0x07, 0x72, - 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x72, 0x49, - 0x6e, 0x74, 0x36, 0x34, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, - 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x07, 0x72, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, - 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x05, 0x20, 0x03, 0x28, - 0x04, 0x52, 0x07, 0x72, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, - 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x06, 0x20, 0x03, 0x28, 0x11, 0x52, 0x07, 0x72, 0x53, - 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, - 0x34, 0x18, 0x07, 0x20, 0x03, 0x28, 0x12, 0x52, 0x07, 0x72, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, - 0x12, 0x17, 0x0a, 0x07, 0x72, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x03, 0x28, - 0x02, 0x52, 0x06, 0x72, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x64, - 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x01, 0x52, 0x07, 0x72, 0x44, 0x6f, - 0x75, 0x62, 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, - 0x17, 0x0a, 0x07, 0x72, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0c, - 0x52, 0x06, 0x72, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0xb6, 0x02, 0x0a, 0x06, 0x57, 0x69, 0x64, - 0x67, 0x65, 0x74, 0x12, 0x2a, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, - 0x65, 0x74, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, - 0x2d, 0x0a, 0x07, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0e, - 0x32, 0x14, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, - 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x06, 0x72, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x26, - 0x0a, 0x06, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x06, - 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x29, 0x0a, 0x08, 0x72, 0x5f, 0x73, 0x69, 0x6d, 0x70, - 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, - 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x07, 0x72, 0x53, 0x69, 0x6d, 0x70, 0x6c, - 0x65, 0x12, 0x29, 0x0a, 0x07, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x18, 0x14, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, - 0x61, 0x74, 0x73, 0x52, 0x07, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x09, - 0x72, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0f, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, - 0x52, 0x08, 0x72, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x73, 0x22, 0x25, 0x0a, 0x05, 0x43, 0x6f, - 0x6c, 0x6f, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x47, 0x52, 0x45, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4c, 0x55, 0x45, 0x10, - 0x02, 0x22, 0x94, 0x02, 0x0a, 0x04, 0x4d, 0x61, 0x70, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x6d, 0x5f, - 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x73, 0x2e, 0x4d, 0x49, - 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x49, - 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x12, 0x41, 0x0a, 0x0d, 0x6d, 0x5f, 0x62, 0x6f, 0x6f, - 0x6c, 0x5f, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, - 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x70, 0x73, 0x2e, 0x4d, 0x42, 0x6f, - 0x6f, 0x6c, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x6d, - 0x42, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x49, - 0x6e, 0x74, 0x36, 0x34, 0x53, 0x74, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4e, 0x0a, 0x10, 0x4d, 0x42, 0x6f, 0x6f, - 0x6c, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd1, 0x01, 0x0a, 0x0c, 0x4d, 0x73, 0x67, - 0x57, 0x69, 0x74, 0x68, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x69, 0x74, - 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, - 0x65, 0x12, 0x18, 0x0a, 0x06, 0x73, 0x61, 0x6c, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x48, 0x00, 0x52, 0x06, 0x73, 0x61, 0x6c, 0x61, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x07, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x23, 0x0a, 0x0c, 0x68, 0x6f, 0x6d, 0x65, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x0b, 0x68, 0x6f, 0x6d, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x45, 0x0a, 0x11, - 0x6d, 0x73, 0x67, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, - 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, - 0x48, 0x00, 0x52, 0x0f, 0x6d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, - 0x72, 0x65, 0x64, 0x42, 0x07, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x22, 0x26, 0x0a, 0x04, - 0x52, 0x65, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, - 0x80, 0x80, 0x80, 0x02, 0x22, 0x77, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x12, - 0x1c, 0x0a, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x2a, 0x08, 0x08, - 0x64, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x32, 0x44, 0x0a, 0x0e, 0x72, 0x65, 0x61, 0x6c, 0x5f, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0c, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, - 0x70, 0x62, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x18, 0x7b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x52, 0x0d, - 0x72, 0x65, 0x61, 0x6c, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xba, 0x05, - 0x0a, 0x0a, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x02, - 0x61, 0x6e, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x02, - 0x61, 0x6e, 0x12, 0x2b, 0x0a, 0x03, 0x64, 0x75, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x64, 0x75, 0x72, 0x12, - 0x27, 0x0a, 0x02, 0x73, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, - 0x72, 0x75, 0x63, 0x74, 0x52, 0x02, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x02, 0x74, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x52, 0x02, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x02, 0x6c, 0x76, - 0x12, 0x28, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x12, 0x2e, 0x0a, 0x03, 0x64, 0x62, - 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x03, 0x64, 0x62, 0x6c, 0x12, 0x2d, 0x0a, 0x03, 0x66, 0x6c, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x52, 0x03, 0x66, 0x6c, 0x74, 0x12, 0x2d, 0x0a, 0x03, 0x69, 0x36, 0x34, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x03, 0x69, 0x36, 0x34, 0x12, 0x2e, 0x0a, 0x03, 0x75, 0x36, 0x34, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x03, 0x75, 0x36, 0x34, 0x12, 0x2d, 0x0a, 0x03, 0x69, 0x33, 0x32, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x03, 0x69, 0x33, 0x32, 0x12, 0x2e, 0x0a, 0x03, 0x75, 0x33, 0x32, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x03, 0x75, 0x33, 0x32, 0x12, 0x2e, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, - 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x2e, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x03, 0x73, 0x74, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0x23, 0x0a, 0x0f, 0x4d, 0x73, - 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x10, 0x0a, - 0x03, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x03, 0x73, 0x74, 0x72, 0x22, - 0xa2, 0x02, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x64, 0x69, 0x72, - 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x04, 0x73, - 0x75, 0x62, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, - 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x64, 0x52, 0x04, 0x73, 0x75, 0x62, 0x6d, 0x12, 0x4a, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, - 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6a, 0x73, - 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x64, 0x69, - 0x72, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x2e, 0x4d, 0x61, 0x70, - 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, - 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x64, 0x52, 0x0a, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x54, - 0x0a, 0x0d, 0x4d, 0x61, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, - 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0x2a, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, - 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, - 0x62, 0x79, 0x74, 0x73, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x79, 0x74, 0x73, - 0x22, 0x44, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, - 0x72, 0x65, 0x64, 0x57, 0x4b, 0x54, 0x12, 0x2e, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, - 0x02, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x03, 0x73, 0x74, 0x72, 0x3a, 0x20, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0c, - 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x18, 0x7c, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x39, 0x0a, 0x04, 0x65, 0x78, 0x74, 0x6d, - 0x12, 0x0c, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x18, 0x7d, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2e, 0x4d, 0x73, - 0x67, 0x57, 0x69, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x52, 0x04, 0x65, - 0x78, 0x74, 0x6d, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x62, 0x5f, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x6a, 0x73, 0x6f, 0x6e, 0x70, - 0x62, -} - -var xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc) - -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) - -var File_jsonpb_test_proto_test_objects_proto protoreflect.FileDescriptor - -var xxx_File_jsonpb_test_proto_test_objects_proto_enumTypes = make([]protoreflect.EnumType, 1) -var xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes = make([]protoimpl.MessageType, 16) -var xxx_File_jsonpb_test_proto_test_objects_proto_goTypes = []interface{}{ - (Widget_Color)(0), // 0: jsonpb.Widget.Color - (*Simple)(nil), // 1: jsonpb.Simple - (*NonFinites)(nil), // 2: jsonpb.NonFinites - (*Repeats)(nil), // 3: jsonpb.Repeats - (*Widget)(nil), // 4: jsonpb.Widget - (*Maps)(nil), // 5: jsonpb.Maps - (*MsgWithOneof)(nil), // 6: jsonpb.MsgWithOneof - (*Real)(nil), // 7: jsonpb.Real - (*Complex)(nil), // 8: jsonpb.Complex - (*KnownTypes)(nil), // 9: jsonpb.KnownTypes - (*MsgWithRequired)(nil), // 10: jsonpb.MsgWithRequired - (*MsgWithIndirectRequired)(nil), // 11: jsonpb.MsgWithIndirectRequired - (*MsgWithRequiredBytes)(nil), // 12: jsonpb.MsgWithRequiredBytes - (*MsgWithRequiredWKT)(nil), // 13: jsonpb.MsgWithRequiredWKT - nil, // 14: jsonpb.Maps.MInt64StrEntry - nil, // 15: jsonpb.Maps.MBoolSimpleEntry - nil, // 16: jsonpb.MsgWithIndirectRequired.MapFieldEntry - (*known.Any)(nil), // 17: google.protobuf.Any - (*known.Duration)(nil), // 18: google.protobuf.Duration - (*known.Struct)(nil), // 19: google.protobuf.Struct - (*known.Timestamp)(nil), // 20: google.protobuf.Timestamp - (*known.ListValue)(nil), // 21: google.protobuf.ListValue - (*known.Value)(nil), // 22: google.protobuf.Value - (*known.DoubleValue)(nil), // 23: google.protobuf.DoubleValue - (*known.FloatValue)(nil), // 24: google.protobuf.FloatValue - (*known.Int64Value)(nil), // 25: google.protobuf.Int64Value - (*known.UInt64Value)(nil), // 26: google.protobuf.UInt64Value - (*known.Int32Value)(nil), // 27: google.protobuf.Int32Value - (*known.UInt32Value)(nil), // 28: google.protobuf.UInt32Value - (*known.BoolValue)(nil), // 29: google.protobuf.BoolValue - (*known.StringValue)(nil), // 30: google.protobuf.StringValue - (*known.BytesValue)(nil), // 31: google.protobuf.BytesValue -} -var xxx_File_jsonpb_test_proto_test_objects_proto_depIdxs = []int32{ - 7, // jsonpb.name:extendee -> jsonpb.Real - 7, // jsonpb.extm:extendee -> jsonpb.Real - 7, // jsonpb.Complex.real_extension:extendee -> jsonpb.Real - 0, // jsonpb.Widget.color:type_name -> jsonpb.Widget.Color - 0, // jsonpb.Widget.r_color:type_name -> jsonpb.Widget.Color - 1, // jsonpb.Widget.simple:type_name -> jsonpb.Simple - 1, // jsonpb.Widget.r_simple:type_name -> jsonpb.Simple - 3, // jsonpb.Widget.repeats:type_name -> jsonpb.Repeats - 3, // jsonpb.Widget.r_repeats:type_name -> jsonpb.Repeats - 14, // jsonpb.Maps.m_int64_str:type_name -> jsonpb.Maps.MInt64StrEntry - 15, // jsonpb.Maps.m_bool_simple:type_name -> jsonpb.Maps.MBoolSimpleEntry - 10, // jsonpb.MsgWithOneof.msg_with_required:type_name -> jsonpb.MsgWithRequired - 17, // jsonpb.KnownTypes.an:type_name -> google.protobuf.Any - 18, // jsonpb.KnownTypes.dur:type_name -> google.protobuf.Duration - 19, // jsonpb.KnownTypes.st:type_name -> google.protobuf.Struct - 20, // jsonpb.KnownTypes.ts:type_name -> google.protobuf.Timestamp - 21, // jsonpb.KnownTypes.lv:type_name -> google.protobuf.ListValue - 22, // jsonpb.KnownTypes.val:type_name -> google.protobuf.Value - 23, // jsonpb.KnownTypes.dbl:type_name -> google.protobuf.DoubleValue - 24, // jsonpb.KnownTypes.flt:type_name -> google.protobuf.FloatValue - 25, // jsonpb.KnownTypes.i64:type_name -> google.protobuf.Int64Value - 26, // jsonpb.KnownTypes.u64:type_name -> google.protobuf.UInt64Value - 27, // jsonpb.KnownTypes.i32:type_name -> google.protobuf.Int32Value - 28, // jsonpb.KnownTypes.u32:type_name -> google.protobuf.UInt32Value - 29, // jsonpb.KnownTypes.bool:type_name -> google.protobuf.BoolValue - 30, // jsonpb.KnownTypes.str:type_name -> google.protobuf.StringValue - 31, // jsonpb.KnownTypes.bytes:type_name -> google.protobuf.BytesValue - 10, // jsonpb.MsgWithIndirectRequired.subm:type_name -> jsonpb.MsgWithRequired - 16, // jsonpb.MsgWithIndirectRequired.map_field:type_name -> jsonpb.MsgWithIndirectRequired.MapFieldEntry - 10, // jsonpb.MsgWithIndirectRequired.slice_field:type_name -> jsonpb.MsgWithRequired - 30, // jsonpb.MsgWithRequiredWKT.str:type_name -> google.protobuf.StringValue - 1, // jsonpb.Maps.MBoolSimpleEntry.value:type_name -> jsonpb.Simple - 10, // jsonpb.MsgWithIndirectRequired.MapFieldEntry.value:type_name -> jsonpb.MsgWithRequired - 10, // jsonpb.extm:type_name -> jsonpb.MsgWithRequired - 8, // jsonpb.Complex.real_extension:type_name -> jsonpb.Complex -} - -func init() { xxx_File_jsonpb_test_proto_test_objects_proto_init() } -func xxx_File_jsonpb_test_proto_test_objects_proto_init() { - if File_jsonpb_test_proto_test_objects_proto != nil { - return - } - messageTypes := make([]protoreflect.MessageType, 16) - extensionTypes := make([]protoreflect.ExtensionType, 3) - File_jsonpb_test_proto_test_objects_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_jsonpb_test_proto_test_objects_proto_rawdesc, - GoTypes: xxx_File_jsonpb_test_proto_test_objects_proto_goTypes, - DependencyIndexes: xxx_File_jsonpb_test_proto_test_objects_proto_depIdxs, - EnumOutputTypes: xxx_File_jsonpb_test_proto_test_objects_proto_enumTypes, - MessageOutputTypes: messageTypes, - ExtensionOutputTypes: extensionTypes, - }.Init() - messageGoTypes := xxx_File_jsonpb_test_proto_test_objects_proto_goTypes[1:][:16] - for i, mt := range messageTypes { - xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[i].GoType = reflect.TypeOf(messageGoTypes[i]) - xxx_File_jsonpb_test_proto_test_objects_proto_messageTypes[i].PBType = mt - } - E_Name.Type = extensionTypes[0] - E_Extm.Type = extensionTypes[1] - E_Complex_RealExtension.Type = extensionTypes[2] - xxx_File_jsonpb_test_proto_test_objects_proto_goTypes = nil - xxx_File_jsonpb_test_proto_test_objects_proto_depIdxs = nil +func init() { + proto.RegisterFile("jsonpb_test_proto/test_objects.proto", fileDescriptor_6b3d96f97365f06c) +} + +var fileDescriptor_6b3d96f97365f06c = []byte{ + // 1504 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0xdd, 0x72, 0xdb, 0xb8, + 0x15, 0x36, 0x49, 0x51, 0x12, 0x8f, 0xfc, 0x17, 0xc4, 0x49, 0x64, 0x37, 0x4d, 0x39, 0x4a, 0x9a, + 0xaa, 0x49, 0x2d, 0x4f, 0x65, 0x8d, 0x26, 0x75, 0x72, 0x13, 0xc7, 0x4e, 0x93, 0x26, 0x71, 0x3b, + 0xb0, 0xd3, 0xcc, 0xf4, 0x46, 0x43, 0x99, 0x94, 0xcc, 0x94, 0x24, 0x54, 0x00, 0xb2, 0xa3, 0xe9, + 0xee, 0x8c, 0x9f, 0x61, 0x67, 0x9f, 0x60, 0x2f, 0xf6, 0x76, 0xef, 0xf6, 0x62, 0xdf, 0x62, 0xdf, + 0x68, 0x07, 0x07, 0xa0, 0x7e, 0xad, 0xd9, 0xbd, 0xb2, 0x80, 0xef, 0x07, 0x20, 0xce, 0xc7, 0x03, + 0x1a, 0x1e, 0x7d, 0x16, 0x2c, 0x1b, 0x74, 0x3b, 0x32, 0x12, 0xb2, 0x33, 0xe0, 0x4c, 0xb2, 0x3d, + 0xfc, 0xc9, 0xba, 0x9f, 0xa3, 0x73, 0x29, 0x1a, 0x38, 0x45, 0x8a, 0x9a, 0xb5, 0xb3, 0xdd, 0x67, + 0xac, 0x9f, 0x44, 0x7b, 0x38, 0xdb, 0x1d, 0xf6, 0xf6, 0x82, 0x6c, 0xa4, 0x29, 0x3b, 0x0f, 0xe6, + 0xa1, 0x70, 0xc8, 0x03, 0x19, 0xb3, 0xcc, 0xe0, 0xf7, 0xe7, 0x71, 0x21, 0xf9, 0xf0, 0x5c, 0x1a, + 0xf4, 0x0f, 0xf3, 0xa8, 0x8c, 0xd3, 0x48, 0xc8, 0x20, 0x1d, 0x2c, 0xb3, 0xbf, 0xe2, 0xc1, 0x60, + 0x10, 0x71, 0xb3, 0xc3, 0xda, 0x0f, 0x05, 0x28, 0x9e, 0xc6, 0xe9, 0x20, 0x89, 0xc8, 0x1d, 0x28, + 0xb2, 0x4e, 0x97, 0xb1, 0xa4, 0x6a, 0xf9, 0x56, 0xbd, 0x4c, 0x5d, 0x76, 0xc8, 0x58, 0x42, 0xee, + 0x41, 0x89, 0x75, 0xe2, 0x4c, 0xee, 0x37, 0xab, 0xb6, 0x6f, 0xd5, 0x5d, 0x5a, 0x64, 0x6f, 0xd5, + 0x88, 0x3c, 0x80, 0x8a, 0x01, 0x3a, 0x42, 0xf2, 0xaa, 0x83, 0xa0, 0xa7, 0xc1, 0x53, 0xc9, 0xc7, + 0xc2, 0x76, 0xab, 0x5a, 0xf0, 0xad, 0xba, 0xa3, 0x85, 0xed, 0xd6, 0x58, 0xd8, 0x6e, 0xa1, 0xd0, + 0x45, 0xd0, 0xd3, 0xa0, 0x12, 0x6e, 0x43, 0x99, 0x75, 0x86, 0x7a, 0xc9, 0xa2, 0x6f, 0xd5, 0xd7, + 0x68, 0x89, 0x7d, 0xc4, 0x21, 0xf1, 0x61, 0x35, 0x87, 0x50, 0x5b, 0x42, 0x18, 0x0c, 0x3c, 0x23, + 0x6e, 0xb7, 0xaa, 0x65, 0xdf, 0xaa, 0x17, 0x8c, 0xb8, 0xdd, 0x9a, 0x88, 0xcd, 0xc2, 0x1e, 0xc2, + 0x60, 0xe0, 0xb1, 0x58, 0xe8, 0x95, 0xc1, 0xb7, 0xea, 0xb7, 0x68, 0x89, 0x9d, 0x4e, 0xad, 0x2c, + 0x26, 0x2b, 0x57, 0x10, 0x06, 0x03, 0xcf, 0x88, 0xdb, 0xad, 0xea, 0xaa, 0x6f, 0xd5, 0x89, 0x11, + 0xe7, 0x2b, 0x8b, 0xc9, 0xca, 0x6b, 0x08, 0x83, 0x81, 0xc7, 0x87, 0xd5, 0x4b, 0x58, 0x20, 0xab, + 0xeb, 0xbe, 0x55, 0xb7, 0x69, 0x91, 0xbd, 0x56, 0x23, 0x7d, 0x58, 0x08, 0xa0, 0x72, 0x03, 0x41, + 0x4f, 0x83, 0xe3, 0x55, 0x43, 0x36, 0xec, 0x26, 0x51, 0x75, 0xd3, 0xb7, 0xea, 0x16, 0x2d, 0xb1, + 0x23, 0x1c, 0xea, 0x55, 0x35, 0x84, 0xda, 0x5b, 0x08, 0x83, 0x81, 0x27, 0x5b, 0x96, 0x3c, 0xce, + 0xfa, 0x55, 0xe2, 0x5b, 0x75, 0x4f, 0x6d, 0x19, 0x87, 0x7a, 0x43, 0xdd, 0x91, 0x8c, 0x44, 0xf5, + 0xb6, 0x6f, 0xd5, 0x57, 0x69, 0x91, 0x1d, 0xaa, 0x51, 0xed, 0x1b, 0x0b, 0xe0, 0x84, 0x65, 0xaf, + 0xe3, 0x2c, 0x96, 0x91, 0x20, 0xb7, 0xc1, 0xed, 0x75, 0xb2, 0x20, 0xc3, 0xd0, 0xd8, 0xb4, 0xd0, + 0x3b, 0x09, 0x32, 0x15, 0xa5, 0x5e, 0x67, 0x10, 0x67, 0x3d, 0x8c, 0x8c, 0x4d, 0xdd, 0xde, 0xbf, + 0xe2, 0xac, 0xa7, 0xa7, 0x33, 0x35, 0xed, 0x98, 0xe9, 0x13, 0x35, 0x7d, 0x1b, 0xdc, 0x10, 0x2d, + 0x0a, 0xb8, 0xc1, 0x42, 0x68, 0x2c, 0x42, 0x6d, 0xe1, 0xe2, 0xac, 0x1b, 0xe6, 0x16, 0xa1, 0xb6, + 0x28, 0x9a, 0x69, 0x65, 0x51, 0xfb, 0xde, 0x86, 0x12, 0x8d, 0x06, 0x51, 0x20, 0x85, 0xa2, 0xf0, + 0x3c, 0xc7, 0x8e, 0xca, 0x31, 0xcf, 0x73, 0xcc, 0xc7, 0x39, 0x76, 0x54, 0x8e, 0xb9, 0xce, 0x71, + 0x0e, 0xb4, 0x5b, 0x55, 0xc7, 0x77, 0x54, 0x4e, 0xb9, 0xce, 0xe9, 0x36, 0x94, 0x79, 0x9e, 0xc3, + 0x82, 0xef, 0xa8, 0x1c, 0x72, 0x93, 0xc3, 0x31, 0xd4, 0x6e, 0x55, 0x5d, 0xdf, 0x51, 0x29, 0xe3, + 0x26, 0x65, 0x08, 0x89, 0x3c, 0xbd, 0x8e, 0xca, 0x10, 0x3f, 0x9d, 0x52, 0x99, 0x84, 0x94, 0x7c, + 0x47, 0x25, 0x84, 0x9b, 0x84, 0xe0, 0x26, 0x74, 0xfd, 0xcb, 0xbe, 0xa3, 0xea, 0xcf, 0x75, 0xfd, + 0x51, 0x63, 0xea, 0xeb, 0xf9, 0x8e, 0xaa, 0x2f, 0x37, 0xf5, 0xd5, 0x76, 0xba, 0x7a, 0xe0, 0x3b, + 0xaa, 0x7a, 0x7c, 0x52, 0x3d, 0x6e, 0xaa, 0x57, 0xf1, 0x1d, 0x55, 0x3d, 0xae, 0xab, 0xf7, 0xa3, + 0x0d, 0xc5, 0x4f, 0x71, 0xd8, 0x8f, 0x24, 0x79, 0x02, 0xee, 0x39, 0x4b, 0x18, 0xc7, 0xca, 0xad, + 0x37, 0xb7, 0x1a, 0xba, 0x59, 0x35, 0x34, 0xdc, 0x78, 0xa5, 0x30, 0xaa, 0x29, 0x64, 0x57, 0xf9, + 0x69, 0xb6, 0x3a, 0xbc, 0x65, 0xec, 0x22, 0xc7, 0xbf, 0xe4, 0x31, 0x14, 0x05, 0x36, 0x15, 0x7c, + 0x8b, 0x2a, 0xcd, 0xf5, 0x9c, 0xad, 0x5b, 0x0d, 0x35, 0x28, 0xf9, 0xb3, 0x3e, 0x10, 0x64, 0xaa, + 0x7d, 0x2e, 0x32, 0xd5, 0x01, 0x19, 0x6a, 0x89, 0xeb, 0x02, 0x57, 0xb7, 0xd0, 0x73, 0x23, 0x67, + 0x9a, 0xba, 0xd3, 0x1c, 0x27, 0x7f, 0x01, 0x8f, 0x77, 0x72, 0xf2, 0x1d, 0xb4, 0x5d, 0x20, 0x97, + 0xb9, 0xf9, 0x55, 0xfb, 0x23, 0xb8, 0x7a, 0xd3, 0x25, 0x70, 0xe8, 0xf1, 0xd1, 0xe6, 0x0a, 0xf1, + 0xc0, 0xfd, 0x3b, 0x3d, 0x3e, 0x3e, 0xd9, 0xb4, 0x48, 0x19, 0x0a, 0x87, 0xef, 0x3f, 0x1e, 0x6f, + 0xda, 0xb5, 0x6f, 0x6d, 0x28, 0x7c, 0x08, 0x06, 0x82, 0x3c, 0x87, 0x4a, 0x3a, 0xd5, 0xbd, 0x2c, + 0xf4, 0xff, 0x5d, 0xee, 0xaf, 0x28, 0x8d, 0x0f, 0x79, 0x2b, 0x3b, 0xce, 0x24, 0x1f, 0x51, 0x2f, + 0x1d, 0xb7, 0xb6, 0x97, 0xb0, 0x96, 0x62, 0x36, 0xf3, 0xa7, 0xb6, 0x51, 0xfe, 0xfb, 0x59, 0xb9, + 0xca, 0xab, 0x7e, 0x6c, 0x6d, 0x50, 0x49, 0x27, 0x33, 0x3b, 0x2f, 0x60, 0x7d, 0xd6, 0x9f, 0x6c, + 0x82, 0xf3, 0xdf, 0x68, 0x84, 0x65, 0x74, 0xa8, 0xfa, 0x49, 0xb6, 0xc0, 0xbd, 0x0c, 0x92, 0x61, + 0x84, 0xaf, 0x9f, 0x47, 0xf5, 0xe0, 0xc0, 0x7e, 0x66, 0xed, 0x9c, 0xc0, 0xe6, 0xbc, 0xfd, 0xb4, + 0xbe, 0xac, 0xf5, 0x8f, 0xa6, 0xf5, 0x8b, 0x45, 0x99, 0xf8, 0xd5, 0x7e, 0xb6, 0x60, 0xf5, 0x83, + 0xe8, 0x7f, 0x8a, 0xe5, 0xc5, 0x3f, 0xb3, 0x88, 0xf5, 0xc8, 0x5d, 0x70, 0x65, 0x2c, 0x93, 0x08, + 0xed, 0xbc, 0x37, 0x2b, 0x54, 0x0f, 0x49, 0x15, 0x8a, 0x22, 0x48, 0x02, 0x3e, 0x42, 0x4f, 0xe7, + 0xcd, 0x0a, 0x35, 0x63, 0xb2, 0x03, 0xa5, 0x57, 0x6c, 0xa8, 0x76, 0x82, 0x6d, 0x41, 0x69, 0xf2, + 0x09, 0xf2, 0x10, 0x56, 0x2f, 0x58, 0x1a, 0x75, 0x82, 0x30, 0xe4, 0x91, 0x10, 0xd8, 0x21, 0x14, + 0xa1, 0xa2, 0x66, 0x5f, 0xea, 0x49, 0x72, 0x0c, 0xb7, 0x52, 0xd1, 0xef, 0x5c, 0xc5, 0xf2, 0xa2, + 0xc3, 0xa3, 0xff, 0x0d, 0x63, 0x1e, 0x85, 0xd8, 0x35, 0x2a, 0xcd, 0x7b, 0xe3, 0x83, 0xd5, 0x7b, + 0xa4, 0x06, 0x7e, 0xb3, 0x42, 0x37, 0xd2, 0xd9, 0xa9, 0xc3, 0x12, 0xb8, 0xc3, 0x2c, 0x66, 0x59, + 0xed, 0x31, 0x14, 0x68, 0x14, 0x24, 0x93, 0x53, 0xb4, 0x74, 0xab, 0xc1, 0xc1, 0x93, 0x72, 0x39, + 0xdc, 0xbc, 0xbe, 0xbe, 0xbe, 0xb6, 0x6b, 0x57, 0x6a, 0xe3, 0xea, 0x40, 0xbe, 0x90, 0xfb, 0xe0, + 0xc5, 0x69, 0xd0, 0x8f, 0x33, 0xf5, 0x80, 0x9a, 0x3e, 0x99, 0x98, 0x48, 0x9a, 0x47, 0xb0, 0xce, + 0xa3, 0x20, 0xe9, 0x44, 0x5f, 0x64, 0x94, 0x89, 0x98, 0x65, 0x64, 0x75, 0x92, 0xcc, 0x20, 0xa9, + 0xfe, 0x7f, 0x36, 0xda, 0xc6, 0x9e, 0xae, 0x29, 0xd1, 0x71, 0xae, 0xa9, 0xfd, 0xe4, 0x02, 0xbc, + 0xcb, 0xd8, 0x55, 0x76, 0x36, 0x1a, 0x44, 0x82, 0x3c, 0x02, 0x3b, 0xc8, 0xf0, 0xda, 0xa8, 0x34, + 0xb7, 0x1a, 0xfa, 0xc2, 0x6f, 0xe4, 0x17, 0x7e, 0xe3, 0x65, 0x36, 0xa2, 0x76, 0x90, 0x91, 0xa7, + 0xe0, 0x84, 0x43, 0xfd, 0xb2, 0x57, 0x9a, 0xdb, 0x0b, 0xb4, 0x23, 0xf3, 0xd9, 0x41, 0x15, 0x8b, + 0xfc, 0x09, 0x6c, 0x21, 0xf1, 0x16, 0x53, 0x67, 0x38, 0xcf, 0x3d, 0xc5, 0x4f, 0x10, 0x6a, 0x0b, + 0xd5, 0x44, 0x6c, 0x29, 0x4c, 0x4c, 0x76, 0x16, 0x88, 0x67, 0xf9, 0xd7, 0x08, 0xb5, 0xa5, 0x50, + 0xdc, 0xe4, 0x12, 0x6f, 0xb0, 0x9b, 0xb8, 0xef, 0x63, 0x21, 0xff, 0xad, 0x4e, 0x98, 0xda, 0xc9, + 0x25, 0xa9, 0x83, 0x73, 0x19, 0x24, 0x78, 0xa3, 0x55, 0x9a, 0x77, 0x17, 0xc8, 0x9a, 0xa8, 0x28, + 0xa4, 0x01, 0x4e, 0xd8, 0x4d, 0x30, 0x3a, 0x95, 0xe6, 0xfd, 0xc5, 0xe7, 0xc2, 0x5e, 0x69, 0xf8, + 0x61, 0x37, 0x21, 0xbb, 0xe0, 0xf4, 0x12, 0x89, 0x49, 0x52, 0xef, 0xed, 0x3c, 0x1f, 0xbb, 0xae, + 0xa1, 0xf7, 0x12, 0xa9, 0xe8, 0x31, 0x36, 0xf9, 0x9b, 0xe9, 0xf8, 0x26, 0x1a, 0x7a, 0xdc, 0x6e, + 0xa9, 0xdd, 0x0c, 0xdb, 0x2d, 0xbc, 0x9c, 0x6e, 0xda, 0xcd, 0xc7, 0x69, 0xfe, 0xb0, 0xdd, 0x42, + 0xfb, 0xfd, 0x26, 0x7e, 0xc7, 0x2c, 0xb1, 0xdf, 0x6f, 0xe6, 0xf6, 0xfb, 0x4d, 0xb4, 0xdf, 0x6f, + 0xe2, 0x87, 0xcd, 0x32, 0xfb, 0x31, 0x7f, 0x88, 0xfc, 0x02, 0xde, 0x84, 0xde, 0x92, 0x43, 0x57, + 0xad, 0x40, 0xd3, 0x91, 0xa7, 0xfc, 0x55, 0x53, 0x83, 0x25, 0xfe, 0xfa, 0x76, 0x31, 0xfe, 0x42, + 0x72, 0xf2, 0x57, 0x70, 0xf3, 0x5b, 0xe6, 0xe6, 0x07, 0xc0, 0x5b, 0x47, 0x0b, 0x34, 0xb3, 0xf6, + 0x10, 0x36, 0xe6, 0x5e, 0x46, 0xd5, 0x80, 0x74, 0x2b, 0xb5, 0xeb, 0x1e, 0xfa, 0xd6, 0xbe, 0xb3, + 0xe1, 0x9e, 0x61, 0xbd, 0xcd, 0xc2, 0x98, 0x47, 0xe7, 0x72, 0xcc, 0x7e, 0x0a, 0x05, 0x31, 0xec, + 0xa6, 0x26, 0xc9, 0xcb, 0xde, 0x70, 0x8a, 0x24, 0xf2, 0x0f, 0xf0, 0xd2, 0x60, 0xd0, 0xe9, 0xc5, + 0x51, 0x12, 0x9a, 0x66, 0xbb, 0x3b, 0xa7, 0x98, 0x5f, 0x40, 0x35, 0xe1, 0xd7, 0x8a, 0xaf, 0x9b, + 0x6f, 0x39, 0x35, 0x43, 0xf2, 0x0c, 0x2a, 0x22, 0x89, 0xcf, 0x23, 0xe3, 0xe6, 0xa0, 0xdb, 0xd2, + 0xf5, 0x01, 0xb9, 0xa8, 0xdc, 0x39, 0x83, 0xb5, 0x19, 0xd3, 0xe9, 0x96, 0xeb, 0xe9, 0x96, 0xbb, + 0x3b, 0xdb, 0x72, 0x97, 0xda, 0x4e, 0xf5, 0xde, 0x27, 0xb0, 0x35, 0x87, 0xe2, 0x69, 0x13, 0x02, + 0x85, 0xee, 0x48, 0x0a, 0x3c, 0xcf, 0x55, 0x8a, 0xbf, 0x6b, 0x47, 0x40, 0xe6, 0xb8, 0x9f, 0xde, + 0x9d, 0xe5, 0xe5, 0x56, 0xc4, 0xdf, 0x52, 0xee, 0x03, 0x1f, 0x0a, 0x59, 0x90, 0x46, 0x73, 0x4d, + 0xeb, 0x2b, 0x7c, 0x0a, 0x44, 0x0e, 0xfe, 0x06, 0x85, 0xe8, 0x8b, 0x4c, 0xe7, 0x18, 0x5f, 0xff, + 0x4a, 0xa9, 0x94, 0xe4, 0xf0, 0xc5, 0x7f, 0x0e, 0xfa, 0xb1, 0xbc, 0x18, 0x76, 0x1b, 0xe7, 0x2c, + 0xdd, 0xeb, 0xb3, 0x24, 0xc8, 0xfa, 0x93, 0xff, 0x5b, 0xb4, 0x74, 0x6f, 0xe1, 0xdf, 0xae, 0xe7, + 0x7a, 0xe6, 0x97, 0x00, 0x00, 0x00, 0xff, 0xff, 0x66, 0xc2, 0xb5, 0xb6, 0x91, 0x0d, 0x00, 0x00, } diff --git a/proto/proto3_proto/proto3.pb.go b/proto/proto3_proto/proto3.pb.go index 11fde28170..4dd9476edf 100644 --- a/proto/proto3_proto/proto3.pb.go +++ b/proto/proto3_proto/proto3.pb.go @@ -4,15 +4,18 @@ package proto3_proto import ( + fmt "fmt" proto "github.com/golang/protobuf/proto" test_proto "github.com/golang/protobuf/proto/test_proto" - protoapi "github.com/golang/protobuf/protoapi" - protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" - protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" - known "github.com/golang/protobuf/v2/types/known" - reflect "reflect" + any "github.com/golang/protobuf/ptypes/any" + math "math" ) +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -28,13 +31,6 @@ const ( Message_BILL_BAILEY Message_Humour = 3 ) -func (e Message_Humour) Type() protoreflect.EnumType { - return xxx_File_proto3_proto_proto3_proto_enumTypes[0] -} -func (e Message_Humour) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - var Message_Humour_name = map[int32]string{ 0: "UNKNOWN", 1: "PUNS", @@ -54,7 +50,7 @@ func (x Message_Humour) String() string { } func (Message_Humour) EnumDescriptor() ([]byte, []int) { - return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{0, 0} + return fileDescriptor_1c50d9b824d4ac38, []int{0, 0} } type Message struct { @@ -72,8 +68,8 @@ type Message struct { Terrain map[string]*Nested `protobuf:"bytes,10,rep,name=terrain,proto3" json:"terrain,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Proto2Field *test_proto.SubDefaults `protobuf:"bytes,11,opt,name=proto2_field,json=proto2Field,proto3" json:"proto2_field,omitempty"` Proto2Value map[string]*test_proto.SubDefaults `protobuf:"bytes,13,rep,name=proto2_value,json=proto2Value,proto3" json:"proto2_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Anything *known.Any `protobuf:"bytes,14,opt,name=anything,proto3" json:"anything,omitempty"` - ManyThings []*known.Any `protobuf:"bytes,15,rep,name=many_things,json=manyThings,proto3" json:"many_things,omitempty"` + Anything *any.Any `protobuf:"bytes,14,opt,name=anything,proto3" json:"anything,omitempty"` + ManyThings []*any.Any `protobuf:"bytes,15,rep,name=many_things,json=manyThings,proto3" json:"many_things,omitempty"` Submessage *Message `protobuf:"bytes,17,opt,name=submessage,proto3" json:"submessage,omitempty"` Children []*Message `protobuf:"bytes,18,rep,name=children,proto3" json:"children,omitempty"` StringMap map[string]string `protobuf:"bytes,20,rep,name=string_map,json=stringMap,proto3" json:"string_map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` @@ -82,14 +78,11 @@ type Message struct { XXX_sizecache int32 `json:"-"` } -func (m *Message) ProtoReflect() protoreflect.Message { - return xxx_File_proto3_proto_proto3_proto_messageTypes[0].MessageOf(m) -} func (m *Message) Reset() { *m = Message{} } func (m *Message) String() string { return proto.CompactTextString(m) } func (*Message) ProtoMessage() {} func (*Message) Descriptor() ([]byte, []int) { - return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{0} + return fileDescriptor_1c50d9b824d4ac38, []int{0} } func (m *Message) XXX_Unmarshal(b []byte) error { @@ -208,14 +201,14 @@ func (m *Message) GetProto2Value() map[string]*test_proto.SubDefaults { return nil } -func (m *Message) GetAnything() *known.Any { +func (m *Message) GetAnything() *any.Any { if m != nil { return m.Anything } return nil } -func (m *Message) GetManyThings() []*known.Any { +func (m *Message) GetManyThings() []*any.Any { if m != nil { return m.ManyThings } @@ -251,14 +244,11 @@ type Nested struct { XXX_sizecache int32 `json:"-"` } -func (m *Nested) ProtoReflect() protoreflect.Message { - return xxx_File_proto3_proto_proto3_proto_messageTypes[1].MessageOf(m) -} func (m *Nested) Reset() { *m = Nested{} } func (m *Nested) String() string { return proto.CompactTextString(m) } func (*Nested) ProtoMessage() {} func (*Nested) Descriptor() ([]byte, []int) { - return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{1} + return fileDescriptor_1c50d9b824d4ac38, []int{1} } func (m *Nested) XXX_Unmarshal(b []byte) error { @@ -300,14 +290,11 @@ type MessageWithMap struct { XXX_sizecache int32 `json:"-"` } -func (m *MessageWithMap) ProtoReflect() protoreflect.Message { - return xxx_File_proto3_proto_proto3_proto_messageTypes[2].MessageOf(m) -} func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } func (*MessageWithMap) ProtoMessage() {} func (*MessageWithMap) Descriptor() ([]byte, []int) { - return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{2} + return fileDescriptor_1c50d9b824d4ac38, []int{2} } func (m *MessageWithMap) XXX_Unmarshal(b []byte) error { @@ -342,14 +329,11 @@ type IntMap struct { XXX_sizecache int32 `json:"-"` } -func (m *IntMap) ProtoReflect() protoreflect.Message { - return xxx_File_proto3_proto_proto3_proto_messageTypes[3].MessageOf(m) -} func (m *IntMap) Reset() { *m = IntMap{} } func (m *IntMap) String() string { return proto.CompactTextString(m) } func (*IntMap) ProtoMessage() {} func (*IntMap) Descriptor() ([]byte, []int) { - return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{3} + return fileDescriptor_1c50d9b824d4ac38, []int{3} } func (m *IntMap) XXX_Unmarshal(b []byte) error { @@ -384,14 +368,11 @@ type IntMaps struct { XXX_sizecache int32 `json:"-"` } -func (m *IntMaps) ProtoReflect() protoreflect.Message { - return xxx_File_proto3_proto_proto3_proto_messageTypes[4].MessageOf(m) -} func (m *IntMaps) Reset() { *m = IntMaps{} } func (m *IntMaps) String() string { return proto.CompactTextString(m) } func (*IntMaps) ProtoMessage() {} func (*IntMaps) Descriptor() ([]byte, []int) { - return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{4} + return fileDescriptor_1c50d9b824d4ac38, []int{4} } func (m *IntMaps) XXX_Unmarshal(b []byte) error { @@ -432,14 +413,11 @@ type TestUTF8 struct { XXX_sizecache int32 `json:"-"` } -func (m *TestUTF8) ProtoReflect() protoreflect.Message { - return xxx_File_proto3_proto_proto3_proto_messageTypes[5].MessageOf(m) -} func (m *TestUTF8) Reset() { *m = TestUTF8{} } func (m *TestUTF8) String() string { return proto.CompactTextString(m) } func (*TestUTF8) ProtoMessage() {} func (*TestUTF8) Descriptor() ([]byte, []int) { - return xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped, []int{5} + return fileDescriptor_1c50d9b824d4ac38, []int{5} } func (m *TestUTF8) XXX_Unmarshal(b []byte) error { @@ -520,7 +498,6 @@ func (*TestUTF8) XXX_OneofWrappers() []interface{} { } func init() { - proto.RegisterFile("proto3_proto/proto3.proto", xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped) proto.RegisterEnum("proto3_proto.Message_Humour", Message_Humour_name, Message_Humour_value) proto.RegisterType((*Message)(nil), "proto3_proto.Message") proto.RegisterMapType((map[string]*test_proto.SubDefaults)(nil), "proto3_proto.Message.Proto2ValueEntry") @@ -537,203 +514,66 @@ func init() { proto.RegisterMapType((map[int64]string)(nil), "proto3_proto.TestUTF8.MapValueEntry") } -var xxx_File_proto3_proto_proto3_proto_rawdesc = []byte{ - // 2036 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x19, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x86, 0x09, 0x0a, 0x07, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x08, 0x68, - 0x69, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x2e, 0x48, 0x75, 0x6d, 0x6f, 0x75, 0x72, 0x52, 0x08, 0x68, 0x69, 0x6c, - 0x61, 0x72, 0x69, 0x74, 0x79, 0x12, 0x20, 0x0a, 0x0c, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, - 0x69, 0x6e, 0x5f, 0x63, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x68, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x49, 0x6e, 0x43, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x21, 0x0a, 0x0c, 0x72, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x0b, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23, - 0x0a, 0x0d, 0x74, 0x72, 0x75, 0x65, 0x5f, 0x73, 0x63, 0x6f, 0x74, 0x73, 0x6d, 0x61, 0x6e, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x74, 0x72, 0x75, 0x65, 0x53, 0x63, 0x6f, 0x74, 0x73, - 0x6d, 0x61, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x02, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x73, - 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x13, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, - 0x73, 0x68, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, - 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x06, - 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x07, 0x72, 0x5f, 0x66, 0x75, 0x6e, 0x6e, - 0x79, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, - 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x48, - 0x75, 0x6d, 0x6f, 0x75, 0x72, 0x52, 0x06, 0x72, 0x46, 0x75, 0x6e, 0x6e, 0x79, 0x12, 0x3c, 0x0a, - 0x07, 0x74, 0x65, 0x72, 0x72, 0x61, 0x69, 0x6e, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x65, 0x72, 0x72, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x07, 0x74, 0x65, 0x72, 0x72, 0x61, 0x69, 0x6e, 0x12, 0x3a, 0x0a, 0x0c, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, - 0x75, 0x62, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x32, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x49, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x61, 0x6e, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x18, 0x0e, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x61, 0x6e, 0x79, 0x74, - 0x68, 0x69, 0x6e, 0x67, 0x12, 0x35, 0x0a, 0x0b, 0x6d, 0x61, 0x6e, 0x79, 0x5f, 0x74, 0x68, 0x69, - 0x6e, 0x67, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, - 0x0a, 0x6d, 0x61, 0x6e, 0x79, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x35, 0x0a, 0x0a, 0x73, - 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x12, 0x31, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x12, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x63, 0x68, 0x69, - 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x43, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, - 0x6d, 0x61, 0x70, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x09, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x1a, 0x50, 0x0a, 0x0c, 0x54, 0x65, - 0x72, 0x72, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, - 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x57, 0x0a, 0x10, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, - 0x75, 0x62, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3c, 0x0a, 0x0e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, - 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x22, 0x3f, 0x0a, 0x06, 0x48, 0x75, 0x6d, 0x6f, 0x75, 0x72, 0x12, 0x0b, 0x0a, - 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x50, 0x55, - 0x4e, 0x53, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x4c, 0x41, 0x50, 0x53, 0x54, 0x49, 0x43, - 0x4b, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x42, 0x49, 0x4c, 0x4c, 0x5f, 0x42, 0x41, 0x49, 0x4c, - 0x45, 0x59, 0x10, 0x03, 0x22, 0x32, 0x0a, 0x06, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x14, - 0x0a, 0x05, 0x62, 0x75, 0x6e, 0x6e, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, - 0x75, 0x6e, 0x6e, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x04, 0x63, 0x75, 0x74, 0x65, 0x22, 0xa2, 0x01, 0x0a, 0x0e, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x61, 0x70, 0x12, 0x50, 0x0a, 0x0c, 0x62, - 0x79, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x2d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x61, 0x70, 0x2e, - 0x42, 0x79, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x1a, 0x3e, 0x0a, - 0x10, 0x42, 0x79, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x71, 0x0a, - 0x06, 0x49, 0x6e, 0x74, 0x4d, 0x61, 0x70, 0x12, 0x2f, 0x0a, 0x03, 0x72, 0x74, 0x74, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x74, 0x4d, 0x61, 0x70, 0x2e, 0x52, 0x74, 0x74, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x03, 0x72, 0x74, 0x74, 0x1a, 0x36, 0x0a, 0x08, 0x52, 0x74, 0x74, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x22, 0x33, 0x0a, 0x07, 0x49, 0x6e, 0x74, 0x4d, 0x61, 0x70, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x6d, - 0x61, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x74, 0x4d, 0x61, 0x70, 0x52, - 0x04, 0x6d, 0x61, 0x70, 0x73, 0x22, 0xd3, 0x02, 0x0a, 0x08, 0x54, 0x65, 0x73, 0x74, 0x55, 0x54, - 0x46, 0x38, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x65, - 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x65, 0x63, 0x74, - 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x3b, 0x0a, 0x07, 0x6d, 0x61, - 0x70, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x55, - 0x54, 0x46, 0x38, 0x2e, 0x4d, 0x61, 0x70, 0x4b, 0x65, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x06, 0x6d, 0x61, 0x70, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x55, 0x54, - 0x46, 0x38, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x08, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x39, 0x0a, 0x0b, 0x4d, 0x61, - 0x70, 0x4b, 0x65, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x42, 0x2f, 0x5a, 0x2d, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var xxx_File_proto3_proto_proto3_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_proto3_proto_proto3_proto_rawdesc) - -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) - -var File_proto3_proto_proto3_proto protoreflect.FileDescriptor - -var xxx_File_proto3_proto_proto3_proto_enumTypes = make([]protoreflect.EnumType, 1) -var xxx_File_proto3_proto_proto3_proto_messageTypes = make([]protoimpl.MessageType, 13) -var xxx_File_proto3_proto_proto3_proto_goTypes = []interface{}{ - (Message_Humour)(0), // 0: proto3_proto.Message.Humour - (*Message)(nil), // 1: proto3_proto.Message - (*Nested)(nil), // 2: proto3_proto.Nested - (*MessageWithMap)(nil), // 3: proto3_proto.MessageWithMap - (*IntMap)(nil), // 4: proto3_proto.IntMap - (*IntMaps)(nil), // 5: proto3_proto.IntMaps - (*TestUTF8)(nil), // 6: proto3_proto.TestUTF8 - nil, // 7: proto3_proto.Message.TerrainEntry - nil, // 8: proto3_proto.Message.Proto2ValueEntry - nil, // 9: proto3_proto.Message.StringMapEntry - nil, // 10: proto3_proto.MessageWithMap.ByteMappingEntry - nil, // 11: proto3_proto.IntMap.RttEntry - nil, // 12: proto3_proto.TestUTF8.MapKeyEntry - nil, // 13: proto3_proto.TestUTF8.MapValueEntry - (*test_proto.SubDefaults)(nil), // 14: test_proto.SubDefaults - (*known.Any)(nil), // 15: google.protobuf.Any -} -var xxx_File_proto3_proto_proto3_proto_depIdxs = []int32{ - 0, // proto3_proto.Message.hilarity:type_name -> proto3_proto.Message.Humour - 2, // proto3_proto.Message.nested:type_name -> proto3_proto.Nested - 0, // proto3_proto.Message.r_funny:type_name -> proto3_proto.Message.Humour - 7, // proto3_proto.Message.terrain:type_name -> proto3_proto.Message.TerrainEntry - 14, // proto3_proto.Message.proto2_field:type_name -> test_proto.SubDefaults - 8, // proto3_proto.Message.proto2_value:type_name -> proto3_proto.Message.Proto2ValueEntry - 15, // proto3_proto.Message.anything:type_name -> google.protobuf.Any - 15, // proto3_proto.Message.many_things:type_name -> google.protobuf.Any - 1, // proto3_proto.Message.submessage:type_name -> proto3_proto.Message - 1, // proto3_proto.Message.children:type_name -> proto3_proto.Message - 9, // proto3_proto.Message.string_map:type_name -> proto3_proto.Message.StringMapEntry - 10, // proto3_proto.MessageWithMap.byte_mapping:type_name -> proto3_proto.MessageWithMap.ByteMappingEntry - 11, // proto3_proto.IntMap.rtt:type_name -> proto3_proto.IntMap.RttEntry - 4, // proto3_proto.IntMaps.maps:type_name -> proto3_proto.IntMap - 12, // proto3_proto.TestUTF8.map_key:type_name -> proto3_proto.TestUTF8.MapKeyEntry - 13, // proto3_proto.TestUTF8.map_value:type_name -> proto3_proto.TestUTF8.MapValueEntry - 2, // proto3_proto.Message.TerrainEntry.value:type_name -> proto3_proto.Nested - 14, // proto3_proto.Message.Proto2ValueEntry.value:type_name -> test_proto.SubDefaults -} - -func init() { xxx_File_proto3_proto_proto3_proto_init() } -func xxx_File_proto3_proto_proto3_proto_init() { - if File_proto3_proto_proto3_proto != nil { - return - } - messageTypes := make([]protoreflect.MessageType, 13) - File_proto3_proto_proto3_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_proto3_proto_proto3_proto_rawdesc, - GoTypes: xxx_File_proto3_proto_proto3_proto_goTypes, - DependencyIndexes: xxx_File_proto3_proto_proto3_proto_depIdxs, - EnumOutputTypes: xxx_File_proto3_proto_proto3_proto_enumTypes, - MessageOutputTypes: messageTypes, - }.Init() - messageGoTypes := xxx_File_proto3_proto_proto3_proto_goTypes[1:][:13] - for i, mt := range messageTypes { - xxx_File_proto3_proto_proto3_proto_messageTypes[i].GoType = reflect.TypeOf(messageGoTypes[i]) - xxx_File_proto3_proto_proto3_proto_messageTypes[i].PBType = mt - } - xxx_File_proto3_proto_proto3_proto_goTypes = nil - xxx_File_proto3_proto_proto3_proto_depIdxs = nil +func init() { proto.RegisterFile("proto3_proto/proto3.proto", fileDescriptor_1c50d9b824d4ac38) } + +var fileDescriptor_1c50d9b824d4ac38 = []byte{ + // 920 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xff, 0x6e, 0xe3, 0x44, + 0x10, 0x3e, 0xc7, 0xf9, 0xe1, 0x4c, 0x92, 0x5e, 0x58, 0x72, 0xc7, 0x5e, 0x00, 0xc9, 0x04, 0x84, + 0x2c, 0x44, 0x1d, 0xc8, 0xa9, 0xa8, 0xdc, 0x9d, 0x40, 0x4d, 0xb9, 0xea, 0xa2, 0x36, 0x21, 0x72, + 0x52, 0x2a, 0xf8, 0xc7, 0xda, 0xa4, 0x9b, 0xc4, 0x22, 0x5e, 0x07, 0xef, 0xfa, 0x24, 0xbf, 0x00, + 0x0f, 0xc2, 0x2b, 0xf1, 0x42, 0x68, 0x77, 0x9d, 0xd6, 0x39, 0xb9, 0xf4, 0xaf, 0xec, 0x7c, 0xf9, + 0x66, 0xbe, 0xd9, 0x99, 0xd9, 0x31, 0xbc, 0xd8, 0xc5, 0x91, 0x88, 0x5e, 0xfa, 0xea, 0xa7, 0xaf, + 0x0d, 0x57, 0xfd, 0xa0, 0x66, 0xfe, 0xaf, 0xee, 0x8b, 0x75, 0x14, 0xad, 0xb7, 0x54, 0x53, 0x16, + 0xc9, 0xaa, 0x4f, 0x58, 0xaa, 0x89, 0xdd, 0x67, 0x82, 0x72, 0x91, 0x45, 0x90, 0x47, 0x0d, 0xf7, + 0xfe, 0xae, 0x43, 0x6d, 0x4c, 0x39, 0x27, 0x6b, 0x8a, 0x10, 0x94, 0x19, 0x09, 0x29, 0x36, 0x6c, + 0xc3, 0xa9, 0x7b, 0xea, 0x8c, 0x4e, 0xc1, 0xda, 0x04, 0x5b, 0x12, 0x07, 0x22, 0xc5, 0x25, 0xdb, + 0x70, 0x8e, 0x06, 0x9f, 0xb9, 0x79, 0x49, 0x37, 0x73, 0x76, 0xdf, 0x25, 0x61, 0x94, 0xc4, 0xde, + 0x1d, 0x1b, 0xd9, 0xd0, 0xdc, 0xd0, 0x60, 0xbd, 0x11, 0x7e, 0xc0, 0xfc, 0x65, 0x88, 0x4d, 0xdb, + 0x70, 0x5a, 0x1e, 0x68, 0x6c, 0xc4, 0xce, 0x43, 0xa9, 0x77, 0x4b, 0x04, 0xc1, 0x65, 0xdb, 0x70, + 0x9a, 0x9e, 0x3a, 0xa3, 0x2f, 0xa0, 0x19, 0x53, 0x9e, 0x6c, 0x85, 0xbf, 0x8c, 0x12, 0x26, 0x70, + 0xcd, 0x36, 0x1c, 0xd3, 0x6b, 0x68, 0xec, 0x5c, 0x42, 0xe8, 0x4b, 0x68, 0x89, 0x38, 0xa1, 0x3e, + 0x5f, 0x46, 0x82, 0x87, 0x84, 0x61, 0xcb, 0x36, 0x1c, 0xcb, 0x6b, 0x4a, 0x70, 0x96, 0x61, 0xa8, + 0x03, 0x15, 0xbe, 0x8c, 0x62, 0x8a, 0xeb, 0xb6, 0xe1, 0x94, 0x3c, 0x6d, 0xa0, 0x36, 0x98, 0x7f, + 0xd2, 0x14, 0x57, 0x6c, 0xd3, 0x29, 0x7b, 0xf2, 0x88, 0x3e, 0x85, 0x3a, 0xdf, 0x44, 0xb1, 0xf0, + 0x25, 0xfe, 0xb1, 0x6d, 0x3a, 0x15, 0xcf, 0x52, 0xc0, 0x25, 0x4d, 0xd1, 0xb7, 0x50, 0x65, 0x94, + 0x0b, 0x7a, 0x8b, 0xab, 0xb6, 0xe1, 0x34, 0x06, 0x9d, 0xc3, 0xab, 0x4f, 0xd4, 0x7f, 0x5e, 0xc6, + 0x41, 0x27, 0x50, 0x8b, 0xfd, 0x55, 0xc2, 0x58, 0x8a, 0xdb, 0xb6, 0xf9, 0x68, 0xa5, 0xaa, 0xf1, + 0x85, 0xe4, 0xa2, 0x37, 0x50, 0x13, 0x34, 0x8e, 0x49, 0xc0, 0x30, 0xd8, 0xa6, 0xd3, 0x18, 0xf4, + 0x8a, 0xdd, 0xe6, 0x9a, 0xf4, 0x96, 0x89, 0x38, 0xf5, 0xf6, 0x2e, 0xe8, 0x15, 0xe8, 0x09, 0x18, + 0xf8, 0xab, 0x80, 0x6e, 0x6f, 0x71, 0x43, 0x25, 0xfa, 0x89, 0x7b, 0xdf, 0x6d, 0x77, 0x96, 0x2c, + 0x7e, 0xa1, 0x2b, 0x92, 0x6c, 0x05, 0xf7, 0x1a, 0x9a, 0x7c, 0x21, 0xb9, 0x68, 0x74, 0xe7, 0xfb, + 0x9e, 0x6c, 0x13, 0x8a, 0x5b, 0x4a, 0xfe, 0xeb, 0x62, 0xf9, 0xa9, 0x62, 0xfe, 0x26, 0x89, 0x3a, + 0x85, 0x2c, 0x94, 0x42, 0xd0, 0x77, 0x60, 0x11, 0x96, 0x8a, 0x4d, 0xc0, 0xd6, 0xf8, 0x28, 0xab, + 0x95, 0x9e, 0x45, 0x77, 0x3f, 0x8b, 0xee, 0x19, 0x4b, 0xbd, 0x3b, 0x16, 0x3a, 0x81, 0x46, 0x48, + 0x58, 0xea, 0x2b, 0x8b, 0xe3, 0xa7, 0x4a, 0xbb, 0xd8, 0x09, 0x24, 0x71, 0xae, 0x78, 0xe8, 0x04, + 0x80, 0x27, 0x8b, 0x50, 0x27, 0x85, 0x3f, 0x52, 0x52, 0xcf, 0x0a, 0x33, 0xf6, 0x72, 0x44, 0xf4, + 0x3d, 0x58, 0xcb, 0x4d, 0xb0, 0xbd, 0x8d, 0x29, 0xc3, 0x48, 0x49, 0x3d, 0xe0, 0x74, 0x47, 0x43, + 0xe7, 0x00, 0x5c, 0xc4, 0x01, 0x5b, 0xfb, 0x21, 0xd9, 0xe1, 0x8e, 0x72, 0xfa, 0xaa, 0xb8, 0x36, + 0x33, 0xc5, 0x1b, 0x93, 0x9d, 0xae, 0x4c, 0x9d, 0xef, 0xed, 0xee, 0x14, 0x9a, 0xf9, 0xbe, 0xed, + 0x07, 0x50, 0xbf, 0x30, 0x35, 0x80, 0xdf, 0x40, 0x45, 0x57, 0xbf, 0xf4, 0x3f, 0x23, 0xa6, 0x29, + 0xaf, 0x4a, 0xa7, 0x46, 0xf7, 0x06, 0xda, 0x1f, 0xb6, 0xa2, 0x20, 0xea, 0xf1, 0x61, 0xd4, 0x07, + 0xe7, 0x21, 0x17, 0xf8, 0x0d, 0x1c, 0x1d, 0xde, 0xa3, 0x20, 0x6c, 0x27, 0x1f, 0xb6, 0x9e, 0xf3, + 0xee, 0xfd, 0x0c, 0x55, 0x3d, 0xd7, 0xa8, 0x01, 0xb5, 0xeb, 0xc9, 0xe5, 0xe4, 0xd7, 0x9b, 0x49, + 0xfb, 0x09, 0xb2, 0xa0, 0x3c, 0xbd, 0x9e, 0xcc, 0xda, 0x06, 0x6a, 0x41, 0x7d, 0x76, 0x75, 0x36, + 0x9d, 0xcd, 0x47, 0xe7, 0x97, 0xed, 0x12, 0x7a, 0x0a, 0x8d, 0xe1, 0xe8, 0xea, 0xca, 0x1f, 0x9e, + 0x8d, 0xae, 0xde, 0xfe, 0xde, 0x36, 0x7b, 0x03, 0xa8, 0xea, 0xcb, 0x4a, 0x91, 0x85, 0x7a, 0x45, + 0x5a, 0x58, 0x1b, 0x72, 0x59, 0x2c, 0x13, 0xa1, 0x95, 0x2d, 0x4f, 0x9d, 0x7b, 0xff, 0x18, 0x70, + 0x94, 0xf5, 0xe0, 0x26, 0x10, 0x9b, 0x31, 0xd9, 0xa1, 0x29, 0x34, 0x17, 0xa9, 0xa0, 0xb2, 0x67, + 0x3b, 0x39, 0x8c, 0x86, 0xea, 0xdb, 0x71, 0x61, 0xdf, 0x32, 0x1f, 0x77, 0x98, 0x0a, 0x3a, 0xd6, + 0xfc, 0x6c, 0xb4, 0x17, 0xf7, 0x48, 0xf7, 0x27, 0x68, 0x7f, 0x48, 0xc8, 0x57, 0xc6, 0x2a, 0xa8, + 0x4c, 0x33, 0x5f, 0x99, 0xbf, 0xa0, 0x3a, 0x62, 0x42, 0xe6, 0xd6, 0x07, 0x33, 0x16, 0x22, 0x4b, + 0xe9, 0xf3, 0xc3, 0x94, 0x34, 0xc5, 0xf5, 0x84, 0xd0, 0x29, 0x48, 0x66, 0xf7, 0x07, 0xb0, 0xf6, + 0x40, 0x5e, 0xb2, 0x52, 0x20, 0x59, 0xc9, 0x4b, 0xbe, 0x84, 0x9a, 0x8e, 0xc7, 0x91, 0x03, 0xe5, + 0x90, 0xec, 0x78, 0x26, 0xda, 0x29, 0x12, 0xf5, 0x14, 0xa3, 0xf7, 0x6f, 0x09, 0xac, 0x39, 0xe5, + 0xe2, 0x7a, 0x7e, 0x71, 0x8a, 0x9e, 0x43, 0x95, 0x2f, 0xc9, 0x96, 0xc4, 0x59, 0x13, 0x32, 0x4b, + 0xe2, 0xef, 0xe9, 0x52, 0x44, 0x31, 0x2e, 0xd9, 0xa6, 0xc4, 0xb5, 0x85, 0x9e, 0x43, 0x45, 0xef, + 0x1f, 0xb9, 0xe5, 0xeb, 0xef, 0x9e, 0x78, 0xda, 0x44, 0xaf, 0xa1, 0x16, 0x92, 0x9d, 0x5a, 0xae, + 0xe5, 0xa2, 0xe5, 0xb6, 0x17, 0x74, 0xc7, 0x64, 0x77, 0x49, 0x53, 0x7d, 0xf7, 0x6a, 0xa8, 0x0c, + 0x74, 0x06, 0x75, 0xe9, 0xac, 0x2f, 0x59, 0x29, 0x7a, 0x80, 0x79, 0xf7, 0xdc, 0x6a, 0xb2, 0xc2, + 0xcc, 0xec, 0xfe, 0x08, 0x8d, 0x5c, 0xe4, 0xc7, 0x26, 0xda, 0xcc, 0xbf, 0x87, 0xd7, 0xd0, 0x3a, + 0x88, 0x9a, 0x77, 0x36, 0x1f, 0x79, 0x0e, 0xc3, 0x1a, 0x54, 0x22, 0x46, 0xa3, 0xd5, 0xb0, 0xff, + 0xc7, 0xf1, 0x3a, 0x10, 0x9b, 0x64, 0xe1, 0x2e, 0xa3, 0xb0, 0xbf, 0x8e, 0xb6, 0x84, 0xad, 0xef, + 0x3f, 0xcf, 0xf9, 0x0f, 0xba, 0xbe, 0xd2, 0xa2, 0xaa, 0xad, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, + 0xae, 0xc1, 0x78, 0xeb, 0xf4, 0x07, 0x00, 0x00, } diff --git a/proto/test_proto/test.pb.go b/proto/test_proto/test.pb.go index 3bf88ca4f4..624e834a45 100644 --- a/proto/test_proto/test.pb.go +++ b/proto/test_proto/test.pb.go @@ -4,14 +4,16 @@ package test_proto import ( + fmt "fmt" proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" - protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" - protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" math "math" - reflect "reflect" ) +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the @@ -24,13 +26,6 @@ const ( FOO_FOO1 FOO = 1 ) -func (e FOO) Type() protoreflect.EnumType { - return xxx_File_test_proto_test_proto_enumTypes[0] -} -func (e FOO) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - var FOO_name = map[int32]string{ 1: "FOO1", } @@ -59,7 +54,7 @@ func (x *FOO) UnmarshalJSON(data []byte) error { } func (FOO) EnumDescriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{0} + return fileDescriptor_8ca34d01332f1402, []int{0} } // An enum, for completeness. @@ -85,13 +80,6 @@ const ( GoTest_FUNCTION GoTest_KIND = 12 ) -func (e GoTest_KIND) Type() protoreflect.EnumType { - return xxx_File_test_proto_test_proto_enumTypes[1] -} -func (e GoTest_KIND) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - var GoTest_KIND_name = map[int32]string{ 0: "VOID", 1: "BOOL", @@ -144,7 +132,7 @@ func (x *GoTest_KIND) UnmarshalJSON(data []byte) error { } func (GoTest_KIND) EnumDescriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{2, 0} + return fileDescriptor_8ca34d01332f1402, []int{2, 0} } type MyMessage_Color int32 @@ -155,13 +143,6 @@ const ( MyMessage_BLUE MyMessage_Color = 2 ) -func (e MyMessage_Color) Type() protoreflect.EnumType { - return xxx_File_test_proto_test_proto_enumTypes[2] -} -func (e MyMessage_Color) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - var MyMessage_Color_name = map[int32]string{ 0: "RED", 1: "GREEN", @@ -194,7 +175,7 @@ func (x *MyMessage_Color) UnmarshalJSON(data []byte) error { } func (MyMessage_Color) EnumDescriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{13, 0} + return fileDescriptor_8ca34d01332f1402, []int{13, 0} } type DefaultsMessage_DefaultsEnum int32 @@ -205,13 +186,6 @@ const ( DefaultsMessage_TWO DefaultsMessage_DefaultsEnum = 2 ) -func (e DefaultsMessage_DefaultsEnum) Type() protoreflect.EnumType { - return xxx_File_test_proto_test_proto_enumTypes[3] -} -func (e DefaultsMessage_DefaultsEnum) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - var DefaultsMessage_DefaultsEnum_name = map[int32]string{ 0: "ZERO", 1: "ONE", @@ -244,7 +218,7 @@ func (x *DefaultsMessage_DefaultsEnum) UnmarshalJSON(data []byte) error { } func (DefaultsMessage_DefaultsEnum) EnumDescriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{16, 0} + return fileDescriptor_8ca34d01332f1402, []int{16, 0} } type Defaults_Color int32 @@ -255,13 +229,6 @@ const ( Defaults_BLUE Defaults_Color = 2 ) -func (e Defaults_Color) Type() protoreflect.EnumType { - return xxx_File_test_proto_test_proto_enumTypes[4] -} -func (e Defaults_Color) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - var Defaults_Color_name = map[int32]string{ 0: "RED", 1: "GREEN", @@ -294,7 +261,7 @@ func (x *Defaults_Color) UnmarshalJSON(data []byte) error { } func (Defaults_Color) EnumDescriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{21, 0} + return fileDescriptor_8ca34d01332f1402, []int{21, 0} } type RepeatedEnum_Color int32 @@ -303,13 +270,6 @@ const ( RepeatedEnum_RED RepeatedEnum_Color = 1 ) -func (e RepeatedEnum_Color) Type() protoreflect.EnumType { - return xxx_File_test_proto_test_proto_enumTypes[5] -} -func (e RepeatedEnum_Color) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(e) -} - var RepeatedEnum_Color_name = map[int32]string{ 1: "RED", } @@ -338,7 +298,7 @@ func (x *RepeatedEnum_Color) UnmarshalJSON(data []byte) error { } func (RepeatedEnum_Color) EnumDescriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{23, 0} + return fileDescriptor_8ca34d01332f1402, []int{23, 0} } type GoEnum struct { @@ -348,14 +308,11 @@ type GoEnum struct { XXX_sizecache int32 `json:"-"` } -func (m *GoEnum) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[0].MessageOf(m) -} func (m *GoEnum) Reset() { *m = GoEnum{} } func (m *GoEnum) String() string { return proto.CompactTextString(m) } func (*GoEnum) ProtoMessage() {} func (*GoEnum) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{0} + return fileDescriptor_8ca34d01332f1402, []int{0} } func (m *GoEnum) XXX_Unmarshal(b []byte) error { @@ -391,14 +348,11 @@ type GoTestField struct { XXX_sizecache int32 `json:"-"` } -func (m *GoTestField) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[1].MessageOf(m) -} func (m *GoTestField) Reset() { *m = GoTestField{} } func (m *GoTestField) String() string { return proto.CompactTextString(m) } func (*GoTestField) ProtoMessage() {} func (*GoTestField) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{1} + return fileDescriptor_8ca34d01332f1402, []int{1} } func (m *GoTestField) XXX_Unmarshal(b []byte) error { @@ -528,14 +482,11 @@ type GoTest struct { XXX_sizecache int32 `json:"-"` } -func (m *GoTest) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[2].MessageOf(m) -} func (m *GoTest) Reset() { *m = GoTest{} } func (m *GoTest) String() string { return proto.CompactTextString(m) } func (*GoTest) ProtoMessage() {} func (*GoTest) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{2} + return fileDescriptor_8ca34d01332f1402, []int{2} } func (m *GoTest) XXX_Unmarshal(b []byte) error { @@ -1148,6 +1099,124 @@ func (m *GoTest) GetOptionalgroup() *GoTest_OptionalGroup { return nil } +// Required, repeated, and optional groups. +type GoTest_RequiredGroup struct { + RequiredField *string `protobuf:"bytes,71,req,name=RequiredField" json:"RequiredField,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTest_RequiredGroup) Reset() { *m = GoTest_RequiredGroup{} } +func (m *GoTest_RequiredGroup) String() string { return proto.CompactTextString(m) } +func (*GoTest_RequiredGroup) ProtoMessage() {} +func (*GoTest_RequiredGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{2, 0} +} + +func (m *GoTest_RequiredGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTest_RequiredGroup.Unmarshal(m, b) +} +func (m *GoTest_RequiredGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTest_RequiredGroup.Marshal(b, m, deterministic) +} +func (m *GoTest_RequiredGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTest_RequiredGroup.Merge(m, src) +} +func (m *GoTest_RequiredGroup) XXX_Size() int { + return xxx_messageInfo_GoTest_RequiredGroup.Size(m) +} +func (m *GoTest_RequiredGroup) XXX_DiscardUnknown() { + xxx_messageInfo_GoTest_RequiredGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTest_RequiredGroup proto.InternalMessageInfo + +func (m *GoTest_RequiredGroup) GetRequiredField() string { + if m != nil && m.RequiredField != nil { + return *m.RequiredField + } + return "" +} + +type GoTest_RepeatedGroup struct { + RequiredField *string `protobuf:"bytes,81,req,name=RequiredField" json:"RequiredField,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTest_RepeatedGroup) Reset() { *m = GoTest_RepeatedGroup{} } +func (m *GoTest_RepeatedGroup) String() string { return proto.CompactTextString(m) } +func (*GoTest_RepeatedGroup) ProtoMessage() {} +func (*GoTest_RepeatedGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{2, 1} +} + +func (m *GoTest_RepeatedGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTest_RepeatedGroup.Unmarshal(m, b) +} +func (m *GoTest_RepeatedGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTest_RepeatedGroup.Marshal(b, m, deterministic) +} +func (m *GoTest_RepeatedGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTest_RepeatedGroup.Merge(m, src) +} +func (m *GoTest_RepeatedGroup) XXX_Size() int { + return xxx_messageInfo_GoTest_RepeatedGroup.Size(m) +} +func (m *GoTest_RepeatedGroup) XXX_DiscardUnknown() { + xxx_messageInfo_GoTest_RepeatedGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTest_RepeatedGroup proto.InternalMessageInfo + +func (m *GoTest_RepeatedGroup) GetRequiredField() string { + if m != nil && m.RequiredField != nil { + return *m.RequiredField + } + return "" +} + +type GoTest_OptionalGroup struct { + RequiredField *string `protobuf:"bytes,91,req,name=RequiredField" json:"RequiredField,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTest_OptionalGroup) Reset() { *m = GoTest_OptionalGroup{} } +func (m *GoTest_OptionalGroup) String() string { return proto.CompactTextString(m) } +func (*GoTest_OptionalGroup) ProtoMessage() {} +func (*GoTest_OptionalGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{2, 2} +} + +func (m *GoTest_OptionalGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTest_OptionalGroup.Unmarshal(m, b) +} +func (m *GoTest_OptionalGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTest_OptionalGroup.Marshal(b, m, deterministic) +} +func (m *GoTest_OptionalGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTest_OptionalGroup.Merge(m, src) +} +func (m *GoTest_OptionalGroup) XXX_Size() int { + return xxx_messageInfo_GoTest_OptionalGroup.Size(m) +} +func (m *GoTest_OptionalGroup) XXX_DiscardUnknown() { + xxx_messageInfo_GoTest_OptionalGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTest_OptionalGroup proto.InternalMessageInfo + +func (m *GoTest_OptionalGroup) GetRequiredField() string { + if m != nil && m.RequiredField != nil { + return *m.RequiredField + } + return "" +} + // For testing a group containing a required field. type GoTestRequiredGroupField struct { Group *GoTestRequiredGroupField_Group `protobuf:"group,1,req,name=Group,json=group" json:"group,omitempty"` @@ -1156,14 +1225,11 @@ type GoTestRequiredGroupField struct { XXX_sizecache int32 `json:"-"` } -func (m *GoTestRequiredGroupField) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[3].MessageOf(m) -} func (m *GoTestRequiredGroupField) Reset() { *m = GoTestRequiredGroupField{} } func (m *GoTestRequiredGroupField) String() string { return proto.CompactTextString(m) } func (*GoTestRequiredGroupField) ProtoMessage() {} func (*GoTestRequiredGroupField) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{3} + return fileDescriptor_8ca34d01332f1402, []int{3} } func (m *GoTestRequiredGroupField) XXX_Unmarshal(b []byte) error { @@ -1191,6 +1257,45 @@ func (m *GoTestRequiredGroupField) GetGroup() *GoTestRequiredGroupField_Group { return nil } +type GoTestRequiredGroupField_Group struct { + Field *int32 `protobuf:"varint,2,req,name=Field" json:"Field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTestRequiredGroupField_Group) Reset() { *m = GoTestRequiredGroupField_Group{} } +func (m *GoTestRequiredGroupField_Group) String() string { return proto.CompactTextString(m) } +func (*GoTestRequiredGroupField_Group) ProtoMessage() {} +func (*GoTestRequiredGroupField_Group) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{3, 0} +} + +func (m *GoTestRequiredGroupField_Group) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTestRequiredGroupField_Group.Unmarshal(m, b) +} +func (m *GoTestRequiredGroupField_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTestRequiredGroupField_Group.Marshal(b, m, deterministic) +} +func (m *GoTestRequiredGroupField_Group) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTestRequiredGroupField_Group.Merge(m, src) +} +func (m *GoTestRequiredGroupField_Group) XXX_Size() int { + return xxx_messageInfo_GoTestRequiredGroupField_Group.Size(m) +} +func (m *GoTestRequiredGroupField_Group) XXX_DiscardUnknown() { + xxx_messageInfo_GoTestRequiredGroupField_Group.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTestRequiredGroupField_Group proto.InternalMessageInfo + +func (m *GoTestRequiredGroupField_Group) GetField() int32 { + if m != nil && m.Field != nil { + return *m.Field + } + return 0 +} + // For testing skipping of unrecognized fields. // Numbers are all big, larger than tag numbers in GoTestField, // the message used in the corresponding test. @@ -1205,14 +1310,11 @@ type GoSkipTest struct { XXX_sizecache int32 `json:"-"` } -func (m *GoSkipTest) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[4].MessageOf(m) -} func (m *GoSkipTest) Reset() { *m = GoSkipTest{} } func (m *GoSkipTest) String() string { return proto.CompactTextString(m) } func (*GoSkipTest) ProtoMessage() {} func (*GoSkipTest) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{4} + return fileDescriptor_8ca34d01332f1402, []int{4} } func (m *GoSkipTest) XXX_Unmarshal(b []byte) error { @@ -1268,6 +1370,53 @@ func (m *GoSkipTest) GetSkipgroup() *GoSkipTest_SkipGroup { return nil } +type GoSkipTest_SkipGroup struct { + GroupInt32 *int32 `protobuf:"varint,16,req,name=group_int32,json=groupInt32" json:"group_int32,omitempty"` + GroupString *string `protobuf:"bytes,17,req,name=group_string,json=groupString" json:"group_string,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoSkipTest_SkipGroup) Reset() { *m = GoSkipTest_SkipGroup{} } +func (m *GoSkipTest_SkipGroup) String() string { return proto.CompactTextString(m) } +func (*GoSkipTest_SkipGroup) ProtoMessage() {} +func (*GoSkipTest_SkipGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{4, 0} +} + +func (m *GoSkipTest_SkipGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoSkipTest_SkipGroup.Unmarshal(m, b) +} +func (m *GoSkipTest_SkipGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoSkipTest_SkipGroup.Marshal(b, m, deterministic) +} +func (m *GoSkipTest_SkipGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoSkipTest_SkipGroup.Merge(m, src) +} +func (m *GoSkipTest_SkipGroup) XXX_Size() int { + return xxx_messageInfo_GoSkipTest_SkipGroup.Size(m) +} +func (m *GoSkipTest_SkipGroup) XXX_DiscardUnknown() { + xxx_messageInfo_GoSkipTest_SkipGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_GoSkipTest_SkipGroup proto.InternalMessageInfo + +func (m *GoSkipTest_SkipGroup) GetGroupInt32() int32 { + if m != nil && m.GroupInt32 != nil { + return *m.GroupInt32 + } + return 0 +} + +func (m *GoSkipTest_SkipGroup) GetGroupString() string { + if m != nil && m.GroupString != nil { + return *m.GroupString + } + return "" +} + // For testing packed/non-packed decoder switching. // A serialized instance of one should be deserializable as the other. type NonPackedTest struct { @@ -1277,14 +1426,11 @@ type NonPackedTest struct { XXX_sizecache int32 `json:"-"` } -func (m *NonPackedTest) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[5].MessageOf(m) -} func (m *NonPackedTest) Reset() { *m = NonPackedTest{} } func (m *NonPackedTest) String() string { return proto.CompactTextString(m) } func (*NonPackedTest) ProtoMessage() {} func (*NonPackedTest) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{5} + return fileDescriptor_8ca34d01332f1402, []int{5} } func (m *NonPackedTest) XXX_Unmarshal(b []byte) error { @@ -1319,14 +1465,11 @@ type PackedTest struct { XXX_sizecache int32 `json:"-"` } -func (m *PackedTest) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[6].MessageOf(m) -} func (m *PackedTest) Reset() { *m = PackedTest{} } func (m *PackedTest) String() string { return proto.CompactTextString(m) } func (*PackedTest) ProtoMessage() {} func (*PackedTest) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{6} + return fileDescriptor_8ca34d01332f1402, []int{6} } func (m *PackedTest) XXX_Unmarshal(b []byte) error { @@ -1362,14 +1505,11 @@ type MaxTag struct { XXX_sizecache int32 `json:"-"` } -func (m *MaxTag) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[7].MessageOf(m) -} func (m *MaxTag) Reset() { *m = MaxTag{} } func (m *MaxTag) String() string { return proto.CompactTextString(m) } func (*MaxTag) ProtoMessage() {} func (*MaxTag) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{7} + return fileDescriptor_8ca34d01332f1402, []int{7} } func (m *MaxTag) XXX_Unmarshal(b []byte) error { @@ -1405,14 +1545,11 @@ type OldMessage struct { XXX_sizecache int32 `json:"-"` } -func (m *OldMessage) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[8].MessageOf(m) -} func (m *OldMessage) Reset() { *m = OldMessage{} } func (m *OldMessage) String() string { return proto.CompactTextString(m) } func (*OldMessage) ProtoMessage() {} func (*OldMessage) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{8} + return fileDescriptor_8ca34d01332f1402, []int{8} } func (m *OldMessage) XXX_Unmarshal(b []byte) error { @@ -1447,35 +1584,71 @@ func (m *OldMessage) GetNum() int32 { return 0 } -// NewMessage is wire compatible with OldMessage; -// imagine it as a future version. -type NewMessage struct { - Nested *NewMessage_Nested `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` - // This is an int32 in OldMessage. - Num *int64 `protobuf:"varint,2,opt,name=num" json:"num,omitempty"` +type OldMessage_Nested struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *NewMessage) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[9].MessageOf(m) -} -func (m *NewMessage) Reset() { *m = NewMessage{} } -func (m *NewMessage) String() string { return proto.CompactTextString(m) } -func (*NewMessage) ProtoMessage() {} -func (*NewMessage) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{9} +func (m *OldMessage_Nested) Reset() { *m = OldMessage_Nested{} } +func (m *OldMessage_Nested) String() string { return proto.CompactTextString(m) } +func (*OldMessage_Nested) ProtoMessage() {} +func (*OldMessage_Nested) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{8, 0} } -func (m *NewMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NewMessage.Unmarshal(m, b) +func (m *OldMessage_Nested) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OldMessage_Nested.Unmarshal(m, b) } -func (m *NewMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NewMessage.Marshal(b, m, deterministic) +func (m *OldMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OldMessage_Nested.Marshal(b, m, deterministic) } -func (m *NewMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_NewMessage.Merge(m, src) +func (m *OldMessage_Nested) XXX_Merge(src proto.Message) { + xxx_messageInfo_OldMessage_Nested.Merge(m, src) +} +func (m *OldMessage_Nested) XXX_Size() int { + return xxx_messageInfo_OldMessage_Nested.Size(m) +} +func (m *OldMessage_Nested) XXX_DiscardUnknown() { + xxx_messageInfo_OldMessage_Nested.DiscardUnknown(m) +} + +var xxx_messageInfo_OldMessage_Nested proto.InternalMessageInfo + +func (m *OldMessage_Nested) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +// NewMessage is wire compatible with OldMessage; +// imagine it as a future version. +type NewMessage struct { + Nested *NewMessage_Nested `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` + // This is an int32 in OldMessage. + Num *int64 `protobuf:"varint,2,opt,name=num" json:"num,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NewMessage) Reset() { *m = NewMessage{} } +func (m *NewMessage) String() string { return proto.CompactTextString(m) } +func (*NewMessage) ProtoMessage() {} +func (*NewMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{9} +} + +func (m *NewMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NewMessage.Unmarshal(m, b) +} +func (m *NewMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NewMessage.Marshal(b, m, deterministic) +} +func (m *NewMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_NewMessage.Merge(m, src) } func (m *NewMessage) XXX_Size() int { return xxx_messageInfo_NewMessage.Size(m) @@ -1500,6 +1673,53 @@ func (m *NewMessage) GetNum() int64 { return 0 } +type NewMessage_Nested struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + FoodGroup *string `protobuf:"bytes,2,opt,name=food_group,json=foodGroup" json:"food_group,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NewMessage_Nested) Reset() { *m = NewMessage_Nested{} } +func (m *NewMessage_Nested) String() string { return proto.CompactTextString(m) } +func (*NewMessage_Nested) ProtoMessage() {} +func (*NewMessage_Nested) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{9, 0} +} + +func (m *NewMessage_Nested) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NewMessage_Nested.Unmarshal(m, b) +} +func (m *NewMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NewMessage_Nested.Marshal(b, m, deterministic) +} +func (m *NewMessage_Nested) XXX_Merge(src proto.Message) { + xxx_messageInfo_NewMessage_Nested.Merge(m, src) +} +func (m *NewMessage_Nested) XXX_Size() int { + return xxx_messageInfo_NewMessage_Nested.Size(m) +} +func (m *NewMessage_Nested) XXX_DiscardUnknown() { + xxx_messageInfo_NewMessage_Nested.DiscardUnknown(m) +} + +var xxx_messageInfo_NewMessage_Nested proto.InternalMessageInfo + +func (m *NewMessage_Nested) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *NewMessage_Nested) GetFoodGroup() string { + if m != nil && m.FoodGroup != nil { + return *m.FoodGroup + } + return "" +} + type InnerMessage struct { Host *string `protobuf:"bytes,1,req,name=host" json:"host,omitempty"` Port *int32 `protobuf:"varint,2,opt,name=port,def=4000" json:"port,omitempty"` @@ -1509,14 +1729,11 @@ type InnerMessage struct { XXX_sizecache int32 `json:"-"` } -func (m *InnerMessage) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[10].MessageOf(m) -} func (m *InnerMessage) Reset() { *m = InnerMessage{} } func (m *InnerMessage) String() string { return proto.CompactTextString(m) } func (*InnerMessage) ProtoMessage() {} func (*InnerMessage) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{10} + return fileDescriptor_8ca34d01332f1402, []int{10} } func (m *InnerMessage) XXX_Unmarshal(b []byte) error { @@ -1571,14 +1788,11 @@ type OtherMessage struct { XXX_sizecache int32 `json:"-"` } -func (m *OtherMessage) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[11].MessageOf(m) -} func (m *OtherMessage) Reset() { *m = OtherMessage{} } func (m *OtherMessage) String() string { return proto.CompactTextString(m) } func (*OtherMessage) ProtoMessage() {} func (*OtherMessage) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{11} + return fileDescriptor_8ca34d01332f1402, []int{11} } var extRange_OtherMessage = []proto.ExtensionRange{ @@ -1642,14 +1856,11 @@ type RequiredInnerMessage struct { XXX_sizecache int32 `json:"-"` } -func (m *RequiredInnerMessage) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[12].MessageOf(m) -} func (m *RequiredInnerMessage) Reset() { *m = RequiredInnerMessage{} } func (m *RequiredInnerMessage) String() string { return proto.CompactTextString(m) } func (*RequiredInnerMessage) ProtoMessage() {} func (*RequiredInnerMessage) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{12} + return fileDescriptor_8ca34d01332f1402, []int{12} } func (m *RequiredInnerMessage) XXX_Unmarshal(b []byte) error { @@ -1697,14 +1908,11 @@ type MyMessage struct { XXX_sizecache int32 `json:"-"` } -func (m *MyMessage) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[13].MessageOf(m) -} func (m *MyMessage) Reset() { *m = MyMessage{} } func (m *MyMessage) String() string { return proto.CompactTextString(m) } func (*MyMessage) ProtoMessage() {} func (*MyMessage) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{13} + return fileDescriptor_8ca34d01332f1402, []int{13} } var extRange_MyMessage = []proto.ExtensionRange{ @@ -1817,6 +2025,45 @@ func (m *MyMessage) GetBigfloat() float64 { return 0 } +type MyMessage_SomeGroup struct { + GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MyMessage_SomeGroup) Reset() { *m = MyMessage_SomeGroup{} } +func (m *MyMessage_SomeGroup) String() string { return proto.CompactTextString(m) } +func (*MyMessage_SomeGroup) ProtoMessage() {} +func (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{13, 0} +} + +func (m *MyMessage_SomeGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MyMessage_SomeGroup.Unmarshal(m, b) +} +func (m *MyMessage_SomeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MyMessage_SomeGroup.Marshal(b, m, deterministic) +} +func (m *MyMessage_SomeGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_MyMessage_SomeGroup.Merge(m, src) +} +func (m *MyMessage_SomeGroup) XXX_Size() int { + return xxx_messageInfo_MyMessage_SomeGroup.Size(m) +} +func (m *MyMessage_SomeGroup) XXX_DiscardUnknown() { + xxx_messageInfo_MyMessage_SomeGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_MyMessage_SomeGroup proto.InternalMessageInfo + +func (m *MyMessage_SomeGroup) GetGroupField() int32 { + if m != nil && m.GroupField != nil { + return *m.GroupField + } + return 0 +} + type Ext struct { Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` MapField map[int32]int32 `protobuf:"bytes,2,rep,name=map_field,json=mapField" json:"map_field,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` @@ -1825,14 +2072,11 @@ type Ext struct { XXX_sizecache int32 `json:"-"` } -func (m *Ext) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[14].MessageOf(m) -} func (m *Ext) Reset() { *m = Ext{} } func (m *Ext) String() string { return proto.CompactTextString(m) } func (*Ext) ProtoMessage() {} func (*Ext) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{14} + return fileDescriptor_8ca34d01332f1402, []int{14} } func (m *Ext) XXX_Unmarshal(b []byte) error { @@ -1867,6 +2111,33 @@ func (m *Ext) GetMapField() map[int32]int32 { return nil } +var E_Ext_More = &proto.ExtensionDesc{ + ExtendedType: (*MyMessage)(nil), + ExtensionType: (*Ext)(nil), + Field: 103, + Name: "test_proto.Ext.more", + Tag: "bytes,103,opt,name=more", + Filename: "test_proto/test.proto", +} + +var E_Ext_Text = &proto.ExtensionDesc{ + ExtendedType: (*MyMessage)(nil), + ExtensionType: (*string)(nil), + Field: 104, + Name: "test_proto.Ext.text", + Tag: "bytes,104,opt,name=text", + Filename: "test_proto/test.proto", +} + +var E_Ext_Number = &proto.ExtensionDesc{ + ExtendedType: (*MyMessage)(nil), + ExtensionType: (*int32)(nil), + Field: 105, + Name: "test_proto.Ext.number", + Tag: "varint,105,opt,name=number", + Filename: "test_proto/test.proto", +} + type ComplexExtension struct { First *int32 `protobuf:"varint,1,opt,name=first" json:"first,omitempty"` Second *int32 `protobuf:"varint,2,opt,name=second" json:"second,omitempty"` @@ -1876,14 +2147,11 @@ type ComplexExtension struct { XXX_sizecache int32 `json:"-"` } -func (m *ComplexExtension) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[15].MessageOf(m) -} func (m *ComplexExtension) Reset() { *m = ComplexExtension{} } func (m *ComplexExtension) String() string { return proto.CompactTextString(m) } func (*ComplexExtension) ProtoMessage() {} func (*ComplexExtension) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{15} + return fileDescriptor_8ca34d01332f1402, []int{15} } func (m *ComplexExtension) XXX_Unmarshal(b []byte) error { @@ -1932,14 +2200,11 @@ type DefaultsMessage struct { XXX_sizecache int32 `json:"-"` } -func (m *DefaultsMessage) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[16].MessageOf(m) -} func (m *DefaultsMessage) Reset() { *m = DefaultsMessage{} } func (m *DefaultsMessage) String() string { return proto.CompactTextString(m) } func (*DefaultsMessage) ProtoMessage() {} func (*DefaultsMessage) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{16} + return fileDescriptor_8ca34d01332f1402, []int{16} } var extRange_DefaultsMessage = []proto.ExtensionRange{ @@ -1975,14 +2240,11 @@ type MyMessageSet struct { XXX_sizecache int32 `json:"-"` } -func (m *MyMessageSet) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[17].MessageOf(m) -} func (m *MyMessageSet) Reset() { *m = MyMessageSet{} } func (m *MyMessageSet) String() string { return proto.CompactTextString(m) } func (*MyMessageSet) ProtoMessage() {} func (*MyMessageSet) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{17} + return fileDescriptor_8ca34d01332f1402, []int{17} } var extRange_MyMessageSet = []proto.ExtensionRange{ @@ -2017,14 +2279,11 @@ type Empty struct { XXX_sizecache int32 `json:"-"` } -func (m *Empty) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[18].MessageOf(m) -} func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{18} + return fileDescriptor_8ca34d01332f1402, []int{18} } func (m *Empty) XXX_Unmarshal(b []byte) error { @@ -2052,14 +2311,11 @@ type MessageList struct { XXX_sizecache int32 `json:"-"` } -func (m *MessageList) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[19].MessageOf(m) -} func (m *MessageList) Reset() { *m = MessageList{} } func (m *MessageList) String() string { return proto.CompactTextString(m) } func (*MessageList) ProtoMessage() {} func (*MessageList) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{19} + return fileDescriptor_8ca34d01332f1402, []int{19} } func (m *MessageList) XXX_Unmarshal(b []byte) error { @@ -2087,6 +2343,53 @@ func (m *MessageList) GetMessage() []*MessageList_Message { return nil } +type MessageList_Message struct { + Name *string `protobuf:"bytes,2,req,name=name" json:"name,omitempty"` + Count *int32 `protobuf:"varint,3,req,name=count" json:"count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MessageList_Message) Reset() { *m = MessageList_Message{} } +func (m *MessageList_Message) String() string { return proto.CompactTextString(m) } +func (*MessageList_Message) ProtoMessage() {} +func (*MessageList_Message) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{19, 0} +} + +func (m *MessageList_Message) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MessageList_Message.Unmarshal(m, b) +} +func (m *MessageList_Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MessageList_Message.Marshal(b, m, deterministic) +} +func (m *MessageList_Message) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageList_Message.Merge(m, src) +} +func (m *MessageList_Message) XXX_Size() int { + return xxx_messageInfo_MessageList_Message.Size(m) +} +func (m *MessageList_Message) XXX_DiscardUnknown() { + xxx_messageInfo_MessageList_Message.DiscardUnknown(m) +} + +var xxx_messageInfo_MessageList_Message proto.InternalMessageInfo + +func (m *MessageList_Message) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *MessageList_Message) GetCount() int32 { + if m != nil && m.Count != nil { + return *m.Count + } + return 0 +} + type Strings struct { StringField *string `protobuf:"bytes,1,opt,name=string_field,json=stringField" json:"string_field,omitempty"` BytesField []byte `protobuf:"bytes,2,opt,name=bytes_field,json=bytesField" json:"bytes_field,omitempty"` @@ -2095,14 +2398,11 @@ type Strings struct { XXX_sizecache int32 `json:"-"` } -func (m *Strings) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[20].MessageOf(m) -} func (m *Strings) Reset() { *m = Strings{} } func (m *Strings) String() string { return proto.CompactTextString(m) } func (*Strings) ProtoMessage() {} func (*Strings) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{20} + return fileDescriptor_8ca34d01332f1402, []int{20} } func (m *Strings) XXX_Unmarshal(b []byte) error { @@ -2167,14 +2467,11 @@ type Defaults struct { XXX_sizecache int32 `json:"-"` } -func (m *Defaults) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[21].MessageOf(m) -} func (m *Defaults) Reset() { *m = Defaults{} } func (m *Defaults) String() string { return proto.CompactTextString(m) } func (*Defaults) ProtoMessage() {} func (*Defaults) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{21} + return fileDescriptor_8ca34d01332f1402, []int{21} } func (m *Defaults) XXX_Unmarshal(b []byte) error { @@ -2216,8 +2513,6 @@ var Default_Defaults_F_Pinf float32 = float32(math.Inf(1)) var Default_Defaults_F_Ninf float32 = float32(math.Inf(-1)) var Default_Defaults_F_Nan float32 = float32(math.NaN()) -const Default_Defaults_StrZero string = "" - func (m *Defaults) GetF_Bool() bool { if m != nil && m.F_Bool != nil { return *m.F_Bool @@ -2348,7 +2643,7 @@ func (m *Defaults) GetStrZero() string { if m != nil && m.StrZero != nil { return *m.StrZero } - return Default_Defaults_StrZero + return "" } type SubDefaults struct { @@ -2358,14 +2653,11 @@ type SubDefaults struct { XXX_sizecache int32 `json:"-"` } -func (m *SubDefaults) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[22].MessageOf(m) -} func (m *SubDefaults) Reset() { *m = SubDefaults{} } func (m *SubDefaults) String() string { return proto.CompactTextString(m) } func (*SubDefaults) ProtoMessage() {} func (*SubDefaults) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{22} + return fileDescriptor_8ca34d01332f1402, []int{22} } func (m *SubDefaults) XXX_Unmarshal(b []byte) error { @@ -2402,14 +2694,11 @@ type RepeatedEnum struct { XXX_sizecache int32 `json:"-"` } -func (m *RepeatedEnum) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[23].MessageOf(m) -} func (m *RepeatedEnum) Reset() { *m = RepeatedEnum{} } func (m *RepeatedEnum) String() string { return proto.CompactTextString(m) } func (*RepeatedEnum) ProtoMessage() {} func (*RepeatedEnum) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{23} + return fileDescriptor_8ca34d01332f1402, []int{23} } func (m *RepeatedEnum) XXX_Unmarshal(b []byte) error { @@ -2450,14 +2739,11 @@ type MoreRepeated struct { XXX_sizecache int32 `json:"-"` } -func (m *MoreRepeated) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[24].MessageOf(m) -} func (m *MoreRepeated) Reset() { *m = MoreRepeated{} } func (m *MoreRepeated) String() string { return proto.CompactTextString(m) } func (*MoreRepeated) ProtoMessage() {} func (*MoreRepeated) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{24} + return fileDescriptor_8ca34d01332f1402, []int{24} } func (m *MoreRepeated) XXX_Unmarshal(b []byte) error { @@ -2534,14 +2820,11 @@ type GroupOld struct { XXX_sizecache int32 `json:"-"` } -func (m *GroupOld) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[25].MessageOf(m) -} func (m *GroupOld) Reset() { *m = GroupOld{} } func (m *GroupOld) String() string { return proto.CompactTextString(m) } func (*GroupOld) ProtoMessage() {} func (*GroupOld) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{25} + return fileDescriptor_8ca34d01332f1402, []int{25} } func (m *GroupOld) XXX_Unmarshal(b []byte) error { @@ -2569,6 +2852,45 @@ func (m *GroupOld) GetG() *GroupOld_G { return nil } +type GroupOld_G struct { + X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GroupOld_G) Reset() { *m = GroupOld_G{} } +func (m *GroupOld_G) String() string { return proto.CompactTextString(m) } +func (*GroupOld_G) ProtoMessage() {} +func (*GroupOld_G) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{25, 0} +} + +func (m *GroupOld_G) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupOld_G.Unmarshal(m, b) +} +func (m *GroupOld_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupOld_G.Marshal(b, m, deterministic) +} +func (m *GroupOld_G) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupOld_G.Merge(m, src) +} +func (m *GroupOld_G) XXX_Size() int { + return xxx_messageInfo_GroupOld_G.Size(m) +} +func (m *GroupOld_G) XXX_DiscardUnknown() { + xxx_messageInfo_GroupOld_G.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupOld_G proto.InternalMessageInfo + +func (m *GroupOld_G) GetX() int32 { + if m != nil && m.X != nil { + return *m.X + } + return 0 +} + type GroupNew struct { G *GroupNew_G `protobuf:"group,101,opt,name=G,json=g" json:"g,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -2576,14 +2898,11 @@ type GroupNew struct { XXX_sizecache int32 `json:"-"` } -func (m *GroupNew) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[26].MessageOf(m) -} func (m *GroupNew) Reset() { *m = GroupNew{} } func (m *GroupNew) String() string { return proto.CompactTextString(m) } func (*GroupNew) ProtoMessage() {} func (*GroupNew) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{26} + return fileDescriptor_8ca34d01332f1402, []int{26} } func (m *GroupNew) XXX_Unmarshal(b []byte) error { @@ -2611,6 +2930,53 @@ func (m *GroupNew) GetG() *GroupNew_G { return nil } +type GroupNew_G struct { + X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` + Y *int32 `protobuf:"varint,3,opt,name=y" json:"y,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GroupNew_G) Reset() { *m = GroupNew_G{} } +func (m *GroupNew_G) String() string { return proto.CompactTextString(m) } +func (*GroupNew_G) ProtoMessage() {} +func (*GroupNew_G) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{26, 0} +} + +func (m *GroupNew_G) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupNew_G.Unmarshal(m, b) +} +func (m *GroupNew_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupNew_G.Marshal(b, m, deterministic) +} +func (m *GroupNew_G) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupNew_G.Merge(m, src) +} +func (m *GroupNew_G) XXX_Size() int { + return xxx_messageInfo_GroupNew_G.Size(m) +} +func (m *GroupNew_G) XXX_DiscardUnknown() { + xxx_messageInfo_GroupNew_G.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupNew_G proto.InternalMessageInfo + +func (m *GroupNew_G) GetX() int32 { + if m != nil && m.X != nil { + return *m.X + } + return 0 +} + +func (m *GroupNew_G) GetY() int32 { + if m != nil && m.Y != nil { + return *m.Y + } + return 0 +} + type FloatingPoint struct { F *float64 `protobuf:"fixed64,1,req,name=f" json:"f,omitempty"` Exact *bool `protobuf:"varint,2,opt,name=exact" json:"exact,omitempty"` @@ -2619,14 +2985,11 @@ type FloatingPoint struct { XXX_sizecache int32 `json:"-"` } -func (m *FloatingPoint) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[27].MessageOf(m) -} func (m *FloatingPoint) Reset() { *m = FloatingPoint{} } func (m *FloatingPoint) String() string { return proto.CompactTextString(m) } func (*FloatingPoint) ProtoMessage() {} func (*FloatingPoint) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{27} + return fileDescriptor_8ca34d01332f1402, []int{27} } func (m *FloatingPoint) XXX_Unmarshal(b []byte) error { @@ -2671,14 +3034,11 @@ type MessageWithMap struct { XXX_sizecache int32 `json:"-"` } -func (m *MessageWithMap) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[28].MessageOf(m) -} func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } func (*MessageWithMap) ProtoMessage() {} func (*MessageWithMap) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{28} + return fileDescriptor_8ca34d01332f1402, []int{28} } func (m *MessageWithMap) XXX_Unmarshal(b []byte) error { @@ -2755,14 +3115,11 @@ type Oneof struct { XXX_sizecache int32 `json:"-"` } -func (m *Oneof) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[29].MessageOf(m) -} func (m *Oneof) Reset() { *m = Oneof{} } func (m *Oneof) String() string { return proto.CompactTextString(m) } func (*Oneof) ProtoMessage() {} func (*Oneof) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{29} + return fileDescriptor_8ca34d01332f1402, []int{29} } func (m *Oneof) XXX_Unmarshal(b []byte) error { @@ -3063,6 +3420,45 @@ func (*Oneof) XXX_OneofWrappers() []interface{} { } } +type Oneof_F_Group struct { + X *int32 `protobuf:"varint,17,opt,name=x" json:"x,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Oneof_F_Group) Reset() { *m = Oneof_F_Group{} } +func (m *Oneof_F_Group) String() string { return proto.CompactTextString(m) } +func (*Oneof_F_Group) ProtoMessage() {} +func (*Oneof_F_Group) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{29, 0} +} + +func (m *Oneof_F_Group) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Oneof_F_Group.Unmarshal(m, b) +} +func (m *Oneof_F_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Oneof_F_Group.Marshal(b, m, deterministic) +} +func (m *Oneof_F_Group) XXX_Merge(src proto.Message) { + xxx_messageInfo_Oneof_F_Group.Merge(m, src) +} +func (m *Oneof_F_Group) XXX_Size() int { + return xxx_messageInfo_Oneof_F_Group.Size(m) +} +func (m *Oneof_F_Group) XXX_DiscardUnknown() { + xxx_messageInfo_Oneof_F_Group.DiscardUnknown(m) +} + +var xxx_messageInfo_Oneof_F_Group proto.InternalMessageInfo + +func (m *Oneof_F_Group) GetX() int32 { + if m != nil && m.X != nil { + return *m.X + } + return 0 +} + type Communique struct { MakeMeCry *bool `protobuf:"varint,1,opt,name=make_me_cry,json=makeMeCry" json:"make_me_cry,omitempty"` // This is a oneof, called "union". @@ -3080,14 +3476,11 @@ type Communique struct { XXX_sizecache int32 `json:"-"` } -func (m *Communique) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[30].MessageOf(m) -} func (m *Communique) Reset() { *m = Communique{} } func (m *Communique) String() string { return proto.CompactTextString(m) } func (*Communique) ProtoMessage() {} func (*Communique) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{30} + return fileDescriptor_8ca34d01332f1402, []int{30} } func (m *Communique) XXX_Unmarshal(b []byte) error { @@ -3162,695 +3555,155 @@ func (m *Communique) GetUnion() isCommunique_Union { return nil } -func (m *Communique) GetNumber() int32 { - if x, ok := m.GetUnion().(*Communique_Number); ok { - return x.Number - } - return 0 -} - -func (m *Communique) GetName() string { - if x, ok := m.GetUnion().(*Communique_Name); ok { - return x.Name - } - return "" -} - -func (m *Communique) GetData() []byte { - if x, ok := m.GetUnion().(*Communique_Data); ok { - return x.Data - } - return nil -} - -func (m *Communique) GetTempC() float64 { - if x, ok := m.GetUnion().(*Communique_TempC); ok { - return x.TempC - } - return 0 -} - -func (m *Communique) GetCol() MyMessage_Color { - if x, ok := m.GetUnion().(*Communique_Col); ok { - return x.Col - } - return MyMessage_RED -} - -func (m *Communique) GetMsg() *Strings { - if x, ok := m.GetUnion().(*Communique_Msg); ok { - return x.Msg - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Communique) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Communique_Number)(nil), - (*Communique_Name)(nil), - (*Communique_Data)(nil), - (*Communique_TempC)(nil), - (*Communique_Col)(nil), - (*Communique_Msg)(nil), - } -} - -type TestUTF8 struct { - Scalar *string `protobuf:"bytes,1,opt,name=scalar" json:"scalar,omitempty"` - Vector []string `protobuf:"bytes,2,rep,name=vector" json:"vector,omitempty"` - // Types that are valid to be assigned to Oneof: - // *TestUTF8_Field - Oneof isTestUTF8_Oneof `protobuf_oneof:"oneof"` - MapKey map[string]int64 `protobuf:"bytes,4,rep,name=map_key,json=mapKey" json:"map_key,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` - MapValue map[int64]string `protobuf:"bytes,5,rep,name=map_value,json=mapValue" json:"map_value,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TestUTF8) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[31].MessageOf(m) -} -func (m *TestUTF8) Reset() { *m = TestUTF8{} } -func (m *TestUTF8) String() string { return proto.CompactTextString(m) } -func (*TestUTF8) ProtoMessage() {} -func (*TestUTF8) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{31} -} - -func (m *TestUTF8) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TestUTF8.Unmarshal(m, b) -} -func (m *TestUTF8) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TestUTF8.Marshal(b, m, deterministic) -} -func (m *TestUTF8) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestUTF8.Merge(m, src) -} -func (m *TestUTF8) XXX_Size() int { - return xxx_messageInfo_TestUTF8.Size(m) -} -func (m *TestUTF8) XXX_DiscardUnknown() { - xxx_messageInfo_TestUTF8.DiscardUnknown(m) -} - -var xxx_messageInfo_TestUTF8 proto.InternalMessageInfo - -func (m *TestUTF8) GetScalar() string { - if m != nil && m.Scalar != nil { - return *m.Scalar - } - return "" -} - -func (m *TestUTF8) GetVector() []string { - if m != nil { - return m.Vector - } - return nil -} - -type isTestUTF8_Oneof interface { - isTestUTF8_Oneof() -} - -type TestUTF8_Field struct { - Field string `protobuf:"bytes,3,opt,name=field,oneof"` -} - -func (*TestUTF8_Field) isTestUTF8_Oneof() {} - -func (m *TestUTF8) GetOneof() isTestUTF8_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (m *TestUTF8) GetField() string { - if x, ok := m.GetOneof().(*TestUTF8_Field); ok { - return x.Field - } - return "" -} - -func (m *TestUTF8) GetMapKey() map[string]int64 { - if m != nil { - return m.MapKey - } - return nil -} - -func (m *TestUTF8) GetMapValue() map[int64]string { - if m != nil { - return m.MapValue - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*TestUTF8) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*TestUTF8_Field)(nil), - } -} - -// Required, repeated, and optional groups. -type GoTest_RequiredGroup struct { - RequiredField *string `protobuf:"bytes,71,req,name=RequiredField" json:"RequiredField,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GoTest_RequiredGroup) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[32].MessageOf(m) -} -func (m *GoTest_RequiredGroup) Reset() { *m = GoTest_RequiredGroup{} } -func (m *GoTest_RequiredGroup) String() string { return proto.CompactTextString(m) } -func (*GoTest_RequiredGroup) ProtoMessage() {} -func (*GoTest_RequiredGroup) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{2, 0} -} - -func (m *GoTest_RequiredGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GoTest_RequiredGroup.Unmarshal(m, b) -} -func (m *GoTest_RequiredGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GoTest_RequiredGroup.Marshal(b, m, deterministic) -} -func (m *GoTest_RequiredGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_GoTest_RequiredGroup.Merge(m, src) -} -func (m *GoTest_RequiredGroup) XXX_Size() int { - return xxx_messageInfo_GoTest_RequiredGroup.Size(m) -} -func (m *GoTest_RequiredGroup) XXX_DiscardUnknown() { - xxx_messageInfo_GoTest_RequiredGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_GoTest_RequiredGroup proto.InternalMessageInfo - -func (m *GoTest_RequiredGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" -} - -type GoTest_RepeatedGroup struct { - RequiredField *string `protobuf:"bytes,81,req,name=RequiredField" json:"RequiredField,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GoTest_RepeatedGroup) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[33].MessageOf(m) -} -func (m *GoTest_RepeatedGroup) Reset() { *m = GoTest_RepeatedGroup{} } -func (m *GoTest_RepeatedGroup) String() string { return proto.CompactTextString(m) } -func (*GoTest_RepeatedGroup) ProtoMessage() {} -func (*GoTest_RepeatedGroup) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{2, 1} -} - -func (m *GoTest_RepeatedGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GoTest_RepeatedGroup.Unmarshal(m, b) -} -func (m *GoTest_RepeatedGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GoTest_RepeatedGroup.Marshal(b, m, deterministic) -} -func (m *GoTest_RepeatedGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_GoTest_RepeatedGroup.Merge(m, src) -} -func (m *GoTest_RepeatedGroup) XXX_Size() int { - return xxx_messageInfo_GoTest_RepeatedGroup.Size(m) -} -func (m *GoTest_RepeatedGroup) XXX_DiscardUnknown() { - xxx_messageInfo_GoTest_RepeatedGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_GoTest_RepeatedGroup proto.InternalMessageInfo - -func (m *GoTest_RepeatedGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" -} - -type GoTest_OptionalGroup struct { - RequiredField *string `protobuf:"bytes,91,req,name=RequiredField" json:"RequiredField,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GoTest_OptionalGroup) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[34].MessageOf(m) -} -func (m *GoTest_OptionalGroup) Reset() { *m = GoTest_OptionalGroup{} } -func (m *GoTest_OptionalGroup) String() string { return proto.CompactTextString(m) } -func (*GoTest_OptionalGroup) ProtoMessage() {} -func (*GoTest_OptionalGroup) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{2, 2} -} - -func (m *GoTest_OptionalGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GoTest_OptionalGroup.Unmarshal(m, b) -} -func (m *GoTest_OptionalGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GoTest_OptionalGroup.Marshal(b, m, deterministic) -} -func (m *GoTest_OptionalGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_GoTest_OptionalGroup.Merge(m, src) -} -func (m *GoTest_OptionalGroup) XXX_Size() int { - return xxx_messageInfo_GoTest_OptionalGroup.Size(m) -} -func (m *GoTest_OptionalGroup) XXX_DiscardUnknown() { - xxx_messageInfo_GoTest_OptionalGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_GoTest_OptionalGroup proto.InternalMessageInfo - -func (m *GoTest_OptionalGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" -} - -type GoTestRequiredGroupField_Group struct { - Field *int32 `protobuf:"varint,2,req,name=Field" json:"Field,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GoTestRequiredGroupField_Group) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[35].MessageOf(m) -} -func (m *GoTestRequiredGroupField_Group) Reset() { *m = GoTestRequiredGroupField_Group{} } -func (m *GoTestRequiredGroupField_Group) String() string { return proto.CompactTextString(m) } -func (*GoTestRequiredGroupField_Group) ProtoMessage() {} -func (*GoTestRequiredGroupField_Group) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{3, 0} -} - -func (m *GoTestRequiredGroupField_Group) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GoTestRequiredGroupField_Group.Unmarshal(m, b) -} -func (m *GoTestRequiredGroupField_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GoTestRequiredGroupField_Group.Marshal(b, m, deterministic) -} -func (m *GoTestRequiredGroupField_Group) XXX_Merge(src proto.Message) { - xxx_messageInfo_GoTestRequiredGroupField_Group.Merge(m, src) -} -func (m *GoTestRequiredGroupField_Group) XXX_Size() int { - return xxx_messageInfo_GoTestRequiredGroupField_Group.Size(m) -} -func (m *GoTestRequiredGroupField_Group) XXX_DiscardUnknown() { - xxx_messageInfo_GoTestRequiredGroupField_Group.DiscardUnknown(m) -} - -var xxx_messageInfo_GoTestRequiredGroupField_Group proto.InternalMessageInfo - -func (m *GoTestRequiredGroupField_Group) GetField() int32 { - if m != nil && m.Field != nil { - return *m.Field - } - return 0 -} - -type GoSkipTest_SkipGroup struct { - GroupInt32 *int32 `protobuf:"varint,16,req,name=group_int32,json=groupInt32" json:"group_int32,omitempty"` - GroupString *string `protobuf:"bytes,17,req,name=group_string,json=groupString" json:"group_string,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GoSkipTest_SkipGroup) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[36].MessageOf(m) -} -func (m *GoSkipTest_SkipGroup) Reset() { *m = GoSkipTest_SkipGroup{} } -func (m *GoSkipTest_SkipGroup) String() string { return proto.CompactTextString(m) } -func (*GoSkipTest_SkipGroup) ProtoMessage() {} -func (*GoSkipTest_SkipGroup) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{4, 0} -} - -func (m *GoSkipTest_SkipGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GoSkipTest_SkipGroup.Unmarshal(m, b) -} -func (m *GoSkipTest_SkipGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GoSkipTest_SkipGroup.Marshal(b, m, deterministic) -} -func (m *GoSkipTest_SkipGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_GoSkipTest_SkipGroup.Merge(m, src) -} -func (m *GoSkipTest_SkipGroup) XXX_Size() int { - return xxx_messageInfo_GoSkipTest_SkipGroup.Size(m) -} -func (m *GoSkipTest_SkipGroup) XXX_DiscardUnknown() { - xxx_messageInfo_GoSkipTest_SkipGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_GoSkipTest_SkipGroup proto.InternalMessageInfo - -func (m *GoSkipTest_SkipGroup) GetGroupInt32() int32 { - if m != nil && m.GroupInt32 != nil { - return *m.GroupInt32 - } - return 0 -} - -func (m *GoSkipTest_SkipGroup) GetGroupString() string { - if m != nil && m.GroupString != nil { - return *m.GroupString - } - return "" -} - -type OldMessage_Nested struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OldMessage_Nested) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[37].MessageOf(m) -} -func (m *OldMessage_Nested) Reset() { *m = OldMessage_Nested{} } -func (m *OldMessage_Nested) String() string { return proto.CompactTextString(m) } -func (*OldMessage_Nested) ProtoMessage() {} -func (*OldMessage_Nested) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{8, 0} -} - -func (m *OldMessage_Nested) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OldMessage_Nested.Unmarshal(m, b) -} -func (m *OldMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OldMessage_Nested.Marshal(b, m, deterministic) -} -func (m *OldMessage_Nested) XXX_Merge(src proto.Message) { - xxx_messageInfo_OldMessage_Nested.Merge(m, src) -} -func (m *OldMessage_Nested) XXX_Size() int { - return xxx_messageInfo_OldMessage_Nested.Size(m) -} -func (m *OldMessage_Nested) XXX_DiscardUnknown() { - xxx_messageInfo_OldMessage_Nested.DiscardUnknown(m) -} - -var xxx_messageInfo_OldMessage_Nested proto.InternalMessageInfo - -func (m *OldMessage_Nested) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -type NewMessage_Nested struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - FoodGroup *string `protobuf:"bytes,2,opt,name=food_group,json=foodGroup" json:"food_group,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NewMessage_Nested) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[38].MessageOf(m) -} -func (m *NewMessage_Nested) Reset() { *m = NewMessage_Nested{} } -func (m *NewMessage_Nested) String() string { return proto.CompactTextString(m) } -func (*NewMessage_Nested) ProtoMessage() {} -func (*NewMessage_Nested) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{9, 0} -} - -func (m *NewMessage_Nested) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NewMessage_Nested.Unmarshal(m, b) -} -func (m *NewMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NewMessage_Nested.Marshal(b, m, deterministic) -} -func (m *NewMessage_Nested) XXX_Merge(src proto.Message) { - xxx_messageInfo_NewMessage_Nested.Merge(m, src) -} -func (m *NewMessage_Nested) XXX_Size() int { - return xxx_messageInfo_NewMessage_Nested.Size(m) -} -func (m *NewMessage_Nested) XXX_DiscardUnknown() { - xxx_messageInfo_NewMessage_Nested.DiscardUnknown(m) -} - -var xxx_messageInfo_NewMessage_Nested proto.InternalMessageInfo - -func (m *NewMessage_Nested) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *NewMessage_Nested) GetFoodGroup() string { - if m != nil && m.FoodGroup != nil { - return *m.FoodGroup - } - return "" -} - -type MyMessage_SomeGroup struct { - GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MyMessage_SomeGroup) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[39].MessageOf(m) -} -func (m *MyMessage_SomeGroup) Reset() { *m = MyMessage_SomeGroup{} } -func (m *MyMessage_SomeGroup) String() string { return proto.CompactTextString(m) } -func (*MyMessage_SomeGroup) ProtoMessage() {} -func (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{13, 0} -} - -func (m *MyMessage_SomeGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MyMessage_SomeGroup.Unmarshal(m, b) -} -func (m *MyMessage_SomeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MyMessage_SomeGroup.Marshal(b, m, deterministic) -} -func (m *MyMessage_SomeGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_MyMessage_SomeGroup.Merge(m, src) -} -func (m *MyMessage_SomeGroup) XXX_Size() int { - return xxx_messageInfo_MyMessage_SomeGroup.Size(m) -} -func (m *MyMessage_SomeGroup) XXX_DiscardUnknown() { - xxx_messageInfo_MyMessage_SomeGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_MyMessage_SomeGroup proto.InternalMessageInfo - -func (m *MyMessage_SomeGroup) GetGroupField() int32 { - if m != nil && m.GroupField != nil { - return *m.GroupField - } - return 0 -} - -type MessageList_Message struct { - Name *string `protobuf:"bytes,2,req,name=name" json:"name,omitempty"` - Count *int32 `protobuf:"varint,3,req,name=count" json:"count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MessageList_Message) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[41].MessageOf(m) -} -func (m *MessageList_Message) Reset() { *m = MessageList_Message{} } -func (m *MessageList_Message) String() string { return proto.CompactTextString(m) } -func (*MessageList_Message) ProtoMessage() {} -func (*MessageList_Message) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{19, 0} -} - -func (m *MessageList_Message) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MessageList_Message.Unmarshal(m, b) -} -func (m *MessageList_Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MessageList_Message.Marshal(b, m, deterministic) -} -func (m *MessageList_Message) XXX_Merge(src proto.Message) { - xxx_messageInfo_MessageList_Message.Merge(m, src) -} -func (m *MessageList_Message) XXX_Size() int { - return xxx_messageInfo_MessageList_Message.Size(m) -} -func (m *MessageList_Message) XXX_DiscardUnknown() { - xxx_messageInfo_MessageList_Message.DiscardUnknown(m) -} - -var xxx_messageInfo_MessageList_Message proto.InternalMessageInfo +func (m *Communique) GetNumber() int32 { + if x, ok := m.GetUnion().(*Communique_Number); ok { + return x.Number + } + return 0 +} -func (m *MessageList_Message) GetName() string { - if m != nil && m.Name != nil { - return *m.Name +func (m *Communique) GetName() string { + if x, ok := m.GetUnion().(*Communique_Name); ok { + return x.Name } return "" } -func (m *MessageList_Message) GetCount() int32 { - if m != nil && m.Count != nil { - return *m.Count +func (m *Communique) GetData() []byte { + if x, ok := m.GetUnion().(*Communique_Data); ok { + return x.Data } - return 0 + return nil } -type GroupOld_G struct { - X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (m *Communique) GetTempC() float64 { + if x, ok := m.GetUnion().(*Communique_TempC); ok { + return x.TempC + } + return 0 } -func (m *GroupOld_G) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[42].MessageOf(m) -} -func (m *GroupOld_G) Reset() { *m = GroupOld_G{} } -func (m *GroupOld_G) String() string { return proto.CompactTextString(m) } -func (*GroupOld_G) ProtoMessage() {} -func (*GroupOld_G) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{25, 0} +func (m *Communique) GetCol() MyMessage_Color { + if x, ok := m.GetUnion().(*Communique_Col); ok { + return x.Col + } + return MyMessage_RED } -func (m *GroupOld_G) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GroupOld_G.Unmarshal(m, b) -} -func (m *GroupOld_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GroupOld_G.Marshal(b, m, deterministic) -} -func (m *GroupOld_G) XXX_Merge(src proto.Message) { - xxx_messageInfo_GroupOld_G.Merge(m, src) -} -func (m *GroupOld_G) XXX_Size() int { - return xxx_messageInfo_GroupOld_G.Size(m) -} -func (m *GroupOld_G) XXX_DiscardUnknown() { - xxx_messageInfo_GroupOld_G.DiscardUnknown(m) +func (m *Communique) GetMsg() *Strings { + if x, ok := m.GetUnion().(*Communique_Msg); ok { + return x.Msg + } + return nil } -var xxx_messageInfo_GroupOld_G proto.InternalMessageInfo - -func (m *GroupOld_G) GetX() int32 { - if m != nil && m.X != nil { - return *m.X +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Communique) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Communique_Number)(nil), + (*Communique_Name)(nil), + (*Communique_Data)(nil), + (*Communique_TempC)(nil), + (*Communique_Col)(nil), + (*Communique_Msg)(nil), } - return 0 } -type GroupNew_G struct { - X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` - Y *int32 `protobuf:"varint,3,opt,name=y" json:"y,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type TestUTF8 struct { + Scalar *string `protobuf:"bytes,1,opt,name=scalar" json:"scalar,omitempty"` + Vector []string `protobuf:"bytes,2,rep,name=vector" json:"vector,omitempty"` + // Types that are valid to be assigned to Oneof: + // *TestUTF8_Field + Oneof isTestUTF8_Oneof `protobuf_oneof:"oneof"` + MapKey map[string]int64 `protobuf:"bytes,4,rep,name=map_key,json=mapKey" json:"map_key,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + MapValue map[int64]string `protobuf:"bytes,5,rep,name=map_value,json=mapValue" json:"map_value,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *GroupNew_G) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[43].MessageOf(m) -} -func (m *GroupNew_G) Reset() { *m = GroupNew_G{} } -func (m *GroupNew_G) String() string { return proto.CompactTextString(m) } -func (*GroupNew_G) ProtoMessage() {} -func (*GroupNew_G) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{26, 0} +func (m *TestUTF8) Reset() { *m = TestUTF8{} } +func (m *TestUTF8) String() string { return proto.CompactTextString(m) } +func (*TestUTF8) ProtoMessage() {} +func (*TestUTF8) Descriptor() ([]byte, []int) { + return fileDescriptor_8ca34d01332f1402, []int{31} } -func (m *GroupNew_G) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GroupNew_G.Unmarshal(m, b) +func (m *TestUTF8) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TestUTF8.Unmarshal(m, b) } -func (m *GroupNew_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GroupNew_G.Marshal(b, m, deterministic) +func (m *TestUTF8) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TestUTF8.Marshal(b, m, deterministic) } -func (m *GroupNew_G) XXX_Merge(src proto.Message) { - xxx_messageInfo_GroupNew_G.Merge(m, src) +func (m *TestUTF8) XXX_Merge(src proto.Message) { + xxx_messageInfo_TestUTF8.Merge(m, src) } -func (m *GroupNew_G) XXX_Size() int { - return xxx_messageInfo_GroupNew_G.Size(m) +func (m *TestUTF8) XXX_Size() int { + return xxx_messageInfo_TestUTF8.Size(m) } -func (m *GroupNew_G) XXX_DiscardUnknown() { - xxx_messageInfo_GroupNew_G.DiscardUnknown(m) +func (m *TestUTF8) XXX_DiscardUnknown() { + xxx_messageInfo_TestUTF8.DiscardUnknown(m) } -var xxx_messageInfo_GroupNew_G proto.InternalMessageInfo +var xxx_messageInfo_TestUTF8 proto.InternalMessageInfo -func (m *GroupNew_G) GetX() int32 { - if m != nil && m.X != nil { - return *m.X +func (m *TestUTF8) GetScalar() string { + if m != nil && m.Scalar != nil { + return *m.Scalar } - return 0 + return "" } -func (m *GroupNew_G) GetY() int32 { - if m != nil && m.Y != nil { - return *m.Y +func (m *TestUTF8) GetVector() []string { + if m != nil { + return m.Vector } - return 0 + return nil } -type Oneof_F_Group struct { - X *int32 `protobuf:"varint,17,opt,name=x" json:"x,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type isTestUTF8_Oneof interface { + isTestUTF8_Oneof() } -func (m *Oneof_F_Group) ProtoReflect() protoreflect.Message { - return xxx_File_test_proto_test_proto_messageTypes[48].MessageOf(m) -} -func (m *Oneof_F_Group) Reset() { *m = Oneof_F_Group{} } -func (m *Oneof_F_Group) String() string { return proto.CompactTextString(m) } -func (*Oneof_F_Group) ProtoMessage() {} -func (*Oneof_F_Group) Descriptor() ([]byte, []int) { - return xxx_File_test_proto_test_proto_rawdesc_gzipped, []int{29, 0} +type TestUTF8_Field struct { + Field string `protobuf:"bytes,3,opt,name=field,oneof"` } -func (m *Oneof_F_Group) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Oneof_F_Group.Unmarshal(m, b) -} -func (m *Oneof_F_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Oneof_F_Group.Marshal(b, m, deterministic) -} -func (m *Oneof_F_Group) XXX_Merge(src proto.Message) { - xxx_messageInfo_Oneof_F_Group.Merge(m, src) +func (*TestUTF8_Field) isTestUTF8_Oneof() {} + +func (m *TestUTF8) GetOneof() isTestUTF8_Oneof { + if m != nil { + return m.Oneof + } + return nil } -func (m *Oneof_F_Group) XXX_Size() int { - return xxx_messageInfo_Oneof_F_Group.Size(m) + +func (m *TestUTF8) GetField() string { + if x, ok := m.GetOneof().(*TestUTF8_Field); ok { + return x.Field + } + return "" } -func (m *Oneof_F_Group) XXX_DiscardUnknown() { - xxx_messageInfo_Oneof_F_Group.DiscardUnknown(m) + +func (m *TestUTF8) GetMapKey() map[string]int64 { + if m != nil { + return m.MapKey + } + return nil } -var xxx_messageInfo_Oneof_F_Group proto.InternalMessageInfo +func (m *TestUTF8) GetMapValue() map[int64]string { + if m != nil { + return m.MapValue + } + return nil +} -func (m *Oneof_F_Group) GetX() int32 { - if m != nil && m.X != nil { - return *m.X +// XXX_OneofWrappers is for the internal use of the proto package. +func (*TestUTF8) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*TestUTF8_Field)(nil), } - return 0 } var E_Greeting = &proto.ExtensionDesc{ @@ -4618,35 +4471,7 @@ var E_X250 = &proto.ExtensionDesc{ Filename: "test_proto/test.proto", } -var E_Ext_More = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: (*Ext)(nil), - Field: 103, - Name: "test_proto.Ext.more", - Tag: "bytes,103,opt,name=more", - Filename: "test_proto/test.proto", -} - -var E_Ext_Text = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: (*string)(nil), - Field: 104, - Name: "test_proto.Ext.text", - Tag: "bytes,104,opt,name=text", - Filename: "test_proto/test.proto", -} - -var E_Ext_Number = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 105, - Name: "test_proto.Ext.number", - Tag: "varint,105,opt,name=number", - Filename: "test_proto/test.proto", -} - func init() { - proto.RegisterFile("test_proto/test.proto", xxx_File_test_proto_test_proto_rawdesc_gzipped) proto.RegisterEnum("test_proto.FOO", FOO_name, FOO_value) proto.RegisterEnum("test_proto.GoTest_KIND", GoTest_KIND_name, GoTest_KIND_value) proto.RegisterEnum("test_proto.MyMessage_Color", MyMessage_Color_name, MyMessage_Color_value) @@ -4656,17 +4481,28 @@ func init() { proto.RegisterType((*GoEnum)(nil), "test_proto.GoEnum") proto.RegisterType((*GoTestField)(nil), "test_proto.GoTestField") proto.RegisterType((*GoTest)(nil), "test_proto.GoTest") + proto.RegisterType((*GoTest_RequiredGroup)(nil), "test_proto.GoTest.RequiredGroup") + proto.RegisterType((*GoTest_RepeatedGroup)(nil), "test_proto.GoTest.RepeatedGroup") + proto.RegisterType((*GoTest_OptionalGroup)(nil), "test_proto.GoTest.OptionalGroup") proto.RegisterType((*GoTestRequiredGroupField)(nil), "test_proto.GoTestRequiredGroupField") + proto.RegisterType((*GoTestRequiredGroupField_Group)(nil), "test_proto.GoTestRequiredGroupField.Group") proto.RegisterType((*GoSkipTest)(nil), "test_proto.GoSkipTest") + proto.RegisterType((*GoSkipTest_SkipGroup)(nil), "test_proto.GoSkipTest.SkipGroup") proto.RegisterType((*NonPackedTest)(nil), "test_proto.NonPackedTest") proto.RegisterType((*PackedTest)(nil), "test_proto.PackedTest") proto.RegisterType((*MaxTag)(nil), "test_proto.MaxTag") proto.RegisterType((*OldMessage)(nil), "test_proto.OldMessage") + proto.RegisterType((*OldMessage_Nested)(nil), "test_proto.OldMessage.Nested") proto.RegisterType((*NewMessage)(nil), "test_proto.NewMessage") + proto.RegisterType((*NewMessage_Nested)(nil), "test_proto.NewMessage.Nested") proto.RegisterType((*InnerMessage)(nil), "test_proto.InnerMessage") proto.RegisterType((*OtherMessage)(nil), "test_proto.OtherMessage") proto.RegisterType((*RequiredInnerMessage)(nil), "test_proto.RequiredInnerMessage") proto.RegisterType((*MyMessage)(nil), "test_proto.MyMessage") + proto.RegisterType((*MyMessage_SomeGroup)(nil), "test_proto.MyMessage.SomeGroup") + proto.RegisterExtension(E_Ext_More) + proto.RegisterExtension(E_Ext_Text) + proto.RegisterExtension(E_Ext_Number) proto.RegisterType((*Ext)(nil), "test_proto.Ext") proto.RegisterMapType((map[int32]int32)(nil), "test_proto.Ext.MapFieldEntry") proto.RegisterType((*ComplexExtension)(nil), "test_proto.ComplexExtension") @@ -4674,13 +4510,16 @@ func init() { proto.RegisterType((*MyMessageSet)(nil), "test_proto.MyMessageSet") proto.RegisterType((*Empty)(nil), "test_proto.Empty") proto.RegisterType((*MessageList)(nil), "test_proto.MessageList") + proto.RegisterType((*MessageList_Message)(nil), "test_proto.MessageList.Message") proto.RegisterType((*Strings)(nil), "test_proto.Strings") proto.RegisterType((*Defaults)(nil), "test_proto.Defaults") proto.RegisterType((*SubDefaults)(nil), "test_proto.SubDefaults") proto.RegisterType((*RepeatedEnum)(nil), "test_proto.RepeatedEnum") proto.RegisterType((*MoreRepeated)(nil), "test_proto.MoreRepeated") proto.RegisterType((*GroupOld)(nil), "test_proto.GroupOld") + proto.RegisterType((*GroupOld_G)(nil), "test_proto.GroupOld.G") proto.RegisterType((*GroupNew)(nil), "test_proto.GroupNew") + proto.RegisterType((*GroupNew_G)(nil), "test_proto.GroupNew.G") proto.RegisterType((*FloatingPoint)(nil), "test_proto.FloatingPoint") proto.RegisterType((*MessageWithMap)(nil), "test_proto.MessageWithMap") proto.RegisterMapType((map[bool][]byte)(nil), "test_proto.MessageWithMap.ByteMappingEntry") @@ -4688,22 +4527,11 @@ func init() { proto.RegisterMapType((map[int32]string)(nil), "test_proto.MessageWithMap.NameMappingEntry") proto.RegisterMapType((map[string]string)(nil), "test_proto.MessageWithMap.StrToStrEntry") proto.RegisterType((*Oneof)(nil), "test_proto.Oneof") + proto.RegisterType((*Oneof_F_Group)(nil), "test_proto.Oneof.F_Group") proto.RegisterType((*Communique)(nil), "test_proto.Communique") proto.RegisterType((*TestUTF8)(nil), "test_proto.TestUTF8") proto.RegisterMapType((map[string]int64)(nil), "test_proto.TestUTF8.MapKeyEntry") proto.RegisterMapType((map[int64]string)(nil), "test_proto.TestUTF8.MapValueEntry") - proto.RegisterType((*GoTest_RequiredGroup)(nil), "test_proto.GoTest.RequiredGroup") - proto.RegisterType((*GoTest_RepeatedGroup)(nil), "test_proto.GoTest.RepeatedGroup") - proto.RegisterType((*GoTest_OptionalGroup)(nil), "test_proto.GoTest.OptionalGroup") - proto.RegisterType((*GoTestRequiredGroupField_Group)(nil), "test_proto.GoTestRequiredGroupField.Group") - proto.RegisterType((*GoSkipTest_SkipGroup)(nil), "test_proto.GoSkipTest.SkipGroup") - proto.RegisterType((*OldMessage_Nested)(nil), "test_proto.OldMessage.Nested") - proto.RegisterType((*NewMessage_Nested)(nil), "test_proto.NewMessage.Nested") - proto.RegisterType((*MyMessage_SomeGroup)(nil), "test_proto.MyMessage.SomeGroup") - proto.RegisterType((*MessageList_Message)(nil), "test_proto.MessageList.Message") - proto.RegisterType((*GroupOld_G)(nil), "test_proto.GroupOld.G") - proto.RegisterType((*GroupNew_G)(nil), "test_proto.GroupNew.G") - proto.RegisterType((*Oneof_F_Group)(nil), "test_proto.Oneof.F_Group") proto.RegisterExtension(E_Greeting) proto.RegisterExtension(E_Complex) proto.RegisterExtension(E_RComplex) @@ -4789,1382 +4617,310 @@ func init() { proto.RegisterExtension(E_X248) proto.RegisterExtension(E_X249) proto.RegisterExtension(E_X250) - proto.RegisterExtension(E_Ext_More) - proto.RegisterExtension(E_Ext_Text) - proto.RegisterExtension(E_Ext_Number) } -var xxx_File_test_proto_test_proto_rawdesc = []byte{ - // 16100 bytes of the wire-encoded FileDescriptorProto - 0x0a, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, - 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x06, 0x47, 0x6f, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x21, 0x0a, - 0x03, 0x66, 0x6f, 0x6f, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x4f, 0x4f, 0x52, 0x03, 0x66, 0x6f, 0x6f, - 0x22, 0x37, 0x0a, 0x0b, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, - 0x14, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x05, - 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, - 0x02, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x22, 0xb5, 0x22, 0x0a, 0x06, 0x47, 0x6f, - 0x54, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x02, - 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x4b, 0x49, 0x4e, 0x44, 0x52, 0x04, 0x4b, 0x69, 0x6e, - 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x3d, 0x0a, - 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x04, - 0x20, 0x02, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0d, 0x52, - 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x3d, 0x0a, 0x0d, - 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0d, 0x52, 0x65, - 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x3d, 0x0a, 0x0d, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0d, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x26, 0x0a, 0x0f, 0x46, 0x5f, - 0x42, 0x6f, 0x6f, 0x6c, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x0a, 0x20, - 0x02, 0x28, 0x08, 0x52, 0x0d, 0x46, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x72, 0x65, - 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x02, 0x28, 0x05, 0x52, 0x0e, 0x46, 0x49, - 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x28, 0x0a, 0x10, - 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, - 0x18, 0x0c, 0x20, 0x02, 0x28, 0x03, 0x52, 0x0e, 0x46, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, - 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, - 0x64, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x0d, 0x20, 0x02, - 0x28, 0x07, 0x52, 0x10, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x52, 0x65, 0x71, 0x75, - 0x69, 0x72, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, - 0x34, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x0e, 0x20, 0x02, 0x28, 0x06, - 0x52, 0x10, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x72, - 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x0f, 0x46, - 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2a, - 0x0a, 0x11, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, - 0x72, 0x65, 0x64, 0x18, 0x10, 0x20, 0x02, 0x28, 0x04, 0x52, 0x0f, 0x46, 0x55, 0x69, 0x6e, 0x74, - 0x36, 0x34, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x46, 0x5f, - 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x11, - 0x20, 0x02, 0x28, 0x02, 0x52, 0x0e, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x69, 0x72, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, - 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x12, 0x20, 0x02, 0x28, 0x01, 0x52, - 0x0f, 0x46, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, - 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65, 0x71, - 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x13, 0x20, 0x02, 0x28, 0x09, 0x52, 0x0f, 0x46, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x28, 0x0a, 0x10, - 0x46, 0x5f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, - 0x18, 0x65, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x0e, 0x46, 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, - 0x33, 0x32, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x66, 0x20, 0x02, 0x28, - 0x11, 0x52, 0x0f, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, - 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x67, 0x20, 0x02, 0x28, 0x12, 0x52, 0x0f, 0x46, - 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2e, - 0x0a, 0x13, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x71, - 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x68, 0x20, 0x02, 0x28, 0x0f, 0x52, 0x11, 0x46, 0x53, 0x66, - 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2e, - 0x0a, 0x13, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x71, - 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x69, 0x20, 0x02, 0x28, 0x10, 0x52, 0x11, 0x46, 0x53, 0x66, - 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x26, - 0x0a, 0x0f, 0x46, 0x5f, 0x42, 0x6f, 0x6f, 0x6c, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x18, 0x14, 0x20, 0x03, 0x28, 0x08, 0x52, 0x0d, 0x46, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, - 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, - 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x15, 0x20, 0x03, 0x28, 0x05, - 0x52, 0x0e, 0x46, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x12, 0x28, 0x0a, 0x10, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, - 0x61, 0x74, 0x65, 0x64, 0x18, 0x16, 0x20, 0x03, 0x28, 0x03, 0x52, 0x0e, 0x46, 0x49, 0x6e, 0x74, - 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x46, 0x5f, - 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x18, 0x17, 0x20, 0x03, 0x28, 0x07, 0x52, 0x10, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, - 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x46, 0x5f, 0x46, 0x69, - 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x18, - 0x20, 0x03, 0x28, 0x06, 0x52, 0x10, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, 0x65, - 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, - 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x19, 0x20, 0x03, 0x28, - 0x0d, 0x52, 0x0f, 0x46, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, - 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, - 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x1a, 0x20, 0x03, 0x28, 0x04, 0x52, 0x0f, 0x46, - 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x28, - 0x0a, 0x10, 0x46, 0x5f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, - 0x65, 0x64, 0x18, 0x1b, 0x20, 0x03, 0x28, 0x02, 0x52, 0x0e, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, - 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x44, 0x6f, - 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x1c, 0x20, - 0x03, 0x28, 0x01, 0x52, 0x0f, 0x46, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x65, - 0x61, 0x74, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x1d, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x0f, 0x46, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x12, 0x29, 0x0a, 0x10, 0x46, 0x5f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x70, 0x65, - 0x61, 0x74, 0x65, 0x64, 0x18, 0xc9, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0e, 0x46, 0x42, 0x79, - 0x74, 0x65, 0x73, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x46, - 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x18, 0xca, 0x01, 0x20, 0x03, 0x28, 0x11, 0x52, 0x0f, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, - 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x69, - 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0xcb, 0x01, - 0x20, 0x03, 0x28, 0x12, 0x52, 0x0f, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, 0x70, - 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2f, 0x0a, 0x13, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, - 0x64, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0xcc, 0x01, 0x20, - 0x03, 0x28, 0x0f, 0x52, 0x11, 0x46, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x52, 0x65, - 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2f, 0x0a, 0x13, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, - 0x65, 0x64, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0xcd, 0x01, - 0x20, 0x03, 0x28, 0x10, 0x52, 0x11, 0x46, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, - 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x26, 0x0a, 0x0f, 0x46, 0x5f, 0x42, 0x6f, 0x6f, - 0x6c, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0d, 0x46, 0x42, 0x6f, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, - 0x28, 0x0a, 0x10, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x61, 0x6c, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x46, 0x49, 0x6e, 0x74, 0x33, - 0x32, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x28, 0x0a, 0x10, 0x46, 0x5f, 0x49, - 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x20, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0e, 0x46, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x61, 0x6c, 0x12, 0x2c, 0x0a, 0x12, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, - 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x21, 0x20, 0x01, 0x28, 0x07, 0x52, - 0x10, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x12, 0x2c, 0x0a, 0x12, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x06, 0x52, 0x10, 0x46, - 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, - 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x6f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x23, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x46, 0x55, 0x69, 0x6e, - 0x74, 0x33, 0x32, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x2a, 0x0a, 0x11, 0x46, - 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x18, 0x24, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x46, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x28, 0x0a, 0x10, 0x46, 0x5f, 0x46, 0x6c, 0x6f, - 0x61, 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x25, 0x20, 0x01, 0x28, - 0x02, 0x52, 0x0e, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x12, 0x2a, 0x0a, 0x11, 0x46, 0x5f, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x26, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0f, 0x46, 0x44, - 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x2a, 0x0a, - 0x11, 0x46, 0x5f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x18, 0x27, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x46, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x29, 0x0a, 0x10, 0x46, 0x5f, 0x42, - 0x79, 0x74, 0x65, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0xad, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x46, 0x42, 0x79, 0x74, 0x65, 0x73, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x2b, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, - 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0xae, 0x02, 0x20, 0x01, 0x28, 0x11, - 0x52, 0x0f, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x12, 0x2b, 0x0a, 0x11, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0xaf, 0x02, 0x20, 0x01, 0x28, 0x12, 0x52, 0x0f, 0x46, - 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x2f, - 0x0a, 0x13, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0xb0, 0x02, 0x20, 0x01, 0x28, 0x0f, 0x52, 0x11, 0x46, 0x53, - 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, - 0x2f, 0x0a, 0x13, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0xb1, 0x02, 0x20, 0x01, 0x28, 0x10, 0x52, 0x11, 0x46, - 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x12, 0x2e, 0x0a, 0x10, 0x46, 0x5f, 0x42, 0x6f, 0x6f, 0x6c, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x65, 0x64, 0x18, 0x28, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x04, 0x74, 0x72, 0x75, 0x65, - 0x52, 0x0e, 0x46, 0x42, 0x6f, 0x6f, 0x6c, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, - 0x12, 0x2e, 0x0a, 0x11, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x64, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x29, 0x20, 0x01, 0x28, 0x05, 0x3a, 0x02, 0x33, 0x32, 0x52, - 0x0f, 0x46, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, - 0x12, 0x2e, 0x0a, 0x11, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x64, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x2a, 0x20, 0x01, 0x28, 0x03, 0x3a, 0x02, 0x36, 0x34, 0x52, - 0x0f, 0x46, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, - 0x12, 0x33, 0x0a, 0x13, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x64, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x2b, 0x20, 0x01, 0x28, 0x07, 0x3a, 0x03, 0x33, - 0x32, 0x30, 0x52, 0x11, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x44, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x33, 0x0a, 0x13, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, 0x64, - 0x36, 0x34, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x2c, 0x20, 0x01, - 0x28, 0x06, 0x3a, 0x03, 0x36, 0x34, 0x30, 0x52, 0x11, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, - 0x34, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x32, 0x0a, 0x12, 0x46, 0x5f, - 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, - 0x18, 0x2d, 0x20, 0x01, 0x28, 0x0d, 0x3a, 0x04, 0x33, 0x32, 0x30, 0x30, 0x52, 0x10, 0x46, 0x55, - 0x69, 0x6e, 0x74, 0x33, 0x32, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x32, - 0x0a, 0x12, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x65, 0x64, 0x18, 0x2e, 0x20, 0x01, 0x28, 0x04, 0x3a, 0x04, 0x36, 0x34, 0x30, 0x30, - 0x52, 0x10, 0x46, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x65, 0x64, 0x12, 0x32, 0x0a, 0x11, 0x46, 0x5f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x64, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x2f, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x06, 0x33, - 0x31, 0x34, 0x31, 0x35, 0x39, 0x52, 0x0f, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x44, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x12, 0x46, 0x5f, 0x44, 0x6f, 0x75, 0x62, - 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x30, 0x20, 0x01, - 0x28, 0x01, 0x3a, 0x06, 0x32, 0x37, 0x31, 0x38, 0x32, 0x38, 0x52, 0x10, 0x46, 0x44, 0x6f, 0x75, - 0x62, 0x6c, 0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x3e, 0x0a, 0x12, - 0x46, 0x5f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x65, 0x64, 0x18, 0x31, 0x20, 0x01, 0x28, 0x09, 0x3a, 0x10, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, - 0x20, 0x22, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x22, 0x0a, 0x52, 0x10, 0x46, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x11, - 0x46, 0x5f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, - 0x64, 0x18, 0x91, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x3a, 0x07, 0x42, 0x69, 0x67, 0x6e, 0x6f, 0x73, - 0x65, 0x52, 0x0f, 0x46, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x65, 0x64, 0x12, 0x32, 0x0a, 0x12, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x92, 0x03, 0x20, 0x01, 0x28, 0x11, 0x3a, - 0x03, 0x2d, 0x33, 0x32, 0x52, 0x10, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x44, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x32, 0x0a, 0x12, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, - 0x36, 0x34, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x93, 0x03, 0x20, - 0x01, 0x28, 0x12, 0x3a, 0x03, 0x2d, 0x36, 0x34, 0x52, 0x10, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x36, - 0x34, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x14, 0x46, 0x5f, - 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x65, 0x64, 0x18, 0x94, 0x03, 0x20, 0x01, 0x28, 0x0f, 0x3a, 0x03, 0x2d, 0x33, 0x32, 0x52, 0x12, - 0x46, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x65, 0x64, 0x12, 0x36, 0x0a, 0x14, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, - 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x18, 0x95, 0x03, 0x20, 0x01, 0x28, - 0x10, 0x3a, 0x03, 0x2d, 0x36, 0x34, 0x52, 0x12, 0x46, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, - 0x34, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x16, 0x46, 0x5f, - 0x42, 0x6f, 0x6f, 0x6c, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, - 0x63, 0x6b, 0x65, 0x64, 0x18, 0x32, 0x20, 0x03, 0x28, 0x08, 0x42, 0x02, 0x10, 0x01, 0x52, 0x13, - 0x46, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, - 0x6b, 0x65, 0x64, 0x12, 0x39, 0x0a, 0x17, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x72, - 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x33, - 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x14, 0x46, 0x49, 0x6e, 0x74, 0x33, 0x32, - 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x39, - 0x0a, 0x17, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, - 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x34, 0x20, 0x03, 0x28, 0x03, 0x42, - 0x02, 0x10, 0x01, 0x52, 0x14, 0x46, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, - 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3d, 0x0a, 0x19, 0x46, 0x5f, 0x46, - 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, - 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x35, 0x20, 0x03, 0x28, 0x07, 0x42, 0x02, 0x10, 0x01, - 0x52, 0x16, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, - 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3d, 0x0a, 0x19, 0x46, 0x5f, 0x46, 0x69, - 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, - 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x36, 0x20, 0x03, 0x28, 0x06, 0x42, 0x02, 0x10, 0x01, 0x52, - 0x16, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x18, 0x46, 0x5f, 0x55, 0x69, 0x6e, - 0x74, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, - 0x6b, 0x65, 0x64, 0x18, 0x37, 0x20, 0x03, 0x28, 0x0d, 0x42, 0x02, 0x10, 0x01, 0x52, 0x15, 0x46, - 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, - 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x18, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, - 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, - 0x18, 0x38, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x01, 0x52, 0x15, 0x46, 0x55, 0x69, 0x6e, - 0x74, 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, - 0x64, 0x12, 0x39, 0x0a, 0x17, 0x46, 0x5f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x72, 0x65, 0x70, - 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x39, 0x20, 0x03, - 0x28, 0x02, 0x42, 0x02, 0x10, 0x01, 0x52, 0x14, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x52, 0x65, - 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x18, - 0x46, 0x5f, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x3a, 0x20, 0x03, 0x28, 0x01, 0x42, 0x02, - 0x10, 0x01, 0x52, 0x15, 0x46, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x65, 0x61, - 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3c, 0x0a, 0x18, 0x46, 0x5f, 0x53, - 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, - 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0xf6, 0x03, 0x20, 0x03, 0x28, 0x11, 0x42, 0x02, 0x10, 0x01, - 0x52, 0x15, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x3c, 0x0a, 0x18, 0x46, 0x5f, 0x53, 0x69, 0x6e, - 0x74, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, - 0x6b, 0x65, 0x64, 0x18, 0xf7, 0x03, 0x20, 0x03, 0x28, 0x12, 0x42, 0x02, 0x10, 0x01, 0x52, 0x15, - 0x46, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x50, - 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x40, 0x0a, 0x1a, 0x46, 0x5f, 0x53, 0x66, 0x69, 0x78, 0x65, - 0x64, 0x33, 0x32, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, - 0x6b, 0x65, 0x64, 0x18, 0xf8, 0x03, 0x20, 0x03, 0x28, 0x0f, 0x42, 0x02, 0x10, 0x01, 0x52, 0x17, - 0x46, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x40, 0x0a, 0x1a, 0x46, 0x5f, 0x53, 0x66, 0x69, - 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, - 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0xf9, 0x03, 0x20, 0x03, 0x28, 0x10, 0x42, 0x02, 0x10, 0x01, - 0x52, 0x17, 0x46, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, 0x65, 0x70, 0x65, 0x61, - 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x46, 0x0a, 0x0d, 0x72, 0x65, 0x71, - 0x75, 0x69, 0x72, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x46, 0x20, 0x02, 0x28, 0x0a, - 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x6f, - 0x54, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x52, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x12, 0x46, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x67, 0x72, 0x6f, - 0x75, 0x70, 0x18, 0x50, 0x20, 0x03, 0x28, 0x0a, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, - 0x65, 0x61, 0x74, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0d, 0x72, 0x65, 0x70, 0x65, - 0x61, 0x74, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x46, 0x0a, 0x0d, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x0a, - 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x6f, - 0x54, 0x65, 0x73, 0x74, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x52, 0x0d, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x1a, 0x35, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x12, 0x24, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x18, 0x47, 0x20, 0x02, 0x28, 0x09, 0x52, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, - 0x72, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x35, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x65, - 0x61, 0x74, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x24, 0x0a, 0x0d, 0x52, 0x65, 0x71, - 0x75, 0x69, 0x72, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x51, 0x20, 0x02, 0x28, 0x09, - 0x52, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, - 0x35, 0x0a, 0x0d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x12, 0x24, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x18, 0x5b, 0x20, 0x02, 0x28, 0x09, 0x52, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x98, 0x01, 0x0a, 0x04, 0x4b, 0x49, 0x4e, 0x44, 0x12, - 0x08, 0x0a, 0x04, 0x56, 0x4f, 0x49, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4f, 0x4f, - 0x4c, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, 0x02, 0x12, 0x0f, - 0x0a, 0x0b, 0x46, 0x49, 0x4e, 0x47, 0x45, 0x52, 0x50, 0x52, 0x49, 0x4e, 0x54, 0x10, 0x03, 0x12, - 0x09, 0x0a, 0x05, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x04, 0x12, 0x07, 0x0a, 0x03, 0x49, 0x4e, - 0x54, 0x10, 0x05, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x06, 0x12, - 0x08, 0x0a, 0x04, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x55, 0x50, - 0x4c, 0x45, 0x10, 0x08, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x09, 0x12, - 0x07, 0x0a, 0x03, 0x4d, 0x41, 0x50, 0x10, 0x0a, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x41, 0x42, 0x4c, - 0x45, 0x10, 0x0b, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, - 0x0c, 0x22, 0x7b, 0x0a, 0x18, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, - 0x72, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x40, 0x0a, - 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0a, 0x32, 0x2a, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, - 0x1d, 0x0a, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x18, 0x02, 0x20, 0x02, 0x28, 0x05, 0x52, 0x05, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 0xa3, - 0x02, 0x0a, 0x0a, 0x47, 0x6f, 0x53, 0x6b, 0x69, 0x70, 0x54, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, - 0x0a, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x0b, 0x20, 0x02, 0x28, - 0x05, 0x52, 0x09, 0x73, 0x6b, 0x69, 0x70, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x21, 0x0a, 0x0c, - 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x0c, 0x20, 0x02, - 0x28, 0x07, 0x52, 0x0b, 0x73, 0x6b, 0x69, 0x70, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, - 0x21, 0x0a, 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x18, - 0x0d, 0x20, 0x02, 0x28, 0x06, 0x52, 0x0b, 0x73, 0x6b, 0x69, 0x70, 0x46, 0x69, 0x78, 0x65, 0x64, - 0x36, 0x34, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x18, 0x0e, 0x20, 0x02, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6b, 0x69, 0x70, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x6b, 0x69, 0x70, 0x67, 0x72, 0x6f, 0x75, 0x70, - 0x18, 0x0f, 0x20, 0x02, 0x28, 0x0a, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x6f, 0x53, 0x6b, 0x69, 0x70, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x53, - 0x6b, 0x69, 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x09, 0x73, 0x6b, 0x69, 0x70, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x1a, 0x4f, 0x0a, 0x09, 0x53, 0x6b, 0x69, 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, - 0x10, 0x20, 0x02, 0x28, 0x05, 0x52, 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, 0x74, 0x33, - 0x32, 0x12, 0x21, 0x0a, 0x0c, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x18, 0x11, 0x20, 0x02, 0x28, 0x09, 0x52, 0x0b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x22, 0x1d, 0x0a, 0x0d, 0x4e, 0x6f, 0x6e, 0x50, 0x61, 0x63, 0x6b, 0x65, - 0x64, 0x54, 0x65, 0x73, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, - 0x52, 0x01, 0x61, 0x22, 0x1e, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x54, 0x65, 0x73, - 0x74, 0x12, 0x10, 0x0a, 0x01, 0x62, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, - 0x52, 0x01, 0x62, 0x22, 0x2b, 0x0a, 0x06, 0x4d, 0x61, 0x78, 0x54, 0x61, 0x67, 0x12, 0x21, 0x0a, - 0x0a, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0xff, 0xff, 0xff, 0xff, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x22, 0x73, 0x0a, 0x0a, 0x4f, 0x6c, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x35, - 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x6c, 0x64, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x06, 0x6e, - 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x1a, 0x1c, 0x0a, 0x06, 0x4e, 0x65, 0x73, 0x74, 0x65, - 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x0a, 0x4e, 0x65, 0x77, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x4e, 0x65, 0x77, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x65, 0x73, - 0x74, 0x65, 0x64, 0x52, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, - 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x1a, 0x3b, 0x0a, - 0x06, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, - 0x6f, 0x6f, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x66, 0x6f, 0x6f, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x5a, 0x0a, 0x0c, 0x49, 0x6e, - 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, - 0x73, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x18, - 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x3a, 0x04, 0x34, 0x30, - 0x30, 0x30, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x22, 0x88, 0x01, 0x0a, 0x0c, 0x4f, 0x74, 0x68, 0x65, 0x72, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, - 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x69, 0x6e, 0x6e, 0x65, 0x72, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x52, 0x05, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, 0x80, 0x80, 0x80, - 0x02, 0x22, 0x68, 0x0a, 0x14, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x49, 0x6e, 0x6e, - 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x50, 0x0a, 0x18, 0x6c, 0x65, 0x6f, - 0x5f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x6c, 0x79, 0x5f, 0x77, 0x6f, 0x6e, 0x5f, 0x61, 0x6e, 0x5f, - 0x6f, 0x73, 0x63, 0x61, 0x72, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x14, 0x6c, 0x65, 0x6f, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x6c, - 0x79, 0x57, 0x6f, 0x6e, 0x41, 0x6e, 0x4f, 0x73, 0x63, 0x61, 0x72, 0x22, 0xd3, 0x04, 0x0a, 0x09, - 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x65, 0x74, - 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x70, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x69, - 0x6e, 0x6e, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x05, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x06, 0x6f, - 0x74, 0x68, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x06, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x73, 0x12, 0x4b, 0x0a, - 0x11, 0x77, 0x65, 0x5f, 0x6d, 0x75, 0x73, 0x74, 0x5f, 0x67, 0x6f, 0x5f, 0x64, 0x65, 0x65, 0x70, - 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x49, 0x6e, - 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0e, 0x77, 0x65, 0x4d, 0x75, - 0x73, 0x74, 0x47, 0x6f, 0x44, 0x65, 0x65, 0x70, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, - 0x70, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x72, 0x65, 0x70, 0x49, 0x6e, 0x6e, 0x65, - 0x72, 0x12, 0x37, 0x0a, 0x08, 0x62, 0x69, 0x6b, 0x65, 0x73, 0x68, 0x65, 0x64, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, - 0x52, 0x08, 0x62, 0x69, 0x6b, 0x65, 0x73, 0x68, 0x65, 0x64, 0x12, 0x3d, 0x0a, 0x09, 0x73, 0x6f, - 0x6d, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0a, 0x32, 0x1f, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x09, - 0x73, 0x6f, 0x6d, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x70, - 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, - 0x70, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x69, 0x67, 0x66, 0x6c, 0x6f, - 0x61, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x62, 0x69, 0x67, 0x66, 0x6c, 0x6f, - 0x61, 0x74, 0x1a, 0x2c, 0x0a, 0x09, 0x53, 0x6f, 0x6d, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, - 0x1f, 0x0a, 0x0b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x09, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x22, 0x25, 0x0a, 0x05, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x08, 0x0a, - 0x04, 0x42, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, 0x80, 0x80, 0x80, - 0x02, 0x22, 0xa8, 0x02, 0x0a, 0x03, 0x45, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3a, 0x0a, - 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, - 0x74, 0x2e, 0x4d, 0x61, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x08, 0x6d, 0x61, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x61, 0x70, - 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0x3a, 0x0a, 0x04, 0x6d, 0x6f, 0x72, 0x65, 0x12, 0x15, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x52, 0x04, 0x6d, 0x6f, - 0x72, 0x65, 0x32, 0x29, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x15, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x18, 0x68, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x32, 0x2d, 0x0a, - 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x69, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x56, 0x0a, 0x10, - 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x72, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x05, 0x66, 0x69, 0x72, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x14, - 0x0a, 0x05, 0x74, 0x68, 0x69, 0x72, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x74, - 0x68, 0x69, 0x72, 0x64, 0x22, 0x47, 0x0a, 0x0f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2a, 0x0a, 0x0c, 0x44, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x73, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x5a, 0x45, 0x52, 0x4f, 0x10, - 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x57, - 0x4f, 0x10, 0x02, 0x2a, 0x08, 0x08, 0x64, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x1c, 0x0a, - 0x0c, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x2a, 0x08, 0x08, - 0x64, 0x10, 0xff, 0xff, 0xff, 0xff, 0x07, 0x3a, 0x02, 0x08, 0x01, 0x22, 0x07, 0x0a, 0x05, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x22, 0x7d, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, - 0x69, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0a, 0x32, 0x1f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x33, - 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x02, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0x4d, 0x0a, 0x07, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x21, - 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x22, 0xb6, 0x05, 0x0a, 0x08, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, - 0x1b, 0x0a, 0x06, 0x46, 0x5f, 0x42, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, - 0x04, 0x74, 0x72, 0x75, 0x65, 0x52, 0x05, 0x46, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x1b, 0x0a, 0x07, - 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x3a, 0x02, 0x33, - 0x32, 0x52, 0x06, 0x46, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1b, 0x0a, 0x07, 0x46, 0x5f, 0x49, - 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x3a, 0x02, 0x36, 0x34, 0x52, 0x06, - 0x46, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x20, 0x0a, 0x09, 0x46, 0x5f, 0x46, 0x69, 0x78, 0x65, - 0x64, 0x33, 0x32, 0x18, 0x04, 0x20, 0x01, 0x28, 0x07, 0x3a, 0x03, 0x33, 0x32, 0x30, 0x52, 0x08, - 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x20, 0x0a, 0x09, 0x46, 0x5f, 0x46, 0x69, - 0x78, 0x65, 0x64, 0x36, 0x34, 0x18, 0x05, 0x20, 0x01, 0x28, 0x06, 0x3a, 0x03, 0x36, 0x34, 0x30, - 0x52, 0x08, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x1f, 0x0a, 0x08, 0x46, 0x5f, - 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x3a, 0x04, 0x33, 0x32, - 0x30, 0x30, 0x52, 0x07, 0x46, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1f, 0x0a, 0x08, 0x46, - 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x3a, 0x04, 0x36, - 0x34, 0x30, 0x30, 0x52, 0x07, 0x46, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1f, 0x0a, 0x07, - 0x46, 0x5f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x06, 0x33, - 0x31, 0x34, 0x31, 0x35, 0x39, 0x52, 0x06, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x21, 0x0a, - 0x08, 0x46, 0x5f, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x3a, - 0x06, 0x32, 0x37, 0x31, 0x38, 0x32, 0x38, 0x52, 0x07, 0x46, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, - 0x12, 0x2b, 0x0a, 0x08, 0x46, 0x5f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x09, 0x3a, 0x10, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x22, 0x77, 0x6f, 0x72, 0x6c, - 0x64, 0x21, 0x22, 0x0a, 0x52, 0x07, 0x46, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x20, 0x0a, - 0x07, 0x46, 0x5f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x3a, 0x07, - 0x42, 0x69, 0x67, 0x6e, 0x6f, 0x73, 0x65, 0x52, 0x06, 0x46, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, - 0x1e, 0x0a, 0x08, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x11, 0x3a, 0x03, 0x2d, 0x33, 0x32, 0x52, 0x07, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, - 0x1e, 0x0a, 0x08, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x0d, 0x20, 0x01, 0x28, - 0x12, 0x3a, 0x03, 0x2d, 0x36, 0x34, 0x52, 0x07, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, - 0x38, 0x0a, 0x06, 0x46, 0x5f, 0x45, 0x6e, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x1a, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x05, 0x47, 0x52, 0x45, - 0x45, 0x4e, 0x52, 0x05, 0x46, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x06, 0x46, 0x5f, 0x50, - 0x69, 0x6e, 0x66, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x03, 0x69, 0x6e, 0x66, 0x52, 0x05, - 0x46, 0x50, 0x69, 0x6e, 0x66, 0x12, 0x1b, 0x0a, 0x06, 0x46, 0x5f, 0x4e, 0x69, 0x6e, 0x66, 0x18, - 0x10, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x04, 0x2d, 0x69, 0x6e, 0x66, 0x52, 0x05, 0x46, 0x4e, 0x69, - 0x6e, 0x66, 0x12, 0x18, 0x0a, 0x05, 0x46, 0x5f, 0x4e, 0x61, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, - 0x02, 0x3a, 0x03, 0x6e, 0x61, 0x6e, 0x52, 0x04, 0x46, 0x4e, 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x03, - 0x73, 0x75, 0x62, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x75, 0x62, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x73, 0x52, 0x03, 0x73, 0x75, 0x62, 0x12, 0x1b, 0x0a, 0x08, 0x73, 0x74, 0x72, 0x5f, 0x7a, - 0x65, 0x72, 0x6f, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x3a, 0x00, 0x52, 0x07, 0x73, 0x74, 0x72, - 0x5a, 0x65, 0x72, 0x6f, 0x22, 0x25, 0x0a, 0x05, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x07, 0x0a, - 0x03, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x10, - 0x01, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x22, 0x1e, 0x0a, 0x0b, 0x53, - 0x75, 0x62, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x0f, 0x0a, 0x01, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x3a, 0x01, 0x37, 0x52, 0x01, 0x6e, 0x22, 0x56, 0x0a, 0x0c, 0x52, - 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x34, 0x0a, 0x05, 0x63, - 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x45, 0x6e, 0x75, 0x6d, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, - 0x72, 0x22, 0x10, 0x0a, 0x05, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x45, - 0x44, 0x10, 0x01, 0x22, 0xdf, 0x01, 0x0a, 0x0c, 0x4d, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x70, 0x65, - 0x61, 0x74, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x73, 0x12, 0x25, 0x0a, 0x0c, 0x62, 0x6f, - 0x6f, 0x6c, 0x73, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x08, - 0x42, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x62, 0x6f, 0x6f, 0x6c, 0x73, 0x50, 0x61, 0x63, 0x6b, 0x65, - 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, - 0x04, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x23, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x73, 0x5f, 0x70, 0x61, - 0x63, 0x6b, 0x65, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x0a, - 0x69, 0x6e, 0x74, 0x73, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x27, 0x0a, 0x0d, 0x69, 0x6e, - 0x74, 0x36, 0x34, 0x73, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x03, 0x42, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x73, 0x50, 0x61, 0x63, - 0x6b, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x05, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x16, 0x0a, - 0x06, 0x66, 0x69, 0x78, 0x65, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x07, 0x52, 0x06, 0x66, - 0x69, 0x78, 0x65, 0x64, 0x73, 0x22, 0x43, 0x0a, 0x08, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4f, 0x6c, - 0x64, 0x12, 0x24, 0x0a, 0x01, 0x67, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0a, 0x32, 0x16, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4f, - 0x6c, 0x64, 0x2e, 0x47, 0x52, 0x01, 0x67, 0x1a, 0x11, 0x0a, 0x01, 0x47, 0x12, 0x0c, 0x0a, 0x01, - 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x22, 0x51, 0x0a, 0x08, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x4e, 0x65, 0x77, 0x12, 0x24, 0x0a, 0x01, 0x67, 0x18, 0x65, 0x20, 0x01, 0x28, - 0x0a, 0x32, 0x16, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x65, 0x77, 0x2e, 0x47, 0x52, 0x01, 0x67, 0x1a, 0x1f, 0x0a, 0x01, - 0x47, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, - 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0x33, 0x0a, - 0x0d, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x0c, - 0x0a, 0x01, 0x66, 0x18, 0x01, 0x20, 0x02, 0x28, 0x01, 0x52, 0x01, 0x66, 0x12, 0x14, 0x0a, 0x05, - 0x65, 0x78, 0x61, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x65, 0x78, 0x61, - 0x63, 0x74, 0x22, 0xdc, 0x04, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, - 0x74, 0x68, 0x4d, 0x61, 0x70, 0x12, 0x4e, 0x0a, 0x0c, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x6d, 0x61, - 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x57, 0x69, 0x74, 0x68, 0x4d, 0x61, 0x70, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x70, 0x70, - 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x4d, 0x61, - 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x73, 0x67, 0x5f, 0x6d, 0x61, 0x70, - 0x70, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, - 0x69, 0x74, 0x68, 0x4d, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, - 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x6d, 0x73, 0x67, 0x4d, 0x61, 0x70, 0x70, 0x69, - 0x6e, 0x67, 0x12, 0x4e, 0x0a, 0x0c, 0x62, 0x79, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, - 0x6e, 0x67, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, - 0x68, 0x4d, 0x61, 0x70, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, - 0x6e, 0x67, 0x12, 0x46, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x5f, 0x74, 0x6f, 0x5f, 0x73, 0x74, 0x72, - 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4d, - 0x61, 0x70, 0x2e, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x53, 0x74, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x08, 0x73, 0x74, 0x72, 0x54, 0x6f, 0x53, 0x74, 0x72, 0x1a, 0x3e, 0x0a, 0x10, 0x4e, 0x61, - 0x6d, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x58, 0x0a, 0x0f, 0x4d, 0x73, - 0x67, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x12, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x2f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x6c, 0x6f, 0x61, - 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x42, 0x79, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x70, - 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x53, 0x74, 0x72, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x22, 0x8b, 0x05, 0x0a, 0x05, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x17, 0x0a, 0x06, 0x46, - 0x5f, 0x42, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x05, 0x46, - 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x19, 0x0a, 0x07, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x06, 0x46, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, - 0x19, 0x0a, 0x07, 0x46, 0x5f, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, - 0x48, 0x00, 0x52, 0x06, 0x46, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1d, 0x0a, 0x09, 0x46, 0x5f, - 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x04, 0x20, 0x01, 0x28, 0x07, 0x48, 0x00, 0x52, - 0x08, 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x1d, 0x0a, 0x09, 0x46, 0x5f, 0x46, - 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x18, 0x05, 0x20, 0x01, 0x28, 0x06, 0x48, 0x00, 0x52, 0x08, - 0x46, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x1b, 0x0a, 0x08, 0x46, 0x5f, 0x55, 0x69, - 0x6e, 0x74, 0x33, 0x32, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x07, 0x46, 0x55, - 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1b, 0x0a, 0x08, 0x46, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x36, - 0x34, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x07, 0x46, 0x55, 0x69, 0x6e, 0x74, - 0x36, 0x34, 0x12, 0x19, 0x0a, 0x07, 0x46, 0x5f, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x02, 0x48, 0x00, 0x52, 0x06, 0x46, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x1b, 0x0a, - 0x08, 0x46, 0x5f, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x48, - 0x00, 0x52, 0x07, 0x46, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x08, 0x46, 0x5f, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, - 0x46, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x19, 0x0a, 0x07, 0x46, 0x5f, 0x42, 0x79, 0x74, - 0x65, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x06, 0x46, 0x42, 0x79, 0x74, - 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x08, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x0c, - 0x20, 0x01, 0x28, 0x11, 0x48, 0x00, 0x52, 0x07, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, - 0x1b, 0x0a, 0x08, 0x46, 0x5f, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x0d, 0x20, 0x01, 0x28, - 0x12, 0x48, 0x00, 0x52, 0x07, 0x46, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x34, 0x0a, 0x06, - 0x46, 0x5f, 0x45, 0x6e, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x05, 0x46, 0x45, 0x6e, - 0x75, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x46, 0x5f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x47, 0x6f, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x00, - 0x52, 0x08, 0x46, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x66, 0x5f, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0a, 0x32, 0x19, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x46, - 0x5f, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x48, 0x00, 0x52, 0x06, 0x66, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x12, 0x28, 0x0a, 0x0d, 0x46, 0x5f, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x73, 0x74, 0x5f, 0x54, 0x61, - 0x67, 0x18, 0xff, 0xff, 0xff, 0xff, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x0b, 0x46, - 0x4c, 0x61, 0x72, 0x67, 0x65, 0x73, 0x74, 0x54, 0x61, 0x67, 0x12, 0x16, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x1a, 0x17, 0x0a, 0x07, 0x46, 0x5f, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x0c, 0x0a, - 0x01, 0x78, 0x18, 0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x42, 0x07, 0x0a, 0x05, 0x75, - 0x6e, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x74, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x6f, 0x22, - 0xee, 0x01, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x12, 0x1e, - 0x0a, 0x0b, 0x6d, 0x61, 0x6b, 0x65, 0x5f, 0x6d, 0x65, 0x5f, 0x63, 0x72, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x6d, 0x61, 0x6b, 0x65, 0x4d, 0x65, 0x43, 0x72, 0x79, 0x12, 0x18, - 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, - 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, - 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x12, 0x17, 0x0a, 0x06, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x63, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x05, 0x74, 0x65, 0x6d, 0x70, 0x43, 0x12, 0x2f, 0x0a, - 0x03, 0x63, 0x6f, 0x6c, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x03, 0x63, 0x6f, 0x6c, 0x12, 0x27, - 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, - 0x48, 0x00, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x42, 0x07, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x6f, 0x6e, - 0x22, 0xcf, 0x02, 0x0a, 0x08, 0x54, 0x65, 0x73, 0x74, 0x55, 0x54, 0x46, 0x38, 0x12, 0x16, 0x0a, - 0x06, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, - 0x63, 0x61, 0x6c, 0x61, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x16, 0x0a, - 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, - 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x39, 0x0a, 0x07, 0x6d, 0x61, 0x70, 0x5f, 0x6b, 0x65, 0x79, - 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x55, 0x54, 0x46, 0x38, 0x2e, 0x4d, 0x61, 0x70, - 0x4b, 0x65, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6d, 0x61, 0x70, 0x4b, 0x65, 0x79, - 0x12, 0x3f, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x54, 0x65, 0x73, 0x74, 0x55, 0x54, 0x46, 0x38, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x1a, 0x39, 0x0a, 0x0b, 0x4d, 0x61, 0x70, 0x4b, 0x65, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, - 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, - 0x6f, 0x66, 0x2a, 0x0f, 0x0a, 0x03, 0x46, 0x4f, 0x4f, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x4f, 0x4f, - 0x31, 0x10, 0x01, 0x3a, 0x31, 0x0a, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x12, - 0x15, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x6a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, - 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x3a, 0x51, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, - 0x78, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, - 0x74, 0x68, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xc8, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x3a, 0x54, 0x0a, 0x09, 0x72, 0x5f, 0x63, - 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0xc9, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x3a, - 0x47, 0x0a, 0x11, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x64, 0x6f, - 0x75, 0x62, 0x6c, 0x65, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x18, 0x65, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0f, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x3a, 0x45, 0x0a, 0x10, 0x6e, 0x6f, 0x5f, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x1b, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x66, 0x20, 0x01, 0x28, 0x02, 0x52, - 0x0e, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x3a, - 0x45, 0x0a, 0x10, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x69, 0x6e, - 0x74, 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0x67, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x3a, 0x45, 0x0a, 0x10, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x68, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x6e, - 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x3a, 0x47, 0x0a, - 0x11, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x75, 0x69, 0x6e, 0x74, - 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x69, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x3a, 0x47, 0x0a, 0x11, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x6a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, - 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x3a, - 0x47, 0x0a, 0x11, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x69, - 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x11, 0x52, 0x0f, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x3a, 0x47, 0x0a, 0x11, 0x6e, 0x6f, 0x5f, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1b, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x6c, 0x20, 0x01, 0x28, 0x12, - 0x52, 0x0f, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x69, 0x6e, 0x74, 0x36, - 0x34, 0x3a, 0x49, 0x0a, 0x12, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, - 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x18, 0x6d, 0x20, 0x01, 0x28, 0x07, 0x52, 0x10, 0x6e, 0x6f, 0x44, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x3a, 0x49, 0x0a, 0x12, - 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, - 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x6e, 0x20, 0x01, 0x28, 0x06, 0x52, 0x10, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x3a, 0x4b, 0x0a, 0x13, 0x6e, 0x6f, 0x5f, 0x64, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x1b, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x6f, 0x20, 0x01, 0x28, - 0x0f, 0x52, 0x11, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x66, 0x69, 0x78, - 0x65, 0x64, 0x33, 0x32, 0x3a, 0x4b, 0x0a, 0x13, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x5f, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x70, 0x20, 0x01, 0x28, 0x10, 0x52, 0x11, - 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, - 0x34, 0x3a, 0x43, 0x0a, 0x0f, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, - 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x18, 0x71, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x42, 0x6f, 0x6f, 0x6c, 0x3a, 0x47, 0x0a, 0x11, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x1b, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x72, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, - 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3a, - 0x45, 0x0a, 0x10, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x62, 0x79, - 0x74, 0x65, 0x73, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0x73, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x3a, 0x6d, 0x0a, 0x0f, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x74, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x73, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x0d, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x45, 0x6e, 0x75, 0x6d, 0x3a, 0x4b, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x18, 0xc9, 0x01, 0x20, 0x01, 0x28, 0x01, 0x3a, 0x06, 0x33, 0x2e, 0x31, - 0x34, 0x31, 0x35, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x6f, 0x75, 0x62, - 0x6c, 0x65, 0x3a, 0x47, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x6c, - 0x6f, 0x61, 0x74, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0xca, 0x01, 0x20, 0x01, 0x28, 0x02, 0x3a, 0x04, 0x33, 0x2e, 0x31, 0x34, 0x52, 0x0c, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x3a, 0x45, 0x0a, 0x0d, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xcb, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x3a, 0x02, 0x34, 0x32, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x49, 0x6e, 0x74, - 0x33, 0x32, 0x3a, 0x45, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x69, 0x6e, - 0x74, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0xcc, 0x01, 0x20, 0x01, 0x28, 0x03, 0x3a, 0x02, 0x34, 0x33, 0x52, 0x0c, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x3a, 0x47, 0x0a, 0x0e, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xcd, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x3a, - 0x02, 0x34, 0x34, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x55, 0x69, 0x6e, 0x74, - 0x33, 0x32, 0x3a, 0x47, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x75, 0x69, - 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x18, 0xce, 0x01, 0x20, 0x01, 0x28, 0x04, 0x3a, 0x02, 0x34, 0x35, 0x52, 0x0d, 0x64, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x3a, 0x47, 0x0a, 0x0e, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1b, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xcf, 0x01, 0x20, 0x01, 0x28, - 0x11, 0x3a, 0x02, 0x34, 0x36, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x69, - 0x6e, 0x74, 0x33, 0x32, 0x3a, 0x47, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, - 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x18, 0xd0, 0x01, 0x20, 0x01, 0x28, 0x12, 0x3a, 0x02, 0x34, 0x37, 0x52, 0x0d, - 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x3a, 0x49, 0x0a, - 0x0f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, - 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xd1, 0x01, - 0x20, 0x01, 0x28, 0x07, 0x3a, 0x02, 0x34, 0x38, 0x52, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x3a, 0x49, 0x0a, 0x0f, 0x64, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xd2, 0x01, 0x20, 0x01, 0x28, 0x06, 0x3a, - 0x02, 0x34, 0x39, 0x52, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x46, 0x69, 0x78, 0x65, - 0x64, 0x36, 0x34, 0x3a, 0x4b, 0x0a, 0x10, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, - 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x18, 0xd3, 0x01, 0x20, 0x01, 0x28, 0x0f, 0x3a, 0x02, 0x35, 0x30, 0x52, - 0x0f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, - 0x3a, 0x4b, 0x0a, 0x10, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x66, 0x69, 0x78, - 0x65, 0x64, 0x36, 0x34, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x18, 0xd4, 0x01, 0x20, 0x01, 0x28, 0x10, 0x3a, 0x02, 0x35, 0x31, 0x52, 0x0f, 0x64, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x3a, 0x45, 0x0a, - 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x1b, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xd5, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x3a, 0x04, 0x74, 0x72, 0x75, 0x65, 0x52, 0x0b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x42, 0x6f, 0x6f, 0x6c, 0x3a, 0x5a, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, - 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x18, 0xd6, 0x01, 0x20, 0x01, 0x28, 0x09, 0x3a, 0x15, 0x48, 0x65, 0x6c, 0x6c, - 0x6f, 0x2c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2c, 0x64, 0x65, 0x66, 0x3d, 0x66, 0x6f, - 0x6f, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x3a, 0x4f, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, - 0x73, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xd7, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x3a, 0x0c, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x62, 0x79, - 0x74, 0x65, 0x73, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x42, 0x79, 0x74, 0x65, - 0x73, 0x3a, 0x6e, 0x0a, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x65, 0x6e, 0x75, - 0x6d, 0x12, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0xd8, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x45, 0x6e, 0x75, 0x6d, 0x3a, - 0x03, 0x4f, 0x4e, 0x45, 0x52, 0x0b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x45, 0x6e, 0x75, - 0x6d, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, 0x31, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x53, 0x65, 0x74, 0x18, 0xc9, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, - 0x32, 0x30, 0x31, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, 0x32, 0x12, 0x18, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xca, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, - 0x04, 0x78, 0x32, 0x30, 0x32, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, 0x33, 0x12, 0x18, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xcb, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x52, 0x04, 0x78, 0x32, 0x30, 0x33, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, 0x34, 0x12, - 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xcc, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x30, 0x34, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, - 0x35, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, - 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xcd, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x30, 0x35, 0x3a, 0x40, 0x0a, 0x04, 0x78, - 0x32, 0x30, 0x36, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xce, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x30, 0x36, 0x3a, 0x40, 0x0a, - 0x04, 0x78, 0x32, 0x30, 0x37, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, - 0xcf, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x30, 0x37, 0x3a, - 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, 0x38, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, - 0x74, 0x18, 0xd0, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x30, - 0x38, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x30, 0x39, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x53, 0x65, 0x74, 0x18, 0xd1, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, - 0x32, 0x30, 0x39, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x30, 0x12, 0x18, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xd2, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, - 0x04, 0x78, 0x32, 0x31, 0x30, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x31, 0x12, 0x18, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xd3, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, 0x31, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x32, 0x12, - 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xd4, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, 0x32, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, - 0x33, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, - 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xd5, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, 0x33, 0x3a, 0x40, 0x0a, 0x04, 0x78, - 0x32, 0x31, 0x34, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xd6, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, 0x34, 0x3a, 0x40, 0x0a, - 0x04, 0x78, 0x32, 0x31, 0x35, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, - 0xd7, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, 0x35, 0x3a, - 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x36, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, - 0x74, 0x18, 0xd8, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, - 0x36, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x37, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x53, 0x65, 0x74, 0x18, 0xd9, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, - 0x32, 0x31, 0x37, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x38, 0x12, 0x18, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xda, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, - 0x04, 0x78, 0x32, 0x31, 0x38, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x31, 0x39, 0x12, 0x18, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xdb, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x52, 0x04, 0x78, 0x32, 0x31, 0x39, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, 0x30, 0x12, - 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xdc, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x30, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, - 0x31, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, - 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xdd, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x31, 0x3a, 0x40, 0x0a, 0x04, 0x78, - 0x32, 0x32, 0x32, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xde, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x32, 0x3a, 0x40, 0x0a, - 0x04, 0x78, 0x32, 0x32, 0x33, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, - 0xdf, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x33, 0x3a, - 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, 0x34, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, - 0x74, 0x18, 0xe0, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, - 0x34, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, 0x35, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x53, 0x65, 0x74, 0x18, 0xe1, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, - 0x32, 0x32, 0x35, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, 0x36, 0x12, 0x18, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xe2, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, - 0x04, 0x78, 0x32, 0x32, 0x36, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, 0x37, 0x12, 0x18, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xe3, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x37, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, 0x38, 0x12, - 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xe4, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x38, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x32, - 0x39, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, - 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xe5, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x32, 0x39, 0x3a, 0x40, 0x0a, 0x04, 0x78, - 0x32, 0x33, 0x30, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xe6, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x30, 0x3a, 0x40, 0x0a, - 0x04, 0x78, 0x32, 0x33, 0x31, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, - 0xe7, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x31, 0x3a, - 0x40, 0x0a, 0x04, 0x78, 0x32, 0x33, 0x32, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, - 0x74, 0x18, 0xe8, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, - 0x32, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x33, 0x33, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x53, 0x65, 0x74, 0x18, 0xe9, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, - 0x32, 0x33, 0x33, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x33, 0x34, 0x12, 0x18, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xea, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, - 0x04, 0x78, 0x32, 0x33, 0x34, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x33, 0x35, 0x12, 0x18, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xeb, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x35, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x33, 0x36, 0x12, - 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xec, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x36, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x33, - 0x37, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, - 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xed, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x37, 0x3a, 0x40, 0x0a, 0x04, 0x78, - 0x32, 0x33, 0x38, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xee, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x38, 0x3a, 0x40, 0x0a, - 0x04, 0x78, 0x32, 0x33, 0x39, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, - 0xef, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x33, 0x39, 0x3a, - 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x30, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, - 0x74, 0x18, 0xf0, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, - 0x30, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x31, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x53, 0x65, 0x74, 0x18, 0xf1, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, - 0x32, 0x34, 0x31, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x32, 0x12, 0x18, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xf2, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, - 0x04, 0x78, 0x32, 0x34, 0x32, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x33, 0x12, 0x18, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xf3, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, 0x33, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x34, 0x12, - 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xf4, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, 0x34, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, - 0x35, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, - 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xf5, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, 0x35, 0x3a, 0x40, 0x0a, 0x04, 0x78, - 0x32, 0x34, 0x36, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xf6, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, 0x36, 0x3a, 0x40, 0x0a, - 0x04, 0x78, 0x32, 0x34, 0x37, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, - 0xf7, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, 0x37, 0x3a, - 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x38, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, - 0x74, 0x18, 0xf8, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, 0x32, 0x34, - 0x38, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x34, 0x39, 0x12, 0x18, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x53, 0x65, 0x74, 0x18, 0xf9, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x04, 0x78, - 0x32, 0x34, 0x39, 0x3a, 0x40, 0x0a, 0x04, 0x78, 0x32, 0x35, 0x30, 0x12, 0x18, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x53, 0x65, 0x74, 0x18, 0xfa, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, - 0x04, 0x78, 0x32, 0x35, 0x30, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, -} - -var xxx_File_test_proto_test_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_test_proto_test_proto_rawdesc) - -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) - -var File_test_proto_test_proto protoreflect.FileDescriptor - -var xxx_File_test_proto_test_proto_enumTypes = make([]protoreflect.EnumType, 6) -var xxx_File_test_proto_test_proto_messageTypes = make([]protoimpl.MessageType, 51) -var xxx_File_test_proto_test_proto_goTypes = []interface{}{ - (FOO)(0), // 0: test_proto.FOO - (GoTest_KIND)(0), // 1: test_proto.GoTest.KIND - (MyMessage_Color)(0), // 2: test_proto.MyMessage.Color - (DefaultsMessage_DefaultsEnum)(0), // 3: test_proto.DefaultsMessage.DefaultsEnum - (Defaults_Color)(0), // 4: test_proto.Defaults.Color - (RepeatedEnum_Color)(0), // 5: test_proto.RepeatedEnum.Color - (*GoEnum)(nil), // 6: test_proto.GoEnum - (*GoTestField)(nil), // 7: test_proto.GoTestField - (*GoTest)(nil), // 8: test_proto.GoTest - (*GoTestRequiredGroupField)(nil), // 9: test_proto.GoTestRequiredGroupField - (*GoSkipTest)(nil), // 10: test_proto.GoSkipTest - (*NonPackedTest)(nil), // 11: test_proto.NonPackedTest - (*PackedTest)(nil), // 12: test_proto.PackedTest - (*MaxTag)(nil), // 13: test_proto.MaxTag - (*OldMessage)(nil), // 14: test_proto.OldMessage - (*NewMessage)(nil), // 15: test_proto.NewMessage - (*InnerMessage)(nil), // 16: test_proto.InnerMessage - (*OtherMessage)(nil), // 17: test_proto.OtherMessage - (*RequiredInnerMessage)(nil), // 18: test_proto.RequiredInnerMessage - (*MyMessage)(nil), // 19: test_proto.MyMessage - (*Ext)(nil), // 20: test_proto.Ext - (*ComplexExtension)(nil), // 21: test_proto.ComplexExtension - (*DefaultsMessage)(nil), // 22: test_proto.DefaultsMessage - (*MyMessageSet)(nil), // 23: test_proto.MyMessageSet - (*Empty)(nil), // 24: test_proto.Empty - (*MessageList)(nil), // 25: test_proto.MessageList - (*Strings)(nil), // 26: test_proto.Strings - (*Defaults)(nil), // 27: test_proto.Defaults - (*SubDefaults)(nil), // 28: test_proto.SubDefaults - (*RepeatedEnum)(nil), // 29: test_proto.RepeatedEnum - (*MoreRepeated)(nil), // 30: test_proto.MoreRepeated - (*GroupOld)(nil), // 31: test_proto.GroupOld - (*GroupNew)(nil), // 32: test_proto.GroupNew - (*FloatingPoint)(nil), // 33: test_proto.FloatingPoint - (*MessageWithMap)(nil), // 34: test_proto.MessageWithMap - (*Oneof)(nil), // 35: test_proto.Oneof - (*Communique)(nil), // 36: test_proto.Communique - (*TestUTF8)(nil), // 37: test_proto.TestUTF8 - (*GoTest_RequiredGroup)(nil), // 38: test_proto.GoTest.RequiredGroup - (*GoTest_RepeatedGroup)(nil), // 39: test_proto.GoTest.RepeatedGroup - (*GoTest_OptionalGroup)(nil), // 40: test_proto.GoTest.OptionalGroup - (*GoTestRequiredGroupField_Group)(nil), // 41: test_proto.GoTestRequiredGroupField.Group - (*GoSkipTest_SkipGroup)(nil), // 42: test_proto.GoSkipTest.SkipGroup - (*OldMessage_Nested)(nil), // 43: test_proto.OldMessage.Nested - (*NewMessage_Nested)(nil), // 44: test_proto.NewMessage.Nested - (*MyMessage_SomeGroup)(nil), // 45: test_proto.MyMessage.SomeGroup - nil, // 46: test_proto.Ext.MapFieldEntry - (*MessageList_Message)(nil), // 47: test_proto.MessageList.Message - (*GroupOld_G)(nil), // 48: test_proto.GroupOld.G - (*GroupNew_G)(nil), // 49: test_proto.GroupNew.G - nil, // 50: test_proto.MessageWithMap.NameMappingEntry - nil, // 51: test_proto.MessageWithMap.MsgMappingEntry - nil, // 52: test_proto.MessageWithMap.ByteMappingEntry - nil, // 53: test_proto.MessageWithMap.StrToStrEntry - (*Oneof_F_Group)(nil), // 54: test_proto.Oneof.F_Group - nil, // 55: test_proto.TestUTF8.MapKeyEntry - nil, // 56: test_proto.TestUTF8.MapValueEntry -} -var xxx_File_test_proto_test_proto_depIdxs = []int32{ - 19, // test_proto.greeting:extendee -> test_proto.MyMessage - 17, // test_proto.complex:extendee -> test_proto.OtherMessage - 17, // test_proto.r_complex:extendee -> test_proto.OtherMessage - 22, // test_proto.no_default_double:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_float:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_int32:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_int64:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_uint32:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_uint64:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_sint32:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_sint64:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_fixed32:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_fixed64:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_sfixed32:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_sfixed64:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_bool:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_string:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_bytes:extendee -> test_proto.DefaultsMessage - 22, // test_proto.no_default_enum:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_double:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_float:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_int32:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_int64:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_uint32:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_uint64:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_sint32:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_sint64:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_fixed32:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_fixed64:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_sfixed32:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_sfixed64:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_bool:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_string:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_bytes:extendee -> test_proto.DefaultsMessage - 22, // test_proto.default_enum:extendee -> test_proto.DefaultsMessage - 23, // test_proto.x201:extendee -> test_proto.MyMessageSet - 23, // test_proto.x202:extendee -> test_proto.MyMessageSet - 23, // test_proto.x203:extendee -> test_proto.MyMessageSet - 23, // test_proto.x204:extendee -> test_proto.MyMessageSet - 23, // test_proto.x205:extendee -> test_proto.MyMessageSet - 23, // test_proto.x206:extendee -> test_proto.MyMessageSet - 23, // test_proto.x207:extendee -> test_proto.MyMessageSet - 23, // test_proto.x208:extendee -> test_proto.MyMessageSet - 23, // test_proto.x209:extendee -> test_proto.MyMessageSet - 23, // test_proto.x210:extendee -> test_proto.MyMessageSet - 23, // test_proto.x211:extendee -> test_proto.MyMessageSet - 23, // test_proto.x212:extendee -> test_proto.MyMessageSet - 23, // test_proto.x213:extendee -> test_proto.MyMessageSet - 23, // test_proto.x214:extendee -> test_proto.MyMessageSet - 23, // test_proto.x215:extendee -> test_proto.MyMessageSet - 23, // test_proto.x216:extendee -> test_proto.MyMessageSet - 23, // test_proto.x217:extendee -> test_proto.MyMessageSet - 23, // test_proto.x218:extendee -> test_proto.MyMessageSet - 23, // test_proto.x219:extendee -> test_proto.MyMessageSet - 23, // test_proto.x220:extendee -> test_proto.MyMessageSet - 23, // test_proto.x221:extendee -> test_proto.MyMessageSet - 23, // test_proto.x222:extendee -> test_proto.MyMessageSet - 23, // test_proto.x223:extendee -> test_proto.MyMessageSet - 23, // test_proto.x224:extendee -> test_proto.MyMessageSet - 23, // test_proto.x225:extendee -> test_proto.MyMessageSet - 23, // test_proto.x226:extendee -> test_proto.MyMessageSet - 23, // test_proto.x227:extendee -> test_proto.MyMessageSet - 23, // test_proto.x228:extendee -> test_proto.MyMessageSet - 23, // test_proto.x229:extendee -> test_proto.MyMessageSet - 23, // test_proto.x230:extendee -> test_proto.MyMessageSet - 23, // test_proto.x231:extendee -> test_proto.MyMessageSet - 23, // test_proto.x232:extendee -> test_proto.MyMessageSet - 23, // test_proto.x233:extendee -> test_proto.MyMessageSet - 23, // test_proto.x234:extendee -> test_proto.MyMessageSet - 23, // test_proto.x235:extendee -> test_proto.MyMessageSet - 23, // test_proto.x236:extendee -> test_proto.MyMessageSet - 23, // test_proto.x237:extendee -> test_proto.MyMessageSet - 23, // test_proto.x238:extendee -> test_proto.MyMessageSet - 23, // test_proto.x239:extendee -> test_proto.MyMessageSet - 23, // test_proto.x240:extendee -> test_proto.MyMessageSet - 23, // test_proto.x241:extendee -> test_proto.MyMessageSet - 23, // test_proto.x242:extendee -> test_proto.MyMessageSet - 23, // test_proto.x243:extendee -> test_proto.MyMessageSet - 23, // test_proto.x244:extendee -> test_proto.MyMessageSet - 23, // test_proto.x245:extendee -> test_proto.MyMessageSet - 23, // test_proto.x246:extendee -> test_proto.MyMessageSet - 23, // test_proto.x247:extendee -> test_proto.MyMessageSet - 23, // test_proto.x248:extendee -> test_proto.MyMessageSet - 23, // test_proto.x249:extendee -> test_proto.MyMessageSet - 23, // test_proto.x250:extendee -> test_proto.MyMessageSet - 19, // test_proto.Ext.more:extendee -> test_proto.MyMessage - 19, // test_proto.Ext.text:extendee -> test_proto.MyMessage - 19, // test_proto.Ext.number:extendee -> test_proto.MyMessage - 0, // test_proto.GoEnum.foo:type_name -> test_proto.FOO - 1, // test_proto.GoTest.Kind:type_name -> test_proto.GoTest.KIND - 7, // test_proto.GoTest.RequiredField:type_name -> test_proto.GoTestField - 7, // test_proto.GoTest.RepeatedField:type_name -> test_proto.GoTestField - 7, // test_proto.GoTest.OptionalField:type_name -> test_proto.GoTestField - 38, // test_proto.GoTest.requiredgroup:type_name -> test_proto.GoTest.RequiredGroup - 39, // test_proto.GoTest.repeatedgroup:type_name -> test_proto.GoTest.RepeatedGroup - 40, // test_proto.GoTest.optionalgroup:type_name -> test_proto.GoTest.OptionalGroup - 41, // test_proto.GoTestRequiredGroupField.group:type_name -> test_proto.GoTestRequiredGroupField.Group - 42, // test_proto.GoSkipTest.skipgroup:type_name -> test_proto.GoSkipTest.SkipGroup - 43, // test_proto.OldMessage.nested:type_name -> test_proto.OldMessage.Nested - 44, // test_proto.NewMessage.nested:type_name -> test_proto.NewMessage.Nested - 16, // test_proto.OtherMessage.inner:type_name -> test_proto.InnerMessage - 16, // test_proto.RequiredInnerMessage.leo_finally_won_an_oscar:type_name -> test_proto.InnerMessage - 16, // test_proto.MyMessage.inner:type_name -> test_proto.InnerMessage - 17, // test_proto.MyMessage.others:type_name -> test_proto.OtherMessage - 18, // test_proto.MyMessage.we_must_go_deeper:type_name -> test_proto.RequiredInnerMessage - 16, // test_proto.MyMessage.rep_inner:type_name -> test_proto.InnerMessage - 2, // test_proto.MyMessage.bikeshed:type_name -> test_proto.MyMessage.Color - 45, // test_proto.MyMessage.somegroup:type_name -> test_proto.MyMessage.SomeGroup - 46, // test_proto.Ext.map_field:type_name -> test_proto.Ext.MapFieldEntry - 47, // test_proto.MessageList.message:type_name -> test_proto.MessageList.Message - 4, // test_proto.Defaults.F_Enum:type_name -> test_proto.Defaults.Color - 28, // test_proto.Defaults.sub:type_name -> test_proto.SubDefaults - 5, // test_proto.RepeatedEnum.color:type_name -> test_proto.RepeatedEnum.Color - 48, // test_proto.GroupOld.g:type_name -> test_proto.GroupOld.G - 49, // test_proto.GroupNew.g:type_name -> test_proto.GroupNew.G - 50, // test_proto.MessageWithMap.name_mapping:type_name -> test_proto.MessageWithMap.NameMappingEntry - 51, // test_proto.MessageWithMap.msg_mapping:type_name -> test_proto.MessageWithMap.MsgMappingEntry - 52, // test_proto.MessageWithMap.byte_mapping:type_name -> test_proto.MessageWithMap.ByteMappingEntry - 53, // test_proto.MessageWithMap.str_to_str:type_name -> test_proto.MessageWithMap.StrToStrEntry - 2, // test_proto.Oneof.F_Enum:type_name -> test_proto.MyMessage.Color - 7, // test_proto.Oneof.F_Message:type_name -> test_proto.GoTestField - 54, // test_proto.Oneof.f_group:type_name -> test_proto.Oneof.F_Group - 2, // test_proto.Communique.col:type_name -> test_proto.MyMessage.Color - 26, // test_proto.Communique.msg:type_name -> test_proto.Strings - 55, // test_proto.TestUTF8.map_key:type_name -> test_proto.TestUTF8.MapKeyEntry - 56, // test_proto.TestUTF8.map_value:type_name -> test_proto.TestUTF8.MapValueEntry - 33, // test_proto.MessageWithMap.MsgMappingEntry.value:type_name -> test_proto.FloatingPoint - 21, // test_proto.complex:type_name -> test_proto.ComplexExtension - 21, // test_proto.r_complex:type_name -> test_proto.ComplexExtension - 3, // test_proto.no_default_enum:type_name -> test_proto.DefaultsMessage.DefaultsEnum - 3, // test_proto.default_enum:type_name -> test_proto.DefaultsMessage.DefaultsEnum - 24, // test_proto.x201:type_name -> test_proto.Empty - 24, // test_proto.x202:type_name -> test_proto.Empty - 24, // test_proto.x203:type_name -> test_proto.Empty - 24, // test_proto.x204:type_name -> test_proto.Empty - 24, // test_proto.x205:type_name -> test_proto.Empty - 24, // test_proto.x206:type_name -> test_proto.Empty - 24, // test_proto.x207:type_name -> test_proto.Empty - 24, // test_proto.x208:type_name -> test_proto.Empty - 24, // test_proto.x209:type_name -> test_proto.Empty - 24, // test_proto.x210:type_name -> test_proto.Empty - 24, // test_proto.x211:type_name -> test_proto.Empty - 24, // test_proto.x212:type_name -> test_proto.Empty - 24, // test_proto.x213:type_name -> test_proto.Empty - 24, // test_proto.x214:type_name -> test_proto.Empty - 24, // test_proto.x215:type_name -> test_proto.Empty - 24, // test_proto.x216:type_name -> test_proto.Empty - 24, // test_proto.x217:type_name -> test_proto.Empty - 24, // test_proto.x218:type_name -> test_proto.Empty - 24, // test_proto.x219:type_name -> test_proto.Empty - 24, // test_proto.x220:type_name -> test_proto.Empty - 24, // test_proto.x221:type_name -> test_proto.Empty - 24, // test_proto.x222:type_name -> test_proto.Empty - 24, // test_proto.x223:type_name -> test_proto.Empty - 24, // test_proto.x224:type_name -> test_proto.Empty - 24, // test_proto.x225:type_name -> test_proto.Empty - 24, // test_proto.x226:type_name -> test_proto.Empty - 24, // test_proto.x227:type_name -> test_proto.Empty - 24, // test_proto.x228:type_name -> test_proto.Empty - 24, // test_proto.x229:type_name -> test_proto.Empty - 24, // test_proto.x230:type_name -> test_proto.Empty - 24, // test_proto.x231:type_name -> test_proto.Empty - 24, // test_proto.x232:type_name -> test_proto.Empty - 24, // test_proto.x233:type_name -> test_proto.Empty - 24, // test_proto.x234:type_name -> test_proto.Empty - 24, // test_proto.x235:type_name -> test_proto.Empty - 24, // test_proto.x236:type_name -> test_proto.Empty - 24, // test_proto.x237:type_name -> test_proto.Empty - 24, // test_proto.x238:type_name -> test_proto.Empty - 24, // test_proto.x239:type_name -> test_proto.Empty - 24, // test_proto.x240:type_name -> test_proto.Empty - 24, // test_proto.x241:type_name -> test_proto.Empty - 24, // test_proto.x242:type_name -> test_proto.Empty - 24, // test_proto.x243:type_name -> test_proto.Empty - 24, // test_proto.x244:type_name -> test_proto.Empty - 24, // test_proto.x245:type_name -> test_proto.Empty - 24, // test_proto.x246:type_name -> test_proto.Empty - 24, // test_proto.x247:type_name -> test_proto.Empty - 24, // test_proto.x248:type_name -> test_proto.Empty - 24, // test_proto.x249:type_name -> test_proto.Empty - 24, // test_proto.x250:type_name -> test_proto.Empty - 20, // test_proto.Ext.more:type_name -> test_proto.Ext -} - -func init() { xxx_File_test_proto_test_proto_init() } -func xxx_File_test_proto_test_proto_init() { - if File_test_proto_test_proto != nil { - return - } - messageTypes := make([]protoreflect.MessageType, 51) - extensionTypes := make([]protoreflect.ExtensionType, 88) - File_test_proto_test_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_test_proto_test_proto_rawdesc, - GoTypes: xxx_File_test_proto_test_proto_goTypes, - DependencyIndexes: xxx_File_test_proto_test_proto_depIdxs, - EnumOutputTypes: xxx_File_test_proto_test_proto_enumTypes, - MessageOutputTypes: messageTypes, - ExtensionOutputTypes: extensionTypes, - }.Init() - messageGoTypes := xxx_File_test_proto_test_proto_goTypes[6:][:51] - for i, mt := range messageTypes { - xxx_File_test_proto_test_proto_messageTypes[i].GoType = reflect.TypeOf(messageGoTypes[i]) - xxx_File_test_proto_test_proto_messageTypes[i].PBType = mt - } - E_Greeting.Type = extensionTypes[0] - E_Complex.Type = extensionTypes[1] - E_RComplex.Type = extensionTypes[2] - E_NoDefaultDouble.Type = extensionTypes[3] - E_NoDefaultFloat.Type = extensionTypes[4] - E_NoDefaultInt32.Type = extensionTypes[5] - E_NoDefaultInt64.Type = extensionTypes[6] - E_NoDefaultUint32.Type = extensionTypes[7] - E_NoDefaultUint64.Type = extensionTypes[8] - E_NoDefaultSint32.Type = extensionTypes[9] - E_NoDefaultSint64.Type = extensionTypes[10] - E_NoDefaultFixed32.Type = extensionTypes[11] - E_NoDefaultFixed64.Type = extensionTypes[12] - E_NoDefaultSfixed32.Type = extensionTypes[13] - E_NoDefaultSfixed64.Type = extensionTypes[14] - E_NoDefaultBool.Type = extensionTypes[15] - E_NoDefaultString.Type = extensionTypes[16] - E_NoDefaultBytes.Type = extensionTypes[17] - E_NoDefaultEnum.Type = extensionTypes[18] - E_DefaultDouble.Type = extensionTypes[19] - E_DefaultFloat.Type = extensionTypes[20] - E_DefaultInt32.Type = extensionTypes[21] - E_DefaultInt64.Type = extensionTypes[22] - E_DefaultUint32.Type = extensionTypes[23] - E_DefaultUint64.Type = extensionTypes[24] - E_DefaultSint32.Type = extensionTypes[25] - E_DefaultSint64.Type = extensionTypes[26] - E_DefaultFixed32.Type = extensionTypes[27] - E_DefaultFixed64.Type = extensionTypes[28] - E_DefaultSfixed32.Type = extensionTypes[29] - E_DefaultSfixed64.Type = extensionTypes[30] - E_DefaultBool.Type = extensionTypes[31] - E_DefaultString.Type = extensionTypes[32] - E_DefaultBytes.Type = extensionTypes[33] - E_DefaultEnum.Type = extensionTypes[34] - E_X201.Type = extensionTypes[35] - E_X202.Type = extensionTypes[36] - E_X203.Type = extensionTypes[37] - E_X204.Type = extensionTypes[38] - E_X205.Type = extensionTypes[39] - E_X206.Type = extensionTypes[40] - E_X207.Type = extensionTypes[41] - E_X208.Type = extensionTypes[42] - E_X209.Type = extensionTypes[43] - E_X210.Type = extensionTypes[44] - E_X211.Type = extensionTypes[45] - E_X212.Type = extensionTypes[46] - E_X213.Type = extensionTypes[47] - E_X214.Type = extensionTypes[48] - E_X215.Type = extensionTypes[49] - E_X216.Type = extensionTypes[50] - E_X217.Type = extensionTypes[51] - E_X218.Type = extensionTypes[52] - E_X219.Type = extensionTypes[53] - E_X220.Type = extensionTypes[54] - E_X221.Type = extensionTypes[55] - E_X222.Type = extensionTypes[56] - E_X223.Type = extensionTypes[57] - E_X224.Type = extensionTypes[58] - E_X225.Type = extensionTypes[59] - E_X226.Type = extensionTypes[60] - E_X227.Type = extensionTypes[61] - E_X228.Type = extensionTypes[62] - E_X229.Type = extensionTypes[63] - E_X230.Type = extensionTypes[64] - E_X231.Type = extensionTypes[65] - E_X232.Type = extensionTypes[66] - E_X233.Type = extensionTypes[67] - E_X234.Type = extensionTypes[68] - E_X235.Type = extensionTypes[69] - E_X236.Type = extensionTypes[70] - E_X237.Type = extensionTypes[71] - E_X238.Type = extensionTypes[72] - E_X239.Type = extensionTypes[73] - E_X240.Type = extensionTypes[74] - E_X241.Type = extensionTypes[75] - E_X242.Type = extensionTypes[76] - E_X243.Type = extensionTypes[77] - E_X244.Type = extensionTypes[78] - E_X245.Type = extensionTypes[79] - E_X246.Type = extensionTypes[80] - E_X247.Type = extensionTypes[81] - E_X248.Type = extensionTypes[82] - E_X249.Type = extensionTypes[83] - E_X250.Type = extensionTypes[84] - E_Ext_More.Type = extensionTypes[85] - E_Ext_Text.Type = extensionTypes[86] - E_Ext_Number.Type = extensionTypes[87] - xxx_File_test_proto_test_proto_goTypes = nil - xxx_File_test_proto_test_proto_depIdxs = nil +func init() { proto.RegisterFile("test_proto/test.proto", fileDescriptor_8ca34d01332f1402) } + +var fileDescriptor_8ca34d01332f1402 = []byte{ + // 4795 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5b, 0xd9, 0x73, 0x1b, 0x47, + 0x7a, 0xd7, 0x0c, 0xee, 0x0f, 0x20, 0x31, 0x6c, 0xc9, 0x12, 0x44, 0x59, 0xd2, 0x08, 0x6b, 0xaf, + 0x61, 0xc9, 0xa2, 0x48, 0x60, 0x08, 0x49, 0x70, 0xec, 0x58, 0x07, 0x41, 0xb3, 0x24, 0x12, 0xf2, + 0x90, 0xb6, 0xb3, 0xca, 0x03, 0x0a, 0x24, 0x06, 0x20, 0x56, 0xc0, 0x0c, 0x0c, 0x0c, 0x56, 0x64, + 0x52, 0xa9, 0xf2, 0x63, 0xaa, 0xf2, 0x94, 0x4d, 0x52, 0x95, 0xf7, 0xbc, 0xe4, 0x25, 0xd7, 0x43, + 0xf2, 0x37, 0xc4, 0xd7, 0x7a, 0x77, 0xbd, 0x57, 0x92, 0x4d, 0x36, 0xf7, 0x9d, 0xcd, 0xbd, 0x47, + 0x5e, 0x9c, 0xea, 0xaf, 0x7b, 0x66, 0x7a, 0x06, 0x50, 0x93, 0x7c, 0xe2, 0x74, 0xf7, 0xef, 0xfb, + 0xf5, 0xf5, 0x9b, 0xef, 0xfb, 0xba, 0x31, 0x84, 0xe7, 0x5c, 0x6b, 0xec, 0x36, 0x87, 0x23, 0xc7, + 0x75, 0x6e, 0xd0, 0xc7, 0x25, 0x7c, 0x24, 0x10, 0x54, 0x17, 0xaf, 0x41, 0x72, 0xdd, 0x59, 0xb3, + 0x27, 0x03, 0x72, 0x05, 0x62, 0x1d, 0xc7, 0x29, 0x28, 0xba, 0x5a, 0x9a, 0x2f, 0xe7, 0x97, 0x02, + 0xcc, 0x52, 0xbd, 0xd1, 0x30, 0x69, 0x5b, 0xf1, 0x26, 0x64, 0xd7, 0x9d, 0x1d, 0x6b, 0xec, 0xd6, + 0x7b, 0x56, 0xbf, 0x4d, 0xce, 0x40, 0xe2, 0x61, 0x6b, 0xd7, 0xea, 0xa3, 0x4d, 0xc6, 0x64, 0x05, + 0x42, 0x20, 0xbe, 0x73, 0x38, 0xb4, 0x0a, 0x2a, 0x56, 0xe2, 0x73, 0xf1, 0x0f, 0x8b, 0xb4, 0x1b, + 0x6a, 0x49, 0xae, 0x41, 0xfc, 0x41, 0xcf, 0x6e, 0xf3, 0x7e, 0xce, 0x89, 0xfd, 0x30, 0xc4, 0xd2, + 0x83, 0x8d, 0xad, 0xfb, 0x26, 0x82, 0x68, 0x0f, 0x3b, 0xad, 0xdd, 0x3e, 0x25, 0x53, 0x68, 0x0f, + 0x58, 0xa0, 0xb5, 0x8f, 0x5a, 0xa3, 0xd6, 0xa0, 0x10, 0xd3, 0x95, 0x52, 0xc2, 0x64, 0x05, 0xf2, + 0x1a, 0xcc, 0x99, 0xd6, 0x7b, 0x93, 0xde, 0xc8, 0x6a, 0xe3, 0xf0, 0x0a, 0x71, 0x5d, 0x2d, 0x65, + 0x67, 0xf5, 0x80, 0xcd, 0x66, 0x18, 0xcd, 0xcc, 0x87, 0x56, 0xcb, 0xf5, 0xcc, 0x13, 0x7a, 0xec, + 0x08, 0x73, 0x01, 0x4d, 0xcd, 0x1b, 0x43, 0xb7, 0xe7, 0xd8, 0xad, 0x3e, 0x33, 0x4f, 0xea, 0x8a, + 0xd4, 0x3c, 0x84, 0x26, 0x5f, 0x84, 0x7c, 0xbd, 0x79, 0xd7, 0x71, 0xfa, 0xcd, 0x11, 0x1f, 0x55, + 0x01, 0x74, 0xb5, 0x94, 0x36, 0xe7, 0xea, 0xb4, 0xd6, 0x1b, 0x2a, 0x29, 0x81, 0x56, 0x6f, 0x6e, + 0xd8, 0x6e, 0xa5, 0x1c, 0x00, 0xb3, 0xba, 0x5a, 0x4a, 0x98, 0xf3, 0x75, 0xac, 0x9e, 0x42, 0x56, + 0x8d, 0x00, 0x99, 0xd3, 0xd5, 0x52, 0x8c, 0x21, 0xab, 0x86, 0x8f, 0x7c, 0x05, 0x48, 0xbd, 0x59, + 0xef, 0x1d, 0x58, 0x6d, 0x91, 0x75, 0x4e, 0x57, 0x4b, 0x29, 0x53, 0xab, 0xf3, 0x86, 0x19, 0x68, + 0x91, 0x79, 0x5e, 0x57, 0x4b, 0x49, 0x0f, 0x2d, 0x70, 0x5f, 0x85, 0x85, 0x7a, 0xf3, 0xed, 0x5e, + 0x78, 0xc0, 0x79, 0x5d, 0x2d, 0xcd, 0x99, 0xf9, 0x3a, 0xab, 0x9f, 0xc6, 0x8a, 0xc4, 0x9a, 0xae, + 0x96, 0xe2, 0x1c, 0x2b, 0xf0, 0xe2, 0xec, 0xea, 0x7d, 0xa7, 0xe5, 0x06, 0xd0, 0x05, 0x5d, 0x2d, + 0xa9, 0xe6, 0x7c, 0x1d, 0xab, 0xc3, 0xac, 0xf7, 0x9d, 0xc9, 0x6e, 0xdf, 0x0a, 0xa0, 0x44, 0x57, + 0x4b, 0x8a, 0x99, 0xaf, 0xb3, 0xfa, 0x30, 0x76, 0xdb, 0x1d, 0xf5, 0xec, 0x6e, 0x80, 0x3d, 0x8d, + 0x3a, 0xce, 0xd7, 0x59, 0x7d, 0x78, 0x04, 0x77, 0x0f, 0x5d, 0x6b, 0x1c, 0x40, 0x2d, 0x5d, 0x2d, + 0xe5, 0xcc, 0xf9, 0x3a, 0x56, 0x47, 0x58, 0x23, 0x6b, 0xd0, 0xd1, 0xd5, 0xd2, 0x02, 0x65, 0x9d, + 0xb1, 0x06, 0xdb, 0x91, 0x35, 0xe8, 0xea, 0x6a, 0x89, 0x70, 0xac, 0xb0, 0x06, 0x4b, 0x70, 0xba, + 0xde, 0xdc, 0xee, 0x44, 0x37, 0x6e, 0x5f, 0x57, 0x4b, 0x79, 0x73, 0xa1, 0xee, 0xb5, 0xcc, 0xc2, + 0x8b, 0xec, 0x3d, 0x5d, 0x2d, 0x69, 0x3e, 0x5e, 0xe0, 0x17, 0x35, 0xc9, 0xa4, 0x5e, 0x38, 0xa3, + 0xc7, 0x04, 0x4d, 0xb2, 0xca, 0xb0, 0x26, 0x39, 0xf0, 0x39, 0x3d, 0x26, 0x6a, 0x32, 0x82, 0xc4, + 0xee, 0x39, 0xf2, 0xac, 0x1e, 0x13, 0x35, 0xc9, 0x91, 0x11, 0x4d, 0x72, 0xec, 0x39, 0x3d, 0x16, + 0xd6, 0xe4, 0x14, 0x5a, 0x64, 0x2e, 0xe8, 0xb1, 0xb0, 0x26, 0x39, 0x3a, 0xac, 0x49, 0x0e, 0x3e, + 0xaf, 0xc7, 0x42, 0x9a, 0x8c, 0x62, 0x45, 0xe2, 0x45, 0x3d, 0x16, 0xd2, 0xa4, 0x38, 0x3b, 0x4f, + 0x93, 0x1c, 0x7a, 0x41, 0x8f, 0x89, 0x9a, 0x14, 0x59, 0x7d, 0x4d, 0x72, 0xe8, 0xf3, 0x7a, 0x2c, + 0xa4, 0x49, 0x11, 0xeb, 0x6b, 0x92, 0x63, 0x2f, 0xea, 0xb1, 0x90, 0x26, 0x39, 0xf6, 0x65, 0x51, + 0x93, 0x1c, 0xfa, 0x81, 0xa2, 0xc7, 0x44, 0x51, 0x72, 0xe8, 0xb5, 0x90, 0x28, 0x39, 0xf6, 0x43, + 0x8a, 0x15, 0x55, 0x19, 0x05, 0x8b, 0xab, 0xf0, 0x11, 0x05, 0x8b, 0xb2, 0xe4, 0xe0, 0x1b, 0x11, + 0x59, 0x72, 0xf8, 0xc7, 0x14, 0x1e, 0xd6, 0xe5, 0xb4, 0x81, 0xc8, 0xff, 0x09, 0x35, 0x08, 0x0b, + 0x93, 0x1b, 0x04, 0xc2, 0x74, 0xb8, 0x13, 0x2d, 0x5c, 0xd2, 0x15, 0x5f, 0x98, 0x9e, 0x67, 0x15, + 0x85, 0xe9, 0x03, 0x2f, 0x63, 0xc8, 0xe0, 0xc2, 0x9c, 0x42, 0x56, 0x8d, 0x00, 0xa9, 0xeb, 0x4a, + 0x20, 0x4c, 0x1f, 0x19, 0x12, 0xa6, 0x8f, 0xbd, 0xa2, 0x2b, 0xa2, 0x30, 0x67, 0xa0, 0x45, 0xe6, + 0xa2, 0xae, 0x88, 0xc2, 0xf4, 0xd1, 0xa2, 0x30, 0x7d, 0xf0, 0x17, 0x74, 0x45, 0x10, 0xe6, 0x34, + 0x56, 0x24, 0x7e, 0x41, 0x57, 0x04, 0x61, 0x86, 0x67, 0xc7, 0x84, 0xe9, 0x43, 0x5f, 0xd4, 0x95, + 0x40, 0x98, 0x61, 0x56, 0x2e, 0x4c, 0x1f, 0xfa, 0x45, 0x5d, 0x11, 0x84, 0x19, 0xc6, 0x72, 0x61, + 0xfa, 0xd8, 0x97, 0x30, 0x4e, 0x7b, 0xc2, 0xf4, 0xb1, 0x82, 0x30, 0x7d, 0xe8, 0xef, 0xd0, 0x98, + 0xee, 0x0b, 0xd3, 0x87, 0x8a, 0xc2, 0xf4, 0xb1, 0xbf, 0x4b, 0xb1, 0x81, 0x30, 0xa7, 0xc1, 0xe2, + 0x2a, 0xfc, 0x1e, 0x05, 0x07, 0xc2, 0xf4, 0xc1, 0x61, 0x61, 0xfa, 0xf0, 0xdf, 0xa7, 0x70, 0x51, + 0x98, 0xb3, 0x0c, 0x44, 0xfe, 0x3f, 0xa0, 0x06, 0xa2, 0x30, 0x7d, 0x83, 0x25, 0x9c, 0x26, 0x15, + 0x66, 0xdb, 0xea, 0xb4, 0x26, 0x7d, 0x2a, 0xe3, 0x12, 0x55, 0x66, 0x2d, 0xee, 0x8e, 0x26, 0x16, + 0x9d, 0xab, 0xe3, 0xf4, 0xef, 0x7b, 0x6d, 0x64, 0x89, 0x0e, 0x9f, 0x09, 0x34, 0x30, 0x78, 0x99, + 0x2a, 0xb4, 0xa6, 0x56, 0xca, 0x66, 0x9e, 0xa9, 0x74, 0x1a, 0x5f, 0x35, 0x04, 0xfc, 0x55, 0xaa, + 0xd3, 0x9a, 0x5a, 0x35, 0x18, 0xbe, 0x6a, 0x04, 0xf8, 0x0a, 0x9d, 0x80, 0x27, 0xd6, 0xc0, 0xe2, + 0x1a, 0x55, 0x6b, 0x2d, 0x56, 0x29, 0x2f, 0x9b, 0x0b, 0x9e, 0x64, 0x67, 0x19, 0x85, 0xba, 0x79, + 0x85, 0x8a, 0xb6, 0x16, 0xab, 0x1a, 0xbe, 0x91, 0xd8, 0x53, 0x99, 0x0a, 0x9d, 0x4b, 0x37, 0xb0, + 0xb9, 0x4e, 0xb5, 0x5b, 0x8b, 0x57, 0xca, 0xcb, 0xcb, 0xa6, 0xc6, 0x15, 0x3c, 0xc3, 0x26, 0xd4, + 0xcf, 0x12, 0xd5, 0x70, 0x2d, 0x5e, 0x35, 0x7c, 0x9b, 0x70, 0x3f, 0x0b, 0x9e, 0x94, 0x03, 0x93, + 0x1b, 0x54, 0xcb, 0xb5, 0x64, 0x65, 0xc5, 0x58, 0x59, 0xbd, 0x6d, 0xe6, 0x99, 0xa6, 0x03, 0x1b, + 0x83, 0xf6, 0xc3, 0x45, 0x1d, 0x18, 0x2d, 0x53, 0x55, 0xd7, 0x92, 0xe5, 0x9b, 0x2b, 0xb7, 0xca, + 0xb7, 0x4c, 0x8d, 0xab, 0x3b, 0xb0, 0x7a, 0x9d, 0x5a, 0x71, 0x79, 0x07, 0x56, 0x2b, 0x54, 0xdf, + 0x35, 0x6d, 0xdf, 0xea, 0xf7, 0x9d, 0x57, 0xf4, 0xe2, 0x53, 0x67, 0xd4, 0x6f, 0x5f, 0x29, 0x82, + 0xa9, 0x71, 0xc5, 0x8b, 0xbd, 0x2e, 0x78, 0x92, 0x0f, 0xcc, 0x7f, 0x95, 0x66, 0xac, 0xb9, 0x5a, + 0xea, 0x6e, 0xaf, 0x6b, 0x3b, 0x63, 0xcb, 0xcc, 0x33, 0xf1, 0x47, 0xd6, 0x64, 0x3b, 0xba, 0x8e, + 0x5f, 0xa5, 0x66, 0x0b, 0xb5, 0xd8, 0xf5, 0x4a, 0x99, 0xf6, 0x34, 0x6b, 0x1d, 0xb7, 0xa3, 0xeb, + 0xf8, 0x6b, 0xd4, 0x86, 0xd4, 0x62, 0xd7, 0xab, 0x06, 0xb7, 0x11, 0xd7, 0xb1, 0x0a, 0x67, 0x84, + 0x77, 0x21, 0xb0, 0xfa, 0x75, 0x6a, 0x95, 0x67, 0x3d, 0x11, 0xff, 0x8d, 0x98, 0x69, 0x17, 0xea, + 0xed, 0x37, 0xa8, 0x9d, 0xc6, 0x7a, 0x23, 0xfe, 0x8b, 0x11, 0xd8, 0xdd, 0x84, 0xb3, 0x91, 0x5c, + 0xa2, 0x39, 0x6c, 0xed, 0x3d, 0xb1, 0xda, 0x85, 0x32, 0x4d, 0x29, 0xee, 0xaa, 0x9a, 0x62, 0x9e, + 0x0e, 0xa5, 0x15, 0x8f, 0xb0, 0x99, 0xdc, 0x86, 0x73, 0xd1, 0xe4, 0xc2, 0xb3, 0xac, 0xd0, 0x1c, + 0x03, 0x2d, 0xcf, 0x84, 0xf3, 0x8c, 0x88, 0xa9, 0x10, 0x54, 0x3c, 0x53, 0x83, 0x26, 0x1d, 0x81, + 0x69, 0x10, 0x5b, 0xb8, 0xe9, 0x6b, 0x70, 0x7e, 0x3a, 0xfd, 0xf0, 0x8c, 0x57, 0x69, 0x16, 0x82, + 0xc6, 0x67, 0xa3, 0x99, 0xc8, 0x94, 0xf9, 0x8c, 0xbe, 0xab, 0x34, 0x2d, 0x11, 0xcd, 0xa7, 0x7a, + 0x7f, 0x15, 0x0a, 0x53, 0x09, 0x8a, 0x67, 0x7d, 0x93, 0xe6, 0x29, 0x68, 0xfd, 0x5c, 0x24, 0x57, + 0x89, 0x1a, 0xcf, 0xe8, 0xfa, 0x16, 0x4d, 0x5c, 0x04, 0xe3, 0xa9, 0x9e, 0x71, 0xc9, 0xc2, 0x29, + 0x8c, 0x67, 0x7b, 0x9b, 0x66, 0x32, 0x7c, 0xc9, 0x42, 0xd9, 0x8c, 0xd8, 0x6f, 0x24, 0xa7, 0xf1, + 0x6c, 0x6b, 0x34, 0xb5, 0xe1, 0xfd, 0x86, 0xd3, 0x1b, 0x6e, 0xfc, 0x33, 0xd4, 0x78, 0x7b, 0xf6, + 0x8c, 0x7f, 0x14, 0xa3, 0x49, 0x09, 0xb7, 0xde, 0x9e, 0x35, 0x65, 0xdf, 0x7a, 0xc6, 0x94, 0x7f, + 0x4c, 0xad, 0x89, 0x60, 0x3d, 0x35, 0xe7, 0x37, 0x60, 0x71, 0x46, 0xbe, 0xe2, 0xd9, 0xff, 0x84, + 0xda, 0xe7, 0xd1, 0xfe, 0xdc, 0x54, 0xea, 0x32, 0xcd, 0x30, 0x63, 0x04, 0x3f, 0xa5, 0x0c, 0x5a, + 0x88, 0x61, 0x6a, 0x0c, 0x75, 0x98, 0xf3, 0xf2, 0xf1, 0xee, 0xc8, 0x99, 0x0c, 0x0b, 0x75, 0x5d, + 0x2d, 0x41, 0x59, 0x9f, 0x71, 0x3a, 0xf6, 0xd2, 0xf3, 0x75, 0x8a, 0x33, 0xc3, 0x66, 0x8c, 0x87, + 0x31, 0x33, 0x9e, 0x47, 0x7a, 0xec, 0x99, 0x3c, 0x0c, 0xe7, 0xf3, 0x08, 0x66, 0x94, 0xc7, 0x0b, + 0x77, 0x8c, 0xe7, 0xb1, 0xae, 0x3c, 0x83, 0xc7, 0x0b, 0x7e, 0x9c, 0x27, 0x64, 0xb6, 0xb8, 0x1a, + 0x9c, 0xc9, 0xb1, 0x9d, 0xbc, 0x10, 0x3d, 0xa4, 0xaf, 0xe3, 0xe9, 0x2a, 0x5c, 0xc9, 0xcc, 0x84, + 0xe1, 0x4d, 0x9b, 0xbd, 0xf5, 0x0c, 0xb3, 0xd0, 0x68, 0xa6, 0xcd, 0x7e, 0x7e, 0x86, 0x59, 0xf1, + 0x37, 0x15, 0x88, 0x3f, 0xd8, 0xd8, 0xba, 0x4f, 0xd2, 0x10, 0x7f, 0xa7, 0xb1, 0x71, 0x5f, 0x3b, + 0x45, 0x9f, 0xee, 0x36, 0x1a, 0x0f, 0x35, 0x85, 0x64, 0x20, 0x71, 0xf7, 0x4b, 0x3b, 0x6b, 0xdb, + 0x9a, 0x4a, 0xf2, 0x90, 0xad, 0x6f, 0x6c, 0xad, 0xaf, 0x99, 0x8f, 0xcc, 0x8d, 0xad, 0x1d, 0x2d, + 0x46, 0xdb, 0xea, 0x0f, 0x1b, 0x77, 0x76, 0xb4, 0x38, 0x49, 0x41, 0x8c, 0xd6, 0x25, 0x08, 0x40, + 0x72, 0x7b, 0xc7, 0xdc, 0xd8, 0x5a, 0xd7, 0x92, 0x94, 0x65, 0x67, 0x63, 0x73, 0x4d, 0x4b, 0x51, + 0xe4, 0xce, 0xdb, 0x8f, 0x1e, 0xae, 0x69, 0x69, 0xfa, 0x78, 0xc7, 0x34, 0xef, 0x7c, 0x49, 0xcb, + 0x50, 0xa3, 0xcd, 0x3b, 0x8f, 0x34, 0xc0, 0xe6, 0x3b, 0x77, 0x1f, 0xae, 0x69, 0x59, 0x92, 0x83, + 0x74, 0xfd, 0xed, 0xad, 0x7b, 0x3b, 0x1b, 0x8d, 0x2d, 0x2d, 0x57, 0xfc, 0x45, 0x28, 0xb0, 0x65, + 0x0e, 0xad, 0x22, 0xbb, 0x32, 0x78, 0x03, 0x12, 0x6c, 0x6f, 0x14, 0xd4, 0xca, 0xd5, 0xe9, 0xbd, + 0x99, 0x36, 0x5a, 0x62, 0xbb, 0xc4, 0x0c, 0x17, 0x2f, 0x42, 0x82, 0xad, 0xd3, 0x19, 0x48, 0xb0, + 0xf5, 0x51, 0xf1, 0x2a, 0x81, 0x15, 0x8a, 0xbf, 0xa5, 0x02, 0xac, 0x3b, 0xdb, 0x4f, 0x7a, 0x43, + 0xbc, 0xb8, 0xb9, 0x08, 0x30, 0x7e, 0xd2, 0x1b, 0x36, 0xf1, 0x0d, 0xe4, 0x97, 0x0e, 0x19, 0x5a, + 0x83, 0xbe, 0x97, 0x5c, 0x81, 0x1c, 0x36, 0xf3, 0x57, 0x04, 0xef, 0x1a, 0x52, 0x66, 0x96, 0xd6, + 0x71, 0x27, 0x19, 0x86, 0x54, 0x0d, 0xbc, 0x62, 0x48, 0x0a, 0x90, 0xaa, 0x41, 0x2e, 0x03, 0x16, + 0x9b, 0x63, 0x8c, 0xa6, 0x78, 0xad, 0x90, 0x31, 0xb1, 0x5f, 0x16, 0x5f, 0xc9, 0xeb, 0x80, 0x7d, + 0xb2, 0x99, 0xe7, 0x67, 0xbd, 0x25, 0xde, 0x80, 0x97, 0xe8, 0x03, 0x9b, 0x6f, 0x60, 0xb2, 0xd8, + 0x80, 0x8c, 0x5f, 0x4f, 0x7b, 0xc3, 0x5a, 0x3e, 0x27, 0x0d, 0xe7, 0x04, 0x58, 0xe5, 0x4f, 0x8a, + 0x01, 0xf8, 0x78, 0x16, 0x70, 0x3c, 0xcc, 0x88, 0x0d, 0xa8, 0x78, 0x11, 0xe6, 0xb6, 0x1c, 0x9b, + 0xbd, 0xc7, 0xb8, 0x4e, 0x39, 0x50, 0x5a, 0x05, 0x05, 0xcf, 0xbf, 0x4a, 0xab, 0x78, 0x09, 0x40, + 0x68, 0xd3, 0x40, 0xd9, 0x65, 0x6d, 0xe8, 0x0f, 0x94, 0xdd, 0xe2, 0x35, 0x48, 0x6e, 0xb6, 0x0e, + 0x76, 0x5a, 0x5d, 0x72, 0x05, 0xa0, 0xdf, 0x1a, 0xbb, 0xcd, 0x0e, 0xee, 0xc4, 0xe7, 0x9f, 0x7f, + 0xfe, 0xb9, 0x82, 0xc9, 0x74, 0x86, 0xd6, 0xb2, 0x1d, 0x19, 0x03, 0x34, 0xfa, 0xed, 0x4d, 0x6b, + 0x3c, 0x6e, 0x75, 0x2d, 0xb2, 0x0a, 0x49, 0xdb, 0x1a, 0xd3, 0xe8, 0xab, 0xe0, 0x5d, 0xd3, 0x45, + 0x71, 0x1d, 0x02, 0xdc, 0xd2, 0x16, 0x82, 0x4c, 0x0e, 0x26, 0x1a, 0xc4, 0xec, 0xc9, 0x00, 0x6f, + 0xd4, 0x12, 0x26, 0x7d, 0x5c, 0x7c, 0x1e, 0x92, 0x0c, 0x43, 0x08, 0xc4, 0xed, 0xd6, 0xc0, 0x2a, + 0xb0, 0x9e, 0xf1, 0xb9, 0xf8, 0x55, 0x05, 0x60, 0xcb, 0x7a, 0x7a, 0xac, 0x5e, 0x03, 0x9c, 0xa4, + 0xd7, 0x18, 0xeb, 0xf5, 0x55, 0x59, 0xaf, 0x54, 0x6d, 0x1d, 0xc7, 0x69, 0x37, 0xd9, 0x46, 0xb3, + 0xeb, 0xbf, 0x0c, 0xad, 0xc1, 0x9d, 0x2b, 0x3e, 0x86, 0xdc, 0x86, 0x6d, 0x5b, 0x23, 0x6f, 0x54, + 0x04, 0xe2, 0xfb, 0xce, 0xd8, 0xe5, 0x37, 0x91, 0xf8, 0x4c, 0x0a, 0x10, 0x1f, 0x3a, 0x23, 0x97, + 0xcd, 0xb4, 0x16, 0x37, 0x96, 0x97, 0x97, 0x4d, 0xac, 0x21, 0xcf, 0x43, 0x66, 0xcf, 0xb1, 0x6d, + 0x6b, 0x8f, 0x4e, 0x23, 0x86, 0x47, 0xc7, 0xa0, 0xa2, 0xf8, 0xcb, 0x0a, 0xe4, 0x1a, 0xee, 0x7e, + 0x40, 0xae, 0x41, 0xec, 0x89, 0x75, 0x88, 0xc3, 0x8b, 0x99, 0xf4, 0x91, 0xbe, 0x30, 0x5f, 0x69, + 0xf5, 0x27, 0xec, 0x5e, 0x32, 0x67, 0xb2, 0x02, 0x39, 0x0b, 0xc9, 0xa7, 0x56, 0xaf, 0xbb, 0xef, + 0x22, 0xa7, 0x6a, 0xf2, 0x12, 0x59, 0x82, 0x44, 0x8f, 0x0e, 0xb6, 0x10, 0xc7, 0x15, 0x2b, 0x88, + 0x2b, 0x26, 0xce, 0xc2, 0x64, 0xb0, 0xab, 0xe9, 0x74, 0x5b, 0x7b, 0xff, 0xfd, 0xf7, 0xdf, 0x57, + 0x8b, 0xfb, 0x70, 0xc6, 0x7b, 0x89, 0x43, 0xd3, 0x7d, 0x04, 0x85, 0xbe, 0xe5, 0x34, 0x3b, 0x3d, + 0xbb, 0xd5, 0xef, 0x1f, 0x36, 0x9f, 0x3a, 0x76, 0xb3, 0x65, 0x37, 0x9d, 0xf1, 0x5e, 0x6b, 0x84, + 0x4b, 0x20, 0xeb, 0xe4, 0x4c, 0xdf, 0x72, 0xea, 0xcc, 0xf0, 0x5d, 0xc7, 0xbe, 0x63, 0x37, 0xa8, + 0x55, 0xf1, 0xb3, 0x38, 0x64, 0x36, 0x0f, 0x3d, 0xfe, 0x33, 0x90, 0xd8, 0x73, 0x26, 0x36, 0x5b, + 0xcf, 0x84, 0xc9, 0x0a, 0xfe, 0x3e, 0xa9, 0xc2, 0x3e, 0x9d, 0x81, 0xc4, 0x7b, 0x13, 0xc7, 0xb5, + 0x70, 0xca, 0x19, 0x93, 0x15, 0xe8, 0x8a, 0x0d, 0x2d, 0xb7, 0x10, 0xc7, 0x6b, 0x0a, 0xfa, 0x18, + 0xac, 0x41, 0xe2, 0x58, 0x6b, 0x40, 0x96, 0x21, 0xe9, 0xd0, 0x3d, 0x18, 0x17, 0x92, 0x78, 0x0f, + 0x1b, 0x32, 0x10, 0x77, 0xc7, 0xe4, 0x38, 0xf2, 0x00, 0x16, 0x9e, 0x5a, 0xcd, 0xc1, 0x64, 0xec, + 0x36, 0xbb, 0x4e, 0xb3, 0x6d, 0x59, 0x43, 0x6b, 0x54, 0x98, 0xc3, 0xde, 0x42, 0x1e, 0x62, 0xd6, + 0x82, 0x9a, 0xf3, 0x4f, 0xad, 0xcd, 0xc9, 0xd8, 0x5d, 0x77, 0xee, 0xa3, 0x1d, 0x59, 0x85, 0xcc, + 0xc8, 0xa2, 0x7e, 0x81, 0x0e, 0x39, 0x37, 0x3d, 0x82, 0x90, 0x71, 0x7a, 0x64, 0x0d, 0xb1, 0x82, + 0xdc, 0x84, 0xf4, 0x6e, 0xef, 0x89, 0x35, 0xde, 0xb7, 0xda, 0x85, 0x94, 0xae, 0x94, 0xe6, 0xcb, + 0x17, 0x44, 0x2b, 0x7f, 0x81, 0x97, 0xee, 0x39, 0x7d, 0x67, 0x64, 0xfa, 0x60, 0xf2, 0x1a, 0x64, + 0xc6, 0xce, 0xc0, 0x62, 0x6a, 0x4f, 0x63, 0xb0, 0xbd, 0x3c, 0xdb, 0x72, 0xdb, 0x19, 0x58, 0x9e, + 0x57, 0xf3, 0x2c, 0xc8, 0x05, 0x36, 0xdc, 0x5d, 0x7a, 0x98, 0x28, 0x00, 0x5e, 0xf8, 0xd0, 0x41, + 0xe1, 0xe1, 0x82, 0x2c, 0xd2, 0x41, 0x75, 0x3b, 0x34, 0x67, 0x2b, 0x64, 0xf1, 0x2c, 0xef, 0x97, + 0x17, 0x5f, 0x81, 0x8c, 0x4f, 0x18, 0xb8, 0x43, 0xe6, 0x82, 0x32, 0xe8, 0x21, 0x98, 0x3b, 0x64, + 0xfe, 0xe7, 0x45, 0x48, 0xe0, 0xc0, 0x69, 0xe4, 0x32, 0xd7, 0x68, 0xa0, 0xcc, 0x40, 0x62, 0xdd, + 0x5c, 0x5b, 0xdb, 0xd2, 0x14, 0x8c, 0x99, 0x0f, 0xdf, 0x5e, 0xd3, 0x54, 0x41, 0xbf, 0xbf, 0xad, + 0x42, 0x6c, 0xed, 0x00, 0x95, 0xd3, 0x6e, 0xb9, 0x2d, 0xef, 0x0d, 0xa7, 0xcf, 0xa4, 0x06, 0x99, + 0x41, 0xcb, 0xeb, 0x4b, 0xc5, 0x25, 0x0e, 0xf9, 0x92, 0xb5, 0x03, 0x77, 0x69, 0xb3, 0xc5, 0x7a, + 0x5e, 0xb3, 0xdd, 0xd1, 0xa1, 0x99, 0x1e, 0xf0, 0xe2, 0xe2, 0xab, 0x30, 0x17, 0x6a, 0x12, 0x5f, + 0xd1, 0xc4, 0x8c, 0x57, 0x34, 0xc1, 0x5f, 0xd1, 0x9a, 0x7a, 0x4b, 0x29, 0xd7, 0x20, 0x3e, 0x70, + 0x46, 0x16, 0x79, 0x6e, 0xe6, 0x02, 0x17, 0xba, 0x28, 0x99, 0x7c, 0x64, 0x28, 0x26, 0xda, 0x94, + 0x5f, 0x86, 0xb8, 0x6b, 0x1d, 0xb8, 0xcf, 0xb2, 0xdd, 0x67, 0xf3, 0xa3, 0x90, 0xf2, 0x75, 0x48, + 0xda, 0x93, 0xc1, 0xae, 0x35, 0x7a, 0x16, 0xb8, 0x87, 0x03, 0xe3, 0xa0, 0xe2, 0x3b, 0xa0, 0xdd, + 0x73, 0x06, 0xc3, 0xbe, 0x75, 0xb0, 0x76, 0xe0, 0x5a, 0xf6, 0xb8, 0xe7, 0xd8, 0x74, 0x0e, 0x9d, + 0xde, 0x08, 0xdd, 0x1a, 0xce, 0x01, 0x0b, 0xd4, 0xcd, 0x8c, 0xad, 0x3d, 0xc7, 0x6e, 0xf3, 0xa9, + 0xf1, 0x12, 0x45, 0xbb, 0xfb, 0xbd, 0x11, 0xf5, 0x68, 0x34, 0xf8, 0xb0, 0x42, 0x71, 0x1d, 0xf2, + 0xfc, 0x18, 0x36, 0xe6, 0x1d, 0x17, 0xaf, 0x42, 0xce, 0xab, 0xc2, 0x5f, 0x7e, 0xd2, 0x10, 0x7f, + 0xbc, 0x66, 0x36, 0xb4, 0x53, 0x74, 0x5f, 0x1b, 0x5b, 0x6b, 0x9a, 0x42, 0x1f, 0x76, 0xde, 0x6d, + 0x84, 0xf6, 0xf2, 0x79, 0xc8, 0xf9, 0x63, 0xdf, 0xb6, 0x5c, 0x6c, 0xa1, 0x51, 0x2a, 0x55, 0x53, + 0xd3, 0x4a, 0x31, 0x05, 0x89, 0xb5, 0xc1, 0xd0, 0x3d, 0x2c, 0xfe, 0x12, 0x64, 0x39, 0xe8, 0x61, + 0x6f, 0xec, 0x92, 0xdb, 0x90, 0x1a, 0xf0, 0xf9, 0x2a, 0x98, 0x8b, 0x86, 0x65, 0x1d, 0x20, 0xbd, + 0x67, 0xd3, 0xc3, 0x2f, 0x56, 0x20, 0x25, 0xb8, 0x77, 0xee, 0x79, 0x54, 0xd1, 0xf3, 0x30, 0x1f, + 0x15, 0x13, 0x7c, 0x54, 0x71, 0x13, 0x52, 0x2c, 0x30, 0x8f, 0x31, 0xdd, 0x60, 0xe7, 0x77, 0xa6, + 0x31, 0x26, 0xbe, 0x2c, 0xab, 0x63, 0x39, 0xd4, 0x65, 0xc8, 0xe2, 0x3b, 0xe3, 0xab, 0x90, 0x7a, + 0x73, 0xc0, 0x2a, 0xa6, 0xf8, 0x3f, 0x4a, 0x40, 0xda, 0x5b, 0x2b, 0x72, 0x01, 0x92, 0xec, 0x10, + 0x8b, 0x54, 0xde, 0xa5, 0x4e, 0x02, 0x8f, 0xad, 0xe4, 0x02, 0xa4, 0xf8, 0x41, 0x95, 0x07, 0x1c, + 0xb5, 0x52, 0x36, 0x93, 0xec, 0x60, 0xea, 0x37, 0x56, 0x0d, 0xf4, 0x93, 0xec, 0xba, 0x26, 0xc9, + 0x8e, 0x9e, 0x44, 0x87, 0x8c, 0x7f, 0xd8, 0xc4, 0x10, 0xc1, 0xef, 0x66, 0xd2, 0xde, 0xe9, 0x52, + 0x40, 0x54, 0x0d, 0x74, 0xa0, 0xfc, 0x22, 0x26, 0x5d, 0x0f, 0xf2, 0xa6, 0xb4, 0x77, 0x64, 0xc4, + 0x5f, 0x9e, 0xbc, 0x5b, 0x97, 0x14, 0x3f, 0x24, 0x06, 0x80, 0xaa, 0x81, 0x9e, 0xc9, 0xbb, 0x62, + 0x49, 0xf1, 0x83, 0x20, 0xb9, 0x4c, 0x87, 0x88, 0x07, 0x3b, 0xf4, 0x3f, 0xc1, 0x7d, 0x4a, 0x92, + 0x1d, 0xf7, 0xc8, 0x15, 0xca, 0xc0, 0x4e, 0x6f, 0xe8, 0x1a, 0x82, 0xcb, 0x93, 0x14, 0x3f, 0xd4, + 0x91, 0x6b, 0x14, 0xc2, 0x96, 0xbf, 0x00, 0xcf, 0xb8, 0x29, 0x49, 0xf1, 0x9b, 0x12, 0xa2, 0xd3, + 0x0e, 0xd1, 0x43, 0xa1, 0x57, 0x12, 0x6e, 0x45, 0x92, 0xec, 0x56, 0x84, 0x5c, 0x42, 0x3a, 0x36, + 0xa9, 0x5c, 0x70, 0x03, 0x92, 0xe2, 0xa7, 0xc0, 0xa0, 0x1d, 0x73, 0x49, 0xff, 0xb6, 0x23, 0xc5, + 0xcf, 0x79, 0xe4, 0x16, 0xdd, 0x2f, 0xaa, 0xf0, 0xc2, 0x3c, 0xfa, 0xe2, 0x45, 0x51, 0x7a, 0xde, + 0xae, 0x32, 0x57, 0x5c, 0x63, 0x6e, 0xcc, 0x4c, 0xd4, 0xf1, 0x8d, 0x58, 0xa4, 0x96, 0x8f, 0x7a, + 0x76, 0xa7, 0x90, 0xc7, 0xb5, 0x88, 0xf5, 0xec, 0x8e, 0x99, 0xa8, 0xd3, 0x1a, 0xa6, 0x82, 0x2d, + 0xda, 0xa6, 0x61, 0x5b, 0xfc, 0x3a, 0x6b, 0xa4, 0x55, 0xa4, 0x00, 0x89, 0x7a, 0x73, 0xab, 0x65, + 0x17, 0x16, 0x98, 0x9d, 0xdd, 0xb2, 0xcd, 0x78, 0x7d, 0xab, 0x65, 0x93, 0x97, 0x21, 0x36, 0x9e, + 0xec, 0x16, 0xc8, 0xf4, 0xcf, 0x82, 0xdb, 0x93, 0x5d, 0x6f, 0x30, 0x26, 0xc5, 0x90, 0x0b, 0x90, + 0x1e, 0xbb, 0xa3, 0xe6, 0x2f, 0x58, 0x23, 0xa7, 0x70, 0x1a, 0x97, 0xf1, 0x94, 0x99, 0x1a, 0xbb, + 0xa3, 0xc7, 0xd6, 0xc8, 0x39, 0xa6, 0x0f, 0x2e, 0x5e, 0x82, 0xac, 0xc0, 0x4b, 0xf2, 0xa0, 0xd8, + 0x2c, 0x81, 0xa9, 0x29, 0x37, 0x4d, 0xc5, 0x2e, 0xbe, 0x03, 0x39, 0xef, 0x88, 0x85, 0x33, 0x36, + 0xe8, 0xdb, 0xd4, 0x77, 0x46, 0xf8, 0x96, 0xce, 0x97, 0x2f, 0x85, 0x23, 0x66, 0x00, 0xe4, 0x91, + 0x8b, 0x81, 0x8b, 0x5a, 0x64, 0x30, 0x4a, 0xf1, 0x07, 0x0a, 0xe4, 0x36, 0x9d, 0x51, 0xf0, 0xfb, + 0xc5, 0x19, 0x48, 0xec, 0x3a, 0x4e, 0x7f, 0x8c, 0xc4, 0x69, 0x93, 0x15, 0xc8, 0x8b, 0x90, 0xc3, + 0x07, 0xef, 0x90, 0xac, 0xfa, 0xb7, 0x40, 0x59, 0xac, 0xe7, 0xe7, 0x62, 0x02, 0xf1, 0x9e, 0xed, + 0x8e, 0xb9, 0x47, 0xc3, 0x67, 0xf2, 0x05, 0xc8, 0xd2, 0xbf, 0x9e, 0x65, 0xdc, 0xcf, 0xa6, 0x81, + 0x56, 0x73, 0xc3, 0x97, 0x60, 0x0e, 0x35, 0xe0, 0xc3, 0x52, 0xfe, 0x8d, 0x4f, 0x8e, 0x35, 0x70, + 0x60, 0x01, 0x52, 0xcc, 0x21, 0x8c, 0xf1, 0x07, 0xdf, 0x8c, 0xe9, 0x15, 0xa9, 0x9b, 0xc5, 0x83, + 0x0a, 0xcb, 0x40, 0x52, 0x26, 0x2f, 0x15, 0xef, 0x41, 0x1a, 0xc3, 0x65, 0xa3, 0xdf, 0x26, 0x2f, + 0x80, 0xd2, 0x2d, 0x58, 0x18, 0xae, 0xcf, 0x86, 0x4e, 0x21, 0x1c, 0xb0, 0xb4, 0x6e, 0x2a, 0xdd, + 0xc5, 0x05, 0x50, 0xd6, 0xe9, 0xb1, 0xe0, 0x80, 0x3b, 0x6c, 0xe5, 0xa0, 0xf8, 0x16, 0x27, 0xd9, + 0xb2, 0x9e, 0xca, 0x49, 0xb6, 0xac, 0xa7, 0x8c, 0xe4, 0xf2, 0x14, 0x09, 0x2d, 0x1d, 0xf2, 0xdf, + 0xc0, 0x95, 0xc3, 0x62, 0x05, 0xe6, 0xf0, 0x45, 0xed, 0xd9, 0xdd, 0x47, 0x4e, 0xcf, 0xc6, 0x83, + 0x48, 0x07, 0x13, 0x38, 0xc5, 0x54, 0x3a, 0x74, 0x1f, 0xac, 0x83, 0xd6, 0x1e, 0x4b, 0x87, 0xd3, + 0x26, 0x2b, 0x14, 0xbf, 0x1f, 0x87, 0x79, 0xee, 0x64, 0xdf, 0xed, 0xb9, 0xfb, 0x9b, 0xad, 0x21, + 0xd9, 0x82, 0x1c, 0xf5, 0xaf, 0xcd, 0x41, 0x6b, 0x38, 0xa4, 0x2f, 0xb2, 0x82, 0xa1, 0xf9, 0xda, + 0x0c, 0xb7, 0xcd, 0x2d, 0x96, 0xb6, 0x5a, 0x03, 0x6b, 0x93, 0xa1, 0x59, 0xa0, 0xce, 0xda, 0x41, + 0x0d, 0x79, 0x00, 0xd9, 0xc1, 0xb8, 0xeb, 0xd3, 0xb1, 0x48, 0x7f, 0x55, 0x42, 0xb7, 0x39, 0xee, + 0x86, 0xd8, 0x60, 0xe0, 0x57, 0xd0, 0xc1, 0x51, 0xef, 0xec, 0xb3, 0xc5, 0x8e, 0x1c, 0x1c, 0x75, + 0x25, 0xe1, 0xc1, 0xed, 0x06, 0x35, 0xa4, 0x0e, 0x40, 0x5f, 0x35, 0xd7, 0xa1, 0x27, 0x3c, 0xd4, + 0x52, 0xb6, 0x5c, 0x92, 0xb0, 0x6d, 0xbb, 0xa3, 0x1d, 0x67, 0xdb, 0x1d, 0xf1, 0x84, 0x64, 0xcc, + 0x8b, 0x8b, 0xaf, 0x83, 0x16, 0x5d, 0x85, 0xa3, 0x72, 0x92, 0x8c, 0x90, 0x93, 0x2c, 0xfe, 0x1c, + 0xe4, 0x23, 0xd3, 0x16, 0xcd, 0x09, 0x33, 0xbf, 0x21, 0x9a, 0x67, 0xcb, 0xe7, 0x43, 0xdf, 0x68, + 0x88, 0x5b, 0x2f, 0x32, 0xbf, 0x0e, 0x5a, 0x74, 0x09, 0x44, 0xea, 0xb4, 0xe4, 0x40, 0x83, 0xf6, + 0xaf, 0xc2, 0x5c, 0x68, 0xd2, 0xa2, 0x71, 0xe6, 0x88, 0x69, 0x15, 0x7f, 0x25, 0x01, 0x89, 0x86, + 0x6d, 0x39, 0x1d, 0x72, 0x2e, 0x1c, 0x3b, 0xdf, 0x3c, 0xe5, 0xc5, 0xcd, 0xf3, 0x91, 0xb8, 0xf9, + 0xe6, 0x29, 0x3f, 0x6a, 0x9e, 0x8f, 0x44, 0x4d, 0xaf, 0xa9, 0x6a, 0x90, 0x8b, 0x53, 0x31, 0xf3, + 0xcd, 0x53, 0x42, 0xc0, 0xbc, 0x38, 0x15, 0x30, 0x83, 0xe6, 0xaa, 0x41, 0x1d, 0x6c, 0x38, 0x5a, + 0xbe, 0x79, 0x2a, 0x88, 0x94, 0x17, 0xa2, 0x91, 0xd2, 0x6f, 0xac, 0x1a, 0x6c, 0x48, 0x42, 0x94, + 0xc4, 0x21, 0xb1, 0xf8, 0x78, 0x21, 0x1a, 0x1f, 0xd1, 0x8e, 0x47, 0xc6, 0x0b, 0xd1, 0xc8, 0x88, + 0x8d, 0x3c, 0x12, 0x9e, 0x8f, 0x44, 0x42, 0x24, 0x65, 0x21, 0xf0, 0x42, 0x34, 0x04, 0x32, 0x3b, + 0x61, 0xa4, 0x62, 0xfc, 0xf3, 0x1b, 0xab, 0x06, 0x31, 0x22, 0xc1, 0x4f, 0x76, 0x10, 0xc1, 0xdd, + 0xc0, 0x30, 0x50, 0xa5, 0x0b, 0xe7, 0x25, 0xa8, 0x79, 0xe9, 0x27, 0x2c, 0xb8, 0xa2, 0x5e, 0x82, + 0x66, 0x40, 0xaa, 0xc3, 0xcf, 0xea, 0x1a, 0x7a, 0xb2, 0x90, 0x38, 0x51, 0x02, 0x4b, 0xf5, 0x26, + 0x7a, 0x34, 0x3a, 0xbb, 0x0e, 0x3b, 0x70, 0x94, 0x60, 0xae, 0xde, 0x7c, 0xd8, 0x1a, 0x75, 0x29, + 0x74, 0xa7, 0xd5, 0xf5, 0x6f, 0x3d, 0xa8, 0x0a, 0xb2, 0x75, 0xde, 0xb2, 0xd3, 0xea, 0x92, 0xb3, + 0x9e, 0xc4, 0xda, 0xd8, 0xaa, 0x70, 0x91, 0x2d, 0x9e, 0xa3, 0x4b, 0xc7, 0xc8, 0xd0, 0x37, 0x2e, + 0x70, 0xdf, 0x78, 0x37, 0x05, 0x89, 0x89, 0xdd, 0x73, 0xec, 0xbb, 0x19, 0x48, 0xb9, 0xce, 0x68, + 0xd0, 0x72, 0x9d, 0xe2, 0x0f, 0x15, 0x80, 0x7b, 0xce, 0x60, 0x30, 0xb1, 0x7b, 0xef, 0x4d, 0x2c, + 0x72, 0x09, 0xb2, 0x83, 0xd6, 0x13, 0xab, 0x39, 0xb0, 0x9a, 0x7b, 0x23, 0xef, 0x6d, 0xc8, 0xd0, + 0xaa, 0x4d, 0xeb, 0xde, 0xe8, 0x90, 0x14, 0xbc, 0x04, 0x1e, 0x15, 0x84, 0xc2, 0xe4, 0x09, 0xfd, + 0x19, 0x9e, 0x8e, 0x26, 0xf9, 0x4e, 0x7a, 0x09, 0x29, 0x3b, 0xe4, 0xa4, 0xf8, 0x1e, 0xb2, 0x63, + 0xce, 0x39, 0x48, 0xba, 0xd6, 0x60, 0xd8, 0xdc, 0x43, 0xc1, 0x50, 0x51, 0x24, 0x68, 0xf9, 0x1e, + 0xb9, 0x01, 0xb1, 0x3d, 0xa7, 0x8f, 0x52, 0x39, 0x72, 0x77, 0x28, 0x92, 0xbc, 0x04, 0xb1, 0xc1, + 0x98, 0xc9, 0x27, 0x5b, 0x3e, 0x1d, 0xca, 0x20, 0x58, 0xc8, 0xa2, 0xc0, 0xc1, 0xb8, 0xeb, 0xcf, + 0xbd, 0xf8, 0xa9, 0x0a, 0x69, 0xba, 0x5f, 0x6f, 0xef, 0xd4, 0x6f, 0xe1, 0xb1, 0x61, 0xaf, 0xd5, + 0xc7, 0x1b, 0x02, 0xfa, 0x9a, 0xf2, 0x12, 0xad, 0xff, 0x8a, 0xb5, 0xe7, 0x3a, 0x23, 0x74, 0xcd, + 0x19, 0x93, 0x97, 0xe8, 0x92, 0xb3, 0xac, 0x38, 0xc6, 0x67, 0xc9, 0x8a, 0x98, 0xd1, 0xb7, 0x86, + 0x4d, 0xea, 0x03, 0x98, 0xbf, 0x0c, 0x9d, 0xae, 0xbd, 0xee, 0xe8, 0xd1, 0xed, 0x81, 0x75, 0xc8, + 0xfc, 0x64, 0x72, 0x80, 0x05, 0xf2, 0xb3, 0xec, 0xc8, 0xc7, 0x76, 0x92, 0x7d, 0x5f, 0x55, 0x7c, + 0x96, 0xf1, 0x3b, 0x14, 0x14, 0x9c, 0xfb, 0xb0, 0xb8, 0x78, 0x1b, 0xb2, 0x02, 0xef, 0x51, 0xae, + 0x28, 0x16, 0xf1, 0x63, 0x21, 0xd6, 0xa3, 0x6e, 0x75, 0x44, 0x3f, 0x46, 0x57, 0xd4, 0xa1, 0x1a, + 0xbe, 0x9a, 0x87, 0x58, 0xbd, 0xd1, 0xa0, 0x79, 0x56, 0xbd, 0xd1, 0x58, 0xd1, 0x94, 0xda, 0x0a, + 0xa4, 0xbb, 0x23, 0xcb, 0xa2, 0xae, 0xf7, 0x59, 0xe7, 0xbc, 0x2f, 0xe3, 0xb2, 0xfa, 0xb0, 0xda, + 0x5b, 0x90, 0xda, 0x63, 0x27, 0x3d, 0xf2, 0xcc, 0x5b, 0x8d, 0xc2, 0x1f, 0xb3, 0xdb, 0xb5, 0xe7, + 0x45, 0x40, 0xf4, 0x7c, 0x68, 0x7a, 0x3c, 0xb5, 0x1d, 0xc8, 0x8c, 0x9a, 0x47, 0x93, 0x7e, 0xc0, + 0x62, 0xb9, 0x9c, 0x34, 0x3d, 0xe2, 0x55, 0xb5, 0x75, 0x58, 0xb0, 0x1d, 0xef, 0x47, 0xbe, 0x66, + 0x9b, 0x7b, 0xb2, 0x59, 0x49, 0xb4, 0xd7, 0x81, 0xc5, 0x3e, 0x15, 0xb0, 0x1d, 0xde, 0xc0, 0xbc, + 0x5f, 0x6d, 0x0d, 0x34, 0x81, 0xa8, 0xc3, 0xdc, 0xa5, 0x8c, 0xa7, 0xc3, 0xbe, 0x4e, 0xf0, 0x79, + 0xd0, 0xc3, 0x46, 0x68, 0xb8, 0x0f, 0x94, 0xd1, 0x74, 0xd9, 0xc7, 0x1e, 0x3e, 0x0d, 0x86, 0x95, + 0x69, 0x1a, 0x1a, 0x11, 0x64, 0x34, 0xfb, 0xec, 0x4b, 0x10, 0x91, 0xa6, 0x6a, 0x44, 0x56, 0x67, + 0x72, 0x8c, 0xe1, 0xf4, 0xd8, 0xa7, 0x1c, 0x3e, 0x0f, 0x0b, 0x38, 0x33, 0x88, 0x8e, 0x1a, 0xd0, + 0x97, 0xd9, 0x77, 0x1e, 0x21, 0xa2, 0xa9, 0x11, 0x8d, 0x8f, 0x31, 0xa2, 0x27, 0xec, 0xb3, 0x0a, + 0x9f, 0x68, 0x7b, 0xd6, 0x88, 0xc6, 0xc7, 0x18, 0x51, 0x9f, 0x7d, 0x72, 0x11, 0x22, 0xaa, 0x1a, + 0xb5, 0x0d, 0x20, 0xe2, 0xc6, 0xf3, 0xe8, 0x2c, 0x65, 0x1a, 0xb0, 0x4f, 0x69, 0x82, 0xad, 0x67, + 0x46, 0xb3, 0xa8, 0x8e, 0x1a, 0x94, 0xcd, 0xbe, 0xb3, 0x09, 0x53, 0x55, 0x8d, 0xda, 0x03, 0x38, + 0x2d, 0x4e, 0xef, 0x58, 0xc3, 0x72, 0xd8, 0x47, 0x22, 0xc1, 0x04, 0xb9, 0xd5, 0x4c, 0xb2, 0xa3, + 0x06, 0x36, 0x64, 0x1f, 0x90, 0x44, 0xc8, 0xaa, 0x46, 0xed, 0x1e, 0xe4, 0x05, 0xb2, 0x5d, 0xbc, + 0x57, 0x90, 0x11, 0xbd, 0xc7, 0x3e, 0x7b, 0xf2, 0x89, 0x68, 0x46, 0x15, 0xdd, 0x3d, 0x96, 0x63, + 0x48, 0x69, 0x46, 0xec, 0xab, 0x9d, 0x60, 0x3c, 0x68, 0x13, 0x79, 0x51, 0x76, 0x59, 0x42, 0x22, + 0xe3, 0x19, 0xb3, 0x2f, 0x7a, 0x82, 0xe1, 0x50, 0x93, 0xda, 0x20, 0x34, 0x29, 0x8b, 0xa6, 0x19, + 0x52, 0x16, 0x17, 0x23, 0x62, 0x49, 0x02, 0x59, 0x12, 0xaf, 0xaf, 0x84, 0xe9, 0xd3, 0x62, 0xed, + 0x01, 0xcc, 0x9f, 0xc4, 0x65, 0x7d, 0xa0, 0xb0, 0xbb, 0x8c, 0xca, 0xd2, 0x8a, 0xb1, 0xb2, 0x6a, + 0xce, 0xb5, 0x43, 0x9e, 0x6b, 0x1d, 0xe6, 0x4e, 0xe0, 0xb6, 0x3e, 0x54, 0xd8, 0x8d, 0x00, 0xe5, + 0x32, 0x73, 0xed, 0xb0, 0xef, 0x9a, 0x3b, 0x81, 0xe3, 0xfa, 0x48, 0x61, 0x57, 0x48, 0x46, 0xd9, + 0xa7, 0xf1, 0x7c, 0xd7, 0xdc, 0x09, 0x1c, 0xd7, 0xc7, 0xec, 0xc4, 0xaf, 0x1a, 0x15, 0x91, 0x06, + 0x3d, 0xc5, 0xfc, 0x49, 0x1c, 0xd7, 0x27, 0x0a, 0x5e, 0x29, 0xa9, 0x86, 0xe1, 0xaf, 0x8f, 0xef, + 0xbb, 0xe6, 0x4f, 0xe2, 0xb8, 0xbe, 0xa6, 0xe0, 0xd5, 0x93, 0x6a, 0xac, 0x86, 0x88, 0xc2, 0x23, + 0x3a, 0x8e, 0xe3, 0xfa, 0x54, 0xc1, 0xfb, 0x20, 0xd5, 0xa8, 0xfa, 0x44, 0xdb, 0x53, 0x23, 0x3a, + 0x8e, 0xe3, 0xfa, 0x3a, 0x9e, 0xaf, 0x6a, 0xaa, 0x71, 0x33, 0x44, 0x84, 0xbe, 0x2b, 0x7f, 0x22, + 0xc7, 0xf5, 0x0d, 0x05, 0xaf, 0xee, 0x54, 0xe3, 0x96, 0xe9, 0x8d, 0x20, 0xf0, 0x5d, 0xf9, 0x13, + 0x39, 0xae, 0x6f, 0x2a, 0x78, 0xc7, 0xa7, 0x1a, 0xb7, 0xc3, 0x54, 0xe8, 0xbb, 0xb4, 0x93, 0x39, + 0xae, 0xcf, 0x14, 0xfc, 0xa2, 0x47, 0x5d, 0x5d, 0x36, 0xbd, 0x41, 0x08, 0xbe, 0x4b, 0x3b, 0x99, + 0xe3, 0xfa, 0x96, 0x82, 0x9f, 0xf9, 0xa8, 0xab, 0x2b, 0x11, 0xb2, 0xaa, 0x51, 0x5b, 0x83, 0xdc, + 0xf1, 0x1d, 0xd7, 0xb7, 0xc5, 0x1b, 0xd4, 0x6c, 0x5b, 0xf0, 0x5e, 0x8f, 0x85, 0xfd, 0x3b, 0x86, + 0xeb, 0xfa, 0x0e, 0x26, 0x7f, 0xb5, 0xe7, 0xde, 0x64, 0xf7, 0x8c, 0xcc, 0xe4, 0x95, 0xb6, 0xd5, + 0x79, 0xad, 0xe3, 0x38, 0xc1, 0x96, 0x32, 0x87, 0xd6, 0x08, 0xde, 0x9e, 0x63, 0x78, 0xb3, 0xef, + 0x2a, 0x78, 0x2d, 0x99, 0xe3, 0xd4, 0x68, 0xe1, 0xbf, 0x47, 0xcc, 0xb5, 0xd9, 0xc1, 0x9c, 0x8f, + 0xf6, 0x6b, 0xdf, 0x53, 0x4e, 0xe6, 0xd8, 0x6a, 0xb1, 0xc6, 0xd6, 0x9a, 0xbf, 0x38, 0x58, 0xf3, + 0x06, 0xc4, 0x0f, 0xca, 0xcb, 0x2b, 0xe1, 0x14, 0x4f, 0xbc, 0x95, 0x67, 0xee, 0x2c, 0x5b, 0x5e, + 0x08, 0xfd, 0x7c, 0x31, 0x18, 0xba, 0x87, 0x26, 0x5a, 0x72, 0x86, 0xb2, 0x84, 0xe1, 0x43, 0x29, + 0x43, 0x99, 0x33, 0x54, 0x24, 0x0c, 0x1f, 0x49, 0x19, 0x2a, 0x9c, 0xc1, 0x90, 0x30, 0x7c, 0x2c, + 0x65, 0x30, 0x38, 0xc3, 0xaa, 0x84, 0xe1, 0x13, 0x29, 0xc3, 0x2a, 0x67, 0xa8, 0x4a, 0x18, 0xbe, + 0x26, 0x65, 0xa8, 0x72, 0x86, 0x9b, 0x12, 0x86, 0x4f, 0xa5, 0x0c, 0x37, 0x39, 0xc3, 0x2d, 0x09, + 0xc3, 0xd7, 0xa5, 0x0c, 0xb7, 0x38, 0xc3, 0x6d, 0x09, 0xc3, 0x37, 0xa4, 0x0c, 0xb7, 0x19, 0xc3, + 0xca, 0xb2, 0x84, 0xe1, 0x9b, 0x32, 0x86, 0x95, 0x65, 0xce, 0x20, 0xd3, 0xe4, 0x67, 0x52, 0x06, + 0xae, 0xc9, 0x15, 0x99, 0x26, 0xbf, 0x25, 0x65, 0xe0, 0x9a, 0x5c, 0x91, 0x69, 0xf2, 0xdb, 0x52, + 0x06, 0xae, 0xc9, 0x15, 0x99, 0x26, 0xbf, 0x23, 0x65, 0xe0, 0x9a, 0x5c, 0x91, 0x69, 0xf2, 0xbb, + 0x52, 0x06, 0xae, 0xc9, 0x15, 0x99, 0x26, 0xbf, 0x27, 0x65, 0xe0, 0x9a, 0x5c, 0x91, 0x69, 0xf2, + 0x4f, 0xa4, 0x0c, 0x5c, 0x93, 0x2b, 0x32, 0x4d, 0xfe, 0xa9, 0x94, 0x81, 0x6b, 0x72, 0x45, 0xa6, + 0xc9, 0x3f, 0x93, 0x32, 0x70, 0x4d, 0x96, 0x65, 0x9a, 0xfc, 0xbe, 0x8c, 0xa1, 0xcc, 0x35, 0x59, + 0x96, 0x69, 0xf2, 0xcf, 0xa5, 0x0c, 0x5c, 0x93, 0x65, 0x99, 0x26, 0xff, 0x42, 0xca, 0xc0, 0x35, + 0x59, 0x96, 0x69, 0xf2, 0x07, 0x52, 0x06, 0xae, 0xc9, 0xb2, 0x4c, 0x93, 0x7f, 0x29, 0x65, 0xe0, + 0x9a, 0x2c, 0xcb, 0x34, 0xf9, 0x57, 0x52, 0x06, 0xae, 0xc9, 0xb2, 0x4c, 0x93, 0x7f, 0x2d, 0x65, + 0xe0, 0x9a, 0x2c, 0xcb, 0x34, 0xf9, 0x37, 0x52, 0x06, 0xae, 0xc9, 0xb2, 0x4c, 0x93, 0x7f, 0x2b, + 0x65, 0xe0, 0x9a, 0x2c, 0xcb, 0x34, 0xf9, 0x77, 0x52, 0x06, 0xae, 0xc9, 0x8a, 0x4c, 0x93, 0x7f, + 0x2f, 0x63, 0xa8, 0x70, 0x4d, 0x56, 0x64, 0x9a, 0xfc, 0x07, 0x29, 0x03, 0xd7, 0x64, 0x45, 0xa6, + 0xc9, 0x7f, 0x94, 0x32, 0x70, 0x4d, 0x56, 0x64, 0x9a, 0xfc, 0x27, 0x29, 0x03, 0xd7, 0x64, 0x45, + 0xa6, 0xc9, 0x7f, 0x96, 0x32, 0x70, 0x4d, 0x56, 0x64, 0x9a, 0xfc, 0x17, 0x29, 0x03, 0xd7, 0x64, + 0x45, 0xa6, 0xc9, 0x7f, 0x95, 0x32, 0x70, 0x4d, 0x56, 0x64, 0x9a, 0xfc, 0x37, 0x29, 0x03, 0xd7, + 0x64, 0x45, 0xa6, 0xc9, 0x1f, 0x4a, 0x19, 0xb8, 0x26, 0x2b, 0x32, 0x4d, 0xfe, 0xbb, 0x94, 0x81, + 0x6b, 0xd2, 0x90, 0x69, 0xf2, 0x3f, 0x64, 0x0c, 0x06, 0xd7, 0xa4, 0x21, 0xd3, 0xe4, 0x7f, 0x4a, + 0x19, 0xb8, 0x26, 0x0d, 0x99, 0x26, 0xff, 0x4b, 0xca, 0xc0, 0x35, 0x69, 0xc8, 0x34, 0xf9, 0xdf, + 0x52, 0x06, 0xae, 0x49, 0x43, 0xa6, 0xc9, 0xff, 0x91, 0x32, 0x70, 0x4d, 0x1a, 0x32, 0x4d, 0xfe, + 0xaf, 0x94, 0x81, 0x6b, 0xd2, 0x90, 0x69, 0xf2, 0x47, 0x52, 0x06, 0xae, 0x49, 0x43, 0xa6, 0xc9, + 0x1f, 0x4b, 0x19, 0xb8, 0x26, 0x0d, 0x99, 0x26, 0x7f, 0x22, 0x65, 0xe0, 0x9a, 0x34, 0x64, 0x9a, + 0xfc, 0xa9, 0x94, 0x81, 0x6b, 0x72, 0x55, 0xa6, 0xc9, 0xff, 0x93, 0x31, 0xac, 0x2e, 0xdf, 0xbd, + 0xfe, 0xf8, 0x5a, 0xb7, 0xe7, 0xee, 0x4f, 0x76, 0x97, 0xf6, 0x9c, 0xc1, 0x8d, 0xae, 0xd3, 0x6f, + 0xd9, 0xdd, 0x1b, 0x08, 0xdb, 0x9d, 0x74, 0x6e, 0x04, 0xff, 0xcc, 0xce, 0x4c, 0xff, 0x3f, 0x00, + 0x00, 0xff, 0xff, 0x8e, 0xb4, 0x0c, 0xbd, 0xe4, 0x3e, 0x00, 0x00, } From 1566aab987a84d915b16b69a4595a2fa7a8d0d85 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 15 Mar 2019 13:58:31 -0700 Subject: [PATCH 050/133] proto: simplify StructProperties StructProperties were the old approach of pseudo-providing reflection like functionality for Go protobufs. However, the API is fundamentally too closely tied to Go structs to be easily extensible to the new protobuf reflection API. In preparation for that migration work, we simplify the implementation of StructProperties. Changes made: * Export Properties.{Proto3,Oneof} as these are sensible pieces of information relevant to the proto type system. * Delete StructProperties.{decoderTags,order} and Properties.{stype,sprop,mtype} as nothing uses these anymore. * Move the functionality of StructProperties.{reqCount,decoderOrigNames} to be under text_parser.go, which is the only user of those fields. * Avoid depending on the interface for XXX_Oneof, but use pure reflection. This breaks the dependency on the Buffer type. * Move unrelated declarations to lib.go such as: protoMessageType, marshalerType, oneofFuncsIface, oneofWrappersIface This set of changes make it such that all usages of StructProperties within the proto package itself is on the public API of StructProperties rather than some internal property. It also makes it such that properties.go builds on its own with no dependencies on any other source file inthe proto package. Change-Id: I96414ce65116846c50e5509b5c9c9c9a65d3b6dc Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167772 Reviewed-by: Herbie Ong --- proto/clone.go | 2 +- proto/equal.go | 2 +- proto/lib.go | 18 ++- proto/properties.go | 375 ++++++++++++------------------------------- proto/table_merge.go | 2 +- proto/text.go | 2 +- proto/text_parser.go | 38 ++++- 7 files changed, 157 insertions(+), 282 deletions(-) diff --git a/proto/clone.go b/proto/clone.go index aea08994f1..5f97f7aa62 100644 --- a/proto/clone.go +++ b/proto/clone.go @@ -176,7 +176,7 @@ func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { // 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 { + if prop != nil && prop.Proto3 && in.Len() == 0 { return } diff --git a/proto/equal.go b/proto/equal.go index c7097903f7..88e094ed98 100644 --- a/proto/equal.go +++ b/proto/equal.go @@ -176,7 +176,7 @@ func equalAny(v1, v2 reflect.Value, prop *Properties) bool { // 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 { + if prop != nil && prop.Proto3 && v1.Len() == 0 && v2.Len() == 0 { return true } if v1.IsNil() != v2.IsNil() { diff --git a/proto/lib.go b/proto/lib.go index a35f5dbbd3..c18e4a83c0 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -86,6 +86,19 @@ func (nf *nonFatal) Merge(err error) (ok bool) { // Message is implemented by generated protocol buffer messages. type Message = protoapi.Message +var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() + +var marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() + +type ( + oneofFuncsIface interface { + XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) + } + oneofWrappersIface interface { + XXX_OneofWrappers() []interface{} + } +) + // A Buffer is a buffer manager for marshaling and unmarshaling // protocol buffers. It may be reused between invocations to // reduce memory usage. It is not necessary to use a Buffer; @@ -479,9 +492,8 @@ type scalarField struct { // t is a struct type. func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { sprop := GetProperties(t) - for _, prop := range sprop.Prop { - fi, ok := sprop.decoderTags.get(prop.Tag) - if !ok { + for fi, prop := range sprop.Prop { + if prop.Tag <= 0 { // XXX_unrecognized continue } diff --git a/proto/properties.go b/proto/properties.go index 538137a9c1..09325589bd 100644 --- a/proto/properties.go +++ b/proto/properties.go @@ -4,15 +4,8 @@ package proto -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - import ( - "fmt" - "os" "reflect" - "sort" "strconv" "strings" "sync" @@ -21,59 +14,16 @@ import ( // Constants that identify the encoding of a value on the wire. const ( WireVarint = 0 + WireFixed32 = 5 WireFixed64 = 1 WireBytes = 2 WireStartGroup = 3 WireEndGroup = 4 - WireFixed32 = 5 ) -// tagMap is an optimization over map[int]int for typical protocol buffer -// use-cases. Encoded protocol buffers are often in tag order with small tag -// numbers. -type tagMap struct { - fastTags []int - slowTags map[int]int -} - -// tagMapFastLimit is the upper bound on the tag number that will be stored in -// the tagMap slice rather than its map. -const tagMapFastLimit = 1024 - -func (p *tagMap) get(t int) (int, bool) { - if t > 0 && t < tagMapFastLimit { - if t >= len(p.fastTags) { - return 0, false - } - fi := p.fastTags[t] - return fi, fi >= 0 - } - fi, ok := p.slowTags[t] - return fi, ok -} - -func (p *tagMap) put(t int, fi int) { - if t > 0 && t < tagMapFastLimit { - for len(p.fastTags) < t+1 { - p.fastTags = append(p.fastTags, -1) - } - p.fastTags[t] = fi - return - } - if p.slowTags == nil { - p.slowTags = make(map[int]int) - } - p.slowTags[t] = fi -} - // StructProperties represents properties for all the fields of a struct. -// decoderTags and decoderOrigNames should only be used by the decoder. type StructProperties struct { - Prop []*Properties // properties for each field - reqCount int // required count - decoderTags tagMap // map from proto tag to struct field number - decoderOrigNames map[string]int // map from original name to struct field number - order []int // list of struct field numbers in tag order + Prop []*Properties // properties for each field // OneofTypes contains information about the oneof fields in this message. // It is keyed by the original name of a field. @@ -87,14 +37,9 @@ type OneofProperties struct { Prop *Properties } -// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec. -// See encode.go, (*Buffer).enc_struct. - -func (sp *StructProperties) Len() int { return len(sp.order) } -func (sp *StructProperties) Less(i, j int) bool { - return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag -} -func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] } +func (sp *StructProperties) Len() int { return len(sp.Prop) } +func (sp *StructProperties) Less(i, j int) bool { return false } +func (sp *StructProperties) Swap(i, j int) { return } // Properties represents the protocol-specific behavior of a single struct field. type Properties struct { @@ -109,25 +54,20 @@ type Properties struct { Repeated bool Packed bool // relevant for repeated primitives only Enum string // set for enum types only - proto3 bool // whether this is known to be a proto3 field - oneof bool // whether this is a oneof field + Proto3 bool // whether this is known to be a proto3 field + Oneof bool // whether this is a oneof field Default string // default value HasDefault bool // whether an explicit default was provided - stype reflect.Type // set for struct types only - sprop *StructProperties // set for struct types only - - mtype reflect.Type // set for map types only - MapKeyProp *Properties // set for map types only - MapValProp *Properties // set for map types only + MapKeyProp *Properties // set for map types only + MapValProp *Properties // set for map types only } // String formats the properties in the protobuf struct field tag style. func (p *Properties) String() string { s := p.Wire - s += "," - s += strconv.Itoa(p.Tag) + s += "," + strconv.Itoa(p.Tag) if p.Required { s += ",req" } @@ -141,13 +81,13 @@ func (p *Properties) String() string { s += ",packed" } s += ",name=" + p.OrigName - if p.JSONName != p.OrigName { + if p.JSONName != "" { s += ",json=" + p.JSONName } - if p.proto3 { + if p.Proto3 { s += ",proto3" } - if p.oneof { + if p.Oneof { s += ",oneof" } if len(p.Enum) > 0 { @@ -160,252 +100,141 @@ func (p *Properties) String() string { } // Parse populates p by parsing a string in the protobuf struct field tag style. -func (p *Properties) Parse(s string) { - // "bytes,49,opt,name=foo,def=hello!" - fields := strings.Split(s, ",") // breaks def=, but handled below. - if len(fields) < 2 { - fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) - return - } - - p.Wire = fields[0] - switch p.Wire { - case "varint": - p.WireType = WireVarint - case "fixed32": - p.WireType = WireFixed32 - case "fixed64": - p.WireType = WireFixed64 - case "zigzag32": - p.WireType = WireVarint - case "zigzag64": - p.WireType = WireVarint - case "bytes", "group": - p.WireType = WireBytes - // no numeric converter for non-numeric types - default: - fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) - return - } - - var err error - p.Tag, err = strconv.Atoi(fields[1]) - if err != nil { - return - } - -outer: - for i := 2; i < len(fields); i++ { - f := fields[i] - switch { - case f == "req": - p.Required = true - case f == "opt": +func (p *Properties) Parse(tag string) { + // For example: "bytes,49,opt,name=foo,def=hello!" + for len(tag) > 0 { + i := strings.IndexByte(tag, ',') + if i < 0 { + i = len(tag) + } + switch s := tag[:i]; { + case strings.HasPrefix(s, "name="): + p.OrigName = s[len("name="):] + case strings.HasPrefix(s, "json="): + p.JSONName = s[len("json="):] + case strings.HasPrefix(s, "enum="): + p.Enum = s[len("enum="):] + case strings.Trim(s, "0123456789") == "": + n, _ := strconv.ParseUint(s, 10, 32) + p.Tag = int(n) + case s == "opt": p.Optional = true - case f == "rep": + case s == "req": + p.Required = true + case s == "rep": p.Repeated = true - case f == "packed": + case s == "varint" || s == "zigzag32" || s == "zigzag64": + p.Wire = s + p.WireType = WireVarint + case s == "fixed32": + p.Wire = s + p.WireType = WireFixed32 + case s == "fixed64": + p.Wire = s + p.WireType = WireFixed64 + case s == "bytes" || s == "group": + // NOTE: Historically, this used WireBytes even for groups, + // when it should have been WireStartGroup. + p.Wire = s + p.WireType = WireBytes + case s == "packed": p.Packed = true - case strings.HasPrefix(f, "name="): - p.OrigName = f[5:] - case strings.HasPrefix(f, "json="): - p.JSONName = f[5:] - case strings.HasPrefix(f, "enum="): - p.Enum = f[5:] - case f == "proto3": - p.proto3 = true - case f == "oneof": - p.oneof = true - case strings.HasPrefix(f, "def="): + case s == "proto3": + p.Proto3 = true + case s == "oneof": + p.Oneof = true + case strings.HasPrefix(s, "def="): + // The default tag is special in that everything afterwards is the + // default regardless of the presence of commas. p.HasDefault = true - p.Default = f[4:] // rest of string - if i+1 < len(fields) { - // Commas aren't escaped, and def is always last. - p.Default += "," + strings.Join(fields[i+1:], ",") - break outer - } + p.Default, i = tag[len("def="):], len(tag) } + tag = strings.TrimPrefix(tag[i:], ",") } } -var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() - -// setFieldProps initializes the field properties for submessages and maps. -func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { - switch t1 := typ; t1.Kind() { - case reflect.Ptr: - if t1.Elem().Kind() == reflect.Struct { - p.stype = t1.Elem() - } - - case reflect.Slice: - if t2 := t1.Elem(); t2.Kind() == reflect.Ptr && t2.Elem().Kind() == reflect.Struct { - p.stype = t2.Elem() - } - - case reflect.Map: - p.mtype = t1 - p.MapKeyProp = &Properties{} - p.MapKeyProp.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) - p.MapValProp = &Properties{} - vtype := p.mtype.Elem() - if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice { - // The value type is not a message (*T) or bytes ([]byte), - // so we need encoders for the pointer to this type. - vtype = reflect.PtrTo(vtype) - } - p.MapValProp.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) - } - - if p.stype != nil { - if lockGetProp { - p.sprop = GetProperties(p.stype) - } else { - p.sprop = getPropertiesLocked(p.stype) - } - } -} - -var ( - marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() -) - // Init populates the properties from a protocol buffer struct tag. func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.init(typ, name, tag, f, true) + p.init(typ, name, tag, f) } -func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) { - // "bytes,49,opt,def=hello!" +func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField) { p.Name = name p.OrigName = name if tag == "" { return } p.Parse(tag) - p.setFieldProps(typ, f, lockGetProp) + + if typ != nil && typ.Kind() == reflect.Map { + p.MapKeyProp = new(Properties) + p.MapKeyProp.init(nil, "Key", f.Tag.Get("protobuf_key"), nil) + p.MapValProp = new(Properties) + p.MapValProp.init(nil, "Value", f.Tag.Get("protobuf_val"), nil) + } } -var ( - propertiesMu sync.RWMutex - propertiesMap = make(map[reflect.Type]*StructProperties) -) +var propertiesCache sync.Map // map[reflect.Type]*StructProperties // GetProperties returns the list of properties for the type represented by t. // t must represent a generated struct type of a protocol message. func GetProperties(t reflect.Type) *StructProperties { - if t.Kind() != reflect.Struct { - panic("proto: type must have kind struct") - } - - // Most calls to GetProperties in a long-running program will be - // retrieving details for types we have seen before. - propertiesMu.RLock() - sprop, ok := propertiesMap[t] - propertiesMu.RUnlock() - if ok { - return sprop + if p, ok := propertiesCache.Load(t); ok { + return p.(*StructProperties) } - - propertiesMu.Lock() - sprop = getPropertiesLocked(t) - propertiesMu.Unlock() - return sprop + p, _ := propertiesCache.LoadOrStore(t, newProperties(t)) + return p.(*StructProperties) } -type ( - oneofFuncsIface interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) - } - oneofWrappersIface interface { - XXX_OneofWrappers() []interface{} - } -) - -// getPropertiesLocked requires that propertiesMu is held. -func getPropertiesLocked(t reflect.Type) *StructProperties { - if prop, ok := propertiesMap[t]; ok { - return prop +func newProperties(t reflect.Type) *StructProperties { + if t.Kind() != reflect.Struct { + panic("proto: type must have kind struct") } prop := new(StructProperties) - // in case of recursive protos, fill this in now. - propertiesMap[t] = prop - - // build properties - prop.Prop = make([]*Properties, t.NumField()) - prop.order = make([]int, t.NumField()) + // Construct a list of properties for each field in the struct. for i := 0; i < t.NumField(); i++ { - f := t.Field(i) p := new(Properties) - name := f.Name - p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) + f := t.Field(i) + p.init(f.Type, f.Name, f.Tag.Get("protobuf"), &f) - oneof := f.Tag.Get("protobuf_oneof") // special case - if oneof != "" { - // Oneof fields don't use the traditional protobuf tag. - p.OrigName = oneof + if name := f.Tag.Get("protobuf_oneof"); name != "" { + p.OrigName = name } - prop.Prop[i] = p - prop.order[i] = i + prop.Prop = append(prop.Prop, p) } - // Re-order prop.order. - sort.Sort(prop) - - var oots []interface{} - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oots = m.XXX_OneofFuncs() - case oneofWrappersIface: - oots = m.XXX_OneofWrappers() + // Construct a mapping of oneof field names to properties. + var oneofWrappers []interface{} + if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofFuncs"); ok { + oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[3].Interface().([]interface{}) + } + if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok { + oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0].Interface().([]interface{}) } - if len(oots) > 0 { - // Interpret oneof metadata. + if len(oneofWrappers) > 0 { prop.OneofTypes = make(map[string]*OneofProperties) - for _, oot := range oots { - oop := &OneofProperties{ - Type: reflect.ValueOf(oot).Type(), // *T + for _, wrapper := range oneofWrappers { + p := &OneofProperties{ + Type: reflect.ValueOf(wrapper).Type(), // *T Prop: new(Properties), } - sft := oop.Type.Elem().Field(0) - oop.Prop.Name = sft.Name - oop.Prop.Parse(sft.Tag.Get("protobuf")) - // There will be exactly one interface field that - // this new value is assignable to. + f := p.Type.Elem().Field(0) + p.Prop.Name = f.Name + p.Prop.Parse(f.Tag.Get("protobuf")) + + // Determine the struct field that contains this oneof. + // Each wrapper is assignable to exactly one parent field. for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Type.Kind() != reflect.Interface { - continue - } - if !oop.Type.AssignableTo(f.Type) { - continue + if p.Type.AssignableTo(t.Field(i).Type) { + p.Field = i + break } - oop.Field = i - break } - prop.OneofTypes[oop.Prop.OrigName] = oop - } - } - - // build required counts - // build tags - reqCount := 0 - prop.decoderOrigNames = make(map[string]int) - for i, p := range prop.Prop { - if strings.HasPrefix(p.Name, "XXX_") { - // Internal fields should not appear in tags/origNames maps. - // They are handled specially when encoding and decoding. - continue - } - if p.Required { - reqCount++ + prop.OneofTypes[p.Prop.OrigName] = p } - prop.decoderTags.put(p.Tag, i) - prop.decoderOrigNames[p.OrigName] = i } - prop.reqCount = reqCount return prop } diff --git a/proto/table_merge.go b/proto/table_merge.go index 4edb4f4e0f..cb30bdc0a1 100644 --- a/proto/table_merge.go +++ b/proto/table_merge.go @@ -465,7 +465,7 @@ func (mi *mergeInfo) computeMergeInfo() { } } case reflect.Slice: - isProto3 := props.Prop[i].proto3 + isProto3 := props.Prop[i].Proto3 switch { case isPointer: panic("bad pointer in byte slice case in " + tf.Name()) diff --git a/proto/text.go b/proto/text.go index dcbd98d7f0..439bb761cc 100644 --- a/proto/text.go +++ b/proto/text.go @@ -364,7 +364,7 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { } continue } - if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { + if props.Proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { // empty bytes field continue } diff --git a/proto/text_parser.go b/proto/text_parser.go index 0371f0d5b4..543176ec4b 100644 --- a/proto/text_parser.go +++ b/proto/text_parser.go @@ -14,6 +14,7 @@ import ( "reflect" "strconv" "strings" + "sync" "unicode/utf8" "github.com/golang/protobuf/protoapi" @@ -357,7 +358,7 @@ func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSet } // Returns the index in the struct for the named field, as well as the parsed tag properties. -func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) { +func structFieldByName(sprops *textStructProperties, name string) (int, *Properties, bool) { i, ok := sprops.decoderOrigNames[name] if ok { return i, sprops.Prop[i], true @@ -407,9 +408,42 @@ func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseEr return nil } +var textPropertiesCache sync.Map // map[reflect.Type]*textStructProperties + +type textStructProperties struct { + *StructProperties + reqCount int + decoderOrigNames map[string]int +} + +func getTextProperties(t reflect.Type) *textStructProperties { + if p, ok := textPropertiesCache.Load(t); ok { + return p.(*textStructProperties) + } + + prop := &textStructProperties{StructProperties: GetProperties(t)} + reqCount := 0 + prop.decoderOrigNames = make(map[string]int) + for i, p := range prop.Prop { + if strings.HasPrefix(p.Name, "XXX_") { + // Internal fields should not appear in tags/origNames maps. + // They are handled specially when encoding and decoding. + continue + } + if p.Required { + reqCount++ + } + prop.decoderOrigNames[p.OrigName] = i + } + prop.reqCount = reqCount + + textPropertiesCache.Store(t, prop) + return prop +} + func (p *textParser) readStruct(sv reflect.Value, terminator string) error { st := sv.Type() - sprops := GetProperties(st) + sprops := getTextProperties(st) reqCount := sprops.reqCount var reqFieldErr error fieldSet := make(map[string]bool) From faaaa590077fb0bcc96259e112f85cdf8b8633e1 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 15 Mar 2019 14:24:30 -0700 Subject: [PATCH 051/133] internal/proto: copy properties over This copies properties.go over with no change, sets up testing scaffolding to switch between the original versiona and the copied version, which will be reimplemented using protobuf reflection. Change-Id: I7b15dcbba60c05ff91c376beaa30de69baff52e1 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167877 Reviewed-by: Herbie Ong --- internal/proto/properties.go | 240 +++++++++++++++++++++++++++++++++++ proto/properties.go | 2 + proto/properties_alt.go | 33 +++++ 3 files changed, 275 insertions(+) create mode 100644 internal/proto/properties.go create mode 100644 proto/properties_alt.go diff --git a/internal/proto/properties.go b/internal/proto/properties.go new file mode 100644 index 0000000000..eed3644160 --- /dev/null +++ b/internal/proto/properties.go @@ -0,0 +1,240 @@ +// 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 + +import ( + "reflect" + "strconv" + "strings" + "sync" +) + +// Constants that identify the encoding of a value on the wire. +const ( + WireVarint = 0 + WireFixed32 = 5 + WireFixed64 = 1 + WireBytes = 2 + WireStartGroup = 3 + WireEndGroup = 4 +) + +// StructProperties represents properties for all the fields of a struct. +type StructProperties struct { + Prop []*Properties // properties for each field + + // OneofTypes contains information about the oneof fields in this message. + // It is keyed by the original name of a field. + OneofTypes map[string]*OneofProperties +} + +// Properties represents the protocol-specific behavior of a single struct field. +type Properties struct { + Name string // name of the field, for error messages + OrigName string // original name before protocol compiler (always set) + JSONName string // name to use for JSON; determined by protoc + Wire string + WireType int + Tag int + Required bool + Optional bool + Repeated bool + Packed bool // relevant for repeated primitives only + Enum string // set for enum types only + Proto3 bool // whether this is known to be a proto3 field + Oneof bool // whether this is a oneof field + + Default string // default value + HasDefault bool // whether an explicit default was provided + + MapKeyProp *Properties // set for map types only + MapValProp *Properties // set for map types only +} + +// OneofProperties represents information about a specific field in a oneof. +type OneofProperties struct { + Type reflect.Type // pointer to generated struct type for this oneof field + Field int // struct field number of the containing oneof in the message + Prop *Properties +} + +// String formats the properties in the protobuf struct field tag style. +func (p *Properties) String() string { + s := p.Wire + s += "," + strconv.Itoa(p.Tag) + if p.Required { + s += ",req" + } + if p.Optional { + s += ",opt" + } + if p.Repeated { + s += ",rep" + } + if p.Packed { + s += ",packed" + } + s += ",name=" + p.OrigName + if p.JSONName != "" { + s += ",json=" + p.JSONName + } + if p.Proto3 { + s += ",proto3" + } + if p.Oneof { + s += ",oneof" + } + if len(p.Enum) > 0 { + s += ",enum=" + p.Enum + } + if p.HasDefault { + s += ",def=" + p.Default + } + return s +} + +// Parse populates p by parsing a string in the protobuf struct field tag style. +func (p *Properties) Parse(tag string) { + // For example: "bytes,49,opt,name=foo,def=hello!" + for len(tag) > 0 { + i := strings.IndexByte(tag, ',') + if i < 0 { + i = len(tag) + } + switch s := tag[:i]; { + case strings.HasPrefix(s, "name="): + p.OrigName = s[len("name="):] + case strings.HasPrefix(s, "json="): + p.JSONName = s[len("json="):] + case strings.HasPrefix(s, "enum="): + p.Enum = s[len("enum="):] + case strings.Trim(s, "0123456789") == "": + n, _ := strconv.ParseUint(s, 10, 32) + p.Tag = int(n) + case s == "opt": + p.Optional = true + case s == "req": + p.Required = true + case s == "rep": + p.Repeated = true + case s == "varint" || s == "zigzag32" || s == "zigzag64": + p.Wire = s + p.WireType = WireVarint + case s == "fixed32": + p.Wire = s + p.WireType = WireFixed32 + case s == "fixed64": + p.Wire = s + p.WireType = WireFixed64 + case s == "bytes" || s == "group": + // NOTE: Historically, this used WireBytes even for groups, + // when it should have been WireStartGroup. + p.Wire = s + p.WireType = WireBytes + case s == "packed": + p.Packed = true + case s == "proto3": + p.Proto3 = true + case s == "oneof": + p.Oneof = true + case strings.HasPrefix(s, "def="): + // The default tag is special in that everything afterwards is the + // default regardless of the presence of commas. + p.HasDefault = true + p.Default, i = tag[len("def="):], len(tag) + } + tag = strings.TrimPrefix(tag[i:], ",") + } +} + +// Init populates the properties from a protocol buffer struct tag. +func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { + p.init(typ, name, tag, f) +} + +func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField) { + p.Name = name + p.OrigName = name + if tag == "" { + return + } + p.Parse(tag) + + if typ != nil && typ.Kind() == reflect.Map { + p.MapKeyProp = new(Properties) + p.MapKeyProp.init(nil, "Key", f.Tag.Get("protobuf_key"), nil) + p.MapValProp = new(Properties) + p.MapValProp.init(nil, "Value", f.Tag.Get("protobuf_val"), nil) + } +} + +var propertiesCache sync.Map // map[reflect.Type]*StructProperties + +// GetProperties returns the list of properties for the type represented by t. +// t must represent a generated struct type of a protocol message. +func GetProperties(t reflect.Type) *StructProperties { + if p, ok := propertiesCache.Load(t); ok { + return p.(*StructProperties) + } + p, _ := propertiesCache.LoadOrStore(t, newProperties(t)) + return p.(*StructProperties) +} + +func (sp *StructProperties) Len() int { return len(sp.Prop) } +func (sp *StructProperties) Less(i, j int) bool { return false } +func (sp *StructProperties) Swap(i, j int) { return } + +func newProperties(t reflect.Type) *StructProperties { + if t.Kind() != reflect.Struct { + panic("proto: type must have kind struct") + } + + prop := new(StructProperties) + + // Construct a list of properties for each field in the struct. + for i := 0; i < t.NumField(); i++ { + p := new(Properties) + f := t.Field(i) + p.init(f.Type, f.Name, f.Tag.Get("protobuf"), &f) + + if name := f.Tag.Get("protobuf_oneof"); name != "" { + p.OrigName = name + } + prop.Prop = append(prop.Prop, p) + } + + // Construct a mapping of oneof field names to properties. + var oneofWrappers []interface{} + if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofFuncs"); ok { + oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[3].Interface().([]interface{}) + } + if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok { + oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0].Interface().([]interface{}) + } + if len(oneofWrappers) > 0 { + prop.OneofTypes = make(map[string]*OneofProperties) + for _, wrapper := range oneofWrappers { + p := &OneofProperties{ + Type: reflect.ValueOf(wrapper).Type(), // *T + Prop: new(Properties), + } + f := p.Type.Elem().Field(0) + p.Prop.Name = f.Name + p.Prop.Parse(f.Tag.Get("protobuf")) + + // Determine the struct field that contains this oneof. + // Each wrapper is assignable to exactly one parent field. + for i := 0; i < t.NumField(); i++ { + if p.Type.AssignableTo(t.Field(i).Type) { + p.Field = i + break + } + } + prop.OneofTypes[p.Prop.OrigName] = p + } + } + + return prop +} diff --git a/proto/properties.go b/proto/properties.go index 09325589bd..42a27da38c 100644 --- a/proto/properties.go +++ b/proto/properties.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build !proto_reimpl + package proto import ( diff --git a/proto/properties_alt.go b/proto/properties_alt.go new file mode 100644 index 0000000000..8fba1c48cf --- /dev/null +++ b/proto/properties_alt.go @@ -0,0 +1,33 @@ +// 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. + +// +build proto_reimpl + +package proto + +import ( + "reflect" + + "github.com/golang/protobuf/internal/proto" +) + +// Constants that identify the encoding of a value on the wire. +const ( + WireVarint = 0 + WireFixed64 = 1 + WireBytes = 2 + WireStartGroup = 3 + WireEndGroup = 4 + WireFixed32 = 5 +) + +type ( + Properties = proto.Properties + StructProperties = proto.StructProperties + OneofProperties = proto.OneofProperties +) + +func GetProperties(t reflect.Type) *StructProperties { + return proto.GetProperties(t) +} From f5983a527bbdbebe09855e1915b229f67e529e23 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 12 Mar 2019 20:25:42 -0700 Subject: [PATCH 052/133] internal/cmd/generate-alias: directly invoke v2 internal_gengo Now that Cl/167768 removed the dependency on protoc for the generated test protos, the only remaining dependency is on protoc is for the import public aliases. However, we observe that we can avoid protoc since we already have the file descriptor on hand for the remote targets. Using that, we can invoke internal_gengo directly and circumvent any need for protoc. With protoc no longer being a dependency, the integration script loses its value, so can be deleted. Change-Id: I522c1e4f2abc47be2817f3bd6b3ff9704b0abb83 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167770 Reviewed-by: Herbie Ong --- .travis.yml | 22 +- integration_test.go | 335 ---------------------- internal/cmd/generate-alias/main.go | 114 ++++++++ internal/cmd/generate-protos/main.go | 146 ---------- protoc-gen-go/descriptor/descriptor.pb.go | 5 +- protoc-gen-go/descriptor/descriptor.proto | 3 - protoc-gen-go/plugin/plugin.pb.go | 4 +- protoc-gen-go/plugin/plugin.proto | 3 - ptypes/any/any.pb.go | 7 +- ptypes/any/any.proto | 3 - ptypes/duration/duration.pb.go | 8 +- ptypes/duration/duration.proto | 3 - ptypes/empty/empty.pb.go | 8 +- ptypes/empty/empty.proto | 3 - ptypes/struct/struct.proto | 3 - ptypes/timestamp/timestamp.pb.go | 11 +- ptypes/timestamp/timestamp.proto | 3 - ptypes/wrappers/wrappers.pb.go | 8 +- ptypes/wrappers/wrappers.proto | 3 - regenerate.bash | 2 +- test.bash | 33 ++- 21 files changed, 189 insertions(+), 538 deletions(-) delete mode 100644 integration_test.go create mode 100644 internal/cmd/generate-alias/main.go delete mode 100644 internal/cmd/generate-protos/main.go delete mode 100644 protoc-gen-go/descriptor/descriptor.proto delete mode 100644 protoc-gen-go/plugin/plugin.proto delete mode 100644 ptypes/any/any.proto delete mode 100644 ptypes/duration/duration.proto delete mode 100644 ptypes/empty/empty.proto delete mode 100644 ptypes/struct/struct.proto delete mode 100644 ptypes/timestamp/timestamp.proto delete mode 100644 ptypes/wrappers/wrappers.proto diff --git a/.travis.yml b/.travis.yml index ae7591ac03..a1e92e6e62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,16 @@ -dist: xenial -script: - - ./test.bash -cache: - directories: - - .cache +language: go +before_install: + - mkdir /tmp/go1.12 + - curl -L -s https://dl.google.com/go/go1.12.linux-amd64.tar.gz | tar -zxf - -C /tmp/go1.12 --strip-components 1 + - unset GOROOT + - (GO111MODULE=on /tmp/go1.12/bin/go mod vendor) +matrix: + include: + - go: 1.9.x + script: go test -v ./... + - go: 1.10.x + script: go test -v ./... + - go: 1.11.x + script: go test -v ./... + - go: 1.12.x + script: ./test.bash diff --git a/integration_test.go b/integration_test.go deleted file mode 100644 index ba6d3ceb84..0000000000 --- a/integration_test.go +++ /dev/null @@ -1,335 +0,0 @@ -// 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. - -// +build ignore - -package main - -import ( - "archive/tar" - "bytes" - "compress/gzip" - "flag" - "fmt" - "io" - "io/ioutil" - "net/http" - "os" - "os/exec" - "path/filepath" - "regexp" - "runtime" - "strings" - "testing" - "time" -) - -var ( - regenerate = flag.Bool("regenerate", false, "regenerate files") - - protobufVersion = "3.7.0" - golangVersions = []string{"1.9.7", "1.10.8", "1.11.5", "1.12"} - golangLatest = golangVersions[len(golangVersions)-1] - - // purgeTimeout determines the maximum age of unused sub-directories. - purgeTimeout = 30 * 24 * time.Hour // 1 month - - // Variables initialized by mustInitDeps. - goPath string - modulePath string -) - -func Test(t *testing.T) { - mustInitDeps(t) - - if *regenerate { - t.Run("Generate", func(t *testing.T) { - fmt.Print(mustRunCommand(t, ".", "go", "run", "./internal/cmd/generate-protos", "-execute")) - files := strings.Split(strings.TrimSpace(mustRunCommand(t, ".", "git", "ls-files", "*.go")), "\n") - mustRunCommand(t, ".", append([]string{"gofmt", "-w"}, files...)...) - }) - t.SkipNow() - } - - for _, v := range golangVersions { - t.Run("Go"+v, func(t *testing.T) { - runGo := func(label, workDir string, args ...string) { - args[0] += v - t.Run(label, func(t *testing.T) { - t.Parallel() - mustRunCommand(t, workDir, args...) - }) - } - workDir := filepath.Join(goPath, "src", modulePath) - runGo("Build", workDir, "go", "build", "./...") - runGo("TestNormal", workDir, "go", "test", "-race", "./...") - runGo("TestReimpl", workDir, "go", "test", "-race", "-tags", "proto_reimpl", "./...") - }) - } - - t.Run("GeneratedGoFiles", func(t *testing.T) { - diff := mustRunCommand(t, ".", "go", "run", "./internal/cmd/generate-protos") - if strings.TrimSpace(diff) != "" { - t.Fatalf("stale generated files:\n%v", diff) - } - }) - t.Run("FormattedGoFiles", func(t *testing.T) { - files := strings.Split(strings.TrimSpace(mustRunCommand(t, ".", "git", "ls-files", "*.go")), "\n") - diff := mustRunCommand(t, ".", append([]string{"gofmt", "-d"}, files...)...) - if strings.TrimSpace(diff) != "" { - t.Fatalf("unformatted source files:\n%v", diff) - } - }) - t.Run("CommittedGitChanges", func(t *testing.T) { - diff := mustRunCommand(t, ".", "git", "diff", "--no-prefix", "HEAD") - if strings.TrimSpace(diff) != "" { - t.Fatalf("uncommitted changes:\n%v", diff) - } - }) - t.Run("TrackedGitFiles", func(t *testing.T) { - diff := mustRunCommand(t, ".", "git", "ls-files", "--others", "--exclude-standard") - if strings.TrimSpace(diff) != "" { - t.Fatalf("untracked files:\n%v", diff) - } - }) -} - -func mustInitDeps(t *testing.T) { - check := func(err error) { - t.Helper() - if err != nil { - t.Fatal(err) - } - } - - // Determine the directory to place the test directory. - repoRoot, err := os.Getwd() - check(err) - testDir := filepath.Join(repoRoot, ".cache") - check(os.MkdirAll(testDir, 0775)) - - // Travis-CI has a hard-coded timeout where it kills the test after - // 10 minutes of a lack of activity on stdout. - // We work around this restriction by periodically printing the timestamp. - ticker := time.NewTicker(5 * time.Minute) - done := make(chan struct{}) - go func() { - now := time.Now() - for { - select { - case t := <-ticker.C: - fmt.Printf("\tt=%0.fmin\n", t.Sub(now).Minutes()) - case <-done: - return - } - } - }() - defer close(done) - defer ticker.Stop() - - // Delete the current directory if non-empty, - // which only occurs if a dependency failed to initialize properly. - var workingDir string - defer func() { - if workingDir != "" { - os.RemoveAll(workingDir) // best-effort - } - }() - - // Delete other sub-directories that are no longer relevant. - defer func() { - subDirs := map[string]bool{"bin": true, "gocache": true, "gopath": true} - subDirs["protobuf-"+protobufVersion] = true - for _, v := range golangVersions { - subDirs["go"+v] = true - } - - now := time.Now() - fis, _ := ioutil.ReadDir(testDir) - for _, fi := range fis { - if subDirs[fi.Name()] { - os.Chtimes(filepath.Join(testDir, fi.Name()), now, now) // best-effort - continue - } - if now.Sub(fi.ModTime()) < purgeTimeout { - continue - } - fmt.Printf("delete %v\n", fi.Name()) - os.RemoveAll(filepath.Join(testDir, fi.Name())) // best-effort - } - }() - - // The bin directory contains symlinks to each tool by version. - // It is safe to delete this directory and run the test script from scratch. - binPath := filepath.Join(testDir, "bin") - check(os.RemoveAll(binPath)) - check(os.Mkdir(binPath, 0775)) - check(os.Setenv("PATH", binPath+":"+os.Getenv("PATH"))) - registerBinary := func(name, path string) { - check(os.Symlink(path, filepath.Join(binPath, name))) - } - - // Download and build the protobuf toolchain. - // We avoid downloading the pre-compiled binaries since they do not contain - // the conformance test runner. - workingDir = filepath.Join(testDir, "protobuf-"+protobufVersion) - if _, err := os.Stat(workingDir); err != nil { - fmt.Printf("download %v\n", filepath.Base(workingDir)) - url := fmt.Sprintf("https://github.com/google/protobuf/releases/download/v%v/protobuf-all-%v.tar.gz", protobufVersion, protobufVersion) - downloadArchive(check, workingDir, url, "protobuf-"+protobufVersion) - - fmt.Printf("build %v\n", filepath.Base(workingDir)) - mustRunCommand(t, workingDir, "./autogen.sh") - mustRunCommand(t, workingDir, "./configure") - mustRunCommand(t, workingDir, "make") - mustRunCommand(t, filepath.Join(workingDir, "conformance"), "make") - } - patchProtos(check, workingDir) - check(os.Setenv("PROTOBUF_ROOT", workingDir)) // for generate-protos - registerBinary("conform-test-runner", filepath.Join(workingDir, "conformance", "conformance-test-runner")) - registerBinary("protoc", filepath.Join(workingDir, "src", "protoc")) - workingDir = "" - - // Download each Go toolchain version. - for _, v := range golangVersions { - workingDir = filepath.Join(testDir, "go"+v) - if _, err := os.Stat(workingDir); err != nil { - fmt.Printf("download %v\n", filepath.Base(workingDir)) - url := fmt.Sprintf("https://dl.google.com/go/go%v.%v-%v.tar.gz", v, runtime.GOOS, runtime.GOARCH) - downloadArchive(check, workingDir, url, "go") - } - registerBinary("go"+v, filepath.Join(workingDir, "bin", "go")) - } - registerBinary("go", filepath.Join(testDir, "go"+golangLatest, "bin", "go")) - registerBinary("gofmt", filepath.Join(testDir, "go"+golangLatest, "bin", "gofmt")) - workingDir = "" - - // Travis-CI sets GOROOT, which confuses invocations of the Go toolchain. - // Explicitly clear GOROOT, so each toolchain uses their default GOROOT. - check(os.Unsetenv("GOROOT")) - - // Set a cache directory within the test directory. - check(os.Setenv("GOCACHE", filepath.Join(testDir, "gocache"))) - - // Setup GOPATH for pre-module support (i.e., go1.10 and earlier). - goPath = filepath.Join(testDir, "gopath") - modulePath = strings.TrimSpace(mustRunCommand(t, testDir, "go", "list", "-m", "-f", "{{.Path}}")) - check(os.RemoveAll(filepath.Join(goPath, "src"))) - check(os.MkdirAll(filepath.Join(goPath, "src", filepath.Dir(modulePath)), 0775)) - check(os.Symlink(repoRoot, filepath.Join(goPath, "src", modulePath))) - mustRunCommand(t, repoRoot, "go", "mod", "tidy") - mustRunCommand(t, repoRoot, "go", "mod", "vendor") - check(os.Setenv("GOPATH", goPath)) -} - -func downloadArchive(check func(error), dstPath, srcURL, skipPrefix string) { - check(os.RemoveAll(dstPath)) - - resp, err := http.Get(srcURL) - check(err) - defer resp.Body.Close() - - zr, err := gzip.NewReader(resp.Body) - check(err) - - tr := tar.NewReader(zr) - for { - h, err := tr.Next() - if err == io.EOF { - return - } - check(err) - - // Skip directories or files outside the prefix directory. - if len(skipPrefix) > 0 { - if !strings.HasPrefix(h.Name, skipPrefix) { - continue - } - if len(h.Name) > len(skipPrefix) && h.Name[len(skipPrefix)] != '/' { - continue - } - } - - path := strings.TrimPrefix(strings.TrimPrefix(h.Name, skipPrefix), "/") - path = filepath.Join(dstPath, filepath.FromSlash(path)) - mode := os.FileMode(h.Mode & 0777) - switch h.Typeflag { - case tar.TypeReg: - b, err := ioutil.ReadAll(tr) - check(err) - check(ioutil.WriteFile(path, b, mode)) - case tar.TypeDir: - check(os.Mkdir(path, mode)) - } - } -} - -// patchProtos patches proto files with v2 locations of Go packages. -// TODO: Commit these changes upstream. -func patchProtos(check func(error), repoRoot string) { - javaPackageRx := regexp.MustCompile(`^option\s+java_package\s*=\s*".*"\s*;\s*$`) - goPackageRx := regexp.MustCompile(`^option\s+go_package\s*=\s*".*"\s*;\s*$`) - files := map[string]string{ - "src/google/protobuf/any.proto": "github.com/golang/protobuf/v2/types/known;known_proto", - "src/google/protobuf/api.proto": "github.com/golang/protobuf/v2/types/known;known_proto", - "src/google/protobuf/duration.proto": "github.com/golang/protobuf/v2/types/known;known_proto", - "src/google/protobuf/empty.proto": "github.com/golang/protobuf/v2/types/known;known_proto", - "src/google/protobuf/field_mask.proto": "github.com/golang/protobuf/v2/types/known;known_proto", - "src/google/protobuf/source_context.proto": "github.com/golang/protobuf/v2/types/known;known_proto", - "src/google/protobuf/struct.proto": "github.com/golang/protobuf/v2/types/known;known_proto", - "src/google/protobuf/timestamp.proto": "github.com/golang/protobuf/v2/types/known;known_proto", - "src/google/protobuf/type.proto": "github.com/golang/protobuf/v2/types/known;known_proto", - "src/google/protobuf/wrappers.proto": "github.com/golang/protobuf/v2/types/known;known_proto", - "src/google/protobuf/descriptor.proto": "github.com/golang/protobuf/v2/types/descriptor;descriptor_proto", - "src/google/protobuf/compiler/plugin.proto": "github.com/golang/protobuf/v2/types/plugin;plugin_proto", - "conformance/conformance.proto": "github.com/golang/protobuf/v2/internal/testprotos/conformance;conformance_proto", - } - for pbpath, gopath := range files { - b, err := ioutil.ReadFile(filepath.Join(repoRoot, pbpath)) - check(err) - ss := strings.Split(string(b), "\n") - - // Locate java_package and (possible) go_package options. - javaPackageIdx, goPackageIdx := -1, -1 - for i, s := range ss { - if javaPackageIdx < 0 && javaPackageRx.MatchString(s) { - javaPackageIdx = i - } - if goPackageIdx < 0 && goPackageRx.MatchString(s) { - goPackageIdx = i - } - } - - // Ensure the proto file has the correct go_package option. - opt := `option go_package = "` + gopath + `";` - if goPackageIdx >= 0 { - if ss[goPackageIdx] == opt { - continue // no changes needed - } - ss[goPackageIdx] = opt - } else { - // Insert go_package option before java_package option. - ss = append(ss[:javaPackageIdx], append([]string{opt}, ss[javaPackageIdx:]...)...) - } - - fmt.Println("patch " + pbpath) - b = []byte(strings.Join(ss, "\n")) - check(ioutil.WriteFile(filepath.Join(repoRoot, pbpath), b, 0664)) - } -} - -func mustRunCommand(t *testing.T, dir string, args ...string) string { - t.Helper() - stdout := new(bytes.Buffer) - combined := new(bytes.Buffer) - cmd := exec.Command(args[0], args[1:]...) - cmd.Dir = dir - cmd.Env = append(os.Environ(), "PWD="+dir) - cmd.Stdout = io.MultiWriter(stdout, combined) - cmd.Stderr = combined - if err := cmd.Run(); err != nil { - t.Fatalf("executing (%v): %v\n%s", strings.Join(args, " "), err, combined.String()) - } - return stdout.String() -} diff --git a/internal/cmd/generate-alias/main.go b/internal/cmd/generate-alias/main.go new file mode 100644 index 0000000000..f1a3584f69 --- /dev/null +++ b/internal/cmd/generate-alias/main.go @@ -0,0 +1,114 @@ +// 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. + +//go:generate go run . -execute + +package main + +import ( + "flag" + "fmt" + "io/ioutil" + "os" + "os/exec" + "path" + "path/filepath" + "strings" + + "github.com/golang/protobuf/proto" + gengo "github.com/golang/protobuf/v2/cmd/protoc-gen-go/internal_gengo" + "github.com/golang/protobuf/v2/protogen" + "github.com/golang/protobuf/v2/reflect/protodesc" + "github.com/golang/protobuf/v2/reflect/protoreflect" + + descriptorpb "github.com/golang/protobuf/v2/types/descriptor" + knownpb "github.com/golang/protobuf/v2/types/known" + pluginpb "github.com/golang/protobuf/v2/types/plugin" +) + +func main() { + run := flag.Bool("execute", false, "Write generated files to destination.") + flag.Parse() + + // Set of generated proto packages to forward to v2. + files := []struct { + goPkg string + pbDesc protoreflect.FileDescriptor + }{{ + goPkg: "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor", + pbDesc: descriptorpb.File_google_protobuf_descriptor_proto, + }, { + goPkg: "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go", + pbDesc: pluginpb.File_google_protobuf_compiler_plugin_proto, + }, { + goPkg: "github.com/golang/protobuf/ptypes/any;any", + pbDesc: knownpb.File_google_protobuf_any_proto, + }, { + goPkg: "github.com/golang/protobuf/ptypes/duration;duration", + pbDesc: knownpb.File_google_protobuf_duration_proto, + }, { + goPkg: "github.com/golang/protobuf/ptypes/timestamp;timestamp", + pbDesc: knownpb.File_google_protobuf_timestamp_proto, + }, { + goPkg: "github.com/golang/protobuf/ptypes/wrappers;wrappers", + pbDesc: knownpb.File_google_protobuf_wrappers_proto, + }, { + goPkg: "github.com/golang/protobuf/ptypes/struct;structpb", + pbDesc: knownpb.File_google_protobuf_struct_proto, + }, { + goPkg: "github.com/golang/protobuf/ptypes/empty;empty", + pbDesc: knownpb.File_google_protobuf_empty_proto, + }} + + // For each package, construct a proto file that public imports the package. + var req pluginpb.CodeGeneratorRequest + for _, file := range files { + pkgPath := file.goPkg[:strings.IndexByte(file.goPkg, ';')] + fd := &descriptorpb.FileDescriptorProto{ + Name: proto.String(pkgPath + "/" + path.Base(pkgPath) + ".proto"), + Syntax: proto.String(file.pbDesc.Syntax().String()), + Dependency: []string{file.pbDesc.Path()}, + PublicDependency: []int32{0}, + Options: &descriptorpb.FileOptions{GoPackage: proto.String(file.goPkg)}, + } + req.ProtoFile = append(req.ProtoFile, protodesc.ToFileDescriptorProto(file.pbDesc), fd) + req.FileToGenerate = append(req.FileToGenerate, fd.GetName()) + } + + // Use the internal logic of protoc-gen-go to generate the files. + gen, err := protogen.New(&req, nil) + check(err) + for _, file := range gen.Files { + if file.Generate { + gengo.GenerateFile(gen, file) + } + } + + // Write the generated files. + resp := gen.Response() + if resp.Error != nil { + panic("gengo error: " + resp.GetError()) + } + for _, file := range resp.File { + relPath, err := filepath.Rel(filepath.FromSlash("github.com/golang/protobuf"), file.GetName()) + check(err) + + check(ioutil.WriteFile(relPath+".bak", []byte(file.GetContent()), 0664)) + if *run { + fmt.Println("#", relPath) + check(os.Rename(relPath+".bak", relPath)) + } else { + cmd := exec.Command("diff", relPath, relPath+".bak", "-N", "-u") + cmd.Stdout = os.Stdout + cmd.Run() + os.Remove(relPath + ".bak") // best-effort delete + } + } +} + +func check(err error) { + if err != nil { + panic(err) + } +} diff --git a/internal/cmd/generate-protos/main.go b/internal/cmd/generate-protos/main.go deleted file mode 100644 index 8db856c710..0000000000 --- a/internal/cmd/generate-protos/main.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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. - -//go:generate go run . -execute - -package main - -import ( - "flag" - "fmt" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "strings" - - gengo "github.com/golang/protobuf/v2/cmd/protoc-gen-go/internal_gengo" - "github.com/golang/protobuf/v2/protogen" -) - -func init() { - // When the environment variable RUN_AS_PROTOC_PLUGIN is set, - // we skip running main and instead act as a protoc plugin. - // This allows the binary to pass itself to protoc. - if os.Getenv("RUN_AS_PROTOC_PLUGIN") == "1" { - protogen.Run(nil, func(gen *protogen.Plugin) error { - for _, file := range gen.Files { - if file.Generate { - gengo.GenerateFile(gen, file) - } - } - return nil - }) - os.Exit(0) - } -} - -var ( - run bool - protoRoot string - repoRoot string - modulePath string -) - -func main() { - flag.BoolVar(&run, "execute", false, "Write generated files to destination.") - flag.StringVar(&protoRoot, "protoroot", os.Getenv("PROTOBUF_ROOT"), "The root of the protobuf source tree.") - flag.Parse() - if protoRoot == "" { - panic("protobuf source root is not set") - } - - // Determine repository root path. - out, err := exec.Command("git", "rev-parse", "--show-toplevel").CombinedOutput() - check(err) - repoRoot = strings.TrimSpace(string(out)) - - // Determine the module path. - cmd := exec.Command("go", "list", "-m", "-f", "{{.Path}}") - cmd.Dir = repoRoot - out, err = cmd.CombinedOutput() - check(err) - modulePath = strings.TrimSpace(string(out)) - - generateLocalProtos() -} - -func generateLocalProtos() { - tmpDir, err := ioutil.TempDir(repoRoot, "tmp") - check(err) - defer os.RemoveAll(tmpDir) - - // Generate all local proto files. - dirs := []struct { - path string - }{ - {path: "protoc-gen-go"}, - {path: "ptypes"}, - } - for _, d := range dirs { - srcDir := filepath.Join(repoRoot, filepath.FromSlash(d.path)) - filepath.Walk(srcDir, func(srcPath string, _ os.FileInfo, err error) error { - if !strings.HasSuffix(srcPath, ".proto") { - return nil - } - - impPath := tmpDir - - relPath, err := filepath.Rel(repoRoot, srcPath) - check(err) - relPath = filepath.Join(filepath.FromSlash(modulePath), relPath) - - dstDir := filepath.Join(tmpDir, filepath.Dir(relPath)) - check(os.MkdirAll(dstDir, 0775)) - check(os.Link(srcPath, filepath.Join(tmpDir, relPath))) - - protoc("-I"+filepath.Join(protoRoot, "src"), "-I"+impPath, "--go_out="+tmpDir, relPath) - return nil - }) - } - - syncOutput(repoRoot, filepath.Join(tmpDir, filepath.FromSlash(modulePath))) -} - -func protoc(args ...string) { - cmd := exec.Command("protoc", "--plugin=protoc-gen-go="+os.Args[0]) - cmd.Args = append(cmd.Args, args...) - cmd.Env = append(os.Environ(), "RUN_AS_PROTOC_PLUGIN=1") - out, err := cmd.CombinedOutput() - if err != nil { - fmt.Println(args) - fmt.Printf("executing: %v\n%s\n", strings.Join(cmd.Args, " "), out) - } - check(err) -} - -func syncOutput(dstDir, srcDir string) { - filepath.Walk(srcDir, func(srcPath string, _ os.FileInfo, _ error) error { - if !strings.HasSuffix(srcPath, ".go") { - return nil - } - relPath, err := filepath.Rel(srcDir, srcPath) - check(err) - dstPath := filepath.Join(dstDir, relPath) - - if run { - fmt.Println("#", relPath) - b, err := ioutil.ReadFile(srcPath) - check(err) - check(os.MkdirAll(filepath.Dir(dstPath), 0775)) - check(ioutil.WriteFile(dstPath, b, 0664)) - } else { - cmd := exec.Command("diff", dstPath, srcPath, "-N", "-u") - cmd.Stdout = os.Stdout - cmd.Run() - } - return nil - }) -} - -func check(err error) { - if err != nil { - panic(err) - } -} diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index 03e0a7ba43..a27d857286 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -161,7 +161,7 @@ func init() { } var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc = []byte{ - // 172 bytes of the wire-encoded FileDescriptorProto + // 180 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, @@ -172,7 +172,8 @@ var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_prot 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x3b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x00, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x32, } var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc) diff --git a/protoc-gen-go/descriptor/descriptor.proto b/protoc-gen-go/descriptor/descriptor.proto deleted file mode 100644 index c75b4ea950..0000000000 --- a/protoc-gen-go/descriptor/descriptor.proto +++ /dev/null @@ -1,3 +0,0 @@ -syntax = "proto2"; -option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor"; -import public "google/protobuf/descriptor.proto"; diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index 4c904de651..6314cb7f9f 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -29,7 +29,7 @@ func init() { } var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc = []byte{ - // 164 bytes of the wire-encoded FileDescriptorProto + // 172 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, @@ -40,7 +40,7 @@ var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdes 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x3b, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, - 0x67, 0x6f, 0x50, 0x00, + 0x67, 0x6f, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, } var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc) diff --git a/protoc-gen-go/plugin/plugin.proto b/protoc-gen-go/plugin/plugin.proto deleted file mode 100644 index 75b380bc06..0000000000 --- a/protoc-gen-go/plugin/plugin.proto +++ /dev/null @@ -1,3 +0,0 @@ -syntax = "proto2"; -option go_package = "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go"; -import public "google/protobuf/compiler/plugin.proto"; diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index 372c515146..42078b5a47 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -26,15 +26,16 @@ func init() { } var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc = []byte{ - // 127 bytes of the wire-encoded FileDescriptorProto + // 131 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x27, 0x5a, 0x25, + 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x2b, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x3b, 0x61, 0x6e, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc) diff --git a/ptypes/any/any.proto b/ptypes/any/any.proto deleted file mode 100644 index ecfd3e1f9d..0000000000 --- a/ptypes/any/any.proto +++ /dev/null @@ -1,3 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/golang/protobuf/ptypes/any"; -import public "google/protobuf/any.proto"; diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index 0f8d740358..d667a5eae3 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -26,17 +26,17 @@ func init() { } var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc = []byte{ - // 147 bytes of the wire-encoded FileDescriptorProto + // 156 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x2c, 0x5a, 0x2a, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc) diff --git a/ptypes/duration/duration.proto b/ptypes/duration/duration.proto deleted file mode 100644 index 1c9153e8c7..0000000000 --- a/ptypes/duration/duration.proto +++ /dev/null @@ -1,3 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/golang/protobuf/ptypes/duration"; -import public "google/protobuf/duration.proto"; diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index 45f35dff33..c94aa08c22 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -26,16 +26,16 @@ func init() { } var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc = []byte{ - // 135 bytes of the wire-encoded FileDescriptorProto + // 141 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x74, 0x6f, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x00, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x3b, 0x65, 0x6d, + 0x70, 0x74, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc) diff --git a/ptypes/empty/empty.proto b/ptypes/empty/empty.proto deleted file mode 100644 index b63cbd8a9c..0000000000 --- a/ptypes/empty/empty.proto +++ /dev/null @@ -1,3 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/golang/protobuf/ptypes/empty"; -import public "google/protobuf/empty.proto"; diff --git a/ptypes/struct/struct.proto b/ptypes/struct/struct.proto deleted file mode 100644 index 6072bd27fc..0000000000 --- a/ptypes/struct/struct.proto +++ /dev/null @@ -1,3 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/golang/protobuf/ptypes/struct;structpb"; -import public "google/protobuf/struct.proto"; diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index 1f26667319..c4246dcf2e 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -26,17 +26,18 @@ func init() { } var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc = []byte{ - // 151 bytes of the wire-encoded FileDescriptorProto + // 161 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x2d, - 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x37, + 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x50, 0x00, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x3b, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc) diff --git a/ptypes/timestamp/timestamp.proto b/ptypes/timestamp/timestamp.proto deleted file mode 100644 index eb1accdf63..0000000000 --- a/ptypes/timestamp/timestamp.proto +++ /dev/null @@ -1,3 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/golang/protobuf/ptypes/timestamp"; -import public "google/protobuf/timestamp.proto"; diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index 87282953a7..d3499accc6 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -34,17 +34,17 @@ func init() { } var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc = []byte{ - // 147 bytes of the wire-encoded FileDescriptorProto + // 156 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, - 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x2c, 0x5a, 0x2a, 0x67, + 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x3b, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, + 0x72, 0x73, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc) diff --git a/ptypes/wrappers/wrappers.proto b/ptypes/wrappers/wrappers.proto deleted file mode 100644 index b977dfd55d..0000000000 --- a/ptypes/wrappers/wrappers.proto +++ /dev/null @@ -1,3 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/golang/protobuf/ptypes/wrappers"; -import public "google/protobuf/wrappers.proto"; diff --git a/regenerate.bash b/regenerate.bash index 71f7cdd0b4..e3e3966dce 100755 --- a/regenerate.bash +++ b/regenerate.bash @@ -4,5 +4,5 @@ # license that can be found in the LICENSE file. cd "$(git rev-parse --show-toplevel)" -go test -v -mod=vendor -timeout=60m -count=1 integration_test.go "$@" -regenerate +go run ./internal/cmd/generate-alias -execute exit $? diff --git a/test.bash b/test.bash index b225be61ad..11af78dd53 100755 --- a/test.bash +++ b/test.bash @@ -4,5 +4,34 @@ # license that can be found in the LICENSE file. cd "$(git rev-parse --show-toplevel)" -go test -v -mod=vendor -timeout=60m -count=1 integration_test.go "$@" -exit $? + +BOLD="\x1b[1mRunning: " +PASS="\x1b[32mPASS" +FAIL="\x1b[31mFAIL" +RESET="\x1b[0m" + +echo -e "${BOLD}go test${RESET}" +RET_TEST=$((go test ./... && go test -tags proto_reimpl ./...) | egrep -v "^(ok|[?])\s+") +if [[ ! -z "$RET_TEST" ]]; then echo "$RET_TEST"; echo; fi + +echo -e "${BOLD}go generate${RESET}" +RET_GEN=$(go run ./internal/cmd/generate-alias 2>&1) +if [[ ! -z "$RET_GEN" ]]; then echo "$RET_GEN"; echo; fi + +echo -e "${BOLD}go fmt${RESET}" +RET_FMT=$(gofmt -d $(git ls-files *.go) 2>&1) +if [[ ! -z "$RET_FMT" ]]; then echo "$RET_FMT"; echo; fi + +echo -e "${BOLD}git diff${RESET}" +RET_DIFF=$(git diff --no-prefix HEAD 2>&1) +if [[ ! -z "$RET_DIFF" ]]; then echo "$RET_DIFF"; echo; fi + +echo -e "${BOLD}git ls-files${RESET}" +RET_FILES=$(git ls-files --others --exclude-standard 2>&1) +if [[ ! -z "$RET_FILES" ]]; then echo "$RET_FILES"; echo; fi + +if [[ ! -z "$RET_TEST" ]] || [[ ! -z "$RET_GEN" ]] || [ ! -z "$RET_FMT" ] || [[ ! -z "$RET_DIFF" ]] || [[ ! -z "$RET_FILES" ]]; then + echo -e "${FAIL}${RESET}"; exit 1 +else + echo -e "${PASS}${RESET}"; exit 0 +fi From 612769ef042b0ee0efb7c6e3bf22c65ebec8832b Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 15 Mar 2019 09:25:18 -0700 Subject: [PATCH 053/133] proto: move primitive wrappers Change-Id: I358fd58ed1ca3e00a1243ccf1826eb7e62afd451 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167919 Reviewed-by: Herbie Ong --- proto/lib.go | 61 ----------------------------------------------- proto/wrappers.go | 32 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 61 deletions(-) create mode 100644 proto/wrappers.go diff --git a/proto/lib.go b/proto/lib.go index c18e4a83c0..8887b7a420 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -157,67 +157,6 @@ func (p *Buffer) SetDeterministic(deterministic bool) { p.deterministic = deterministic } -/* - * Helper routines for simplifying the creation of optional fields of basic type. - */ - -// Bool is a helper routine that allocates a new bool value -// to store v and returns a pointer to it. -func Bool(v bool) *bool { - return &v -} - -// Int32 is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it. -func Int32(v int32) *int32 { - return &v -} - -// Int is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it, but unlike Int32 -// its argument value is an int. -func Int(v int) *int32 { - p := new(int32) - *p = int32(v) - return p -} - -// Int64 is a helper routine that allocates a new int64 value -// to store v and returns a pointer to it. -func Int64(v int64) *int64 { - return &v -} - -// Float32 is a helper routine that allocates a new float32 value -// to store v and returns a pointer to it. -func Float32(v float32) *float32 { - return &v -} - -// Float64 is a helper routine that allocates a new float64 value -// to store v and returns a pointer to it. -func Float64(v float64) *float64 { - return &v -} - -// Uint32 is a helper routine that allocates a new uint32 value -// to store v and returns a pointer to it. -func Uint32(v uint32) *uint32 { - return &v -} - -// Uint64 is a helper routine that allocates a new uint64 value -// to store v and returns a pointer to it. -func Uint64(v uint64) *uint64 { - return &v -} - -// String is a helper routine that allocates a new string value -// to store v and returns a pointer to it. -func String(v string) *string { - return &v -} - // DebugPrint dumps the encoded data in b in a debugging format with a header // including the string s. Used in testing but made available for general debugging. func (p *Buffer) DebugPrint(s string, b []byte) { diff --git a/proto/wrappers.go b/proto/wrappers.go new file mode 100644 index 0000000000..b69d844135 --- /dev/null +++ b/proto/wrappers.go @@ -0,0 +1,32 @@ +// 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 + +// Bool stores v in a new bool value and returns a pointer to it. +func Bool(v bool) *bool { return &v } + +// Int stores v in a new int32 value and returns a pointer to it. +func Int(v int) *int32 { return Int32(int32(v)) } + +// Int32 stores v in a new int32 value and returns a pointer to it. +func Int32(v int32) *int32 { return &v } + +// Int64 stores v in a new int64 value and returns a pointer to it. +func Int64(v int64) *int64 { return &v } + +// Float32 stores v in a new float32 value and returns a pointer to it. +func Float32(v float32) *float32 { return &v } + +// Float64 stores v in a new float64 value and returns a pointer to it. +func Float64(v float64) *float64 { return &v } + +// Uint32 stores v in a new uint32 value and returns a pointer to it. +func Uint32(v uint32) *uint32 { return &v } + +// Uint64 stores v in a new uint64 value and returns a pointer to it. +func Uint64(v uint64) *uint64 { return &v } + +// String stores v in a new string value and returns a pointer to it. +func String(v string) *string { return &v } From dfecc367826276cdca1d6dbcf1998357840dcdb9 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 18 Mar 2019 11:35:00 -0700 Subject: [PATCH 054/133] internal/proto: robustify GetProperties for a post-reflection world Originally, the approach taken was to re-write GetProperties in terms of protobuf reflection to partially support the use of GetProperties on generated messages not in the open-struct API. However, CL/167918 shows that doing so preserves a significant amount of technical debt in the v1 repository. In discussing this with @dneil, we decided that we should keep GetProperties working for open-struct messages, but to instead ensure that GetProperties does *not* work for non-open-struct messages. Changes made: * Document the API more, and place warnings on all exported entry points deterring away new users. * Always rename unrelated Go struct fields with an XXX_ prefix since this is a common pattern that users check for. * Deliberately fail if the struct does not look like an open-struct API. * Minor bug fix for groups getting assigned the wrong wire type. Change-Id: I404bde0327fea9d83387d19fb50feccfa4608e47 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/168157 Reviewed-by: Herbie Ong --- internal/proto/properties.go | 147 ++++++++++++++++++++++++++--------- proto/properties.go | 7 +- 2 files changed, 115 insertions(+), 39 deletions(-) diff --git a/internal/proto/properties.go b/internal/proto/properties.go index eed3644160..3df9e3decb 100644 --- a/internal/proto/properties.go +++ b/internal/proto/properties.go @@ -5,10 +5,13 @@ package proto import ( + "fmt" "reflect" "strconv" "strings" "sync" + + "github.com/golang/protobuf/v2/runtime/protoimpl" ) // Constants that identify the encoding of a value on the wire. @@ -21,43 +24,82 @@ const ( WireEndGroup = 4 ) -// StructProperties represents properties for all the fields of a struct. +// StructProperties represents protocol buffer type information for a +// generated protobuf message in the open-struct API. +// +// Deprecated: Do not use. type StructProperties struct { - Prop []*Properties // properties for each field + // Prop are the properties for each field. + // + // Fields belonging to a oneof are stored in OneofTypes instead, with a + // single Properties representing the parent oneof held here. + // + // The order of Prop matches the order of fields in the Go struct. + // Struct fields that are not related to protobufs have a "XXX_" prefix + // in the Properties.Name and must be ignored by the user. + Prop []*Properties // OneofTypes contains information about the oneof fields in this message. - // It is keyed by the original name of a field. + // It is keyed by the protobuf field name. OneofTypes map[string]*OneofProperties } -// Properties represents the protocol-specific behavior of a single struct field. +// Properties represents the type information for a protobuf message field. +// +// Deprecated: Do not use. type Properties struct { - Name string // name of the field, for error messages - OrigName string // original name before protocol compiler (always set) - JSONName string // name to use for JSON; determined by protoc - Wire string + // Name is a placeholder name with little meaningful semantic value. + // Fields with an "XXX_" prefix must be ignored. + Name string + // OrigName is the protobuf field name or oneof name. + OrigName string + // JSONName is the JSON name for the protobuf field. + JSONName string + // Enum is a placeholder name for enums. + // For historical reasons, this is neither the Go name for the enum, + // nor the protobuf name for the enum. + Enum string // Deprecated: Do not use. + // Wire is a string representation of the wire type. + Wire string + // WireType is the protobuf wire type for the field. WireType int - Tag int + // Tag is the protobuf field number. + Tag int + // Required reports whether this is a required field. Required bool + // Optional reports whether this is a optional field. Optional bool + // Repeated reports whether this is a repeated field. Repeated bool - Packed bool // relevant for repeated primitives only - Enum string // set for enum types only - Proto3 bool // whether this is known to be a proto3 field - Oneof bool // whether this is a oneof field + // Packed reports whether this is a packed repeated field of scalars. + Packed bool + // Proto3 reports whether this field operates under the proto3 syntax. + Proto3 bool + // Oneof reports whether this field belongs within a oneof. + Oneof bool - Default string // default value - HasDefault bool // whether an explicit default was provided + // Default is the default value in string form. + Default string + // HasDefault reports whether the field has a default value. + HasDefault bool - MapKeyProp *Properties // set for map types only - MapValProp *Properties // set for map types only + // MapKeyProp is the properties for the key field for a map field. + MapKeyProp *Properties + // MapValProp is the properties for the value field for a map field. + MapValProp *Properties } -// OneofProperties represents information about a specific field in a oneof. +// OneofProperties represents the type information for a protobuf oneof. +// +// Deprecated: Do not use. type OneofProperties struct { - Type reflect.Type // pointer to generated struct type for this oneof field - Field int // struct field number of the containing oneof in the message - Prop *Properties + // Type is a pointer to the generated wrapper type for the field value. + // This is nil for messages that are not in the open-struct API. + Type reflect.Type + // Field is the index into StructProperties.Prop for the containing oneof. + Field int + // Prop is the properties for the field. + Prop *Properties } // String formats the properties in the protobuf struct field tag style. @@ -128,11 +170,12 @@ func (p *Properties) Parse(tag string) { case s == "fixed64": p.Wire = s p.WireType = WireFixed64 - case s == "bytes" || s == "group": - // NOTE: Historically, this used WireBytes even for groups, - // when it should have been WireStartGroup. + case s == "bytes": p.Wire = s p.WireType = WireBytes + case s == "group": + p.Wire = s + p.WireType = WireStartGroup case s == "packed": p.Packed = true case s == "proto3": @@ -150,6 +193,8 @@ func (p *Properties) Parse(tag string) { } // Init populates the properties from a protocol buffer struct tag. +// +// Deprecated: Do not use. func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { p.init(typ, name, tag, f) } @@ -172,8 +217,11 @@ func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructF var propertiesCache sync.Map // map[reflect.Type]*StructProperties -// GetProperties returns the list of properties for the type represented by t. -// t must represent a generated struct type of a protocol message. +// GetProperties returns the list of properties for the type represented by t, +// which must be a generated protocol buffer message in the open-struct API, +// where protobuf message fields are represented by exported Go struct fields. +// +// Deprecated: Use v2 protobuf reflection instead. func GetProperties(t reflect.Type) *StructProperties { if p, ok := propertiesCache.Load(t); ok { return p.(*StructProperties) @@ -182,26 +230,33 @@ func GetProperties(t reflect.Type) *StructProperties { return p.(*StructProperties) } -func (sp *StructProperties) Len() int { return len(sp.Prop) } -func (sp *StructProperties) Less(i, j int) bool { return false } -func (sp *StructProperties) Swap(i, j int) { return } - func newProperties(t reflect.Type) *StructProperties { if t.Kind() != reflect.Struct { - panic("proto: type must have kind struct") + panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) } + var foundField bool prop := new(StructProperties) // Construct a list of properties for each field in the struct. for i := 0; i < t.NumField(); i++ { p := new(Properties) f := t.Field(i) - p.init(f.Type, f.Name, f.Tag.Get("protobuf"), &f) + tagField := f.Tag.Get("protobuf") + p.init(f.Type, f.Name, tagField, &f) + foundField = foundField || p.Tag > 0 + + tagOneof := f.Tag.Get("protobuf_oneof") + if tagOneof != "" { + p.OrigName = tagOneof + } - if name := f.Tag.Get("protobuf_oneof"); name != "" { - p.OrigName = name + // Rename unrelated struct fields with the "XXX_" prefix since so much + // user code simply checks for this to exclude special fields. + if tagField == "" && tagOneof == "" && !strings.HasPrefix(p.Name, "XXX_") { + p.Name = "XXX_invalid_" + p.Name } + prop.Prop = append(prop.Prop, p) } @@ -223,18 +278,38 @@ func newProperties(t reflect.Type) *StructProperties { f := p.Type.Elem().Field(0) p.Prop.Name = f.Name p.Prop.Parse(f.Tag.Get("protobuf")) + foundField = foundField || p.Prop.Tag > 0 // Determine the struct field that contains this oneof. // Each wrapper is assignable to exactly one parent field. - for i := 0; i < t.NumField(); i++ { + var foundOneof bool + for i := 0; i < t.NumField() && !foundOneof; i++ { if p.Type.AssignableTo(t.Field(i).Type) { p.Field = i - break + foundOneof = true } } + if !foundOneof { + panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) + } prop.OneofTypes[p.Prop.OrigName] = p } } + // If we found no fields, it is possible that the struct uses a + // generated API that is not an open-struct layout. + if !foundField { + // Check with protobuf reflection to make sure this isn't + // an empty protobuf message. + mt := protoimpl.X.MessageOf(reflect.New(t).Interface()).Type() + if mt.Fields().Len() > 0 { + panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) + } + } + return prop } + +func (sp *StructProperties) Len() int { return len(sp.Prop) } +func (sp *StructProperties) Less(i, j int) bool { return false } +func (sp *StructProperties) Swap(i, j int) { return } diff --git a/proto/properties.go b/proto/properties.go index 42a27da38c..5c4d44d885 100644 --- a/proto/properties.go +++ b/proto/properties.go @@ -134,11 +134,12 @@ func (p *Properties) Parse(tag string) { case s == "fixed64": p.Wire = s p.WireType = WireFixed64 - case s == "bytes" || s == "group": - // NOTE: Historically, this used WireBytes even for groups, - // when it should have been WireStartGroup. + case s == "bytes": p.Wire = s p.WireType = WireBytes + case s == "group": + p.Wire = s + p.WireType = WireStartGroup case s == "packed": p.Packed = true case s == "proto3": From 98c2acd4d11a8755710d9c62844ddd8189d00364 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 18 Mar 2019 15:43:36 -0700 Subject: [PATCH 055/133] internal/proto: implement v1 registration with v2 registration This CL implements v1 registration in terms of v2 registration, unifying the two global states. Change-Id: I1c28e5f3392dcfa7cd7b2933f2c0974456a182a9 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/168350 Reviewed-by: Herbie Ong --- go.mod | 2 +- go.sum | 8 +- internal/proto/common.go | 5 +- internal/proto/properties.go | 2 +- internal/proto/registry.go | 373 ++++++++++++++++++++++ jsonpb/jsonpb_test.go | 2 +- proto/discard.go | 4 +- proto/equal.go | 2 +- proto/hooks.go | 14 - proto/hooks_disabled.go | 76 +++++ proto/hooks_enabled.go | 31 ++ proto/lib.go | 4 +- proto/registry.go | 122 ++++++- proto/registry_test.go | 28 ++ proto/table_marshal.go | 2 +- proto/table_unmarshal.go | 2 +- proto/text.go | 2 +- proto/text_parser.go | 4 +- protoapi/registry.go | 132 -------- protoc-gen-go/descriptor/descriptor.pb.go | 14 +- protoc-gen-go/plugin/plugin.pb.go | 14 +- ptypes/any/any.pb.go | 14 +- ptypes/duration/duration.pb.go | 14 +- ptypes/empty/empty.pb.go | 14 +- ptypes/struct/struct.pb.go | 14 +- ptypes/timestamp/timestamp.pb.go | 14 +- ptypes/wrappers/wrappers.pb.go | 14 +- 27 files changed, 650 insertions(+), 277 deletions(-) create mode 100644 internal/proto/registry.go delete mode 100644 proto/hooks.go create mode 100644 proto/hooks_disabled.go create mode 100644 proto/hooks_enabled.go create mode 100644 proto/registry_test.go delete mode 100644 protoapi/registry.go diff --git a/go.mod b/go.mod index 22c87536b1..dbcf0329c4 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/golang/protobuf -require github.com/golang/protobuf/v2 v2.0.0-20190312230405-4989810018b7 +require github.com/golang/protobuf/v2 v2.0.0-20190320041633-559d47f1da45 diff --git a/go.sum b/go.sum index 9dd4c5b88e..d0211f0e58 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ github.com/golang/protobuf v1.2.1-0.20190311233832-968e039ade03/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf/v2 v2.0.0-20190312230405-4989810018b7 h1:aQENkYDAn/68ZfghmurTBhR18Q7/XWx1JpMaqFtP1GM= -github.com/golang/protobuf/v2 v2.0.0-20190312230405-4989810018b7/go.mod h1:euNorOscCho6jibQUfcx8TAp5HZXU5/+1xMsdtkc8lo= -github.com/google/go-cmp v0.2.1-0.20190228024137-c81281657ad9 h1:GDk30QdVXDf6i734280OeWAO9UCCjXLeWkLLyHQGUkI= -github.com/google/go-cmp v0.2.1-0.20190228024137-c81281657ad9/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/golang/protobuf/v2 v2.0.0-20190320041633-559d47f1da45 h1:UpSQcE2BQjlwjgUj1o+22OMRLUpeeTZNH1fuZN5lEv4= +github.com/golang/protobuf/v2 v2.0.0-20190320041633-559d47f1da45/go.mod h1:memx26heJzlbv0kkl0yZyY1iCWPnh53PDfstsy8HCEg= +github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42 h1:q3pnF5JFBNRz8sRD+IRj7Y6DMyYGTNqnZ9axTbSfoNI= +github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= diff --git a/internal/proto/common.go b/internal/proto/common.go index f8ec49617f..d49c17c817 100644 --- a/internal/proto/common.go +++ b/internal/proto/common.go @@ -14,4 +14,7 @@ import ( _ "github.com/golang/protobuf/v2/runtime/protolegacy" ) -type Message = protoapi.Message +type ( + Message = protoapi.Message + ExtensionDesc = protoapi.ExtensionDesc +) diff --git a/internal/proto/properties.go b/internal/proto/properties.go index 3df9e3decb..2d0ace676f 100644 --- a/internal/proto/properties.go +++ b/internal/proto/properties.go @@ -301,7 +301,7 @@ func newProperties(t reflect.Type) *StructProperties { if !foundField { // Check with protobuf reflection to make sure this isn't // an empty protobuf message. - mt := protoimpl.X.MessageOf(reflect.New(t).Interface()).Type() + mt := protoimpl.X.MessageTypeOf(reflect.New(t).Interface()) if mt.Fields().Len() > 0 { panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) } diff --git a/internal/proto/registry.go b/internal/proto/registry.go new file mode 100644 index 0000000000..d63283b63c --- /dev/null +++ b/internal/proto/registry.go @@ -0,0 +1,373 @@ +// 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 ( + "bytes" + "compress/gzip" + "fmt" + "io/ioutil" + "os" + "reflect" + "runtime" + "strings" + "sync" + + protoV2 "github.com/golang/protobuf/v2/proto" + "github.com/golang/protobuf/v2/reflect/protodesc" + "github.com/golang/protobuf/v2/reflect/protoreflect" + pref "github.com/golang/protobuf/v2/reflect/protoreflect" + "github.com/golang/protobuf/v2/reflect/protoregistry" + "github.com/golang/protobuf/v2/runtime/protoimpl" + "github.com/golang/protobuf/v2/runtime/protolegacy" + + descriptorpb "github.com/golang/protobuf/v2/types/descriptor" +) + +// filePath is the path to the proto source file. +type filePath = string // e.g., "google/protobuf/descriptor.proto" + +// fileDescGZIP is the compressed contents of the encoded FileDescriptorProto. +type fileDescGZIP = []byte + +var fileCache sync.Map // map[filePath]fileDescGZIP + +// RegisterFile is called from generated code and registers the compressed +// FileDescriptorProto with the file path for a proto source file. +// +// Deprecated: Use protoregistry.GlobalFiles.Register instead. +func RegisterFile(s filePath, d fileDescGZIP) { + // Decompress the descriptor. + zr, err := gzip.NewReader(bytes.NewReader(d)) + if err != nil { + panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) + } + b, err := ioutil.ReadAll(zr) + if err != nil { + panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) + } + + // Parse the raw descriptor proto. + var pb descriptorpb.FileDescriptorProto + if err := protoV2.Unmarshal(b, &pb); err != nil { + panic(fmt.Sprintf("proto: unmarshal failure: %v", err)) + } + + // Convert the raw descriptor to a structured file descriptor. + fd, err := protodesc.NewFile(&pb, nil) + if err != nil { + // TODO: Ignore errors due to placeholders. + panic(fmt.Sprintf("proto: descriptor parsing failure: %v", err)) + } + + // Register the descriptor in the v2 registry and cache the result locally. + if err := protoregistry.GlobalFiles.Register(fd); err != nil { + printWarning(err) + return + } + fileCache.Store(s, b) +} + +// FileDescriptor returns the compressed FileDescriptorProto given the file path +// for a proto source file. It returns nil if not found. +// +// Deprecated: Use protoregistry.GlobalFiles.RangeFilesByPath instead. +func FileDescriptor(s filePath) (d fileDescGZIP) { + if d, ok := fileCache.Load(s); ok { + return d.(fileDescGZIP) + } + + // Find the descriptor in the v2 registry. + var n int + protoregistry.GlobalFiles.RangeFilesByPath(s, func(fd protoreflect.FileDescriptor) bool { + n++ + + // Convert the structured file descriptor to the raw descriptor proto. + pb := protodesc.ToFileDescriptorProto(fd) + b, err := protoV2.Marshal(pb) + if err != nil { + panic(fmt.Sprintf("proto: marshal failure: %v", err)) + } + bb := new(bytes.Buffer) + zw := gzip.NewWriter(bb) + if _, err := zw.Write(b); err != nil { + panic(fmt.Sprintf("proto: compression failure: %v", err)) + } + if err := zw.Close(); err != nil { + panic(fmt.Sprintf("proto: compression failure: %v", err)) + } + d = bb.Bytes() + return true + }) + if n > 1 { + return d // best-effort; may be non-deterministic + } + + // Locally cache the raw descriptor form for the file. + if len(d) > 0 { + fileCache.Store(s, d) + } + return d +} + +// enumName is the name of an enum. For historical reasons, the enum name is +// neither the full Go name nor the full protobuf name of the enum. +// The name is the dot-separated combination of just the proto package that the +// enum is declared within followed by the Go type name of the generated enum. +type enumName = string // e.g., "my.proto.package.GoMessage_GoEnum" + +// enumsByName maps enum values by name to their numeric counterpart. +type enumsByName = map[string]int32 + +// enumsByNumber maps enum values by number to their name counterpart. +type enumsByNumber = map[int32]string + +var enumCache sync.Map // map[enumName]enumsByName + +// RegisterEnum is called from the generated code and registers the mapping of +// enum value names to enum numbers for the enum identified by s. +// +// Deprecated: Use protoregistry.GlobalTypes.Register instead. +func RegisterEnum(s enumName, _ enumsByNumber, m enumsByName) { + if _, ok := enumCache.Load(s); ok { + panic("proto: duplicate enum registered: " + s) + } + enumCache.Store(s, m) + + // This does not forward registration to the v2 registry since this API + // lacks sufficient information to construct a complete v2 enum descriptor. +} + +// EnumValueMap returns the mapping from enum value names to enum numbers for +// the enum of the given name. It returns nil if not found. +// +// Deprecated: Use protoregistry.GlobalTypes.FindEnumByName instead. +func EnumValueMap(s enumName) (m enumsByName) { + v, ok := enumCache.Load(s) + if ok { + return v.(enumsByName) + } + + // Construct the mapping from a v2 enum descriptor. + var protoPkg protoreflect.FullName + if i := strings.LastIndexByte(s, '.'); i >= 0 { + protoPkg = protoreflect.FullName(s[:i]) + } + protoregistry.GlobalFiles.RangeFilesByPackage(protoreflect.FullName(protoPkg), func(fd protoreflect.FileDescriptor) bool { + return walkEnums(fd, func(ed protoreflect.EnumDescriptor) bool { + if s == hybridEnumName(ed) { + m = make(enumsByName) + evs := ed.Values() + for i := evs.Len() - 1; i >= 0; i-- { + ev := evs.Get(i) + m[string(ev.Name())] = int32(ev.Number()) + } + return false + } + return true + }) + }) + + if m != nil { + enumCache.Store(s, m) + } + return m +} + +// walkEnums recursively walks all enums declared in d. +func walkEnums(d interface { + Enums() protoreflect.EnumDescriptors + Messages() protoreflect.MessageDescriptors +}, f func(protoreflect.EnumDescriptor) bool) bool { + cont := true + eds := d.Enums() + for i := eds.Len() - 1; cont && i >= 0; i-- { + cont = cont && f(eds.Get(i)) + } + mds := d.Messages() + for i := mds.Len() - 1; cont && i >= 0; i-- { + cont = cont && walkEnums(mds.Get(i), f) + } + return cont +} + +// hybridEnumName returns the legacy enum identifier. +func hybridEnumName(ed pref.EnumDescriptor) enumName { + var protoPkg string + for parent, _ := ed.Parent(); parent != nil; parent, _ = parent.Parent() { + if fd, ok := parent.(pref.FileDescriptor); ok { + protoPkg = string(fd.Package()) + break + } + } + if protoPkg == "" { + return camelCase(string(ed.FullName())) + } + return protoPkg + "." + camelCase(strings.TrimPrefix(string(ed.FullName()), protoPkg+".")) +} + +// camelCase is a copy of the v2 protogen.camelCase function. +func camelCase(s string) string { + isASCIILower := func(c byte) bool { + return 'a' <= c && c <= 'z' + } + isASCIIDigit := func(c byte) bool { + return '0' <= c && c <= '9' + } + + var b []byte + for i := 0; i < len(s); i++ { + c := s[i] + switch { + case c == '.' && i+1 < len(s) && isASCIILower(s[i+1]): + continue + case c == '.': + b = append(b, '_') + case c == '_' && (i == 0 || s[i-1] == '.'): + b = append(b, 'X') + case c == '_' && i+1 < len(s) && isASCIILower(s[i+1]): + continue + case isASCIIDigit(c): + b = append(b, c) + default: + if isASCIILower(c) { + c -= 'a' - 'A' + } + b = append(b, c) + for ; i+1 < len(s) && isASCIILower(s[i+1]); i++ { + b = append(b, s[i+1]) + } + } + } + return string(b) +} + +// messageName is the full name of protobuf message. +type messageName = string + +var messageTypeCache sync.Map // map[messageName]reflect.Type + +// RegisterType is called from generated code and register the message Go type +// for a message of the given name. +// +// Deprecated: Use protoregistry.GlobalTypes.Register instead. +func RegisterType(m Message, s messageName) { + mt := protoimpl.X.MessageTypeOf(m) + if s != messageName(mt.FullName()) { + panic(fmt.Sprintf("proto: inconsistent message name: got %v, want %v", s, mt.FullName())) + } + if err := protoregistry.GlobalTypes.Register(mt); err != nil { + printWarning(err) + return + } + messageTypeCache.Store(s, reflect.TypeOf(m)) +} + +// RegisterMapType is called from generated code and registers the Go map type +// for a protobuf message representing a map entry. +// +// Deprecated: Do not use. +func RegisterMapType(m interface{}, s messageName) { + t := reflect.TypeOf(m) + if t.Kind() != reflect.Map { + panic(fmt.Sprintf("invalid map kind: %v", t)) + } + if _, ok := messageTypeCache.Load(s); ok { + printWarning(fmt.Errorf("proto: duplicate proto message registered: %s", s)) + return + } + messageTypeCache.Store(s, t) +} + +// MessageType returns the message type for a named message. +// It returns nil if not found. +// +// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead. +func MessageType(s messageName) reflect.Type { + if t, ok := messageTypeCache.Load(s); ok { + return t.(reflect.Type) + } + + // Derive the message type from the v2 registry. + var t reflect.Type + mt, _ := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(s)) + if mt != nil { + t = mt.GoType() + } + // TODO: Support retrieving Go map types for map entry messages? + + if t != nil { + messageTypeCache.Store(s, t) + } + return t +} + +// MessageName returns the full protobuf name for the given message type. +// +// Deprecated: Use protoreflect.MessageDescriptor.FullName instead. +func MessageName(m Message) messageName { + if m, ok := m.(interface { + XXX_MessageName() messageName + }); ok { + return m.XXX_MessageName() + } + return messageName(protoimpl.X.MessageTypeOf(m).FullName()) +} + +// RegisterExtension is called from the generated code and registers +// the extension descriptor. +// +// Deprecated: Use protoregistry.GlobalTypes.Register instead. +func RegisterExtension(d *ExtensionDesc) { + xt := protolegacy.X.ExtensionTypeFromDesc(d) + if err := protoregistry.GlobalTypes.Register(xt); err != nil { + panic(err) + } +} + +type extensionsByNumber = map[int32]*ExtensionDesc + +var extensionCache sync.Map // map[messageName]extensionsByNumber + +// RegisteredExtensions returns a map of the registered extensions for the +// provided protobuf message, indexed by the extension field number. +// +// Deprecated: Use protoregistry.GlobalTypes.RangeExtensionsByMessage instead. +func RegisteredExtensions(m Message) extensionsByNumber { + s := MessageName(m) + if xs, ok := extensionCache.Load(s); ok { + return xs.(extensionsByNumber) + } + + var xs extensionsByNumber + protoregistry.GlobalTypes.RangeExtensionsByMessage(protoreflect.FullName(s), func(xt protoreflect.ExtensionType) bool { + if xs == nil { + xs = make(extensionsByNumber) + } + xs[int32(xt.Number())] = protolegacy.X.ExtensionDescFromType(xt) + return true + }) + + if xs == nil { + return nil + } + if xs, ok := extensionCache.LoadOrStore(s, xs); ok { + return xs.(extensionsByNumber) + } + return xs +} + +// printWarning prints a warning to os.Stderr regarding a registration conflict. +func printWarning(err error) { + // TODO: Provide a link in the warning to a page that explains + // what the user should do instead? + b := make([]byte, 0, 1<<12) + b = append(b, "==================\n"...) + b = append(b, "WARNING: "+err.Error()+"\n"...) + b = append(b, "A future release of proto will panic on registration conflicts.\n\n"...) + b = b[:len(b)+runtime.Stack(b[len(b):cap(b)], false)] + b = append(b, "==================\n"...) + os.Stderr.Write(b) +} diff --git a/jsonpb/jsonpb_test.go b/jsonpb/jsonpb_test.go index 607a57a1f9..a8000c91d9 100644 --- a/jsonpb/jsonpb_test.go +++ b/jsonpb/jsonpb_test.go @@ -1024,7 +1024,7 @@ func TestUnmarshalAnyJSONPBUnmarshaler(t *testing.T) { } const ( - dynamicMessageName = "google.protobuf.jsonpb.testing.dynamicMessage" + dynamicMessageName = "github_com.golang.protobuf.jsonpb.dynamicMessage" ) func init() { diff --git a/proto/discard.go b/proto/discard.go index fe5a1409b5..7c376c2173 100644 --- a/proto/discard.go +++ b/proto/discard.go @@ -18,8 +18,6 @@ type generatedDiscarder interface { XXX_DiscardUnknown() } -var discardUnknownAlt func(Message) // populated by hooks.go - // DiscardUnknown recursively discards all unknown fields from this message // and all embedded messages. // @@ -33,7 +31,7 @@ var discardUnknownAlt func(Message) // populated by hooks.go // discarded from messages that have been accessed via GetExtension. func DiscardUnknown(m Message) { if discardUnknownAlt != nil { - discardUnknownAlt(m) + discardUnknownAlt(m) // populated by hooks_enabled.go return } diff --git a/proto/equal.go b/proto/equal.go index 88e094ed98..29ae49ba9e 100644 --- a/proto/equal.go +++ b/proto/equal.go @@ -245,7 +245,7 @@ func equalExtensions(base reflect.Type, em1, em2 protoapi.ExtensionFields) bool // we need to unmarshal them first. var desc *ExtensionDesc mz := reflect.Zero(reflect.PtrTo(base)).Interface().(Message) - if m := protoapi.RegisteredExtensions(mz); m != nil { + if m := RegisteredExtensions(mz); m != nil { desc = m[int32(extNum)] } if desc == nil { diff --git a/proto/hooks.go b/proto/hooks.go deleted file mode 100644 index cd4da7d205..0000000000 --- a/proto/hooks.go +++ /dev/null @@ -1,14 +0,0 @@ -// 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. - -// +build proto_reimpl - -package proto - -import "github.com/golang/protobuf/internal/proto" - -func init() { - setDefaultsAlt = proto.SetDefaults - discardUnknownAlt = proto.DiscardUnknown -} diff --git a/proto/hooks_disabled.go b/proto/hooks_disabled.go new file mode 100644 index 0000000000..fe9aaa0721 --- /dev/null +++ b/proto/hooks_disabled.go @@ -0,0 +1,76 @@ +// 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. + +// +build !proto_reimpl + +package proto + +import ( + "reflect" + + descriptorpb "github.com/golang/protobuf/v2/types/descriptor" +) + +var ( + // Hooks for lib.go. + setDefaultsAlt func(Message) + + // Hooks for discard.go. + discardUnknownAlt func(Message) + + // Hooks for registry.go. + registerEnumAlt func(string, map[int32]string, map[string]int32) + enumValueMapAlt func(string) map[string]int32 + registerTypeAlt func(Message, string) + registerMapTypeAlt func(interface{}, string) + messageNameAlt func(Message) string + messageTypeAlt func(string) reflect.Type + registerFileAlt func(string, []byte) + fileDescriptorAlt func(string) []byte + registerExtensionAlt func(*ExtensionDesc) + registeredExtensionsAlt func(Message) map[int32]*ExtensionDesc +) + +// The v2 descriptor no longer registers with v1. +// If we're only relying on the v1 registry, we need to manually register the +// types in descriptor. +func init() { + // TODO: This should be eventually deleted once the v1 repository is fully + // switched over to wrap the v2 repository. + rawDesc, _ := (*descriptorpb.DescriptorProto)(nil).Descriptor() + RegisterFile("google/protobuf/descriptor.proto", rawDesc) + RegisterEnum("google.protobuf.FieldDescriptorProto_Type", descriptorpb.FieldDescriptorProto_Type_name, descriptorpb.FieldDescriptorProto_Type_value) + RegisterEnum("google.protobuf.FieldDescriptorProto_Label", descriptorpb.FieldDescriptorProto_Label_name, descriptorpb.FieldDescriptorProto_Label_value) + RegisterEnum("google.protobuf.FileOptions_OptimizeMode", descriptorpb.FileOptions_OptimizeMode_name, descriptorpb.FileOptions_OptimizeMode_value) + RegisterEnum("google.protobuf.FieldOptions_CType", descriptorpb.FieldOptions_CType_name, descriptorpb.FieldOptions_CType_value) + RegisterEnum("google.protobuf.FieldOptions_JSType", descriptorpb.FieldOptions_JSType_name, descriptorpb.FieldOptions_JSType_value) + RegisterEnum("google.protobuf.MethodOptions_IdempotencyLevel", descriptorpb.MethodOptions_IdempotencyLevel_name, descriptorpb.MethodOptions_IdempotencyLevel_value) + RegisterType((*descriptorpb.FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") + RegisterType((*descriptorpb.FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") + RegisterType((*descriptorpb.DescriptorProto)(nil), "google.protobuf.DescriptorProto") + RegisterType((*descriptorpb.ExtensionRangeOptions)(nil), "google.protobuf.ExtensionRangeOptions") + RegisterType((*descriptorpb.FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") + RegisterType((*descriptorpb.OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") + RegisterType((*descriptorpb.EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") + RegisterType((*descriptorpb.EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") + RegisterType((*descriptorpb.ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") + RegisterType((*descriptorpb.MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") + RegisterType((*descriptorpb.FileOptions)(nil), "google.protobuf.FileOptions") + RegisterType((*descriptorpb.MessageOptions)(nil), "google.protobuf.MessageOptions") + RegisterType((*descriptorpb.FieldOptions)(nil), "google.protobuf.FieldOptions") + RegisterType((*descriptorpb.OneofOptions)(nil), "google.protobuf.OneofOptions") + RegisterType((*descriptorpb.EnumOptions)(nil), "google.protobuf.EnumOptions") + RegisterType((*descriptorpb.EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") + RegisterType((*descriptorpb.ServiceOptions)(nil), "google.protobuf.ServiceOptions") + RegisterType((*descriptorpb.MethodOptions)(nil), "google.protobuf.MethodOptions") + RegisterType((*descriptorpb.UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") + RegisterType((*descriptorpb.SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") + RegisterType((*descriptorpb.GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") + RegisterType((*descriptorpb.DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") + RegisterType((*descriptorpb.DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") + RegisterType((*descriptorpb.EnumDescriptorProto_EnumReservedRange)(nil), "google.protobuf.EnumDescriptorProto.EnumReservedRange") + RegisterType((*descriptorpb.UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") + RegisterType((*descriptorpb.SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") + RegisterType((*descriptorpb.GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") +} diff --git a/proto/hooks_enabled.go b/proto/hooks_enabled.go new file mode 100644 index 0000000000..c117ba445d --- /dev/null +++ b/proto/hooks_enabled.go @@ -0,0 +1,31 @@ +// 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. + +// +build proto_reimpl + +package proto + +import ( + "github.com/golang/protobuf/internal/proto" +) + +var ( + // Hooks for lib.go. + setDefaultsAlt = proto.SetDefaults + + // Hooks for discard.go. + discardUnknownAlt = proto.DiscardUnknown + + // Hooks for registry.go. + registerEnumAlt = proto.RegisterEnum + enumValueMapAlt = proto.EnumValueMap + registerTypeAlt = proto.RegisterType + registerMapTypeAlt = proto.RegisterMapType + messageNameAlt = proto.MessageName + messageTypeAlt = proto.MessageType + registerFileAlt = proto.RegisterFile + fileDescriptorAlt = proto.FileDescriptor + registerExtensionAlt = proto.RegisterExtension + registeredExtensionsAlt = proto.RegisteredExtensions +) diff --git a/proto/lib.go b/proto/lib.go index 8887b7a420..1906a2a417 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -261,14 +261,12 @@ out: p.index = index } -var setDefaultsAlt func(Message) // populated by hooks.go - // SetDefaults sets unset protocol buffer fields to their default values. // It only modifies fields that are both unset and have defined defaults. // It recursively sets default values in any non-nil sub-messages. func SetDefaults(pb Message) { if setDefaultsAlt != nil { - setDefaultsAlt(pb) + setDefaultsAlt(pb) // populated by hooks_enabled.go return } setDefaults(reflect.ValueOf(pb), true, false) diff --git a/proto/registry.go b/proto/registry.go index b2c0265368..49732ce8e3 100644 --- a/proto/registry.go +++ b/proto/registry.go @@ -1,72 +1,166 @@ -// Copyright 2016 The Go Authors. All rights reserved. +// 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 ( + "fmt" + "log" "reflect" - - "github.com/golang/protobuf/protoapi" + "strconv" ) -// TODO: Registration should be written in terms of v2 registries. +var enumValueMaps = make(map[string]map[string]int32) // RegisterEnum is called from the generated code to install the enum descriptor // maps into the global table to aid parsing text format protocol buffers. func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { - protoapi.RegisterEnum(typeName, unusedNameMap, valueMap) + if registerEnumAlt != nil { + registerEnumAlt(typeName, unusedNameMap, valueMap) // populated by hooks_enabled.go + return + } + if _, ok := enumValueMaps[typeName]; ok { + panic("proto: duplicate enum registered: " + typeName) + } + enumValueMaps[typeName] = valueMap } // EnumValueMap returns the mapping from names to integers of the // enum type enumType, or a nil if not found. func EnumValueMap(enumType string) map[string]int32 { - return protoapi.EnumValueMap(enumType) + if enumValueMapAlt != nil { + return enumValueMapAlt(enumType) // populated by hooks_enabled.go + } + return enumValueMaps[enumType] } +// A registry of all linked message types. +// The string is a fully-qualified proto name ("pkg.Message"). +var ( + protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers + protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types + revProtoTypes = make(map[reflect.Type]string) +) + // RegisterType is called from generated code and maps from the fully qualified // proto name to the type (pointer to struct) of the protocol buffer. func RegisterType(x Message, name string) { - protoapi.RegisterType(x, name) + if registerTypeAlt != nil { + registerTypeAlt(x, name) // populated by hooks_enabled.go + return + } + if _, ok := protoTypedNils[name]; ok { + // TODO: Some day, make this a panic. + log.Printf("proto: duplicate proto type registered: %s", name) + return + } + t := reflect.TypeOf(x) + if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { + // Generated code always calls RegisterType with nil x. + // This check is just for extra safety. + protoTypedNils[name] = x + } else { + protoTypedNils[name] = reflect.Zero(t).Interface().(Message) + } + revProtoTypes[t] = name } // RegisterMapType is called from generated code and maps from the fully qualified // proto name to the native map type of the proto map definition. func RegisterMapType(x interface{}, name string) { - protoapi.RegisterMapType(x, name) + if registerMapTypeAlt != nil { + registerMapTypeAlt(x, name) // populated by hooks_enabled.go + return + } + if reflect.TypeOf(x).Kind() != reflect.Map { + panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) + } + if _, ok := protoMapTypes[name]; ok { + log.Printf("proto: duplicate proto type registered: %s", name) + return + } + t := reflect.TypeOf(x) + protoMapTypes[name] = t + + // Avoid registering into revProtoTypes since map types are not unique. + // revProtoTypes[t] = name } // MessageName returns the fully-qualified proto name for the given message type. func MessageName(x Message) string { - return protoapi.MessageName(x) + if messageNameAlt != nil { + return messageNameAlt(x) // populated by hooks_enabled.go + } + type xname interface { + XXX_MessageName() string + } + if m, ok := x.(xname); ok { + return m.XXX_MessageName() + } + return revProtoTypes[reflect.TypeOf(x)] } // MessageType returns the message type (pointer to struct) for a named message. // The type is not guaranteed to implement proto.Message if the name refers to a // map entry. func MessageType(name string) reflect.Type { - return protoapi.MessageType(name) + if messageTypeAlt != nil { + return messageTypeAlt(name) // populated by hooks_enabled.go + } + if t, ok := protoTypedNils[name]; ok { + return reflect.TypeOf(t) + } + return protoMapTypes[name] } +// A registry of all linked proto files. +var protoFiles = make(map[string][]byte) // file name => fileDescriptor + // RegisterFile is called from generated code and maps from the // full file name of a .proto file to its compressed FileDescriptorProto. func RegisterFile(filename string, fileDescriptor []byte) { - protoapi.RegisterFile(filename, fileDescriptor) + if registerFileAlt != nil { + registerFileAlt(filename, fileDescriptor) // populated by hooks_enabled.go + return + } + protoFiles[filename] = fileDescriptor } // FileDescriptor returns the compressed FileDescriptorProto for a .proto file. func FileDescriptor(filename string) []byte { - return protoapi.FileDescriptor(filename) + if fileDescriptorAlt != nil { + return fileDescriptorAlt(filename) // populated by hooks_enabled.go + } + return protoFiles[filename] } +var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) + // RegisterExtension is called from the generated code. func RegisterExtension(desc *ExtensionDesc) { - protoapi.RegisterExtension(desc) + if registerExtensionAlt != nil { + registerExtensionAlt(desc) // populated by hooks_enabled.go + return + } + st := reflect.TypeOf(desc.ExtendedType).Elem() + m := extensionMaps[st] + if m == nil { + m = make(map[int32]*ExtensionDesc) + extensionMaps[st] = m + } + if _, ok := m[desc.Field]; ok { + panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) + } + m[desc.Field] = desc } // RegisteredExtensions returns a map of the registered extensions of a // protocol buffer struct, indexed by the extension number. // The argument pb should be a nil pointer to the struct type. func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { - return protoapi.RegisteredExtensions(pb) + if registeredExtensionsAlt != nil { + return registeredExtensionsAlt(pb) // populated by hooks_enabled.go + } + return extensionMaps[reflect.TypeOf(pb).Elem()] } diff --git a/proto/registry_test.go b/proto/registry_test.go new file mode 100644 index 0000000000..ca3f97164a --- /dev/null +++ b/proto/registry_test.go @@ -0,0 +1,28 @@ +// 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_test + +import ( + "reflect" + "testing" + + "github.com/golang/protobuf/proto" + + descriptorpb "github.com/golang/protobuf/v2/types/descriptor" +) + +func TestRegistry(t *testing.T) { + if got := proto.FileDescriptor("google/protobuf/descriptor.proto"); len(got) == 0 { + t.Errorf(`FileDescriptor("google/protobuf/descriptor.proto") = empty, want non-empty`) + } + if got := proto.EnumValueMap("google.protobuf.FieldDescriptorProto_Label"); len(got) == 0 { + t.Errorf(`EnumValueMap("google.protobuf.FieldDescriptorProto_Label") = empty, want non-empty`) + } + wantType := reflect.TypeOf(new(descriptorpb.EnumDescriptorProto_EnumReservedRange)) + gotType := proto.MessageType("google.protobuf.EnumDescriptorProto.EnumReservedRange") + if gotType != wantType { + t.Errorf(`MessageType("google.protobuf.EnumDescriptorProto.EnumReservedRange") = %v, want %v`, gotType, wantType) + } +} diff --git a/proto/table_marshal.go b/proto/table_marshal.go index 008d07db15..aefee649d0 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -259,7 +259,7 @@ func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte if err == errInvalidUTF8 { if errLater == nil { mz := reflect.Zero(reflect.PtrTo(u.typ)).Interface().(Message) - fullName := protoapi.MessageName(mz) + "." + f.name + fullName := MessageName(mz) + "." + f.name errLater = &invalidUTF8Error{fullName} } continue diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index aed2af8f19..104f375593 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -164,7 +164,7 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { if err == errInvalidUTF8 { if errLater == nil { mz := reflect.Zero(reflect.PtrTo(u.typ)).Interface().(Message) - fullName := protoapi.MessageName(mz) + "." + f.name + fullName := MessageName(mz) + "." + f.name errLater = &invalidUTF8Error{fullName} } continue diff --git a/proto/text.go b/proto/text.go index 439bb761cc..ad0652b814 100644 --- a/proto/text.go +++ b/proto/text.go @@ -653,7 +653,7 @@ func (s fieldNumSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } // writeExtensions writes all the extensions in pv. // pv is assumed to be a pointer to a protocol message struct that is extendable. func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { - emap := protoapi.RegisteredExtensions(pv.Interface().(Message)) + emap := RegisteredExtensions(pv.Interface().(Message)) ep, _ := extendable(pv.Interface()) // Order the extensions by ID. diff --git a/proto/text_parser.go b/proto/text_parser.go index 543176ec4b..96a7833243 100644 --- a/proto/text_parser.go +++ b/proto/text_parser.go @@ -16,8 +16,6 @@ import ( "strings" "sync" "unicode/utf8" - - "github.com/golang/protobuf/protoapi" ) // Error string emitted when deserializing Any and fields are already set @@ -823,7 +821,7 @@ func (p *textParser) readAny(v reflect.Value, props *Properties) error { if len(props.Enum) == 0 { break } - m := protoapi.EnumValueMap(props.Enum) + m := EnumValueMap(props.Enum) if m == nil { break } diff --git a/protoapi/registry.go b/protoapi/registry.go deleted file mode 100644 index 0383d4f458..0000000000 --- a/protoapi/registry.go +++ /dev/null @@ -1,132 +0,0 @@ -// 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 protoapi - -import ( - "fmt" - "log" - "reflect" - "strconv" -) - -// TODO: This entire file should not exist and will eventually be deleted. -// This is added for bootstrapping purposes so that a descriptor proto can be -// generated that supports v2 reflection, but still registers into the -// v1 registries for the time being. - -var enumValueMaps = make(map[string]map[string]int32) - -// RegisterEnum is called from the generated code to install the enum descriptor -// maps into the global table to aid parsing text format protocol buffers. -func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { - if _, ok := enumValueMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumValueMaps[typeName] = valueMap -} - -// EnumValueMap returns the mapping from names to integers of the -// enum type enumType, or a nil if not found. -func EnumValueMap(enumType string) map[string]int32 { - return enumValueMaps[enumType] -} - -// A registry of all linked message types. -// The string is a fully-qualified proto name ("pkg.Message"). -var ( - protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers - protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types - revProtoTypes = make(map[reflect.Type]string) -) - -// RegisterType is called from generated code and maps from the fully qualified -// proto name to the type (pointer to struct) of the protocol buffer. -func RegisterType(x Message, name string) { - if _, ok := protoTypedNils[name]; ok { - // TODO: Some day, make this a panic. - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { - // Generated code always calls RegisterType with nil x. - // This check is just for extra safety. - protoTypedNils[name] = x - } else { - protoTypedNils[name] = reflect.Zero(t).Interface().(Message) - } - revProtoTypes[t] = name -} - -// RegisterMapType is called from generated code and maps from the fully qualified -// proto name to the native map type of the proto map definition. -func RegisterMapType(x interface{}, name string) { - if reflect.TypeOf(x).Kind() != reflect.Map { - panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) - } - if _, ok := protoMapTypes[name]; ok { - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - protoMapTypes[name] = t - revProtoTypes[t] = name -} - -// MessageName returns the fully-qualified proto name for the given message type. -func MessageName(x Message) string { - type xname interface { - XXX_MessageName() string - } - if m, ok := x.(xname); ok { - return m.XXX_MessageName() - } - return revProtoTypes[reflect.TypeOf(x)] -} - -// MessageType returns the message type (pointer to struct) for a named message. -// The type is not guaranteed to implement proto.Message if the name refers to a -// map entry. -func MessageType(name string) reflect.Type { - if t, ok := protoTypedNils[name]; ok { - return reflect.TypeOf(t) - } - return protoMapTypes[name] -} - -// A registry of all linked proto files. -var protoFiles = make(map[string][]byte) // file name => fileDescriptor - -// RegisterFile is called from generated code and maps from the -// full file name of a .proto file to its compressed FileDescriptorProto. -func RegisterFile(filename string, fileDescriptor []byte) { - protoFiles[filename] = fileDescriptor -} - -// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. -func FileDescriptor(filename string) []byte { return protoFiles[filename] } - -var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) - -// RegisterExtension is called from the generated code. -func RegisterExtension(desc *ExtensionDesc) { - st := reflect.TypeOf(desc.ExtendedType).Elem() - m := extensionMaps[st] - if m == nil { - m = make(map[int32]*ExtensionDesc) - extensionMaps[st] = m - } - if _, ok := m[desc.Field]; ok { - panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) - } - m[desc.Field] = desc -} - -// RegisteredExtensions returns a map of the registered extensions of a -// protocol buffer struct, indexed by the extension number. -// The argument pb should be a nil pointer to the struct type. -func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { - return extensionMaps[reflect.TypeOf(pb).Elem()] -} diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index a27d857286..6fc98edc36 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -5,18 +5,11 @@ package descriptor import ( proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" descriptor "github.com/golang/protobuf/v2/types/descriptor" ) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - // Symbols defined in public import of google/protobuf/descriptor.proto type FieldDescriptorProto_Type = descriptor.FieldDescriptorProto_Type @@ -156,10 +149,6 @@ type UninterpretedOption_NamePart = descriptor.UninterpretedOption_NamePart type SourceCodeInfo_Location = descriptor.SourceCodeInfo_Location type GeneratedCodeInfo_Annotation = descriptor.GeneratedCodeInfo_Annotation -func init() { - proto.RegisterFile("github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto", xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc_gzipped) -} - var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc = []byte{ // 180 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, @@ -176,7 +165,7 @@ var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_prot 0x6f, 0x74, 0x6f, 0x32, } -var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc) +var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) @@ -195,6 +184,7 @@ func xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_pro GoTypes: xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs, }.Init() + proto.RegisterFile("github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto", xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc_gzipped) xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = nil xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = nil } diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index 6314cb7f9f..7d13e686cd 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -5,18 +5,11 @@ package plugin_go import ( proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" plugin "github.com/golang/protobuf/v2/types/plugin" ) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - // Symbols defined in public import of google/protobuf/compiler/plugin.proto type Version = plugin.Version @@ -24,10 +17,6 @@ type CodeGeneratorRequest = plugin.CodeGeneratorRequest type CodeGeneratorResponse = plugin.CodeGeneratorResponse type CodeGeneratorResponse_File = plugin.CodeGeneratorResponse_File -func init() { - proto.RegisterFile("github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto", xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc_gzipped) -} - var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc = []byte{ // 172 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, @@ -43,7 +32,7 @@ var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdes 0x67, 0x6f, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, } -var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc) +var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) @@ -62,6 +51,7 @@ func xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init( GoTypes: xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs, }.Init() + proto.RegisterFile("github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto", xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc_gzipped) xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = nil xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = nil } diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index 42078b5a47..1857c74166 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -5,26 +5,15 @@ package any import ( proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" known "github.com/golang/protobuf/v2/types/known" ) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - // Symbols defined in public import of google/protobuf/any.proto type Any = known.Any -func init() { - proto.RegisterFile("github.com/golang/protobuf/ptypes/any/any.proto", xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc_gzipped) -} - var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc = []byte{ // 131 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, @@ -38,7 +27,7 @@ var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc = []byte{ 0x74, 0x6f, 0x33, } -var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc) +var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) @@ -57,6 +46,7 @@ func xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_init() { GoTypes: xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs, }.Init() + proto.RegisterFile("github.com/golang/protobuf/ptypes/any/any.proto", xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc_gzipped) xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = nil xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = nil } diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index d667a5eae3..af0e70b1d4 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -5,26 +5,15 @@ package duration import ( proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" known "github.com/golang/protobuf/v2/types/known" ) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - // Symbols defined in public import of google/protobuf/duration.proto type Duration = known.Duration -func init() { - proto.RegisterFile("github.com/golang/protobuf/ptypes/duration/duration.proto", xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc_gzipped) -} - var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc = []byte{ // 156 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, @@ -39,7 +28,7 @@ var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc = 0x6f, 0x6e, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc) +var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) @@ -58,6 +47,7 @@ func xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_init() { GoTypes: xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs, }.Init() + proto.RegisterFile("github.com/golang/protobuf/ptypes/duration/duration.proto", xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc_gzipped) xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = nil xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = nil } diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index c94aa08c22..726c360cbf 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -5,26 +5,15 @@ package empty import ( proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" known "github.com/golang/protobuf/v2/types/known" ) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - // Symbols defined in public import of google/protobuf/empty.proto type Empty = known.Empty -func init() { - proto.RegisterFile("github.com/golang/protobuf/ptypes/empty/empty.proto", xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc_gzipped) -} - var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc = []byte{ // 141 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, @@ -38,7 +27,7 @@ var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc = []byt 0x70, 0x74, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc) +var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) @@ -57,6 +46,7 @@ func xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_init() { GoTypes: xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs, }.Init() + proto.RegisterFile("github.com/golang/protobuf/ptypes/empty/empty.proto", xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc_gzipped) xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = nil xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = nil } diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index 0d71b8dab1..543a925439 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -5,18 +5,11 @@ package structpb import ( proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" known "github.com/golang/protobuf/v2/types/known" ) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - // Symbols defined in public import of google/protobuf/struct.proto type NullValue = known.NullValue @@ -36,10 +29,6 @@ type Value_StructValue = known.Value_StructValue type Value_ListValue = known.Value_ListValue type ListValue = known.ListValue -func init() { - proto.RegisterFile("github.com/golang/protobuf/ptypes/struct/struct.proto", xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc_gzipped) -} - var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc = []byte{ // 148 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, @@ -54,7 +43,7 @@ var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc = []b 0x6f, 0x74, 0x6f, 0x33, } -var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc) +var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) @@ -73,6 +62,7 @@ func xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_init() { GoTypes: xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs, }.Init() + proto.RegisterFile("github.com/golang/protobuf/ptypes/struct/struct.proto", xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc_gzipped) xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = nil xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = nil } diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index c4246dcf2e..c993c5899e 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -5,26 +5,15 @@ package timestamp import ( proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" known "github.com/golang/protobuf/v2/types/known" ) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - // Symbols defined in public import of google/protobuf/timestamp.proto type Timestamp = known.Timestamp -func init() { - proto.RegisterFile("github.com/golang/protobuf/ptypes/timestamp/timestamp.proto", xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc_gzipped) -} - var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc = []byte{ // 161 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, @@ -40,7 +29,7 @@ var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc 0x33, } -var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc) +var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) @@ -59,6 +48,7 @@ func xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() GoTypes: xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs, }.Init() + proto.RegisterFile("github.com/golang/protobuf/ptypes/timestamp/timestamp.proto", xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc_gzipped) xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = nil xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = nil } diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index d3499accc6..7e47bc64b4 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -5,18 +5,11 @@ package wrappers import ( proto "github.com/golang/protobuf/proto" - protoapi "github.com/golang/protobuf/protoapi" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" known "github.com/golang/protobuf/v2/types/known" ) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - // Symbols defined in public import of google/protobuf/wrappers.proto type DoubleValue = known.DoubleValue @@ -29,10 +22,6 @@ type BoolValue = known.BoolValue type StringValue = known.StringValue type BytesValue = known.BytesValue -func init() { - proto.RegisterFile("github.com/golang/protobuf/ptypes/wrappers/wrappers.proto", xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc_gzipped) -} - var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc = []byte{ // 156 bytes of the wire-encoded FileDescriptorProto 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, @@ -47,7 +36,7 @@ var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc = 0x72, 0x73, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc) +var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc) const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) @@ -66,6 +55,7 @@ func xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() { GoTypes: xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs, }.Init() + proto.RegisterFile("github.com/golang/protobuf/ptypes/wrappers/wrappers.proto", xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc_gzipped) xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = nil xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = nil } From d94fb84e04b733b44c21ce6ef83d98f145b83317 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 20 Mar 2019 21:13:23 -0700 Subject: [PATCH 056/133] all: move v1 types over to the v2 repository In CL/168519, we move all exported types in v1 protoapi over to the v2 repository. This CL does the other half of the move, where the moved logic is deleted from protoapi. Since little logic remains in protoapi, the package is being deleted, and remaining logic moved back into the v1 proto package itself. CL/168538 is the corresponding change to alter v1. There will be a temporary build failure as it is not possible to submit CL/168519 and CL/168538 atomically. Change-Id: I3f233b56684357747e35ac6b83f3e0aa427b3152 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/168538 Reviewed-by: Herbie Ong --- go.mod | 3 - go.sum | 5 - internal/proto/common.go | 7 +- proto/clone.go | 3 +- proto/deprecated.go | 50 +++++--- proto/equal.go | 12 +- proto/extensions.go | 17 +-- proto/lib.go | 24 +++- proto/message_set.go | 4 +- proto/table_marshal.go | 10 +- proto/table_unmarshal.go | 8 +- proto/text.go | 5 - protoapi/api.go | 242 --------------------------------------- protoapi/impl.go | 91 --------------- protoapi/impl_test.go | 41 ------- 15 files changed, 83 insertions(+), 439 deletions(-) delete mode 100644 go.mod delete mode 100644 go.sum delete mode 100644 protoapi/api.go delete mode 100644 protoapi/impl.go delete mode 100644 protoapi/impl_test.go diff --git a/go.mod b/go.mod deleted file mode 100644 index dbcf0329c4..0000000000 --- a/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/golang/protobuf - -require github.com/golang/protobuf/v2 v2.0.0-20190320041633-559d47f1da45 diff --git a/go.sum b/go.sum deleted file mode 100644 index d0211f0e58..0000000000 --- a/go.sum +++ /dev/null @@ -1,5 +0,0 @@ -github.com/golang/protobuf v1.2.1-0.20190311233832-968e039ade03/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf/v2 v2.0.0-20190320041633-559d47f1da45 h1:UpSQcE2BQjlwjgUj1o+22OMRLUpeeTZNH1fuZN5lEv4= -github.com/golang/protobuf/v2 v2.0.0-20190320041633-559d47f1da45/go.mod h1:memx26heJzlbv0kkl0yZyY1iCWPnh53PDfstsy8HCEg= -github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42 h1:q3pnF5JFBNRz8sRD+IRj7Y6DMyYGTNqnZ9axTbSfoNI= -github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= diff --git a/internal/proto/common.go b/internal/proto/common.go index d49c17c817..93f5178408 100644 --- a/internal/proto/common.go +++ b/internal/proto/common.go @@ -9,12 +9,11 @@ package proto // that they would otherwise be able to call directly. import ( - "github.com/golang/protobuf/protoapi" - + "github.com/golang/protobuf/v2/runtime/protoiface" _ "github.com/golang/protobuf/v2/runtime/protolegacy" ) type ( - Message = protoapi.Message - ExtensionDesc = protoapi.ExtensionDesc + Message = protoiface.MessageV1 + ExtensionDesc = protoiface.ExtensionDescV1 ) diff --git a/proto/clone.go b/proto/clone.go index 5f97f7aa62..2cb7009fea 100644 --- a/proto/clone.go +++ b/proto/clone.go @@ -13,7 +13,6 @@ import ( "reflect" "strings" - "github.com/golang/protobuf/protoapi" "github.com/golang/protobuf/v2/reflect/protoreflect" ) @@ -209,7 +208,7 @@ func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { } } -func mergeExtension(out, in protoapi.ExtensionFields) { +func mergeExtension(out, in extensionFields) { in.Range(func(extNum protoreflect.FieldNumber, eIn Extension) bool { eOut := Extension{Desc: eIn.Desc} if eIn.Value != nil { diff --git a/proto/deprecated.go b/proto/deprecated.go index da5b374dd3..7db76d4a39 100644 --- a/proto/deprecated.go +++ b/proto/deprecated.go @@ -5,49 +5,69 @@ package proto import ( + "encoding/json" "errors" - - "github.com/golang/protobuf/protoapi" + "fmt" + "strconv" ) -// Deprecated: do not use. +// Deprecated: Do not use. var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") -// Deprecated: do not use. +// 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. +// Deprecated: Do not use. func EnumName(m map[int32]string, v int32) string { - return protoapi.EnumName(m, v) + if s, ok := m[v]; ok { + return s + } + return strconv.Itoa(int(v)) } -// Deprecated: do not use. -func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { - return protoapi.UnmarshalJSONEnum(m, data, enumName) +// Deprecated: Do not use. +func UnmarshalJSONEnum(m map[string]int32, b []byte, enumName string) (int32, error) { + if b[0] == '"' { + var s string + if err := json.Unmarshal(b, &s); err != nil { + return 0, fmt.Errorf("proto: invalid input for enum %v: %s", enumName, b) + } + v, ok := m[s] + if !ok { + return 0, fmt.Errorf("proto: invalid value for enum %v: %s", enumName, b) + } + return v, nil + } else { + var v int32 + if err := json.Unmarshal(b, &v); err != nil { + return 0, fmt.Errorf("proto: invalid input for enum %v: %s", enumName, b) + } + return v, nil + } } diff --git a/proto/equal.go b/proto/equal.go index 29ae49ba9e..04da80aada 100644 --- a/proto/equal.go +++ b/proto/equal.go @@ -12,8 +12,8 @@ import ( "reflect" "strings" - "github.com/golang/protobuf/protoapi" "github.com/golang/protobuf/v2/reflect/protoreflect" + "github.com/golang/protobuf/v2/runtime/protoimpl" ) /* @@ -94,8 +94,8 @@ func equalStruct(v1, v2 reflect.Value) bool { if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { em2 := v2.FieldByName("XXX_InternalExtensions") - m1 := protoapi.ExtensionFieldsOf(em1.Addr().Interface()) - m2 := protoapi.ExtensionFieldsOf(em2.Addr().Interface()) + m1 := protoimpl.X.ExtensionFieldsOf(em1.Addr().Interface()) + m2 := protoimpl.X.ExtensionFieldsOf(em2.Addr().Interface()) if !equalExtensions(v1.Type(), m1, m2) { return false } @@ -103,8 +103,8 @@ func equalStruct(v1, v2 reflect.Value) bool { if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { em2 := v2.FieldByName("XXX_extensions") - m1 := protoapi.ExtensionFieldsOf(em1.Addr().Interface()) - m2 := protoapi.ExtensionFieldsOf(em2.Addr().Interface()) + m1 := protoimpl.X.ExtensionFieldsOf(em1.Addr().Interface()) + m2 := protoimpl.X.ExtensionFieldsOf(em2.Addr().Interface()) if !equalExtensions(v1.Type(), m1, m2) { return false } @@ -207,7 +207,7 @@ func equalAny(v1, v2 reflect.Value, prop *Properties) bool { return false } -func equalExtensions(base reflect.Type, em1, em2 protoapi.ExtensionFields) bool { +func equalExtensions(base reflect.Type, em1, em2 extensionFields) bool { if em1.Len() != em2.Len() { return false } diff --git a/proto/extensions.go b/proto/extensions.go index 3923707b85..836619d452 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -15,14 +15,15 @@ import ( "reflect" "sync" - "github.com/golang/protobuf/protoapi" "github.com/golang/protobuf/v2/reflect/protoreflect" + "github.com/golang/protobuf/v2/runtime/protoiface" + "github.com/golang/protobuf/v2/runtime/protoimpl" ) // ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. var ErrMissingExtension = errors.New("proto: missing extension") -func extendable(p interface{}) (protoapi.ExtensionFields, error) { +func extendable(p interface{}) (extensionFields, error) { type extendableProto interface { Message ExtensionRangeArray() []ExtensionRange @@ -32,10 +33,10 @@ func extendable(p interface{}) (protoapi.ExtensionFields, error) { if v.Kind() == reflect.Ptr && !v.IsNil() { v = v.Elem() if v := v.FieldByName("XXX_InternalExtensions"); v.IsValid() { - return protoapi.ExtensionFieldsOf(v.Addr().Interface()), nil + return protoimpl.X.ExtensionFieldsOf(v.Addr().Interface()), nil } if v := v.FieldByName("XXX_extensions"); v.IsValid() { - return protoapi.ExtensionFieldsOf(v.Addr().Interface()), nil + return protoimpl.X.ExtensionFieldsOf(v.Addr().Interface()), nil } } } @@ -47,10 +48,10 @@ func extendable(p interface{}) (protoapi.ExtensionFields, error) { var errNotExtendable = errors.New("proto: not an extendable proto.Message") type ( - ExtensionRange = protoapi.ExtensionRange - ExtensionDesc = protoapi.ExtensionDesc - Extension = protoapi.ExtensionField - XXX_InternalExtensions = protoapi.XXX_InternalExtensions + ExtensionRange = protoiface.ExtensionRangeV1 + ExtensionDesc = protoiface.ExtensionDescV1 + Extension = protoimpl.ExtensionFieldV1 + XXX_InternalExtensions = protoimpl.ExtensionFieldsV1 ) func isRepeatedExtension(ed *ExtensionDesc) bool { diff --git a/proto/lib.go b/proto/lib.go index 1906a2a417..e82e1386f1 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -15,13 +15,25 @@ import ( "strconv" "sync" - // Add a bogus dependency on the v2 API to ensure the Go toolchain does not - // remove our dependency from the go.mod file. - _ "github.com/golang/protobuf/v2/reflect/protoreflect" - - "github.com/golang/protobuf/protoapi" + "github.com/golang/protobuf/v2/reflect/protoreflect" + "github.com/golang/protobuf/v2/runtime/protoiface" + "github.com/golang/protobuf/v2/runtime/protoimpl" ) +type extensionFields = interface { + Len() int + Has(protoreflect.FieldNumber) bool + Get(protoreflect.FieldNumber) protoimpl.ExtensionFieldV1 + Set(protoreflect.FieldNumber, protoimpl.ExtensionFieldV1) + Clear(protoreflect.FieldNumber) + Range(f func(protoreflect.FieldNumber, protoimpl.ExtensionFieldV1) bool) + + // HasInit and Locker are used by v1 GetExtension to provide + // an artificial degree of concurrent safety. + HasInit() bool + sync.Locker +} + // RequiredNotSetError is an error type returned by either Marshal or Unmarshal. // Marshal reports this when a required field is not initialized. // Unmarshal reports this when a required field is missing from the wire data. @@ -84,7 +96,7 @@ func (nf *nonFatal) Merge(err error) (ok bool) { } // Message is implemented by generated protocol buffer messages. -type Message = protoapi.Message +type Message = protoiface.MessageV1 var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() diff --git a/proto/message_set.go b/proto/message_set.go index 19a1a00852..2878bdf8a8 100644 --- a/proto/message_set.go +++ b/proto/message_set.go @@ -11,8 +11,8 @@ package proto import ( "errors" - "github.com/golang/protobuf/protoapi" "github.com/golang/protobuf/v2/reflect/protoreflect" + "github.com/golang/protobuf/v2/runtime/protoimpl" ) // errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. @@ -118,7 +118,7 @@ func skipVarint(buf []byte) []byte { // unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. // It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. func unmarshalMessageSet(buf []byte, exts interface{}) error { - m := protoapi.ExtensionFieldsOf(exts) + m := protoimpl.X.ExtensionFieldsOf(exts) ms := new(messageSet) if err := Unmarshal(buf, ms); err != nil { diff --git a/proto/table_marshal.go b/proto/table_marshal.go index aefee649d0..303c1eaf94 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -16,8 +16,8 @@ import ( "sync/atomic" "unicode/utf8" - "github.com/golang/protobuf/protoapi" "github.com/golang/protobuf/v2/reflect/protoreflect" + "github.com/golang/protobuf/v2/runtime/protoimpl" ) // a sizer takes a pointer to a field and the size of its tag, computes the size of @@ -2366,7 +2366,7 @@ func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, ma // sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field. func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { - m := protoapi.ExtensionFieldsOf(ext) + m := protoimpl.X.ExtensionFieldsOf(ext) if !m.HasInit() { return 0 } @@ -2395,7 +2395,7 @@ func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { // appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b. func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m := protoapi.ExtensionFieldsOf(ext) + m := protoimpl.X.ExtensionFieldsOf(ext) if !m.HasInit() { return b, nil } @@ -2475,7 +2475,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de // sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field // in message set format (above). func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { - m := protoapi.ExtensionFieldsOf(ext) + m := protoimpl.X.ExtensionFieldsOf(ext) if !m.HasInit() { return 0 } @@ -2511,7 +2511,7 @@ func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { // appendMessageSet marshals a XXX_InternalExtensions field in message set format (above) // to the end of byte slice b. func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m := protoapi.ExtensionFieldsOf(ext) + m := protoimpl.X.ExtensionFieldsOf(ext) if !m.HasInit() { return b, nil } diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index 104f375593..ae4395fbb0 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -16,8 +16,8 @@ import ( "sync/atomic" "unicode/utf8" - "github.com/golang/protobuf/protoapi" "github.com/golang/protobuf/v2/reflect/protoreflect" + "github.com/golang/protobuf/v2/runtime/protoimpl" ) // Unmarshal is the entry point from the generated .pb.go files. @@ -187,20 +187,20 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { // Keep unrecognized data around. // maybe in extensions, maybe in the unrecognized field. z := m.offset(u.unrecognized).toBytes() - var emap protoapi.ExtensionFields + var emap extensionFields var e Extension for _, r := range u.extensionRanges { if uint64(r.Start) <= tag && tag <= uint64(r.End) { if u.extensions.IsValid() { mp := m.offset(u.extensions).toExtensions() - emap = protoapi.ExtensionFieldsOf(mp) + emap = protoimpl.X.ExtensionFieldsOf(mp) e = emap.Get(protoreflect.FieldNumber(tag)) z = &e.Raw break } if u.oldExtensions.IsValid() { p := m.offset(u.oldExtensions).toOldExtensions() - emap = protoapi.ExtensionFieldsOf(p) + emap = protoimpl.X.ExtensionFieldsOf(p) e = emap.Get(protoreflect.FieldNumber(tag)) z = &e.Raw break diff --git a/proto/text.go b/proto/text.go index ad0652b814..dfd3e92df3 100644 --- a/proto/text.go +++ b/proto/text.go @@ -19,7 +19,6 @@ import ( "sort" "strings" - "github.com/golang/protobuf/protoapi" "github.com/golang/protobuf/v2/reflect/protoreflect" ) @@ -817,7 +816,3 @@ func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Ma // CompactTextString is the same as CompactText, but returns the string directly. func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } - -func init() { - protoapi.CompactTextString = CompactTextString -} diff --git a/protoapi/api.go b/protoapi/api.go deleted file mode 100644 index 1cae07b39f..0000000000 --- a/protoapi/api.go +++ /dev/null @@ -1,242 +0,0 @@ -// 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 protoapi contains the set of types referenced by generated messages. -// -// WARNING: This package should only ever be imported by generated messages. -// The compatibility agreement covers nothing except for functionality needed -// to keep existing generated messages operational. -package protoapi - -import ( - "fmt" - "sync" - - "github.com/golang/protobuf/v2/reflect/protoreflect" -) - -// TODO: How to handle Registration during the v1 to v2 switchover? - -type ( - Message interface { - Reset() - String() string - ProtoMessage() - } - - ExtensionRange struct { - Start, End int32 // both inclusive - } - - ExtensionDesc struct { - // Type is the descriptor type for the extension field using the v2 API. - // If populated, the information in this field takes precedence over - // all other fields in ExtensionDesc. - Type protoreflect.ExtensionType - - // ExtendedType is a typed nil-pointer to the parent message type that - // is being extended. It is possible for this to be unpopulated in v2 - // since the message may no longer implement the v1 Message interface. - // - // Deprecated: Use Type.ExtendedType instead. - ExtendedType Message - - // ExtensionType is zero value of the extension type. - // - // For historical reasons, reflect.TypeOf(ExtensionType) and Type.GoType - // may not be identical: - // * for scalars (except []byte), where ExtensionType uses *T, - // while Type.GoType uses T. - // * for repeated fields, where ExtensionType uses []T, - // while Type.GoType uses *[]T. - // - // Deprecated: Use Type.GoType instead. - ExtensionType interface{} - - // Field is the field number of the extension. - // - // Deprecated: Use Type.Number instead. - Field int32 // field number - - // Name is the fully qualified name of extension. - // - // Deprecated: Use Type.FullName instead. - Name string - - // Tag is the protobuf struct tag used in the v1 API. - // - // Deprecated: Do not use. - Tag string - - // Filename is the proto filename in which the extension is defined. - // - // Deprecated: Use Type.Parent to ascend to the top-most parent and use - // protoreflect.FileDescriptor.Path. - Filename string - } - - ExtensionFields extensionFields - ExtensionField extensionField - XXX_InternalExtensions extensionSyncMap -) - -// ExtensionFieldsOf returns an ExtensionFields abstraction over various -// internal representations of extension fields. -func ExtensionFieldsOf(p interface{}) ExtensionFields { - switch p := p.(type) { - case *map[int32]ExtensionField: - return (*extensionMap)(p) - case *XXX_InternalExtensions: - return (*extensionSyncMap)(p) - default: - panic(fmt.Sprintf("invalid extension fields type: %T", p)) - } -} - -type extensionFields interface { - Len() int - Has(protoreflect.FieldNumber) bool - Get(protoreflect.FieldNumber) ExtensionField - Set(protoreflect.FieldNumber, ExtensionField) - Clear(protoreflect.FieldNumber) - Range(f func(protoreflect.FieldNumber, ExtensionField) bool) - - // HasInit and Locker are used by v1 GetExtension to provide - // an artificial degree of concurrent safety. - HasInit() bool - sync.Locker -} - -type extensionField struct { - // When an extension is stored in a message using SetExtension - // only desc and value are set. When the message is marshaled - // Raw will be set to the encoded form of the message. - // - // When a message is unmarshaled and contains extensions, each - // extension will have only Raw set. When such an extension is - // accessed using GetExtension (or GetExtensions) desc and value - // will be set. - Desc *ExtensionDesc // TODO: switch to protoreflect.ExtensionType - - // Value is a concrete value for the extension field. Let the type of - // Desc.ExtensionType be the "API type" and the type of Value be the - // "storage type". The API type and storage type are the same except: - // * for scalars (except []byte), where the API type uses *T, - // while the storage type uses T. - // * for repeated fields, where 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{} // TODO: switch to protoreflect.Value - - // Raw is the raw encoded bytes for the extension field. - // It is possible for Raw to be populated irrespective of whether the - // other fields are populated. - Raw []byte // TODO: switch to protoreflect.RawFields -} - -type extensionSyncMap struct { - p *struct { - mu sync.Mutex - m extensionMap - } -} - -func (m extensionSyncMap) Len() int { - if m.p == nil { - return 0 - } - return m.p.m.Len() -} -func (m extensionSyncMap) Has(n protoreflect.FieldNumber) bool { - if m.p == nil { - return false - } - return m.p.m.Has(n) -} -func (m extensionSyncMap) Get(n protoreflect.FieldNumber) ExtensionField { - if m.p == nil { - return ExtensionField{} - } - return m.p.m.Get(n) -} -func (m *extensionSyncMap) Set(n protoreflect.FieldNumber, x ExtensionField) { - if m.p == nil { - m.p = new(struct { - mu sync.Mutex - m extensionMap - }) - } - m.p.m.Set(n, x) -} -func (m extensionSyncMap) Clear(n protoreflect.FieldNumber) { - if m.p == nil { - return - } - m.p.m.Clear(n) -} -func (m extensionSyncMap) Range(f func(protoreflect.FieldNumber, ExtensionField) bool) { - if m.p == nil { - return - } - m.p.m.Range(f) -} - -func (m extensionSyncMap) HasInit() bool { - return m.p != nil -} -func (m extensionSyncMap) Lock() { - m.p.mu.Lock() -} -func (m extensionSyncMap) Unlock() { - m.p.mu.Unlock() -} - -type extensionMap map[int32]ExtensionField - -func (m extensionMap) Len() int { - return len(m) -} -func (m extensionMap) Has(n protoreflect.FieldNumber) bool { - _, ok := m[int32(n)] - return ok -} -func (m extensionMap) Get(n protoreflect.FieldNumber) ExtensionField { - return m[int32(n)] -} -func (m *extensionMap) Set(n protoreflect.FieldNumber, x ExtensionField) { - if *m == nil { - *m = make(map[int32]ExtensionField) - } - (*m)[int32(n)] = x -} -func (m *extensionMap) Clear(n protoreflect.FieldNumber) { - delete(*m, int32(n)) -} -func (m extensionMap) Range(f func(protoreflect.FieldNumber, ExtensionField) bool) { - for n, x := range m { - if !f(protoreflect.FieldNumber(n), x) { - return - } - } -} - -var globalLock sync.Mutex - -func (m extensionMap) HasInit() bool { - return m != nil -} -func (m extensionMap) Lock() { - if !m.HasInit() { - panic("cannot lock an uninitialized map") - } - globalLock.Lock() -} -func (m extensionMap) Unlock() { - globalLock.Unlock() -} diff --git a/protoapi/impl.go b/protoapi/impl.go deleted file mode 100644 index 460b592e56..0000000000 --- a/protoapi/impl.go +++ /dev/null @@ -1,91 +0,0 @@ -// 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 protoapi - -import ( - "encoding/binary" - "encoding/json" - "fmt" - "hash/crc32" - "math" - "strconv" -) - -// TODO: Are these the final signatures that we want? - -// EnumName is a helper function to simplify printing protocol buffer enums -// by name. Given an enum map and a value, it returns a useful string. -func EnumName(m map[int32]string, v int32) string { - s, ok := m[v] - if ok { - return s - } - return strconv.Itoa(int(v)) -} - -// UnmarshalJSONEnum is a helper function to simplify recovering enum int values -// from their JSON-encoded representation. Given a map from the enum's symbolic -// names to its int values, and a byte buffer containing the JSON-encoded -// value, it returns an int32 that can be cast to the enum type by the caller. -// -// The function can deal with both JSON representations, numeric and symbolic. -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 -} - -// CompressGZIP compresses the input as a GZIP-encoded file. -// The current implementation does no compression. -func CompressGZIP(in []byte) (out []byte) { - // RFC 1952, section 2.3.1. - var gzipHeader = [10]byte{0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff} - - // RFC 1951, section 3.2.4. - var blockHeader [5]byte - const maxBlockSize = math.MaxUint16 - numBlocks := 1 + len(in)/maxBlockSize - - // RFC 1952, section 2.3.1. - var gzipFooter [8]byte - binary.LittleEndian.PutUint32(gzipFooter[0:4], crc32.ChecksumIEEE(in)) - binary.LittleEndian.PutUint32(gzipFooter[4:8], uint32(len(in))) - - // Encode the input without compression using raw DEFLATE blocks. - out = make([]byte, 0, len(gzipHeader)+len(blockHeader)*numBlocks+len(in)+len(gzipFooter)) - out = append(out, gzipHeader[:]...) - for blockHeader[0] == 0 { - blockSize := maxBlockSize - if blockSize > len(in) { - blockHeader[0] = 0x01 // final bit per RFC 1951, section 3.2.3. - blockSize = len(in) - } - binary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize)^0x0000) - binary.LittleEndian.PutUint16(blockHeader[3:5], uint16(blockSize)^0xffff) - out = append(out, blockHeader[:]...) - out = append(out, in[:blockSize]...) - in = in[blockSize:] - } - out = append(out, gzipFooter[:]...) - return out -} - -// TODO: Remove this when v2 textpb is available. -var CompactTextString func(Message) string diff --git a/protoapi/impl_test.go b/protoapi/impl_test.go deleted file mode 100644 index bc73ed79a7..0000000000 --- a/protoapi/impl_test.go +++ /dev/null @@ -1,41 +0,0 @@ -// 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 protoapi - -import ( - "bytes" - "compress/gzip" - "io/ioutil" - "math" - "strings" - "testing" -) - -func TestCompressGZIP(t *testing.T) { - tests := []string{ - "", - "a", - "ab", - "abc", - strings.Repeat("a", math.MaxUint16-1), - strings.Repeat("b", math.MaxUint16), - strings.Repeat("c", math.MaxUint16+1), - strings.Repeat("abcdefghijklmnopqrstuvwxyz", math.MaxUint16-13), - } - for _, want := range tests { - rb := bytes.NewReader(CompressGZIP([]byte(want))) - zr, err := gzip.NewReader(rb) - if err != nil { - t.Errorf("unexpected gzip.NewReader error: %v", err) - } - b, err := ioutil.ReadAll(zr) - if err != nil { - t.Errorf("unexpected ioutil.ReadAll error: %v", err) - } - if got := string(b); got != want { - t.Errorf("output mismatch: got %q, want %q", got, want) - } - } -} From d5e33cf95865e2fed89d235f42795145ca5254f6 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 22 Mar 2019 13:15:58 -0700 Subject: [PATCH 057/133] all: re-add go.mod and go.sum files Change-Id: I76397394b59762f7187823efc5008c09f685e224 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/168918 Reviewed-by: Joe Tsai --- go.mod | 3 +++ go.sum | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 go.mod create mode 100644 go.sum diff --git a/go.mod b/go.mod new file mode 100644 index 0000000000..0dc7235823 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/golang/protobuf + +require github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e diff --git a/go.sum b/go.sum new file mode 100644 index 0000000000..16d8546a59 --- /dev/null +++ b/go.sum @@ -0,0 +1,5 @@ +github.com/golang/protobuf v1.2.1-0.20190322195920-d94fb84e04b7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e h1:JQRqkjZt61BlBnTP2OpISUfb5I1LGJcqYHfFGERMmlg= +github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e/go.mod h1:25ZALhydMFaBRgPH58a8zpFe9YXMAMjOYWtB6pNPcoo= +github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42 h1:q3pnF5JFBNRz8sRD+IRj7Y6DMyYGTNqnZ9axTbSfoNI= +github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= From be03c15fcaa227d4af8e81c350160fe65984a50a Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 25 Mar 2019 18:02:22 -0700 Subject: [PATCH 058/133] all: invert use_golang_protobuf_v1 tag Invert the build tag such that the default is to use the reimplementation that uses v2 under the hood. Change-Id: I04ee912ddd59b387c2fbf0146b779dd99b060e93 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/169297 Reviewed-by: Herbie Ong --- proto/hooks_disabled.go | 2 +- proto/hooks_enabled.go | 2 +- proto/properties.go | 2 +- proto/properties_alt.go | 2 +- test.bash | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/proto/hooks_disabled.go b/proto/hooks_disabled.go index fe9aaa0721..b604f816c3 100644 --- a/proto/hooks_disabled.go +++ b/proto/hooks_disabled.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !proto_reimpl +// +build use_golang_protobuf_v1 package proto diff --git a/proto/hooks_enabled.go b/proto/hooks_enabled.go index c117ba445d..1c6e97f5b8 100644 --- a/proto/hooks_enabled.go +++ b/proto/hooks_enabled.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build proto_reimpl +// +build !use_golang_protobuf_v1 package proto diff --git a/proto/properties.go b/proto/properties.go index 5c4d44d885..6f15aeb839 100644 --- a/proto/properties.go +++ b/proto/properties.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !proto_reimpl +// +build use_golang_protobuf_v1 package proto diff --git a/proto/properties_alt.go b/proto/properties_alt.go index 8fba1c48cf..56b8a66d11 100644 --- a/proto/properties_alt.go +++ b/proto/properties_alt.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build proto_reimpl +// +build !use_golang_protobuf_v1 package proto diff --git a/test.bash b/test.bash index 11af78dd53..a7351bfc60 100755 --- a/test.bash +++ b/test.bash @@ -11,7 +11,7 @@ FAIL="\x1b[31mFAIL" RESET="\x1b[0m" echo -e "${BOLD}go test${RESET}" -RET_TEST=$((go test ./... && go test -tags proto_reimpl ./...) | egrep -v "^(ok|[?])\s+") +RET_TEST=$((go test ./... && go test -tags use_golang_protobuf_v1 ./...) | egrep -v "^(ok|[?])\s+") if [[ ! -z "$RET_TEST" ]]; then echo "$RET_TEST"; echo; fi echo -e "${BOLD}go generate${RESET}" From 63105e5dc89d8404969959ccfa13927c2dcf26da Mon Sep 17 00:00:00 2001 From: Herbie Ong Date: Tue, 9 Apr 2019 23:02:23 -0700 Subject: [PATCH 059/133] proto: wrap v2 textproto marshal/unmarshal Removed V1 test files related to textproto serialization as these do not provide much relevance given that pure V1 implementation is temporary and maintaining dual mode for these tests can be troublesome. Before deleting or changing any test files, all tests except for timestamp_test.go:TestTimestampString pass with tag use_golang_protobuf_v1. The issue with TestTimestampString is brought about by updating go.mod's V2 dependency to a newer version of Timestamp proto message that has String method already using V2 textpb. Test is fixed in this CL. Before these tests were removed, each was inspected for pass/fail against the wrapped implementation. Following tests failed due to expected differences between V1 and V2. The failure reasons are added as review comments in the CL for documentation purposes. text_parser_test.go TestUnmarshalText TestMapParsing TestOneofParsing text_test.go TestMarshalText TestMarshalTextUnknownEnum TestTextOneof TestCompactText TestStringEscaping TestMarshalTextFailing TestRepeatedNilText TestProto3Text any_test.go TestMarshalGolden TestMarshalUnknownAny TestUnmarshalOverwriteAny TestUnmarshalAnyMixAndMatch Change-Id: I2505341d6f47384a69b195efc3218fa07efc4e7a Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/171459 Reviewed-by: Joe Tsai --- go.mod | 2 +- go.sum | 3 + internal/proto/common.go | 54 ++ internal/proto/common_test.go | 63 ++ internal/proto/text.go | 116 ++++ proto/all_test.go | 27 +- proto/any_test.go | 273 --------- proto/hooks_disabled.go | 67 +++ proto/hooks_enabled.go | 15 + proto/lib.go | 8 +- proto/table_marshal.go | 6 +- proto/table_unmarshal.go | 12 +- proto/text.go | 50 +- proto/text_parser.go | 17 +- proto/text_parser_test.go | 679 ---------------------- proto/text_test.go | 491 ---------------- protoc-gen-go/descriptor/descriptor.pb.go | 30 +- protoc-gen-go/plugin/plugin.pb.go | 30 +- ptypes/any/any.pb.go | 30 +- ptypes/duration/duration.pb.go | 30 +- ptypes/empty/empty.pb.go | 30 +- ptypes/struct/struct.pb.go | 30 +- ptypes/timestamp/timestamp.pb.go | 30 +- ptypes/timestamp_test.go | 2 +- ptypes/wrappers/wrappers.pb.go | 30 +- 25 files changed, 564 insertions(+), 1561 deletions(-) create mode 100644 internal/proto/common_test.go create mode 100644 internal/proto/text.go delete mode 100644 proto/any_test.go delete mode 100644 proto/text_parser_test.go delete mode 100644 proto/text_test.go diff --git a/go.mod b/go.mod index 0dc7235823..c52c1b2566 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/golang/protobuf -require github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e +require github.com/golang/protobuf/v2 v2.0.0-20190409211845-4ec39c766335 diff --git a/go.sum b/go.sum index 16d8546a59..f098f99ece 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,8 @@ github.com/golang/protobuf v1.2.1-0.20190322195920-d94fb84e04b7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.1-0.20190326022002-be03c15fcaa2/go.mod h1:rZ4veVXHB1S2+o7TKqD9Isxml062IeDutnCDtFPUlCc= github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e h1:JQRqkjZt61BlBnTP2OpISUfb5I1LGJcqYHfFGERMmlg= github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e/go.mod h1:25ZALhydMFaBRgPH58a8zpFe9YXMAMjOYWtB6pNPcoo= +github.com/golang/protobuf/v2 v2.0.0-20190409211845-4ec39c766335 h1:dtT6y87fe34KJUI0FyKXi08Y1XZIU5NgxDl6yojsYdI= +github.com/golang/protobuf/v2 v2.0.0-20190409211845-4ec39c766335/go.mod h1:baUT2weUsA1MR7ocRtLXLmi2B1s4VrUT3S6tO8AYzMw= github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42 h1:q3pnF5JFBNRz8sRD+IRj7Y6DMyYGTNqnZ9axTbSfoNI= github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= diff --git a/internal/proto/common.go b/internal/proto/common.go index 93f5178408..8cc0df26b2 100644 --- a/internal/proto/common.go +++ b/internal/proto/common.go @@ -9,6 +9,9 @@ package proto // that they would otherwise be able to call directly. import ( + "fmt" + "reflect" + "github.com/golang/protobuf/v2/runtime/protoiface" _ "github.com/golang/protobuf/v2/runtime/protolegacy" ) @@ -17,3 +20,54 @@ type ( Message = protoiface.MessageV1 ExtensionDesc = protoiface.ExtensionDescV1 ) + +// RequiredNotSetError is an error type returned by either Marshal or Unmarshal. +// Marshal reports this when a required field is not initialized. +// Unmarshal reports this when a required field is missing from the input data. +type RequiredNotSetError struct{ field string } + +func (e *RequiredNotSetError) Error() string { + if e.field == "" { + return fmt.Sprintf("proto: required field not set") + } + return fmt.Sprintf("proto: required field %q not set", e.field) +} +func (e *RequiredNotSetError) RequiredNotSet() bool { + return true +} + +type errorMask uint8 + +const ( + _ errorMask = (1 << iota) / 2 + errInvalidUTF8 + errRequiredNotSet +) + +type errorsList = []error + +var errorsListType = reflect.TypeOf(errorsList{}) + +// nonFatalErrors returns an errorMask identifying V2 non-fatal errors. +func nonFatalErrors(err error) errorMask { + verr := reflect.ValueOf(err) + if !verr.IsValid() { + return 0 + } + + if !verr.Type().AssignableTo(errorsListType) { + return 0 + } + + errs := verr.Convert(errorsListType).Interface().(errorsList) + var ret errorMask + for _, e := range errs { + switch e.(type) { + case interface{ RequiredNotSet() bool }: + ret |= errRequiredNotSet + case interface{ InvalidUTF8() bool }: + ret |= errInvalidUTF8 + } + } + return ret +} diff --git a/internal/proto/common_test.go b/internal/proto/common_test.go new file mode 100644 index 0000000000..b6e623f658 --- /dev/null +++ b/internal/proto/common_test.go @@ -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 ( + "errors" + "testing" +) + +type testErrorList []error + +func (e testErrorList) Error() string { + return "testErrorList" +} + +type invalidUTF8Error struct{} + +func (e invalidUTF8Error) Error() string { return "" } +func (e invalidUTF8Error) InvalidUTF8() bool { return true } + +type requiredNotSetError struct{} + +func (e requiredNotSetError) Error() string { return "" } +func (e requiredNotSetError) RequiredNotSet() bool { return true } + +func TestNonFatalErrors(t *testing.T) { + tests := []struct { + input error + want errorMask + }{{ + input: errors.New("not one of them"), + }, { + input: testErrorList{}, + }, { + input: testErrorList{ + invalidUTF8Error{}, + }, + want: errInvalidUTF8, + }, { + input: testErrorList{ + requiredNotSetError{}, + }, + want: errRequiredNotSet, + }, { + input: testErrorList{ + invalidUTF8Error{}, + requiredNotSetError{}, + }, + want: errInvalidUTF8 | errRequiredNotSet, + }} + + for _, tc := range tests { + tc := tc + t.Run("", func(t *testing.T) { + got := nonFatalErrors(tc.input) + if got != tc.want { + t.Errorf("got %v, want %v", got, tc.want) + } + }) + } +} diff --git a/internal/proto/text.go b/internal/proto/text.go new file mode 100644 index 0000000000..4cc0011cda --- /dev/null +++ b/internal/proto/text.go @@ -0,0 +1,116 @@ +// 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 + +// Functions for writing the text protocol buffer format. + +import ( + "bytes" + "encoding" + "io" + "reflect" + + "github.com/golang/protobuf/v2/encoding/textpb" + preg "github.com/golang/protobuf/v2/reflect/protoregistry" + "github.com/golang/protobuf/v2/runtime/protoimpl" +) + +// TextMarshaler is a configurable text format marshaler. +type TextMarshaler struct { + Compact bool // use compact text format in one line without the trailing newline character + ExpandAny bool // expand google.protobuf.Any messages of known types +} + +// Marshal writes a given protocol buffer in text format. +func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { + val := reflect.ValueOf(pb) + // V1 supports passing in nil interface or pointer and outputs , while + // V2 will panic on nil interface and outputs nothing for nil pointer. + if pb == nil || val.IsNil() { + w.Write([]byte("")) + return nil + } + + // V1-specific override in marshaling. + if etm, ok := pb.(encoding.TextMarshaler); ok { + text, err := etm.MarshalText() + if err != nil { + return err + } + if _, err = w.Write(text); err != nil { + return err + } + return nil + } + + var ind string + if !tm.Compact { + ind = " " + } + mo := textpb.MarshalOptions{ + AllowPartial: true, + Indent: ind, + } + if !tm.ExpandAny { + mo.Resolver = emptyResolver + } + b, err := mo.Marshal(protoimpl.X.MessageOf(pb).Interface()) + mask := nonFatalErrors(err) + // V1 does not return invalid UTF-8 error. + if err != nil && mask&errInvalidUTF8 == 0 { + return err + } + if _, err := w.Write(b); err != nil { + return err + } + return nil +} + +// Text is the same as Marshal, but returns the string directly. +func (tm *TextMarshaler) Text(pb Message) string { + var buf bytes.Buffer + tm.Marshal(&buf, pb) + return buf.String() +} + +var ( + emptyResolver = preg.NewTypes() + defaultTextMarshaler = TextMarshaler{} + compactTextMarshaler = TextMarshaler{Compact: true} +) + +// MarshalText writes a given protocol buffer in text format. +func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } + +// MarshalTextString is the same as MarshalText, but returns the string directly. +func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } + +// CompactText writes a given protocol buffer in compact text format (one line). +func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } + +// CompactTextString is the same as CompactText, but returns the string directly. +func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } + +// UnmarshalText reads a protocol buffer in text format. UnmarshalText resets pb +// before starting to unmarshal, so any existing data in pb is always removed. +// If a required field is not set and no other error occurs, UnmarshalText +// returns *RequiredNotSetError. +func UnmarshalText(s string, m Message) error { + if um, ok := m.(encoding.TextUnmarshaler); ok { + return um.UnmarshalText([]byte(s)) + } + err := textpb.Unmarshal(protoimpl.X.MessageOf(m).Interface(), []byte(s)) + // Return RequiredNotSetError for required not set errors and ignore invalid + // UTF-8 errors. + mask := nonFatalErrors(err) + if mask&errRequiredNotSet > 0 { + return &RequiredNotSetError{} + } + if mask&errInvalidUTF8 > 0 { + return nil + } + // Otherwise return error which can either be nil or fatal. + return err +} diff --git a/proto/all_test.go b/proto/all_test.go index a16c05613d..ad586f6484 100644 --- a/proto/all_test.go +++ b/proto/all_test.go @@ -179,6 +179,15 @@ func overify(t *testing.T, pb *GoTest, expected string) { } } +// When hooks are enabled, RequiredNotSetError is typed alias to internal/proto +// package. Binary serialization has not been wrapped yet and hence produces +// requiredNotSetError instead. This function is a work-around to identify both +// aliased and non-aliased types. +func isRequiredNotSetError(err error) bool { + e, ok := err.(interface{ RequiredNotSet() bool }) + return ok && e.RequiredNotSet() +} + // Simple tests for numeric encode/decode primitives (varint, etc.) func TestNumericPrimitives(t *testing.T) { for i := uint64(0); i < 1e6; i += 111 { @@ -1249,7 +1258,7 @@ func TestRequiredFieldEnforcement(t *testing.T) { _, err := Marshal(pb) if err == nil { t.Error("marshal: expected error, got nil") - } else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Label") { + } else if !isRequiredNotSetError(err) { t.Errorf("marshal: bad error type: %v", err) } @@ -1260,7 +1269,7 @@ func TestRequiredFieldEnforcement(t *testing.T) { err = Unmarshal(buf, pb) if err == nil { t.Error("unmarshal: expected error, got nil") - } else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Type") && !strings.Contains(err.Error(), "{Unknown}") { + } else if !isRequiredNotSetError(err) { // TODO: remove unknown cases once we commit to the new unmarshaler. t.Errorf("unmarshal: bad error type: %v", err) } @@ -1271,14 +1280,14 @@ func TestRequiredFieldEnforcementGroups(t *testing.T) { pb := &GoTestRequiredGroupField{Group: &GoTestRequiredGroupField_Group{}} if _, err := Marshal(pb); err == nil { t.Error("marshal: expected error, got nil") - } else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Group.Field") { + } else if !isRequiredNotSetError(err) { t.Errorf("marshal: bad error type: %v", err) } buf := []byte{11, 12} if err := Unmarshal(buf, pb); err == nil { t.Error("unmarshal: expected error, got nil") - } else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Group.Field") && !strings.Contains(err.Error(), "Group.{Unknown}") { + } else if !isRequiredNotSetError(err) { t.Errorf("unmarshal: bad error type: %v", err) } } @@ -1837,7 +1846,7 @@ func TestRequiredNotSetError(t *testing.T) { o := old() bytes, err := Marshal(pb) - if _, ok := err.(*RequiredNotSetError); !ok { + if !isRequiredNotSetError(err) { fmt.Printf("marshal-1 err = %v, want *RequiredNotSetError", err) o.DebugPrint("", bytes) t.Fatalf("expected = %s", expected) @@ -1853,7 +1862,7 @@ func TestRequiredNotSetError(t *testing.T) { // Now test Unmarshal by recreating the original buffer. pbd := new(GoTest) err = Unmarshal(bytes, pbd) - if _, ok := err.(*RequiredNotSetError); !ok { + if !isRequiredNotSetError(err) { t.Fatalf("unmarshal err = %v, want *RequiredNotSetError", err) o.DebugPrint("", bytes) t.Fatalf("string = %s", expected) @@ -1862,7 +1871,7 @@ func TestRequiredNotSetError(t *testing.T) { t.Errorf("unmarshal wrong err msg: %v", err) } bytes, err = Marshal(pbd) - if _, ok := err.(*RequiredNotSetError); !ok { + if !isRequiredNotSetError(err) { t.Errorf("marshal-2 err = %v, want *RequiredNotSetError", err) o.DebugPrint("", bytes) t.Fatalf("string = %s", expected) @@ -2302,7 +2311,7 @@ func TestRequired(t *testing.T) { // It should still be handled even after multiple required field violations. m := &GoTest{F_BoolRequired: Bool(true)} got, err := Marshal(m) - if _, ok := err.(*RequiredNotSetError); !ok { + if !isRequiredNotSetError(err) { t.Errorf("Marshal() = %v, want RequiredNotSetError error", err) } if want := []byte{0x50, 0x01}; !bytes.Equal(got, want) { @@ -2311,7 +2320,7 @@ func TestRequired(t *testing.T) { m = new(GoTest) err = Unmarshal(got, m) - if _, ok := err.(*RequiredNotSetError); !ok { + if !isRequiredNotSetError(err) { t.Errorf("Marshal() = %v, want RequiredNotSetError error", err) } if !m.GetF_BoolRequired() { diff --git a/proto/any_test.go b/proto/any_test.go deleted file mode 100644 index 69e497dbad..0000000000 --- a/proto/any_test.go +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright 2016 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_test - -import ( - "strings" - "testing" - - "github.com/golang/protobuf/proto" - - pb "github.com/golang/protobuf/proto/proto3_proto" - testpb "github.com/golang/protobuf/proto/test_proto" - anypb "github.com/golang/protobuf/ptypes/any" -) - -var ( - expandedMarshaler = proto.TextMarshaler{ExpandAny: true} - expandedCompactMarshaler = proto.TextMarshaler{Compact: true, ExpandAny: true} -) - -// anyEqual reports whether two messages which may be google.protobuf.Any or may -// contain google.protobuf.Any fields are equal. We can't use proto.Equal for -// comparison, because semantically equivalent messages may be marshaled to -// binary in different tag order. Instead, trust that TextMarshaler with -// ExpandAny option works and compare the text marshaling results. -func anyEqual(got, want proto.Message) bool { - // if messages are proto.Equal, no need to marshal. - if proto.Equal(got, want) { - return true - } - g := expandedMarshaler.Text(got) - w := expandedMarshaler.Text(want) - return g == w -} - -type golden struct { - m proto.Message - t, c string -} - -var goldenMessages = makeGolden() - -func makeGolden() []golden { - nested := &pb.Nested{Bunny: "Monty"} - nb, err := proto.Marshal(nested) - if err != nil { - panic(err) - } - m1 := &pb.Message{ - Name: "David", - ResultCount: 47, - Anything: &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(nested), Value: nb}, - } - m2 := &pb.Message{ - Name: "David", - ResultCount: 47, - Anything: &anypb.Any{TypeUrl: "http://[::1]/type.googleapis.com/" + proto.MessageName(nested), Value: nb}, - } - m3 := &pb.Message{ - Name: "David", - ResultCount: 47, - Anything: &anypb.Any{TypeUrl: `type.googleapis.com/"/` + proto.MessageName(nested), Value: nb}, - } - m4 := &pb.Message{ - Name: "David", - ResultCount: 47, - Anything: &anypb.Any{TypeUrl: "type.googleapis.com/a/path/" + proto.MessageName(nested), Value: nb}, - } - m5 := &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(nested), Value: nb} - - any1 := &testpb.MyMessage{Count: proto.Int32(47), Name: proto.String("David")} - proto.SetExtension(any1, testpb.E_Ext_More, &testpb.Ext{Data: proto.String("foo")}) - proto.SetExtension(any1, testpb.E_Ext_Text, proto.String("bar")) - any1b, err := proto.Marshal(any1) - if err != nil { - panic(err) - } - any2 := &testpb.MyMessage{Count: proto.Int32(42), Bikeshed: testpb.MyMessage_GREEN.Enum(), RepBytes: [][]byte{[]byte("roboto")}} - proto.SetExtension(any2, testpb.E_Ext_More, &testpb.Ext{Data: proto.String("baz")}) - any2b, err := proto.Marshal(any2) - if err != nil { - panic(err) - } - m6 := &pb.Message{ - Name: "David", - ResultCount: 47, - Anything: &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any1), Value: any1b}, - ManyThings: []*anypb.Any{ - &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any2), Value: any2b}, - &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any1), Value: any1b}, - }, - } - - const ( - m1Golden = ` -name: "David" -result_count: 47 -anything: < - [type.googleapis.com/proto3_proto.Nested]: < - bunny: "Monty" - > -> -` - m2Golden = ` -name: "David" -result_count: 47 -anything: < - ["http://[::1]/type.googleapis.com/proto3_proto.Nested"]: < - bunny: "Monty" - > -> -` - m3Golden = ` -name: "David" -result_count: 47 -anything: < - ["type.googleapis.com/\"/proto3_proto.Nested"]: < - bunny: "Monty" - > -> -` - m4Golden = ` -name: "David" -result_count: 47 -anything: < - [type.googleapis.com/a/path/proto3_proto.Nested]: < - bunny: "Monty" - > -> -` - m5Golden = ` -[type.googleapis.com/proto3_proto.Nested]: < - bunny: "Monty" -> -` - m6Golden = ` -name: "David" -result_count: 47 -anything: < - [type.googleapis.com/test_proto.MyMessage]: < - count: 47 - name: "David" - [test_proto.Ext.more]: < - data: "foo" - > - [test_proto.Ext.text]: "bar" - > -> -many_things: < - [type.googleapis.com/test_proto.MyMessage]: < - count: 42 - bikeshed: GREEN - rep_bytes: "roboto" - [test_proto.Ext.more]: < - data: "baz" - > - > -> -many_things: < - [type.googleapis.com/test_proto.MyMessage]: < - count: 47 - name: "David" - [test_proto.Ext.more]: < - data: "foo" - > - [test_proto.Ext.text]: "bar" - > -> -` - ) - return []golden{ - {m1, strings.TrimSpace(m1Golden) + "\n", strings.TrimSpace(compact(m1Golden)) + " "}, - {m2, strings.TrimSpace(m2Golden) + "\n", strings.TrimSpace(compact(m2Golden)) + " "}, - {m3, strings.TrimSpace(m3Golden) + "\n", strings.TrimSpace(compact(m3Golden)) + " "}, - {m4, strings.TrimSpace(m4Golden) + "\n", strings.TrimSpace(compact(m4Golden)) + " "}, - {m5, strings.TrimSpace(m5Golden) + "\n", strings.TrimSpace(compact(m5Golden)) + " "}, - {m6, strings.TrimSpace(m6Golden) + "\n", strings.TrimSpace(compact(m6Golden)) + " "}, - } -} - -func TestMarshalGolden(t *testing.T) { - for _, tt := range goldenMessages { - if got, want := expandedMarshaler.Text(tt.m), tt.t; got != want { - t.Errorf("message %v: got:\n%s\nwant:\n%s", tt.m, got, want) - } - if got, want := expandedCompactMarshaler.Text(tt.m), tt.c; got != want { - t.Errorf("message %v: got:\n`%s`\nwant:\n`%s`", tt.m, got, want) - } - } -} - -func TestUnmarshalGolden(t *testing.T) { - for _, tt := range goldenMessages { - want := tt.m - got := proto.Clone(tt.m) - got.Reset() - if err := proto.UnmarshalText(tt.t, got); err != nil { - t.Errorf("failed to unmarshal\n%s\nerror: %v", tt.t, err) - } - if !anyEqual(got, want) { - t.Errorf("message:\n%s\ngot:\n%s\nwant:\n%s", tt.t, got, want) - } - got.Reset() - if err := proto.UnmarshalText(tt.c, got); err != nil { - t.Errorf("failed to unmarshal\n%s\nerror: %v", tt.c, err) - } - if !anyEqual(got, want) { - t.Errorf("message:\n%s\ngot:\n%s\nwant:\n%s", tt.c, got, want) - } - } -} - -func TestMarshalUnknownAny(t *testing.T) { - m := &pb.Message{ - Anything: &anypb.Any{ - TypeUrl: "foo", - Value: []byte("bar"), - }, - } - want := `anything: < - type_url: "foo" - value: "bar" -> -` - got := expandedMarshaler.Text(m) - if got != want { - t.Errorf("got\n`%s`\nwant\n`%s`", got, want) - } -} - -func TestAmbiguousAny(t *testing.T) { - pb := &anypb.Any{} - err := proto.UnmarshalText(` - type_url: "ttt/proto3_proto.Nested" - value: "\n\x05Monty" - `, pb) - t.Logf("result: %v (error: %v)", expandedMarshaler.Text(pb), err) - if err != nil { - t.Errorf("failed to parse ambiguous Any message: %v", err) - } -} - -func TestUnmarshalOverwriteAny(t *testing.T) { - pb := &anypb.Any{} - err := proto.UnmarshalText(` - [type.googleapis.com/a/path/proto3_proto.Nested]: < - bunny: "Monty" - > - [type.googleapis.com/a/path/proto3_proto.Nested]: < - bunny: "Rabbit of Caerbannog" - > - `, pb) - want := `line 7: Any message unpacked multiple times, or "type_url" already set` - if err.Error() != want { - t.Errorf("incorrect error.\nHave: %v\nWant: %v", err.Error(), want) - } -} - -func TestUnmarshalAnyMixAndMatch(t *testing.T) { - pb := &anypb.Any{} - err := proto.UnmarshalText(` - value: "\n\x05Monty" - [type.googleapis.com/a/path/proto3_proto.Nested]: < - bunny: "Rabbit of Caerbannog" - > - `, pb) - want := `line 5: Any message unpacked multiple times, or "value" already set` - if err.Error() != want { - t.Errorf("incorrect error.\nHave: %v\nWant: %v", err.Error(), want) - } -} diff --git a/proto/hooks_disabled.go b/proto/hooks_disabled.go index b604f816c3..96e9b34a26 100644 --- a/proto/hooks_disabled.go +++ b/proto/hooks_disabled.go @@ -7,9 +7,11 @@ package proto import ( + "io" "reflect" descriptorpb "github.com/golang/protobuf/v2/types/descriptor" + knownpb "github.com/golang/protobuf/v2/types/known" ) var ( @@ -30,8 +32,23 @@ var ( fileDescriptorAlt func(string) []byte registerExtensionAlt func(*ExtensionDesc) registeredExtensionsAlt func(Message) map[int32]*ExtensionDesc + + // Hooks for text.go + marshalTextAlt func(io.Writer, Message) error + marshalTextStringAlt func(Message) string + compactTextAlt func(io.Writer, Message) error + compactTextStringAlt func(Message) string + + // Hooks for text_parser.go + unmarshalTextAlt func(string, Message) error ) +// Hooks for lib.go. +type RequiredNotSetError = requiredNotSetError + +// Hooks for text.go +type TextMarshaler = textMarshaler + // The v2 descriptor no longer registers with v1. // If we're only relying on the v1 registry, we need to manually register the // types in descriptor. @@ -73,4 +90,54 @@ func init() { RegisterType((*descriptorpb.UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") RegisterType((*descriptorpb.SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") RegisterType((*descriptorpb.GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") + + // any.proto + RegisterType((*knownpb.Any)(nil), "google.protobuf.Any") + + // api.proto + RegisterType((*knownpb.Api)(nil), "google.protobuf.Api") + RegisterType((*knownpb.Method)(nil), "google.protobuf.Method") + RegisterType((*knownpb.Mixin)(nil), "google.protobuf.Mixin") + + // duration.proto + RegisterType((*knownpb.Duration)(nil), "google.protobuf.Duration") + + // empty.proto + RegisterType((*knownpb.Empty)(nil), "google.protobuf.Empty") + + // field_mask.proto + RegisterType((*knownpb.FieldMask)(nil), "google.protobuf.FieldMask") + + // source_context.proto + RegisterType((*knownpb.SourceContext)(nil), "google.protobuf.SourceContext") + + // struct.proto + RegisterEnum("google.protobuf.NullValue", knownpb.NullValue_name, knownpb.NullValue_value) + RegisterType((*knownpb.Struct)(nil), "google.protobuf.Struct") + RegisterType((*knownpb.Value)(nil), "google.protobuf.Value") + RegisterType((*knownpb.ListValue)(nil), "google.protobuf.ListValue") + + // timestamp.proto + RegisterType((*knownpb.Timestamp)(nil), "google.protobuf.Timestamp") + + // type.proto + RegisterEnum("google.protobuf.Syntax", knownpb.Syntax_name, knownpb.Syntax_value) + RegisterEnum("google.protobuf.Field_Kind", knownpb.Field_Kind_name, knownpb.Field_Kind_value) + RegisterEnum("google.protobuf.Field_Cardinality", knownpb.Field_Cardinality_name, knownpb.Field_Cardinality_value) + RegisterType((*knownpb.Type)(nil), "google.protobuf.Type") + RegisterType((*knownpb.Field)(nil), "google.protobuf.Field") + RegisterType((*knownpb.Enum)(nil), "google.protobuf.Enum") + RegisterType((*knownpb.EnumValue)(nil), "google.protobuf.EnumValue") + RegisterType((*knownpb.Option)(nil), "google.protobuf.Option") + + // wrapper.proto + RegisterType((*knownpb.DoubleValue)(nil), "google.protobuf.DoubleValue") + RegisterType((*knownpb.FloatValue)(nil), "google.protobuf.FloatValue") + RegisterType((*knownpb.Int64Value)(nil), "google.protobuf.Int64Value") + RegisterType((*knownpb.UInt64Value)(nil), "google.protobuf.UInt64Value") + RegisterType((*knownpb.Int32Value)(nil), "google.protobuf.Int32Value") + RegisterType((*knownpb.UInt32Value)(nil), "google.protobuf.UInt32Value") + RegisterType((*knownpb.BoolValue)(nil), "google.protobuf.BoolValue") + RegisterType((*knownpb.StringValue)(nil), "google.protobuf.StringValue") + RegisterType((*knownpb.BytesValue)(nil), "google.protobuf.BytesValue") } diff --git a/proto/hooks_enabled.go b/proto/hooks_enabled.go index 1c6e97f5b8..67f3b01111 100644 --- a/proto/hooks_enabled.go +++ b/proto/hooks_enabled.go @@ -28,4 +28,19 @@ var ( fileDescriptorAlt = proto.FileDescriptor registerExtensionAlt = proto.RegisterExtension registeredExtensionsAlt = proto.RegisteredExtensions + + // Hooks for text.go + marshalTextAlt = proto.MarshalText + marshalTextStringAlt = proto.MarshalTextString + compactTextAlt = proto.CompactText + compactTextStringAlt = proto.CompactTextString + + // Hooks for text_parser.go + unmarshalTextAlt = proto.UnmarshalText ) + +// Hooks for lib.go. +type RequiredNotSetError = proto.RequiredNotSetError + +// Hooks for text.go +type TextMarshaler = proto.TextMarshaler diff --git a/proto/lib.go b/proto/lib.go index e82e1386f1..77c596a32d 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -34,18 +34,18 @@ type extensionFields = interface { sync.Locker } -// RequiredNotSetError is an error type returned by either Marshal or Unmarshal. +// requiredNotSetError is an error type returned by either Marshal or Unmarshal. // Marshal reports this when a required field is not initialized. // Unmarshal reports this when a required field is missing from the wire data. -type RequiredNotSetError struct{ field string } +type requiredNotSetError struct{ field string } -func (e *RequiredNotSetError) Error() string { +func (e *requiredNotSetError) Error() string { if e.field == "" { return fmt.Sprintf("proto: required field not set") } return fmt.Sprintf("proto: required field %q not set", e.field) } -func (e *RequiredNotSetError) RequiredNotSet() bool { +func (e *requiredNotSetError) RequiredNotSet() bool { return true } diff --git a/proto/table_marshal.go b/proto/table_marshal.go index 303c1eaf94..7ec867e711 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -234,7 +234,7 @@ func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte // Required field is not set. // We record the error but keep going, to give a complete marshaling. if errLater == nil { - errLater = &RequiredNotSetError{f.name} + errLater = &requiredNotSetError{f.name} } continue } @@ -245,11 +245,11 @@ func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte } b, err = f.marshaler(b, ptr.offset(f.field), f.wiretag, deterministic) if err != nil { - if err1, ok := err.(*RequiredNotSetError); ok { + if err1, ok := err.(*requiredNotSetError); ok { // Required field in submessage is not set. // We record the error but keep going, to give a complete marshaling. if errLater == nil { - errLater = &RequiredNotSetError{f.name + "." + err1.field} + errLater = &requiredNotSetError{f.name + "." + err1.field} } continue } diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index ae4395fbb0..87d3da7031 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -151,7 +151,7 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { reqMask |= f.reqMask continue } - if r, ok := err.(*RequiredNotSetError); ok { + if r, ok := err.(*requiredNotSetError); ok { // Remember this error, but keep parsing. We need to produce // a full parse even if a required field is missing. if errLater == nil { @@ -227,7 +227,7 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { // A required field of this message is missing. for _, n := range u.reqFields { if reqMask&1 == 0 { - errLater = &RequiredNotSetError{n} + errLater = &requiredNotSetError{n} } reqMask >>= 1 } @@ -1618,7 +1618,7 @@ func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler { } err := sub.unmarshal(v, b[:x]) if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { + if r, ok := err.(*requiredNotSetError); ok { r.field = name + "." + r.field } else { return nil, err @@ -1644,7 +1644,7 @@ func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler { v := valToPointer(reflect.New(sub.typ)) err := sub.unmarshal(v, b[:x]) if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { + if r, ok := err.(*requiredNotSetError); ok { r.field = name + "." + r.field } else { return nil, err @@ -1671,7 +1671,7 @@ func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler { } err := sub.unmarshal(v, b[:x]) if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { + if r, ok := err.(*requiredNotSetError); ok { r.field = name + "." + r.field } else { return nil, err @@ -1693,7 +1693,7 @@ func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler { v := valToPointer(reflect.New(sub.typ)) err := sub.unmarshal(v, b[:x]) if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { + if r, ok := err.(*requiredNotSetError); ok { r.field = name + "." + r.field } else { return nil, err diff --git a/proto/text.go b/proto/text.go index dfd3e92df3..647e10fe12 100644 --- a/proto/text.go +++ b/proto/text.go @@ -179,7 +179,7 @@ func isAny(sv reflect.Value) bool { // // It returns (true, error) when sv was written in expanded format or an error // was encountered. -func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { +func (tm *textMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { turl := sv.FieldByName("TypeUrl") val := sv.FieldByName("Value") if !turl.IsValid() || !val.IsValid() { @@ -225,7 +225,7 @@ func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, return true, nil } -func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { +func (tm *textMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { if tm.ExpandAny && isAny(sv) { if canExpand, err := tm.writeProto3Any(w, sv); canExpand { return err @@ -432,7 +432,7 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { } // writeAny writes an arbitrary field. -func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { +func (tm *textMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { v = reflect.Indirect(v) // Floats have special cases. @@ -651,7 +651,7 @@ func (s fieldNumSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } // writeExtensions writes all the extensions in pv. // pv is assumed to be a pointer to a protocol message struct that is extendable. -func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { +func (tm *textMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { emap := RegisteredExtensions(pv.Interface().(Message)) ep, _ := extendable(pv.Interface()) @@ -706,7 +706,7 @@ func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error return nil } -func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { +func (tm *textMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil { return err } @@ -740,15 +740,15 @@ func (w *textWriter) writeIndent() { w.complete = false } -// TextMarshaler is a configurable text format marshaler. -type TextMarshaler struct { +// textMarshaler is a configurable text format marshaler. +type textMarshaler struct { Compact bool // use compact text format (one line). ExpandAny bool // expand google.protobuf.Any messages of known types } // Marshal writes a given protocol buffer in text format. // The only errors returned are from w. -func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { +func (tm *textMarshaler) Marshal(w io.Writer, pb Message) error { val := reflect.ValueOf(pb) if pb == nil || val.IsNil() { w.Write([]byte("")) @@ -791,28 +791,48 @@ func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { } // Text is the same as Marshal, but returns the string directly. -func (tm *TextMarshaler) Text(pb Message) string { +func (tm *textMarshaler) Text(pb Message) string { var buf bytes.Buffer tm.Marshal(&buf, pb) return buf.String() } var ( - defaultTextMarshaler = TextMarshaler{} - compactTextMarshaler = TextMarshaler{Compact: true} + defaultTextMarshaler = textMarshaler{} + compactTextMarshaler = textMarshaler{Compact: true} ) // TODO: consider removing some of the Marshal functions below. // MarshalText writes a given protocol buffer in text format. // The only errors returned are from w. -func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } +func MarshalText(w io.Writer, pb Message) error { + if marshalTextAlt != nil { + return marshalTextAlt(w, pb) + } + return defaultTextMarshaler.Marshal(w, pb) +} // MarshalTextString is the same as MarshalText, but returns the string directly. -func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } +func MarshalTextString(pb Message) string { + if marshalTextStringAlt != nil { + return marshalTextStringAlt(pb) + } + return defaultTextMarshaler.Text(pb) +} // CompactText writes a given protocol buffer in compact text format (one line). -func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } +func CompactText(w io.Writer, pb Message) error { + if compactTextAlt != nil { + return compactTextAlt(w, pb) + } + return compactTextMarshaler.Marshal(w, pb) +} // CompactTextString is the same as CompactText, but returns the string directly. -func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } +func CompactTextString(pb Message) string { + if compactTextStringAlt != nil { + return compactTextStringAlt(pb) + } + return compactTextMarshaler.Text(pb) +} diff --git a/proto/text_parser.go b/proto/text_parser.go index 96a7833243..443f62707e 100644 --- a/proto/text_parser.go +++ b/proto/text_parser.go @@ -338,8 +338,8 @@ func (p *textParser) consumeToken(s string) error { return nil } -// Return a RequiredNotSetError indicating which required field was not set. -func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError { +// Return a requiredNotSetError indicating which required field was not set. +func (p *textParser) missingRequiredFieldError(sv reflect.Value) *requiredNotSetError { st := sv.Type() sprops := GetProperties(st) for i := 0; i < st.NumField(); i++ { @@ -349,10 +349,10 @@ func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSet props := sprops.Prop[i] if props.Required { - return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} + return &requiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} } } - return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen + return &requiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen } // Returns the index in the struct for the named field, as well as the parsed tag properties. @@ -549,7 +549,7 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) error { ext = reflect.New(typ.Elem()).Elem() } if err := p.readAny(ext, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { + if _, ok := err.(*requiredNotSetError); !ok { return err } reqFieldErr = err @@ -675,7 +675,7 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) error { // Parse into the field. fieldSet[name] = true if err := p.readAny(dst, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { + if _, ok := err.(*requiredNotSetError); !ok { return err } reqFieldErr = err @@ -876,8 +876,11 @@ func (p *textParser) readAny(v reflect.Value, props *Properties) error { // UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb // before starting to unmarshal, so any existing data in pb is always removed. // If a required field is not set and no other error occurs, -// UnmarshalText returns *RequiredNotSetError. +// UnmarshalText returns *requiredNotSetError. func UnmarshalText(s string, pb Message) error { + if unmarshalTextAlt != nil { + return unmarshalTextAlt(s, pb) // populated by hooks_enabled.go + } if um, ok := pb.(encoding.TextUnmarshaler); ok { return um.UnmarshalText([]byte(s)) } diff --git a/proto/text_parser_test.go b/proto/text_parser_test.go deleted file mode 100644 index e0a89272c8..0000000000 --- a/proto/text_parser_test.go +++ /dev/null @@ -1,679 +0,0 @@ -// 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_test - -import ( - "fmt" - "math" - "testing" - - . "github.com/golang/protobuf/proto" - proto3pb "github.com/golang/protobuf/proto/proto3_proto" - . "github.com/golang/protobuf/proto/test_proto" -) - -type UnmarshalTextTest struct { - in string - err string // if "", no error expected - out *MyMessage -} - -func buildExtStructTest(text string) UnmarshalTextTest { - msg := &MyMessage{ - Count: Int32(42), - } - SetExtension(msg, E_Ext_More, &Ext{ - Data: String("Hello, world!"), - }) - return UnmarshalTextTest{in: text, out: msg} -} - -func buildExtDataTest(text string) UnmarshalTextTest { - msg := &MyMessage{ - Count: Int32(42), - } - SetExtension(msg, E_Ext_Text, String("Hello, world!")) - SetExtension(msg, E_Ext_Number, Int32(1729)) - return UnmarshalTextTest{in: text, out: msg} -} - -func buildExtRepStringTest(text string) UnmarshalTextTest { - msg := &MyMessage{ - Count: Int32(42), - } - if err := SetExtension(msg, E_Greeting, []string{"bula", "hola"}); err != nil { - panic(err) - } - return UnmarshalTextTest{in: text, out: msg} -} - -var unMarshalTextTests = []UnmarshalTextTest{ - // Basic - { - in: " count:42\n name:\"Dave\" ", - out: &MyMessage{ - Count: Int32(42), - Name: String("Dave"), - }, - }, - - // Empty quoted string - { - in: `count:42 name:""`, - out: &MyMessage{ - Count: Int32(42), - Name: String(""), - }, - }, - - // Quoted string concatenation with double quotes - { - in: `count:42 name: "My name is "` + "\n" + `"elsewhere"`, - out: &MyMessage{ - Count: Int32(42), - Name: String("My name is elsewhere"), - }, - }, - - // Quoted string concatenation with single quotes - { - in: "count:42 name: 'My name is '\n'elsewhere'", - out: &MyMessage{ - Count: Int32(42), - Name: String("My name is elsewhere"), - }, - }, - - // Quoted string concatenations with mixed quotes - { - in: "count:42 name: 'My name is '\n\"elsewhere\"", - out: &MyMessage{ - Count: Int32(42), - Name: String("My name is elsewhere"), - }, - }, - { - in: "count:42 name: \"My name is \"\n'elsewhere'", - out: &MyMessage{ - Count: Int32(42), - Name: String("My name is elsewhere"), - }, - }, - - // Quoted string with escaped apostrophe - { - in: `count:42 name: "HOLIDAY - New Year\'s Day"`, - out: &MyMessage{ - Count: Int32(42), - Name: String("HOLIDAY - New Year's Day"), - }, - }, - - // Quoted string with single quote - { - in: `count:42 name: 'Roger "The Ramster" Ramjet'`, - out: &MyMessage{ - Count: Int32(42), - Name: String(`Roger "The Ramster" Ramjet`), - }, - }, - - // Quoted string with all the accepted special characters from the C++ test - { - in: `count:42 name: ` + "\"\\\"A string with \\' characters \\n and \\r newlines and \\t tabs and \\001 slashes \\\\ and multiple spaces\"", - out: &MyMessage{ - Count: Int32(42), - Name: String("\"A string with ' characters \n and \r newlines and \t tabs and \001 slashes \\ and multiple spaces"), - }, - }, - - // Quoted string with quoted backslash - { - in: `count:42 name: "\\'xyz"`, - out: &MyMessage{ - Count: Int32(42), - Name: String(`\'xyz`), - }, - }, - - // Quoted string with UTF-8 bytes. - { - in: "count:42 name: '\303\277\302\201\x00\xAB\xCD\xEF'", - out: &MyMessage{ - Count: Int32(42), - Name: String("\303\277\302\201\x00\xAB\xCD\xEF"), - }, - }, - - // Quoted string with unicode escapes. - { - in: `count: 42 name: "\u0047\U00000047\uffff\U0010ffff"`, - out: &MyMessage{ - Count: Int32(42), - Name: String("GG\uffff\U0010ffff"), - }, - }, - - // Bad quoted string - { - in: `inner: < host: "\0" >` + "\n", - err: `line 1.15: invalid quoted string "\0": \0 requires 2 following digits`, - }, - - // Bad \u escape - { - in: `count: 42 name: "\u000"`, - err: `line 1.16: invalid quoted string "\u000": \u requires 4 following digits`, - }, - - // Bad \U escape - { - in: `count: 42 name: "\U0000000"`, - err: `line 1.16: invalid quoted string "\U0000000": \U requires 8 following digits`, - }, - - // Bad \U escape - { - in: `count: 42 name: "\xxx"`, - err: `line 1.16: invalid quoted string "\xxx": \xxx contains non-hexadecimal digits`, - }, - - // Number too large for int64 - { - in: "count: 1 others { key: 123456789012345678901 }", - err: "line 1.23: invalid int64: 123456789012345678901", - }, - - // Number too large for int32 - { - in: "count: 1234567890123", - err: "line 1.7: invalid int32: 1234567890123", - }, - - // Number in hexadecimal - { - in: "count: 0x2beef", - out: &MyMessage{ - Count: Int32(0x2beef), - }, - }, - - // Number in octal - { - in: "count: 024601", - out: &MyMessage{ - Count: Int32(024601), - }, - }, - - // Floating point number with "f" suffix - { - in: "count: 4 others:< weight: 17.0f >", - out: &MyMessage{ - Count: Int32(4), - Others: []*OtherMessage{ - { - Weight: Float32(17), - }, - }, - }, - }, - - // Floating point positive infinity - { - in: "count: 4 bigfloat: inf", - out: &MyMessage{ - Count: Int32(4), - Bigfloat: Float64(math.Inf(1)), - }, - }, - - // Floating point negative infinity - { - in: "count: 4 bigfloat: -inf", - out: &MyMessage{ - Count: Int32(4), - Bigfloat: Float64(math.Inf(-1)), - }, - }, - - // Number too large for float32 - { - in: "others:< weight: 12345678901234567890123456789012345678901234567890 >", - err: "line 1.17: invalid float32: 12345678901234567890123456789012345678901234567890", - }, - - // Number posing as a quoted string - { - in: `inner: < host: 12 >` + "\n", - err: `line 1.15: invalid string: 12`, - }, - - // Quoted string posing as int32 - { - in: `count: "12"`, - err: `line 1.7: invalid int32: "12"`, - }, - - // Quoted string posing a float32 - { - in: `others:< weight: "17.4" >`, - err: `line 1.17: invalid float32: "17.4"`, - }, - - // unclosed bracket doesn't cause infinite loop - { - in: `[`, - err: `line 1.0: unclosed type_url or extension name`, - }, - - // Enum - { - in: `count:42 bikeshed: BLUE`, - out: &MyMessage{ - Count: Int32(42), - Bikeshed: MyMessage_BLUE.Enum(), - }, - }, - - // Repeated field - { - in: `count:42 pet: "horsey" pet:"bunny"`, - out: &MyMessage{ - Count: Int32(42), - Pet: []string{"horsey", "bunny"}, - }, - }, - - // Repeated field with list notation - { - in: `count:42 pet: ["horsey", "bunny"]`, - out: &MyMessage{ - Count: Int32(42), - Pet: []string{"horsey", "bunny"}, - }, - }, - - // Repeated message with/without colon and <>/{} - { - in: `count:42 others:{} others{} others:<> others:{}`, - out: &MyMessage{ - Count: Int32(42), - Others: []*OtherMessage{ - {}, - {}, - {}, - {}, - }, - }, - }, - - // Missing colon for inner message - { - in: `count:42 inner < host: "cauchy.syd" >`, - out: &MyMessage{ - Count: Int32(42), - Inner: &InnerMessage{ - Host: String("cauchy.syd"), - }, - }, - }, - - // Missing colon for string field - { - in: `name "Dave"`, - err: `line 1.5: expected ':', found "\"Dave\""`, - }, - - // Missing colon for int32 field - { - in: `count 42`, - err: `line 1.6: expected ':', found "42"`, - }, - - // Missing required field - { - in: `name: "Pawel"`, - err: fmt.Sprintf(`proto: required field "%T.count" not set`, MyMessage{}), - out: &MyMessage{ - Name: String("Pawel"), - }, - }, - - // Missing required field in a required submessage - { - in: `count: 42 we_must_go_deeper < leo_finally_won_an_oscar <> >`, - err: fmt.Sprintf(`proto: required field "%T.host" not set`, InnerMessage{}), - out: &MyMessage{ - Count: Int32(42), - WeMustGoDeeper: &RequiredInnerMessage{LeoFinallyWonAnOscar: &InnerMessage{}}, - }, - }, - - // Repeated non-repeated field - { - in: `name: "Rob" name: "Russ"`, - err: `line 1.12: non-repeated field "name" was repeated`, - }, - - // Group - { - in: `count: 17 SomeGroup { group_field: 12 }`, - out: &MyMessage{ - Count: Int32(17), - Somegroup: &MyMessage_SomeGroup{ - GroupField: Int32(12), - }, - }, - }, - - // Semicolon between fields - { - in: `count:3;name:"Calvin"`, - out: &MyMessage{ - Count: Int32(3), - Name: String("Calvin"), - }, - }, - // Comma between fields - { - in: `count:4,name:"Ezekiel"`, - out: &MyMessage{ - Count: Int32(4), - Name: String("Ezekiel"), - }, - }, - - // Boolean false - { - in: `count:42 inner { host: "example.com" connected: false }`, - out: &MyMessage{ - Count: Int32(42), - Inner: &InnerMessage{ - Host: String("example.com"), - Connected: Bool(false), - }, - }, - }, - // Boolean true - { - in: `count:42 inner { host: "example.com" connected: true }`, - out: &MyMessage{ - Count: Int32(42), - Inner: &InnerMessage{ - Host: String("example.com"), - Connected: Bool(true), - }, - }, - }, - // Boolean 0 - { - in: `count:42 inner { host: "example.com" connected: 0 }`, - out: &MyMessage{ - Count: Int32(42), - Inner: &InnerMessage{ - Host: String("example.com"), - Connected: Bool(false), - }, - }, - }, - // Boolean 1 - { - in: `count:42 inner { host: "example.com" connected: 1 }`, - out: &MyMessage{ - Count: Int32(42), - Inner: &InnerMessage{ - Host: String("example.com"), - Connected: Bool(true), - }, - }, - }, - // Boolean f - { - in: `count:42 inner { host: "example.com" connected: f }`, - out: &MyMessage{ - Count: Int32(42), - Inner: &InnerMessage{ - Host: String("example.com"), - Connected: Bool(false), - }, - }, - }, - // Boolean t - { - in: `count:42 inner { host: "example.com" connected: t }`, - out: &MyMessage{ - Count: Int32(42), - Inner: &InnerMessage{ - Host: String("example.com"), - Connected: Bool(true), - }, - }, - }, - // Boolean False - { - in: `count:42 inner { host: "example.com" connected: False }`, - out: &MyMessage{ - Count: Int32(42), - Inner: &InnerMessage{ - Host: String("example.com"), - Connected: Bool(false), - }, - }, - }, - // Boolean True - { - in: `count:42 inner { host: "example.com" connected: True }`, - out: &MyMessage{ - Count: Int32(42), - Inner: &InnerMessage{ - Host: String("example.com"), - Connected: Bool(true), - }, - }, - }, - - // Extension - buildExtStructTest(`count: 42 [test_proto.Ext.more]:`), - buildExtStructTest(`count: 42 [test_proto.Ext.more] {data:"Hello, world!"}`), - buildExtDataTest(`count: 42 [test_proto.Ext.text]:"Hello, world!" [test_proto.Ext.number]:1729`), - buildExtRepStringTest(`count: 42 [test_proto.greeting]:"bula" [test_proto.greeting]:"hola"`), - - // Big all-in-one - { - in: "count:42 # Meaning\n" + - `name:"Dave" ` + - `quote:"\"I didn't want to go.\"" ` + - `pet:"bunny" ` + - `pet:"kitty" ` + - `pet:"horsey" ` + - `inner:<` + - ` host:"footrest.syd" ` + - ` port:7001 ` + - ` connected:true ` + - `> ` + - `others:<` + - ` key:3735928559 ` + - ` value:"\x01A\a\f" ` + - `> ` + - `others:<` + - " weight:58.9 # Atomic weight of Co\n" + - ` inner:<` + - ` host:"lesha.mtv" ` + - ` port:8002 ` + - ` >` + - `>`, - out: &MyMessage{ - Count: Int32(42), - Name: String("Dave"), - Quote: String(`"I didn't want to go."`), - Pet: []string{"bunny", "kitty", "horsey"}, - Inner: &InnerMessage{ - Host: String("footrest.syd"), - Port: Int32(7001), - Connected: Bool(true), - }, - Others: []*OtherMessage{ - { - Key: Int64(3735928559), - Value: []byte{0x1, 'A', '\a', '\f'}, - }, - { - Weight: Float32(58.9), - Inner: &InnerMessage{ - Host: String("lesha.mtv"), - Port: Int32(8002), - }, - }, - }, - }, - }, -} - -func TestUnmarshalText(t *testing.T) { - for i, test := range unMarshalTextTests { - pb := new(MyMessage) - err := UnmarshalText(test.in, pb) - if test.err == "" { - // We don't expect failure. - if err != nil { - t.Errorf("Test %d: Unexpected error: %v", i, err) - } else if !Equal(pb, test.out) { - t.Errorf("Test %d: Incorrect populated \nHave: %v\nWant: %v", - i, pb, test.out) - } - } else { - // We do expect failure. - if err == nil { - t.Errorf("Test %d: Didn't get expected error: %v", i, test.err) - } else if err.Error() != test.err { - t.Errorf("Test %d: Incorrect error.\nHave: %v\nWant: %v", - i, err.Error(), test.err) - } else if _, ok := err.(*RequiredNotSetError); ok && test.out != nil && !Equal(pb, test.out) { - t.Errorf("Test %d: Incorrect populated \nHave: %v\nWant: %v", - i, pb, test.out) - } - } - } -} - -func TestUnmarshalTextCustomMessage(t *testing.T) { - msg := &textMessage{} - if err := UnmarshalText("custom", msg); err != nil { - t.Errorf("Unexpected error from custom unmarshal: %v", err) - } - if UnmarshalText("not custom", msg) == nil { - t.Errorf("Didn't get expected error from custom unmarshal") - } -} - -// Regression test; this caused a panic. -func TestRepeatedEnum(t *testing.T) { - pb := new(RepeatedEnum) - if err := UnmarshalText("color: RED", pb); err != nil { - t.Fatal(err) - } - exp := &RepeatedEnum{ - Color: []RepeatedEnum_Color{RepeatedEnum_RED}, - } - if !Equal(pb, exp) { - t.Errorf("Incorrect populated \nHave: %v\nWant: %v", pb, exp) - } -} - -func TestProto3TextParsing(t *testing.T) { - m := new(proto3pb.Message) - const in = `name: "Wallace" true_scotsman: true` - want := &proto3pb.Message{ - Name: "Wallace", - TrueScotsman: true, - } - if err := UnmarshalText(in, m); err != nil { - t.Fatal(err) - } - if !Equal(m, want) { - t.Errorf("\n got %v\nwant %v", m, want) - } -} - -func TestMapParsing(t *testing.T) { - m := new(MessageWithMap) - const in = `name_mapping: name_mapping:` + - `msg_mapping:,>` + // separating commas are okay - `msg_mapping>` + // no colon after "value" - `msg_mapping:>` + // omitted key - `msg_mapping:` + // omitted value - `byte_mapping:` + - `byte_mapping:<>` // omitted key and value - want := &MessageWithMap{ - NameMapping: map[int32]string{ - 1: "Beatles", - 1234: "Feist", - }, - MsgMapping: map[int64]*FloatingPoint{ - -4: {F: Float64(2.0)}, - -2: {F: Float64(4.0)}, - 0: {F: Float64(5.0)}, - 1: nil, - }, - ByteMapping: map[bool][]byte{ - false: nil, - true: []byte("so be it"), - }, - } - if err := UnmarshalText(in, m); err != nil { - t.Fatal(err) - } - if !Equal(m, want) { - t.Errorf("\n got %v\nwant %v", m, want) - } -} - -func TestOneofParsing(t *testing.T) { - const in = `name:"Shrek"` - m := new(Communique) - want := &Communique{Union: &Communique_Name{"Shrek"}} - if err := UnmarshalText(in, m); err != nil { - t.Fatal(err) - } - if !Equal(m, want) { - t.Errorf("\n got %v\nwant %v", m, want) - } - - const inOverwrite = `name:"Shrek" number:42` - m = new(Communique) - testErr := "line 1.13: field 'number' would overwrite already parsed oneof 'Union'" - if err := UnmarshalText(inOverwrite, m); err == nil { - t.Errorf("TestOneofParsing: Didn't get expected error: %v", testErr) - } else if err.Error() != testErr { - t.Errorf("TestOneofParsing: Incorrect error.\nHave: %v\nWant: %v", - err.Error(), testErr) - } - -} - -var benchInput string - -func init() { - benchInput = "count: 4\n" - for i := 0; i < 1000; i++ { - benchInput += "pet: \"fido\"\n" - } - - // Check it is valid input. - pb := new(MyMessage) - err := UnmarshalText(benchInput, pb) - if err != nil { - panic("Bad benchmark input: " + err.Error()) - } -} - -func BenchmarkUnmarshalText(b *testing.B) { - pb := new(MyMessage) - for i := 0; i < b.N; i++ { - UnmarshalText(benchInput, pb) - } - b.SetBytes(int64(len(benchInput))) -} diff --git a/proto/text_test.go b/proto/text_test.go deleted file mode 100644 index 2ff67af5ac..0000000000 --- a/proto/text_test.go +++ /dev/null @@ -1,491 +0,0 @@ -// 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_test - -import ( - "bytes" - "errors" - "io/ioutil" - "math" - "strings" - "sync" - "testing" - - "github.com/golang/protobuf/proto" - - proto3pb "github.com/golang/protobuf/proto/proto3_proto" - pb "github.com/golang/protobuf/proto/test_proto" - anypb "github.com/golang/protobuf/ptypes/any" -) - -// textMessage implements the methods that allow it to marshal and unmarshal -// itself as text. -type textMessage struct { -} - -func (*textMessage) MarshalText() ([]byte, error) { - return []byte("custom"), nil -} - -func (*textMessage) UnmarshalText(bytes []byte) error { - if string(bytes) != "custom" { - return errors.New("expected 'custom'") - } - return nil -} - -func (*textMessage) Reset() {} -func (*textMessage) String() string { return "" } -func (*textMessage) ProtoMessage() {} - -func newTestMessage() *pb.MyMessage { - msg := &pb.MyMessage{ - Count: proto.Int32(42), - Name: proto.String("Dave"), - Quote: proto.String(`"I didn't want to go."`), - Pet: []string{"bunny", "kitty", "horsey"}, - Inner: &pb.InnerMessage{ - Host: proto.String("footrest.syd"), - Port: proto.Int32(7001), - Connected: proto.Bool(true), - }, - Others: []*pb.OtherMessage{ - { - Key: proto.Int64(0xdeadbeef), - Value: []byte{1, 65, 7, 12}, - }, - { - Weight: proto.Float32(6.022), - Inner: &pb.InnerMessage{ - Host: proto.String("lesha.mtv"), - Port: proto.Int32(8002), - }, - }, - }, - Bikeshed: pb.MyMessage_BLUE.Enum(), - Somegroup: &pb.MyMessage_SomeGroup{ - GroupField: proto.Int32(8), - }, - // One normally wouldn't do this. - // This is an undeclared tag 13, as a varint (wire type 0) with value 4. - XXX_unrecognized: []byte{13<<3 | 0, 4}, - } - ext := &pb.Ext{ - Data: proto.String("Big gobs for big rats"), - } - if err := proto.SetExtension(msg, pb.E_Ext_More, ext); err != nil { - panic(err) - } - greetings := []string{"adg", "easy", "cow"} - if err := proto.SetExtension(msg, pb.E_Greeting, greetings); err != nil { - panic(err) - } - - // Add an unknown extension. We marshal a pb.Ext, and fake the ID. - b, err := proto.Marshal(&pb.Ext{Data: proto.String("3G skiing")}) - if err != nil { - panic(err) - } - b = append(proto.EncodeVarint(201<<3|proto.WireBytes), b...) - proto.SetRawExtension(msg, 201, b) - - // Extensions can be plain fields, too, so let's test that. - b = append(proto.EncodeVarint(202<<3|proto.WireVarint), 19) - proto.SetRawExtension(msg, 202, b) - - return msg -} - -const text = `count: 42 -name: "Dave" -quote: "\"I didn't want to go.\"" -pet: "bunny" -pet: "kitty" -pet: "horsey" -inner: < - host: "footrest.syd" - port: 7001 - connected: true -> -others: < - key: 3735928559 - value: "\001A\007\014" -> -others: < - weight: 6.022 - inner: < - host: "lesha.mtv" - port: 8002 - > -> -bikeshed: BLUE -SomeGroup { - group_field: 8 -} -/* 2 unknown bytes */ -13: 4 -[test_proto.Ext.more]: < - data: "Big gobs for big rats" -> -[test_proto.greeting]: "adg" -[test_proto.greeting]: "easy" -[test_proto.greeting]: "cow" -/* 13 unknown bytes */ -201: "\t3G skiing" -/* 3 unknown bytes */ -202: 19 -` - -func TestMarshalText(t *testing.T) { - buf := new(bytes.Buffer) - if err := proto.MarshalText(buf, newTestMessage()); err != nil { - t.Fatalf("proto.MarshalText: %v", err) - } - s := buf.String() - if s != text { - t.Errorf("Got:\n===\n%v===\nExpected:\n===\n%v===\n", s, text) - } -} - -func TestMarshalTextCustomMessage(t *testing.T) { - buf := new(bytes.Buffer) - if err := proto.MarshalText(buf, &textMessage{}); err != nil { - t.Fatalf("proto.MarshalText: %v", err) - } - s := buf.String() - if s != "custom" { - t.Errorf("Got %q, expected %q", s, "custom") - } -} -func TestMarshalTextNil(t *testing.T) { - want := "" - tests := []proto.Message{nil, (*pb.MyMessage)(nil)} - for i, test := range tests { - buf := new(bytes.Buffer) - if err := proto.MarshalText(buf, test); err != nil { - t.Fatal(err) - } - if got := buf.String(); got != want { - t.Errorf("%d: got %q want %q", i, got, want) - } - } -} - -func TestMarshalTextUnknownEnum(t *testing.T) { - // The Color enum only specifies values 0-2. - m := &pb.MyMessage{Bikeshed: pb.MyMessage_Color(3).Enum()} - got := m.String() - const want = `bikeshed:3 ` - if got != want { - t.Errorf("\n got %q\nwant %q", got, want) - } -} - -func TestTextOneof(t *testing.T) { - tests := []struct { - m proto.Message - want string - }{ - // zero message - {&pb.Communique{}, ``}, - // scalar field - {&pb.Communique{Union: &pb.Communique_Number{4}}, `number:4`}, - // message field - {&pb.Communique{Union: &pb.Communique_Msg{ - &pb.Strings{StringField: proto.String("why hello!")}, - }}, `msg:`}, - // bad oneof (should not panic) - {&pb.Communique{Union: &pb.Communique_Msg{nil}}, `msg:/* nil */`}, - } - for _, test := range tests { - got := strings.TrimSpace(test.m.String()) - if got != test.want { - t.Errorf("\n got %s\nwant %s", got, test.want) - } - } -} - -func BenchmarkMarshalTextBuffered(b *testing.B) { - buf := new(bytes.Buffer) - m := newTestMessage() - for i := 0; i < b.N; i++ { - buf.Reset() - proto.MarshalText(buf, m) - } -} - -func BenchmarkMarshalTextUnbuffered(b *testing.B) { - w := ioutil.Discard - m := newTestMessage() - for i := 0; i < b.N; i++ { - proto.MarshalText(w, m) - } -} - -func compact(src string) string { - // s/[ \n]+/ /g; s/ $//; - dst := make([]byte, len(src)) - space, comment := false, false - j := 0 - for i := 0; i < len(src); i++ { - if strings.HasPrefix(src[i:], "/*") { - comment = true - i++ - continue - } - if comment && strings.HasPrefix(src[i:], "*/") { - comment = false - i++ - continue - } - if comment { - continue - } - c := src[i] - if c == ' ' || c == '\n' { - space = true - continue - } - if j > 0 && (dst[j-1] == ':' || dst[j-1] == '<' || dst[j-1] == '{') { - space = false - } - if c == '{' { - space = false - } - if space { - dst[j] = ' ' - j++ - space = false - } - dst[j] = c - j++ - } - if space { - dst[j] = ' ' - j++ - } - return string(dst[0:j]) -} - -var compactText = compact(text) - -func TestCompactText(t *testing.T) { - s := proto.CompactTextString(newTestMessage()) - if s != compactText { - t.Errorf("Got:\n===\n%v===\nExpected:\n===\n%v\n===\n", s, compactText) - } -} - -func TestStringEscaping(t *testing.T) { - testCases := []struct { - in *pb.Strings - out string - }{ - { - // Test data from C++ test (TextFormatTest.StringEscape). - // Single divergence: we don't escape apostrophes. - &pb.Strings{StringField: proto.String("\"A string with ' characters \n and \r newlines and \t tabs and \001 slashes \\ and multiple spaces")}, - "string_field: \"\\\"A string with ' characters \\n and \\r newlines and \\t tabs and \\001 slashes \\\\ and multiple spaces\"\n", - }, - { - // Test data from the same C++ test. - &pb.Strings{StringField: proto.String("\350\260\267\346\255\214")}, - "string_field: \"\\350\\260\\267\\346\\255\\214\"\n", - }, - { - // Some UTF-8. - &pb.Strings{StringField: proto.String("\x00\x01\xff\x81")}, - `string_field: "\000\001\377\201"` + "\n", - }, - } - - for i, tc := range testCases { - var buf bytes.Buffer - if err := proto.MarshalText(&buf, tc.in); err != nil { - t.Errorf("proto.MarsalText: %v", err) - continue - } - s := buf.String() - if s != tc.out { - t.Errorf("#%d: Got:\n%s\nExpected:\n%s\n", i, s, tc.out) - continue - } - - // Check round-trip. - pb := new(pb.Strings) - if err := proto.UnmarshalText(s, pb); err != nil { - t.Errorf("#%d: UnmarshalText: %v", i, err) - continue - } - if !proto.Equal(pb, tc.in) { - t.Errorf("#%d: Round-trip failed:\nstart: %v\n end: %v", i, tc.in, pb) - } - } -} - -// A limitedWriter accepts some output before it fails. -// This is a proxy for something like a nearly-full or imminently-failing disk, -// or a network connection that is about to die. -type limitedWriter struct { - b bytes.Buffer - limit int -} - -var outOfSpace = errors.New("proto: insufficient space") - -func (w *limitedWriter) Write(p []byte) (n int, err error) { - var avail = w.limit - w.b.Len() - if avail <= 0 { - return 0, outOfSpace - } - if len(p) <= avail { - return w.b.Write(p) - } - n, _ = w.b.Write(p[:avail]) - return n, outOfSpace -} - -func TestMarshalTextFailing(t *testing.T) { - // Try lots of different sizes to exercise more error code-paths. - for lim := 0; lim < len(text); lim++ { - buf := new(limitedWriter) - buf.limit = lim - err := proto.MarshalText(buf, newTestMessage()) - // We expect a certain error, but also some partial results in the buffer. - if err != outOfSpace { - t.Errorf("Got:\n===\n%v===\nExpected:\n===\n%v===\n", err, outOfSpace) - } - s := buf.b.String() - x := text[:buf.limit] - if s != x { - t.Errorf("Got:\n===\n%v===\nExpected:\n===\n%v===\n", s, x) - } - } -} - -func TestFloats(t *testing.T) { - tests := []struct { - f float64 - want string - }{ - {0, "0"}, - {4.7, "4.7"}, - {math.Inf(1), "inf"}, - {math.Inf(-1), "-inf"}, - {math.NaN(), "nan"}, - } - for _, test := range tests { - msg := &pb.FloatingPoint{F: &test.f} - got := strings.TrimSpace(msg.String()) - want := `f:` + test.want - if got != want { - t.Errorf("f=%f: got %q, want %q", test.f, got, want) - } - } -} - -func TestRepeatedNilText(t *testing.T) { - m := &pb.MessageList{ - Message: []*pb.MessageList_Message{ - nil, - &pb.MessageList_Message{ - Name: proto.String("Horse"), - }, - nil, - }, - } - want := `Message -Message { - name: "Horse" -} -Message -` - if s := proto.MarshalTextString(m); s != want { - t.Errorf(" got: %s\nwant: %s", s, want) - } -} - -func TestProto3Text(t *testing.T) { - tests := []struct { - m proto.Message - want string - }{ - // zero message - {&proto3pb.Message{}, ``}, - // zero message except for an empty byte slice - {&proto3pb.Message{Data: []byte{}}, ``}, - // trivial case - {&proto3pb.Message{Name: "Rob", HeightInCm: 175}, `name:"Rob" height_in_cm:175`}, - // empty map - {&pb.MessageWithMap{}, ``}, - // non-empty map; map format is the same as a repeated struct, - // and they are sorted by key (numerically for numeric keys). - { - &pb.MessageWithMap{NameMapping: map[int32]string{ - -1: "Negatory", - 7: "Lucky", - 1234: "Feist", - 6345789: "Otis", - }}, - `name_mapping: ` + - `name_mapping: ` + - `name_mapping: ` + - `name_mapping:`, - }, - // map with nil value; not well-defined, but we shouldn't crash - { - &pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{7: nil}}, - `msg_mapping:`, - }, - } - for _, test := range tests { - got := strings.TrimSpace(test.m.String()) - if got != test.want { - t.Errorf("\n got %s\nwant %s", got, test.want) - } - } -} - -func TestRacyMarshal(t *testing.T) { - // This test should be run with the race detector. - - any := &pb.MyMessage{Count: proto.Int32(47), Name: proto.String("David")} - proto.SetExtension(any, pb.E_Ext_Text, proto.String("bar")) - b, err := proto.Marshal(any) - if err != nil { - panic(err) - } - m := &proto3pb.Message{ - Name: "David", - ResultCount: 47, - Anything: &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any), Value: b}, - } - - wantText := proto.MarshalTextString(m) - wantBytes, err := proto.Marshal(m) - if err != nil { - t.Fatalf("proto.Marshal error: %v", err) - } - - var wg sync.WaitGroup - defer wg.Wait() - wg.Add(20) - for i := 0; i < 10; i++ { - go func() { - defer wg.Done() - got := proto.MarshalTextString(m) - if got != wantText { - t.Errorf("proto.MarshalTextString = %q, want %q", got, wantText) - } - }() - go func() { - defer wg.Done() - got, err := proto.Marshal(m) - if !bytes.Equal(got, wantBytes) || err != nil { - t.Errorf("proto.Marshal = (%x, %v), want (%x, nil)", got, err, wantBytes) - } - }() - } -} diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index 6fc98edc36..e1658862db 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -4,12 +4,15 @@ package descriptor import ( - proto "github.com/golang/protobuf/proto" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" descriptor "github.com/golang/protobuf/v2/types/descriptor" + sync "sync" ) +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) + // Symbols defined in public import of google/protobuf/descriptor.proto type FieldDescriptorProto_Type = descriptor.FieldDescriptorProto_Type @@ -149,8 +152,9 @@ type UninterpretedOption_NamePart = descriptor.UninterpretedOption_NamePart type SourceCodeInfo_Location = descriptor.SourceCodeInfo_Location type GeneratedCodeInfo_Annotation = descriptor.GeneratedCodeInfo_Annotation -var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc = []byte{ - // 180 bytes of the wire-encoded FileDescriptorProto +var File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto protoreflect.FileDescriptor + +var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc = []byte{ 0x0a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, @@ -165,11 +169,17 @@ var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_prot 0x6f, 0x74, 0x6f, 0x32, } -var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc) - -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +var ( + xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc_once sync.Once + xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc +) -var File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto protoreflect.FileDescriptor +func xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescGZIP() []byte { + xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc_once.Do(func() { + xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc_data) + }) + return xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc_data +} var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = []interface{}{} var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = []int32{} @@ -180,11 +190,13 @@ func xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_pro return } File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc, + RawDescriptor: xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc, GoTypes: xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs, + FilesRegistry: protoregistry.GlobalFiles, + TypesRegistry: protoregistry.GlobalTypes, }.Init() - proto.RegisterFile("github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto", xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawdesc_gzipped) + xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc = nil xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = nil xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = nil } diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index 7d13e686cd..60fdf29123 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -4,12 +4,15 @@ package plugin_go import ( - proto "github.com/golang/protobuf/proto" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" plugin "github.com/golang/protobuf/v2/types/plugin" + sync "sync" ) +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) + // Symbols defined in public import of google/protobuf/compiler/plugin.proto type Version = plugin.Version @@ -17,8 +20,9 @@ type CodeGeneratorRequest = plugin.CodeGeneratorRequest type CodeGeneratorResponse = plugin.CodeGeneratorResponse type CodeGeneratorResponse_File = plugin.CodeGeneratorResponse_File -var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc = []byte{ - // 172 bytes of the wire-encoded FileDescriptorProto +var File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto protoreflect.FileDescriptor + +var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc = []byte{ 0x0a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, @@ -32,11 +36,17 @@ var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdes 0x67, 0x6f, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, } -var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc) - -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +var ( + xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc_once sync.Once + xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc +) -var File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto protoreflect.FileDescriptor +func xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescGZIP() []byte { + xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc_once.Do(func() { + xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc_data) + }) + return xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc_data +} var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = []interface{}{} var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = []int32{} @@ -47,11 +57,13 @@ func xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init( return } File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc, + RawDescriptor: xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc, GoTypes: xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs, + FilesRegistry: protoregistry.GlobalFiles, + TypesRegistry: protoregistry.GlobalTypes, }.Init() - proto.RegisterFile("github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto", xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawdesc_gzipped) + xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc = nil xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = nil xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = nil } diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index 1857c74166..4fee3bf754 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -4,18 +4,22 @@ package any import ( - proto "github.com/golang/protobuf/proto" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" known "github.com/golang/protobuf/v2/types/known" + sync "sync" ) +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) + // Symbols defined in public import of google/protobuf/any.proto type Any = known.Any -var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc = []byte{ - // 131 bytes of the wire-encoded FileDescriptorProto +var File_github_com_golang_protobuf_ptypes_any_any_proto protoreflect.FileDescriptor + +var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = []byte{ 0x0a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, @@ -27,11 +31,17 @@ var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc = []byte{ 0x74, 0x6f, 0x33, } -var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc) - -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +var ( + xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc_once sync.Once + xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc +) -var File_github_com_golang_protobuf_ptypes_any_any_proto protoreflect.FileDescriptor +func xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDescGZIP() []byte { + xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc_once.Do(func() { + xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc_data) + }) + return xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc_data +} var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = []interface{}{} var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{} @@ -42,11 +52,13 @@ func xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_init() { return } File_github_com_golang_protobuf_ptypes_any_any_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc, + RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc, GoTypes: xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs, + FilesRegistry: protoregistry.GlobalFiles, + TypesRegistry: protoregistry.GlobalTypes, }.Init() - proto.RegisterFile("github.com/golang/protobuf/ptypes/any/any.proto", xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawdesc_gzipped) + xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = nil xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = nil xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = nil } diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index af0e70b1d4..b173a1dc57 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -4,18 +4,22 @@ package duration import ( - proto "github.com/golang/protobuf/proto" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" known "github.com/golang/protobuf/v2/types/known" + sync "sync" ) +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) + // Symbols defined in public import of google/protobuf/duration.proto type Duration = known.Duration -var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc = []byte{ - // 156 bytes of the wire-encoded FileDescriptorProto +var File_github_com_golang_protobuf_ptypes_duration_duration_proto protoreflect.FileDescriptor + +var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = []byte{ 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x64, 0x75, 0x72, @@ -28,11 +32,17 @@ var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc = 0x6f, 0x6e, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc) - -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +var ( + xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc_once sync.Once + xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc +) -var File_github_com_golang_protobuf_ptypes_duration_duration_proto protoreflect.FileDescriptor +func xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescGZIP() []byte { + xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc_once.Do(func() { + xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc_data) + }) + return xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc_data +} var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = []interface{}{} var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = []int32{} @@ -43,11 +53,13 @@ func xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_init() { return } File_github_com_golang_protobuf_ptypes_duration_duration_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc, + RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc, GoTypes: xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs, + FilesRegistry: protoregistry.GlobalFiles, + TypesRegistry: protoregistry.GlobalTypes, }.Init() - proto.RegisterFile("github.com/golang/protobuf/ptypes/duration/duration.proto", xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawdesc_gzipped) + xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = nil xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = nil xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = nil } diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index 726c360cbf..a2fa06a0e9 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -4,18 +4,22 @@ package empty import ( - proto "github.com/golang/protobuf/proto" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" known "github.com/golang/protobuf/v2/types/known" + sync "sync" ) +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) + // Symbols defined in public import of google/protobuf/empty.proto type Empty = known.Empty -var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc = []byte{ - // 141 bytes of the wire-encoded FileDescriptorProto +var File_github_com_golang_protobuf_ptypes_empty_empty_proto protoreflect.FileDescriptor + +var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc = []byte{ 0x0a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, @@ -27,11 +31,17 @@ var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc = []byt 0x70, 0x74, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc) - -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +var ( + xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc_once sync.Once + xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc +) -var File_github_com_golang_protobuf_ptypes_empty_empty_proto protoreflect.FileDescriptor +func xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescGZIP() []byte { + xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc_once.Do(func() { + xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc_data) + }) + return xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc_data +} var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = []interface{}{} var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = []int32{} @@ -42,11 +52,13 @@ func xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_init() { return } File_github_com_golang_protobuf_ptypes_empty_empty_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc, + RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc, GoTypes: xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs, + FilesRegistry: protoregistry.GlobalFiles, + TypesRegistry: protoregistry.GlobalTypes, }.Init() - proto.RegisterFile("github.com/golang/protobuf/ptypes/empty/empty.proto", xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawdesc_gzipped) + xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc = nil xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = nil xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = nil } diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index 543a925439..3f848ef1e6 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -4,12 +4,15 @@ package structpb import ( - proto "github.com/golang/protobuf/proto" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" known "github.com/golang/protobuf/v2/types/known" + sync "sync" ) +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) + // Symbols defined in public import of google/protobuf/struct.proto type NullValue = known.NullValue @@ -29,8 +32,9 @@ type Value_StructValue = known.Value_StructValue type Value_ListValue = known.Value_ListValue type ListValue = known.ListValue -var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc = []byte{ - // 148 bytes of the wire-encoded FileDescriptorProto +var File_github_com_golang_protobuf_ptypes_struct_struct_proto protoreflect.FileDescriptor + +var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc = []byte{ 0x0a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, @@ -43,11 +47,17 @@ var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc = []b 0x6f, 0x74, 0x6f, 0x33, } -var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc) - -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +var ( + xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc_once sync.Once + xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc +) -var File_github_com_golang_protobuf_ptypes_struct_struct_proto protoreflect.FileDescriptor +func xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescGZIP() []byte { + xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc_once.Do(func() { + xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc_data) + }) + return xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc_data +} var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = []interface{}{} var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = []int32{} @@ -58,11 +68,13 @@ func xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_init() { return } File_github_com_golang_protobuf_ptypes_struct_struct_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc, + RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc, GoTypes: xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs, + FilesRegistry: protoregistry.GlobalFiles, + TypesRegistry: protoregistry.GlobalTypes, }.Init() - proto.RegisterFile("github.com/golang/protobuf/ptypes/struct/struct.proto", xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawdesc_gzipped) + xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc = nil xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = nil xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = nil } diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index c993c5899e..b4c4abe9f3 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -4,18 +4,22 @@ package timestamp import ( - proto "github.com/golang/protobuf/proto" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" known "github.com/golang/protobuf/v2/types/known" + sync "sync" ) +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) + // Symbols defined in public import of google/protobuf/timestamp.proto type Timestamp = known.Timestamp -var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc = []byte{ - // 161 bytes of the wire-encoded FileDescriptorProto +var File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto protoreflect.FileDescriptor + +var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = []byte{ 0x0a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2f, 0x74, 0x69, @@ -29,11 +33,17 @@ var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc 0x33, } -var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc) - -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +var ( + xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc_once sync.Once + xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc +) -var File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto protoreflect.FileDescriptor +func xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescGZIP() []byte { + xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc_once.Do(func() { + xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc_data) + }) + return xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc_data +} var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = []interface{}{} var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = []int32{} @@ -44,11 +54,13 @@ func xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() return } File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc, + RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc, GoTypes: xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs, + FilesRegistry: protoregistry.GlobalFiles, + TypesRegistry: protoregistry.GlobalTypes, }.Init() - proto.RegisterFile("github.com/golang/protobuf/ptypes/timestamp/timestamp.proto", xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawdesc_gzipped) + xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = nil xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = nil xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = nil } diff --git a/ptypes/timestamp_test.go b/ptypes/timestamp_test.go index 179f5035c3..96811180d6 100644 --- a/ptypes/timestamp_test.go +++ b/ptypes/timestamp_test.go @@ -97,7 +97,7 @@ func TestTimestampString(t *testing.T) { // Not much testing needed because presumably time.Format is // well-tested. {&tspb.Timestamp{Seconds: 0, Nanos: 0}, "1970-01-01T00:00:00Z"}, - {&tspb.Timestamp{Seconds: minValidSeconds - 1, Nanos: 0}, "(timestamp: seconds:-62135596801 before 0001-01-01)"}, + {&tspb.Timestamp{Seconds: minValidSeconds - 1, Nanos: 0}, "(timestamp: seconds:-62135596801 before 0001-01-01)"}, } { got := TimestampString(test.ts) if got != test.want { diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index 7e47bc64b4..9c70983304 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -4,12 +4,15 @@ package wrappers import ( - proto "github.com/golang/protobuf/proto" protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" + protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" known "github.com/golang/protobuf/v2/types/known" + sync "sync" ) +const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) + // Symbols defined in public import of google/protobuf/wrappers.proto type DoubleValue = known.DoubleValue @@ -22,8 +25,9 @@ type BoolValue = known.BoolValue type StringValue = known.StringValue type BytesValue = known.BytesValue -var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc = []byte{ - // 156 bytes of the wire-encoded FileDescriptorProto +var File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto protoreflect.FileDescriptor + +var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc = []byte{ 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2f, 0x77, 0x72, 0x61, @@ -36,11 +40,17 @@ var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc = 0x72, 0x73, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc) - -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +var ( + xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc_once sync.Once + xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc +) -var File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto protoreflect.FileDescriptor +func xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescGZIP() []byte { + xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc_once.Do(func() { + xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc_data) + }) + return xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc_data +} var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = []interface{}{} var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = []int32{} @@ -51,11 +61,13 @@ func xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() { return } File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc, + RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc, GoTypes: xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes, DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs, + FilesRegistry: protoregistry.GlobalFiles, + TypesRegistry: protoregistry.GlobalTypes, }.Init() - proto.RegisterFile("github.com/golang/protobuf/ptypes/wrappers/wrappers.proto", xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawdesc_gzipped) + xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc = nil xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = nil xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = nil } From 292a74a82a45b4968f045f6b42081698cae119c6 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 16 Apr 2019 12:14:52 -0700 Subject: [PATCH 060/133] proto: unmarshal extensions eagerly Prior to this CL, Go did not eagerly unmarshal extension fields. The unmarshaling was done when GetExtension was called. The prior behavior has always been problematic: * This is incorrect since we are not validating that extensions are valid upon the initial unmarshal, which is a property of correctness that C++ and Java provide. * Usage is racy. GetExtension is a mutating operation since it can transform some bytes in the unknown fields to become extension fields. Thus, concurrent read-only operations with GetExtension is racy. In v1, we added a lock around the extension map to try and avoid a race, but this is just a facade. This fixes a race condition in terms of the Go memory model, but it is still racy since a local operation can still observe the effects of a remote GetExtension operation. * The API is clunky since delayed unmarshaling means that GetExtension needs to deal with possible unmarshal errors. We make extensions eagerly unmarshaled to avoid all of these problems. Change-Id: Iafccf2aeaa839c0d3f88ca18bd84af481e9b1662 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/172399 Reviewed-by: Damien Neil --- proto/table_unmarshal.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index 87d3da7031..7ac445bf81 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -116,6 +116,7 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { } var reqMask uint64 // bitmask of required fields we've seen. var errLater error + var hasExtensions bool for len(b) > 0 { // Read tag and wire type. // Special case 1 and 2 byte varints. @@ -191,6 +192,7 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { var e Extension for _, r := range u.extensionRanges { if uint64(r.Start) <= tag && tag <= uint64(r.End) { + hasExtensions = true if u.extensions.IsValid() { mp := m.offset(u.extensions).toExtensions() emap = protoimpl.X.ExtensionFieldsOf(mp) @@ -223,6 +225,35 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { emap.Set(protoreflect.FieldNumber(tag), e) } } + + // If there were unknown extensions, eagerly unmarshal them. + if hasExtensions { + mi := m.asPointerTo(u.typ).Interface().(Message) + ep, _ := extendable(mi) + if ep != nil { + var errFatal error + emap := RegisteredExtensions(mi) // map[int32]*ExtensionDesc + ep.Range(func(id protoreflect.FieldNumber, ef Extension) bool { + ed := emap[int32(id)] + if ed != nil { + _, err := GetExtension(mi, ed) + var nerr nonFatal + if !nerr.Merge(err) { + errFatal = err + return false + } + if errLater == nil { + errLater = nerr.E + } + } + return true + }) + if errFatal != nil { + return errFatal + } + } + } + if reqMask != u.reqMask && errLater == nil { // A required field of this message is missing. for _, n := range u.reqFields { From 13cf6e79fd39dcd52f513b5e1c9973fffadc112e Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 16 Apr 2019 12:13:08 -0700 Subject: [PATCH 061/133] proto: drop dependence on v2 protoimpl.ExtensionFieldsV2 The v2 protoimpl.ExtensionFieldsV2 is now just an alias to an unnamed map, which simplifies our implementation. Also, we can drop all synchronization since we now eagerly unmarshal extension fields. Change-Id: I4baa31e3d610d04d702686a489ebdb5e246276ab Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/172437 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 5 +- proto/clone.go | 6 +-- proto/equal.go | 11 ++--- proto/extensions.go | 56 +++++++++++++++++------ proto/lib.go | 16 ------- proto/message_set.go | 3 +- proto/table_marshal.go | 25 ++++------ proto/table_merge.go | 4 +- proto/table_unmarshal.go | 7 ++- proto/text.go | 4 +- protoc-gen-go/descriptor/descriptor.pb.go | 34 +++++++------- protoc-gen-go/plugin/plugin.pb.go | 34 +++++++------- ptypes/any/any.pb.go | 34 +++++++------- ptypes/duration/duration.pb.go | 34 +++++++------- ptypes/empty/empty.pb.go | 34 +++++++------- ptypes/struct/struct.pb.go | 34 +++++++------- ptypes/timestamp/timestamp.pb.go | 34 +++++++------- ptypes/wrappers/wrappers.pb.go | 34 +++++++------- 19 files changed, 203 insertions(+), 208 deletions(-) diff --git a/go.mod b/go.mod index c52c1b2566..38299adc03 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/golang/protobuf -require github.com/golang/protobuf/v2 v2.0.0-20190409211845-4ec39c766335 +require github.com/golang/protobuf/v2 v2.0.0-20190416222953-ab61d41ec93f diff --git a/go.sum b/go.sum index f098f99ece..8931984874 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,7 @@ github.com/golang/protobuf v1.2.1-0.20190322195920-d94fb84e04b7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.1-0.20190326022002-be03c15fcaa2/go.mod h1:rZ4veVXHB1S2+o7TKqD9Isxml062IeDutnCDtFPUlCc= -github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e h1:JQRqkjZt61BlBnTP2OpISUfb5I1LGJcqYHfFGERMmlg= github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e/go.mod h1:25ZALhydMFaBRgPH58a8zpFe9YXMAMjOYWtB6pNPcoo= -github.com/golang/protobuf/v2 v2.0.0-20190409211845-4ec39c766335 h1:dtT6y87fe34KJUI0FyKXi08Y1XZIU5NgxDl6yojsYdI= -github.com/golang/protobuf/v2 v2.0.0-20190409211845-4ec39c766335/go.mod h1:baUT2weUsA1MR7ocRtLXLmi2B1s4VrUT3S6tO8AYzMw= +github.com/golang/protobuf/v2 v2.0.0-20190416222953-ab61d41ec93f h1:/ykGaIiod920llcsrLlxw+U2sJkPdzwWF+zABcffzHc= +github.com/golang/protobuf/v2 v2.0.0-20190416222953-ab61d41ec93f/go.mod h1:baUT2weUsA1MR7ocRtLXLmi2B1s4VrUT3S6tO8AYzMw= github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42 h1:q3pnF5JFBNRz8sRD+IRj7Y6DMyYGTNqnZ9axTbSfoNI= github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= diff --git a/proto/clone.go b/proto/clone.go index 2cb7009fea..4b9f099e50 100644 --- a/proto/clone.go +++ b/proto/clone.go @@ -85,10 +85,8 @@ func mergeStruct(out, in reflect.Value) { if emIn, err := extendable(in.Addr().Interface()); err == nil { emOut, _ := extendable(out.Addr().Interface()) - if emIn.HasInit() { - emIn.Lock() + if emIn != nil { mergeExtension(emOut, emIn) - emIn.Unlock() } } @@ -208,7 +206,7 @@ func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { } } -func mergeExtension(out, in extensionFields) { +func mergeExtension(out, in *extensionMap) { in.Range(func(extNum protoreflect.FieldNumber, eIn Extension) bool { eOut := Extension{Desc: eIn.Desc} if eIn.Value != nil { diff --git a/proto/equal.go b/proto/equal.go index 04da80aada..29c28059d5 100644 --- a/proto/equal.go +++ b/proto/equal.go @@ -13,7 +13,6 @@ import ( "strings" "github.com/golang/protobuf/v2/reflect/protoreflect" - "github.com/golang/protobuf/v2/runtime/protoimpl" ) /* @@ -94,8 +93,8 @@ func equalStruct(v1, v2 reflect.Value) bool { if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { em2 := v2.FieldByName("XXX_InternalExtensions") - m1 := protoimpl.X.ExtensionFieldsOf(em1.Addr().Interface()) - m2 := protoimpl.X.ExtensionFieldsOf(em2.Addr().Interface()) + m1 := extensionFieldsOf(em1.Addr().Interface()) + m2 := extensionFieldsOf(em2.Addr().Interface()) if !equalExtensions(v1.Type(), m1, m2) { return false } @@ -103,8 +102,8 @@ func equalStruct(v1, v2 reflect.Value) bool { if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { em2 := v2.FieldByName("XXX_extensions") - m1 := protoimpl.X.ExtensionFieldsOf(em1.Addr().Interface()) - m2 := protoimpl.X.ExtensionFieldsOf(em2.Addr().Interface()) + m1 := extensionFieldsOf(em1.Addr().Interface()) + m2 := extensionFieldsOf(em2.Addr().Interface()) if !equalExtensions(v1.Type(), m1, m2) { return false } @@ -207,7 +206,7 @@ func equalAny(v1, v2 reflect.Value, prop *Properties) bool { return false } -func equalExtensions(base reflect.Type, em1, em2 extensionFields) bool { +func equalExtensions(base reflect.Type, em1, em2 *extensionMap) bool { if em1.Len() != em2.Len() { return false } diff --git a/proto/extensions.go b/proto/extensions.go index 836619d452..62b3cfdabf 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -23,7 +23,43 @@ import ( // ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. var ErrMissingExtension = errors.New("proto: missing extension") -func extendable(p interface{}) (extensionFields, error) { +func extensionFieldsOf(p interface{}) *extensionMap { + if p, ok := p.(*map[int32]Extension); ok { + return (*extensionMap)(p) + } + panic(fmt.Sprintf("invalid extension fields type: %T", p)) +} + +type extensionMap map[int32]Extension + +func (m extensionMap) Len() int { + return len(m) +} +func (m extensionMap) Has(n protoreflect.FieldNumber) bool { + _, ok := m[int32(n)] + return ok +} +func (m extensionMap) Get(n protoreflect.FieldNumber) Extension { + return m[int32(n)] +} +func (m *extensionMap) Set(n protoreflect.FieldNumber, x Extension) { + if *m == nil { + *m = make(map[int32]Extension) + } + (*m)[int32(n)] = x +} +func (m *extensionMap) Clear(n protoreflect.FieldNumber) { + delete(*m, int32(n)) +} +func (m extensionMap) Range(f func(protoreflect.FieldNumber, Extension) bool) { + for n, x := range m { + if !f(protoreflect.FieldNumber(n), x) { + return + } + } +} + +func extendable(p interface{}) (*extensionMap, error) { type extendableProto interface { Message ExtensionRangeArray() []ExtensionRange @@ -33,10 +69,10 @@ func extendable(p interface{}) (extensionFields, error) { if v.Kind() == reflect.Ptr && !v.IsNil() { v = v.Elem() if v := v.FieldByName("XXX_InternalExtensions"); v.IsValid() { - return protoimpl.X.ExtensionFieldsOf(v.Addr().Interface()), nil + return extensionFieldsOf(v.Addr().Interface()), nil } if v := v.FieldByName("XXX_extensions"); v.IsValid() { - return protoimpl.X.ExtensionFieldsOf(v.Addr().Interface()), nil + return extensionFieldsOf(v.Addr().Interface()), nil } } } @@ -51,7 +87,7 @@ type ( ExtensionRange = protoiface.ExtensionRangeV1 ExtensionDesc = protoiface.ExtensionDescV1 Extension = protoimpl.ExtensionFieldV1 - XXX_InternalExtensions = protoimpl.ExtensionFieldsV1 + XXX_InternalExtensions = protoimpl.ExtensionFields ) func isRepeatedExtension(ed *ExtensionDesc) bool { @@ -139,11 +175,9 @@ func HasExtension(pb Message, extension *ExtensionDesc) bool { if err != nil { return false } - if !epb.HasInit() { + if epb == nil { return false } - epb.Lock() - defer epb.Unlock() return epb.Has(protoreflect.FieldNumber(extension.Field)) } @@ -177,11 +211,9 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { return nil, err } - if !epb.HasInit() { + if epb == nil { return defaultExtensionValue(pb, extension) } - epb.Lock() - defer epb.Unlock() if !epb.Has(protoreflect.FieldNumber(extension.Field)) { // defaultExtensionValue returns the default value or // ErrMissingExtension if there is no default. @@ -319,11 +351,9 @@ func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { } registeredExtensions := RegisteredExtensions(pb) - if !epb.HasInit() { + if epb == nil { return nil, nil } - epb.Lock() - defer epb.Unlock() extensions := make([]*ExtensionDesc, 0, epb.Len()) epb.Range(func(extid protoreflect.FieldNumber, e Extension) bool { desc := e.Desc diff --git a/proto/lib.go b/proto/lib.go index 77c596a32d..b87f70ea58 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -15,25 +15,9 @@ import ( "strconv" "sync" - "github.com/golang/protobuf/v2/reflect/protoreflect" "github.com/golang/protobuf/v2/runtime/protoiface" - "github.com/golang/protobuf/v2/runtime/protoimpl" ) -type extensionFields = interface { - Len() int - Has(protoreflect.FieldNumber) bool - Get(protoreflect.FieldNumber) protoimpl.ExtensionFieldV1 - Set(protoreflect.FieldNumber, protoimpl.ExtensionFieldV1) - Clear(protoreflect.FieldNumber) - Range(f func(protoreflect.FieldNumber, protoimpl.ExtensionFieldV1) bool) - - // HasInit and Locker are used by v1 GetExtension to provide - // an artificial degree of concurrent safety. - HasInit() bool - sync.Locker -} - // requiredNotSetError is an error type returned by either Marshal or Unmarshal. // Marshal reports this when a required field is not initialized. // Unmarshal reports this when a required field is missing from the wire data. diff --git a/proto/message_set.go b/proto/message_set.go index 2878bdf8a8..df3a8c1782 100644 --- a/proto/message_set.go +++ b/proto/message_set.go @@ -12,7 +12,6 @@ import ( "errors" "github.com/golang/protobuf/v2/reflect/protoreflect" - "github.com/golang/protobuf/v2/runtime/protoimpl" ) // errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. @@ -118,7 +117,7 @@ func skipVarint(buf []byte) []byte { // unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. // It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. func unmarshalMessageSet(buf []byte, exts interface{}) error { - m := protoimpl.X.ExtensionFieldsOf(exts) + m := extensionFieldsOf(exts) ms := new(messageSet) if err := Unmarshal(buf, ms); err != nil { diff --git a/proto/table_marshal.go b/proto/table_marshal.go index 7ec867e711..a1bda5556e 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -17,7 +17,6 @@ import ( "unicode/utf8" "github.com/golang/protobuf/v2/reflect/protoreflect" - "github.com/golang/protobuf/v2/runtime/protoimpl" ) // a sizer takes a pointer to a field and the size of its tag, computes the size of @@ -2366,12 +2365,10 @@ func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, ma // sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field. func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { - m := protoimpl.X.ExtensionFieldsOf(ext) - if !m.HasInit() { + m := extensionFieldsOf(ext) + if m == nil { return 0 } - m.Lock() - defer m.Unlock() n := 0 m.Range(func(_ protoreflect.FieldNumber, e Extension) bool { @@ -2395,12 +2392,10 @@ func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { // appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b. func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m := protoimpl.X.ExtensionFieldsOf(ext) - if !m.HasInit() { + m := extensionFieldsOf(ext) + if m == nil { return b, nil } - m.Lock() - defer m.Unlock() var err error var nerr nonFatal @@ -2475,12 +2470,10 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de // sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field // in message set format (above). func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { - m := protoimpl.X.ExtensionFieldsOf(ext) - if !m.HasInit() { + m := extensionFieldsOf(ext) + if m == nil { return 0 } - m.Lock() - defer m.Unlock() n := 0 m.Range(func(id protoreflect.FieldNumber, e Extension) bool { @@ -2511,12 +2504,10 @@ func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { // appendMessageSet marshals a XXX_InternalExtensions field in message set format (above) // to the end of byte slice b. func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m := protoimpl.X.ExtensionFieldsOf(ext) - if !m.HasInit() { + m := extensionFieldsOf(ext) + if m == nil { return b, nil } - m.Lock() - defer m.Unlock() var err error var nerr nonFatal diff --git a/proto/table_merge.go b/proto/table_merge.go index cb30bdc0a1..3565efbda7 100644 --- a/proto/table_merge.go +++ b/proto/table_merge.go @@ -117,10 +117,8 @@ func (mi *mergeInfo) merge(dst, src pointer) { in := src.asPointerTo(mi.typ).Elem() if emIn, err := extendable(in.Addr().Interface()); err == nil { emOut, _ := extendable(out.Addr().Interface()) - if emIn.HasInit() { - emIn.Lock() + if emIn != nil { mergeExtension(emOut, emIn) - emIn.Unlock() } } diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index 7ac445bf81..0db9068779 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -17,7 +17,6 @@ import ( "unicode/utf8" "github.com/golang/protobuf/v2/reflect/protoreflect" - "github.com/golang/protobuf/v2/runtime/protoimpl" ) // Unmarshal is the entry point from the generated .pb.go files. @@ -188,21 +187,21 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { // Keep unrecognized data around. // maybe in extensions, maybe in the unrecognized field. z := m.offset(u.unrecognized).toBytes() - var emap extensionFields + var emap *extensionMap var e Extension for _, r := range u.extensionRanges { if uint64(r.Start) <= tag && tag <= uint64(r.End) { hasExtensions = true if u.extensions.IsValid() { mp := m.offset(u.extensions).toExtensions() - emap = protoimpl.X.ExtensionFieldsOf(mp) + emap = extensionFieldsOf(mp) e = emap.Get(protoreflect.FieldNumber(tag)) z = &e.Raw break } if u.oldExtensions.IsValid() { p := m.offset(u.oldExtensions).toOldExtensions() - emap = protoimpl.X.ExtensionFieldsOf(p) + emap = extensionFieldsOf(p) e = emap.Get(protoreflect.FieldNumber(tag)) z = &e.Raw break diff --git a/proto/text.go b/proto/text.go index 647e10fe12..4e46452885 100644 --- a/proto/text.go +++ b/proto/text.go @@ -658,17 +658,15 @@ func (tm *textMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error // Order the extensions by ID. // This isn't strictly necessary, but it will give us // canonical output, which will also make testing easier. - if !ep.HasInit() { + if ep == nil { return nil } - ep.Lock() ids := make([]protoreflect.FieldNumber, 0, ep.Len()) ep.Range(func(id protoreflect.FieldNumber, _ Extension) bool { ids = append(ids, id) return true }) sort.Sort(fieldNumSlice(ids)) - ep.Unlock() for _, extNum := range ids { ext := ep.Get(extNum) diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index e1658862db..fdbd3b7ec7 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -154,7 +154,7 @@ type GeneratedCodeInfo_Annotation = descriptor.GeneratedCodeInfo_Annotation var File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto protoreflect.FileDescriptor -var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc = []byte{ +var file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc = []byte{ 0x0a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, @@ -170,33 +170,33 @@ var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_prot } var ( - xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc_once sync.Once - xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc + file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescOnce sync.Once + file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescData = file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc ) -func xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescGZIP() []byte { - xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc_once.Do(func() { - xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc_data) +func file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescGZIP() []byte { + file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescOnce.Do(func() { + file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescData) }) - return xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc_data + return file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescData } -var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = []interface{}{} -var xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = []interface{}{} +var file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = []int32{} -func init() { xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_init() } -func xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_init() { +func init() { file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_init() } +func file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_init() { if File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto != nil { return } File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc, - GoTypes: xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes, - DependencyIndexes: xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs, + RawDescriptor: file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc, + GoTypes: file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes, + DependencyIndexes: file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs, FilesRegistry: protoregistry.GlobalFiles, TypesRegistry: protoregistry.GlobalTypes, }.Init() - xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc = nil - xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = nil - xxx_File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = nil + file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc = nil + file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = nil + file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = nil } diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index 60fdf29123..c4df1c4c4c 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -22,7 +22,7 @@ type CodeGeneratorResponse_File = plugin.CodeGeneratorResponse_File var File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto protoreflect.FileDescriptor -var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc = []byte{ +var file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc = []byte{ 0x0a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, @@ -37,33 +37,33 @@ var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDes } var ( - xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc_once sync.Once - xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc + file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescOnce sync.Once + file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescData = file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc ) -func xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescGZIP() []byte { - xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc_once.Do(func() { - xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc_data) +func file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescGZIP() []byte { + file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescOnce.Do(func() { + file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescData) }) - return xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc_data + return file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescData } -var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = []interface{}{} -var xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = []interface{}{} +var file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = []int32{} -func init() { xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init() } -func xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init() { +func init() { file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init() } +func file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init() { if File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto != nil { return } File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc, - GoTypes: xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes, - DependencyIndexes: xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs, + RawDescriptor: file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc, + GoTypes: file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes, + DependencyIndexes: file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs, FilesRegistry: protoregistry.GlobalFiles, TypesRegistry: protoregistry.GlobalTypes, }.Init() - xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc = nil - xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = nil - xxx_File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = nil + file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc = nil + file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = nil + file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = nil } diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index 4fee3bf754..e3a390fe2b 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -19,7 +19,7 @@ type Any = known.Any var File_github_com_golang_protobuf_ptypes_any_any_proto protoreflect.FileDescriptor -var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = []byte{ +var file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = []byte{ 0x0a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, @@ -32,33 +32,33 @@ var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = []byte{ } var ( - xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc_once sync.Once - xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc + file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescOnce sync.Once + file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescData = file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc ) -func xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDescGZIP() []byte { - xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc_once.Do(func() { - xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc_data) +func file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescGZIP() []byte { + file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescOnce.Do(func() { + file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescData) }) - return xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc_data + return file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescData } -var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = []interface{}{} -var xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = []interface{}{} +var file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{} -func init() { xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_init() } -func xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_init() { +func init() { file_github_com_golang_protobuf_ptypes_any_any_proto_init() } +func file_github_com_golang_protobuf_ptypes_any_any_proto_init() { if File_github_com_golang_protobuf_ptypes_any_any_proto != nil { return } File_github_com_golang_protobuf_ptypes_any_any_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc, - GoTypes: xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_goTypes, - DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs, + RawDescriptor: file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc, + GoTypes: file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes, + DependencyIndexes: file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs, FilesRegistry: protoregistry.GlobalFiles, TypesRegistry: protoregistry.GlobalTypes, }.Init() - xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = nil - xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = nil - xxx_File_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = nil + file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = nil + file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = nil + file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = nil } diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index b173a1dc57..25f853fa90 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -19,7 +19,7 @@ type Duration = known.Duration var File_github_com_golang_protobuf_ptypes_duration_duration_proto protoreflect.FileDescriptor -var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = []byte{ +var file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = []byte{ 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x64, 0x75, 0x72, @@ -33,33 +33,33 @@ var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = } var ( - xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc_once sync.Once - xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc + file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescOnce sync.Once + file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescData = file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc ) -func xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescGZIP() []byte { - xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc_once.Do(func() { - xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc_data) +func file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescGZIP() []byte { + file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescOnce.Do(func() { + file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescData) }) - return xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc_data + return file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescData } -var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = []interface{}{} -var xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = []interface{}{} +var file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = []int32{} -func init() { xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_init() } -func xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_init() { +func init() { file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() } +func file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() { if File_github_com_golang_protobuf_ptypes_duration_duration_proto != nil { return } File_github_com_golang_protobuf_ptypes_duration_duration_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc, - GoTypes: xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes, - DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs, + RawDescriptor: file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc, + GoTypes: file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes, + DependencyIndexes: file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs, FilesRegistry: protoregistry.GlobalFiles, TypesRegistry: protoregistry.GlobalTypes, }.Init() - xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = nil - xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = nil - xxx_File_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = nil + file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = nil + file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = nil + file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = nil } diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index a2fa06a0e9..75e2b50ac1 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -19,7 +19,7 @@ type Empty = known.Empty var File_github_com_golang_protobuf_ptypes_empty_empty_proto protoreflect.FileDescriptor -var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc = []byte{ +var file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc = []byte{ 0x0a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, @@ -32,33 +32,33 @@ var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc = []byt } var ( - xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc_once sync.Once - xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc + file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescOnce sync.Once + file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescData = file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc ) -func xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescGZIP() []byte { - xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc_once.Do(func() { - xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc_data) +func file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescGZIP() []byte { + file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescOnce.Do(func() { + file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescData) }) - return xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc_data + return file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescData } -var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = []interface{}{} -var xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = []interface{}{} +var file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = []int32{} -func init() { xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_init() } -func xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_init() { +func init() { file_github_com_golang_protobuf_ptypes_empty_empty_proto_init() } +func file_github_com_golang_protobuf_ptypes_empty_empty_proto_init() { if File_github_com_golang_protobuf_ptypes_empty_empty_proto != nil { return } File_github_com_golang_protobuf_ptypes_empty_empty_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc, - GoTypes: xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes, - DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs, + RawDescriptor: file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc, + GoTypes: file_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes, + DependencyIndexes: file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs, FilesRegistry: protoregistry.GlobalFiles, TypesRegistry: protoregistry.GlobalTypes, }.Init() - xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc = nil - xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = nil - xxx_File_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = nil + file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc = nil + file_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = nil + file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = nil } diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index 3f848ef1e6..755052c18f 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -34,7 +34,7 @@ type ListValue = known.ListValue var File_github_com_golang_protobuf_ptypes_struct_struct_proto protoreflect.FileDescriptor -var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc = []byte{ +var file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc = []byte{ 0x0a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, @@ -48,33 +48,33 @@ var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc = []b } var ( - xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc_once sync.Once - xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc + file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescOnce sync.Once + file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescData = file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc ) -func xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescGZIP() []byte { - xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc_once.Do(func() { - xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc_data) +func file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescGZIP() []byte { + file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescOnce.Do(func() { + file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescData) }) - return xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc_data + return file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescData } -var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = []interface{}{} -var xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = []interface{}{} +var file_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = []int32{} -func init() { xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_init() } -func xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_init() { +func init() { file_github_com_golang_protobuf_ptypes_struct_struct_proto_init() } +func file_github_com_golang_protobuf_ptypes_struct_struct_proto_init() { if File_github_com_golang_protobuf_ptypes_struct_struct_proto != nil { return } File_github_com_golang_protobuf_ptypes_struct_struct_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc, - GoTypes: xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes, - DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs, + RawDescriptor: file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc, + GoTypes: file_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes, + DependencyIndexes: file_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs, FilesRegistry: protoregistry.GlobalFiles, TypesRegistry: protoregistry.GlobalTypes, }.Init() - xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc = nil - xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = nil - xxx_File_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = nil + file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc = nil + file_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = nil + file_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = nil } diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index b4c4abe9f3..dd5c401acb 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -19,7 +19,7 @@ type Timestamp = known.Timestamp var File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto protoreflect.FileDescriptor -var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = []byte{ +var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = []byte{ 0x0a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2f, 0x74, 0x69, @@ -34,33 +34,33 @@ var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc } var ( - xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc_once sync.Once - xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc + file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescOnce sync.Once + file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescData = file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc ) -func xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescGZIP() []byte { - xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc_once.Do(func() { - xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc_data) +func file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescGZIP() []byte { + file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescOnce.Do(func() { + file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescData) }) - return xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc_data + return file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescData } -var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = []interface{}{} -var xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = []interface{}{} +var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = []int32{} -func init() { xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() } -func xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() { +func init() { file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() } +func file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() { if File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto != nil { return } File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc, - GoTypes: xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes, - DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs, + RawDescriptor: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc, + GoTypes: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes, + DependencyIndexes: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs, FilesRegistry: protoregistry.GlobalFiles, TypesRegistry: protoregistry.GlobalTypes, }.Init() - xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = nil - xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = nil - xxx_File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = nil + file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = nil + file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = nil + file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = nil } diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index 9c70983304..c2ee85a26f 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -27,7 +27,7 @@ type BytesValue = known.BytesValue var File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto protoreflect.FileDescriptor -var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc = []byte{ +var file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc = []byte{ 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2f, 0x77, 0x72, 0x61, @@ -41,33 +41,33 @@ var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc = } var ( - xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc_once sync.Once - xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc_data = xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc + file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescOnce sync.Once + file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescData = file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc ) -func xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescGZIP() []byte { - xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc_once.Do(func() { - xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc_data = protoimpl.X.CompressGZIP(xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc_data) +func file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescGZIP() []byte { + file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescOnce.Do(func() { + file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescData) }) - return xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc_data + return file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescData } -var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = []interface{}{} -var xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = []interface{}{} +var file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = []int32{} -func init() { xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() } -func xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() { +func init() { file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() } +func file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() { if File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto != nil { return } File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto = protoimpl.FileBuilder{ - RawDescriptor: xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc, - GoTypes: xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes, - DependencyIndexes: xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs, + RawDescriptor: file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc, + GoTypes: file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes, + DependencyIndexes: file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs, FilesRegistry: protoregistry.GlobalFiles, TypesRegistry: protoregistry.GlobalTypes, }.Init() - xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc = nil - xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = nil - xxx_File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = nil + file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc = nil + file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = nil + file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = nil } From 2b4f3c98b458235b1563a07326ee91358f445bd3 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 17 Apr 2019 18:11:15 -0700 Subject: [PATCH 062/133] internal/proto: rename method calls CL/172238 renames some protoreflect methods. Make equivalent changes in v1. Change-Id: Iaa9af9adf864edefeb4d5ec7670efe07290f2890 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/172582 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 +++- internal/proto/defaults.go | 2 +- internal/proto/discard.go | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 38299adc03..eba613e1c7 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/golang/protobuf -require github.com/golang/protobuf/v2 v2.0.0-20190416222953-ab61d41ec93f +require github.com/golang/protobuf/v2 v2.0.0-20190420063524-d24bc72368a2 diff --git a/go.sum b/go.sum index 8931984874..d5b74bf97b 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,9 @@ github.com/golang/protobuf v1.2.1-0.20190322195920-d94fb84e04b7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.1-0.20190326022002-be03c15fcaa2/go.mod h1:rZ4veVXHB1S2+o7TKqD9Isxml062IeDutnCDtFPUlCc= +github.com/golang/protobuf v1.2.1-0.20190416233244-13cf6e79fd39/go.mod h1:RgnTNLHWo9HXezTFX5MTeuXnXx9eeQX8y3Cukv+9HaE= github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e/go.mod h1:25ZALhydMFaBRgPH58a8zpFe9YXMAMjOYWtB6pNPcoo= -github.com/golang/protobuf/v2 v2.0.0-20190416222953-ab61d41ec93f h1:/ykGaIiod920llcsrLlxw+U2sJkPdzwWF+zABcffzHc= github.com/golang/protobuf/v2 v2.0.0-20190416222953-ab61d41ec93f/go.mod h1:baUT2weUsA1MR7ocRtLXLmi2B1s4VrUT3S6tO8AYzMw= +github.com/golang/protobuf/v2 v2.0.0-20190420063524-d24bc72368a2 h1:Tp4FhirEYFiZdhirylriHTC/4tGUz3j1r96XDMpYaAQ= +github.com/golang/protobuf/v2 v2.0.0-20190420063524-d24bc72368a2/go.mod h1:wcEMLTNPNYxBFS3yY7kunR0QKUgP/f+wzZaPeTbHi0g= github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42 h1:q3pnF5JFBNRz8sRD+IRj7Y6DMyYGTNqnZ9axTbSfoNI= github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= diff --git a/internal/proto/defaults.go b/internal/proto/defaults.go index 580d76252d..c2a00770c1 100644 --- a/internal/proto/defaults.go +++ b/internal/proto/defaults.go @@ -49,7 +49,7 @@ func setDefaults(m pref.Message) { } // Handle map of messages. default: - k := fd.MessageType().Fields().ByNumber(2).Kind() + k := fd.Message().Fields().ByNumber(2).Kind() if k == pref.MessageKind || k == pref.GroupKind { ms := knownFields.Get(num).Map() ms.Range(func(_ pref.MapKey, v pref.Value) bool { diff --git a/internal/proto/discard.go b/internal/proto/discard.go index f995cad702..2bb01283ac 100644 --- a/internal/proto/discard.go +++ b/internal/proto/discard.go @@ -51,7 +51,7 @@ func discardUnknown(m pref.Message) { } // Handle map of messages. default: - k := fd.MessageType().Fields().ByNumber(2).Kind() + k := fd.Message().Fields().ByNumber(2).Kind() if k == pref.MessageKind || k == pref.GroupKind { ms := knownFields.Get(num).Map() ms.Range(func(_ pref.MapKey, v pref.Value) bool { From 911a20d792529e6511c108e81e0e09986d9907fe Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 6 May 2019 22:56:31 -0700 Subject: [PATCH 063/133] proto: use XXX_unrecognized exclusively for unknown fields The protobuf data model makes no distinction between unknown fields that are within the extension field ranges or not. Now that we eagerly unmarshal extensions, there is even less need for storing unknown fields in the extension map. Instead, use the XXX_unrecognized field exclusively for this purpose. To support this logic, we fork the v2 internal/encoding/wire package. This is a temporary measure since the v1 code will be completely re-written in terms of the v2 API in the near future. Change-Id: I3dadd04ec2314e6d245d46f6329383bb9e0d00f7 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/175580 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 +- internal/wire/wire.go | 516 ++++++++++++++++++++++++++++++++++++++ proto/clone.go | 4 - proto/equal.go | 43 +--- proto/extensions.go | 99 ++++++-- proto/extensions_test.go | 12 - proto/message_set.go | 24 +- proto/message_set_test.go | 10 +- proto/table_marshal.go | 108 +++++--- proto/table_unmarshal.go | 112 +++++---- proto/text.go | 5 - 12 files changed, 759 insertions(+), 180 deletions(-) create mode 100644 internal/wire/wire.go diff --git a/go.mod b/go.mod index eba613e1c7..dc095b7e90 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/golang/protobuf -require github.com/golang/protobuf/v2 v2.0.0-20190420063524-d24bc72368a2 +require github.com/golang/protobuf/v2 v2.0.0-20190509012650-00a323deed55 diff --git a/go.sum b/go.sum index d5b74bf97b..eb5c8d9cc3 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,11 @@ github.com/golang/protobuf v1.2.1-0.20190322195920-d94fb84e04b7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.1-0.20190326022002-be03c15fcaa2/go.mod h1:rZ4veVXHB1S2+o7TKqD9Isxml062IeDutnCDtFPUlCc= github.com/golang/protobuf v1.2.1-0.20190416233244-13cf6e79fd39/go.mod h1:RgnTNLHWo9HXezTFX5MTeuXnXx9eeQX8y3Cukv+9HaE= +github.com/golang/protobuf v1.2.1-0.20190420064300-2b4f3c98b458/go.mod h1:hPB+itxf2EbA0J6prVtJg+ohMeLFLEhlSXXPS2qxTZE= github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e/go.mod h1:25ZALhydMFaBRgPH58a8zpFe9YXMAMjOYWtB6pNPcoo= github.com/golang/protobuf/v2 v2.0.0-20190416222953-ab61d41ec93f/go.mod h1:baUT2weUsA1MR7ocRtLXLmi2B1s4VrUT3S6tO8AYzMw= -github.com/golang/protobuf/v2 v2.0.0-20190420063524-d24bc72368a2 h1:Tp4FhirEYFiZdhirylriHTC/4tGUz3j1r96XDMpYaAQ= github.com/golang/protobuf/v2 v2.0.0-20190420063524-d24bc72368a2/go.mod h1:wcEMLTNPNYxBFS3yY7kunR0QKUgP/f+wzZaPeTbHi0g= +github.com/golang/protobuf/v2 v2.0.0-20190509012650-00a323deed55 h1:zd+Y1Z1XtROfzk20h4yfXgURDkZ13m1dCC1aoaA/T6c= +github.com/golang/protobuf/v2 v2.0.0-20190509012650-00a323deed55/go.mod h1:pWnbrfE+N2TBYiklDHixM32oa26kuZCiJwxIu0DAl7Y= github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42 h1:q3pnF5JFBNRz8sRD+IRj7Y6DMyYGTNqnZ9axTbSfoNI= github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= diff --git a/internal/wire/wire.go b/internal/wire/wire.go new file mode 100644 index 0000000000..8f97078d24 --- /dev/null +++ b/internal/wire/wire.go @@ -0,0 +1,516 @@ +// 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 wire parses and formats the protobuf wire encoding. +// +// See https://developers.google.com/protocol-buffers/docs/encoding. +package wire + +import ( + "errors" + "io" + "math" + "math/bits" + + "github.com/golang/protobuf/v2/reflect/protoreflect" +) + +// Number represents the field number. +type Number = protoreflect.FieldNumber + +const ( + MinValidNumber Number = 1 + FirstReservedNumber Number = 19000 + LastReservedNumber Number = 19999 + MaxValidNumber Number = 1<<29 - 1 +) + +// Type represents the wire type. +type Type int8 + +const ( + VarintType Type = 0 + Fixed32Type Type = 5 + Fixed64Type Type = 1 + BytesType Type = 2 + StartGroupType Type = 3 + EndGroupType Type = 4 +) + +const ( + _ = -iota + errCodeTruncated + errCodeFieldNumber + errCodeOverflow + errCodeReserved + errCodeEndGroup +) + +var ( + errFieldNumber = errors.New("invalid field number") + errOverflow = errors.New("variable length integer overflow") + errReserved = errors.New("cannot parse reserved wire type") + errEndGroup = errors.New("mismatching end group marker") + errParse = errors.New("parse error") +) + +// ParseError converts an error code into an error value. +// This returns nil if n is a non-negative number. +func ParseError(n int) error { + if n >= 0 { + return nil + } + switch n { + case errCodeTruncated: + return io.ErrUnexpectedEOF + case errCodeFieldNumber: + return errFieldNumber + case errCodeOverflow: + return errOverflow + case errCodeReserved: + return errReserved + case errCodeEndGroup: + return errEndGroup + default: + return errParse + } +} + +// ConsumeField parses an entire field record (both tag and value) and returns +// the field number, the wire type, and the total length. +// This returns a negative length upon an error (see ParseError). +// +// The total length includes the tag header and the end group marker (if the +// field is a group). +func ConsumeField(b []byte) (Number, Type, int) { + num, typ, n := ConsumeTag(b) + if n < 0 { + return 0, 0, n // forward error code + } + m := ConsumeFieldValue(num, typ, b[n:]) + if m < 0 { + return 0, 0, m // forward error code + } + return num, typ, n + m +} + +// ConsumeFieldValue parses a field value and returns its length. +// This assumes that the field Number and wire Type have already been parsed. +// This returns a negative length upon an error (see ParseError). +// +// When parsing a group, the length includes the end group marker and +// the end group is verified to match the starting field number. +func ConsumeFieldValue(num Number, typ Type, b []byte) (n int) { + switch typ { + case VarintType: + _, n = ConsumeVarint(b) + return n + case Fixed32Type: + _, n = ConsumeFixed32(b) + return n + case Fixed64Type: + _, n = ConsumeFixed64(b) + return n + case BytesType: + _, n = ConsumeBytes(b) + return n + case StartGroupType: + n0 := len(b) + for { + num2, typ2, n := ConsumeTag(b) + if n < 0 { + return n // forward error code + } + b = b[n:] + if typ2 == EndGroupType { + if num != num2 { + return errCodeEndGroup + } + return n0 - len(b) + } + + n = ConsumeFieldValue(num2, typ2, b) + if n < 0 { + return n // forward error code + } + b = b[n:] + } + case EndGroupType: + return errCodeEndGroup + default: + return errCodeReserved + } +} + +// AppendTag encodes num and typ as a varint-encoded tag and appends it to b. +func AppendTag(b []byte, num Number, typ Type) []byte { + return AppendVarint(b, EncodeTag(num, typ)) +} + +// ConsumeTag parses b as a varint-encoded tag, reporting its length. +// This returns a negative length upon an error (see ParseError). +func ConsumeTag(b []byte) (Number, Type, int) { + v, n := ConsumeVarint(b) + if n < 0 { + return 0, 0, n // forward error code + } + num, typ := DecodeTag(v) + if num < MinValidNumber { + return 0, 0, errCodeFieldNumber + } + return num, typ, n +} + +func SizeTag(num Number) int { + return SizeVarint(EncodeTag(num, 0)) // wire type has no effect on size +} + +// AppendVarint appends v to b as a varint-encoded uint64. +func AppendVarint(b []byte, v uint64) []byte { + // TODO: Specialize for sizes 1 and 2 with mid-stack inlining. + switch { + case v < 1<<7: + b = append(b, byte(v)) + case v < 1<<14: + b = append(b, + byte((v>>0)&0x7f|0x80), + byte(v>>7)) + case v < 1<<21: + b = append(b, + byte((v>>0)&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte(v>>14)) + case v < 1<<28: + b = append(b, + byte((v>>0)&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte(v>>21)) + case v < 1<<35: + b = append(b, + byte((v>>0)&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte(v>>28)) + case v < 1<<42: + b = append(b, + byte((v>>0)&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte(v>>35)) + case v < 1<<49: + b = append(b, + byte((v>>0)&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte(v>>42)) + case v < 1<<56: + b = append(b, + byte((v>>0)&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte((v>>42)&0x7f|0x80), + byte(v>>49)) + case v < 1<<63: + b = append(b, + byte((v>>0)&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte((v>>42)&0x7f|0x80), + byte((v>>49)&0x7f|0x80), + byte(v>>56)) + default: + b = append(b, + byte((v>>0)&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte((v>>42)&0x7f|0x80), + byte((v>>49)&0x7f|0x80), + byte((v>>56)&0x7f|0x80), + 1) + } + return b +} + +// ConsumeVarint parses b as a varint-encoded uint64, reporting its length. +// This returns a negative length upon an error (see ParseError). +func ConsumeVarint(b []byte) (v uint64, n int) { + // TODO: Specialize for sizes 1 and 2 with mid-stack inlining. + var y uint64 + if len(b) <= 0 { + return 0, errCodeTruncated + } + v = uint64(b[0]) + if v < 0x80 { + return v, 1 + } + v -= 0x80 + + if len(b) <= 1 { + return 0, errCodeTruncated + } + y = uint64(b[1]) + v += y << 7 + if y < 0x80 { + return v, 2 + } + v -= 0x80 << 7 + + if len(b) <= 2 { + return 0, errCodeTruncated + } + y = uint64(b[2]) + v += y << 14 + if y < 0x80 { + return v, 3 + } + v -= 0x80 << 14 + + if len(b) <= 3 { + return 0, errCodeTruncated + } + y = uint64(b[3]) + v += y << 21 + if y < 0x80 { + return v, 4 + } + v -= 0x80 << 21 + + if len(b) <= 4 { + return 0, errCodeTruncated + } + y = uint64(b[4]) + v += y << 28 + if y < 0x80 { + return v, 5 + } + v -= 0x80 << 28 + + if len(b) <= 5 { + return 0, errCodeTruncated + } + y = uint64(b[5]) + v += y << 35 + if y < 0x80 { + return v, 6 + } + v -= 0x80 << 35 + + if len(b) <= 6 { + return 0, errCodeTruncated + } + y = uint64(b[6]) + v += y << 42 + if y < 0x80 { + return v, 7 + } + v -= 0x80 << 42 + + if len(b) <= 7 { + return 0, errCodeTruncated + } + y = uint64(b[7]) + v += y << 49 + if y < 0x80 { + return v, 8 + } + v -= 0x80 << 49 + + if len(b) <= 8 { + return 0, errCodeTruncated + } + y = uint64(b[8]) + v += y << 56 + if y < 0x80 { + return v, 9 + } + v -= 0x80 << 56 + + if len(b) <= 9 { + return 0, errCodeTruncated + } + y = uint64(b[9]) + v += y << 63 + if y < 2 { + return v, 10 + } + return 0, errCodeOverflow +} + +// SizeVarint returns the encoded size of a varint. +// The size is guaranteed to be within 1 and 10, inclusive. +func SizeVarint(v uint64) int { + return 1 + (bits.Len64(v)-1)/7 +} + +// AppendFixed32 appends v to b as a little-endian uint32. +func AppendFixed32(b []byte, v uint32) []byte { + return append(b, + byte(v>>0), + byte(v>>8), + byte(v>>16), + byte(v>>24)) +} + +// ConsumeFixed32 parses b as a little-endian uint32, reporting its length. +// This returns a negative length upon an error (see ParseError). +func ConsumeFixed32(b []byte) (v uint32, n int) { + if len(b) < 4 { + return 0, errCodeTruncated + } + v = uint32(b[0])<<0 | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 + return v, 4 +} + +// SizeFixed32 returns the encoded size of a fixed32; which is always 4. +func SizeFixed32() int { + return 4 +} + +// AppendFixed64 appends v to b as a little-endian uint64. +func AppendFixed64(b []byte, v uint64) []byte { + return append(b, + byte(v>>0), + byte(v>>8), + byte(v>>16), + byte(v>>24), + byte(v>>32), + byte(v>>40), + byte(v>>48), + byte(v>>56)) +} + +// ConsumeFixed64 parses b as a little-endian uint64, reporting its length. +// This returns a negative length upon an error (see ParseError). +func ConsumeFixed64(b []byte) (v uint64, n int) { + if len(b) < 8 { + return 0, errCodeTruncated + } + v = uint64(b[0])<<0 | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + return v, 8 +} + +// SizeFixed64 returns the encoded size of a fixed64; which is always 8. +func SizeFixed64() int { + return 8 +} + +// AppendBytes appends v to b as a length-prefixed bytes value. +func AppendBytes(b []byte, v []byte) []byte { + return append(AppendVarint(b, uint64(len(v))), v...) +} + +// ConsumeBytes parses b as a length-prefixed bytes value, reporting its length. +// This returns a negative length upon an error (see ParseError). +func ConsumeBytes(b []byte) (v []byte, n int) { + m, n := ConsumeVarint(b) + if n < 0 { + return nil, n // forward error code + } + if m > uint64(len(b[n:])) { + return nil, errCodeTruncated + } + return b[n:][:m], n + int(m) +} + +// SizeBytes returns the encoded size of a length-prefixed bytes value, +// given only the length. +func SizeBytes(n int) int { + return SizeVarint(uint64(n)) + n +} + +// AppendGroup appends v to b as group value, with a trailing end group marker. +// The value v must not contain the end marker. +func AppendGroup(b []byte, num Number, v []byte) []byte { + return AppendVarint(append(b, v...), EncodeTag(num, EndGroupType)) +} + +// ConsumeGroup parses b as a group value until the trailing end group marker, +// and verifies that the end marker matches the provided num. The value v +// does not contain the end marker, while the length does contain the end marker. +// This returns a negative length upon an error (see ParseError). +func ConsumeGroup(num Number, b []byte) (v []byte, n int) { + n = ConsumeFieldValue(num, StartGroupType, b) + if n < 0 { + return nil, n // forward error code + } + b = b[:n] + + // Truncate off end group marker, but need to handle denormalized varints. + // Assuming end marker is never 0 (which is always the case since + // EndGroupType is non-zero), we can truncate all trailing bytes where the + // lower 7 bits are all zero (implying that the varint is denormalized). + for len(b) > 0 && b[len(b)-1]&0x7f == 0 { + b = b[:len(b)-1] + } + b = b[:len(b)-SizeTag(num)] + return b, n +} + +// SizeGroup returns the encoded size of a group, given only the length. +func SizeGroup(num Number, n int) int { + return n + SizeTag(num) +} + +// DecodeTag decodes the field Number and wire Type from its unified form. +// The Number is -1 if the decoded field number overflows. +// Other than overflow, this does not check for field number validity. +func DecodeTag(x uint64) (Number, Type) { + // NOTE: MessageSet allows for larger field numbers than normal. + if x>>3 > uint64(math.MaxInt32) { + return -1, 0 + } + return Number(x >> 3), Type(x & 7) +} + +// EncodeTag encodes the field Number and wire Type into its unified form. +func EncodeTag(num Number, typ Type) uint64 { + return uint64(num)<<3 | uint64(typ&7) +} + +// DecodeZigZag decodes a zig-zag-encoded uint64 as an int64. +// Input: {…, 5, 3, 1, 0, 2, 4, 6, …} +// Output: {…, -3, -2, -1, 0, +1, +2, +3, …} +func DecodeZigZag(x uint64) int64 { + return int64(x>>1) ^ int64(x)<<63>>63 +} + +// EncodeZigZag encodes an int64 as a zig-zag-encoded uint64. +// Input: {…, -3, -2, -1, 0, +1, +2, +3, …} +// Output: {…, 5, 3, 1, 0, 2, 4, 6, …} +func EncodeZigZag(x int64) uint64 { + return uint64(x<<1) ^ uint64(x>>63) +} + +// DecodeBool decodes a uint64 as a bool. +// Input: { 0, 1, 2, …} +// Output: {false, true, true, …} +func DecodeBool(x uint64) bool { + return x != 0 +} + +// EncodeBool encodes a bool as a uint64. +// Input: {false, true} +// Output: { 0, 1} +func EncodeBool(x bool) uint64 { + if x { + return 1 + } + return 0 +} diff --git a/proto/clone.go b/proto/clone.go index 4b9f099e50..a9b9868c14 100644 --- a/proto/clone.go +++ b/proto/clone.go @@ -214,10 +214,6 @@ func mergeExtension(out, in *extensionMap) { mergeAny(v, reflect.ValueOf(eIn.Value), false, nil) eOut.Value = v.Interface() } - if eIn.Raw != nil { - eOut.Raw = make([]byte, len(eIn.Raw)) - copy(eOut.Raw, eIn.Raw) - } out.Set(extNum, eOut) return true diff --git a/proto/equal.go b/proto/equal.go index 29c28059d5..49b9eee5da 100644 --- a/proto/equal.go +++ b/proto/equal.go @@ -223,12 +223,7 @@ func equalExtensions(base reflect.Type, em1, em2 *extensionMap) bool { m2 := extensionAsLegacyType(e2.Value) if m1 == nil && m2 == nil { - // Both have only encoded form. - if bytes.Equal(e1.Raw, e2.Raw) { - return true - } - // The bytes are different, but the extensions might still be - // equal. We need to decode them to compare. + return true } if m1 != nil && m2 != nil { @@ -240,40 +235,8 @@ func equalExtensions(base reflect.Type, em1, em2 *extensionMap) bool { return true } - // At least one is encoded. To do a semantically correct comparison - // we need to unmarshal them first. - var desc *ExtensionDesc - mz := reflect.Zero(reflect.PtrTo(base)).Interface().(Message) - if m := RegisteredExtensions(mz); m != nil { - desc = m[int32(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) - equal = false - return false - } - var err error - if m1 == nil { - m1, err = decodeExtension(e1.Raw, desc) - } - if m2 == nil && err == nil { - m2, err = decodeExtension(e2.Raw, desc) - } - if err != nil { - // The encoded form is invalid. - log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err) - equal = false - return false - } - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - equal = false - return false - } - return true + equal = false + return false }) return equal diff --git a/proto/extensions.go b/proto/extensions.go index 62b3cfdabf..e45867d687 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -15,6 +15,7 @@ import ( "reflect" "sync" + "github.com/golang/protobuf/internal/wire" "github.com/golang/protobuf/v2/reflect/protoreflect" "github.com/golang/protobuf/v2/runtime/protoiface" "github.com/golang/protobuf/v2/runtime/protoimpl" @@ -97,11 +98,38 @@ func isRepeatedExtension(ed *ExtensionDesc) bool { // SetRawExtension is for testing only. func SetRawExtension(base Message, id int32, b []byte) { - epb, err := extendable(base) - if err != nil { + v := reflect.ValueOf(base) + if !v.IsValid() || v.Kind() != reflect.Ptr || v.IsNil() || v.Elem().Kind() != reflect.Struct { + return + } + v = v.Elem().FieldByName("XXX_unrecognized") + if !v.IsValid() { return } - epb.Set(protoreflect.FieldNumber(id), Extension{Raw: b}) + + // Verify that the raw field is valid. + for b0 := b; len(b0) > 0; { + fieldNum, _, n := wire.ConsumeField(b0) + if int32(fieldNum) != id { + panic(fmt.Sprintf("mismatching field number: got %d, want %d", fieldNum, id)) + } + b0 = b0[n:] + } + + fnum := protoreflect.FieldNumber(id) + v.SetBytes(append(removeRawFields(v.Bytes(), fnum), b...)) +} + +func removeRawFields(b []byte, fnum protoreflect.FieldNumber) []byte { + out := b[:0] + for len(b) > 0 { + got, _, n := wire.ConsumeField(b) + if got != fnum { + out = append(out, b[:n]...) + } + b = b[n:] + } + return out } // isExtensionField returns true iff the given field number is in an extension range. @@ -172,13 +200,24 @@ func extensionProperties(pb Message, ed *ExtensionDesc) *Properties { func HasExtension(pb Message, extension *ExtensionDesc) bool { // TODO: Check types, field numbers, etc.? epb, err := extendable(pb) - if err != nil { + if err != nil || epb == nil { return false } - if epb == nil { - return false + if epb.Has(protoreflect.FieldNumber(extension.Field)) { + return true } - return epb.Has(protoreflect.FieldNumber(extension.Field)) + + // Check whether this field exists in raw form. + unrecognized := reflect.ValueOf(pb).Elem().FieldByName("XXX_unrecognized") + fnum := protoreflect.FieldNumber(extension.Field) + for b := unrecognized.Bytes(); len(b) > 0; { + got, _, n := wire.ConsumeField(b) + if got == fnum { + return true + } + b = b[n:] + } + return false } // ClearExtension removes the given extension from pb. @@ -211,16 +250,24 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { return nil, err } - if epb == nil { - return defaultExtensionValue(pb, extension) + unrecognized := reflect.ValueOf(pb).Elem().FieldByName("XXX_unrecognized") + var out []byte + fnum := protoreflect.FieldNumber(extension.Field) + for b := unrecognized.Bytes(); len(b) > 0; { + got, _, n := wire.ConsumeField(b) + if got == fnum { + out = append(out, b[:n]...) + } + b = b[n:] } - if !epb.Has(protoreflect.FieldNumber(extension.Field)) { + + if !epb.Has(protoreflect.FieldNumber(extension.Field)) && len(out) == 0 { // defaultExtensionValue returns the default value or // ErrMissingExtension if there is no default. return defaultExtensionValue(pb, extension) } - e := epb.Get(protoreflect.FieldNumber(extension.Field)) + e := epb.Get(protoreflect.FieldNumber(extension.Field)) if e.Value != nil { // Already decoded. Check the descriptor, though. if e.Desc != extension { @@ -232,12 +279,13 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { return extensionAsLegacyType(e.Value), nil } + // Descriptor without type information. if extension.ExtensionType == nil { - // incomplete descriptor - return e.Raw, nil + return out, nil } - v, err := decodeExtension(e.Raw, extension) + // TODO: Remove this logic for automatically unmarshaling the unknown fields. + v, err := decodeExtension(out, extension) if err != nil { return nil, err } @@ -246,7 +294,7 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { // That way it is safe to mutate what we return. e.Value = extensionAsStorageType(v) e.Desc = extension - e.Raw = nil + unrecognized.SetBytes(removeRawFields(unrecognized.Bytes(), fnum)) epb.Set(protoreflect.FieldNumber(extension.Field), e) return extensionAsLegacyType(e.Value), nil } @@ -367,6 +415,27 @@ func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { extensions = append(extensions, desc) return true }) + + unrecognized := reflect.ValueOf(pb).Elem().FieldByName("XXX_unrecognized") + if b := unrecognized.Bytes(); len(b) > 0 { + fieldNums := make(map[int32]bool) + for len(b) > 0 { + fnum, _, n := wire.ConsumeField(b) + if isExtensionField(pb, int32(fnum)) { + fieldNums[int32(fnum)] = true + } + b = b[n:] + } + + for id := range fieldNums { + desc := registeredExtensions[id] + if desc == nil { + desc = &ExtensionDesc{Field: id} + } + extensions = append(extensions, desc) + } + } + return extensions, nil } diff --git a/proto/extensions_test.go b/proto/extensions_test.go index 13d419bf70..044aaf4a64 100644 --- a/proto/extensions_test.go +++ b/proto/extensions_test.go @@ -7,7 +7,6 @@ package proto_test import ( "bytes" "fmt" - "io" "reflect" "sort" "strings" @@ -39,17 +38,6 @@ func TestGetExtensionsWithMissingExtensions(t *testing.T) { } } -func TestGetExtensionWithEmptyBuffer(t *testing.T) { - // Make sure that GetExtension returns an error if its - // undecoded buffer is empty. - msg := &pb.MyMessage{} - proto.SetRawExtension(msg, pb.E_Ext_More.Field, []byte{}) - _, err := proto.GetExtension(msg, pb.E_Ext_More) - if want := io.ErrUnexpectedEOF; err != want { - t.Errorf("unexpected error in GetExtension from empty buffer: got %v, want %v", err, want) - } -} - func TestGetExtensionForIncompleteDesc(t *testing.T) { msg := &pb.MyMessage{Count: proto.Int32(0)} extdesc1 := &proto.ExtensionDesc{ diff --git a/proto/message_set.go b/proto/message_set.go index df3a8c1782..730ddb67e1 100644 --- a/proto/message_set.go +++ b/proto/message_set.go @@ -10,6 +10,7 @@ package proto import ( "errors" + "reflect" "github.com/golang/protobuf/v2/reflect/protoreflect" ) @@ -116,35 +117,24 @@ func skipVarint(buf []byte) []byte { // unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. // It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. -func unmarshalMessageSet(buf []byte, exts interface{}) error { - m := extensionFieldsOf(exts) - +func unmarshalMessageSet(buf []byte, mi Message, exts interface{}) error { ms := new(messageSet) if err := Unmarshal(buf, ms); err != nil { return err } + unrecognized := reflect.ValueOf(mi).Elem().FieldByName("XXX_unrecognized").Addr().Interface().(*[]byte) + for _, item := range ms.Item { id := protoreflect.FieldNumber(*item.TypeId) msg := item.Message // Restore wire type and field number varint, plus length varint. - // Be careful to preserve duplicate items. b := EncodeVarint(uint64(id)<<3 | WireBytes) - if m.Has(id) { - ext := m.Get(id) - - // Existing data; rip off the tag and length varint - // so we join the new data correctly. - // We can assume that ext.Raw is set because we are unmarshaling. - o := ext.Raw[len(b):] // skip wire type and field number - _, n := DecodeVarint(o) // calculate length of length varint - o = o[n:] // skip length varint - msg = append(o, msg...) // join old data and new data - } b = append(b, EncodeVarint(uint64(len(msg)))...) b = append(b, msg...) - m.Set(id, Extension{Raw: b}) + *unrecognized = append(*unrecognized, b...) } - return nil + + return unmarshalExtensions(mi, unrecognized) } diff --git a/proto/message_set_test.go b/proto/message_set_test.go index cabd44c8b9..a61e2b6c7a 100644 --- a/proto/message_set_test.go +++ b/proto/message_set_test.go @@ -38,13 +38,19 @@ func TestUnmarshalMessageSetWithDuplicate(t *testing.T) { Tag{1, StartGroup}, Message{ Tag{2, Varint}, Uvarint(12345), - Tag{3, Bytes}, Bytes("hoohah"), + Tag{3, Bytes}, Bytes("hoo"), + }, + Tag{1, EndGroup}, + Tag{1, StartGroup}, + Message{ + Tag{2, Varint}, Uvarint(12345), + Tag{3, Bytes}, Bytes("hah"), }, Tag{1, EndGroup}, } */ var want []byte - fmt.Sscanf("0b10b9601a06686f6f6861680c", "%x", &want) + fmt.Sscanf("0b10b9601a03686f6f0c0b10b9601a036861680c", "%x", &want) var m MyMessageSet if err := proto.Unmarshal(in, &m); err != nil { diff --git a/proto/table_marshal.go b/proto/table_marshal.go index a1bda5556e..b17cc35f1e 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -16,6 +16,7 @@ import ( "sync/atomic" "unicode/utf8" + "github.com/golang/protobuf/internal/wire" "github.com/golang/protobuf/v2/reflect/protoreflect" ) @@ -160,7 +161,7 @@ func (u *marshalInfo) size(ptr pointer) int { if u.extensions.IsValid() { e := ptr.offset(u.extensions).toExtensions() if u.messageset { - n += u.sizeMessageSet(e) + n += u.sizeMessageSet(e, *ptr.offset(u.unrecognized).toBytes()) } else { n += u.sizeExtensions(e) } @@ -169,7 +170,7 @@ func (u *marshalInfo) size(ptr pointer) int { m := *ptr.offset(u.v1extensions).toOldExtensions() n += u.sizeV1Extensions(m) } - if u.unrecognized.IsValid() { + if u.unrecognized.IsValid() && !u.messageset { s := *ptr.offset(u.unrecognized).toBytes() n += len(s) } @@ -212,7 +213,7 @@ func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte if u.extensions.IsValid() { e := ptr.offset(u.extensions).toExtensions() if u.messageset { - b, err = u.appendMessageSet(b, e, deterministic) + b, err = u.appendMessageSet(b, e, *ptr.offset(u.unrecognized).toBytes(), deterministic) } else { b, err = u.appendExtensions(b, e, deterministic) } @@ -266,7 +267,7 @@ func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte return b, err } } - if u.unrecognized.IsValid() { + if u.unrecognized.IsValid() && !u.messageset { s := *ptr.offset(u.unrecognized).toBytes() b = append(b, s...) } @@ -2373,9 +2374,7 @@ func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { n := 0 m.Range(func(_ protoreflect.FieldNumber, e Extension) bool { if e.Value == nil || e.Desc == nil { - // Extension is only in its encoded form. - n += len(e.Raw) - return true + return true // should never happen } // We don't skip extensions that have an encoded form set, @@ -2405,9 +2404,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de if m.Len() <= 1 { m.Range(func(_ protoreflect.FieldNumber, e Extension) bool { if e.Value == nil || e.Desc == nil { - // Extension is only in its encoded form. - b = append(b, e.Raw...) - return true + return true // should never happen } // We don't skip extensions that have an encoded form set, @@ -2439,9 +2436,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de for _, k := range keys { e := m.Get(protoreflect.FieldNumber(k)) if e.Value == nil || e.Desc == nil { - // Extension is only in its encoded form. - b = append(b, e.Raw...) - continue + continue // should never happen } // We don't skip extensions that have an encoded form set, @@ -2469,7 +2464,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de // sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field // in message set format (above). -func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { +func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions, unk []byte) int { m := extensionFieldsOf(ext) if m == nil { return 0 @@ -2481,11 +2476,7 @@ func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) if e.Value == nil || e.Desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.Raw) // skip old tag, but leave the length varint - siz := len(msgWithLen) - n += siz + 1 // message, tag = 3 (size=1) - return true + return true // should never happen } // We don't skip extensions that have an encoded form set, @@ -2498,12 +2489,29 @@ func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { n += ei.sizer(p, 1) // message, tag = 3 (size=1) return true }) + + // Extension is only in its encoded form. + for len(unk) > 0 { + id, _, fieldLen := wire.ConsumeField(unk) + if fieldLen < 0 { + break + } + + msgWithLen := skipVarint(unk[:fieldLen]) // skip old tag, but leave the length varint + siz := len(msgWithLen) + n += 2 // start group, end group. tag = 1 (size=1) + n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) + n += siz + 1 // message, tag = 3 (size=1) + + unk = unk[fieldLen:] + } + return n } // appendMessageSet marshals a XXX_InternalExtensions field in message set format (above) // to the end of byte slice b. -func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { +func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, unk []byte, deterministic bool) ([]byte, error) { m := extensionFieldsOf(ext) if m == nil { return b, nil @@ -2521,12 +2529,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de b = appendVarint(b, uint64(id)) if e.Value == nil || e.Desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.Raw) // skip old tag, but leave the length varint - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - return true + return true // should never happen } // We don't skip extensions that have an encoded form set, @@ -2544,6 +2547,25 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de err = nerr.E return true }) + + // Extension is only in its encoded form. + for len(unk) > 0 { + id, _, fieldLen := wire.ConsumeField(unk) + if fieldLen < 0 { + return b, wire.ParseError(fieldLen) + } + + msgWithLen := skipVarint(unk[:fieldLen]) // skip old tag, but leave the length varint + b = append(b, 1<<3|WireStartGroup) + b = append(b, 2<<3|WireVarint) + b = appendVarint(b, uint64(id)) + b = append(b, 3<<3|WireBytes) + b = append(b, msgWithLen...) + b = append(b, 1<<3|WireEndGroup) + + unk = unk[fieldLen:] + } + return b, err } @@ -2562,12 +2584,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de b = appendVarint(b, uint64(id)) if e.Value == nil || e.Desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.Raw) // skip old tag, but leave the length varint - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - continue + continue // should never happen } // We don't skip extensions that have an encoded form set, @@ -2583,6 +2600,25 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de return b, err } } + + // Extension is only in its encoded form. + for len(unk) > 0 { + id, _, fieldLen := wire.ConsumeField(unk) + if fieldLen < 0 { + return b, wire.ParseError(fieldLen) + } + + msgWithLen := skipVarint(unk[:fieldLen]) // skip old tag, but leave the length varint + b = append(b, 1<<3|WireStartGroup) + b = append(b, 2<<3|WireVarint) + b = appendVarint(b, uint64(id)) + b = append(b, 3<<3|WireBytes) + b = append(b, msgWithLen...) + b = append(b, 1<<3|WireEndGroup) + + unk = unk[fieldLen:] + } + return b, nerr.E } @@ -2595,9 +2631,7 @@ func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { n := 0 for _, e := range m { if e.Value == nil || e.Desc == nil { - // Extension is only in its encoded form. - n += len(e.Raw) - continue + continue // should never happen } // We don't skip extensions that have an encoded form set, @@ -2630,9 +2664,7 @@ func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, determ for _, k := range keys { e := m[int32(k)] if e.Value == nil || e.Desc == nil { - // Extension is only in its encoded form. - b = append(b, e.Raw...) - continue + continue // should never happen } // We don't skip extensions that have an encoded form set, diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index 0db9068779..98ecb4bdb5 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -16,7 +16,7 @@ import ( "sync/atomic" "unicode/utf8" - "github.com/golang/protobuf/v2/reflect/protoreflect" + "github.com/golang/protobuf/internal/wire" ) // Unmarshal is the entry point from the generated .pb.go files. @@ -111,7 +111,7 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { u.computeUnmarshalInfo() } if u.isMessageSet { - return unmarshalMessageSet(b, m.offset(u.extensions).toExtensions()) + return unmarshalMessageSet(b, m.asPointerTo(u.typ).Interface().(Message), m.offset(u.extensions).toExtensions()) } var reqMask uint64 // bitmask of required fields we've seen. var errLater error @@ -187,26 +187,9 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { // Keep unrecognized data around. // maybe in extensions, maybe in the unrecognized field. z := m.offset(u.unrecognized).toBytes() - var emap *extensionMap - var e Extension for _, r := range u.extensionRanges { if uint64(r.Start) <= tag && tag <= uint64(r.End) { hasExtensions = true - if u.extensions.IsValid() { - mp := m.offset(u.extensions).toExtensions() - emap = extensionFieldsOf(mp) - e = emap.Get(protoreflect.FieldNumber(tag)) - z = &e.Raw - break - } - if u.oldExtensions.IsValid() { - p := m.offset(u.oldExtensions).toOldExtensions() - emap = extensionFieldsOf(p) - e = emap.Get(protoreflect.FieldNumber(tag)) - z = &e.Raw - break - } - panic("no extensions field available") } } @@ -219,37 +202,15 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { } *z = encodeVarint(*z, tag<<3|uint64(wire)) *z = append(*z, b0[:len(b0)-len(b)]...) - - if emap != nil { - emap.Set(protoreflect.FieldNumber(tag), e) - } } // If there were unknown extensions, eagerly unmarshal them. if hasExtensions { + var nerr nonFatal mi := m.asPointerTo(u.typ).Interface().(Message) - ep, _ := extendable(mi) - if ep != nil { - var errFatal error - emap := RegisteredExtensions(mi) // map[int32]*ExtensionDesc - ep.Range(func(id protoreflect.FieldNumber, ef Extension) bool { - ed := emap[int32(id)] - if ed != nil { - _, err := GetExtension(mi, ed) - var nerr nonFatal - if !nerr.Merge(err) { - errFatal = err - return false - } - if errLater == nil { - errLater = nerr.E - } - } - return true - }) - if errFatal != nil { - return errFatal - } + unrecognized := m.offset(u.unrecognized).toBytes() + if err := unmarshalExtensions(mi, unrecognized); !nerr.Merge(err) { + return err } } @@ -265,6 +226,67 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { return errLater } +func unmarshalExtensions(mi Message, unrecognized *[]byte) error { + extFields, _ := extendable(mi) + if extFields == nil { + return nil + } + + emap := RegisteredExtensions(mi) // map[int32]*ExtensionDesc + oldUnknownFields := *unrecognized + newUnknownFields := oldUnknownFields[:0] + + for len(oldUnknownFields) > 0 { + fieldNum, wireTyp, tagLen := wire.ConsumeTag(oldUnknownFields) + if tagLen < 0 { + return wire.ParseError(tagLen) + } + extDesc, ok := emap[int32(fieldNum)] + if !ok || extDesc.ExtensionType == nil { + valLen := wire.ConsumeFieldValue(fieldNum, wireTyp, oldUnknownFields[tagLen:]) + if valLen < 0 { + return wire.ParseError(valLen) + } + + newUnknownFields = append(newUnknownFields, oldUnknownFields[:tagLen+valLen]...) + oldUnknownFields = oldUnknownFields[tagLen+valLen:] + continue + } + oldUnknownFields = oldUnknownFields[tagLen:] + + if err := checkExtensionTypeAndRanges(mi, extDesc); err != nil { + return err + } + + // Create a new value or reuse an existing one. + fieldType := reflect.TypeOf(extDesc.ExtensionType) + fieldVal := reflect.New(fieldType).Elem() // E.g., *int32, *Message, []T + if extField := extFields.Get(fieldNum); extField.Value != nil { + fieldVal.Set(reflect.ValueOf(extensionAsLegacyType(extField.Value))) + } + + // Unmarshal the value. + var err error + var nerr nonFatal + unmarshal := typeUnmarshaler(fieldType, extDesc.Tag) + if oldUnknownFields, err = unmarshal(oldUnknownFields, valToPointer(fieldVal.Addr()), int(wireTyp)); !nerr.Merge(err) { + return err + } + + // Store the value into the extension field. + extFields.Set(fieldNum, Extension{ + Desc: extDesc, + Value: extensionAsStorageType(fieldVal.Interface()), + }) + } + + if len(newUnknownFields) == 0 { + newUnknownFields = nil // NOTE: code actually depends on this... + } + *unrecognized = newUnknownFields + return nil +} + // computeUnmarshalInfo fills in u with information for use // in unmarshaling protocol buffers of type u.typ. func (u *unmarshalInfo) computeUnmarshalInfo() { diff --git a/proto/text.go b/proto/text.go index 4e46452885..ab12facda4 100644 --- a/proto/text.go +++ b/proto/text.go @@ -669,16 +669,11 @@ func (tm *textMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error sort.Sort(fieldNumSlice(ids)) for _, extNum := range ids { - ext := ep.Get(extNum) var desc *ExtensionDesc if emap != nil { desc = emap[int32(extNum)] } if desc == nil { - // Unknown extension. - if err := writeUnknownStruct(w, ext.Raw); err != nil { - return err - } continue } From 54001ae5120e5d7ae80b02018cbfdde65045674b Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 1 May 2019 23:40:55 -0700 Subject: [PATCH 064/133] internal/proto: adjust usage for Descriptor method The Type method is being removed, switch to Descriptor method, which was added in CL/174918. Change-Id: Ic2f132db3e6db31e303c31d4d0f00236f2df2253 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/174919 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 +++- internal/proto/defaults.go | 6 +++--- internal/proto/discard.go | 8 ++++---- internal/proto/properties.go | 2 +- internal/proto/registry.go | 31 +++++++++++++++---------------- 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/go.mod b/go.mod index dc095b7e90..fe5232b468 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/golang/protobuf -require github.com/golang/protobuf/v2 v2.0.0-20190509012650-00a323deed55 +require github.com/golang/protobuf/v2 v2.0.0-20190513193441-0fc49f8225fc diff --git a/go.sum b/go.sum index eb5c8d9cc3..91254f3c35 100644 --- a/go.sum +++ b/go.sum @@ -2,10 +2,12 @@ github.com/golang/protobuf v1.2.1-0.20190322195920-d94fb84e04b7/go.mod h1:6lQm79 github.com/golang/protobuf v1.2.1-0.20190326022002-be03c15fcaa2/go.mod h1:rZ4veVXHB1S2+o7TKqD9Isxml062IeDutnCDtFPUlCc= github.com/golang/protobuf v1.2.1-0.20190416233244-13cf6e79fd39/go.mod h1:RgnTNLHWo9HXezTFX5MTeuXnXx9eeQX8y3Cukv+9HaE= github.com/golang/protobuf v1.2.1-0.20190420064300-2b4f3c98b458/go.mod h1:hPB+itxf2EbA0J6prVtJg+ohMeLFLEhlSXXPS2qxTZE= +github.com/golang/protobuf v1.2.1-0.20190509013249-911a20d79252/go.mod h1:1lePdeOu8oinPqnsR0b0MT7mXK8t1iCeDN4TrHzKWEU= github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e/go.mod h1:25ZALhydMFaBRgPH58a8zpFe9YXMAMjOYWtB6pNPcoo= github.com/golang/protobuf/v2 v2.0.0-20190416222953-ab61d41ec93f/go.mod h1:baUT2weUsA1MR7ocRtLXLmi2B1s4VrUT3S6tO8AYzMw= github.com/golang/protobuf/v2 v2.0.0-20190420063524-d24bc72368a2/go.mod h1:wcEMLTNPNYxBFS3yY7kunR0QKUgP/f+wzZaPeTbHi0g= -github.com/golang/protobuf/v2 v2.0.0-20190509012650-00a323deed55 h1:zd+Y1Z1XtROfzk20h4yfXgURDkZ13m1dCC1aoaA/T6c= github.com/golang/protobuf/v2 v2.0.0-20190509012650-00a323deed55/go.mod h1:pWnbrfE+N2TBYiklDHixM32oa26kuZCiJwxIu0DAl7Y= +github.com/golang/protobuf/v2 v2.0.0-20190513193441-0fc49f8225fc h1:lR/aX2vpZuBmsx8I9hi5SL7t8DZqWFEAxY2tua/7Or0= +github.com/golang/protobuf/v2 v2.0.0-20190513193441-0fc49f8225fc/go.mod h1:BvOFOLPdtAzg0go71Nf5Tchso+PBMNnE93vaAZ7dTRU= github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42 h1:q3pnF5JFBNRz8sRD+IRj7Y6DMyYGTNqnZ9axTbSfoNI= github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= diff --git a/internal/proto/defaults.go b/internal/proto/defaults.go index c2a00770c1..56dd82e546 100644 --- a/internal/proto/defaults.go +++ b/internal/proto/defaults.go @@ -18,10 +18,10 @@ func SetDefaults(m Message) { } func setDefaults(m pref.Message) { - fieldTypes := m.Type().Fields() + fieldDescs := m.Descriptor().Fields() knownFields := m.KnownFields() - for i := 0; i < fieldTypes.Len(); i++ { - fd := fieldTypes.Get(i) + for i := 0; i < fieldDescs.Len(); i++ { + fd := fieldDescs.Get(i) num := fd.Number() if !knownFields.Has(num) { if fd.HasDefault() { diff --git a/internal/proto/discard.go b/internal/proto/discard.go index 2bb01283ac..bfef5fade5 100644 --- a/internal/proto/discard.go +++ b/internal/proto/discard.go @@ -28,12 +28,12 @@ func DiscardUnknown(m Message) { } func discardUnknown(m pref.Message) { - fieldTypes := m.Type().Fields() + fieldDescs := m.Descriptor().Fields() knownFields := m.KnownFields() knownFields.Range(func(num pref.FieldNumber, val pref.Value) bool { - fd := fieldTypes.ByNumber(num) + fd := fieldDescs.ByNumber(num) if fd == nil { - fd = knownFields.ExtensionTypes().ByNumber(num) + fd = knownFields.ExtensionTypes().ByNumber(num).Descriptor() } switch { // Handle singular message. @@ -63,7 +63,7 @@ func discardUnknown(m pref.Message) { return true }) - extRanges := m.Type().ExtensionRanges() + extRanges := m.Descriptor().ExtensionRanges() unknownFields := m.UnknownFields() unknownFields.Range(func(num pref.FieldNumber, _ pref.RawFields) bool { // NOTE: Historically, this function did not discard unknown fields diff --git a/internal/proto/properties.go b/internal/proto/properties.go index 2d0ace676f..5397cc1c11 100644 --- a/internal/proto/properties.go +++ b/internal/proto/properties.go @@ -301,7 +301,7 @@ func newProperties(t reflect.Type) *StructProperties { if !foundField { // Check with protobuf reflection to make sure this isn't // an empty protobuf message. - mt := protoimpl.X.MessageTypeOf(reflect.New(t).Interface()) + mt := protoimpl.X.MessageDescriptorOf(reflect.New(t).Interface()) if mt.Fields().Len() > 0 { panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) } diff --git a/internal/proto/registry.go b/internal/proto/registry.go index d63283b63c..fcc6ae3426 100644 --- a/internal/proto/registry.go +++ b/internal/proto/registry.go @@ -17,7 +17,6 @@ import ( protoV2 "github.com/golang/protobuf/v2/proto" "github.com/golang/protobuf/v2/reflect/protodesc" - "github.com/golang/protobuf/v2/reflect/protoreflect" pref "github.com/golang/protobuf/v2/reflect/protoreflect" "github.com/golang/protobuf/v2/reflect/protoregistry" "github.com/golang/protobuf/v2/runtime/protoimpl" @@ -81,7 +80,7 @@ func FileDescriptor(s filePath) (d fileDescGZIP) { // Find the descriptor in the v2 registry. var n int - protoregistry.GlobalFiles.RangeFilesByPath(s, func(fd protoreflect.FileDescriptor) bool { + protoregistry.GlobalFiles.RangeFilesByPath(s, func(fd pref.FileDescriptor) bool { n++ // Convert the structured file descriptor to the raw descriptor proto. @@ -151,12 +150,12 @@ func EnumValueMap(s enumName) (m enumsByName) { } // Construct the mapping from a v2 enum descriptor. - var protoPkg protoreflect.FullName + var protoPkg pref.FullName if i := strings.LastIndexByte(s, '.'); i >= 0 { - protoPkg = protoreflect.FullName(s[:i]) + protoPkg = pref.FullName(s[:i]) } - protoregistry.GlobalFiles.RangeFilesByPackage(protoreflect.FullName(protoPkg), func(fd protoreflect.FileDescriptor) bool { - return walkEnums(fd, func(ed protoreflect.EnumDescriptor) bool { + protoregistry.GlobalFiles.RangeFilesByPackage(pref.FullName(protoPkg), func(fd pref.FileDescriptor) bool { + return walkEnums(fd, func(ed pref.EnumDescriptor) bool { if s == hybridEnumName(ed) { m = make(enumsByName) evs := ed.Values() @@ -178,9 +177,9 @@ func EnumValueMap(s enumName) (m enumsByName) { // walkEnums recursively walks all enums declared in d. func walkEnums(d interface { - Enums() protoreflect.EnumDescriptors - Messages() protoreflect.MessageDescriptors -}, f func(protoreflect.EnumDescriptor) bool) bool { + Enums() pref.EnumDescriptors + Messages() pref.MessageDescriptors +}, f func(pref.EnumDescriptor) bool) bool { cont := true eds := d.Enums() for i := eds.Len() - 1; cont && i >= 0; i-- { @@ -255,8 +254,8 @@ var messageTypeCache sync.Map // map[messageName]reflect.Type // Deprecated: Use protoregistry.GlobalTypes.Register instead. func RegisterType(m Message, s messageName) { mt := protoimpl.X.MessageTypeOf(m) - if s != messageName(mt.FullName()) { - panic(fmt.Sprintf("proto: inconsistent message name: got %v, want %v", s, mt.FullName())) + if s != messageName(mt.Descriptor().FullName()) { + panic(fmt.Sprintf("proto: inconsistent message name: got %v, want %v", s, mt.Descriptor().FullName())) } if err := protoregistry.GlobalTypes.Register(mt); err != nil { printWarning(err) @@ -292,7 +291,7 @@ func MessageType(s messageName) reflect.Type { // Derive the message type from the v2 registry. var t reflect.Type - mt, _ := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(s)) + mt, _ := protoregistry.GlobalTypes.FindMessageByName(pref.FullName(s)) if mt != nil { t = mt.GoType() } @@ -306,14 +305,14 @@ func MessageType(s messageName) reflect.Type { // MessageName returns the full protobuf name for the given message type. // -// Deprecated: Use protoreflect.MessageDescriptor.FullName instead. +// Deprecated: Use pref.MessageDescriptor.FullName instead. func MessageName(m Message) messageName { if m, ok := m.(interface { XXX_MessageName() messageName }); ok { return m.XXX_MessageName() } - return messageName(protoimpl.X.MessageTypeOf(m).FullName()) + return messageName(protoimpl.X.MessageDescriptorOf(m).FullName()) } // RegisterExtension is called from the generated code and registers @@ -342,11 +341,11 @@ func RegisteredExtensions(m Message) extensionsByNumber { } var xs extensionsByNumber - protoregistry.GlobalTypes.RangeExtensionsByMessage(protoreflect.FullName(s), func(xt protoreflect.ExtensionType) bool { + protoregistry.GlobalTypes.RangeExtensionsByMessage(pref.FullName(s), func(xt pref.ExtensionType) bool { if xs == nil { xs = make(extensionsByNumber) } - xs[int32(xt.Number())] = protolegacy.X.ExtensionDescFromType(xt) + xs[int32(xt.Descriptor().Number())] = protolegacy.X.ExtensionDescFromType(xt) return true }) From e24bdfb33f1e833016084c6cdf5b90602babcb66 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 8 May 2019 10:45:56 -0700 Subject: [PATCH 065/133] internal/proto: use ParentFile instead of Parent CL/176777 adds support for the ParentFile method. Use that instead of manually looping to the parent. Change-Id: I15f197e583cf8d687ff21a0957de69fe45f0fc8f Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/176000 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 ++-- internal/proto/registry.go | 7 ++----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index fe5232b468..eb7a0e191d 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/golang/protobuf -require github.com/golang/protobuf/v2 v2.0.0-20190513193441-0fc49f8225fc +require github.com/golang/protobuf/v2 v2.0.0-20190513202118-67c1d9b2c11d diff --git a/go.sum b/go.sum index 91254f3c35..8b2a55a8a7 100644 --- a/go.sum +++ b/go.sum @@ -7,7 +7,7 @@ github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e/go.mod h1:25ZAL github.com/golang/protobuf/v2 v2.0.0-20190416222953-ab61d41ec93f/go.mod h1:baUT2weUsA1MR7ocRtLXLmi2B1s4VrUT3S6tO8AYzMw= github.com/golang/protobuf/v2 v2.0.0-20190420063524-d24bc72368a2/go.mod h1:wcEMLTNPNYxBFS3yY7kunR0QKUgP/f+wzZaPeTbHi0g= github.com/golang/protobuf/v2 v2.0.0-20190509012650-00a323deed55/go.mod h1:pWnbrfE+N2TBYiklDHixM32oa26kuZCiJwxIu0DAl7Y= -github.com/golang/protobuf/v2 v2.0.0-20190513193441-0fc49f8225fc h1:lR/aX2vpZuBmsx8I9hi5SL7t8DZqWFEAxY2tua/7Or0= -github.com/golang/protobuf/v2 v2.0.0-20190513193441-0fc49f8225fc/go.mod h1:BvOFOLPdtAzg0go71Nf5Tchso+PBMNnE93vaAZ7dTRU= +github.com/golang/protobuf/v2 v2.0.0-20190513202118-67c1d9b2c11d h1:YjFyyqqKRB4KxR6rkhIWwPBsCUCHfp7u4vXrru0if04= +github.com/golang/protobuf/v2 v2.0.0-20190513202118-67c1d9b2c11d/go.mod h1:BvOFOLPdtAzg0go71Nf5Tchso+PBMNnE93vaAZ7dTRU= github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42 h1:q3pnF5JFBNRz8sRD+IRj7Y6DMyYGTNqnZ9axTbSfoNI= github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= diff --git a/internal/proto/registry.go b/internal/proto/registry.go index fcc6ae3426..a6071541cb 100644 --- a/internal/proto/registry.go +++ b/internal/proto/registry.go @@ -195,11 +195,8 @@ func walkEnums(d interface { // hybridEnumName returns the legacy enum identifier. func hybridEnumName(ed pref.EnumDescriptor) enumName { var protoPkg string - for parent, _ := ed.Parent(); parent != nil; parent, _ = parent.Parent() { - if fd, ok := parent.(pref.FileDescriptor); ok { - protoPkg = string(fd.Package()) - break - } + if fd := ed.ParentFile(); fd != nil { + protoPkg = string(fd.Package()) } if protoPkg == "" { return camelCase(string(ed.FullName())) From f3ab391baad9facbc1bf73c4d185f4448162f6ac Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Tue, 14 May 2019 00:00:40 -0700 Subject: [PATCH 066/133] all: change module to google.golang.org/protobuf Temporarily remove go.mod, since we can't generate an accurate one until the corresponding v2 change is submitted. Change-Id: I183cb0dde8d01065b955cf4b70e76ae43ac88885 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/176999 Reviewed-by: Joe Tsai --- go.mod | 3 --- go.sum | 13 ------------- internal/cmd/generate-alias/main.go | 14 +++++++------- internal/proto/common.go | 4 ++-- internal/proto/defaults.go | 4 ++-- internal/proto/discard.go | 4 ++-- internal/proto/properties.go | 2 +- internal/proto/registry.go | 16 ++++++++-------- internal/proto/text.go | 6 +++--- internal/wire/wire.go | 2 +- proto/clone.go | 2 +- proto/discard.go | 2 +- proto/equal.go | 2 +- proto/extensions.go | 6 +++--- proto/hooks_disabled.go | 4 ++-- proto/lib.go | 2 +- proto/message_set.go | 2 +- proto/registry_test.go | 2 +- proto/table_marshal.go | 2 +- proto/text.go | 2 +- protoc-gen-go/descriptor/descriptor.pb.go | 8 ++++---- protoc-gen-go/main.go | 6 +++--- protoc-gen-go/plugin/plugin.pb.go | 8 ++++---- ptypes/any/any.pb.go | 8 ++++---- ptypes/duration/duration.pb.go | 8 ++++---- ptypes/empty/empty.pb.go | 8 ++++---- ptypes/struct/struct.pb.go | 8 ++++---- ptypes/timestamp/timestamp.pb.go | 8 ++++---- ptypes/wrappers/wrappers.pb.go | 8 ++++---- 29 files changed, 74 insertions(+), 90 deletions(-) delete mode 100644 go.mod delete mode 100644 go.sum diff --git a/go.mod b/go.mod deleted file mode 100644 index eb7a0e191d..0000000000 --- a/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/golang/protobuf - -require github.com/golang/protobuf/v2 v2.0.0-20190513202118-67c1d9b2c11d diff --git a/go.sum b/go.sum deleted file mode 100644 index 8b2a55a8a7..0000000000 --- a/go.sum +++ /dev/null @@ -1,13 +0,0 @@ -github.com/golang/protobuf v1.2.1-0.20190322195920-d94fb84e04b7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.2.1-0.20190326022002-be03c15fcaa2/go.mod h1:rZ4veVXHB1S2+o7TKqD9Isxml062IeDutnCDtFPUlCc= -github.com/golang/protobuf v1.2.1-0.20190416233244-13cf6e79fd39/go.mod h1:RgnTNLHWo9HXezTFX5MTeuXnXx9eeQX8y3Cukv+9HaE= -github.com/golang/protobuf v1.2.1-0.20190420064300-2b4f3c98b458/go.mod h1:hPB+itxf2EbA0J6prVtJg+ohMeLFLEhlSXXPS2qxTZE= -github.com/golang/protobuf v1.2.1-0.20190509013249-911a20d79252/go.mod h1:1lePdeOu8oinPqnsR0b0MT7mXK8t1iCeDN4TrHzKWEU= -github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e/go.mod h1:25ZALhydMFaBRgPH58a8zpFe9YXMAMjOYWtB6pNPcoo= -github.com/golang/protobuf/v2 v2.0.0-20190416222953-ab61d41ec93f/go.mod h1:baUT2weUsA1MR7ocRtLXLmi2B1s4VrUT3S6tO8AYzMw= -github.com/golang/protobuf/v2 v2.0.0-20190420063524-d24bc72368a2/go.mod h1:wcEMLTNPNYxBFS3yY7kunR0QKUgP/f+wzZaPeTbHi0g= -github.com/golang/protobuf/v2 v2.0.0-20190509012650-00a323deed55/go.mod h1:pWnbrfE+N2TBYiklDHixM32oa26kuZCiJwxIu0DAl7Y= -github.com/golang/protobuf/v2 v2.0.0-20190513202118-67c1d9b2c11d h1:YjFyyqqKRB4KxR6rkhIWwPBsCUCHfp7u4vXrru0if04= -github.com/golang/protobuf/v2 v2.0.0-20190513202118-67c1d9b2c11d/go.mod h1:BvOFOLPdtAzg0go71Nf5Tchso+PBMNnE93vaAZ7dTRU= -github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42 h1:q3pnF5JFBNRz8sRD+IRj7Y6DMyYGTNqnZ9axTbSfoNI= -github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= diff --git a/internal/cmd/generate-alias/main.go b/internal/cmd/generate-alias/main.go index f1a3584f69..93094386c3 100644 --- a/internal/cmd/generate-alias/main.go +++ b/internal/cmd/generate-alias/main.go @@ -17,14 +17,14 @@ import ( "strings" "github.com/golang/protobuf/proto" - gengo "github.com/golang/protobuf/v2/cmd/protoc-gen-go/internal_gengo" - "github.com/golang/protobuf/v2/protogen" - "github.com/golang/protobuf/v2/reflect/protodesc" - "github.com/golang/protobuf/v2/reflect/protoreflect" + gengo "google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo" + "google.golang.org/protobuf/protogen" + "google.golang.org/protobuf/reflect/protodesc" + "google.golang.org/protobuf/reflect/protoreflect" - descriptorpb "github.com/golang/protobuf/v2/types/descriptor" - knownpb "github.com/golang/protobuf/v2/types/known" - pluginpb "github.com/golang/protobuf/v2/types/plugin" + descriptorpb "google.golang.org/protobuf/types/descriptor" + knownpb "google.golang.org/protobuf/types/known" + pluginpb "google.golang.org/protobuf/types/plugin" ) func main() { diff --git a/internal/proto/common.go b/internal/proto/common.go index 8cc0df26b2..3e9500fd29 100644 --- a/internal/proto/common.go +++ b/internal/proto/common.go @@ -12,8 +12,8 @@ import ( "fmt" "reflect" - "github.com/golang/protobuf/v2/runtime/protoiface" - _ "github.com/golang/protobuf/v2/runtime/protolegacy" + "google.golang.org/protobuf/runtime/protoiface" + _ "google.golang.org/protobuf/runtime/protolegacy" ) type ( diff --git a/internal/proto/defaults.go b/internal/proto/defaults.go index 56dd82e546..0d4ae5f8ee 100644 --- a/internal/proto/defaults.go +++ b/internal/proto/defaults.go @@ -5,8 +5,8 @@ package proto import ( - pref "github.com/golang/protobuf/v2/reflect/protoreflect" - "github.com/golang/protobuf/v2/runtime/protoimpl" + pref "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/runtime/protoimpl" ) // SetDefaults sets unset protocol buffer fields to their default values. diff --git a/internal/proto/discard.go b/internal/proto/discard.go index bfef5fade5..03bceaba17 100644 --- a/internal/proto/discard.go +++ b/internal/proto/discard.go @@ -5,8 +5,8 @@ package proto import ( - pref "github.com/golang/protobuf/v2/reflect/protoreflect" - "github.com/golang/protobuf/v2/runtime/protoimpl" + pref "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/runtime/protoimpl" ) // DiscardUnknown recursively discards all unknown fields from this message diff --git a/internal/proto/properties.go b/internal/proto/properties.go index 5397cc1c11..a3d024b6c3 100644 --- a/internal/proto/properties.go +++ b/internal/proto/properties.go @@ -11,7 +11,7 @@ import ( "strings" "sync" - "github.com/golang/protobuf/v2/runtime/protoimpl" + "google.golang.org/protobuf/runtime/protoimpl" ) // Constants that identify the encoding of a value on the wire. diff --git a/internal/proto/registry.go b/internal/proto/registry.go index a6071541cb..33890d40f5 100644 --- a/internal/proto/registry.go +++ b/internal/proto/registry.go @@ -15,14 +15,14 @@ import ( "strings" "sync" - protoV2 "github.com/golang/protobuf/v2/proto" - "github.com/golang/protobuf/v2/reflect/protodesc" - pref "github.com/golang/protobuf/v2/reflect/protoreflect" - "github.com/golang/protobuf/v2/reflect/protoregistry" - "github.com/golang/protobuf/v2/runtime/protoimpl" - "github.com/golang/protobuf/v2/runtime/protolegacy" - - descriptorpb "github.com/golang/protobuf/v2/types/descriptor" + protoV2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protodesc" + pref "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/runtime/protoimpl" + "google.golang.org/protobuf/runtime/protolegacy" + + descriptorpb "google.golang.org/protobuf/types/descriptor" ) // filePath is the path to the proto source file. diff --git a/internal/proto/text.go b/internal/proto/text.go index 4cc0011cda..03efd3cc28 100644 --- a/internal/proto/text.go +++ b/internal/proto/text.go @@ -12,9 +12,9 @@ import ( "io" "reflect" - "github.com/golang/protobuf/v2/encoding/textpb" - preg "github.com/golang/protobuf/v2/reflect/protoregistry" - "github.com/golang/protobuf/v2/runtime/protoimpl" + "google.golang.org/protobuf/encoding/textpb" + preg "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/runtime/protoimpl" ) // TextMarshaler is a configurable text format marshaler. diff --git a/internal/wire/wire.go b/internal/wire/wire.go index 8f97078d24..f4282e0f1e 100644 --- a/internal/wire/wire.go +++ b/internal/wire/wire.go @@ -13,7 +13,7 @@ import ( "math" "math/bits" - "github.com/golang/protobuf/v2/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoreflect" ) // Number represents the field number. diff --git a/proto/clone.go b/proto/clone.go index a9b9868c14..43ec700673 100644 --- a/proto/clone.go +++ b/proto/clone.go @@ -13,7 +13,7 @@ import ( "reflect" "strings" - "github.com/golang/protobuf/v2/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoreflect" ) // Clone returns a deep copy of a protocol buffer. diff --git a/proto/discard.go b/proto/discard.go index 7c376c2173..5404e7ffdd 100644 --- a/proto/discard.go +++ b/proto/discard.go @@ -11,7 +11,7 @@ import ( "sync" "sync/atomic" - "github.com/golang/protobuf/v2/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoreflect" ) type generatedDiscarder interface { diff --git a/proto/equal.go b/proto/equal.go index 49b9eee5da..9a512b7fe0 100644 --- a/proto/equal.go +++ b/proto/equal.go @@ -12,7 +12,7 @@ import ( "reflect" "strings" - "github.com/golang/protobuf/v2/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoreflect" ) /* diff --git a/proto/extensions.go b/proto/extensions.go index e45867d687..0614bbf79c 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -16,9 +16,9 @@ import ( "sync" "github.com/golang/protobuf/internal/wire" - "github.com/golang/protobuf/v2/reflect/protoreflect" - "github.com/golang/protobuf/v2/runtime/protoiface" - "github.com/golang/protobuf/v2/runtime/protoimpl" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/runtime/protoiface" + "google.golang.org/protobuf/runtime/protoimpl" ) // ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. diff --git a/proto/hooks_disabled.go b/proto/hooks_disabled.go index 96e9b34a26..8b322185e0 100644 --- a/proto/hooks_disabled.go +++ b/proto/hooks_disabled.go @@ -10,8 +10,8 @@ import ( "io" "reflect" - descriptorpb "github.com/golang/protobuf/v2/types/descriptor" - knownpb "github.com/golang/protobuf/v2/types/known" + descriptorpb "google.golang.org/protobuf/types/descriptor" + knownpb "google.golang.org/protobuf/types/known" ) var ( diff --git a/proto/lib.go b/proto/lib.go index b87f70ea58..c8afe8a541 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -15,7 +15,7 @@ import ( "strconv" "sync" - "github.com/golang/protobuf/v2/runtime/protoiface" + "google.golang.org/protobuf/runtime/protoiface" ) // requiredNotSetError is an error type returned by either Marshal or Unmarshal. diff --git a/proto/message_set.go b/proto/message_set.go index 730ddb67e1..8626382a2b 100644 --- a/proto/message_set.go +++ b/proto/message_set.go @@ -12,7 +12,7 @@ import ( "errors" "reflect" - "github.com/golang/protobuf/v2/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoreflect" ) // errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. diff --git a/proto/registry_test.go b/proto/registry_test.go index ca3f97164a..123999c35c 100644 --- a/proto/registry_test.go +++ b/proto/registry_test.go @@ -10,7 +10,7 @@ import ( "github.com/golang/protobuf/proto" - descriptorpb "github.com/golang/protobuf/v2/types/descriptor" + descriptorpb "google.golang.org/protobuf/types/descriptor" ) func TestRegistry(t *testing.T) { diff --git a/proto/table_marshal.go b/proto/table_marshal.go index b17cc35f1e..95ca8aacfd 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -17,7 +17,7 @@ import ( "unicode/utf8" "github.com/golang/protobuf/internal/wire" - "github.com/golang/protobuf/v2/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoreflect" ) // a sizer takes a pointer to a field and the size of its tag, computes the size of diff --git a/proto/text.go b/proto/text.go index ab12facda4..ef8735f116 100644 --- a/proto/text.go +++ b/proto/text.go @@ -19,7 +19,7 @@ import ( "sort" "strings" - "github.com/golang/protobuf/v2/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoreflect" ) var ( diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index fdbd3b7ec7..50687ce569 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -4,10 +4,10 @@ package descriptor import ( - protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" - protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" - protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" - descriptor "github.com/golang/protobuf/v2/types/descriptor" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoregistry "google.golang.org/protobuf/reflect/protoregistry" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptor "google.golang.org/protobuf/types/descriptor" sync "sync" ) diff --git a/protoc-gen-go/main.go b/protoc-gen-go/main.go index 5d1f07c223..6bc83cf725 100644 --- a/protoc-gen-go/main.go +++ b/protoc-gen-go/main.go @@ -24,9 +24,9 @@ import ( "fmt" "strings" - gengogrpc "github.com/golang/protobuf/v2/cmd/protoc-gen-go-grpc/internal_gengogrpc" - gengo "github.com/golang/protobuf/v2/cmd/protoc-gen-go/internal_gengo" - "github.com/golang/protobuf/v2/protogen" + gengogrpc "google.golang.org/protobuf/cmd/protoc-gen-go-grpc/internal_gengogrpc" + gengo "google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo" + "google.golang.org/protobuf/protogen" ) func main() { diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index c4df1c4c4c..d81a9671d4 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -4,10 +4,10 @@ package plugin_go import ( - protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" - protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" - protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" - plugin "github.com/golang/protobuf/v2/types/plugin" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoregistry "google.golang.org/protobuf/reflect/protoregistry" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + plugin "google.golang.org/protobuf/types/plugin" sync "sync" ) diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index e3a390fe2b..f99e556c02 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -4,10 +4,10 @@ package any import ( - protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" - protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" - protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" - known "github.com/golang/protobuf/v2/types/known" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoregistry "google.golang.org/protobuf/reflect/protoregistry" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + known "google.golang.org/protobuf/types/known" sync "sync" ) diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index 25f853fa90..0a204c7247 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -4,10 +4,10 @@ package duration import ( - protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" - protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" - protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" - known "github.com/golang/protobuf/v2/types/known" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoregistry "google.golang.org/protobuf/reflect/protoregistry" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + known "google.golang.org/protobuf/types/known" sync "sync" ) diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index 75e2b50ac1..ffe3673bfd 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -4,10 +4,10 @@ package empty import ( - protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" - protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" - protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" - known "github.com/golang/protobuf/v2/types/known" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoregistry "google.golang.org/protobuf/reflect/protoregistry" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + known "google.golang.org/protobuf/types/known" sync "sync" ) diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index 755052c18f..774687e930 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -4,10 +4,10 @@ package structpb import ( - protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" - protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" - protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" - known "github.com/golang/protobuf/v2/types/known" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoregistry "google.golang.org/protobuf/reflect/protoregistry" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + known "google.golang.org/protobuf/types/known" sync "sync" ) diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index dd5c401acb..3fdef47606 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -4,10 +4,10 @@ package timestamp import ( - protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" - protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" - protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" - known "github.com/golang/protobuf/v2/types/known" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoregistry "google.golang.org/protobuf/reflect/protoregistry" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + known "google.golang.org/protobuf/types/known" sync "sync" ) diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index c2ee85a26f..5a6462f506 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -4,10 +4,10 @@ package wrappers import ( - protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect" - protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry" - protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl" - known "github.com/golang/protobuf/v2/types/known" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoregistry "google.golang.org/protobuf/reflect/protoregistry" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + known "google.golang.org/protobuf/types/known" sync "sync" ) From 7800af189d760ab08aab064e06057b036dd0c0c1 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Tue, 14 May 2019 10:35:13 -0700 Subject: [PATCH 067/133] go.mod, go.sum: add back in after v2 module renaming Change-Id: I4366596203940ab2d1fb20f88bc40e95a57157c4 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/177157 Reviewed-by: Joe Tsai --- go.mod | 5 +++++ go.sum | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 go.mod create mode 100644 go.sum diff --git a/go.mod b/go.mod new file mode 100644 index 0000000000..e58b7f9bb3 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/golang/protobuf + +go 1.9 + +require google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000000..38ec3eb836 --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8 h1:W21IHLlUZTOSWPAugb7YF/zA4lu4QlPm7T5JwlKYstQ= +google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= From 7574ba03306e0609fb5ecf72399ac206575319d2 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Wed, 15 May 2019 12:35:38 -0700 Subject: [PATCH 068/133] all: update import paths for renamed packages Update paths to packages renamed in https://go-review.googlesource.com/c/protobuf/+/177178 Change-Id: Ifd43f4edd0c976e9ec84b145cdaf331b42fa6e53 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/177400 Reviewed-by: Herbie Ong --- go.mod | 2 +- go.sum | 4 ++++ internal/cmd/generate-alias/main.go | 2 +- internal/proto/text.go | 6 +++--- protoc-gen-go/main.go | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index e58b7f9bb3..104a60fe18 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8 +require google.golang.org/protobuf v0.0.0-20190514231807-cdb777356907 diff --git a/go.sum b/go.sum index 38ec3eb836..52026c78f1 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,6 @@ +github.com/golang/protobuf v1.2.1-0.20190514181236-7800af189d76/go.mod h1:Zfz6qcDoDBESdv6JsKsGpgNHnkvwJAJwcA9eL+mOkgc= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8 h1:W21IHLlUZTOSWPAugb7YF/zA4lu4QlPm7T5JwlKYstQ= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= +google.golang.org/protobuf v0.0.0-20190514231807-cdb777356907 h1:KmA4pf+bs1ucZ/8YCj/VXK0/mkK1olh/jzYhKYiebFE= +google.golang.org/protobuf v0.0.0-20190514231807-cdb777356907/go.mod h1:HeRLsKXv4+wE27dOIGwnqcOgq6a1O/GJ7mGhiEPnBrU= diff --git a/internal/cmd/generate-alias/main.go b/internal/cmd/generate-alias/main.go index 93094386c3..71eef42fcb 100644 --- a/internal/cmd/generate-alias/main.go +++ b/internal/cmd/generate-alias/main.go @@ -18,7 +18,7 @@ import ( "github.com/golang/protobuf/proto" gengo "google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo" - "google.golang.org/protobuf/protogen" + "google.golang.org/protobuf/compiler/protogen" "google.golang.org/protobuf/reflect/protodesc" "google.golang.org/protobuf/reflect/protoreflect" diff --git a/internal/proto/text.go b/internal/proto/text.go index 03efd3cc28..ee8fe9202f 100644 --- a/internal/proto/text.go +++ b/internal/proto/text.go @@ -12,7 +12,7 @@ import ( "io" "reflect" - "google.golang.org/protobuf/encoding/textpb" + "google.golang.org/protobuf/encoding/prototext" preg "google.golang.org/protobuf/reflect/protoregistry" "google.golang.org/protobuf/runtime/protoimpl" ) @@ -49,7 +49,7 @@ func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { if !tm.Compact { ind = " " } - mo := textpb.MarshalOptions{ + mo := prototext.MarshalOptions{ AllowPartial: true, Indent: ind, } @@ -101,7 +101,7 @@ func UnmarshalText(s string, m Message) error { if um, ok := m.(encoding.TextUnmarshaler); ok { return um.UnmarshalText([]byte(s)) } - err := textpb.Unmarshal(protoimpl.X.MessageOf(m).Interface(), []byte(s)) + err := prototext.Unmarshal([]byte(s), protoimpl.X.MessageOf(m).Interface()) // Return RequiredNotSetError for required not set errors and ignore invalid // UTF-8 errors. mask := nonFatalErrors(err) diff --git a/protoc-gen-go/main.go b/protoc-gen-go/main.go index 6bc83cf725..1f32d3f0f5 100644 --- a/protoc-gen-go/main.go +++ b/protoc-gen-go/main.go @@ -26,7 +26,7 @@ import ( gengogrpc "google.golang.org/protobuf/cmd/protoc-gen-go-grpc/internal_gengogrpc" gengo "google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo" - "google.golang.org/protobuf/protogen" + "google.golang.org/protobuf/compiler/protogen" ) func main() { From a2cd3ac1b343f72e815eda972bf90e13c7c7a3b7 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 16 May 2019 12:07:29 -0700 Subject: [PATCH 069/133] proto: use opaque GetValue and SetEagerValue extension methods CL/177619 adds scaffolding to support lazy extensions. This CL changes the v1 logic to call the equivalent opaque methods. This CL does not add lazy extension support. Change-Id: I7954f87a6ec59b06ad2e034f625bb4fc40c8aefd Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/177620 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 6 ++++-- proto/clone.go | 8 ++++---- proto/discard.go | 4 ++-- proto/equal.go | 4 ++-- proto/extensions.go | 15 +++++++-------- proto/table_marshal.go | 32 ++++++++++++++++---------------- proto/table_unmarshal.go | 11 +++++------ 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/go.mod b/go.mod index 104a60fe18..bf5493782a 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190514231807-cdb777356907 +require google.golang.org/protobuf v0.0.0-20190516201745-40b83d67fc75 diff --git a/go.sum b/go.sum index 52026c78f1..6e85e59b78 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,8 @@ github.com/golang/protobuf v1.2.1-0.20190514181236-7800af189d76/go.mod h1:Zfz6qcDoDBESdv6JsKsGpgNHnkvwJAJwcA9eL+mOkgc= +github.com/golang/protobuf v1.2.1-0.20190515194842-7574ba03306e/go.mod h1:GjgUz9uwrRQmdPBBrFqiVbojAmlpy6ryM6DCzC+20rE= +github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8 h1:W21IHLlUZTOSWPAugb7YF/zA4lu4QlPm7T5JwlKYstQ= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= -google.golang.org/protobuf v0.0.0-20190514231807-cdb777356907 h1:KmA4pf+bs1ucZ/8YCj/VXK0/mkK1olh/jzYhKYiebFE= google.golang.org/protobuf v0.0.0-20190514231807-cdb777356907/go.mod h1:HeRLsKXv4+wE27dOIGwnqcOgq6a1O/GJ7mGhiEPnBrU= +google.golang.org/protobuf v0.0.0-20190516201745-40b83d67fc75 h1:A9hovAkRmyzyLP+RCw0M+tVW0Ku3SZlCPLiABrEQJW0= +google.golang.org/protobuf v0.0.0-20190516201745-40b83d67fc75/go.mod h1:jf+u8AHuKtkib+0J4/bQXPNzCmT3V9a02hVzYKtatuw= diff --git a/proto/clone.go b/proto/clone.go index 43ec700673..11cf45132c 100644 --- a/proto/clone.go +++ b/proto/clone.go @@ -209,10 +209,10 @@ func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { func mergeExtension(out, in *extensionMap) { in.Range(func(extNum protoreflect.FieldNumber, eIn Extension) bool { 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.HasValue() { + v := reflect.New(reflect.TypeOf(eIn.GetValue())).Elem() + mergeAny(v, reflect.ValueOf(eIn.GetValue()), false, nil) + eOut.SetEagerValue(v.Interface()) } out.Set(extNum, eOut) diff --git a/proto/discard.go b/proto/discard.go index 5404e7ffdd..c53d4b177c 100644 --- a/proto/discard.go +++ b/proto/discard.go @@ -104,7 +104,7 @@ func (di *discardInfo) discard(src pointer) { // that have been accessed via GetExtension. if em, err := extendable(src.asPointerTo(di.typ).Interface()); err == nil { em.Range(func(_ protoreflect.FieldNumber, mx Extension) bool { - if m, ok := mx.Value.(Message); ok { + if m, ok := mx.GetValue().(Message); ok { DiscardUnknown(m) } return true @@ -319,7 +319,7 @@ func discardLegacy(m Message) { // that have been accessed via GetExtension. if em, err := extendable(m); err == nil { em.Range(func(_ protoreflect.FieldNumber, mx Extension) bool { - if m, ok := mx.Value.(Message); ok { + if m, ok := mx.GetValue().(Message); ok { discardLegacy(m) } return true diff --git a/proto/equal.go b/proto/equal.go index 9a512b7fe0..ceebce79f0 100644 --- a/proto/equal.go +++ b/proto/equal.go @@ -219,8 +219,8 @@ func equalExtensions(base reflect.Type, em1, em2 *extensionMap) bool { } e2 := em2.Get(extNum) - m1 := extensionAsLegacyType(e1.Value) - m2 := extensionAsLegacyType(e2.Value) + m1 := extensionAsLegacyType(e1.GetValue()) + m2 := extensionAsLegacyType(e2.GetValue()) if m1 == nil && m2 == nil { return true diff --git a/proto/extensions.go b/proto/extensions.go index 0614bbf79c..1dbf3c5cf1 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -268,7 +268,7 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { } e := epb.Get(protoreflect.FieldNumber(extension.Field)) - if e.Value != nil { + if e.HasValue() { // Already decoded. Check the descriptor, though. if e.Desc != extension { // This shouldn't happen. If it does, it means that @@ -276,7 +276,7 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { // descriptors with the same field number. return nil, errors.New("proto: descriptor conflict") } - return extensionAsLegacyType(e.Value), nil + return extensionAsLegacyType(e.GetValue()), nil } // Descriptor without type information. @@ -292,11 +292,11 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { // Remember the decoded version and drop the encoded version. // That way it is safe to mutate what we return. - e.Value = extensionAsStorageType(v) e.Desc = extension + e.SetEagerValue(extensionAsStorageType(v)) unrecognized.SetBytes(removeRawFields(unrecognized.Bytes(), fnum)) epb.Set(protoreflect.FieldNumber(extension.Field), e) - return extensionAsLegacyType(e.Value), nil + return extensionAsLegacyType(e.GetValue()), nil } // defaultExtensionValue returns the default value for extension. @@ -461,10 +461,9 @@ func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) } - epb.Set(protoreflect.FieldNumber(extension.Field), Extension{ - Desc: extension, - Value: extensionAsStorageType(value), - }) + x := Extension{Desc: extension} + x.SetEagerValue(extensionAsStorageType(value)) + epb.Set(protoreflect.FieldNumber(extension.Field), x) return nil } diff --git a/proto/table_marshal.go b/proto/table_marshal.go index 95ca8aacfd..f30e134dae 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -2373,7 +2373,7 @@ func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { n := 0 m.Range(func(_ protoreflect.FieldNumber, e Extension) bool { - if e.Value == nil || e.Desc == nil { + if e.Desc == nil || !e.HasValue() { return true // should never happen } @@ -2381,7 +2381,7 @@ func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { // because the extension value may have been mutated after // the last time this function was called. ei := u.getExtElemInfo(e.Desc) - v := e.Value + v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, ei.tagsize) return true @@ -2403,7 +2403,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de // Don't bother sorting the keys. if m.Len() <= 1 { m.Range(func(_ protoreflect.FieldNumber, e Extension) bool { - if e.Value == nil || e.Desc == nil { + if e.Desc == nil || !e.HasValue() { return true // should never happen } @@ -2412,7 +2412,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de // the last time this function was called. ei := u.getExtElemInfo(e.Desc) - v := e.Value + v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { @@ -2435,7 +2435,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de for _, k := range keys { e := m.Get(protoreflect.FieldNumber(k)) - if e.Value == nil || e.Desc == nil { + if e.Desc == nil || !e.HasValue() { continue // should never happen } @@ -2444,7 +2444,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de // the last time this function was called. ei := u.getExtElemInfo(e.Desc) - v := e.Value + v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { @@ -2475,7 +2475,7 @@ func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions, unk []byte) in n += 2 // start group, end group. tag = 1 (size=1) n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) - if e.Value == nil || e.Desc == nil { + if e.Desc == nil || !e.HasValue() { return true // should never happen } @@ -2484,7 +2484,7 @@ func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions, unk []byte) in // the last time this function was called. ei := u.getExtElemInfo(e.Desc) - v := e.Value + v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, 1) // message, tag = 3 (size=1) return true @@ -2528,7 +2528,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, un b = append(b, 2<<3|WireVarint) b = appendVarint(b, uint64(id)) - if e.Value == nil || e.Desc == nil { + if e.Desc == nil || !e.HasValue() { return true // should never happen } @@ -2537,7 +2537,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, un // the last time this function was called. ei := u.getExtElemInfo(e.Desc) - v := e.Value + v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) if !nerr.Merge(err) { @@ -2583,7 +2583,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, un b = append(b, 2<<3|WireVarint) b = appendVarint(b, uint64(id)) - if e.Value == nil || e.Desc == nil { + if e.Desc == nil || !e.HasValue() { continue // should never happen } @@ -2592,7 +2592,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, un // the last time this function was called. ei := u.getExtElemInfo(e.Desc) - v := e.Value + v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) b = append(b, 1<<3|WireEndGroup) @@ -2630,7 +2630,7 @@ func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { n := 0 for _, e := range m { - if e.Value == nil || e.Desc == nil { + if e.Desc == nil || !e.HasValue() { continue // should never happen } @@ -2639,7 +2639,7 @@ func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { // the last time this function was called. ei := u.getExtElemInfo(e.Desc) - v := e.Value + v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, ei.tagsize) } @@ -2663,7 +2663,7 @@ func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, determ var nerr nonFatal for _, k := range keys { e := m[int32(k)] - if e.Value == nil || e.Desc == nil { + if e.Desc == nil || !e.HasValue() { continue // should never happen } @@ -2672,7 +2672,7 @@ func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, determ // the last time this function was called. ei := u.getExtElemInfo(e.Desc) - v := e.Value + v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index 98ecb4bdb5..4c4759d272 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -261,8 +261,8 @@ func unmarshalExtensions(mi Message, unrecognized *[]byte) error { // Create a new value or reuse an existing one. fieldType := reflect.TypeOf(extDesc.ExtensionType) fieldVal := reflect.New(fieldType).Elem() // E.g., *int32, *Message, []T - if extField := extFields.Get(fieldNum); extField.Value != nil { - fieldVal.Set(reflect.ValueOf(extensionAsLegacyType(extField.Value))) + if extField := extFields.Get(fieldNum); extField.HasValue() { + fieldVal.Set(reflect.ValueOf(extensionAsLegacyType(extField.GetValue()))) } // Unmarshal the value. @@ -274,10 +274,9 @@ func unmarshalExtensions(mi Message, unrecognized *[]byte) error { } // Store the value into the extension field. - extFields.Set(fieldNum, Extension{ - Desc: extDesc, - Value: extensionAsStorageType(fieldVal.Interface()), - }) + x := Extension{Desc: extDesc} + x.SetEagerValue(extensionAsStorageType(fieldVal.Interface())) + extFields.Set(fieldNum, x) } if len(newUnknownFields) == 0 { From ae2eaafab4057eb45a463fcc2e075c87309199eb Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 16 May 2019 13:14:11 -0700 Subject: [PATCH 070/133] all: update import paths for generated protos CL/177380 changed the import path of all generated protos. Change-Id: Ie3ec86f3f793fca80329f26864c5df206b9fba91 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/177623 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 +- internal/cmd/generate-alias/main.go | 23 ++- internal/proto/registry.go | 2 +- proto/hooks_disabled.go | 73 ++++---- proto/registry_test.go | 2 +- protoc-gen-go/descriptor/descriptor.pb.go | 206 +++++++++++----------- protoc-gen-go/plugin/plugin.pb.go | 10 +- ptypes/any/any.pb.go | 4 +- ptypes/duration/duration.pb.go | 4 +- ptypes/empty/empty.pb.go | 4 +- ptypes/struct/struct.pb.go | 28 +-- ptypes/timestamp/timestamp.pb.go | 4 +- ptypes/wrappers/wrappers.pb.go | 20 +-- 14 files changed, 201 insertions(+), 185 deletions(-) diff --git a/go.mod b/go.mod index bf5493782a..c968698d87 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190516201745-40b83d67fc75 +require google.golang.org/protobuf v0.0.0-20190516215540-a95b29fbf623 diff --git a/go.sum b/go.sum index 6e85e59b78..6876853749 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,10 @@ github.com/golang/protobuf v1.2.1-0.20190514181236-7800af189d76/go.mod h1:Zfz6qcDoDBESdv6JsKsGpgNHnkvwJAJwcA9eL+mOkgc= github.com/golang/protobuf v1.2.1-0.20190515194842-7574ba03306e/go.mod h1:GjgUz9uwrRQmdPBBrFqiVbojAmlpy6ryM6DCzC+20rE= +github.com/golang/protobuf v1.2.1-0.20190516201927-a2cd3ac1b343/go.mod h1:PScGDF2x230A126tLt9Ol9RjhXzbiPJrt/CogooD2mE= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= google.golang.org/protobuf v0.0.0-20190514231807-cdb777356907/go.mod h1:HeRLsKXv4+wE27dOIGwnqcOgq6a1O/GJ7mGhiEPnBrU= -google.golang.org/protobuf v0.0.0-20190516201745-40b83d67fc75 h1:A9hovAkRmyzyLP+RCw0M+tVW0Ku3SZlCPLiABrEQJW0= google.golang.org/protobuf v0.0.0-20190516201745-40b83d67fc75/go.mod h1:jf+u8AHuKtkib+0J4/bQXPNzCmT3V9a02hVzYKtatuw= +google.golang.org/protobuf v0.0.0-20190516215540-a95b29fbf623 h1:66BSNYPKX6AuAowxFl47l/DSyZ/ZekFylmbpjDMScDQ= +google.golang.org/protobuf v0.0.0-20190516215540-a95b29fbf623/go.mod h1:cWWmz5lsCWIcqGLROrKq5Lu231IJw2PzqOZ8cgspbfY= diff --git a/internal/cmd/generate-alias/main.go b/internal/cmd/generate-alias/main.go index 71eef42fcb..1d0ccd466b 100644 --- a/internal/cmd/generate-alias/main.go +++ b/internal/cmd/generate-alias/main.go @@ -22,9 +22,14 @@ import ( "google.golang.org/protobuf/reflect/protodesc" "google.golang.org/protobuf/reflect/protoreflect" - descriptorpb "google.golang.org/protobuf/types/descriptor" - knownpb "google.golang.org/protobuf/types/known" - pluginpb "google.golang.org/protobuf/types/plugin" + "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/known/anypb" + "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/structpb" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" + "google.golang.org/protobuf/types/pluginpb" ) func main() { @@ -43,22 +48,22 @@ func main() { pbDesc: pluginpb.File_google_protobuf_compiler_plugin_proto, }, { goPkg: "github.com/golang/protobuf/ptypes/any;any", - pbDesc: knownpb.File_google_protobuf_any_proto, + pbDesc: anypb.File_google_protobuf_any_proto, }, { goPkg: "github.com/golang/protobuf/ptypes/duration;duration", - pbDesc: knownpb.File_google_protobuf_duration_proto, + pbDesc: durationpb.File_google_protobuf_duration_proto, }, { goPkg: "github.com/golang/protobuf/ptypes/timestamp;timestamp", - pbDesc: knownpb.File_google_protobuf_timestamp_proto, + pbDesc: timestamppb.File_google_protobuf_timestamp_proto, }, { goPkg: "github.com/golang/protobuf/ptypes/wrappers;wrappers", - pbDesc: knownpb.File_google_protobuf_wrappers_proto, + pbDesc: wrapperspb.File_google_protobuf_wrappers_proto, }, { goPkg: "github.com/golang/protobuf/ptypes/struct;structpb", - pbDesc: knownpb.File_google_protobuf_struct_proto, + pbDesc: structpb.File_google_protobuf_struct_proto, }, { goPkg: "github.com/golang/protobuf/ptypes/empty;empty", - pbDesc: knownpb.File_google_protobuf_empty_proto, + pbDesc: emptypb.File_google_protobuf_empty_proto, }} // For each package, construct a proto file that public imports the package. diff --git a/internal/proto/registry.go b/internal/proto/registry.go index 33890d40f5..b7ffe3df36 100644 --- a/internal/proto/registry.go +++ b/internal/proto/registry.go @@ -22,7 +22,7 @@ import ( "google.golang.org/protobuf/runtime/protoimpl" "google.golang.org/protobuf/runtime/protolegacy" - descriptorpb "google.golang.org/protobuf/types/descriptor" + "google.golang.org/protobuf/types/descriptorpb" ) // filePath is the path to the proto source file. diff --git a/proto/hooks_disabled.go b/proto/hooks_disabled.go index 8b322185e0..09485c945d 100644 --- a/proto/hooks_disabled.go +++ b/proto/hooks_disabled.go @@ -10,8 +10,17 @@ import ( "io" "reflect" - descriptorpb "google.golang.org/protobuf/types/descriptor" - knownpb "google.golang.org/protobuf/types/known" + "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/known/anypb" + "google.golang.org/protobuf/types/known/apipb" + "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/fieldmaskpb" + "google.golang.org/protobuf/types/known/sourcecontextpb" + "google.golang.org/protobuf/types/known/structpb" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/typepb" + "google.golang.org/protobuf/types/known/wrapperspb" ) var ( @@ -92,52 +101,52 @@ func init() { RegisterType((*descriptorpb.GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") // any.proto - RegisterType((*knownpb.Any)(nil), "google.protobuf.Any") + RegisterType((*anypb.Any)(nil), "google.protobuf.Any") // api.proto - RegisterType((*knownpb.Api)(nil), "google.protobuf.Api") - RegisterType((*knownpb.Method)(nil), "google.protobuf.Method") - RegisterType((*knownpb.Mixin)(nil), "google.protobuf.Mixin") + RegisterType((*apipb.Api)(nil), "google.protobuf.Api") + RegisterType((*apipb.Method)(nil), "google.protobuf.Method") + RegisterType((*apipb.Mixin)(nil), "google.protobuf.Mixin") // duration.proto - RegisterType((*knownpb.Duration)(nil), "google.protobuf.Duration") + RegisterType((*durationpb.Duration)(nil), "google.protobuf.Duration") // empty.proto - RegisterType((*knownpb.Empty)(nil), "google.protobuf.Empty") + RegisterType((*emptypb.Empty)(nil), "google.protobuf.Empty") // field_mask.proto - RegisterType((*knownpb.FieldMask)(nil), "google.protobuf.FieldMask") + RegisterType((*fieldmaskpb.FieldMask)(nil), "google.protobuf.FieldMask") // source_context.proto - RegisterType((*knownpb.SourceContext)(nil), "google.protobuf.SourceContext") + RegisterType((*sourcecontextpb.SourceContext)(nil), "google.protobuf.SourceContext") // struct.proto - RegisterEnum("google.protobuf.NullValue", knownpb.NullValue_name, knownpb.NullValue_value) - RegisterType((*knownpb.Struct)(nil), "google.protobuf.Struct") - RegisterType((*knownpb.Value)(nil), "google.protobuf.Value") - RegisterType((*knownpb.ListValue)(nil), "google.protobuf.ListValue") + RegisterEnum("google.protobuf.NullValue", structpb.NullValue_name, structpb.NullValue_value) + RegisterType((*structpb.Struct)(nil), "google.protobuf.Struct") + RegisterType((*structpb.Value)(nil), "google.protobuf.Value") + RegisterType((*structpb.ListValue)(nil), "google.protobuf.ListValue") // timestamp.proto - RegisterType((*knownpb.Timestamp)(nil), "google.protobuf.Timestamp") + RegisterType((*timestamppb.Timestamp)(nil), "google.protobuf.Timestamp") // type.proto - RegisterEnum("google.protobuf.Syntax", knownpb.Syntax_name, knownpb.Syntax_value) - RegisterEnum("google.protobuf.Field_Kind", knownpb.Field_Kind_name, knownpb.Field_Kind_value) - RegisterEnum("google.protobuf.Field_Cardinality", knownpb.Field_Cardinality_name, knownpb.Field_Cardinality_value) - RegisterType((*knownpb.Type)(nil), "google.protobuf.Type") - RegisterType((*knownpb.Field)(nil), "google.protobuf.Field") - RegisterType((*knownpb.Enum)(nil), "google.protobuf.Enum") - RegisterType((*knownpb.EnumValue)(nil), "google.protobuf.EnumValue") - RegisterType((*knownpb.Option)(nil), "google.protobuf.Option") + RegisterEnum("google.protobuf.Syntax", typepb.Syntax_name, typepb.Syntax_value) + RegisterEnum("google.protobuf.Field_Kind", typepb.Field_Kind_name, typepb.Field_Kind_value) + RegisterEnum("google.protobuf.Field_Cardinality", typepb.Field_Cardinality_name, typepb.Field_Cardinality_value) + RegisterType((*typepb.Type)(nil), "google.protobuf.Type") + RegisterType((*typepb.Field)(nil), "google.protobuf.Field") + RegisterType((*typepb.Enum)(nil), "google.protobuf.Enum") + RegisterType((*typepb.EnumValue)(nil), "google.protobuf.EnumValue") + RegisterType((*typepb.Option)(nil), "google.protobuf.Option") // wrapper.proto - RegisterType((*knownpb.DoubleValue)(nil), "google.protobuf.DoubleValue") - RegisterType((*knownpb.FloatValue)(nil), "google.protobuf.FloatValue") - RegisterType((*knownpb.Int64Value)(nil), "google.protobuf.Int64Value") - RegisterType((*knownpb.UInt64Value)(nil), "google.protobuf.UInt64Value") - RegisterType((*knownpb.Int32Value)(nil), "google.protobuf.Int32Value") - RegisterType((*knownpb.UInt32Value)(nil), "google.protobuf.UInt32Value") - RegisterType((*knownpb.BoolValue)(nil), "google.protobuf.BoolValue") - RegisterType((*knownpb.StringValue)(nil), "google.protobuf.StringValue") - RegisterType((*knownpb.BytesValue)(nil), "google.protobuf.BytesValue") + RegisterType((*wrapperspb.DoubleValue)(nil), "google.protobuf.DoubleValue") + RegisterType((*wrapperspb.FloatValue)(nil), "google.protobuf.FloatValue") + RegisterType((*wrapperspb.Int64Value)(nil), "google.protobuf.Int64Value") + RegisterType((*wrapperspb.UInt64Value)(nil), "google.protobuf.UInt64Value") + RegisterType((*wrapperspb.Int32Value)(nil), "google.protobuf.Int32Value") + RegisterType((*wrapperspb.UInt32Value)(nil), "google.protobuf.UInt32Value") + RegisterType((*wrapperspb.BoolValue)(nil), "google.protobuf.BoolValue") + RegisterType((*wrapperspb.StringValue)(nil), "google.protobuf.StringValue") + RegisterType((*wrapperspb.BytesValue)(nil), "google.protobuf.BytesValue") } diff --git a/proto/registry_test.go b/proto/registry_test.go index 123999c35c..ed3cd5583c 100644 --- a/proto/registry_test.go +++ b/proto/registry_test.go @@ -10,7 +10,7 @@ import ( "github.com/golang/protobuf/proto" - descriptorpb "google.golang.org/protobuf/types/descriptor" + "google.golang.org/protobuf/types/descriptorpb" ) func TestRegistry(t *testing.T) { diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index 50687ce569..de08d0f55e 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -7,7 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptor "google.golang.org/protobuf/types/descriptor" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" sync "sync" ) @@ -15,142 +15,142 @@ const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) // Symbols defined in public import of google/protobuf/descriptor.proto -type FieldDescriptorProto_Type = descriptor.FieldDescriptorProto_Type +type FieldDescriptorProto_Type = descriptorpb.FieldDescriptorProto_Type -const FieldDescriptorProto_TYPE_DOUBLE = descriptor.FieldDescriptorProto_TYPE_DOUBLE -const FieldDescriptorProto_TYPE_FLOAT = descriptor.FieldDescriptorProto_TYPE_FLOAT -const FieldDescriptorProto_TYPE_INT64 = descriptor.FieldDescriptorProto_TYPE_INT64 -const FieldDescriptorProto_TYPE_UINT64 = descriptor.FieldDescriptorProto_TYPE_UINT64 -const FieldDescriptorProto_TYPE_INT32 = descriptor.FieldDescriptorProto_TYPE_INT32 -const FieldDescriptorProto_TYPE_FIXED64 = descriptor.FieldDescriptorProto_TYPE_FIXED64 -const FieldDescriptorProto_TYPE_FIXED32 = descriptor.FieldDescriptorProto_TYPE_FIXED32 -const FieldDescriptorProto_TYPE_BOOL = descriptor.FieldDescriptorProto_TYPE_BOOL -const FieldDescriptorProto_TYPE_STRING = descriptor.FieldDescriptorProto_TYPE_STRING -const FieldDescriptorProto_TYPE_GROUP = descriptor.FieldDescriptorProto_TYPE_GROUP -const FieldDescriptorProto_TYPE_MESSAGE = descriptor.FieldDescriptorProto_TYPE_MESSAGE -const FieldDescriptorProto_TYPE_BYTES = descriptor.FieldDescriptorProto_TYPE_BYTES -const FieldDescriptorProto_TYPE_UINT32 = descriptor.FieldDescriptorProto_TYPE_UINT32 -const FieldDescriptorProto_TYPE_ENUM = descriptor.FieldDescriptorProto_TYPE_ENUM -const FieldDescriptorProto_TYPE_SFIXED32 = descriptor.FieldDescriptorProto_TYPE_SFIXED32 -const FieldDescriptorProto_TYPE_SFIXED64 = descriptor.FieldDescriptorProto_TYPE_SFIXED64 -const FieldDescriptorProto_TYPE_SINT32 = descriptor.FieldDescriptorProto_TYPE_SINT32 -const FieldDescriptorProto_TYPE_SINT64 = descriptor.FieldDescriptorProto_TYPE_SINT64 +const FieldDescriptorProto_TYPE_DOUBLE = descriptorpb.FieldDescriptorProto_TYPE_DOUBLE +const FieldDescriptorProto_TYPE_FLOAT = descriptorpb.FieldDescriptorProto_TYPE_FLOAT +const FieldDescriptorProto_TYPE_INT64 = descriptorpb.FieldDescriptorProto_TYPE_INT64 +const FieldDescriptorProto_TYPE_UINT64 = descriptorpb.FieldDescriptorProto_TYPE_UINT64 +const FieldDescriptorProto_TYPE_INT32 = descriptorpb.FieldDescriptorProto_TYPE_INT32 +const FieldDescriptorProto_TYPE_FIXED64 = descriptorpb.FieldDescriptorProto_TYPE_FIXED64 +const FieldDescriptorProto_TYPE_FIXED32 = descriptorpb.FieldDescriptorProto_TYPE_FIXED32 +const FieldDescriptorProto_TYPE_BOOL = descriptorpb.FieldDescriptorProto_TYPE_BOOL +const FieldDescriptorProto_TYPE_STRING = descriptorpb.FieldDescriptorProto_TYPE_STRING +const FieldDescriptorProto_TYPE_GROUP = descriptorpb.FieldDescriptorProto_TYPE_GROUP +const FieldDescriptorProto_TYPE_MESSAGE = descriptorpb.FieldDescriptorProto_TYPE_MESSAGE +const FieldDescriptorProto_TYPE_BYTES = descriptorpb.FieldDescriptorProto_TYPE_BYTES +const FieldDescriptorProto_TYPE_UINT32 = descriptorpb.FieldDescriptorProto_TYPE_UINT32 +const FieldDescriptorProto_TYPE_ENUM = descriptorpb.FieldDescriptorProto_TYPE_ENUM +const FieldDescriptorProto_TYPE_SFIXED32 = descriptorpb.FieldDescriptorProto_TYPE_SFIXED32 +const FieldDescriptorProto_TYPE_SFIXED64 = descriptorpb.FieldDescriptorProto_TYPE_SFIXED64 +const FieldDescriptorProto_TYPE_SINT32 = descriptorpb.FieldDescriptorProto_TYPE_SINT32 +const FieldDescriptorProto_TYPE_SINT64 = descriptorpb.FieldDescriptorProto_TYPE_SINT64 -var FieldDescriptorProto_Type_name = descriptor.FieldDescriptorProto_Type_name -var FieldDescriptorProto_Type_value = descriptor.FieldDescriptorProto_Type_value +var FieldDescriptorProto_Type_name = descriptorpb.FieldDescriptorProto_Type_name +var FieldDescriptorProto_Type_value = descriptorpb.FieldDescriptorProto_Type_value -type FieldDescriptorProto_Label = descriptor.FieldDescriptorProto_Label +type FieldDescriptorProto_Label = descriptorpb.FieldDescriptorProto_Label -const FieldDescriptorProto_LABEL_OPTIONAL = descriptor.FieldDescriptorProto_LABEL_OPTIONAL -const FieldDescriptorProto_LABEL_REQUIRED = descriptor.FieldDescriptorProto_LABEL_REQUIRED -const FieldDescriptorProto_LABEL_REPEATED = descriptor.FieldDescriptorProto_LABEL_REPEATED +const FieldDescriptorProto_LABEL_OPTIONAL = descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL +const FieldDescriptorProto_LABEL_REQUIRED = descriptorpb.FieldDescriptorProto_LABEL_REQUIRED +const FieldDescriptorProto_LABEL_REPEATED = descriptorpb.FieldDescriptorProto_LABEL_REPEATED -var FieldDescriptorProto_Label_name = descriptor.FieldDescriptorProto_Label_name -var FieldDescriptorProto_Label_value = descriptor.FieldDescriptorProto_Label_value +var FieldDescriptorProto_Label_name = descriptorpb.FieldDescriptorProto_Label_name +var FieldDescriptorProto_Label_value = descriptorpb.FieldDescriptorProto_Label_value -type FileOptions_OptimizeMode = descriptor.FileOptions_OptimizeMode +type FileOptions_OptimizeMode = descriptorpb.FileOptions_OptimizeMode -const FileOptions_SPEED = descriptor.FileOptions_SPEED -const FileOptions_CODE_SIZE = descriptor.FileOptions_CODE_SIZE -const FileOptions_LITE_RUNTIME = descriptor.FileOptions_LITE_RUNTIME +const FileOptions_SPEED = descriptorpb.FileOptions_SPEED +const FileOptions_CODE_SIZE = descriptorpb.FileOptions_CODE_SIZE +const FileOptions_LITE_RUNTIME = descriptorpb.FileOptions_LITE_RUNTIME -var FileOptions_OptimizeMode_name = descriptor.FileOptions_OptimizeMode_name -var FileOptions_OptimizeMode_value = descriptor.FileOptions_OptimizeMode_value +var FileOptions_OptimizeMode_name = descriptorpb.FileOptions_OptimizeMode_name +var FileOptions_OptimizeMode_value = descriptorpb.FileOptions_OptimizeMode_value -type FieldOptions_CType = descriptor.FieldOptions_CType +type FieldOptions_CType = descriptorpb.FieldOptions_CType -const FieldOptions_STRING = descriptor.FieldOptions_STRING -const FieldOptions_CORD = descriptor.FieldOptions_CORD -const FieldOptions_STRING_PIECE = descriptor.FieldOptions_STRING_PIECE +const FieldOptions_STRING = descriptorpb.FieldOptions_STRING +const FieldOptions_CORD = descriptorpb.FieldOptions_CORD +const FieldOptions_STRING_PIECE = descriptorpb.FieldOptions_STRING_PIECE -var FieldOptions_CType_name = descriptor.FieldOptions_CType_name -var FieldOptions_CType_value = descriptor.FieldOptions_CType_value +var FieldOptions_CType_name = descriptorpb.FieldOptions_CType_name +var FieldOptions_CType_value = descriptorpb.FieldOptions_CType_value -type FieldOptions_JSType = descriptor.FieldOptions_JSType +type FieldOptions_JSType = descriptorpb.FieldOptions_JSType -const FieldOptions_JS_NORMAL = descriptor.FieldOptions_JS_NORMAL -const FieldOptions_JS_STRING = descriptor.FieldOptions_JS_STRING -const FieldOptions_JS_NUMBER = descriptor.FieldOptions_JS_NUMBER +const FieldOptions_JS_NORMAL = descriptorpb.FieldOptions_JS_NORMAL +const FieldOptions_JS_STRING = descriptorpb.FieldOptions_JS_STRING +const FieldOptions_JS_NUMBER = descriptorpb.FieldOptions_JS_NUMBER -var FieldOptions_JSType_name = descriptor.FieldOptions_JSType_name -var FieldOptions_JSType_value = descriptor.FieldOptions_JSType_value +var FieldOptions_JSType_name = descriptorpb.FieldOptions_JSType_name +var FieldOptions_JSType_value = descriptorpb.FieldOptions_JSType_value -type MethodOptions_IdempotencyLevel = descriptor.MethodOptions_IdempotencyLevel +type MethodOptions_IdempotencyLevel = descriptorpb.MethodOptions_IdempotencyLevel -const MethodOptions_IDEMPOTENCY_UNKNOWN = descriptor.MethodOptions_IDEMPOTENCY_UNKNOWN -const MethodOptions_NO_SIDE_EFFECTS = descriptor.MethodOptions_NO_SIDE_EFFECTS -const MethodOptions_IDEMPOTENT = descriptor.MethodOptions_IDEMPOTENT +const MethodOptions_IDEMPOTENCY_UNKNOWN = descriptorpb.MethodOptions_IDEMPOTENCY_UNKNOWN +const MethodOptions_NO_SIDE_EFFECTS = descriptorpb.MethodOptions_NO_SIDE_EFFECTS +const MethodOptions_IDEMPOTENT = descriptorpb.MethodOptions_IDEMPOTENT -var MethodOptions_IdempotencyLevel_name = descriptor.MethodOptions_IdempotencyLevel_name -var MethodOptions_IdempotencyLevel_value = descriptor.MethodOptions_IdempotencyLevel_value +var MethodOptions_IdempotencyLevel_name = descriptorpb.MethodOptions_IdempotencyLevel_name +var MethodOptions_IdempotencyLevel_value = descriptorpb.MethodOptions_IdempotencyLevel_value -type FileDescriptorSet = descriptor.FileDescriptorSet -type FileDescriptorProto = descriptor.FileDescriptorProto -type DescriptorProto = descriptor.DescriptorProto -type ExtensionRangeOptions = descriptor.ExtensionRangeOptions -type FieldDescriptorProto = descriptor.FieldDescriptorProto -type OneofDescriptorProto = descriptor.OneofDescriptorProto -type EnumDescriptorProto = descriptor.EnumDescriptorProto -type EnumValueDescriptorProto = descriptor.EnumValueDescriptorProto -type ServiceDescriptorProto = descriptor.ServiceDescriptorProto -type MethodDescriptorProto = descriptor.MethodDescriptorProto +type FileDescriptorSet = descriptorpb.FileDescriptorSet +type FileDescriptorProto = descriptorpb.FileDescriptorProto +type DescriptorProto = descriptorpb.DescriptorProto +type ExtensionRangeOptions = descriptorpb.ExtensionRangeOptions +type FieldDescriptorProto = descriptorpb.FieldDescriptorProto +type OneofDescriptorProto = descriptorpb.OneofDescriptorProto +type EnumDescriptorProto = descriptorpb.EnumDescriptorProto +type EnumValueDescriptorProto = descriptorpb.EnumValueDescriptorProto +type ServiceDescriptorProto = descriptorpb.ServiceDescriptorProto +type MethodDescriptorProto = descriptorpb.MethodDescriptorProto -const Default_MethodDescriptorProto_ClientStreaming = descriptor.Default_MethodDescriptorProto_ClientStreaming -const Default_MethodDescriptorProto_ServerStreaming = descriptor.Default_MethodDescriptorProto_ServerStreaming +const Default_MethodDescriptorProto_ClientStreaming = descriptorpb.Default_MethodDescriptorProto_ClientStreaming +const Default_MethodDescriptorProto_ServerStreaming = descriptorpb.Default_MethodDescriptorProto_ServerStreaming -type FileOptions = descriptor.FileOptions +type FileOptions = descriptorpb.FileOptions -const Default_FileOptions_JavaMultipleFiles = descriptor.Default_FileOptions_JavaMultipleFiles -const Default_FileOptions_JavaStringCheckUtf8 = descriptor.Default_FileOptions_JavaStringCheckUtf8 -const Default_FileOptions_OptimizeFor = descriptor.Default_FileOptions_OptimizeFor -const Default_FileOptions_CcGenericServices = descriptor.Default_FileOptions_CcGenericServices -const Default_FileOptions_JavaGenericServices = descriptor.Default_FileOptions_JavaGenericServices -const Default_FileOptions_PyGenericServices = descriptor.Default_FileOptions_PyGenericServices -const Default_FileOptions_PhpGenericServices = descriptor.Default_FileOptions_PhpGenericServices -const Default_FileOptions_Deprecated = descriptor.Default_FileOptions_Deprecated -const Default_FileOptions_CcEnableArenas = descriptor.Default_FileOptions_CcEnableArenas +const Default_FileOptions_JavaMultipleFiles = descriptorpb.Default_FileOptions_JavaMultipleFiles +const Default_FileOptions_JavaStringCheckUtf8 = descriptorpb.Default_FileOptions_JavaStringCheckUtf8 +const Default_FileOptions_OptimizeFor = descriptorpb.Default_FileOptions_OptimizeFor +const Default_FileOptions_CcGenericServices = descriptorpb.Default_FileOptions_CcGenericServices +const Default_FileOptions_JavaGenericServices = descriptorpb.Default_FileOptions_JavaGenericServices +const Default_FileOptions_PyGenericServices = descriptorpb.Default_FileOptions_PyGenericServices +const Default_FileOptions_PhpGenericServices = descriptorpb.Default_FileOptions_PhpGenericServices +const Default_FileOptions_Deprecated = descriptorpb.Default_FileOptions_Deprecated +const Default_FileOptions_CcEnableArenas = descriptorpb.Default_FileOptions_CcEnableArenas -type MessageOptions = descriptor.MessageOptions +type MessageOptions = descriptorpb.MessageOptions -const Default_MessageOptions_MessageSetWireFormat = descriptor.Default_MessageOptions_MessageSetWireFormat -const Default_MessageOptions_NoStandardDescriptorAccessor = descriptor.Default_MessageOptions_NoStandardDescriptorAccessor -const Default_MessageOptions_Deprecated = descriptor.Default_MessageOptions_Deprecated +const Default_MessageOptions_MessageSetWireFormat = descriptorpb.Default_MessageOptions_MessageSetWireFormat +const Default_MessageOptions_NoStandardDescriptorAccessor = descriptorpb.Default_MessageOptions_NoStandardDescriptorAccessor +const Default_MessageOptions_Deprecated = descriptorpb.Default_MessageOptions_Deprecated -type FieldOptions = descriptor.FieldOptions +type FieldOptions = descriptorpb.FieldOptions -const Default_FieldOptions_Ctype = descriptor.Default_FieldOptions_Ctype -const Default_FieldOptions_Jstype = descriptor.Default_FieldOptions_Jstype -const Default_FieldOptions_Lazy = descriptor.Default_FieldOptions_Lazy -const Default_FieldOptions_Deprecated = descriptor.Default_FieldOptions_Deprecated -const Default_FieldOptions_Weak = descriptor.Default_FieldOptions_Weak +const Default_FieldOptions_Ctype = descriptorpb.Default_FieldOptions_Ctype +const Default_FieldOptions_Jstype = descriptorpb.Default_FieldOptions_Jstype +const Default_FieldOptions_Lazy = descriptorpb.Default_FieldOptions_Lazy +const Default_FieldOptions_Deprecated = descriptorpb.Default_FieldOptions_Deprecated +const Default_FieldOptions_Weak = descriptorpb.Default_FieldOptions_Weak -type OneofOptions = descriptor.OneofOptions -type EnumOptions = descriptor.EnumOptions +type OneofOptions = descriptorpb.OneofOptions +type EnumOptions = descriptorpb.EnumOptions -const Default_EnumOptions_Deprecated = descriptor.Default_EnumOptions_Deprecated +const Default_EnumOptions_Deprecated = descriptorpb.Default_EnumOptions_Deprecated -type EnumValueOptions = descriptor.EnumValueOptions +type EnumValueOptions = descriptorpb.EnumValueOptions -const Default_EnumValueOptions_Deprecated = descriptor.Default_EnumValueOptions_Deprecated +const Default_EnumValueOptions_Deprecated = descriptorpb.Default_EnumValueOptions_Deprecated -type ServiceOptions = descriptor.ServiceOptions +type ServiceOptions = descriptorpb.ServiceOptions -const Default_ServiceOptions_Deprecated = descriptor.Default_ServiceOptions_Deprecated +const Default_ServiceOptions_Deprecated = descriptorpb.Default_ServiceOptions_Deprecated -type MethodOptions = descriptor.MethodOptions +type MethodOptions = descriptorpb.MethodOptions -const Default_MethodOptions_Deprecated = descriptor.Default_MethodOptions_Deprecated -const Default_MethodOptions_IdempotencyLevel = descriptor.Default_MethodOptions_IdempotencyLevel +const Default_MethodOptions_Deprecated = descriptorpb.Default_MethodOptions_Deprecated +const Default_MethodOptions_IdempotencyLevel = descriptorpb.Default_MethodOptions_IdempotencyLevel -type UninterpretedOption = descriptor.UninterpretedOption -type SourceCodeInfo = descriptor.SourceCodeInfo -type GeneratedCodeInfo = descriptor.GeneratedCodeInfo -type DescriptorProto_ExtensionRange = descriptor.DescriptorProto_ExtensionRange -type DescriptorProto_ReservedRange = descriptor.DescriptorProto_ReservedRange -type EnumDescriptorProto_EnumReservedRange = descriptor.EnumDescriptorProto_EnumReservedRange -type UninterpretedOption_NamePart = descriptor.UninterpretedOption_NamePart -type SourceCodeInfo_Location = descriptor.SourceCodeInfo_Location -type GeneratedCodeInfo_Annotation = descriptor.GeneratedCodeInfo_Annotation +type UninterpretedOption = descriptorpb.UninterpretedOption +type SourceCodeInfo = descriptorpb.SourceCodeInfo +type GeneratedCodeInfo = descriptorpb.GeneratedCodeInfo +type DescriptorProto_ExtensionRange = descriptorpb.DescriptorProto_ExtensionRange +type DescriptorProto_ReservedRange = descriptorpb.DescriptorProto_ReservedRange +type EnumDescriptorProto_EnumReservedRange = descriptorpb.EnumDescriptorProto_EnumReservedRange +type UninterpretedOption_NamePart = descriptorpb.UninterpretedOption_NamePart +type SourceCodeInfo_Location = descriptorpb.SourceCodeInfo_Location +type GeneratedCodeInfo_Annotation = descriptorpb.GeneratedCodeInfo_Annotation var File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto protoreflect.FileDescriptor diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index d81a9671d4..3338f45e54 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -7,7 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - plugin "google.golang.org/protobuf/types/plugin" + pluginpb "google.golang.org/protobuf/types/pluginpb" sync "sync" ) @@ -15,10 +15,10 @@ const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) // Symbols defined in public import of google/protobuf/compiler/plugin.proto -type Version = plugin.Version -type CodeGeneratorRequest = plugin.CodeGeneratorRequest -type CodeGeneratorResponse = plugin.CodeGeneratorResponse -type CodeGeneratorResponse_File = plugin.CodeGeneratorResponse_File +type Version = pluginpb.Version +type CodeGeneratorRequest = pluginpb.CodeGeneratorRequest +type CodeGeneratorResponse = pluginpb.CodeGeneratorResponse +type CodeGeneratorResponse_File = pluginpb.CodeGeneratorResponse_File var File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto protoreflect.FileDescriptor diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index f99e556c02..e849b6b56c 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -7,7 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - known "google.golang.org/protobuf/types/known" + anypb "google.golang.org/protobuf/types/known/anypb" sync "sync" ) @@ -15,7 +15,7 @@ const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) // Symbols defined in public import of google/protobuf/any.proto -type Any = known.Any +type Any = anypb.Any var File_github_com_golang_protobuf_ptypes_any_any_proto protoreflect.FileDescriptor diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index 0a204c7247..aa4d35d5a7 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -7,7 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - known "google.golang.org/protobuf/types/known" + durationpb "google.golang.org/protobuf/types/known/durationpb" sync "sync" ) @@ -15,7 +15,7 @@ const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) // Symbols defined in public import of google/protobuf/duration.proto -type Duration = known.Duration +type Duration = durationpb.Duration var File_github_com_golang_protobuf_ptypes_duration_duration_proto protoreflect.FileDescriptor diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index ffe3673bfd..525f181b1e 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -7,7 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - known "google.golang.org/protobuf/types/known" + emptypb "google.golang.org/protobuf/types/known/emptypb" sync "sync" ) @@ -15,7 +15,7 @@ const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) // Symbols defined in public import of google/protobuf/empty.proto -type Empty = known.Empty +type Empty = emptypb.Empty var File_github_com_golang_protobuf_ptypes_empty_empty_proto protoreflect.FileDescriptor diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index 774687e930..cb93243c8e 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -7,7 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - known "google.golang.org/protobuf/types/known" + structpb "google.golang.org/protobuf/types/known/structpb" sync "sync" ) @@ -15,22 +15,22 @@ const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) // Symbols defined in public import of google/protobuf/struct.proto -type NullValue = known.NullValue +type NullValue = structpb.NullValue -const NullValue_NULL_VALUE = known.NullValue_NULL_VALUE +const NullValue_NULL_VALUE = structpb.NullValue_NULL_VALUE -var NullValue_name = known.NullValue_name -var NullValue_value = known.NullValue_value +var NullValue_name = structpb.NullValue_name +var NullValue_value = structpb.NullValue_value -type Struct = known.Struct -type Value = known.Value -type Value_NullValue = known.Value_NullValue -type Value_NumberValue = known.Value_NumberValue -type Value_StringValue = known.Value_StringValue -type Value_BoolValue = known.Value_BoolValue -type Value_StructValue = known.Value_StructValue -type Value_ListValue = known.Value_ListValue -type ListValue = known.ListValue +type Struct = structpb.Struct +type Value = structpb.Value +type Value_NullValue = structpb.Value_NullValue +type Value_NumberValue = structpb.Value_NumberValue +type Value_StringValue = structpb.Value_StringValue +type Value_BoolValue = structpb.Value_BoolValue +type Value_StructValue = structpb.Value_StructValue +type Value_ListValue = structpb.Value_ListValue +type ListValue = structpb.ListValue var File_github_com_golang_protobuf_ptypes_struct_struct_proto protoreflect.FileDescriptor diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index 3fdef47606..afff160a0e 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -7,7 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - known "google.golang.org/protobuf/types/known" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" sync "sync" ) @@ -15,7 +15,7 @@ const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) // Symbols defined in public import of google/protobuf/timestamp.proto -type Timestamp = known.Timestamp +type Timestamp = timestamppb.Timestamp var File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto protoreflect.FileDescriptor diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index 5a6462f506..3e7c01f8c1 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -7,7 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - known "google.golang.org/protobuf/types/known" + wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" sync "sync" ) @@ -15,15 +15,15 @@ const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) // Symbols defined in public import of google/protobuf/wrappers.proto -type DoubleValue = known.DoubleValue -type FloatValue = known.FloatValue -type Int64Value = known.Int64Value -type UInt64Value = known.UInt64Value -type Int32Value = known.Int32Value -type UInt32Value = known.UInt32Value -type BoolValue = known.BoolValue -type StringValue = known.StringValue -type BytesValue = known.BytesValue +type DoubleValue = wrapperspb.DoubleValue +type FloatValue = wrapperspb.FloatValue +type Int64Value = wrapperspb.Int64Value +type UInt64Value = wrapperspb.UInt64Value +type Int32Value = wrapperspb.Int32Value +type UInt32Value = wrapperspb.UInt32Value +type BoolValue = wrapperspb.BoolValue +type StringValue = wrapperspb.StringValue +type BytesValue = wrapperspb.BytesValue var File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto protoreflect.FileDescriptor From a1331f0b4ab4823f6c757c2130ae4259ad9f4aec Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 22 May 2019 15:44:18 -0400 Subject: [PATCH 071/133] all: update v2 dependency This allows us to drop the dependency on runtime/protolegacy. Change-Id: I71e99f3759f024121244a9ef004dcdafdf1173c9 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/178543 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 +++- internal/proto/common.go | 1 - internal/proto/registry.go | 5 ++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index c968698d87..95e7304dab 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190516215540-a95b29fbf623 +require google.golang.org/protobuf v0.0.0-20190522194032-21ade498bd69 diff --git a/go.sum b/go.sum index 6876853749..95906ef720 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,12 @@ github.com/golang/protobuf v1.2.1-0.20190514181236-7800af189d76/go.mod h1:Zfz6qcDoDBESdv6JsKsGpgNHnkvwJAJwcA9eL+mOkgc= github.com/golang/protobuf v1.2.1-0.20190515194842-7574ba03306e/go.mod h1:GjgUz9uwrRQmdPBBrFqiVbojAmlpy6ryM6DCzC+20rE= github.com/golang/protobuf v1.2.1-0.20190516201927-a2cd3ac1b343/go.mod h1:PScGDF2x230A126tLt9Ol9RjhXzbiPJrt/CogooD2mE= +github.com/golang/protobuf v1.2.1-0.20190516215712-ae2eaafab405/go.mod h1:UmP8hhPKR5WWIjbT9v0JEVT+U0DBSjbW8KaZVeyFfRE= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= google.golang.org/protobuf v0.0.0-20190514231807-cdb777356907/go.mod h1:HeRLsKXv4+wE27dOIGwnqcOgq6a1O/GJ7mGhiEPnBrU= google.golang.org/protobuf v0.0.0-20190516201745-40b83d67fc75/go.mod h1:jf+u8AHuKtkib+0J4/bQXPNzCmT3V9a02hVzYKtatuw= -google.golang.org/protobuf v0.0.0-20190516215540-a95b29fbf623 h1:66BSNYPKX6AuAowxFl47l/DSyZ/ZekFylmbpjDMScDQ= google.golang.org/protobuf v0.0.0-20190516215540-a95b29fbf623/go.mod h1:cWWmz5lsCWIcqGLROrKq5Lu231IJw2PzqOZ8cgspbfY= +google.golang.org/protobuf v0.0.0-20190522194032-21ade498bd69 h1:C4vak6RNv+6SZeonQPm8QpfDoEd2jwk0zmv/XjuhaXc= +google.golang.org/protobuf v0.0.0-20190522194032-21ade498bd69/go.mod h1:cJytyYi/6qdwy/+gD49hmgHcwD7zhWxE/1KPEslaZ3M= diff --git a/internal/proto/common.go b/internal/proto/common.go index 3e9500fd29..d53d2aea16 100644 --- a/internal/proto/common.go +++ b/internal/proto/common.go @@ -13,7 +13,6 @@ import ( "reflect" "google.golang.org/protobuf/runtime/protoiface" - _ "google.golang.org/protobuf/runtime/protolegacy" ) type ( diff --git a/internal/proto/registry.go b/internal/proto/registry.go index b7ffe3df36..80467ffc2d 100644 --- a/internal/proto/registry.go +++ b/internal/proto/registry.go @@ -20,7 +20,6 @@ import ( pref "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" "google.golang.org/protobuf/runtime/protoimpl" - "google.golang.org/protobuf/runtime/protolegacy" "google.golang.org/protobuf/types/descriptorpb" ) @@ -317,7 +316,7 @@ func MessageName(m Message) messageName { // // Deprecated: Use protoregistry.GlobalTypes.Register instead. func RegisterExtension(d *ExtensionDesc) { - xt := protolegacy.X.ExtensionTypeFromDesc(d) + xt := protoimpl.X.ExtensionTypeFromDesc(d) if err := protoregistry.GlobalTypes.Register(xt); err != nil { panic(err) } @@ -342,7 +341,7 @@ func RegisteredExtensions(m Message) extensionsByNumber { if xs == nil { xs = make(extensionsByNumber) } - xs[int32(xt.Descriptor().Number())] = protolegacy.X.ExtensionDescFromType(xt) + xs[int32(xt.Descriptor().Number())] = protoimpl.X.ExtensionDescFromType(xt) return true }) From 76c9e09470bae064813eef4f1bbbac287df92b8b Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 4 Jun 2019 17:03:30 -0700 Subject: [PATCH 072/133] all: avoid accessing ExtensionField.Desc directly CL/180538 adds methods to ExtensionFieldV1 to provide the illusion that it only operates with protoreflect.ExtensionType. Use that instead of touching the Desc field directly. Change-Id: If6770920707ea3f277c6cfd7caf40c7ca3b0aa6f Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/180577 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 ++- proto/clone.go | 3 ++- proto/extensions.go | 9 ++++--- proto/table_marshal.go | 33 ++++++++++++----------- proto/table_unmarshal.go | 4 ++- protoc-gen-go/descriptor/descriptor.pb.go | 7 ++++- protoc-gen-go/plugin/plugin.pb.go | 7 ++++- ptypes/any/any.pb.go | 7 ++++- ptypes/duration/duration.pb.go | 7 ++++- ptypes/empty/empty.pb.go | 7 ++++- ptypes/struct/struct.pb.go | 7 ++++- ptypes/timestamp/timestamp.pb.go | 7 ++++- ptypes/wrappers/wrappers.pb.go | 7 ++++- 14 files changed, 79 insertions(+), 32 deletions(-) diff --git a/go.mod b/go.mod index 95e7304dab..fba6e659cb 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190522194032-21ade498bd69 +require google.golang.org/protobuf v0.0.0-20190605195314-89d49632e5cf diff --git a/go.sum b/go.sum index 95906ef720..97f9013542 100644 --- a/go.sum +++ b/go.sum @@ -2,11 +2,13 @@ github.com/golang/protobuf v1.2.1-0.20190514181236-7800af189d76/go.mod h1:Zfz6qc github.com/golang/protobuf v1.2.1-0.20190515194842-7574ba03306e/go.mod h1:GjgUz9uwrRQmdPBBrFqiVbojAmlpy6ryM6DCzC+20rE= github.com/golang/protobuf v1.2.1-0.20190516201927-a2cd3ac1b343/go.mod h1:PScGDF2x230A126tLt9Ol9RjhXzbiPJrt/CogooD2mE= github.com/golang/protobuf v1.2.1-0.20190516215712-ae2eaafab405/go.mod h1:UmP8hhPKR5WWIjbT9v0JEVT+U0DBSjbW8KaZVeyFfRE= +github.com/golang/protobuf v1.2.1-0.20190523175523-a1331f0b4ab4/go.mod h1:G+fNMoyvKWZDB7PCDHF+dXbH9OeE3+JoozCd9V7i66U= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= google.golang.org/protobuf v0.0.0-20190514231807-cdb777356907/go.mod h1:HeRLsKXv4+wE27dOIGwnqcOgq6a1O/GJ7mGhiEPnBrU= google.golang.org/protobuf v0.0.0-20190516201745-40b83d67fc75/go.mod h1:jf+u8AHuKtkib+0J4/bQXPNzCmT3V9a02hVzYKtatuw= google.golang.org/protobuf v0.0.0-20190516215540-a95b29fbf623/go.mod h1:cWWmz5lsCWIcqGLROrKq5Lu231IJw2PzqOZ8cgspbfY= -google.golang.org/protobuf v0.0.0-20190522194032-21ade498bd69 h1:C4vak6RNv+6SZeonQPm8QpfDoEd2jwk0zmv/XjuhaXc= google.golang.org/protobuf v0.0.0-20190522194032-21ade498bd69/go.mod h1:cJytyYi/6qdwy/+gD49hmgHcwD7zhWxE/1KPEslaZ3M= +google.golang.org/protobuf v0.0.0-20190605195314-89d49632e5cf h1:O9EJAZHrXZ8fKtT5e+sEc2u/izLtNaXiwHhthZEtsSs= +google.golang.org/protobuf v0.0.0-20190605195314-89d49632e5cf/go.mod h1:Btug4TBaP5wNYcb2zGKDTS7WMcaPPLuqEAKfEAZWYbo= diff --git a/proto/clone.go b/proto/clone.go index 11cf45132c..cd1a2e20a4 100644 --- a/proto/clone.go +++ b/proto/clone.go @@ -208,7 +208,8 @@ func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { func mergeExtension(out, in *extensionMap) { in.Range(func(extNum protoreflect.FieldNumber, eIn Extension) bool { - eOut := Extension{Desc: eIn.Desc} + var eOut Extension + eOut.SetType(eIn.GetType()) if eIn.HasValue() { v := reflect.New(reflect.TypeOf(eIn.GetValue())).Elem() mergeAny(v, reflect.ValueOf(eIn.GetValue()), false, nil) diff --git a/proto/extensions.go b/proto/extensions.go index 1dbf3c5cf1..a85ee41a57 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -270,7 +270,7 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { e := epb.Get(protoreflect.FieldNumber(extension.Field)) if e.HasValue() { // Already decoded. Check the descriptor, though. - if e.Desc != extension { + if protoimpl.X.ExtensionDescFromType(e.GetType()) != extension { // This shouldn't happen. If it does, it means that // GetExtension was called twice with two different // descriptors with the same field number. @@ -292,7 +292,7 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { // Remember the decoded version and drop the encoded version. // That way it is safe to mutate what we return. - e.Desc = extension + e.SetType(protoimpl.X.ExtensionTypeFromDesc(extension)) e.SetEagerValue(extensionAsStorageType(v)) unrecognized.SetBytes(removeRawFields(unrecognized.Bytes(), fnum)) epb.Set(protoreflect.FieldNumber(extension.Field), e) @@ -404,7 +404,7 @@ func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { } extensions := make([]*ExtensionDesc, 0, epb.Len()) epb.Range(func(extid protoreflect.FieldNumber, e Extension) bool { - desc := e.Desc + desc := protoimpl.X.ExtensionDescFromType(e.GetType()) if desc == nil { desc = registeredExtensions[int32(extid)] if desc == nil { @@ -461,7 +461,8 @@ func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) } - x := Extension{Desc: extension} + var x Extension + x.SetType(protoimpl.X.ExtensionTypeFromDesc(extension)) x.SetEagerValue(extensionAsStorageType(value)) epb.Set(protoreflect.FieldNumber(extension.Field), x) return nil diff --git a/proto/table_marshal.go b/proto/table_marshal.go index f30e134dae..c3b581de3b 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -18,6 +18,7 @@ import ( "github.com/golang/protobuf/internal/wire" "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/runtime/protoimpl" ) // a sizer takes a pointer to a field and the size of its tag, computes the size of @@ -2373,14 +2374,14 @@ func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { n := 0 m.Range(func(_ protoreflect.FieldNumber, e Extension) bool { - if e.Desc == nil || !e.HasValue() { + if !e.HasType() || !e.HasValue() { return true // should never happen } // We don't skip extensions that have an encoded form set, // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.Desc) + ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, ei.tagsize) @@ -2403,7 +2404,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de // Don't bother sorting the keys. if m.Len() <= 1 { m.Range(func(_ protoreflect.FieldNumber, e Extension) bool { - if e.Desc == nil || !e.HasValue() { + if !e.HasType() || !e.HasValue() { return true // should never happen } @@ -2411,7 +2412,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.Desc) + ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) @@ -2435,7 +2436,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de for _, k := range keys { e := m.Get(protoreflect.FieldNumber(k)) - if e.Desc == nil || !e.HasValue() { + if !e.HasType() || !e.HasValue() { continue // should never happen } @@ -2443,7 +2444,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.Desc) + ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) @@ -2475,7 +2476,7 @@ func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions, unk []byte) in n += 2 // start group, end group. tag = 1 (size=1) n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) - if e.Desc == nil || !e.HasValue() { + if !e.HasType() || !e.HasValue() { return true // should never happen } @@ -2483,7 +2484,7 @@ func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions, unk []byte) in // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.Desc) + ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, 1) // message, tag = 3 (size=1) @@ -2528,7 +2529,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, un b = append(b, 2<<3|WireVarint) b = appendVarint(b, uint64(id)) - if e.Desc == nil || !e.HasValue() { + if !e.HasType() || !e.HasValue() { return true // should never happen } @@ -2536,7 +2537,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, un // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.Desc) + ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) @@ -2583,7 +2584,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, un b = append(b, 2<<3|WireVarint) b = appendVarint(b, uint64(id)) - if e.Desc == nil || !e.HasValue() { + if !e.HasType() || !e.HasValue() { continue // should never happen } @@ -2591,7 +2592,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, un // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.Desc) + ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) @@ -2630,7 +2631,7 @@ func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { n := 0 for _, e := range m { - if e.Desc == nil || !e.HasValue() { + if !e.HasType() || !e.HasValue() { continue // should never happen } @@ -2638,7 +2639,7 @@ func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.Desc) + ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, ei.tagsize) @@ -2663,7 +2664,7 @@ func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, determ var nerr nonFatal for _, k := range keys { e := m[int32(k)] - if e.Desc == nil || !e.HasValue() { + if !e.HasType() || !e.HasValue() { continue // should never happen } @@ -2671,7 +2672,7 @@ func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, determ // because the extension value may have been mutated after // the last time this function was called. - ei := u.getExtElemInfo(e.Desc) + ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) v := e.GetValue() p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index 4c4759d272..152ab79fde 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -17,6 +17,7 @@ import ( "unicode/utf8" "github.com/golang/protobuf/internal/wire" + "google.golang.org/protobuf/runtime/protoimpl" ) // Unmarshal is the entry point from the generated .pb.go files. @@ -274,7 +275,8 @@ func unmarshalExtensions(mi Message, unrecognized *[]byte) error { } // Store the value into the extension field. - x := Extension{Desc: extDesc} + var x Extension + x.SetType(protoimpl.X.ExtensionTypeFromDesc(extDesc)) x.SetEagerValue(extensionAsStorageType(fieldVal.Interface())) extFields.Set(fieldNum, x) } diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index de08d0f55e..218fb826e8 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -11,7 +11,12 @@ import ( sync "sync" ) -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +const ( + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) +) // Symbols defined in public import of google/protobuf/descriptor.proto diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index 3338f45e54..dd111cdb31 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -11,7 +11,12 @@ import ( sync "sync" ) -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +const ( + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) +) // Symbols defined in public import of google/protobuf/compiler/plugin.proto diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index e849b6b56c..7525572f7f 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -11,7 +11,12 @@ import ( sync "sync" ) -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +const ( + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) +) // Symbols defined in public import of google/protobuf/any.proto diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index aa4d35d5a7..170354737f 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -11,7 +11,12 @@ import ( sync "sync" ) -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +const ( + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) +) // Symbols defined in public import of google/protobuf/duration.proto diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index 525f181b1e..2f729bc5bf 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -11,7 +11,12 @@ import ( sync "sync" ) -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +const ( + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) +) // Symbols defined in public import of google/protobuf/empty.proto diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index cb93243c8e..11597d5344 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -11,7 +11,12 @@ import ( sync "sync" ) -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +const ( + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) +) // Symbols defined in public import of google/protobuf/struct.proto diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index afff160a0e..04041b16e8 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -11,7 +11,12 @@ import ( sync "sync" ) -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +const ( + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) +) // Symbols defined in public import of google/protobuf/timestamp.proto diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index 3e7c01f8c1..ea4e0eacd6 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -11,7 +11,12 @@ import ( sync "sync" ) -const _ = protoimpl.EnforceVersion(protoimpl.Version - 0) +const ( + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) +) // Symbols defined in public import of google/protobuf/wrappers.proto From d3ac1a540585c578db1b184dda6ab6f0ac344f95 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 12 Jun 2019 01:53:03 -0700 Subject: [PATCH 073/133] internal/proto: use new protoreflect.Message API CL/175458 adds new Message API in preparation for deprecating the current API through the KnownFields interface. Switch to use the new API. Change-Id: I03f7e69aed846538d69b6c11dbda89114a2adedc Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/181837 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 +++- internal/proto/defaults.go | 12 +++++------ internal/proto/discard.go | 43 +++++++++++++++++++------------------- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/go.mod b/go.mod index fba6e659cb..ec9956320b 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190605195314-89d49632e5cf +require google.golang.org/protobuf v0.0.0-20190617173324-378c1329ded0 diff --git a/go.sum b/go.sum index 97f9013542..0aa65de733 100644 --- a/go.sum +++ b/go.sum @@ -3,6 +3,7 @@ github.com/golang/protobuf v1.2.1-0.20190515194842-7574ba03306e/go.mod h1:GjgUz9 github.com/golang/protobuf v1.2.1-0.20190516201927-a2cd3ac1b343/go.mod h1:PScGDF2x230A126tLt9Ol9RjhXzbiPJrt/CogooD2mE= github.com/golang/protobuf v1.2.1-0.20190516215712-ae2eaafab405/go.mod h1:UmP8hhPKR5WWIjbT9v0JEVT+U0DBSjbW8KaZVeyFfRE= github.com/golang/protobuf v1.2.1-0.20190523175523-a1331f0b4ab4/go.mod h1:G+fNMoyvKWZDB7PCDHF+dXbH9OeE3+JoozCd9V7i66U= +github.com/golang/protobuf v1.2.1-0.20190605195750-76c9e09470ba/go.mod h1:S1YIJXvYHGRCG2UmZsOcElkAYfvZLg2sDRr9+Xu8JXU= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= @@ -10,5 +11,6 @@ google.golang.org/protobuf v0.0.0-20190514231807-cdb777356907/go.mod h1:HeRLsKXv google.golang.org/protobuf v0.0.0-20190516201745-40b83d67fc75/go.mod h1:jf+u8AHuKtkib+0J4/bQXPNzCmT3V9a02hVzYKtatuw= google.golang.org/protobuf v0.0.0-20190516215540-a95b29fbf623/go.mod h1:cWWmz5lsCWIcqGLROrKq5Lu231IJw2PzqOZ8cgspbfY= google.golang.org/protobuf v0.0.0-20190522194032-21ade498bd69/go.mod h1:cJytyYi/6qdwy/+gD49hmgHcwD7zhWxE/1KPEslaZ3M= -google.golang.org/protobuf v0.0.0-20190605195314-89d49632e5cf h1:O9EJAZHrXZ8fKtT5e+sEc2u/izLtNaXiwHhthZEtsSs= google.golang.org/protobuf v0.0.0-20190605195314-89d49632e5cf/go.mod h1:Btug4TBaP5wNYcb2zGKDTS7WMcaPPLuqEAKfEAZWYbo= +google.golang.org/protobuf v0.0.0-20190617173324-378c1329ded0 h1:xWgajdfLzmZPasRoZwpEGv4W/ouKCE33vYT9lIhwXTI= +google.golang.org/protobuf v0.0.0-20190617173324-378c1329ded0/go.mod h1:+FOB8T5/Yw4ywwdyeun9/KlDeuwFYBkNQ+kVuwj9C94= diff --git a/internal/proto/defaults.go b/internal/proto/defaults.go index 0d4ae5f8ee..5056a76ece 100644 --- a/internal/proto/defaults.go +++ b/internal/proto/defaults.go @@ -19,17 +19,15 @@ func SetDefaults(m Message) { func setDefaults(m pref.Message) { fieldDescs := m.Descriptor().Fields() - knownFields := m.KnownFields() for i := 0; i < fieldDescs.Len(); i++ { fd := fieldDescs.Get(i) - num := fd.Number() - if !knownFields.Has(num) { + if !m.Has(fd) { if fd.HasDefault() { v := fd.Default() if fd.Kind() == pref.BytesKind { v = pref.ValueOf(append([]byte(nil), v.Bytes()...)) // copy the default bytes } - knownFields.Set(num, v) + m.Set(fd, v) } continue } @@ -37,12 +35,12 @@ func setDefaults(m pref.Message) { // Handle singular message. case fd.Cardinality() != pref.Repeated: if k := fd.Kind(); k == pref.MessageKind || k == pref.GroupKind { - setDefaults(knownFields.Get(num).Message()) + setDefaults(m.Get(fd).Message()) } // Handle list of messages. case !fd.IsMap(): if k := fd.Kind(); k == pref.MessageKind || k == pref.GroupKind { - ls := knownFields.Get(num).List() + ls := m.Get(fd).List() for i := 0; i < ls.Len(); i++ { setDefaults(ls.Get(i).Message()) } @@ -51,7 +49,7 @@ func setDefaults(m pref.Message) { default: k := fd.Message().Fields().ByNumber(2).Kind() if k == pref.MessageKind || k == pref.GroupKind { - ms := knownFields.Get(num).Map() + ms := m.Get(fd).Map() ms.Range(func(_ pref.MapKey, v pref.Value) bool { setDefaults(v.Message()) return true diff --git a/internal/proto/discard.go b/internal/proto/discard.go index 03bceaba17..6ef7452838 100644 --- a/internal/proto/discard.go +++ b/internal/proto/discard.go @@ -5,6 +5,7 @@ package proto import ( + "github.com/golang/protobuf/internal/wire" pref "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/runtime/protoimpl" ) @@ -28,32 +29,25 @@ func DiscardUnknown(m Message) { } func discardUnknown(m pref.Message) { - fieldDescs := m.Descriptor().Fields() - knownFields := m.KnownFields() - knownFields.Range(func(num pref.FieldNumber, val pref.Value) bool { - fd := fieldDescs.ByNumber(num) - if fd == nil { - fd = knownFields.ExtensionTypes().ByNumber(num).Descriptor() - } + m.Range(func(fd pref.FieldDescriptor, val pref.Value) bool { switch { // Handle singular message. case fd.Cardinality() != pref.Repeated: - if k := fd.Kind(); k == pref.MessageKind || k == pref.GroupKind { - discardUnknown(knownFields.Get(num).Message()) + if fd.Message() != nil { + discardUnknown(m.Get(fd).Message()) } // Handle list of messages. - case !fd.IsMap(): - if k := fd.Kind(); k == pref.MessageKind || k == pref.GroupKind { - ls := knownFields.Get(num).List() + case fd.IsList(): + if fd.Message() != nil { + ls := m.Get(fd).List() for i := 0; i < ls.Len(); i++ { discardUnknown(ls.Get(i).Message()) } } // Handle map of messages. - default: - k := fd.Message().Fields().ByNumber(2).Kind() - if k == pref.MessageKind || k == pref.GroupKind { - ms := knownFields.Get(num).Map() + case fd.IsMap(): + if fd.MapValue().Message() != nil { + ms := m.Get(fd).Map() ms.Range(func(_ pref.MapKey, v pref.Value) bool { discardUnknown(v.Message()) return true @@ -63,14 +57,19 @@ func discardUnknown(m pref.Message) { return true }) + // Discard unknown fields. + var bo pref.RawFields extRanges := m.Descriptor().ExtensionRanges() - unknownFields := m.UnknownFields() - unknownFields.Range(func(num pref.FieldNumber, _ pref.RawFields) bool { + for bi := m.GetUnknown(); len(bi) > 0; { // NOTE: Historically, this function did not discard unknown fields // that were within the extension field ranges. - if !extRanges.Has(num) { - unknownFields.Set(num, nil) + num, _, n := wire.ConsumeField(bi) + if extRanges.Has(num) { + bo = append(bo, bi[:n]...) } - return true - }) + bi = bi[n:] + } + if bi := m.GetUnknown(); len(bi) != len(bo) { + m.SetUnknown(bo) + } } From f94016f5239fe2597c78eefff4c8e5abdc121cf2 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Sat, 15 Jun 2019 22:41:51 -0700 Subject: [PATCH 074/133] internal/proto: use protoregistry.Files.FindFileByPath CL/182497 adds this new API. Change-Id: I14498a3b4ef295e8c9512e1a2ec10553915c7a92 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/182517 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 ++-- internal/proto/registry.go | 10 +--------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index ec9956320b..d9eaedce1c 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190617173324-378c1329ded0 +require google.golang.org/protobuf v0.0.0-20190617175724-bd7b7a9e0c26 diff --git a/go.sum b/go.sum index 0aa65de733..8abc3c4f23 100644 --- a/go.sum +++ b/go.sum @@ -12,5 +12,5 @@ google.golang.org/protobuf v0.0.0-20190516201745-40b83d67fc75/go.mod h1:jf+u8AHu google.golang.org/protobuf v0.0.0-20190516215540-a95b29fbf623/go.mod h1:cWWmz5lsCWIcqGLROrKq5Lu231IJw2PzqOZ8cgspbfY= google.golang.org/protobuf v0.0.0-20190522194032-21ade498bd69/go.mod h1:cJytyYi/6qdwy/+gD49hmgHcwD7zhWxE/1KPEslaZ3M= google.golang.org/protobuf v0.0.0-20190605195314-89d49632e5cf/go.mod h1:Btug4TBaP5wNYcb2zGKDTS7WMcaPPLuqEAKfEAZWYbo= -google.golang.org/protobuf v0.0.0-20190617173324-378c1329ded0 h1:xWgajdfLzmZPasRoZwpEGv4W/ouKCE33vYT9lIhwXTI= -google.golang.org/protobuf v0.0.0-20190617173324-378c1329ded0/go.mod h1:+FOB8T5/Yw4ywwdyeun9/KlDeuwFYBkNQ+kVuwj9C94= +google.golang.org/protobuf v0.0.0-20190617175724-bd7b7a9e0c26 h1:TNW9FO1kBCrRCRWMg37SPUITvx76qDVlAja8TSVvX4c= +google.golang.org/protobuf v0.0.0-20190617175724-bd7b7a9e0c26/go.mod h1:+FOB8T5/Yw4ywwdyeun9/KlDeuwFYBkNQ+kVuwj9C94= diff --git a/internal/proto/registry.go b/internal/proto/registry.go index 80467ffc2d..aa02c87648 100644 --- a/internal/proto/registry.go +++ b/internal/proto/registry.go @@ -78,11 +78,7 @@ func FileDescriptor(s filePath) (d fileDescGZIP) { } // Find the descriptor in the v2 registry. - var n int - protoregistry.GlobalFiles.RangeFilesByPath(s, func(fd pref.FileDescriptor) bool { - n++ - - // Convert the structured file descriptor to the raw descriptor proto. + if fd, _ := protoregistry.GlobalFiles.FindFileByPath(s); fd != nil { pb := protodesc.ToFileDescriptorProto(fd) b, err := protoV2.Marshal(pb) if err != nil { @@ -97,10 +93,6 @@ func FileDescriptor(s filePath) (d fileDescGZIP) { panic(fmt.Sprintf("proto: compression failure: %v", err)) } d = bb.Bytes() - return true - }) - if n > 1 { - return d // best-effort; may be non-deterministic } // Locally cache the raw descriptor form for the file. From 1ee46dfd80dd9d046f17c902c162c663347b5e7c Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 19 Jun 2019 19:09:27 -0700 Subject: [PATCH 075/133] all: update v2 dependency to 20190620020611-d888139e7b59 This pulls in CL/182360 which splits protoimpl.FileBuilder into protoimpl.DescBuilder and protoimpl.TypeBuilder. Change-Id: Iddf7fcbf6aa32476f78199071fabc66b28167772 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/183100 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 +- jsonpb/jsonpb_test.go | 47 +++++++++++++++++++++++ protoc-gen-go/descriptor/descriptor.pb.go | 24 ++++++++---- protoc-gen-go/plugin/plugin.pb.go | 24 ++++++++---- ptypes/any/any.pb.go | 24 ++++++++---- ptypes/duration/duration.pb.go | 24 ++++++++---- ptypes/empty/empty.pb.go | 24 ++++++++---- ptypes/struct/struct.pb.go | 24 ++++++++---- ptypes/timestamp/timestamp.pb.go | 24 ++++++++---- ptypes/wrappers/wrappers.pb.go | 24 ++++++++---- 11 files changed, 187 insertions(+), 58 deletions(-) diff --git a/go.mod b/go.mod index d9eaedce1c..26dbf5d706 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190617175724-bd7b7a9e0c26 +require google.golang.org/protobuf v0.0.0-20190620020611-d888139e7b59 diff --git a/go.sum b/go.sum index 8abc3c4f23..46ffa01ea3 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,7 @@ github.com/golang/protobuf v1.2.1-0.20190516201927-a2cd3ac1b343/go.mod h1:PScGDF github.com/golang/protobuf v1.2.1-0.20190516215712-ae2eaafab405/go.mod h1:UmP8hhPKR5WWIjbT9v0JEVT+U0DBSjbW8KaZVeyFfRE= github.com/golang/protobuf v1.2.1-0.20190523175523-a1331f0b4ab4/go.mod h1:G+fNMoyvKWZDB7PCDHF+dXbH9OeE3+JoozCd9V7i66U= github.com/golang/protobuf v1.2.1-0.20190605195750-76c9e09470ba/go.mod h1:S1YIJXvYHGRCG2UmZsOcElkAYfvZLg2sDRr9+Xu8JXU= +github.com/golang/protobuf v1.2.1-0.20190617175902-f94016f5239f/go.mod h1:G+HpKX7pYZAVkElkAWZkr08MToW6pTp/vs+E9osFfbg= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= @@ -12,5 +13,6 @@ google.golang.org/protobuf v0.0.0-20190516201745-40b83d67fc75/go.mod h1:jf+u8AHu google.golang.org/protobuf v0.0.0-20190516215540-a95b29fbf623/go.mod h1:cWWmz5lsCWIcqGLROrKq5Lu231IJw2PzqOZ8cgspbfY= google.golang.org/protobuf v0.0.0-20190522194032-21ade498bd69/go.mod h1:cJytyYi/6qdwy/+gD49hmgHcwD7zhWxE/1KPEslaZ3M= google.golang.org/protobuf v0.0.0-20190605195314-89d49632e5cf/go.mod h1:Btug4TBaP5wNYcb2zGKDTS7WMcaPPLuqEAKfEAZWYbo= -google.golang.org/protobuf v0.0.0-20190617175724-bd7b7a9e0c26 h1:TNW9FO1kBCrRCRWMg37SPUITvx76qDVlAja8TSVvX4c= google.golang.org/protobuf v0.0.0-20190617175724-bd7b7a9e0c26/go.mod h1:+FOB8T5/Yw4ywwdyeun9/KlDeuwFYBkNQ+kVuwj9C94= +google.golang.org/protobuf v0.0.0-20190620020611-d888139e7b59 h1:8413FO+8BbzBumkamWfo1VRHJyPBKBUeerQodlLbb0g= +google.golang.org/protobuf v0.0.0-20190620020611-d888139e7b59/go.mod h1:of3pt14Y+dOxz2tBOHXEoapPpKFC15/0zWhPAddkfsU= diff --git a/jsonpb/jsonpb_test.go b/jsonpb/jsonpb_test.go index a8000c91d9..93ed06d3a1 100644 --- a/jsonpb/jsonpb_test.go +++ b/jsonpb/jsonpb_test.go @@ -6,6 +6,7 @@ package jsonpb import ( "bytes" + "compress/gzip" "encoding/json" "io" "math" @@ -17,6 +18,7 @@ import ( pb "github.com/golang/protobuf/jsonpb/jsonpb_test_proto" proto3pb "github.com/golang/protobuf/proto/proto3_proto" + descriptorpb "github.com/golang/protobuf/protoc-gen-go/descriptor" "github.com/golang/protobuf/ptypes" anypb "github.com/golang/protobuf/ptypes/any" durpb "github.com/golang/protobuf/ptypes/duration" @@ -1046,6 +1048,10 @@ func (m *ptrFieldMessage) String() string { func (m *ptrFieldMessage) ProtoMessage() { } +func (m *ptrFieldMessage) Descriptor() ([]byte, []int) { + return testMessageFD, []int{0} +} + type stringField struct { IsSet bool `protobuf:"varint,1,opt,name=isSet"` StringValue string `protobuf:"bytes,2,opt,name=stringValue"` @@ -1061,6 +1067,10 @@ func (s *stringField) String() string { func (s *stringField) ProtoMessage() { } +func (s *stringField) Descriptor() ([]byte, []int) { + return testMessageFD, []int{1} +} + func (s *stringField) UnmarshalJSONPB(jum *Unmarshaler, js []byte) error { s.IsSet = true s.StringValue = string(js) @@ -1088,6 +1098,10 @@ func (m *dynamicMessage) String() string { func (m *dynamicMessage) ProtoMessage() { } +func (m *dynamicMessage) Descriptor() ([]byte, []int) { + return testMessageFD, []int{2} +} + func (m *dynamicMessage) MarshalJSONPB(jm *Marshaler) ([]byte, error) { return []byte(m.RawJson), nil } @@ -1097,6 +1111,39 @@ func (m *dynamicMessage) UnmarshalJSONPB(jum *Unmarshaler, js []byte) error { return nil } +var testMessageFD = func() []byte { + fd := new(descriptorpb.FileDescriptorProto) + proto.UnmarshalText(` + name: "jsonpb.proto" + package: "github_com.golang.protobuf.jsonpb" + syntax: "proto3" + message_type: [{ + name: "ptrFieldMessage" + field: [ + {name:"stringField" number:1 label:LABEL_OPTIONAL type:TYPE_MESSAGE type_name:".github_com.golang.protobuf.jsonpb.stringField"} + ] + }, { + name: "stringField" + field: [ + {name:"isSet" number:1 label:LABEL_OPTIONAL type:TYPE_BOOL}, + {name:"stringValue" number:2 label:LABEL_OPTIONAL type:TYPE_STRING} + ] + }, { + name: "dynamicMessage" + field: [ + {name:"rawJson" number:1 label:LABEL_OPTIONAL type:TYPE_BYTES}, + {name:"dummy" number:2 label:LABEL_OPTIONAL type:TYPE_MESSAGE type_name:".github_com.golang.protobuf.jsonpb.dynamicMessage"} + ] + }] + `, fd) + b, _ := proto.Marshal(fd) + var buf bytes.Buffer + zw := gzip.NewWriter(&buf) + zw.Write(b) + zw.Close() + return buf.Bytes() +}() + // Test unmarshaling message containing unset required fields should produce error. func TestUnmarshalUnsetRequiredFields(t *testing.T) { tests := []struct { diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index 218fb826e8..0e07d08624 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -5,7 +5,6 @@ package descriptor import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" sync "sync" @@ -187,20 +186,31 @@ func file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_r } var file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = []int32{ + 0, // starting offset of method output_type sub-list + 0, // starting offset of method input_type sub-list + 0, // starting offset of extension type_name sub-list + 0, // starting offset of extension extendee sub-list + 0, // starting offset of field type_name sub-list +} func init() { file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_init() } func file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_init() { if File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto != nil { return } - File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto = protoimpl.FileBuilder{ - RawDescriptor: file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc, + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + RawDescriptor: file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, GoTypes: file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes, DependencyIndexes: file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs, - FilesRegistry: protoregistry.GlobalFiles, - TypesRegistry: protoregistry.GlobalTypes, - }.Init() + }.Build() + File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto = out.File file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc = nil file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = nil file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = nil diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index dd111cdb31..5d88470c36 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -5,7 +5,6 @@ package plugin_go import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" pluginpb "google.golang.org/protobuf/types/pluginpb" sync "sync" @@ -54,20 +53,31 @@ func file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescGZ } var file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = []int32{ + 0, // starting offset of method output_type sub-list + 0, // starting offset of method input_type sub-list + 0, // starting offset of extension type_name sub-list + 0, // starting offset of extension extendee sub-list + 0, // starting offset of field type_name sub-list +} func init() { file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init() } func file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init() { if File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto != nil { return } - File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto = protoimpl.FileBuilder{ - RawDescriptor: file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc, + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + RawDescriptor: file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, GoTypes: file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes, DependencyIndexes: file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs, - FilesRegistry: protoregistry.GlobalFiles, - TypesRegistry: protoregistry.GlobalTypes, - }.Init() + }.Build() + File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto = out.File file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc = nil file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = nil file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = nil diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index 7525572f7f..d076aa2df9 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -5,7 +5,6 @@ package any import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" sync "sync" @@ -49,20 +48,31 @@ func file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescGZIP() []byte { } var file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{ + 0, // starting offset of method output_type sub-list + 0, // starting offset of method input_type sub-list + 0, // starting offset of extension type_name sub-list + 0, // starting offset of extension extendee sub-list + 0, // starting offset of field type_name sub-list +} func init() { file_github_com_golang_protobuf_ptypes_any_any_proto_init() } func file_github_com_golang_protobuf_ptypes_any_any_proto_init() { if File_github_com_golang_protobuf_ptypes_any_any_proto != nil { return } - File_github_com_golang_protobuf_ptypes_any_any_proto = protoimpl.FileBuilder{ - RawDescriptor: file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc, + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + RawDescriptor: file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, GoTypes: file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes, DependencyIndexes: file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs, - FilesRegistry: protoregistry.GlobalFiles, - TypesRegistry: protoregistry.GlobalTypes, - }.Init() + }.Build() + File_github_com_golang_protobuf_ptypes_any_any_proto = out.File file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = nil file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = nil file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = nil diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index 170354737f..8dc1778321 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -5,7 +5,6 @@ package duration import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" durationpb "google.golang.org/protobuf/types/known/durationpb" sync "sync" @@ -50,20 +49,31 @@ func file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescGZIP( } var file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = []int32{ + 0, // starting offset of method output_type sub-list + 0, // starting offset of method input_type sub-list + 0, // starting offset of extension type_name sub-list + 0, // starting offset of extension extendee sub-list + 0, // starting offset of field type_name sub-list +} func init() { file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() } func file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() { if File_github_com_golang_protobuf_ptypes_duration_duration_proto != nil { return } - File_github_com_golang_protobuf_ptypes_duration_duration_proto = protoimpl.FileBuilder{ - RawDescriptor: file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc, + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + RawDescriptor: file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, GoTypes: file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes, DependencyIndexes: file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs, - FilesRegistry: protoregistry.GlobalFiles, - TypesRegistry: protoregistry.GlobalTypes, - }.Init() + }.Build() + File_github_com_golang_protobuf_ptypes_duration_duration_proto = out.File file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = nil file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = nil file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = nil diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index 2f729bc5bf..890ab4ceff 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -5,7 +5,6 @@ package empty import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" sync "sync" @@ -49,20 +48,31 @@ func file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescGZIP() []by } var file_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = []int32{ + 0, // starting offset of method output_type sub-list + 0, // starting offset of method input_type sub-list + 0, // starting offset of extension type_name sub-list + 0, // starting offset of extension extendee sub-list + 0, // starting offset of field type_name sub-list +} func init() { file_github_com_golang_protobuf_ptypes_empty_empty_proto_init() } func file_github_com_golang_protobuf_ptypes_empty_empty_proto_init() { if File_github_com_golang_protobuf_ptypes_empty_empty_proto != nil { return } - File_github_com_golang_protobuf_ptypes_empty_empty_proto = protoimpl.FileBuilder{ - RawDescriptor: file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc, + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + RawDescriptor: file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, GoTypes: file_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes, DependencyIndexes: file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs, - FilesRegistry: protoregistry.GlobalFiles, - TypesRegistry: protoregistry.GlobalTypes, - }.Init() + }.Build() + File_github_com_golang_protobuf_ptypes_empty_empty_proto = out.File file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc = nil file_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = nil file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = nil diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index 11597d5344..47e8fd776c 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -5,7 +5,6 @@ package structpb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" structpb "google.golang.org/protobuf/types/known/structpb" sync "sync" @@ -65,20 +64,31 @@ func file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescGZIP() [] } var file_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = []int32{ + 0, // starting offset of method output_type sub-list + 0, // starting offset of method input_type sub-list + 0, // starting offset of extension type_name sub-list + 0, // starting offset of extension extendee sub-list + 0, // starting offset of field type_name sub-list +} func init() { file_github_com_golang_protobuf_ptypes_struct_struct_proto_init() } func file_github_com_golang_protobuf_ptypes_struct_struct_proto_init() { if File_github_com_golang_protobuf_ptypes_struct_struct_proto != nil { return } - File_github_com_golang_protobuf_ptypes_struct_struct_proto = protoimpl.FileBuilder{ - RawDescriptor: file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc, + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + RawDescriptor: file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, GoTypes: file_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes, DependencyIndexes: file_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs, - FilesRegistry: protoregistry.GlobalFiles, - TypesRegistry: protoregistry.GlobalTypes, - }.Init() + }.Build() + File_github_com_golang_protobuf_ptypes_struct_struct_proto = out.File file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc = nil file_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = nil file_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = nil diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index 04041b16e8..32fe5b318c 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -5,7 +5,6 @@ package timestamp import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" timestamppb "google.golang.org/protobuf/types/known/timestamppb" sync "sync" @@ -51,20 +50,31 @@ func file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescGZI } var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = []int32{ + 0, // starting offset of method output_type sub-list + 0, // starting offset of method input_type sub-list + 0, // starting offset of extension type_name sub-list + 0, // starting offset of extension extendee sub-list + 0, // starting offset of field type_name sub-list +} func init() { file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() } func file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() { if File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto != nil { return } - File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto = protoimpl.FileBuilder{ - RawDescriptor: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc, + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + RawDescriptor: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, GoTypes: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes, DependencyIndexes: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs, - FilesRegistry: protoregistry.GlobalFiles, - TypesRegistry: protoregistry.GlobalTypes, - }.Init() + }.Build() + File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto = out.File file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = nil file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = nil file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = nil diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index ea4e0eacd6..dec0553be4 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -5,7 +5,6 @@ package wrappers import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoregistry "google.golang.org/protobuf/reflect/protoregistry" protoimpl "google.golang.org/protobuf/runtime/protoimpl" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" sync "sync" @@ -58,20 +57,31 @@ func file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescGZIP( } var file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = []int32{} +var file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = []int32{ + 0, // starting offset of method output_type sub-list + 0, // starting offset of method input_type sub-list + 0, // starting offset of extension type_name sub-list + 0, // starting offset of extension extendee sub-list + 0, // starting offset of field type_name sub-list +} func init() { file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() } func file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() { if File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto != nil { return } - File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto = protoimpl.FileBuilder{ - RawDescriptor: file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc, + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + RawDescriptor: file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, GoTypes: file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes, DependencyIndexes: file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs, - FilesRegistry: protoregistry.GlobalFiles, - TypesRegistry: protoregistry.GlobalTypes, - }.Init() + }.Build() + File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto = out.File file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc = nil file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = nil file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = nil From 346ae1c1bae89564862965d1ab32d202f2afbcd9 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Thu, 27 Jun 2019 12:40:37 -0700 Subject: [PATCH 076/133] internal/proto: set filename in FileDescriptorProto when missing Some old descriptors don't include a filename. When missing, set it from the filename provided to proto.RegisterFile. Fixes a number of warnings in the google.golang.org/protobuf tests stemming from the legacy generated files: WARNING: proto: file "" is already registered A future release of proto will panic on registration conflicts. Change-Id: I4f7c9e4a9ecb4d2a71073b0a373ec0c800e2ec66 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/184078 Reviewed-by: Joe Tsai --- internal/proto/registry.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/proto/registry.go b/internal/proto/registry.go index aa02c87648..d3a5b6074c 100644 --- a/internal/proto/registry.go +++ b/internal/proto/registry.go @@ -52,6 +52,10 @@ func RegisterFile(s filePath, d fileDescGZIP) { if err := protoV2.Unmarshal(b, &pb); err != nil { panic(fmt.Sprintf("proto: unmarshal failure: %v", err)) } + // Some old descriptors don't include the filename. + if pb.Name == nil { + pb.Name = &s + } // Convert the raw descriptor to a structured file descriptor. fd, err := protodesc.NewFile(&pb, nil) From b9f5089fb9d4f7e6d1126161d93549e300c70f50 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 15 Jul 2019 15:51:53 -0700 Subject: [PATCH 077/133] all: update to latest google.golang.org/protobuf Local changes were made to account for the following upstream changes: * Internal fields are now unexported: XXX_sizecache -> sizeCache XXX_unrecognized -> unknownFields XXX_InternalExtensions -> extensionFields * Every message has a *protoimpl.MessageState as the first field * Well-known types no longer have an XXX_WellKnownType method * MessageSets now lack the protobuf_messageset tag * Extensions of MessageSets now use their real name * Messages no longer have a XXX_OneofWrappers method Change-Id: Iec13a8b113d523ed11493fa713e7c6df8895b9ed Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/186538 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 +- internal/proto/properties.go | 14 +- jsonpb/jsonpb.go | 479 ++++++++++++---------- jsonpb/jsonpb_test.go | 2 +- proto/all_test.go | 10 + proto/clone.go | 6 +- proto/discard.go | 19 +- proto/equal.go | 24 +- proto/extensions.go | 15 +- proto/extensions_test.go | 95 +++-- proto/lib.go | 68 +++ proto/message_set.go | 2 +- proto/pointer_reflect.go | 52 ++- proto/pointer_unsafe.go | 19 +- proto/properties.go | 11 +- proto/table_marshal.go | 44 +- proto/table_merge.go | 13 +- proto/table_unmarshal.go | 40 +- proto/text.go | 45 +- proto/text_parser.go | 4 + protoc-gen-go/descriptor/descriptor.pb.go | 3 + protoc-gen-go/plugin/plugin.pb.go | 3 + ptypes/any/any.pb.go | 3 + ptypes/duration/duration.pb.go | 3 + ptypes/empty/empty.pb.go | 3 + ptypes/struct/struct.pb.go | 3 + ptypes/timestamp/timestamp.pb.go | 3 + ptypes/wrappers/wrappers.pb.go | 3 + test.bash | 16 +- 30 files changed, 618 insertions(+), 390 deletions(-) diff --git a/go.mod b/go.mod index 26dbf5d706..c65c56d005 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190620020611-d888139e7b59 +require google.golang.org/protobuf v0.0.0-20190717230113-f647c82cc3c7 diff --git a/go.sum b/go.sum index 46ffa01ea3..ae4387fee5 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,7 @@ github.com/golang/protobuf v1.2.1-0.20190516215712-ae2eaafab405/go.mod h1:UmP8hh github.com/golang/protobuf v1.2.1-0.20190523175523-a1331f0b4ab4/go.mod h1:G+fNMoyvKWZDB7PCDHF+dXbH9OeE3+JoozCd9V7i66U= github.com/golang/protobuf v1.2.1-0.20190605195750-76c9e09470ba/go.mod h1:S1YIJXvYHGRCG2UmZsOcElkAYfvZLg2sDRr9+Xu8JXU= github.com/golang/protobuf v1.2.1-0.20190617175902-f94016f5239f/go.mod h1:G+HpKX7pYZAVkElkAWZkr08MToW6pTp/vs+E9osFfbg= +github.com/golang/protobuf v1.2.1-0.20190620192300-1ee46dfd80dd/go.mod h1:+CMAsi9jpYf/wAltLUKlg++CWXqxCJyD8iLDbQONsJs= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= @@ -14,5 +15,6 @@ google.golang.org/protobuf v0.0.0-20190516215540-a95b29fbf623/go.mod h1:cWWmz5ls google.golang.org/protobuf v0.0.0-20190522194032-21ade498bd69/go.mod h1:cJytyYi/6qdwy/+gD49hmgHcwD7zhWxE/1KPEslaZ3M= google.golang.org/protobuf v0.0.0-20190605195314-89d49632e5cf/go.mod h1:Btug4TBaP5wNYcb2zGKDTS7WMcaPPLuqEAKfEAZWYbo= google.golang.org/protobuf v0.0.0-20190617175724-bd7b7a9e0c26/go.mod h1:+FOB8T5/Yw4ywwdyeun9/KlDeuwFYBkNQ+kVuwj9C94= -google.golang.org/protobuf v0.0.0-20190620020611-d888139e7b59 h1:8413FO+8BbzBumkamWfo1VRHJyPBKBUeerQodlLbb0g= google.golang.org/protobuf v0.0.0-20190620020611-d888139e7b59/go.mod h1:of3pt14Y+dOxz2tBOHXEoapPpKFC15/0zWhPAddkfsU= +google.golang.org/protobuf v0.0.0-20190717230113-f647c82cc3c7 h1:U6U+Hb+UKNGJB0eMAjUGk0wTmy73kduTIvdsEgA4Gf8= +google.golang.org/protobuf v0.0.0-20190717230113-f647c82cc3c7/go.mod h1:yGm7aNHn9Bp1NIvj6+CVUkcJshu+Usshfd3A+YxEuI8= diff --git a/internal/proto/properties.go b/internal/proto/properties.go index a3d024b6c3..d129248e01 100644 --- a/internal/proto/properties.go +++ b/internal/proto/properties.go @@ -11,6 +11,7 @@ import ( "strings" "sync" + protoV2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/runtime/protoimpl" ) @@ -251,10 +252,10 @@ func newProperties(t reflect.Type) *StructProperties { p.OrigName = tagOneof } - // Rename unrelated struct fields with the "XXX_" prefix since so much - // user code simply checks for this to exclude special fields. - if tagField == "" && tagOneof == "" && !strings.HasPrefix(p.Name, "XXX_") { - p.Name = "XXX_invalid_" + p.Name + // Rename unexported struct fields with the "XXX_" prefix since so much + // user code simply checks for this to exclude unrelated fields. + if f.PkgPath != "" { + p.Name = "XXX_" + p.Name } prop.Prop = append(prop.Prop, p) @@ -268,6 +269,11 @@ func newProperties(t reflect.Type) *StructProperties { if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok { oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0].Interface().([]interface{}) } + if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoV2.Message); ok { + if m, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *protoimpl.MessageInfo }); ok { + oneofWrappers = m.ProtoMessageInfo().OneofWrappers + } + } if len(oneofWrappers) > 0 { prop.OneofTypes = make(map[string]*OneofProperties) for _, wrapper := range oneofWrappers { diff --git a/jsonpb/jsonpb.go b/jsonpb/jsonpb.go index 6bcb71946e..0d817d5e17 100644 --- a/jsonpb/jsonpb.go +++ b/jsonpb/jsonpb.go @@ -23,6 +23,8 @@ import ( "time" "github.com/golang/protobuf/proto" + protoV2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" stpb "github.com/golang/protobuf/ptypes/struct" ) @@ -131,8 +133,31 @@ func (s int32Slice) Len() int { return len(s) } func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -type wkt interface { - XXX_WellKnownType() string +func wellKnownType(v interface{}) string { + var s protoreflect.FullName + switch v := v.(type) { + case interface{ XXX_WellKnownType() string }: + return v.XXX_WellKnownType() + case protoreflect.Enum: + s = v.Descriptor().FullName() + case protoreflect.ProtoMessage: + s = v.ProtoReflect().Descriptor().FullName() + } + if s.Parent() == "google.protobuf" { + switch s.Name() { + case "Empty", + "Any", + "BoolValue", + "FloatValue", "DoubleValue", + "Int32Value", "Int64Value", + "UInt32Value", "UInt64Value", + "BytesValue", "StringValue", + "Duration", "Timestamp", + "NullValue", "Struct", "Value", "ListValue": + return string(s.Name()) + } + } + return "" } // marshalObject writes a struct to the Writer. @@ -165,71 +190,69 @@ func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeU s := reflect.ValueOf(v).Elem() // Handle well-known types. - if wkt, ok := v.(wkt); ok { - switch wkt.XXX_WellKnownType() { - case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", - "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": - // "Wrappers use the same representation in JSON - // as the wrapped primitive type, ..." - sprop := proto.GetProperties(s.Type()) - return m.marshalValue(out, sprop.Prop[0], s.Field(0), indent) - case "Any": - // Any is a bit more involved. - return m.marshalAny(out, v, indent) - case "Duration": - // "Generated output always contains 0, 3, 6, or 9 fractional digits, - // depending on required precision." - s, ns := s.Field(0).Int(), s.Field(1).Int() - if ns <= -secondInNanos || ns >= secondInNanos { - return fmt.Errorf("ns out of range (%v, %v)", -secondInNanos, secondInNanos) - } - if (s > 0 && ns < 0) || (s < 0 && ns > 0) { - return errors.New("signs of seconds and nanos do not match") - } - if s < 0 { - ns = -ns - } - x := fmt.Sprintf("%d.%09d", s, ns) - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, ".000") - out.write(`"`) - out.write(x) - out.write(`s"`) - return out.err - case "Struct", "ListValue": - // Let marshalValue handle the `Struct.fields` map or the `ListValue.values` slice. - // TODO: pass the correct Properties if needed. - return m.marshalValue(out, &proto.Properties{}, s.Field(0), indent) - case "Timestamp": - // "RFC 3339, where generated output will always be Z-normalized - // and uses 0, 3, 6 or 9 fractional digits." - s, ns := s.Field(0).Int(), s.Field(1).Int() - if ns < 0 || ns >= secondInNanos { - return fmt.Errorf("ns out of range [0, %v)", secondInNanos) - } - t := time.Unix(s, ns).UTC() - // time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits). - x := t.Format("2006-01-02T15:04:05.000000000") - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, ".000") - out.write(`"`) - out.write(x) - out.write(`Z"`) - return out.err - case "Value": - // Value has a single oneof. - kind := s.Field(0) - if kind.IsNil() { - // "absence of any variant indicates an error" - return errors.New("nil Value") - } - // oneof -> *T -> T -> T.F - x := kind.Elem().Elem().Field(0) - // TODO: pass the correct Properties if needed. - return m.marshalValue(out, &proto.Properties{}, x, indent) + switch wellKnownType(v) { + case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", + "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": + // "Wrappers use the same representation in JSON + // as the wrapped primitive type, ..." + sprop := proto.GetProperties(s.Type()) + return m.marshalValue(out, sprop.Prop[1], s.Field(1), indent) + case "Any": + // Any is a bit more involved. + return m.marshalAny(out, v, indent) + case "Duration": + // "Generated output always contains 0, 3, 6, or 9 fractional digits, + // depending on required precision." + s, ns := s.Field(1).Int(), s.Field(2).Int() + if ns <= -secondInNanos || ns >= secondInNanos { + return fmt.Errorf("ns out of range (%v, %v)", -secondInNanos, secondInNanos) + } + if (s > 0 && ns < 0) || (s < 0 && ns > 0) { + return errors.New("signs of seconds and nanos do not match") + } + if s < 0 { + ns = -ns + } + x := fmt.Sprintf("%d.%09d", s, ns) + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, ".000") + out.write(`"`) + out.write(x) + out.write(`s"`) + return out.err + case "Struct", "ListValue": + // Let marshalValue handle the `Struct.fields` map or the `ListValue.values` slice. + // TODO: pass the correct Properties if needed. + return m.marshalValue(out, &proto.Properties{}, s.Field(1), indent) + case "Timestamp": + // "RFC 3339, where generated output will always be Z-normalized + // and uses 0, 3, 6 or 9 fractional digits." + s, ns := s.Field(1).Int(), s.Field(2).Int() + if ns < 0 || ns >= secondInNanos { + return fmt.Errorf("ns out of range [0, %v)", secondInNanos) + } + t := time.Unix(s, ns).UTC() + // time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits). + x := t.Format("2006-01-02T15:04:05.000000000") + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, ".000") + out.write(`"`) + out.write(x) + out.write(`Z"`) + return out.err + case "Value": + // Value has a single oneof. + kind := s.Field(1) + if kind.IsNil() { + // "absence of any variant indicates an error" + return errors.New("nil Value") } + // oneof -> *T -> T -> T.F + x := kind.Elem().Elem().Field(0) + // TODO: pass the correct Properties if needed. + return m.marshalValue(out, &proto.Properties{}, x, indent) } out.write("{") @@ -247,11 +270,11 @@ func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeU } for i := 0; i < s.NumField(); i++ { - value := s.Field(i) - valueField := s.Type().Field(i) - if strings.HasPrefix(valueField.Name, "XXX_") { + if f := s.Type().Field(i); strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { continue } + value := s.Field(i) + valueField := s.Type().Field(i) // IsNil will panic on most value kinds. switch value.Kind() { @@ -332,7 +355,11 @@ func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeU value := reflect.ValueOf(ext) var prop proto.Properties prop.Parse(desc.Tag) - prop.JSONName = fmt.Sprintf("[%s]", desc.Name) + name := desc.Name + if strings.HasSuffix(name, ".message_set_extension") && isMessageSet(s.Type()) { + name = strings.TrimSuffix(name, ".message_set_extension") + } + prop.JSONName = fmt.Sprintf("[%s]", name) if !firstField { m.writeSep(out) } @@ -366,8 +393,8 @@ func (m *Marshaler) marshalAny(out *errWriter, any proto.Message, indent string) // Otherwise, the value will be converted into a JSON object, // and the "@type" field will be inserted to indicate the actual data type." v := reflect.ValueOf(any).Elem() - turl := v.Field(0).String() - val := v.Field(1).Bytes() + turl := v.Field(1).String() + val := v.Field(2).Bytes() var msg proto.Message var err error @@ -384,7 +411,7 @@ func (m *Marshaler) marshalAny(out *errWriter, any proto.Message, indent string) return err } - if _, ok := msg.(wkt); ok { + if wellKnownType(msg) != "" { out.write("{") if m.Indent != "" { out.write("\n") @@ -489,12 +516,10 @@ func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v refle // Handle well-known types. // Most are handled up in marshalObject (because 99% are messages). - if wkt, ok := v.Interface().(wkt); ok { - switch wkt.XXX_WellKnownType() { - case "NullValue": - out.write("null") - return out.err - } + switch wellKnownType(v.Interface()) { + case "NullValue": + out.write("null") + return out.err } // Handle enumerations. @@ -695,152 +720,150 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe } // Handle well-known types that are not pointers. - if w, ok := target.Addr().Interface().(wkt); ok { - switch w.XXX_WellKnownType() { - case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", - "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": - return u.unmarshalValue(target.Field(0), inputValue, prop) - case "Any": - // Use json.RawMessage pointer type instead of value to support pre-1.8 version. - // 1.8 changed RawMessage.MarshalJSON from pointer type to value type, see - // https://github.com/golang/go/issues/14493 - var jsonFields map[string]*json.RawMessage - if err := json.Unmarshal(inputValue, &jsonFields); err != nil { - return err - } - - val, ok := jsonFields["@type"] - if !ok || val == nil { - return errors.New("Any JSON doesn't have '@type'") - } + switch wellKnownType(target.Addr().Interface()) { + case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", + "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": + return u.unmarshalValue(target.Field(1), inputValue, prop) + case "Any": + // Use json.RawMessage pointer type instead of value to support pre-1.8 version. + // 1.8 changed RawMessage.MarshalJSON from pointer type to value type, see + // https://github.com/golang/go/issues/14493 + var jsonFields map[string]*json.RawMessage + if err := json.Unmarshal(inputValue, &jsonFields); err != nil { + return err + } - var turl string - if err := json.Unmarshal([]byte(*val), &turl); err != nil { - return fmt.Errorf("can't unmarshal Any's '@type': %q", *val) - } - target.Field(0).SetString(turl) - - var m proto.Message - var err error - if u.AnyResolver != nil { - m, err = u.AnyResolver.Resolve(turl) - } else { - m, err = defaultResolveAny(turl) - } - if err != nil { - return err - } + val, ok := jsonFields["@type"] + if !ok || val == nil { + return errors.New("Any JSON doesn't have '@type'") + } - if _, ok := m.(wkt); ok { - val, ok := jsonFields["value"] - if !ok { - return errors.New("Any JSON doesn't have 'value'") - } + var turl string + if err := json.Unmarshal([]byte(*val), &turl); err != nil { + return fmt.Errorf("can't unmarshal Any's '@type': %q", *val) + } + target.Field(1).SetString(turl) - if err := u.unmarshalValue(reflect.ValueOf(m).Elem(), *val, nil); err != nil { - return fmt.Errorf("can't unmarshal Any nested proto %T: %v", m, err) - } - } else { - delete(jsonFields, "@type") - nestedProto, err := json.Marshal(jsonFields) - if err != nil { - return fmt.Errorf("can't generate JSON for Any's nested proto to be unmarshaled: %v", err) - } + var m proto.Message + var err error + if u.AnyResolver != nil { + m, err = u.AnyResolver.Resolve(turl) + } else { + m, err = defaultResolveAny(turl) + } + if err != nil { + return err + } - if err = u.unmarshalValue(reflect.ValueOf(m).Elem(), nestedProto, nil); err != nil { - return fmt.Errorf("can't unmarshal Any nested proto %T: %v", m, err) - } + if wellKnownType(m) != "" { + val, ok := jsonFields["value"] + if !ok { + return errors.New("Any JSON doesn't have 'value'") } - b, err := proto.Marshal(m) - if err != nil { - return fmt.Errorf("can't marshal proto %T into Any.Value: %v", m, err) + if err := u.unmarshalValue(reflect.ValueOf(m).Elem(), *val, nil); err != nil { + return fmt.Errorf("can't unmarshal Any nested proto %T: %v", m, err) } - target.Field(1).SetBytes(b) - - return nil - case "Duration": - unq, err := unquote(string(inputValue)) + } else { + delete(jsonFields, "@type") + nestedProto, err := json.Marshal(jsonFields) if err != nil { - return err + return fmt.Errorf("can't generate JSON for Any's nested proto to be unmarshaled: %v", err) } - d, err := time.ParseDuration(unq) - if err != nil { - return fmt.Errorf("bad Duration: %v", err) + if err = u.unmarshalValue(reflect.ValueOf(m).Elem(), nestedProto, nil); err != nil { + return fmt.Errorf("can't unmarshal Any nested proto %T: %v", m, err) } + } - ns := d.Nanoseconds() - s := ns / 1e9 - ns %= 1e9 - target.Field(0).SetInt(s) - target.Field(1).SetInt(ns) - return nil - case "Timestamp": - unq, err := unquote(string(inputValue)) - if err != nil { - return err - } + b, err := proto.Marshal(m) + if err != nil { + return fmt.Errorf("can't marshal proto %T into Any.Value: %v", m, err) + } + target.Field(2).SetBytes(b) - t, err := time.Parse(time.RFC3339Nano, unq) - if err != nil { - return fmt.Errorf("bad Timestamp: %v", err) - } + return nil + case "Duration": + unq, err := unquote(string(inputValue)) + if err != nil { + return err + } - target.Field(0).SetInt(t.Unix()) - target.Field(1).SetInt(int64(t.Nanosecond())) - return nil - case "Struct": - var m map[string]json.RawMessage - if err := json.Unmarshal(inputValue, &m); err != nil { - return fmt.Errorf("bad StructValue: %v", err) - } + d, err := time.ParseDuration(unq) + if err != nil { + return fmt.Errorf("bad Duration: %v", err) + } - target.Field(0).Set(reflect.ValueOf(map[string]*stpb.Value{})) - for k, jv := range m { - pv := &stpb.Value{} - if err := u.unmarshalValue(reflect.ValueOf(pv).Elem(), jv, prop); err != nil { - return fmt.Errorf("bad value in StructValue for key %q: %v", k, err) - } - target.Field(0).SetMapIndex(reflect.ValueOf(k), reflect.ValueOf(pv)) - } - return nil - case "ListValue": - var s []json.RawMessage - if err := json.Unmarshal(inputValue, &s); err != nil { - return fmt.Errorf("bad ListValue: %v", err) - } + ns := d.Nanoseconds() + s := ns / 1e9 + ns %= 1e9 + target.Field(1).SetInt(s) + target.Field(2).SetInt(ns) + return nil + case "Timestamp": + unq, err := unquote(string(inputValue)) + if err != nil { + return err + } - target.Field(0).Set(reflect.ValueOf(make([]*stpb.Value, len(s)))) - for i, sv := range s { - if err := u.unmarshalValue(target.Field(0).Index(i), sv, prop); err != nil { - return err - } + t, err := time.Parse(time.RFC3339Nano, unq) + if err != nil { + return fmt.Errorf("bad Timestamp: %v", err) + } + + target.Field(1).SetInt(t.Unix()) + target.Field(2).SetInt(int64(t.Nanosecond())) + return nil + case "Struct": + var m map[string]json.RawMessage + if err := json.Unmarshal(inputValue, &m); err != nil { + return fmt.Errorf("bad StructValue: %v", err) + } + + target.Field(1).Set(reflect.ValueOf(map[string]*stpb.Value{})) + for k, jv := range m { + pv := &stpb.Value{} + if err := u.unmarshalValue(reflect.ValueOf(pv).Elem(), jv, prop); err != nil { + return fmt.Errorf("bad value in StructValue for key %q: %v", k, err) } - return nil - case "Value": - ivStr := string(inputValue) - if ivStr == "null" { - target.Field(0).Set(reflect.ValueOf(&stpb.Value_NullValue{})) - } else if v, err := strconv.ParseFloat(ivStr, 0); err == nil { - target.Field(0).Set(reflect.ValueOf(&stpb.Value_NumberValue{v})) - } else if v, err := unquote(ivStr); err == nil { - target.Field(0).Set(reflect.ValueOf(&stpb.Value_StringValue{v})) - } else if v, err := strconv.ParseBool(ivStr); err == nil { - target.Field(0).Set(reflect.ValueOf(&stpb.Value_BoolValue{v})) - } else if err := json.Unmarshal(inputValue, &[]json.RawMessage{}); err == nil { - lv := &stpb.ListValue{} - target.Field(0).Set(reflect.ValueOf(&stpb.Value_ListValue{lv})) - return u.unmarshalValue(reflect.ValueOf(lv).Elem(), inputValue, prop) - } else if err := json.Unmarshal(inputValue, &map[string]json.RawMessage{}); err == nil { - sv := &stpb.Struct{} - target.Field(0).Set(reflect.ValueOf(&stpb.Value_StructValue{sv})) - return u.unmarshalValue(reflect.ValueOf(sv).Elem(), inputValue, prop) - } else { - return fmt.Errorf("unrecognized type for Value %q", ivStr) + target.Field(1).SetMapIndex(reflect.ValueOf(k), reflect.ValueOf(pv)) + } + return nil + case "ListValue": + var s []json.RawMessage + if err := json.Unmarshal(inputValue, &s); err != nil { + return fmt.Errorf("bad ListValue: %v", err) + } + + target.Field(1).Set(reflect.ValueOf(make([]*stpb.Value, len(s)))) + for i, sv := range s { + if err := u.unmarshalValue(target.Field(1).Index(i), sv, prop); err != nil { + return err } - return nil } + return nil + case "Value": + ivStr := string(inputValue) + if ivStr == "null" { + target.Field(1).Set(reflect.ValueOf(&stpb.Value_NullValue{})) + } else if v, err := strconv.ParseFloat(ivStr, 0); err == nil { + target.Field(1).Set(reflect.ValueOf(&stpb.Value_NumberValue{v})) + } else if v, err := unquote(ivStr); err == nil { + target.Field(1).Set(reflect.ValueOf(&stpb.Value_StringValue{v})) + } else if v, err := strconv.ParseBool(ivStr); err == nil { + target.Field(1).Set(reflect.ValueOf(&stpb.Value_BoolValue{v})) + } else if err := json.Unmarshal(inputValue, &[]json.RawMessage{}); err == nil { + lv := &stpb.ListValue{} + target.Field(1).Set(reflect.ValueOf(&stpb.Value_ListValue{lv})) + return u.unmarshalValue(reflect.ValueOf(lv).Elem(), inputValue, prop) + } else if err := json.Unmarshal(inputValue, &map[string]json.RawMessage{}); err == nil { + sv := &stpb.Struct{} + target.Field(1).Set(reflect.ValueOf(&stpb.Value_StructValue{sv})) + return u.unmarshalValue(reflect.ValueOf(sv).Elem(), inputValue, prop) + } else { + return fmt.Errorf("unrecognized type for Value %q", ivStr) + } + return nil } // Handle enums, which have an underlying type of int32, @@ -899,7 +922,7 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe sprops := proto.GetProperties(targetType) for i := 0; i < target.NumField(); i++ { ft := target.Type().Field(i) - if strings.HasPrefix(ft.Name, "XXX_") { + if f := ft; strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { continue } @@ -944,6 +967,23 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe return err } } + if isMessageSet(target.Type()) { + for _, ext := range proto.RegisteredExtensions(ep) { + name := fmt.Sprintf("[%s]", strings.TrimSuffix(ext.Name, ".message_set_extension")) + raw, ok := jsonFields[name] + if !ok { + continue + } + delete(jsonFields, name) + nv := reflect.New(reflect.TypeOf(ext.ExtensionType).Elem()) + if err := u.unmarshalValue(nv.Elem(), raw, nil); err != nil { + return err + } + if err := proto.SetExtension(ep, ext, nv.Interface()); err != nil { + return err + } + } + } } } if !u.AllowUnknownFields && len(jsonFields) > 0 { @@ -1118,7 +1158,7 @@ func checkRequiredFields(pb proto.Message) error { // When an Any message is being unmarshaled, the code will have invoked proto.Marshal on the // embedded message to store the serialized message in Any.Value field, and that should have // returned an error if a required field is not set. - if _, ok := pb.(wkt); ok { + if wellKnownType(pb) != "" { return nil } @@ -1133,17 +1173,11 @@ func checkRequiredFields(pb proto.Message) error { } for i := 0; i < v.NumField(); i++ { - field := v.Field(i) - sfield := v.Type().Field(i) - - if sfield.PkgPath != "" { - // blank PkgPath means the field is exported; skip if not exported - continue - } - - if strings.HasPrefix(sfield.Name, "XXX_") { + if f := v.Type().Field(i); strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { continue } + field := v.Field(i) + sfield := v.Type().Field(i) // Oneof field is an interface implemented by wrapper structs containing the actual oneof // field, i.e. an interface containing &T{real_value}. @@ -1240,3 +1274,14 @@ func checkRequiredFieldsInValue(v reflect.Value) error { } return nil } + +// isMessageSet determines whether t is a MessageSet message, +// where t must be a named struct type. +func isMessageSet(t reflect.Type) bool { + if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoV2.Message); ok { + md := m.ProtoReflect().Descriptor() + xmd, ok := md.(interface{ IsMessageSet() bool }) + return ok && xmd.IsMessageSet() + } + return false +} diff --git a/jsonpb/jsonpb_test.go b/jsonpb/jsonpb_test.go index 93ed06d3a1..d58a803749 100644 --- a/jsonpb/jsonpb_test.go +++ b/jsonpb/jsonpb_test.go @@ -506,7 +506,7 @@ func TestMarshaling(t *testing.T) { if err != nil { t.Errorf("%s: marshaling error: %v", tt.desc, err) } else if tt.json != json { - t.Errorf("%s: got [%v] want [%v]", tt.desc, json, tt.json) + t.Errorf("%s:\ngot: %v\nwant: %v", tt.desc, json, tt.json) } } } diff --git a/proto/all_test.go b/proto/all_test.go index ad586f6484..2c8e3aadc0 100644 --- a/proto/all_test.go +++ b/proto/all_test.go @@ -21,6 +21,7 @@ import ( . "github.com/golang/protobuf/proto" pb3 "github.com/golang/protobuf/proto/proto3_proto" . "github.com/golang/protobuf/proto/test_proto" + tpb "google.golang.org/protobuf/types/known/timestamppb" ) var globalO *Buffer @@ -2328,6 +2329,15 @@ func TestRequired(t *testing.T) { } } +func TestUnknownV2(t *testing.T) { + m := new(tpb.Timestamp) + m.ProtoReflect().SetUnknown([]byte("\x92\x4d\x12unknown field 1234")) + got := CompactTextString(m) + if !strings.Contains(got, "unknown field 1234") { + t.Errorf("got %q, want contains %q", got, "unknown field 1234") + } +} + // Benchmarks func testMsg() *GoTest { diff --git a/proto/clone.go b/proto/clone.go index cd1a2e20a4..c753078df4 100644 --- a/proto/clone.go +++ b/proto/clone.go @@ -77,7 +77,7 @@ 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_") { + if strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { continue } mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) @@ -90,13 +90,13 @@ func mergeStruct(out, in reflect.Value) { } } - uf := in.FieldByName("XXX_unrecognized") + uf := unknownFieldsValue(in) if !uf.IsValid() { return } uin := uf.Bytes() if len(uin) > 0 { - out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...)) + unknownFieldsValue(out).SetBytes(append([]byte(nil), uin...)) } } diff --git a/proto/discard.go b/proto/discard.go index c53d4b177c..8e61be3648 100644 --- a/proto/discard.go +++ b/proto/discard.go @@ -127,11 +127,11 @@ func (di *discardInfo) computeDiscardInfo() { for i := 0; i < n; i++ { f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { + if strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { continue } - dfi := discardFieldInfo{field: toField(&f)} + dfi := discardFieldInfo{field: toField(&f, nil)} tf := f.Type // Unwrap tf to get its most basic type. @@ -219,12 +219,19 @@ func (di *discardInfo) computeDiscardInfo() { di.fields = append(di.fields, dfi) } + expFunc := exporterFunc(t) 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) + di.unrecognized = toField(&f, nil) + } + if f, ok := t.FieldByName("unknownFields"); ok { + if f.Type != reflect.TypeOf([]byte{}) { + panic("expected unknownFields to be of type []byte") + } + di.unrecognized = toField(&f, expFunc) } atomic.StoreInt32(&di.initialized, 1) @@ -243,7 +250,7 @@ func discardLegacy(m Message) { for i := 0; i < v.NumField(); i++ { f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { + if strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { continue } vf := v.Field(i) @@ -308,9 +315,9 @@ func discardLegacy(m Message) { } } - if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() { + if vf := unknownFieldsValue(v); vf.IsValid() { if vf.Type() != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") + panic("expected unknown fields to be of type []byte") } vf.Set(reflect.ValueOf([]byte(nil))) } diff --git a/proto/equal.go b/proto/equal.go index ceebce79f0..b2a69e15ed 100644 --- a/proto/equal.go +++ b/proto/equal.go @@ -72,7 +72,7 @@ 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_") { + if strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { continue } f1, f2 := v1.Field(i), v2.Field(i) @@ -91,8 +91,8 @@ func equalStruct(v1, v2 reflect.Value) bool { } } - if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_InternalExtensions") + if em1 := extensionFieldsValue(v1); em1.IsValid() { + em2 := extensionFieldsValue(v2) m1 := extensionFieldsOf(em1.Addr().Interface()) m2 := extensionFieldsOf(em2.Addr().Interface()) if !equalExtensions(v1.Type(), m1, m2) { @@ -100,23 +100,15 @@ func equalStruct(v1, v2 reflect.Value) bool { } } - if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_extensions") - m1 := extensionFieldsOf(em1.Addr().Interface()) - m2 := extensionFieldsOf(em2.Addr().Interface()) - if !equalExtensions(v1.Type(), m1, m2) { + if uf := unknownFieldsValue(v1); uf.IsValid() { + u1 := uf.Bytes() + u2 := unknownFieldsValue(v2).Bytes() + if !bytes.Equal(u1, u2) { 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) + return true } // v1 and v2 are known to have the same type. diff --git a/proto/extensions.go b/proto/extensions.go index a85ee41a57..adf24b9ea0 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -69,11 +69,8 @@ func extendable(p interface{}) (*extensionMap, error) { v := reflect.ValueOf(p) if v.Kind() == reflect.Ptr && !v.IsNil() { v = v.Elem() - if v := v.FieldByName("XXX_InternalExtensions"); v.IsValid() { - return extensionFieldsOf(v.Addr().Interface()), nil - } - if v := v.FieldByName("XXX_extensions"); v.IsValid() { - return extensionFieldsOf(v.Addr().Interface()), nil + if vf := extensionFieldsValue(v); vf.IsValid() { + return extensionFieldsOf(vf.Addr().Interface()), nil } } } @@ -102,7 +99,7 @@ func SetRawExtension(base Message, id int32, b []byte) { if !v.IsValid() || v.Kind() != reflect.Ptr || v.IsNil() || v.Elem().Kind() != reflect.Struct { return } - v = v.Elem().FieldByName("XXX_unrecognized") + v = unknownFieldsValue(v.Elem()) if !v.IsValid() { return } @@ -208,7 +205,7 @@ func HasExtension(pb Message, extension *ExtensionDesc) bool { } // Check whether this field exists in raw form. - unrecognized := reflect.ValueOf(pb).Elem().FieldByName("XXX_unrecognized") + unrecognized := unknownFieldsValue(reflect.ValueOf(pb).Elem()) fnum := protoreflect.FieldNumber(extension.Field) for b := unrecognized.Bytes(); len(b) > 0; { got, _, n := wire.ConsumeField(b) @@ -250,7 +247,7 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { return nil, err } - unrecognized := reflect.ValueOf(pb).Elem().FieldByName("XXX_unrecognized") + unrecognized := unknownFieldsValue(reflect.ValueOf(pb).Elem()) var out []byte fnum := protoreflect.FieldNumber(extension.Field) for b := unrecognized.Bytes(); len(b) > 0; { @@ -416,7 +413,7 @@ func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { return true }) - unrecognized := reflect.ValueOf(pb).Elem().FieldByName("XXX_unrecognized") + unrecognized := unknownFieldsValue(reflect.ValueOf(pb).Elem()) if b := unrecognized.Bytes(); len(b) > 0 { fieldNums := make(map[int32]bool) for len(b) > 0 { diff --git a/proto/extensions_test.go b/proto/extensions_test.go index 044aaf4a64..e06812a0f1 100644 --- a/proto/extensions_test.go +++ b/proto/extensions_test.go @@ -268,47 +268,53 @@ func TestGetExtensionDefaults(t *testing.T) { {pb.E_DefaultEnum, setEnum, pb.DefaultsMessage_ONE}, } - checkVal := func(test testcase, msg *pb.DefaultsMessage, valWant interface{}) error { - val, err := proto.GetExtension(msg, test.ext) - if err != nil { - if valWant != nil { - return fmt.Errorf("GetExtension(): %s", err) - } - if want := proto.ErrMissingExtension; err != want { - return fmt.Errorf("Unexpected error: got %v, want %v", err, want) + checkVal := func(t *testing.T, name string, test testcase, msg *pb.DefaultsMessage, valWant interface{}) { + t.Run(name, func(t *testing.T) { + val, err := proto.GetExtension(msg, test.ext) + if err != nil { + if valWant != nil { + t.Errorf("GetExtension(): %s", err) + return + } + if want := proto.ErrMissingExtension; err != want { + t.Errorf("Unexpected error: got %v, want %v", err, want) + return + } + return } - return nil - } - - // All proto2 extension values are either a pointer to a value or a slice of values. - ty := reflect.TypeOf(val) - tyWant := reflect.TypeOf(test.ext.ExtensionType) - if got, want := ty, tyWant; got != want { - return fmt.Errorf("unexpected reflect.TypeOf(): got %v want %v", got, want) - } - tye := ty.Elem() - tyeWant := tyWant.Elem() - if got, want := tye, tyeWant; got != want { - return fmt.Errorf("unexpected reflect.TypeOf().Elem(): got %v want %v", got, want) - } - // Check the name of the type of the value. - // If it is an enum it will be type int32 with the name of the enum. - if got, want := tye.Name(), tye.Name(); got != want { - return fmt.Errorf("unexpected reflect.TypeOf().Elem().Name(): got %v want %v", got, want) - } + // All proto2 extension values are either a pointer to a value or a slice of values. + ty := reflect.TypeOf(val) + tyWant := reflect.TypeOf(test.ext.ExtensionType) + if got, want := ty, tyWant; got != want { + t.Errorf("unexpected reflect.TypeOf(): got %v want %v", got, want) + return + } + tye := ty.Elem() + tyeWant := tyWant.Elem() + if got, want := tye, tyeWant; got != want { + t.Errorf("unexpected reflect.TypeOf().Elem(): got %v want %v", got, want) + return + } - // Check that value is what we expect. - // If we have a pointer in val, get the value it points to. - valExp := val - if ty.Kind() == reflect.Ptr { - valExp = reflect.ValueOf(val).Elem().Interface() - } - if got, want := valExp, valWant; !reflect.DeepEqual(got, want) { - return fmt.Errorf("unexpected reflect.DeepEqual(): got %v want %v", got, want) - } + // Check the name of the type of the value. + // If it is an enum it will be type int32 with the name of the enum. + if got, want := tye.Name(), tye.Name(); got != want { + t.Errorf("unexpected reflect.TypeOf().Elem().Name(): got %v want %v", got, want) + return + } - return nil + // Check that value is what we expect. + // If we have a pointer in val, get the value it points to. + valExp := val + if ty.Kind() == reflect.Ptr { + valExp = reflect.ValueOf(val).Elem().Interface() + } + if got, want := valExp, valWant; !reflect.DeepEqual(got, want) { + t.Errorf("unexpected reflect.DeepEqual(): got %v want %v", got, want) + return + } + }) } setTo := func(test testcase) interface{} { @@ -326,27 +332,18 @@ func TestGetExtensionDefaults(t *testing.T) { name := test.ext.Name // Check the initial value. - if err := checkVal(test, msg, test.def); err != nil { - t.Errorf("%s: %v", name, err) - } + checkVal(t, name+"/initial", test, msg, test.def) // Set the per-type value and check value. - name = fmt.Sprintf("%s (set to %T %v)", name, test.want, test.want) if err := proto.SetExtension(msg, test.ext, setTo(test)); err != nil { t.Errorf("%s: SetExtension(): %v", name, err) continue } - if err := checkVal(test, msg, test.want); err != nil { - t.Errorf("%s: %v", name, err) - continue - } + checkVal(t, name+"/set", test, msg, test.want) // Set and check the value. - name += " (cleared)" proto.ClearExtension(msg, test.ext) - if err := checkVal(test, msg, test.def); err != nil { - t.Errorf("%s: %v", name, err) - } + checkVal(t, name+"/cleared", test, msg, test.def) } } diff --git a/proto/lib.go b/proto/lib.go index c8afe8a541..ada7b33fee 100644 --- a/proto/lib.go +++ b/proto/lib.go @@ -15,7 +15,9 @@ import ( "strconv" "sync" + protoV2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/runtime/protoiface" + "google.golang.org/protobuf/runtime/protoimpl" ) // requiredNotSetError is an error type returned by either Marshal or Unmarshal. @@ -95,6 +97,72 @@ type ( } ) +// oneofWrappers returns a list of oneof wrappers for t, +// which must be a named struct type. +func oneofWrappers(t reflect.Type) []interface{} { + var oos []interface{} + switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { + case oneofFuncsIface: + _, _, _, oos = m.XXX_OneofFuncs() + case oneofWrappersIface: + oos = m.XXX_OneofWrappers() + case protoV2.Message: + if m, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *protoimpl.MessageInfo }); ok { + oos = m.ProtoMessageInfo().OneofWrappers + } + } + return oos +} + +// unknownFieldsValue retrieves the value for unknown fields from v, +// which must be a name struct type. +func unknownFieldsValue(v reflect.Value) reflect.Value { + if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() { + return vf + } + if vf := fieldByName(v, "unknownFields"); vf.IsValid() { + return vf + } + return reflect.Value{} +} + +// extensionFieldsValue retrieves the value for extension fields from v, +// which must be a name struct type. +func extensionFieldsValue(v reflect.Value) reflect.Value { + if vf := v.FieldByName("XXX_InternalExtensions"); vf.IsValid() { + return vf + } + if vf := v.FieldByName("XXX_extensions"); vf.IsValid() { + return vf + } + if vf := fieldByName(v, "extensionFields"); vf.IsValid() { + return vf + } + return reflect.Value{} +} + +// exporterFunc retrieves the field exporter function for t, +// which must be a named struct type. +func exporterFunc(t reflect.Type) func(interface{}, int) interface{} { + if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoV2.Message); ok { + if m, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *protoimpl.MessageInfo }); ok { + return m.ProtoMessageInfo().Exporter + } + } + return nil +} + +// isMessageSet determines whether t is a MessageSet message, +// where t must be a named struct type. +func isMessageSet(t reflect.Type) bool { + if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoV2.Message); ok { + md := m.ProtoReflect().Descriptor() + xmd, ok := md.(interface{ IsMessageSet() bool }) + return ok && xmd.IsMessageSet() + } + return false +} + // A Buffer is a buffer manager for marshaling and unmarshaling // protocol buffers. It may be reused between invocations to // reduce memory usage. It is not necessary to use a Buffer; diff --git a/proto/message_set.go b/proto/message_set.go index 8626382a2b..201030d467 100644 --- a/proto/message_set.go +++ b/proto/message_set.go @@ -122,7 +122,7 @@ func unmarshalMessageSet(buf []byte, mi Message, exts interface{}) error { if err := Unmarshal(buf, ms); err != nil { return err } - unrecognized := reflect.ValueOf(mi).Elem().FieldByName("XXX_unrecognized").Addr().Interface().(*[]byte) + unrecognized := unknownFieldsValue(reflect.ValueOf(mi).Elem()).Addr().Interface().(*[]byte) for _, item := range ms.Item { id := protoreflect.FieldNumber(*item.TypeId) diff --git a/proto/pointer_reflect.go b/proto/pointer_reflect.go index 5ee1a0a91d..0b764bc682 100644 --- a/proto/pointer_reflect.go +++ b/proto/pointer_reflect.go @@ -13,6 +13,8 @@ package proto import ( "reflect" "sync" + "unicode" + "unicode/utf8" ) const unsafeAllowed = false @@ -20,21 +22,35 @@ const unsafeAllowed = false // A field identifies a field in a struct, accessible from a pointer. // In this implementation, a field is identified by the sequence of field indices // passed to reflect's FieldByIndex. -type field []int +type field struct { + index int + export exporter +} + +type exporter = func(interface{}, int) interface{} // toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return f.Index +func toField(f *reflect.StructField, x exporter) field { + if len(f.Index) != 1 { + panic("embedded structs are not supported") + } + if f.PkgPath == "" { + return field{index: f.Index[0]} // field is already exported + } + if x == nil { + panic("exporter must be provided for unexported field: " + f.Name) + } + return field{index: f.Index[0], export: x} } // invalidField is an invalid field identifier. -var invalidField = field(nil) +var invalidField = field{index: -1} // zeroField is a noop when calling pointer.offset. -var zeroField = field([]int{}) +var zeroField = field{index: 0} // IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { return f != nil } +func (f field) IsValid() bool { return f.index >= 0 } // The pointer type is for the table-driven decoder. // The implementation here uses a reflect.Value of pointer type to @@ -70,7 +86,12 @@ func valToPointer(v reflect.Value) pointer { // offset converts from a pointer to a structure to a pointer to // one of its fields. func (p pointer) offset(f field) pointer { - return pointer{v: p.v.Elem().FieldByIndex(f).Addr()} + if f.export != nil { + if v := reflect.ValueOf(f.export(p.v.Interface(), f.index)); v.IsValid() { + return pointer{v: v} + } + } + return pointer{v: p.v.Elem().Field(f.index).Addr()} } func (p pointer) isNil() bool { @@ -331,3 +352,20 @@ func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { } var atomicLock sync.Mutex + +// fieldByName is equivalent to reflect.Value.FieldByName, but is able to +// descend into unexported fields for prop +func fieldByName(v reflect.Value, s string) reflect.Value { + if r, _ := utf8.DecodeRuneInString(s); unicode.IsUpper(r) { + return v.FieldByName(s) + } + t := v.Type() + if x := exporterFunc(t); x != nil { + sf, ok := t.FieldByName(s) + if ok { + vi := x(v.Addr().Interface(), sf.Index[0]) + return reflect.ValueOf(vi).Elem() + } + } + return v.FieldByName(s) +} diff --git a/proto/pointer_unsafe.go b/proto/pointer_unsafe.go index 52f1c92b55..20269f45a8 100644 --- a/proto/pointer_unsafe.go +++ b/proto/pointer_unsafe.go @@ -11,6 +11,8 @@ package proto import ( "reflect" "sync/atomic" + "unicode" + "unicode/utf8" "unsafe" ) @@ -20,8 +22,10 @@ const unsafeAllowed = true // In this implementation, a field is identified by its byte offset from the start of the struct. type field uintptr +type exporter = func(interface{}, int) interface{} + // toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { +func toField(f *reflect.StructField, x exporter) field { return field(f.Offset) } @@ -284,3 +288,16 @@ func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) } + +// fieldByName is equivalent to reflect.Value.FieldByName, but is able to +// descend into unexported fields for prop +func fieldByName(v reflect.Value, s string) reflect.Value { + if r, _ := utf8.DecodeRuneInString(s); unicode.IsUpper(r) { + return v.FieldByName(s) + } + sf, ok := v.Type().FieldByName(s) + if !ok { + return reflect.Value{} + } + return reflect.NewAt(sf.Type, unsafe.Pointer(v.UnsafeAddr()+sf.Offset)).Elem() +} diff --git a/proto/properties.go b/proto/properties.go index 6f15aeb839..88f6bb72f1 100644 --- a/proto/properties.go +++ b/proto/properties.go @@ -209,16 +209,9 @@ func newProperties(t reflect.Type) *StructProperties { } // Construct a mapping of oneof field names to properties. - var oneofWrappers []interface{} - if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofFuncs"); ok { - oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[3].Interface().([]interface{}) - } - if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok { - oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0].Interface().([]interface{}) - } - if len(oneofWrappers) > 0 { + if oneofImplementors := oneofWrappers(t); len(oneofImplementors) > 0 { prop.OneofTypes = make(map[string]*OneofProperties) - for _, wrapper := range oneofWrappers { + for _, wrapper := range oneofImplementors { p := &OneofProperties{ Type: reflect.ValueOf(wrapper).Type(), // *T Prop: new(Properties), diff --git a/proto/table_marshal.go b/proto/table_marshal.go index c3b581de3b..f6ac7f5403 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -297,37 +297,37 @@ func (u *marshalInfo) computeMarshalInfo() { return } - // get oneof implementers - var oneofImplementers []interface{} - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oneofImplementers = m.XXX_OneofFuncs() - case oneofWrappersIface: - oneofImplementers = m.XXX_OneofWrappers() - } + oneofImplementers := oneofWrappers(t) + u.messageset = isMessageSet(t) + expFunc := exporterFunc(t) n := t.NumField() - // deal with XXX fields first + // deal with XXX and unexported fields first. for i := 0; i < t.NumField(); i++ { f := t.Field(i) - if !strings.HasPrefix(f.Name, "XXX_") { + if !strings.HasPrefix(f.Name, "XXX_") && f.PkgPath == "" { continue } switch f.Name { case "XXX_sizecache": - u.sizecache = toField(&f) + u.sizecache = toField(&f, nil) case "XXX_unrecognized": - u.unrecognized = toField(&f) + u.unrecognized = toField(&f, nil) case "XXX_InternalExtensions": - u.extensions = toField(&f) - u.messageset = f.Tag.Get("protobuf_messageset") == "1" + u.extensions = toField(&f, nil) + if f.Tag.Get("protobuf_messageset") == "1" { + u.messageset = true + } case "XXX_extensions": - u.v1extensions = toField(&f) - case "XXX_NoUnkeyedLiteral": - // nothing to do - default: - panic("unknown XXX field: " + f.Name) + u.v1extensions = toField(&f, nil) + + case "sizeCache": + u.sizecache = toField(&f, expFunc) + case "unknownFields": + u.unrecognized = toField(&f, expFunc) + case "extensionFields": + u.extensions = toField(&f, expFunc) } n-- } @@ -338,7 +338,7 @@ func (u *marshalInfo) computeMarshalInfo() { for i, j := 0, 0; i < t.NumField(); i++ { f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { + if strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { continue } field := &fields[j] @@ -438,7 +438,7 @@ func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) { } func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) { - fi.field = toField(f) + fi.field = toField(f, nil) fi.wiretag = math.MaxInt32 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. fi.isPointer = true fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f) @@ -486,7 +486,7 @@ func wiretype(encoding string) uint64 { // setTag fills up the tag (in wire format) and its size in the info of a field. func (fi *marshalFieldInfo) setTag(f *reflect.StructField, tag int, wt uint64) { - fi.field = toField(f) + fi.field = toField(f, nil) fi.wiretag = uint64(tag)<<3 | wt fi.tagsize = SizeVarint(uint64(tag) << 3) } diff --git a/proto/table_merge.go b/proto/table_merge.go index 3565efbda7..04f9a90db4 100644 --- a/proto/table_merge.go +++ b/proto/table_merge.go @@ -141,11 +141,11 @@ func (mi *mergeInfo) computeMergeInfo() { props := GetProperties(t) for i := 0; i < n; i++ { f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { + if strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { continue } - mfi := mergeFieldInfo{field: toField(&f)} + mfi := mergeFieldInfo{field: toField(&f, nil)} tf := f.Type // As an optimization, we can avoid the merge function call cost @@ -611,12 +611,19 @@ func (mi *mergeInfo) computeMergeInfo() { mi.fields = append(mi.fields, mfi) } + expFunc := exporterFunc(t) mi.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") } - mi.unrecognized = toField(&f) + mi.unrecognized = toField(&f, nil) + } + if f, ok := t.FieldByName("unknownFields"); ok { + if f.Type != reflect.TypeOf([]byte{}) { + panic("expected unknownFields to be of type []byte") + } + mi.unrecognized = toField(&f, expFunc) } atomic.StoreInt32(&mi.initialized, 1) diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index 152ab79fde..64bf90928b 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -312,6 +312,10 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { } var oneofFields []oneofField + oneofImplementers := oneofWrappers(t) + u.isMessageSet = isMessageSet(t) + expFunc := exporterFunc(t) + for i := 0; i < n; i++ { f := t.Field(i) if f.Name == "XXX_unrecognized" { @@ -319,7 +323,7 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { if f.Type != reflect.TypeOf(([]byte)(nil)) { panic("bad type for XXX_unrecognized field: " + f.Type.Name()) } - u.unrecognized = toField(&f) + u.unrecognized = toField(&f, nil) continue } if f.Name == "XXX_InternalExtensions" { @@ -327,7 +331,7 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) { panic("bad type for XXX_InternalExtensions field: " + f.Type.Name()) } - u.extensions = toField(&f) + u.extensions = toField(&f, nil) if f.Tag.Get("protobuf_messageset") == "1" { u.isMessageSet = true } @@ -338,16 +342,31 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { if f.Type != reflect.TypeOf((map[int32]Extension)(nil)) { panic("bad type for XXX_extensions field: " + f.Type.Name()) } - u.oldExtensions = toField(&f) + u.oldExtensions = toField(&f, nil) continue } - if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" { + if f.Name == "unknownFields" { + if f.Type != reflect.TypeOf(([]byte)(nil)) { + panic("bad type for unknownFields field: " + f.Type.Name()) + } + u.unrecognized = toField(&f, expFunc) + continue + } + if f.Name == "extensionFields" { + if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) { + panic("bad type for extensionFields field: " + f.Type.Name()) + } + u.extensions = toField(&f, expFunc) + continue + } + + if strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { continue } oneof := f.Tag.Get("protobuf_oneof") if oneof != "" { - oneofFields = append(oneofFields, oneofField{f.Type, toField(&f)}) + oneofFields = append(oneofFields, oneofField{f.Type, toField(&f, nil)}) // The rest of oneof processing happens below. continue } @@ -384,17 +403,10 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { } // Store the info in the correct slot in the message. - u.setTag(tag, toField(&f), unmarshal, reqMask, name) + u.setTag(tag, toField(&f, nil), unmarshal, reqMask, name) } // Find any types associated with oneof fields. - var oneofImplementers []interface{} - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oneofImplementers = m.XXX_OneofFuncs() - case oneofWrappersIface: - oneofImplementers = m.XXX_OneofWrappers() - } for _, v := range oneofImplementers { tptr := reflect.TypeOf(v) // *Msg_X typ := tptr.Elem() // Msg_X @@ -1846,7 +1858,7 @@ func makeUnmarshalMap(f *reflect.StructField) unmarshaler { // Note that this function will be called once for each case in the oneof. func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler { sf := typ.Field(0) - field0 := toField(&sf) + field0 := toField(&sf, nil) return func(b []byte, f pointer, w int) ([]byte, error) { // Allocate holder for value. v := reflect.New(typ) diff --git a/proto/text.go b/proto/text.go index ef8735f116..40f7912b0c 100644 --- a/proto/text.go +++ b/proto/text.go @@ -19,6 +19,7 @@ import ( "sort" "strings" + protoV2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" ) @@ -165,11 +166,14 @@ func requiresQuotes(u string) bool { // isAny reports whether sv is a google.protobuf.Any message func isAny(sv reflect.Value) bool { - type wkt interface { - XXX_WellKnownType() string + switch m := sv.Addr().Interface().(type) { + case interface{ XXX_WellKnownType() string }: + return m.XXX_WellKnownType() == "Any" + case protoV2.Message: + return m.ProtoReflect().Descriptor().FullName() == "google.protobuf.Any" + default: + return false } - t, ok := sv.Addr().Interface().(wkt) - return ok && t.XXX_WellKnownType() == "Any" } // writeProto3Any writes an expanded google.protobuf.Any message. @@ -236,23 +240,9 @@ func (tm *textMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { for i := 0; i < sv.NumField(); i++ { fv := sv.Field(i) props := sprops.Prop[i] - name := st.Field(i).Name - - if name == "XXX_NoUnkeyedLiteral" { - continue - } - if strings.HasPrefix(name, "XXX_") { - // There are two XXX_ fields: - // XXX_unrecognized []byte - // XXX_extensions map[int32]proto.Extension - // The first is handled here; - // the second is handled at the bottom of this function. - if name == "XXX_unrecognized" && !fv.IsNil() { - if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { - return err - } - } + f := st.Field(i) + if strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { continue } if fv.Kind() == reflect.Ptr && fv.IsNil() { @@ -420,6 +410,12 @@ func (tm *textMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { } } + if fv := unknownFieldsValue(sv); !fv.IsNil() { + if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { + return err + } + } + // Extensions (the XXX_extensions field). pv := sv.Addr() if _, err := extendable(pv.Interface()); err == nil { @@ -682,15 +678,20 @@ func (tm *textMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error return fmt.Errorf("failed getting extension: %v", err) } + name := desc.Name + if strings.HasSuffix(name, ".message_set_extension") && isMessageSet(pv.Type().Elem()) { + name = strings.TrimSuffix(name, ".message_set_extension") + } + // Repeated extensions will appear as a slice. if !isRepeatedExtension(desc) { - if err := tm.writeExtension(w, desc.Name, pb); err != nil { + if err := tm.writeExtension(w, name, pb); err != nil { return err } } else { v := reflect.ValueOf(pb) for i := 0; i < v.Len(); i++ { - if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil { + if err := tm.writeExtension(w, name, v.Index(i).Interface()); err != nil { return err } } diff --git a/proto/text_parser.go b/proto/text_parser.go index 443f62707e..8fb9463a4b 100644 --- a/proto/text_parser.go +++ b/proto/text_parser.go @@ -525,6 +525,10 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) error { desc = d break } + if strings.TrimSuffix(d.Name, ".message_set_extension") == extName && isMessageSet(st) { + desc = d + break + } } if desc == nil { return p.errorf("unrecognized extension %q", extName) diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index 0e07d08624..c2fb216795 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -7,6 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" + reflect "reflect" sync "sync" ) @@ -199,8 +200,10 @@ func file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_i if File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto != nil { return } + type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc, NumEnums: 0, NumMessages: 0, diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index 5d88470c36..28c50931f3 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -7,6 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" pluginpb "google.golang.org/protobuf/types/pluginpb" + reflect "reflect" sync "sync" ) @@ -66,8 +67,10 @@ func file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init() { if File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto != nil { return } + type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc, NumEnums: 0, NumMessages: 0, diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index d076aa2df9..96dc8e3f9f 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -7,6 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" + reflect "reflect" sync "sync" ) @@ -61,8 +62,10 @@ func file_github_com_golang_protobuf_ptypes_any_any_proto_init() { if File_github_com_golang_protobuf_ptypes_any_any_proto != nil { return } + type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc, NumEnums: 0, NumMessages: 0, diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index 8dc1778321..ea23997333 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -7,6 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" durationpb "google.golang.org/protobuf/types/known/durationpb" + reflect "reflect" sync "sync" ) @@ -62,8 +63,10 @@ func file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() { if File_github_com_golang_protobuf_ptypes_duration_duration_proto != nil { return } + type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc, NumEnums: 0, NumMessages: 0, diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index 890ab4ceff..b8022dc19e 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -7,6 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" sync "sync" ) @@ -61,8 +62,10 @@ func file_github_com_golang_protobuf_ptypes_empty_empty_proto_init() { if File_github_com_golang_protobuf_ptypes_empty_empty_proto != nil { return } + type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc, NumEnums: 0, NumMessages: 0, diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index 47e8fd776c..fae4ea1ed5 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -7,6 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" structpb "google.golang.org/protobuf/types/known/structpb" + reflect "reflect" sync "sync" ) @@ -77,8 +78,10 @@ func file_github_com_golang_protobuf_ptypes_struct_struct_proto_init() { if File_github_com_golang_protobuf_ptypes_struct_struct_proto != nil { return } + type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc, NumEnums: 0, NumMessages: 0, diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index 32fe5b318c..4100c26384 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -7,6 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" sync "sync" ) @@ -63,8 +64,10 @@ func file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() { if File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto != nil { return } + type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc, NumEnums: 0, NumMessages: 0, diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index dec0553be4..faeefe7923 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -7,6 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" + reflect "reflect" sync "sync" ) @@ -70,8 +71,10 @@ func file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() { if File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto != nil { return } + type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc, NumEnums: 0, NumMessages: 0, diff --git a/test.bash b/test.bash index a7351bfc60..bab98bc155 100755 --- a/test.bash +++ b/test.bash @@ -10,9 +10,17 @@ PASS="\x1b[32mPASS" FAIL="\x1b[31mFAIL" RESET="\x1b[0m" -echo -e "${BOLD}go test${RESET}" -RET_TEST=$((go test ./... && go test -tags use_golang_protobuf_v1 ./...) | egrep -v "^(ok|[?])\s+") -if [[ ! -z "$RET_TEST" ]]; then echo "$RET_TEST"; echo; fi +echo -e "${BOLD}go test -tags proto1_legacy ./...${RESET}" +RET_TEST0=$(go test -tags proto1_legacy ./... | egrep -v "^(ok|[?])\s+") +if [[ ! -z "$RET_TEST0" ]]; then echo "$RET_TEST0"; echo; fi + +echo -e "${BOLD}go test -tags use_golang_protobuf_v1 ./...${RESET}" +RET_TEST1=$(go test -tags use_golang_protobuf_v1 ./... | egrep -v "^(ok|[?])\s+") +if [[ ! -z "$RET_TEST1" ]]; then echo "$RET_TEST1"; echo; fi + +echo -e "${BOLD}go test -tags "use_golang_protobuf_v1 purego" ./...${RESET}" +RET_TEST2=$(go test -tags "use_golang_protobuf_v1 purego" ./... | egrep -v "^(ok|[?])\s+") +if [[ ! -z "$RET_TEST2" ]]; then echo "$RET_TEST2"; echo; fi echo -e "${BOLD}go generate${RESET}" RET_GEN=$(go run ./internal/cmd/generate-alias 2>&1) @@ -30,7 +38,7 @@ echo -e "${BOLD}git ls-files${RESET}" RET_FILES=$(git ls-files --others --exclude-standard 2>&1) if [[ ! -z "$RET_FILES" ]]; then echo "$RET_FILES"; echo; fi -if [[ ! -z "$RET_TEST" ]] || [[ ! -z "$RET_GEN" ]] || [ ! -z "$RET_FMT" ] || [[ ! -z "$RET_DIFF" ]] || [[ ! -z "$RET_FILES" ]]; then +if [[ ! -z "$RET_TEST0" ]] || [[ ! -z "$RET_TEST1" ]] || [[ ! -z "$RET_TEST2" ]] || [[ ! -z "$RET_GEN" ]] || [ ! -z "$RET_FMT" ] || [[ ! -z "$RET_DIFF" ]] || [[ ! -z "$RET_FILES" ]]; then echo -e "${FAIL}${RESET}"; exit 1 else echo -e "${PASS}${RESET}"; exit 0 From e7641fac0329ef7ba5f560fe443e60f46bf96fb7 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 17 Jul 2019 16:49:03 -0700 Subject: [PATCH 078/133] all: fix Travis-CI The v1 implementation has support for some legacy proto1 features. However, these features are not enabled by default in v2. Thus, specify the proto1_legacy flag. Change-Id: Ieb160188f9d50385076b8e9f08ccc4cebb02bae1 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/186619 Reviewed-by: Herbie Ong --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a1e92e6e62..95512eaf86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,10 @@ before_install: matrix: include: - go: 1.9.x - script: go test -v ./... + script: go test -tags proto1_legacy -v ./... - go: 1.10.x - script: go test -v ./... + script: go test -tags proto1_legacy -v ./... - go: 1.11.x - script: go test -v ./... + script: go test -tags proto1_legacy -v ./... - go: 1.12.x script: ./test.bash From 7037721e6de0539bc714253f68fd20be8e72bf45 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Tue, 6 Aug 2019 13:15:39 -0700 Subject: [PATCH 079/133] proto: initialize ExtensionDesc.Type at registration time When an ExtensionDesc with an uninitialized Type field is registered, initialize the Type. Change-Id: I2c09312e0c4873b7183d0a3c705cddc53d441f1e Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/189161 Reviewed-by: Joe Tsai --- proto/registry.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proto/registry.go b/proto/registry.go index 49732ce8e3..bc64180aef 100644 --- a/proto/registry.go +++ b/proto/registry.go @@ -9,6 +9,8 @@ import ( "log" "reflect" "strconv" + + "google.golang.org/protobuf/runtime/protoimpl" ) var enumValueMaps = make(map[string]map[string]int32) @@ -139,6 +141,9 @@ var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) // RegisterExtension is called from the generated code. func RegisterExtension(desc *ExtensionDesc) { + if desc.Type == nil { + desc.Type = protoimpl.X.ExtensionTypeFromDesc(desc) + } if registerExtensionAlt != nil { registerExtensionAlt(desc) // populated by hooks_enabled.go return From 212014e9650df11a011b8f32d9f552a41335640a Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Fri, 9 Aug 2019 08:34:28 -0700 Subject: [PATCH 080/133] jsonpb: don't depend on stable struct field indexes Fix for WKT protos generated after https://go-review.googlesource.com/c/protobuf/+/188979 Change-Id: I679f4b83e32b22079115787cf921eb78618512a7 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/189637 Reviewed-by: Joe Tsai --- go.mod | 2 +- go.sum | 3 +++ jsonpb/jsonpb.go | 56 ++++++++++++++++++++++++++---------------------- 3 files changed, 34 insertions(+), 27 deletions(-) diff --git a/go.mod b/go.mod index c65c56d005..3fc66a307c 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190717230113-f647c82cc3c7 +require google.golang.org/protobuf v0.0.0-20190808204900-1799d1111a45 diff --git a/go.sum b/go.sum index ae4387fee5..871dc86217 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,7 @@ github.com/golang/protobuf v1.2.1-0.20190523175523-a1331f0b4ab4/go.mod h1:G+fNMo github.com/golang/protobuf v1.2.1-0.20190605195750-76c9e09470ba/go.mod h1:S1YIJXvYHGRCG2UmZsOcElkAYfvZLg2sDRr9+Xu8JXU= github.com/golang/protobuf v1.2.1-0.20190617175902-f94016f5239f/go.mod h1:G+HpKX7pYZAVkElkAWZkr08MToW6pTp/vs+E9osFfbg= github.com/golang/protobuf v1.2.1-0.20190620192300-1ee46dfd80dd/go.mod h1:+CMAsi9jpYf/wAltLUKlg++CWXqxCJyD8iLDbQONsJs= +github.com/golang/protobuf v1.2.1-0.20190806214225-7037721e6de0/go.mod h1:tDQPRlaHYu9yt1wPgdx85inRiLvUCuJZXsYjC0mwc1c= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= @@ -18,3 +19,5 @@ google.golang.org/protobuf v0.0.0-20190617175724-bd7b7a9e0c26/go.mod h1:+FOB8T5/ google.golang.org/protobuf v0.0.0-20190620020611-d888139e7b59/go.mod h1:of3pt14Y+dOxz2tBOHXEoapPpKFC15/0zWhPAddkfsU= google.golang.org/protobuf v0.0.0-20190717230113-f647c82cc3c7 h1:U6U+Hb+UKNGJB0eMAjUGk0wTmy73kduTIvdsEgA4Gf8= google.golang.org/protobuf v0.0.0-20190717230113-f647c82cc3c7/go.mod h1:yGm7aNHn9Bp1NIvj6+CVUkcJshu+Usshfd3A+YxEuI8= +google.golang.org/protobuf v0.0.0-20190808204900-1799d1111a45 h1:SZXAIsI6RiG0T8bAF4dqHDHgdqJtOa6tkofjswKtU20= +google.golang.org/protobuf v0.0.0-20190808204900-1799d1111a45/go.mod h1:tRqhEyKwbKqwt5CQZAuOtj09RfhLNklDOhndhYA9blU= diff --git a/jsonpb/jsonpb.go b/jsonpb/jsonpb.go index 0d817d5e17..90c2b33217 100644 --- a/jsonpb/jsonpb.go +++ b/jsonpb/jsonpb.go @@ -196,14 +196,14 @@ func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeU // "Wrappers use the same representation in JSON // as the wrapped primitive type, ..." sprop := proto.GetProperties(s.Type()) - return m.marshalValue(out, sprop.Prop[1], s.Field(1), indent) + return m.marshalValue(out, sprop.Prop[1], s.FieldByName("Value"), indent) case "Any": // Any is a bit more involved. return m.marshalAny(out, v, indent) case "Duration": // "Generated output always contains 0, 3, 6, or 9 fractional digits, // depending on required precision." - s, ns := s.Field(1).Int(), s.Field(2).Int() + s, ns := s.FieldByName("Seconds").Int(), s.FieldByName("Nanos").Int() if ns <= -secondInNanos || ns >= secondInNanos { return fmt.Errorf("ns out of range (%v, %v)", -secondInNanos, secondInNanos) } @@ -221,14 +221,18 @@ func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeU out.write(x) out.write(`s"`) return out.err - case "Struct", "ListValue": - // Let marshalValue handle the `Struct.fields` map or the `ListValue.values` slice. + case "Struct": + // Let marshalValue handle the `Struct.fields` map. + // TODO: pass the correct Properties if needed. + return m.marshalValue(out, &proto.Properties{}, s.FieldByName("Fields"), indent) + case "ListValue": + // Let marshalValue handle the `ListValue.values` slice. // TODO: pass the correct Properties if needed. - return m.marshalValue(out, &proto.Properties{}, s.Field(1), indent) + return m.marshalValue(out, &proto.Properties{}, s.FieldByName("Values"), indent) case "Timestamp": // "RFC 3339, where generated output will always be Z-normalized // and uses 0, 3, 6 or 9 fractional digits." - s, ns := s.Field(1).Int(), s.Field(2).Int() + s, ns := s.FieldByName("Seconds").Int(), s.FieldByName("Nanos").Int() if ns < 0 || ns >= secondInNanos { return fmt.Errorf("ns out of range [0, %v)", secondInNanos) } @@ -244,7 +248,7 @@ func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeU return out.err case "Value": // Value has a single oneof. - kind := s.Field(1) + kind := s.FieldByName("Kind") if kind.IsNil() { // "absence of any variant indicates an error" return errors.New("nil Value") @@ -393,8 +397,8 @@ func (m *Marshaler) marshalAny(out *errWriter, any proto.Message, indent string) // Otherwise, the value will be converted into a JSON object, // and the "@type" field will be inserted to indicate the actual data type." v := reflect.ValueOf(any).Elem() - turl := v.Field(1).String() - val := v.Field(2).Bytes() + turl := v.FieldByName("TypeUrl").String() + val := v.FieldByName("Value").Bytes() var msg proto.Message var err error @@ -723,7 +727,7 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe switch wellKnownType(target.Addr().Interface()) { case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": - return u.unmarshalValue(target.Field(1), inputValue, prop) + return u.unmarshalValue(target.FieldByName("Value"), inputValue, prop) case "Any": // Use json.RawMessage pointer type instead of value to support pre-1.8 version. // 1.8 changed RawMessage.MarshalJSON from pointer type to value type, see @@ -742,7 +746,7 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe if err := json.Unmarshal([]byte(*val), &turl); err != nil { return fmt.Errorf("can't unmarshal Any's '@type': %q", *val) } - target.Field(1).SetString(turl) + target.FieldByName("TypeUrl").SetString(turl) var m proto.Message var err error @@ -780,7 +784,7 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe if err != nil { return fmt.Errorf("can't marshal proto %T into Any.Value: %v", m, err) } - target.Field(2).SetBytes(b) + target.FieldByName("Value").SetBytes(b) return nil case "Duration": @@ -797,8 +801,8 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe ns := d.Nanoseconds() s := ns / 1e9 ns %= 1e9 - target.Field(1).SetInt(s) - target.Field(2).SetInt(ns) + target.FieldByName("Seconds").SetInt(s) + target.FieldByName("Nanos").SetInt(ns) return nil case "Timestamp": unq, err := unquote(string(inputValue)) @@ -811,8 +815,8 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe return fmt.Errorf("bad Timestamp: %v", err) } - target.Field(1).SetInt(t.Unix()) - target.Field(2).SetInt(int64(t.Nanosecond())) + target.FieldByName("Seconds").SetInt(t.Unix()) + target.FieldByName("Nanos").SetInt(int64(t.Nanosecond())) return nil case "Struct": var m map[string]json.RawMessage @@ -820,13 +824,13 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe return fmt.Errorf("bad StructValue: %v", err) } - target.Field(1).Set(reflect.ValueOf(map[string]*stpb.Value{})) + target.FieldByName("Fields").Set(reflect.ValueOf(map[string]*stpb.Value{})) for k, jv := range m { pv := &stpb.Value{} if err := u.unmarshalValue(reflect.ValueOf(pv).Elem(), jv, prop); err != nil { return fmt.Errorf("bad value in StructValue for key %q: %v", k, err) } - target.Field(1).SetMapIndex(reflect.ValueOf(k), reflect.ValueOf(pv)) + target.FieldByName("Fields").SetMapIndex(reflect.ValueOf(k), reflect.ValueOf(pv)) } return nil case "ListValue": @@ -835,9 +839,9 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe return fmt.Errorf("bad ListValue: %v", err) } - target.Field(1).Set(reflect.ValueOf(make([]*stpb.Value, len(s)))) + target.FieldByName("Values").Set(reflect.ValueOf(make([]*stpb.Value, len(s)))) for i, sv := range s { - if err := u.unmarshalValue(target.Field(1).Index(i), sv, prop); err != nil { + if err := u.unmarshalValue(target.FieldByName("Values").Index(i), sv, prop); err != nil { return err } } @@ -845,20 +849,20 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe case "Value": ivStr := string(inputValue) if ivStr == "null" { - target.Field(1).Set(reflect.ValueOf(&stpb.Value_NullValue{})) + target.FieldByName("Kind").Set(reflect.ValueOf(&stpb.Value_NullValue{})) } else if v, err := strconv.ParseFloat(ivStr, 0); err == nil { - target.Field(1).Set(reflect.ValueOf(&stpb.Value_NumberValue{v})) + target.FieldByName("Kind").Set(reflect.ValueOf(&stpb.Value_NumberValue{v})) } else if v, err := unquote(ivStr); err == nil { - target.Field(1).Set(reflect.ValueOf(&stpb.Value_StringValue{v})) + target.FieldByName("Kind").Set(reflect.ValueOf(&stpb.Value_StringValue{v})) } else if v, err := strconv.ParseBool(ivStr); err == nil { - target.Field(1).Set(reflect.ValueOf(&stpb.Value_BoolValue{v})) + target.FieldByName("Kind").Set(reflect.ValueOf(&stpb.Value_BoolValue{v})) } else if err := json.Unmarshal(inputValue, &[]json.RawMessage{}); err == nil { lv := &stpb.ListValue{} - target.Field(1).Set(reflect.ValueOf(&stpb.Value_ListValue{lv})) + target.FieldByName("Kind").Set(reflect.ValueOf(&stpb.Value_ListValue{lv})) return u.unmarshalValue(reflect.ValueOf(lv).Elem(), inputValue, prop) } else if err := json.Unmarshal(inputValue, &map[string]json.RawMessage{}); err == nil { sv := &stpb.Struct{} - target.Field(1).Set(reflect.ValueOf(&stpb.Value_StructValue{sv})) + target.FieldByName("Kind").Set(reflect.ValueOf(&stpb.Value_StructValue{sv})) return u.unmarshalValue(reflect.ValueOf(sv).Elem(), inputValue, prop) } else { return fmt.Errorf("unrecognized type for Value %q", ivStr) From 2da1b93405ddedc561202186fdd61fd9f1f36469 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Fri, 9 Aug 2019 10:02:54 -0700 Subject: [PATCH 081/133] proto: rename protoiface.ExtensionDescV1 to protoimpl.ExtensionInfo This is change 2/5 in a series of commits changing protoV1.ExtensionDesc to directly implement protoreflect.ExtensionType. 1. [v2] Add protoimpl.ExtensionInfo as an alias for protoiface.ExtensionDescV1. 2. [v1] Update references to protoimpl.ExtensionInfo to use protoiface.ExtensionInfo. 3. [v2] Create protoimpl.ExtensionInfo (an alias to a new type in the impl package) and remove protoiface.ExtensionDescV1. 4. [v1] Remove unneeded explicit conversions between ExtensionDesc and ExtensionType (since the former now directly implements the latter). 5. [v2] Remove stub conversion functions. Change-Id: Icf5f789bac950bda14e84b8f6250e0399cb0efdf Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/189677 Reviewed-by: Joe Tsai --- go.mod | 2 +- go.sum | 2 ++ internal/proto/common.go | 3 ++- proto/extensions.go | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 3fc66a307c..60767d2d43 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190808204900-1799d1111a45 +require google.golang.org/protobuf v0.0.0-20190820203659-c0f8c0a24ece diff --git a/go.sum b/go.sum index 871dc86217..78a69d3b55 100644 --- a/go.sum +++ b/go.sum @@ -21,3 +21,5 @@ google.golang.org/protobuf v0.0.0-20190717230113-f647c82cc3c7 h1:U6U+Hb+UKNGJB0e google.golang.org/protobuf v0.0.0-20190717230113-f647c82cc3c7/go.mod h1:yGm7aNHn9Bp1NIvj6+CVUkcJshu+Usshfd3A+YxEuI8= google.golang.org/protobuf v0.0.0-20190808204900-1799d1111a45 h1:SZXAIsI6RiG0T8bAF4dqHDHgdqJtOa6tkofjswKtU20= google.golang.org/protobuf v0.0.0-20190808204900-1799d1111a45/go.mod h1:tRqhEyKwbKqwt5CQZAuOtj09RfhLNklDOhndhYA9blU= +google.golang.org/protobuf v0.0.0-20190820203659-c0f8c0a24ece h1:AFYGmds8FWBGNw0zddlFiGtDvkVFSnQ7J2bAdH4X9Xk= +google.golang.org/protobuf v0.0.0-20190820203659-c0f8c0a24ece/go.mod h1:tRqhEyKwbKqwt5CQZAuOtj09RfhLNklDOhndhYA9blU= diff --git a/internal/proto/common.go b/internal/proto/common.go index d53d2aea16..f03c790f4c 100644 --- a/internal/proto/common.go +++ b/internal/proto/common.go @@ -13,11 +13,12 @@ import ( "reflect" "google.golang.org/protobuf/runtime/protoiface" + "google.golang.org/protobuf/runtime/protoimpl" ) type ( Message = protoiface.MessageV1 - ExtensionDesc = protoiface.ExtensionDescV1 + ExtensionDesc = protoimpl.ExtensionInfo ) // RequiredNotSetError is an error type returned by either Marshal or Unmarshal. diff --git a/proto/extensions.go b/proto/extensions.go index adf24b9ea0..0f0f4b6281 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -83,7 +83,7 @@ var errNotExtendable = errors.New("proto: not an extendable proto.Message") type ( ExtensionRange = protoiface.ExtensionRangeV1 - ExtensionDesc = protoiface.ExtensionDescV1 + ExtensionDesc = protoimpl.ExtensionInfo Extension = protoimpl.ExtensionFieldV1 XXX_InternalExtensions = protoimpl.ExtensionFields ) From ae1d65bc5435409ed5f104b0647888541a242bea Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Fri, 9 Aug 2019 10:03:19 -0700 Subject: [PATCH 082/133] proto: remove conversions between Extension{Desc,Type} This is change 4/5 in a series of commits changing protoV1.ExtensionDesc to directly implement protoreflect.ExtensionType. 1. [v2] Add protoimpl.ExtensionInfo as an alias for protoiface.ExtensionDescV1. 2. [v1] Update references to protoimpl.ExtensionInfo to use protoiface.ExtensionInfo. 3. [v2] Create protoimpl.ExtensionInfo (an alias to a new type in the impl package) and remove protoiface.ExtensionDescV1. 4. [v1] Remove unneeded explicit conversions between ExtensionDesc and ExtensionType (since the former now directly implements the latter). 5. [v2] Remove stub conversion functions. Change-Id: I75368109db70d2f39b0e7595496b863dffc95f88 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/189678 Reviewed-by: Joe Tsai --- go.mod | 2 +- go.sum | 3 +++ internal/proto/registry.go | 3 +-- proto/extensions.go | 4 ++-- proto/registry.go | 5 ----- proto/table_unmarshal.go | 3 +-- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 60767d2d43..6eaf28612d 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190820203659-c0f8c0a24ece +require google.golang.org/protobuf v0.0.0-20190820213257-f1e905b04207 diff --git a/go.sum b/go.sum index 78a69d3b55..4c0044e952 100644 --- a/go.sum +++ b/go.sum @@ -7,6 +7,7 @@ github.com/golang/protobuf v1.2.1-0.20190605195750-76c9e09470ba/go.mod h1:S1YIJX github.com/golang/protobuf v1.2.1-0.20190617175902-f94016f5239f/go.mod h1:G+HpKX7pYZAVkElkAWZkr08MToW6pTp/vs+E9osFfbg= github.com/golang/protobuf v1.2.1-0.20190620192300-1ee46dfd80dd/go.mod h1:+CMAsi9jpYf/wAltLUKlg++CWXqxCJyD8iLDbQONsJs= github.com/golang/protobuf v1.2.1-0.20190806214225-7037721e6de0/go.mod h1:tDQPRlaHYu9yt1wPgdx85inRiLvUCuJZXsYjC0mwc1c= +github.com/golang/protobuf v1.2.1-0.20190820204156-2da1b93405dd/go.mod h1:x87I3ou7ehf/yR6iQ88MkyDogdxXN04TELJ7HVy7V7I= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= @@ -23,3 +24,5 @@ google.golang.org/protobuf v0.0.0-20190808204900-1799d1111a45 h1:SZXAIsI6RiG0T8b google.golang.org/protobuf v0.0.0-20190808204900-1799d1111a45/go.mod h1:tRqhEyKwbKqwt5CQZAuOtj09RfhLNklDOhndhYA9blU= google.golang.org/protobuf v0.0.0-20190820203659-c0f8c0a24ece h1:AFYGmds8FWBGNw0zddlFiGtDvkVFSnQ7J2bAdH4X9Xk= google.golang.org/protobuf v0.0.0-20190820203659-c0f8c0a24ece/go.mod h1:tRqhEyKwbKqwt5CQZAuOtj09RfhLNklDOhndhYA9blU= +google.golang.org/protobuf v0.0.0-20190820213257-f1e905b04207 h1:ulV4hvtdAg7XsymkxyxHtKYxQoSq88XU1bmtCELxG38= +google.golang.org/protobuf v0.0.0-20190820213257-f1e905b04207/go.mod h1:UJqt2ZERO8/qk5A9t8Ujq6OJ+MNvOQpg9X4RKyYz9Ho= diff --git a/internal/proto/registry.go b/internal/proto/registry.go index d3a5b6074c..44d709089c 100644 --- a/internal/proto/registry.go +++ b/internal/proto/registry.go @@ -312,8 +312,7 @@ func MessageName(m Message) messageName { // // Deprecated: Use protoregistry.GlobalTypes.Register instead. func RegisterExtension(d *ExtensionDesc) { - xt := protoimpl.X.ExtensionTypeFromDesc(d) - if err := protoregistry.GlobalTypes.Register(xt); err != nil { + if err := protoregistry.GlobalTypes.Register(d); err != nil { panic(err) } } diff --git a/proto/extensions.go b/proto/extensions.go index 0f0f4b6281..28ed1001fc 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -289,7 +289,7 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { // Remember the decoded version and drop the encoded version. // That way it is safe to mutate what we return. - e.SetType(protoimpl.X.ExtensionTypeFromDesc(extension)) + e.SetType(extension) e.SetEagerValue(extensionAsStorageType(v)) unrecognized.SetBytes(removeRawFields(unrecognized.Bytes(), fnum)) epb.Set(protoreflect.FieldNumber(extension.Field), e) @@ -459,7 +459,7 @@ func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error } var x Extension - x.SetType(protoimpl.X.ExtensionTypeFromDesc(extension)) + x.SetType(extension) x.SetEagerValue(extensionAsStorageType(value)) epb.Set(protoreflect.FieldNumber(extension.Field), x) return nil diff --git a/proto/registry.go b/proto/registry.go index bc64180aef..49732ce8e3 100644 --- a/proto/registry.go +++ b/proto/registry.go @@ -9,8 +9,6 @@ import ( "log" "reflect" "strconv" - - "google.golang.org/protobuf/runtime/protoimpl" ) var enumValueMaps = make(map[string]map[string]int32) @@ -141,9 +139,6 @@ var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) // RegisterExtension is called from the generated code. func RegisterExtension(desc *ExtensionDesc) { - if desc.Type == nil { - desc.Type = protoimpl.X.ExtensionTypeFromDesc(desc) - } if registerExtensionAlt != nil { registerExtensionAlt(desc) // populated by hooks_enabled.go return diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go index 64bf90928b..0c17f2edd3 100644 --- a/proto/table_unmarshal.go +++ b/proto/table_unmarshal.go @@ -17,7 +17,6 @@ import ( "unicode/utf8" "github.com/golang/protobuf/internal/wire" - "google.golang.org/protobuf/runtime/protoimpl" ) // Unmarshal is the entry point from the generated .pb.go files. @@ -276,7 +275,7 @@ func unmarshalExtensions(mi Message, unrecognized *[]byte) error { // Store the value into the extension field. var x Extension - x.SetType(protoimpl.X.ExtensionTypeFromDesc(extDesc)) + x.SetType(extDesc) x.SetEagerValue(extensionAsStorageType(fieldVal.Interface())) extFields.Set(fieldNum, x) } From b0a8cbb9ec5e4f900007b6ed4f13330a1afe45c1 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Tue, 20 Aug 2019 14:36:57 -0700 Subject: [PATCH 083/133] all: fix interactions with latest v2 API Change test.bash to pass -tags=protolegacy instead of proto1_legacy. Regenerate .pb.go files. Change-Id: Ifd0633c20c5860de765fcef5d0eb6c5bf3e3f183 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/190979 Reviewed-by: Joe Tsai --- protoc-gen-go/descriptor/descriptor.pb.go | 22 +++++++++++++--------- protoc-gen-go/plugin/plugin.pb.go | 22 +++++++++++++--------- ptypes/any/any.pb.go | 22 +++++++++++++--------- ptypes/duration/duration.pb.go | 22 +++++++++++++--------- ptypes/empty/empty.pb.go | 22 +++++++++++++--------- ptypes/struct/struct.pb.go | 22 +++++++++++++--------- ptypes/timestamp/timestamp.pb.go | 22 +++++++++++++--------- ptypes/wrappers/wrappers.pb.go | 22 +++++++++++++--------- test.bash | 4 ++-- 9 files changed, 106 insertions(+), 74 deletions(-) diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index c2fb216795..ec6c93df76 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.19.0-devel +// protoc (unknown) +// go v1.12.5 // source: github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto package descriptor @@ -12,13 +16,13 @@ import ( ) const ( - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) + _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) ) -// Symbols defined in public import of google/protobuf/descriptor.proto +// Symbols defined in public import of google/protobuf/descriptor.proto. type FieldDescriptorProto_Type = descriptorpb.FieldDescriptorProto_Type @@ -188,11 +192,11 @@ func file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_r var file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = []int32{ - 0, // starting offset of method output_type sub-list - 0, // starting offset of method input_type sub-list - 0, // starting offset of extension type_name sub-list - 0, // starting offset of extension extendee sub-list - 0, // starting offset of field type_name sub-list + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_init() } diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index 28c50931f3..d62cfe431b 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.19.0-devel +// protoc (unknown) +// go v1.12.5 // source: github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto package plugin_go @@ -12,13 +16,13 @@ import ( ) const ( - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) + _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) ) -// Symbols defined in public import of google/protobuf/compiler/plugin.proto +// Symbols defined in public import of google/protobuf/compiler/plugin.proto. type Version = pluginpb.Version type CodeGeneratorRequest = pluginpb.CodeGeneratorRequest @@ -55,11 +59,11 @@ func file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescGZ var file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = []int32{ - 0, // starting offset of method output_type sub-list - 0, // starting offset of method input_type sub-list - 0, // starting offset of extension type_name sub-list - 0, // starting offset of extension extendee sub-list - 0, // starting offset of field type_name sub-list + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init() } diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index 96dc8e3f9f..95ad90e9de 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.19.0-devel +// protoc (unknown) +// go v1.12.5 // source: github.com/golang/protobuf/ptypes/any/any.proto package any @@ -12,13 +16,13 @@ import ( ) const ( - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) + _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) ) -// Symbols defined in public import of google/protobuf/any.proto +// Symbols defined in public import of google/protobuf/any.proto. type Any = anypb.Any @@ -50,11 +54,11 @@ func file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescGZIP() []byte { var file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{ - 0, // starting offset of method output_type sub-list - 0, // starting offset of method input_type sub-list - 0, // starting offset of extension type_name sub-list - 0, // starting offset of extension extendee sub-list - 0, // starting offset of field type_name sub-list + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_github_com_golang_protobuf_ptypes_any_any_proto_init() } diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index ea23997333..4c075ac04e 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.19.0-devel +// protoc (unknown) +// go v1.12.5 // source: github.com/golang/protobuf/ptypes/duration/duration.proto package duration @@ -12,13 +16,13 @@ import ( ) const ( - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) + _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) ) -// Symbols defined in public import of google/protobuf/duration.proto +// Symbols defined in public import of google/protobuf/duration.proto. type Duration = durationpb.Duration @@ -51,11 +55,11 @@ func file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescGZIP( var file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = []int32{ - 0, // starting offset of method output_type sub-list - 0, // starting offset of method input_type sub-list - 0, // starting offset of extension type_name sub-list - 0, // starting offset of extension extendee sub-list - 0, // starting offset of field type_name sub-list + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() } diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index b8022dc19e..50b25ce0dc 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.19.0-devel +// protoc (unknown) +// go v1.12.5 // source: github.com/golang/protobuf/ptypes/empty/empty.proto package empty @@ -12,13 +16,13 @@ import ( ) const ( - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) + _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) ) -// Symbols defined in public import of google/protobuf/empty.proto +// Symbols defined in public import of google/protobuf/empty.proto. type Empty = emptypb.Empty @@ -50,11 +54,11 @@ func file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescGZIP() []by var file_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = []int32{ - 0, // starting offset of method output_type sub-list - 0, // starting offset of method input_type sub-list - 0, // starting offset of extension type_name sub-list - 0, // starting offset of extension extendee sub-list - 0, // starting offset of field type_name sub-list + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_github_com_golang_protobuf_ptypes_empty_empty_proto_init() } diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index fae4ea1ed5..017152f281 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.19.0-devel +// protoc (unknown) +// go v1.12.5 // source: github.com/golang/protobuf/ptypes/struct/struct.proto package structpb @@ -12,13 +16,13 @@ import ( ) const ( - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) + _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) ) -// Symbols defined in public import of google/protobuf/struct.proto +// Symbols defined in public import of google/protobuf/struct.proto. type NullValue = structpb.NullValue @@ -66,11 +70,11 @@ func file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescGZIP() [] var file_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = []int32{ - 0, // starting offset of method output_type sub-list - 0, // starting offset of method input_type sub-list - 0, // starting offset of extension type_name sub-list - 0, // starting offset of extension extendee sub-list - 0, // starting offset of field type_name sub-list + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_github_com_golang_protobuf_ptypes_struct_struct_proto_init() } diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index 4100c26384..bf572a3384 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.19.0-devel +// protoc (unknown) +// go v1.12.5 // source: github.com/golang/protobuf/ptypes/timestamp/timestamp.proto package timestamp @@ -12,13 +16,13 @@ import ( ) const ( - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) + _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) ) -// Symbols defined in public import of google/protobuf/timestamp.proto +// Symbols defined in public import of google/protobuf/timestamp.proto. type Timestamp = timestamppb.Timestamp @@ -52,11 +56,11 @@ func file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescGZI var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = []int32{ - 0, // starting offset of method output_type sub-list - 0, // starting offset of method input_type sub-list - 0, // starting offset of extension type_name sub-list - 0, // starting offset of extension extendee sub-list - 0, // starting offset of field type_name sub-list + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() } diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index faeefe7923..9b504a690c 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.19.0-devel +// protoc (unknown) +// go v1.12.5 // source: github.com/golang/protobuf/ptypes/wrappers/wrappers.proto package wrappers @@ -12,13 +16,13 @@ import ( ) const ( - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0) // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion) + _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) ) -// Symbols defined in public import of google/protobuf/wrappers.proto +// Symbols defined in public import of google/protobuf/wrappers.proto. type DoubleValue = wrapperspb.DoubleValue type FloatValue = wrapperspb.FloatValue @@ -59,11 +63,11 @@ func file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescGZIP( var file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = []int32{ - 0, // starting offset of method output_type sub-list - 0, // starting offset of method input_type sub-list - 0, // starting offset of extension type_name sub-list - 0, // starting offset of extension extendee sub-list - 0, // starting offset of field type_name sub-list + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() } diff --git a/test.bash b/test.bash index bab98bc155..8145020860 100755 --- a/test.bash +++ b/test.bash @@ -10,8 +10,8 @@ PASS="\x1b[32mPASS" FAIL="\x1b[31mFAIL" RESET="\x1b[0m" -echo -e "${BOLD}go test -tags proto1_legacy ./...${RESET}" -RET_TEST0=$(go test -tags proto1_legacy ./... | egrep -v "^(ok|[?])\s+") +echo -e "${BOLD}go test -tags protolegacy ./...${RESET}" +RET_TEST0=$(go test -tags protolegacy ./... | egrep -v "^(ok|[?])\s+") if [[ ! -z "$RET_TEST0" ]]; then echo "$RET_TEST0"; echo; fi echo -e "${BOLD}go test -tags use_golang_protobuf_v1 ./...${RESET}" From b3d22a0bb352cfa836fc508a627a54d50ab17a0b Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Tue, 20 Aug 2019 14:48:11 -0700 Subject: [PATCH 084/133] travis.yml: s/proto1_legacy/protolegacy/ Fix tag used to enable MessageSet support. Change-Id: Iba7d92038beb28f563923c96e477656705b34cbd Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/190980 Reviewed-by: Joe Tsai --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 95512eaf86..720ef9da4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,10 @@ before_install: matrix: include: - go: 1.9.x - script: go test -tags proto1_legacy -v ./... + script: go test -tags protolegacy -v ./... - go: 1.10.x - script: go test -tags proto1_legacy -v ./... + script: go test -tags protolegacy -v ./... - go: 1.11.x - script: go test -tags proto1_legacy -v ./... + script: go test -tags protolegacy -v ./... - go: 1.12.x script: ./test.bash From 28cdcb54310fdc46e85a48847c71ba150ba3ce83 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Wed, 28 Aug 2019 11:39:13 -0700 Subject: [PATCH 085/133] internal/proto: use ExtensionType TypeDescriptor method Descriptor method renamed to TypeDescriptor. Change-Id: I907169ba509395d079a95daecee53648969c9417 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/192140 Reviewed-by: Joe Tsai --- go.mod | 2 +- go.sum | 5 +++-- internal/proto/registry.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 6eaf28612d..8e6fe74ef5 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190820213257-f1e905b04207 +require google.golang.org/protobuf v0.0.0-20190828183429-79bfdbe45be2 diff --git a/go.sum b/go.sum index 4c0044e952..7f2cd5641a 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,7 @@ github.com/golang/protobuf v1.2.1-0.20190617175902-f94016f5239f/go.mod h1:G+HpKX github.com/golang/protobuf v1.2.1-0.20190620192300-1ee46dfd80dd/go.mod h1:+CMAsi9jpYf/wAltLUKlg++CWXqxCJyD8iLDbQONsJs= github.com/golang/protobuf v1.2.1-0.20190806214225-7037721e6de0/go.mod h1:tDQPRlaHYu9yt1wPgdx85inRiLvUCuJZXsYjC0mwc1c= github.com/golang/protobuf v1.2.1-0.20190820204156-2da1b93405dd/go.mod h1:x87I3ou7ehf/yR6iQ88MkyDogdxXN04TELJ7HVy7V7I= +github.com/golang/protobuf v1.2.1-0.20190820213554-ae1d65bc5435/go.mod h1:k7dGkiTZ3rjVDhKSpGt+x1zDzAePJk4jdhoBwIkQgBo= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= @@ -20,9 +21,9 @@ google.golang.org/protobuf v0.0.0-20190617175724-bd7b7a9e0c26/go.mod h1:+FOB8T5/ google.golang.org/protobuf v0.0.0-20190620020611-d888139e7b59/go.mod h1:of3pt14Y+dOxz2tBOHXEoapPpKFC15/0zWhPAddkfsU= google.golang.org/protobuf v0.0.0-20190717230113-f647c82cc3c7 h1:U6U+Hb+UKNGJB0eMAjUGk0wTmy73kduTIvdsEgA4Gf8= google.golang.org/protobuf v0.0.0-20190717230113-f647c82cc3c7/go.mod h1:yGm7aNHn9Bp1NIvj6+CVUkcJshu+Usshfd3A+YxEuI8= -google.golang.org/protobuf v0.0.0-20190808204900-1799d1111a45 h1:SZXAIsI6RiG0T8bAF4dqHDHgdqJtOa6tkofjswKtU20= -google.golang.org/protobuf v0.0.0-20190808204900-1799d1111a45/go.mod h1:tRqhEyKwbKqwt5CQZAuOtj09RfhLNklDOhndhYA9blU= google.golang.org/protobuf v0.0.0-20190820203659-c0f8c0a24ece h1:AFYGmds8FWBGNw0zddlFiGtDvkVFSnQ7J2bAdH4X9Xk= google.golang.org/protobuf v0.0.0-20190820203659-c0f8c0a24ece/go.mod h1:tRqhEyKwbKqwt5CQZAuOtj09RfhLNklDOhndhYA9blU= google.golang.org/protobuf v0.0.0-20190820213257-f1e905b04207 h1:ulV4hvtdAg7XsymkxyxHtKYxQoSq88XU1bmtCELxG38= google.golang.org/protobuf v0.0.0-20190820213257-f1e905b04207/go.mod h1:UJqt2ZERO8/qk5A9t8Ujq6OJ+MNvOQpg9X4RKyYz9Ho= +google.golang.org/protobuf v0.0.0-20190828183429-79bfdbe45be2 h1:g52BKWg08C9Z3iSV/mBCfoP+ObYXKCgdXF+p1EB9zD0= +google.golang.org/protobuf v0.0.0-20190828183429-79bfdbe45be2/go.mod h1:fYMzYhnMXLj/kGDPzNOptS3IFFlQjWTlu2j3ZPET2lw= diff --git a/internal/proto/registry.go b/internal/proto/registry.go index 44d709089c..af304e8027 100644 --- a/internal/proto/registry.go +++ b/internal/proto/registry.go @@ -336,7 +336,7 @@ func RegisteredExtensions(m Message) extensionsByNumber { if xs == nil { xs = make(extensionsByNumber) } - xs[int32(xt.Descriptor().Number())] = protoimpl.X.ExtensionDescFromType(xt) + xs[int32(xt.TypeDescriptor().Number())] = protoimpl.X.ExtensionDescFromType(xt) return true }) From fb8eeff771fc370ffa1f3ce7059a4c32c532991b Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 23 Aug 2019 13:42:42 -0700 Subject: [PATCH 086/133] internal/cmd/generate-alias: avoid generating version markers We control both v1 and v2. The generated version markers are just a nuisance. Change-Id: I0d3248b20414f6279a83f7159bc3a4493619ce36 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/191677 Reviewed-by: Damien Neil --- internal/cmd/generate-alias/main.go | 1 + protoc-gen-go/descriptor/descriptor.pb.go | 11 ----------- protoc-gen-go/plugin/plugin.pb.go | 11 ----------- ptypes/any/any.pb.go | 11 ----------- ptypes/duration/duration.pb.go | 11 ----------- ptypes/empty/empty.pb.go | 11 ----------- ptypes/struct/struct.pb.go | 11 ----------- ptypes/timestamp/timestamp.pb.go | 11 ----------- ptypes/wrappers/wrappers.pb.go | 11 ----------- 9 files changed, 1 insertion(+), 88 deletions(-) diff --git a/internal/cmd/generate-alias/main.go b/internal/cmd/generate-alias/main.go index 1d0ccd466b..5c64f1929f 100644 --- a/internal/cmd/generate-alias/main.go +++ b/internal/cmd/generate-alias/main.go @@ -86,6 +86,7 @@ func main() { check(err) for _, file := range gen.Files { if file.Generate { + gengo.GenerateVersionMarkers = false gengo.GenerateFile(gen, file) } } diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index ec6c93df76..a6d156aff9 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.19.0-devel -// protoc (unknown) -// go v1.12.5 // source: github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto package descriptor @@ -15,13 +11,6 @@ import ( sync "sync" ) -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) -) - // Symbols defined in public import of google/protobuf/descriptor.proto. type FieldDescriptorProto_Type = descriptorpb.FieldDescriptorProto_Type diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index d62cfe431b..df86663a18 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.19.0-devel -// protoc (unknown) -// go v1.12.5 // source: github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto package plugin_go @@ -15,13 +11,6 @@ import ( sync "sync" ) -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) -) - // Symbols defined in public import of google/protobuf/compiler/plugin.proto. type Version = pluginpb.Version diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index 95ad90e9de..a12e7d5f43 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.19.0-devel -// protoc (unknown) -// go v1.12.5 // source: github.com/golang/protobuf/ptypes/any/any.proto package any @@ -15,13 +11,6 @@ import ( sync "sync" ) -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) -) - // Symbols defined in public import of google/protobuf/any.proto. type Any = anypb.Any diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index 4c075ac04e..6bb3b2ab57 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.19.0-devel -// protoc (unknown) -// go v1.12.5 // source: github.com/golang/protobuf/ptypes/duration/duration.proto package duration @@ -15,13 +11,6 @@ import ( sync "sync" ) -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) -) - // Symbols defined in public import of google/protobuf/duration.proto. type Duration = durationpb.Duration diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index 50b25ce0dc..5cab9ad9e1 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.19.0-devel -// protoc (unknown) -// go v1.12.5 // source: github.com/golang/protobuf/ptypes/empty/empty.proto package empty @@ -15,13 +11,6 @@ import ( sync "sync" ) -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) -) - // Symbols defined in public import of google/protobuf/empty.proto. type Empty = emptypb.Empty diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index 017152f281..66298b55af 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.19.0-devel -// protoc (unknown) -// go v1.12.5 // source: github.com/golang/protobuf/ptypes/struct/struct.proto package structpb @@ -15,13 +11,6 @@ import ( sync "sync" ) -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) -) - // Symbols defined in public import of google/protobuf/struct.proto. type NullValue = structpb.NullValue diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index bf572a3384..5c10e7eaf9 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.19.0-devel -// protoc (unknown) -// go v1.12.5 // source: github.com/golang/protobuf/ptypes/timestamp/timestamp.proto package timestamp @@ -15,13 +11,6 @@ import ( sync "sync" ) -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) -) - // Symbols defined in public import of google/protobuf/timestamp.proto. type Timestamp = timestamppb.Timestamp diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index 9b504a690c..c0cbd2fcf8 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.19.0-devel -// protoc (unknown) -// go v1.12.5 // source: github.com/golang/protobuf/ptypes/wrappers/wrappers.proto package wrappers @@ -15,13 +11,6 @@ import ( sync "sync" ) -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) -) - // Symbols defined in public import of google/protobuf/wrappers.proto. type DoubleValue = wrapperspb.DoubleValue From 62f67f1ea9df36ac3d3618558282c187e1a673ee Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Thu, 3 Oct 2019 16:22:31 -0700 Subject: [PATCH 087/133] internal/proto: remove use of MessageType.GoType Remove use in preparation for dropping the GoType method entirely. Change-Id: Ia6df16acbf30c77b26c33eacf6d68fb59d776ca5 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/198817 Reviewed-by: Joe Tsai --- internal/proto/registry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/proto/registry.go b/internal/proto/registry.go index af304e8027..960abdbc08 100644 --- a/internal/proto/registry.go +++ b/internal/proto/registry.go @@ -285,7 +285,7 @@ func MessageType(s messageName) reflect.Type { var t reflect.Type mt, _ := protoregistry.GlobalTypes.FindMessageByName(pref.FullName(s)) if mt != nil { - t = mt.GoType() + t = reflect.TypeOf(mt.Zero().Interface()) } // TODO: Support retrieving Go map types for map entry messages? From ba00afd02128f5c5427e78bf416918a1ca4e27e3 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Fri, 1 Nov 2019 11:55:37 -0700 Subject: [PATCH 088/133] proto: fix interactions with v2 extensions Update to the latest version of google.golang.org/protobuf. https://golang.org/cl/192458 changed the Go representation of repeated extension fields to []T (from *[]T). Make the corresponding update here. Change-Id: Ia67e3899069d83f145569f01635f4ae3d9e664b8 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/204798 Reviewed-by: Joe Tsai --- go.mod | 2 +- go.sum | 3 +++ proto/extensions.go | 19 +------------------ 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index 8e6fe74ef5..7d44b24518 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20190828183429-79bfdbe45be2 +require google.golang.org/protobuf v0.0.0-20191031162342-c826885a2abe diff --git a/go.sum b/go.sum index 7f2cd5641a..9d0e60f8bf 100644 --- a/go.sum +++ b/go.sum @@ -9,6 +9,7 @@ github.com/golang/protobuf v1.2.1-0.20190620192300-1ee46dfd80dd/go.mod h1:+CMAsi github.com/golang/protobuf v1.2.1-0.20190806214225-7037721e6de0/go.mod h1:tDQPRlaHYu9yt1wPgdx85inRiLvUCuJZXsYjC0mwc1c= github.com/golang/protobuf v1.2.1-0.20190820204156-2da1b93405dd/go.mod h1:x87I3ou7ehf/yR6iQ88MkyDogdxXN04TELJ7HVy7V7I= github.com/golang/protobuf v1.2.1-0.20190820213554-ae1d65bc5435/go.mod h1:k7dGkiTZ3rjVDhKSpGt+x1zDzAePJk4jdhoBwIkQgBo= +github.com/golang/protobuf v1.2.1-0.20191004062209-62f67f1ea9df/go.mod h1:o4el5ABfDjqFlwwvAq2OIgAPeNXQYUkhtrjNPXy6T6I= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= @@ -27,3 +28,5 @@ google.golang.org/protobuf v0.0.0-20190820213257-f1e905b04207 h1:ulV4hvtdAg7Xsym google.golang.org/protobuf v0.0.0-20190820213257-f1e905b04207/go.mod h1:UJqt2ZERO8/qk5A9t8Ujq6OJ+MNvOQpg9X4RKyYz9Ho= google.golang.org/protobuf v0.0.0-20190828183429-79bfdbe45be2 h1:g52BKWg08C9Z3iSV/mBCfoP+ObYXKCgdXF+p1EB9zD0= google.golang.org/protobuf v0.0.0-20190828183429-79bfdbe45be2/go.mod h1:fYMzYhnMXLj/kGDPzNOptS3IFFlQjWTlu2j3ZPET2lw= +google.golang.org/protobuf v0.0.0-20191031162342-c826885a2abe h1:TqSqUz1beyIiDb4QdI6lZDstr9RxMfftdKQ0eonA0Dc= +google.golang.org/protobuf v0.0.0-20191031162342-c826885a2abe/go.mod h1:qKrTvhhUFcTIUF6KuejTfRdHXKeBPoa4mtynR6usTss= diff --git a/proto/extensions.go b/proto/extensions.go index 28ed1001fc..91709b0ced 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -486,16 +486,6 @@ func extensionAsLegacyType(v interface{}) interface{} { rv2 := reflect.New(rv.Type()) rv2.Elem().Set(rv) v = rv2.Interface() - case reflect.Ptr: - // Represent slice types as the value itself. - switch rv.Type().Elem().Kind() { - case reflect.Slice: - if rv.IsNil() { - v = reflect.Zero(rv.Type().Elem()).Interface() - } else { - v = rv.Elem().Interface() - } - } } return v } @@ -505,7 +495,7 @@ func extensionAsLegacyType(v interface{}) interface{} { func extensionAsStorageType(v interface{}) interface{} { switch rv := reflect.ValueOf(v); rv.Kind() { case reflect.Ptr: - // Represent slice types as the value itself. + // Represent non-slice types as the value itself. switch rv.Type().Elem().Kind() { case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: if rv.IsNil() { @@ -514,13 +504,6 @@ func extensionAsStorageType(v interface{}) interface{} { v = rv.Elem().Interface() } } - case reflect.Slice: - // Represent slice types as a pointer to the value. - if rv.Type().Elem().Kind() != reflect.Uint8 { - rv2 := reflect.New(rv.Type()) - rv2.Elem().Set(rv) - v = rv2.Interface() - } } return v } From e1cc4b52e126a081632d30d7c46123097c962f9a Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Fri, 1 Nov 2019 14:30:47 -0700 Subject: [PATCH 089/133] proto, internal/proto: fix tests broken by latest v2 module Correct a failure in (un)marshaling extensions caused by expecting a *[]T where we now use a []T. Include unknown fields in text marshal output. Change-Id: Ica1ecab1f0768a1208b00915884ccd8026cc53a8 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/204803 Reviewed-by: Joe Tsai --- internal/proto/text.go | 1 + proto/table_marshal.go | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/internal/proto/text.go b/internal/proto/text.go index ee8fe9202f..9e43edc628 100644 --- a/internal/proto/text.go +++ b/internal/proto/text.go @@ -51,6 +51,7 @@ func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { } mo := prototext.MarshalOptions{ AllowPartial: true, + EmitUnknown: true, Indent: ind, } if !tm.ExpandAny { diff --git a/proto/table_marshal.go b/proto/table_marshal.go index f6ac7f5403..3c294158f4 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -393,18 +393,12 @@ func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo { t = t.Elem() } sizer, marshaler := typeMarshaler(t, tags, false, false) - var deref bool - if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { - t = reflect.PtrTo(t) - deref = true - } e = &marshalElemInfo{ wiretag: uint64(tag)<<3 | wt, tagsize: SizeVarint(uint64(tag) << 3), sizer: sizer, marshaler: marshaler, isptr: t.Kind() == reflect.Ptr, - deref: deref, } // update cache From 0fd87f0c3acdaa738c86e9854611d2cc83046425 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Wed, 6 Nov 2019 14:04:44 -0800 Subject: [PATCH 090/133] internal/proto: avoid deprecated protoregistry APIs Switch from the deprecated Register methods to the type-specific RegisterFile, RegisterMessage, and RegisterExtension. Drop usage of the deprecated NewTypes function. Change-Id: I547e77ef1b8ea1c039227b656ea6ba85c3536dd1 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/205700 Reviewed-by: Joe Tsai --- internal/proto/registry.go | 6 +++--- internal/proto/text.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/proto/registry.go b/internal/proto/registry.go index 960abdbc08..e12f16502e 100644 --- a/internal/proto/registry.go +++ b/internal/proto/registry.go @@ -65,7 +65,7 @@ func RegisterFile(s filePath, d fileDescGZIP) { } // Register the descriptor in the v2 registry and cache the result locally. - if err := protoregistry.GlobalFiles.Register(fd); err != nil { + if err := protoregistry.GlobalFiles.RegisterFile(fd); err != nil { printWarning(err) return } @@ -249,7 +249,7 @@ func RegisterType(m Message, s messageName) { if s != messageName(mt.Descriptor().FullName()) { panic(fmt.Sprintf("proto: inconsistent message name: got %v, want %v", s, mt.Descriptor().FullName())) } - if err := protoregistry.GlobalTypes.Register(mt); err != nil { + if err := protoregistry.GlobalTypes.RegisterMessage(mt); err != nil { printWarning(err) return } @@ -312,7 +312,7 @@ func MessageName(m Message) messageName { // // Deprecated: Use protoregistry.GlobalTypes.Register instead. func RegisterExtension(d *ExtensionDesc) { - if err := protoregistry.GlobalTypes.Register(d); err != nil { + if err := protoregistry.GlobalTypes.RegisterExtension(d); err != nil { panic(err) } } diff --git a/internal/proto/text.go b/internal/proto/text.go index 9e43edc628..87872f0509 100644 --- a/internal/proto/text.go +++ b/internal/proto/text.go @@ -77,7 +77,7 @@ func (tm *TextMarshaler) Text(pb Message) string { } var ( - emptyResolver = preg.NewTypes() + emptyResolver = &preg.Types{} defaultTextMarshaler = TextMarshaler{} compactTextMarshaler = TextMarshaler{Compact: true} ) From ff0ab7ff114d37adbad1e93386d4017f525e5ced Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Thu, 7 Nov 2019 16:39:04 -0800 Subject: [PATCH 091/133] go.mod: update to latest google.golang.org/protobuf go get -u google.golang.org/protobuf/... Fixes deadlock in tests by picking up CL 205957. Change-Id: I9eda29602238c6ba4053f269e35304934bb909f5 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/205997 Reviewed-by: Joe Tsai --- go.mod | 5 ++++- go.sum | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 7d44b24518..be2b4ee1e9 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,7 @@ module github.com/golang/protobuf go 1.9 -require google.golang.org/protobuf v0.0.0-20191031162342-c826885a2abe +require ( + github.com/google/go-cmp v0.3.1 // indirect + google.golang.org/protobuf v0.0.0-20191108002925-e9187326c3ff +) diff --git a/go.sum b/go.sum index 9d0e60f8bf..cddf915c4f 100644 --- a/go.sum +++ b/go.sum @@ -12,6 +12,8 @@ github.com/golang/protobuf v1.2.1-0.20190820213554-ae1d65bc5435/go.mod h1:k7dGki github.com/golang/protobuf v1.2.1-0.20191004062209-62f67f1ea9df/go.mod h1:o4el5ABfDjqFlwwvAq2OIgAPeNXQYUkhtrjNPXy6T6I= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= google.golang.org/protobuf v0.0.0-20190514231807-cdb777356907/go.mod h1:HeRLsKXv4+wE27dOIGwnqcOgq6a1O/GJ7mGhiEPnBrU= google.golang.org/protobuf v0.0.0-20190516201745-40b83d67fc75/go.mod h1:jf+u8AHuKtkib+0J4/bQXPNzCmT3V9a02hVzYKtatuw= @@ -28,5 +30,5 @@ google.golang.org/protobuf v0.0.0-20190820213257-f1e905b04207 h1:ulV4hvtdAg7Xsym google.golang.org/protobuf v0.0.0-20190820213257-f1e905b04207/go.mod h1:UJqt2ZERO8/qk5A9t8Ujq6OJ+MNvOQpg9X4RKyYz9Ho= google.golang.org/protobuf v0.0.0-20190828183429-79bfdbe45be2 h1:g52BKWg08C9Z3iSV/mBCfoP+ObYXKCgdXF+p1EB9zD0= google.golang.org/protobuf v0.0.0-20190828183429-79bfdbe45be2/go.mod h1:fYMzYhnMXLj/kGDPzNOptS3IFFlQjWTlu2j3ZPET2lw= -google.golang.org/protobuf v0.0.0-20191031162342-c826885a2abe h1:TqSqUz1beyIiDb4QdI6lZDstr9RxMfftdKQ0eonA0Dc= -google.golang.org/protobuf v0.0.0-20191031162342-c826885a2abe/go.mod h1:qKrTvhhUFcTIUF6KuejTfRdHXKeBPoa4mtynR6usTss= +google.golang.org/protobuf v0.0.0-20191108002925-e9187326c3ff h1:owlmxbzMXWq78QqeFT2Xj1ySspP/ot+aFzxHoz79YLQ= +google.golang.org/protobuf v0.0.0-20191108002925-e9187326c3ff/go.mod h1:qKrTvhhUFcTIUF6KuejTfRdHXKeBPoa4mtynR6usTss= From cc376d7145c679febdd10557ded10ff26a681fbb Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 8 Jan 2020 20:52:47 -0800 Subject: [PATCH 092/133] all: update to wrap v2 All functionality has been re-written to either wrap v2 directly (e.g., binary serialization) or written to use v2 protobuf reflection (e.g., text and json serialization). This is to done to reduce the technical debt of maintaining the v1 module. Change-Id: I6749fa58a465df991c8fcf89e8d7077d64a2cfdb Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/213901 Reviewed-by: Damien Neil --- descriptor/descriptor.go | 185 +- descriptor/descriptor_test.go | 85 + go.mod | 4 +- go.sum | 33 +- internal/proto/common.go | 73 - internal/proto/common_test.go | 63 - internal/proto/defaults.go | 63 - internal/proto/discard.go | 75 - internal/proto/properties.go | 321 -- internal/proto/registry.go | 363 --- internal/proto/text.go | 117 - .../testprotos/jsonpb_proto/test2.pb.go | 367 ++- .../testprotos/jsonpb_proto/test2.proto | 37 +- .../testprotos/jsonpb_proto/test3.pb.go | 138 +- internal/testprotos/jsonpb_proto/test3.proto | 44 + .../testprotos/proto2_proto}/test.pb.go | 1508 +++------ .../testprotos/proto2_proto}/test.proto | 95 +- .../testprotos/proto3_proto/test.pb.go | 228 +- internal/testprotos/proto3_proto/test.proto | 72 + internal/testprotos/regenerate.bash | 17 + internal/wire/wire.go | 16 +- jsonpb/decode.go | 512 +++ jsonpb/encode.go | 555 ++++ jsonpb/json.go | 69 + jsonpb/{jsonpb_test.go => json_test.go} | 448 +-- jsonpb/jsonpb.go | 1291 -------- .../jsonpb_test_proto/more_test_objects.proto | 71 - proto/buffer.go | 324 ++ proto/clone.go | 222 -- proto/decode.go | 396 --- proto/defaults.go | 64 + proto/deprecated.go | 58 +- proto/discard.go | 336 +- proto/discard_test.go | 50 +- proto/encode.go | 176 -- proto/equal.go | 235 -- proto/equal_test.go | 217 -- proto/extensions.go | 657 ++-- proto/extensions_test.go | 215 +- proto/hooks_disabled.go | 152 - proto/hooks_enabled.go | 46 - proto/lib.go | 692 ---- proto/map_test.go | 74 - proto/message_set.go | 140 - proto/message_set_test.go | 67 - proto/pointer_reflect.go | 371 --- proto/pointer_unsafe.go | 303 -- proto/properties.go | 186 +- proto/properties_alt.go | 33 - proto/proto.go | 140 + proto/proto3_proto/proto3.proto | 99 - proto/proto3_test.go | 124 - proto/{clone_test.go => proto_clone_test.go} | 210 +- proto/proto_equal_test.go | 218 ++ proto/{all_test.go => proto_test.go} | 1272 ++++---- proto/registry.go | 387 ++- proto/registry_test.go | 25 +- proto/size2_test.go | 37 - proto/size_test.go | 164 - proto/table_marshal.go | 2779 ----------------- proto/table_merge.go | 630 ---- proto/table_unmarshal.go | 2090 ------------- proto/text.go | 832 ----- proto/text_decode.go | 799 +++++ proto/text_encode.go | 561 ++++ proto/text_parser.go | 894 ------ proto/wire.go | 72 + proto/{decode_test.go => wire_decode_test.go} | 19 +- proto/{encode_test.go => wire_encode_test.go} | 9 +- proto/wire_size_test.go | 177 ++ proto/wrappers.go | 14 +- protoc-gen-go/generator/generator.go | 2 +- protoc-gen-go/generator/name_test.go | 108 - ptypes/any.go | 176 +- ptypes/any_test.go | 89 +- ptypes/doc.go | 2 +- ptypes/duration.go | 83 +- ptypes/duration_test.go | 1 + ptypes/timestamp.go | 76 +- ptypes/timestamp_test.go | 2 +- test.bash | 14 +- 81 files changed, 6863 insertions(+), 17106 deletions(-) create mode 100644 descriptor/descriptor_test.go delete mode 100644 internal/proto/common.go delete mode 100644 internal/proto/common_test.go delete mode 100644 internal/proto/defaults.go delete mode 100644 internal/proto/discard.go delete mode 100644 internal/proto/properties.go delete mode 100644 internal/proto/registry.go delete mode 100644 internal/proto/text.go rename jsonpb/jsonpb_test_proto/test_objects.pb.go => internal/testprotos/jsonpb_proto/test2.pb.go (66%) rename jsonpb/jsonpb_test_proto/test_objects.proto => internal/testprotos/jsonpb_proto/test2.proto (67%) rename jsonpb/jsonpb_test_proto/more_test_objects.pb.go => internal/testprotos/jsonpb_proto/test3.pb.go (65%) create mode 100644 internal/testprotos/jsonpb_proto/test3.proto rename {proto/test_proto => internal/testprotos/proto2_proto}/test.pb.go (68%) rename {proto/test_proto => internal/testprotos/proto2_proto}/test.proto (79%) rename proto/proto3_proto/proto3.pb.go => internal/testprotos/proto3_proto/test.pb.go (51%) create mode 100644 internal/testprotos/proto3_proto/test.proto create mode 100755 internal/testprotos/regenerate.bash create mode 100644 jsonpb/decode.go create mode 100644 jsonpb/encode.go create mode 100644 jsonpb/json.go rename jsonpb/{jsonpb_test.go => json_test.go} (66%) delete mode 100644 jsonpb/jsonpb.go delete mode 100644 jsonpb/jsonpb_test_proto/more_test_objects.proto create mode 100644 proto/buffer.go delete mode 100644 proto/clone.go delete mode 100644 proto/decode.go create mode 100644 proto/defaults.go delete mode 100644 proto/encode.go delete mode 100644 proto/equal.go delete mode 100644 proto/equal_test.go delete mode 100644 proto/hooks_disabled.go delete mode 100644 proto/hooks_enabled.go delete mode 100644 proto/lib.go delete mode 100644 proto/map_test.go delete mode 100644 proto/message_set.go delete mode 100644 proto/message_set_test.go delete mode 100644 proto/pointer_reflect.go delete mode 100644 proto/pointer_unsafe.go delete mode 100644 proto/properties_alt.go create mode 100644 proto/proto.go delete mode 100644 proto/proto3_proto/proto3.proto delete mode 100644 proto/proto3_test.go rename proto/{clone_test.go => proto_clone_test.go} (55%) create mode 100644 proto/proto_equal_test.go rename proto/{all_test.go => proto_test.go} (69%) delete mode 100644 proto/size2_test.go delete mode 100644 proto/size_test.go delete mode 100644 proto/table_marshal.go delete mode 100644 proto/table_merge.go delete mode 100644 proto/table_unmarshal.go delete mode 100644 proto/text.go create mode 100644 proto/text_decode.go create mode 100644 proto/text_encode.go delete mode 100644 proto/text_parser.go create mode 100644 proto/wire.go rename proto/{decode_test.go => wire_decode_test.go} (93%) rename proto/{encode_test.go => wire_encode_test.go} (85%) create mode 100644 proto/wire_size_test.go delete mode 100644 protoc-gen-go/generator/name_test.go diff --git a/descriptor/descriptor.go b/descriptor/descriptor.go index 90c53904b6..3543da5e0c 100644 --- a/descriptor/descriptor.go +++ b/descriptor/descriptor.go @@ -2,64 +2,183 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package descriptor provides functions for obtaining protocol buffer -// descriptors for generated Go types. +// Package descriptor provides functions for obtaining the protocol buffer +// descriptors of generated Go types. // -// Deprecated: Do not use. The new v2 Message interface provides direct support -// for programmatically interacting with the descriptor information. +// Deprecated: Use the "google.golang.org/protobuf/reflect/protoreflect" +// package instead to obtain an EnumDescriptor or MessageDescriptor in order to +// programatically interact with the protobuf type system. package descriptor import ( "bytes" "compress/gzip" - "fmt" "io/ioutil" + "sync" "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/reflect/protodesc" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "github.com/golang/protobuf/protoc-gen-go/descriptor" ) -// extractFile extracts a FileDescriptorProto from a gzip'd buffer. -func extractFile(gz []byte) (*descriptorpb.FileDescriptorProto, error) { - r, err := gzip.NewReader(bytes.NewReader(gz)) - if err != nil { - return nil, fmt.Errorf("failed to open gzip reader: %v", err) +// Message is proto.Message with a method to return its descriptor. +// Not every message is guaranteed to implement this interface. +type Message interface { + proto.Message + Descriptor() ([]byte, []int) +} + +// ForMessage returns the file descriptor proto containing +// the message and the message descriptor proto for the message itself. +// The returned proto messages must not be mutated. +func ForMessage(m Message) (*descriptorpb.FileDescriptorProto, *descriptorpb.DescriptorProto) { + return MessageDescriptorProtoOf(m) +} + +// GeneratedEnum is any enum type generated by protoc-gen-go +// which is a named int32 kind. +type GeneratedEnum interface{} + +// GeneratedMessage is any message type generated by protoc-gen-go +// which is a pointer to a named struct kind. +type GeneratedMessage interface{} + +type rawDesc struct { + fileDesc []byte + indexes []int +} + +var rawDescCache sync.Map // map[protoreflect.Descriptor]*rawDesc + +func deriveRawDescriptor(d protoreflect.Descriptor) ([]byte, []int) { + // Fast-path: check whether raw descriptors are already cached. + origDesc := d + if v, ok := rawDescCache.Load(origDesc); ok { + return v.(*rawDesc).fileDesc, v.(*rawDesc).indexes } - defer r.Close() - b, err := ioutil.ReadAll(r) - if err != nil { - return nil, fmt.Errorf("failed to uncompress descriptor: %v", err) + // Slow-path: derive the raw descriptor from the v2 descriptor. + + // Start with the leaf (a given enum or message declaration) and + // ascend upwards until we hit the parent file descriptor. + var idxs []int + for { + idxs = append(idxs, d.Index()) + d = d.Parent() + if d == nil { + // TODO: We could construct a FileDescriptor stub for standalone + // descriptors to satisfy the API. + return nil, nil + } + if _, ok := d.(protoreflect.FileDescriptor); ok { + break + } } - fd := new(descriptorpb.FileDescriptorProto) - if err := proto.Unmarshal(b, fd); err != nil { - return nil, fmt.Errorf("malformed FileDescriptorProto: %v", err) + // Obtain the raw file descriptor. + var raw []byte + switch fd := d.(type) { + case interface{ ProtoLegacyRawDesc() []byte }: + raw = fd.ProtoLegacyRawDesc() + case protoreflect.FileDescriptor: + raw, _ = proto.Marshal(protodesc.ToFileDescriptorProto(fd)) } + file := protoimpl.X.CompressGZIP(raw) - return fd, nil + // Reverse the indexes, since we populated it in reverse. + for i, j := 0, len(idxs)-1; i < j; i, j = i+1, j-1 { + idxs[i], idxs[j] = idxs[j], idxs[i] + } + + if v, ok := rawDescCache.LoadOrStore(origDesc, &rawDesc{file, idxs}); ok { + return v.(*rawDesc).fileDesc, v.(*rawDesc).indexes + } + return file, idxs } -// Message is a proto.Message with a method to return its descriptor. -// -// Message types generated by the protocol compiler always satisfy -// the Message interface. -type Message interface { - proto.Message - Descriptor() ([]byte, []int) +// EnumRawDescriptorOf returns the GZIP'd raw file descriptor containing the +// enum and the index path to reach the enum declaration. +// The returned slices must not be mutated. +func EnumRawDescriptorOf(e GeneratedEnum) ([]byte, []int) { + if ev, ok := e.(interface{ EnumDescriptor() ([]byte, []int) }); ok { + return ev.EnumDescriptor() + } + ed := protoimpl.X.EnumTypeOf(e) + return deriveRawDescriptor(ed.Descriptor()) +} + +// MessageRawDescriptorOf returns the GZIP'd raw file descriptor containing +// the message and the index path to reach the message declaration. +// The returned slices must not be mutated. +func MessageRawDescriptorOf(m GeneratedMessage) ([]byte, []int) { + if mv, ok := m.(interface{ Descriptor() ([]byte, []int) }); ok { + return mv.Descriptor() + } + md := protoimpl.X.MessageTypeOf(m) + return deriveRawDescriptor(md.Descriptor()) } -// ForMessage returns a FileDescriptorProto and a DescriptorProto from within it -// describing the given message. -func ForMessage(msg Message) (fd *descriptorpb.FileDescriptorProto, md *descriptorpb.DescriptorProto) { - gz, path := msg.Descriptor() - fd, err := extractFile(gz) +var fileDescCache sync.Map // map[*byte]*descriptorpb.FileDescriptorProto + +func deriveFileDescriptor(rawDesc []byte) *descriptorpb.FileDescriptorProto { + // Fast-path: check whether descriptor protos are already cached. + if v, ok := fileDescCache.Load(&rawDesc[0]); ok { + return v.(*descriptorpb.FileDescriptorProto) + } + + // Slow-path: derive the descriptor proto from the GZIP'd message. + zr, err := gzip.NewReader(bytes.NewReader(rawDesc)) if err != nil { - panic(fmt.Sprintf("invalid FileDescriptorProto for %T: %v", msg, err)) + panic(err) } + b, err := ioutil.ReadAll(zr) + if err != nil { + panic(err) + } + fd := new(descriptorpb.FileDescriptorProto) + if err := proto.Unmarshal(b, fd); err != nil { + panic(err) + } + if v, ok := fileDescCache.LoadOrStore(&rawDesc[0], fd); ok { + return v.(*descriptorpb.FileDescriptorProto) + } + return fd +} - md = fd.MessageType[path[0]] - for _, i := range path[1:] { +// EnumDescriptorProtoOf returns the file descriptor proto containing +// the enum and the enum descriptor proto for the enum itself. +// The returned proto messages must not be mutated. +func EnumDescriptorProtoOf(e GeneratedEnum) (*descriptorpb.FileDescriptorProto, *descriptorpb.EnumDescriptorProto) { + rawDesc, idxs := EnumRawDescriptorOf(e) + if rawDesc == nil || idxs == nil { + return nil, nil + } + fd := deriveFileDescriptor(rawDesc) + if len(idxs) == 1 { + return fd, fd.EnumType[idxs[0]] + } + md := fd.MessageType[idxs[0]] + for _, i := range idxs[1 : len(idxs)-1] { + md = md.NestedType[i] + } + ed := md.EnumType[idxs[len(idxs)-1]] + return fd, ed +} + +// MessageDescriptorProtoOf returns the file descriptor proto containing +// the message and the message descriptor proto for the message itself. +// The returned proto messages must not be mutated. +func MessageDescriptorProtoOf(m GeneratedMessage) (*descriptorpb.FileDescriptorProto, *descriptorpb.DescriptorProto) { + rawDesc, idxs := MessageRawDescriptorOf(m) + if rawDesc == nil || idxs == nil { + return nil, nil + } + fd := deriveFileDescriptor(rawDesc) + md := fd.MessageType[idxs[0]] + for _, i := range idxs[1:] { md = md.NestedType[i] } return fd, md diff --git a/descriptor/descriptor_test.go b/descriptor/descriptor_test.go new file mode 100644 index 0000000000..c11680c80d --- /dev/null +++ b/descriptor/descriptor_test.go @@ -0,0 +1,85 @@ +// Copyright 2020 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 descriptor + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "google.golang.org/protobuf/reflect/protoreflect" + + descpb "github.com/golang/protobuf/protoc-gen-go/descriptor" +) + +func TestEnumDescriptorOf(t *testing.T) { + tests := []struct { + enum protoreflect.Enum + idxs []int + name string + }{{ + enum: descpb.FieldDescriptorProto_Type(0), + idxs: []int{ + new(descpb.FieldDescriptorProto).ProtoReflect().Descriptor().Index(), + new(descpb.FieldDescriptorProto_Type).Descriptor().Index(), + }, + name: "Type", + }, { + enum: descpb.FieldOptions_CType(0), + idxs: []int{ + new(descpb.FieldOptions).ProtoReflect().Descriptor().Index(), + new(descpb.FieldOptions_CType).Descriptor().Index(), + }, + name: "CType", + }} + + for _, tt := range tests { + e := struct{ protoreflect.Enum }{tt.enum} // v2-only enum + + _, idxs := EnumRawDescriptorOf(e) + if diff := cmp.Diff(tt.idxs, idxs); diff != "" { + t.Errorf("path index mismatch (-want +got):\n%v", diff) + } + + _, ed := EnumDescriptorProtoOf(e) + if ed.GetName() != tt.name { + t.Errorf("mismatching enum name: got %v, want %v", ed.GetName(), tt.name) + } + } +} + +func TestMessageDescriptorOf(t *testing.T) { + tests := []struct { + message protoreflect.ProtoMessage + idxs []int + name string + }{{ + message: (*descpb.SourceCodeInfo_Location)(nil), + idxs: []int{ + new(descpb.SourceCodeInfo).ProtoReflect().Descriptor().Index(), + new(descpb.SourceCodeInfo_Location).ProtoReflect().Descriptor().Index(), + }, + name: "Location", + }, { + message: (*descpb.FileDescriptorProto)(nil), + idxs: []int{ + new(descpb.FileDescriptorProto).ProtoReflect().Descriptor().Index(), + }, + name: "FileDescriptorProto", + }} + + for _, tt := range tests { + m := struct{ protoreflect.ProtoMessage }{tt.message} // v2-only message + + _, idxs := MessageRawDescriptorOf(m) + if diff := cmp.Diff(tt.idxs, idxs); diff != "" { + t.Errorf("path index mismatch (-want +got):\n%v", diff) + } + + _, md := MessageDescriptorProtoOf(m) + if md.GetName() != tt.name { + t.Errorf("mismatching message name: got %v, want %v", md.GetName(), tt.name) + } + } +} diff --git a/go.mod b/go.mod index be2b4ee1e9..269f7ab321 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/golang/protobuf go 1.9 require ( - github.com/google/go-cmp v0.3.1 // indirect - google.golang.org/protobuf v0.0.0-20191108002925-e9187326c3ff + github.com/google/go-cmp v0.3.1 + google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd ) diff --git a/go.sum b/go.sum index cddf915c4f..6cbf9e757d 100644 --- a/go.sum +++ b/go.sum @@ -1,34 +1,5 @@ -github.com/golang/protobuf v1.2.1-0.20190514181236-7800af189d76/go.mod h1:Zfz6qcDoDBESdv6JsKsGpgNHnkvwJAJwcA9eL+mOkgc= -github.com/golang/protobuf v1.2.1-0.20190515194842-7574ba03306e/go.mod h1:GjgUz9uwrRQmdPBBrFqiVbojAmlpy6ryM6DCzC+20rE= -github.com/golang/protobuf v1.2.1-0.20190516201927-a2cd3ac1b343/go.mod h1:PScGDF2x230A126tLt9Ol9RjhXzbiPJrt/CogooD2mE= -github.com/golang/protobuf v1.2.1-0.20190516215712-ae2eaafab405/go.mod h1:UmP8hhPKR5WWIjbT9v0JEVT+U0DBSjbW8KaZVeyFfRE= -github.com/golang/protobuf v1.2.1-0.20190523175523-a1331f0b4ab4/go.mod h1:G+fNMoyvKWZDB7PCDHF+dXbH9OeE3+JoozCd9V7i66U= -github.com/golang/protobuf v1.2.1-0.20190605195750-76c9e09470ba/go.mod h1:S1YIJXvYHGRCG2UmZsOcElkAYfvZLg2sDRr9+Xu8JXU= -github.com/golang/protobuf v1.2.1-0.20190617175902-f94016f5239f/go.mod h1:G+HpKX7pYZAVkElkAWZkr08MToW6pTp/vs+E9osFfbg= -github.com/golang/protobuf v1.2.1-0.20190620192300-1ee46dfd80dd/go.mod h1:+CMAsi9jpYf/wAltLUKlg++CWXqxCJyD8iLDbQONsJs= -github.com/golang/protobuf v1.2.1-0.20190806214225-7037721e6de0/go.mod h1:tDQPRlaHYu9yt1wPgdx85inRiLvUCuJZXsYjC0mwc1c= -github.com/golang/protobuf v1.2.1-0.20190820204156-2da1b93405dd/go.mod h1:x87I3ou7ehf/yR6iQ88MkyDogdxXN04TELJ7HVy7V7I= -github.com/golang/protobuf v1.2.1-0.20190820213554-ae1d65bc5435/go.mod h1:k7dGkiTZ3rjVDhKSpGt+x1zDzAePJk4jdhoBwIkQgBo= -github.com/golang/protobuf v1.2.1-0.20191004062209-62f67f1ea9df/go.mod h1:o4el5ABfDjqFlwwvAq2OIgAPeNXQYUkhtrjNPXy6T6I= -github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY= -google.golang.org/protobuf v0.0.0-20190514231807-cdb777356907/go.mod h1:HeRLsKXv4+wE27dOIGwnqcOgq6a1O/GJ7mGhiEPnBrU= -google.golang.org/protobuf v0.0.0-20190516201745-40b83d67fc75/go.mod h1:jf+u8AHuKtkib+0J4/bQXPNzCmT3V9a02hVzYKtatuw= -google.golang.org/protobuf v0.0.0-20190516215540-a95b29fbf623/go.mod h1:cWWmz5lsCWIcqGLROrKq5Lu231IJw2PzqOZ8cgspbfY= -google.golang.org/protobuf v0.0.0-20190522194032-21ade498bd69/go.mod h1:cJytyYi/6qdwy/+gD49hmgHcwD7zhWxE/1KPEslaZ3M= -google.golang.org/protobuf v0.0.0-20190605195314-89d49632e5cf/go.mod h1:Btug4TBaP5wNYcb2zGKDTS7WMcaPPLuqEAKfEAZWYbo= -google.golang.org/protobuf v0.0.0-20190617175724-bd7b7a9e0c26/go.mod h1:+FOB8T5/Yw4ywwdyeun9/KlDeuwFYBkNQ+kVuwj9C94= -google.golang.org/protobuf v0.0.0-20190620020611-d888139e7b59/go.mod h1:of3pt14Y+dOxz2tBOHXEoapPpKFC15/0zWhPAddkfsU= -google.golang.org/protobuf v0.0.0-20190717230113-f647c82cc3c7 h1:U6U+Hb+UKNGJB0eMAjUGk0wTmy73kduTIvdsEgA4Gf8= -google.golang.org/protobuf v0.0.0-20190717230113-f647c82cc3c7/go.mod h1:yGm7aNHn9Bp1NIvj6+CVUkcJshu+Usshfd3A+YxEuI8= -google.golang.org/protobuf v0.0.0-20190820203659-c0f8c0a24ece h1:AFYGmds8FWBGNw0zddlFiGtDvkVFSnQ7J2bAdH4X9Xk= -google.golang.org/protobuf v0.0.0-20190820203659-c0f8c0a24ece/go.mod h1:tRqhEyKwbKqwt5CQZAuOtj09RfhLNklDOhndhYA9blU= -google.golang.org/protobuf v0.0.0-20190820213257-f1e905b04207 h1:ulV4hvtdAg7XsymkxyxHtKYxQoSq88XU1bmtCELxG38= -google.golang.org/protobuf v0.0.0-20190820213257-f1e905b04207/go.mod h1:UJqt2ZERO8/qk5A9t8Ujq6OJ+MNvOQpg9X4RKyYz9Ho= -google.golang.org/protobuf v0.0.0-20190828183429-79bfdbe45be2 h1:g52BKWg08C9Z3iSV/mBCfoP+ObYXKCgdXF+p1EB9zD0= -google.golang.org/protobuf v0.0.0-20190828183429-79bfdbe45be2/go.mod h1:fYMzYhnMXLj/kGDPzNOptS3IFFlQjWTlu2j3ZPET2lw= -google.golang.org/protobuf v0.0.0-20191108002925-e9187326c3ff h1:owlmxbzMXWq78QqeFT2Xj1ySspP/ot+aFzxHoz79YLQ= -google.golang.org/protobuf v0.0.0-20191108002925-e9187326c3ff/go.mod h1:qKrTvhhUFcTIUF6KuejTfRdHXKeBPoa4mtynR6usTss= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd h1:zSMqFwpTkfj+1nNFgmgu4B+Qv5Kpf4jpd11lCmHKuwQ= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/internal/proto/common.go b/internal/proto/common.go deleted file mode 100644 index f03c790f4c..0000000000 --- a/internal/proto/common.go +++ /dev/null @@ -1,73 +0,0 @@ -// 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 - -// TODO: This file exists to provide the illusion to other source files that -// they live within the real proto package by providing functions and types -// that they would otherwise be able to call directly. - -import ( - "fmt" - "reflect" - - "google.golang.org/protobuf/runtime/protoiface" - "google.golang.org/protobuf/runtime/protoimpl" -) - -type ( - Message = protoiface.MessageV1 - ExtensionDesc = protoimpl.ExtensionInfo -) - -// RequiredNotSetError is an error type returned by either Marshal or Unmarshal. -// Marshal reports this when a required field is not initialized. -// Unmarshal reports this when a required field is missing from the input data. -type RequiredNotSetError struct{ field string } - -func (e *RequiredNotSetError) Error() string { - if e.field == "" { - return fmt.Sprintf("proto: required field not set") - } - return fmt.Sprintf("proto: required field %q not set", e.field) -} -func (e *RequiredNotSetError) RequiredNotSet() bool { - return true -} - -type errorMask uint8 - -const ( - _ errorMask = (1 << iota) / 2 - errInvalidUTF8 - errRequiredNotSet -) - -type errorsList = []error - -var errorsListType = reflect.TypeOf(errorsList{}) - -// nonFatalErrors returns an errorMask identifying V2 non-fatal errors. -func nonFatalErrors(err error) errorMask { - verr := reflect.ValueOf(err) - if !verr.IsValid() { - return 0 - } - - if !verr.Type().AssignableTo(errorsListType) { - return 0 - } - - errs := verr.Convert(errorsListType).Interface().(errorsList) - var ret errorMask - for _, e := range errs { - switch e.(type) { - case interface{ RequiredNotSet() bool }: - ret |= errRequiredNotSet - case interface{ InvalidUTF8() bool }: - ret |= errInvalidUTF8 - } - } - return ret -} diff --git a/internal/proto/common_test.go b/internal/proto/common_test.go deleted file mode 100644 index b6e623f658..0000000000 --- a/internal/proto/common_test.go +++ /dev/null @@ -1,63 +0,0 @@ -// 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" - "testing" -) - -type testErrorList []error - -func (e testErrorList) Error() string { - return "testErrorList" -} - -type invalidUTF8Error struct{} - -func (e invalidUTF8Error) Error() string { return "" } -func (e invalidUTF8Error) InvalidUTF8() bool { return true } - -type requiredNotSetError struct{} - -func (e requiredNotSetError) Error() string { return "" } -func (e requiredNotSetError) RequiredNotSet() bool { return true } - -func TestNonFatalErrors(t *testing.T) { - tests := []struct { - input error - want errorMask - }{{ - input: errors.New("not one of them"), - }, { - input: testErrorList{}, - }, { - input: testErrorList{ - invalidUTF8Error{}, - }, - want: errInvalidUTF8, - }, { - input: testErrorList{ - requiredNotSetError{}, - }, - want: errRequiredNotSet, - }, { - input: testErrorList{ - invalidUTF8Error{}, - requiredNotSetError{}, - }, - want: errInvalidUTF8 | errRequiredNotSet, - }} - - for _, tc := range tests { - tc := tc - t.Run("", func(t *testing.T) { - got := nonFatalErrors(tc.input) - if got != tc.want { - t.Errorf("got %v, want %v", got, tc.want) - } - }) - } -} diff --git a/internal/proto/defaults.go b/internal/proto/defaults.go deleted file mode 100644 index 5056a76ece..0000000000 --- a/internal/proto/defaults.go +++ /dev/null @@ -1,63 +0,0 @@ -// 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 ( - pref "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// SetDefaults sets unset protocol buffer fields to their default values. -// It only modifies fields that are both unset and have defined defaults. -// It recursively sets default values in any non-nil sub-messages. -// It does not descend into extension fields that are sub-messages. -func SetDefaults(m Message) { - setDefaults(protoimpl.X.MessageOf(m)) -} - -func setDefaults(m pref.Message) { - fieldDescs := m.Descriptor().Fields() - for i := 0; i < fieldDescs.Len(); i++ { - fd := fieldDescs.Get(i) - if !m.Has(fd) { - if fd.HasDefault() { - v := fd.Default() - if fd.Kind() == pref.BytesKind { - v = pref.ValueOf(append([]byte(nil), v.Bytes()...)) // copy the default bytes - } - m.Set(fd, v) - } - continue - } - switch { - // Handle singular message. - case fd.Cardinality() != pref.Repeated: - if k := fd.Kind(); k == pref.MessageKind || k == pref.GroupKind { - setDefaults(m.Get(fd).Message()) - } - // Handle list of messages. - case !fd.IsMap(): - if k := fd.Kind(); k == pref.MessageKind || k == pref.GroupKind { - ls := m.Get(fd).List() - for i := 0; i < ls.Len(); i++ { - setDefaults(ls.Get(i).Message()) - } - } - // Handle map of messages. - default: - k := fd.Message().Fields().ByNumber(2).Kind() - if k == pref.MessageKind || k == pref.GroupKind { - ms := m.Get(fd).Map() - ms.Range(func(_ pref.MapKey, v pref.Value) bool { - setDefaults(v.Message()) - return true - }) - } - } - } - - // NOTE: Historically, this function has never set the defaults for - // extension fields, nor recursively visited sub-messages of such fields. -} diff --git a/internal/proto/discard.go b/internal/proto/discard.go deleted file mode 100644 index 6ef7452838..0000000000 --- a/internal/proto/discard.go +++ /dev/null @@ -1,75 +0,0 @@ -// 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 ( - "github.com/golang/protobuf/internal/wire" - pref "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// DiscardUnknown recursively discards all unknown fields from this message -// and all embedded messages. -// -// When unmarshaling a message with unrecognized fields, the tags and values -// of such fields are preserved in the Message. This allows a later call to -// 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 == nil { - return - } - discardUnknown(protoimpl.X.MessageOf(m)) -} - -func discardUnknown(m pref.Message) { - m.Range(func(fd pref.FieldDescriptor, val pref.Value) bool { - switch { - // Handle singular message. - case fd.Cardinality() != pref.Repeated: - if fd.Message() != nil { - discardUnknown(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++ { - discardUnknown(ls.Get(i).Message()) - } - } - // Handle map of messages. - case fd.IsMap(): - if fd.MapValue().Message() != nil { - ms := m.Get(fd).Map() - ms.Range(func(_ pref.MapKey, v pref.Value) bool { - discardUnknown(v.Message()) - return true - }) - } - } - return true - }) - - // Discard unknown fields. - var bo pref.RawFields - extRanges := m.Descriptor().ExtensionRanges() - for bi := m.GetUnknown(); len(bi) > 0; { - // NOTE: Historically, this function did not discard unknown fields - // that were within the extension field ranges. - num, _, n := wire.ConsumeField(bi) - if extRanges.Has(num) { - bo = append(bo, bi[:n]...) - } - bi = bi[n:] - } - if bi := m.GetUnknown(); len(bi) != len(bo) { - m.SetUnknown(bo) - } -} diff --git a/internal/proto/properties.go b/internal/proto/properties.go deleted file mode 100644 index d129248e01..0000000000 --- a/internal/proto/properties.go +++ /dev/null @@ -1,321 +0,0 @@ -// 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 - -import ( - "fmt" - "reflect" - "strconv" - "strings" - "sync" - - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// Constants that identify the encoding of a value on the wire. -const ( - WireVarint = 0 - WireFixed32 = 5 - WireFixed64 = 1 - WireBytes = 2 - WireStartGroup = 3 - WireEndGroup = 4 -) - -// StructProperties represents protocol buffer type information for a -// generated protobuf message in the open-struct API. -// -// Deprecated: Do not use. -type StructProperties struct { - // Prop are the properties for each field. - // - // Fields belonging to a oneof are stored in OneofTypes instead, with a - // single Properties representing the parent oneof held here. - // - // The order of Prop matches the order of fields in the Go struct. - // Struct fields that are not related to protobufs have a "XXX_" prefix - // in the Properties.Name and must be ignored by the user. - Prop []*Properties - - // OneofTypes contains information about the oneof fields in this message. - // It is keyed by the protobuf field name. - OneofTypes map[string]*OneofProperties -} - -// Properties represents the type information for a protobuf message field. -// -// Deprecated: Do not use. -type Properties struct { - // Name is a placeholder name with little meaningful semantic value. - // Fields with an "XXX_" prefix must be ignored. - Name string - // OrigName is the protobuf field name or oneof name. - OrigName string - // JSONName is the JSON name for the protobuf field. - JSONName string - // Enum is a placeholder name for enums. - // For historical reasons, this is neither the Go name for the enum, - // nor the protobuf name for the enum. - Enum string // Deprecated: Do not use. - // Wire is a string representation of the wire type. - Wire string - // WireType is the protobuf wire type for the field. - WireType int - // Tag is the protobuf field number. - Tag int - // Required reports whether this is a required field. - Required bool - // Optional reports whether this is a optional field. - Optional bool - // Repeated reports whether this is a repeated field. - Repeated bool - // Packed reports whether this is a packed repeated field of scalars. - Packed bool - // Proto3 reports whether this field operates under the proto3 syntax. - Proto3 bool - // Oneof reports whether this field belongs within a oneof. - Oneof bool - - // Default is the default value in string form. - Default string - // HasDefault reports whether the field has a default value. - HasDefault bool - - // MapKeyProp is the properties for the key field for a map field. - MapKeyProp *Properties - // MapValProp is the properties for the value field for a map field. - MapValProp *Properties -} - -// OneofProperties represents the type information for a protobuf oneof. -// -// Deprecated: Do not use. -type OneofProperties struct { - // Type is a pointer to the generated wrapper type for the field value. - // This is nil for messages that are not in the open-struct API. - Type reflect.Type - // Field is the index into StructProperties.Prop for the containing oneof. - Field int - // Prop is the properties for the field. - Prop *Properties -} - -// String formats the properties in the protobuf struct field tag style. -func (p *Properties) String() string { - s := p.Wire - s += "," + strconv.Itoa(p.Tag) - if p.Required { - s += ",req" - } - if p.Optional { - s += ",opt" - } - if p.Repeated { - s += ",rep" - } - if p.Packed { - s += ",packed" - } - s += ",name=" + p.OrigName - if p.JSONName != "" { - s += ",json=" + p.JSONName - } - if p.Proto3 { - s += ",proto3" - } - if p.Oneof { - s += ",oneof" - } - if len(p.Enum) > 0 { - s += ",enum=" + p.Enum - } - if p.HasDefault { - s += ",def=" + p.Default - } - return s -} - -// Parse populates p by parsing a string in the protobuf struct field tag style. -func (p *Properties) Parse(tag string) { - // For example: "bytes,49,opt,name=foo,def=hello!" - for len(tag) > 0 { - i := strings.IndexByte(tag, ',') - if i < 0 { - i = len(tag) - } - switch s := tag[:i]; { - case strings.HasPrefix(s, "name="): - p.OrigName = s[len("name="):] - case strings.HasPrefix(s, "json="): - p.JSONName = s[len("json="):] - case strings.HasPrefix(s, "enum="): - p.Enum = s[len("enum="):] - case strings.Trim(s, "0123456789") == "": - n, _ := strconv.ParseUint(s, 10, 32) - p.Tag = int(n) - case s == "opt": - p.Optional = true - case s == "req": - p.Required = true - case s == "rep": - p.Repeated = true - case s == "varint" || s == "zigzag32" || s == "zigzag64": - p.Wire = s - p.WireType = WireVarint - case s == "fixed32": - p.Wire = s - p.WireType = WireFixed32 - case s == "fixed64": - p.Wire = s - p.WireType = WireFixed64 - case s == "bytes": - p.Wire = s - p.WireType = WireBytes - case s == "group": - p.Wire = s - p.WireType = WireStartGroup - case s == "packed": - p.Packed = true - case s == "proto3": - p.Proto3 = true - case s == "oneof": - p.Oneof = true - case strings.HasPrefix(s, "def="): - // The default tag is special in that everything afterwards is the - // default regardless of the presence of commas. - p.HasDefault = true - p.Default, i = tag[len("def="):], len(tag) - } - tag = strings.TrimPrefix(tag[i:], ",") - } -} - -// Init populates the properties from a protocol buffer struct tag. -// -// Deprecated: Do not use. -func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.init(typ, name, tag, f) -} - -func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.Name = name - p.OrigName = name - if tag == "" { - return - } - p.Parse(tag) - - if typ != nil && typ.Kind() == reflect.Map { - p.MapKeyProp = new(Properties) - p.MapKeyProp.init(nil, "Key", f.Tag.Get("protobuf_key"), nil) - p.MapValProp = new(Properties) - p.MapValProp.init(nil, "Value", f.Tag.Get("protobuf_val"), nil) - } -} - -var propertiesCache sync.Map // map[reflect.Type]*StructProperties - -// GetProperties returns the list of properties for the type represented by t, -// which must be a generated protocol buffer message in the open-struct API, -// where protobuf message fields are represented by exported Go struct fields. -// -// Deprecated: Use v2 protobuf reflection instead. -func GetProperties(t reflect.Type) *StructProperties { - if p, ok := propertiesCache.Load(t); ok { - return p.(*StructProperties) - } - p, _ := propertiesCache.LoadOrStore(t, newProperties(t)) - return p.(*StructProperties) -} - -func newProperties(t reflect.Type) *StructProperties { - if t.Kind() != reflect.Struct { - panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) - } - - var foundField bool - prop := new(StructProperties) - - // Construct a list of properties for each field in the struct. - for i := 0; i < t.NumField(); i++ { - p := new(Properties) - f := t.Field(i) - tagField := f.Tag.Get("protobuf") - p.init(f.Type, f.Name, tagField, &f) - foundField = foundField || p.Tag > 0 - - tagOneof := f.Tag.Get("protobuf_oneof") - if tagOneof != "" { - p.OrigName = tagOneof - } - - // Rename unexported struct fields with the "XXX_" prefix since so much - // user code simply checks for this to exclude unrelated fields. - if f.PkgPath != "" { - p.Name = "XXX_" + p.Name - } - - prop.Prop = append(prop.Prop, p) - } - - // Construct a mapping of oneof field names to properties. - var oneofWrappers []interface{} - if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofFuncs"); ok { - oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[3].Interface().([]interface{}) - } - if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok { - oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0].Interface().([]interface{}) - } - if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoV2.Message); ok { - if m, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *protoimpl.MessageInfo }); ok { - oneofWrappers = m.ProtoMessageInfo().OneofWrappers - } - } - if len(oneofWrappers) > 0 { - prop.OneofTypes = make(map[string]*OneofProperties) - for _, wrapper := range oneofWrappers { - p := &OneofProperties{ - Type: reflect.ValueOf(wrapper).Type(), // *T - Prop: new(Properties), - } - f := p.Type.Elem().Field(0) - p.Prop.Name = f.Name - p.Prop.Parse(f.Tag.Get("protobuf")) - foundField = foundField || p.Prop.Tag > 0 - - // Determine the struct field that contains this oneof. - // Each wrapper is assignable to exactly one parent field. - var foundOneof bool - for i := 0; i < t.NumField() && !foundOneof; i++ { - if p.Type.AssignableTo(t.Field(i).Type) { - p.Field = i - foundOneof = true - } - } - if !foundOneof { - panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) - } - prop.OneofTypes[p.Prop.OrigName] = p - } - } - - // If we found no fields, it is possible that the struct uses a - // generated API that is not an open-struct layout. - if !foundField { - // Check with protobuf reflection to make sure this isn't - // an empty protobuf message. - mt := protoimpl.X.MessageDescriptorOf(reflect.New(t).Interface()) - if mt.Fields().Len() > 0 { - panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) - } - } - - return prop -} - -func (sp *StructProperties) Len() int { return len(sp.Prop) } -func (sp *StructProperties) Less(i, j int) bool { return false } -func (sp *StructProperties) Swap(i, j int) { return } diff --git a/internal/proto/registry.go b/internal/proto/registry.go deleted file mode 100644 index e12f16502e..0000000000 --- a/internal/proto/registry.go +++ /dev/null @@ -1,363 +0,0 @@ -// 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 ( - "bytes" - "compress/gzip" - "fmt" - "io/ioutil" - "os" - "reflect" - "runtime" - "strings" - "sync" - - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protodesc" - pref "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoimpl" - - "google.golang.org/protobuf/types/descriptorpb" -) - -// filePath is the path to the proto source file. -type filePath = string // e.g., "google/protobuf/descriptor.proto" - -// fileDescGZIP is the compressed contents of the encoded FileDescriptorProto. -type fileDescGZIP = []byte - -var fileCache sync.Map // map[filePath]fileDescGZIP - -// RegisterFile is called from generated code and registers the compressed -// FileDescriptorProto with the file path for a proto source file. -// -// Deprecated: Use protoregistry.GlobalFiles.Register instead. -func RegisterFile(s filePath, d fileDescGZIP) { - // Decompress the descriptor. - zr, err := gzip.NewReader(bytes.NewReader(d)) - if err != nil { - panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) - } - b, err := ioutil.ReadAll(zr) - if err != nil { - panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) - } - - // Parse the raw descriptor proto. - var pb descriptorpb.FileDescriptorProto - if err := protoV2.Unmarshal(b, &pb); err != nil { - panic(fmt.Sprintf("proto: unmarshal failure: %v", err)) - } - // Some old descriptors don't include the filename. - if pb.Name == nil { - pb.Name = &s - } - - // Convert the raw descriptor to a structured file descriptor. - fd, err := protodesc.NewFile(&pb, nil) - if err != nil { - // TODO: Ignore errors due to placeholders. - panic(fmt.Sprintf("proto: descriptor parsing failure: %v", err)) - } - - // Register the descriptor in the v2 registry and cache the result locally. - if err := protoregistry.GlobalFiles.RegisterFile(fd); err != nil { - printWarning(err) - return - } - fileCache.Store(s, b) -} - -// FileDescriptor returns the compressed FileDescriptorProto given the file path -// for a proto source file. It returns nil if not found. -// -// Deprecated: Use protoregistry.GlobalFiles.RangeFilesByPath instead. -func FileDescriptor(s filePath) (d fileDescGZIP) { - if d, ok := fileCache.Load(s); ok { - return d.(fileDescGZIP) - } - - // Find the descriptor in the v2 registry. - if fd, _ := protoregistry.GlobalFiles.FindFileByPath(s); fd != nil { - pb := protodesc.ToFileDescriptorProto(fd) - b, err := protoV2.Marshal(pb) - if err != nil { - panic(fmt.Sprintf("proto: marshal failure: %v", err)) - } - bb := new(bytes.Buffer) - zw := gzip.NewWriter(bb) - if _, err := zw.Write(b); err != nil { - panic(fmt.Sprintf("proto: compression failure: %v", err)) - } - if err := zw.Close(); err != nil { - panic(fmt.Sprintf("proto: compression failure: %v", err)) - } - d = bb.Bytes() - } - - // Locally cache the raw descriptor form for the file. - if len(d) > 0 { - fileCache.Store(s, d) - } - return d -} - -// enumName is the name of an enum. For historical reasons, the enum name is -// neither the full Go name nor the full protobuf name of the enum. -// The name is the dot-separated combination of just the proto package that the -// enum is declared within followed by the Go type name of the generated enum. -type enumName = string // e.g., "my.proto.package.GoMessage_GoEnum" - -// enumsByName maps enum values by name to their numeric counterpart. -type enumsByName = map[string]int32 - -// enumsByNumber maps enum values by number to their name counterpart. -type enumsByNumber = map[int32]string - -var enumCache sync.Map // map[enumName]enumsByName - -// RegisterEnum is called from the generated code and registers the mapping of -// enum value names to enum numbers for the enum identified by s. -// -// Deprecated: Use protoregistry.GlobalTypes.Register instead. -func RegisterEnum(s enumName, _ enumsByNumber, m enumsByName) { - if _, ok := enumCache.Load(s); ok { - panic("proto: duplicate enum registered: " + s) - } - enumCache.Store(s, m) - - // This does not forward registration to the v2 registry since this API - // lacks sufficient information to construct a complete v2 enum descriptor. -} - -// EnumValueMap returns the mapping from enum value names to enum numbers for -// the enum of the given name. It returns nil if not found. -// -// Deprecated: Use protoregistry.GlobalTypes.FindEnumByName instead. -func EnumValueMap(s enumName) (m enumsByName) { - v, ok := enumCache.Load(s) - if ok { - return v.(enumsByName) - } - - // Construct the mapping from a v2 enum descriptor. - var protoPkg pref.FullName - if i := strings.LastIndexByte(s, '.'); i >= 0 { - protoPkg = pref.FullName(s[:i]) - } - protoregistry.GlobalFiles.RangeFilesByPackage(pref.FullName(protoPkg), func(fd pref.FileDescriptor) bool { - return walkEnums(fd, func(ed pref.EnumDescriptor) bool { - if s == hybridEnumName(ed) { - m = make(enumsByName) - evs := ed.Values() - for i := evs.Len() - 1; i >= 0; i-- { - ev := evs.Get(i) - m[string(ev.Name())] = int32(ev.Number()) - } - return false - } - return true - }) - }) - - if m != nil { - enumCache.Store(s, m) - } - return m -} - -// walkEnums recursively walks all enums declared in d. -func walkEnums(d interface { - Enums() pref.EnumDescriptors - Messages() pref.MessageDescriptors -}, f func(pref.EnumDescriptor) bool) bool { - cont := true - eds := d.Enums() - for i := eds.Len() - 1; cont && i >= 0; i-- { - cont = cont && f(eds.Get(i)) - } - mds := d.Messages() - for i := mds.Len() - 1; cont && i >= 0; i-- { - cont = cont && walkEnums(mds.Get(i), f) - } - return cont -} - -// hybridEnumName returns the legacy enum identifier. -func hybridEnumName(ed pref.EnumDescriptor) enumName { - var protoPkg string - if fd := ed.ParentFile(); fd != nil { - protoPkg = string(fd.Package()) - } - if protoPkg == "" { - return camelCase(string(ed.FullName())) - } - return protoPkg + "." + camelCase(strings.TrimPrefix(string(ed.FullName()), protoPkg+".")) -} - -// camelCase is a copy of the v2 protogen.camelCase function. -func camelCase(s string) string { - isASCIILower := func(c byte) bool { - return 'a' <= c && c <= 'z' - } - isASCIIDigit := func(c byte) bool { - return '0' <= c && c <= '9' - } - - var b []byte - for i := 0; i < len(s); i++ { - c := s[i] - switch { - case c == '.' && i+1 < len(s) && isASCIILower(s[i+1]): - continue - case c == '.': - b = append(b, '_') - case c == '_' && (i == 0 || s[i-1] == '.'): - b = append(b, 'X') - case c == '_' && i+1 < len(s) && isASCIILower(s[i+1]): - continue - case isASCIIDigit(c): - b = append(b, c) - default: - if isASCIILower(c) { - c -= 'a' - 'A' - } - b = append(b, c) - for ; i+1 < len(s) && isASCIILower(s[i+1]); i++ { - b = append(b, s[i+1]) - } - } - } - return string(b) -} - -// messageName is the full name of protobuf message. -type messageName = string - -var messageTypeCache sync.Map // map[messageName]reflect.Type - -// RegisterType is called from generated code and register the message Go type -// for a message of the given name. -// -// Deprecated: Use protoregistry.GlobalTypes.Register instead. -func RegisterType(m Message, s messageName) { - mt := protoimpl.X.MessageTypeOf(m) - if s != messageName(mt.Descriptor().FullName()) { - panic(fmt.Sprintf("proto: inconsistent message name: got %v, want %v", s, mt.Descriptor().FullName())) - } - if err := protoregistry.GlobalTypes.RegisterMessage(mt); err != nil { - printWarning(err) - return - } - messageTypeCache.Store(s, reflect.TypeOf(m)) -} - -// RegisterMapType is called from generated code and registers the Go map type -// for a protobuf message representing a map entry. -// -// Deprecated: Do not use. -func RegisterMapType(m interface{}, s messageName) { - t := reflect.TypeOf(m) - if t.Kind() != reflect.Map { - panic(fmt.Sprintf("invalid map kind: %v", t)) - } - if _, ok := messageTypeCache.Load(s); ok { - printWarning(fmt.Errorf("proto: duplicate proto message registered: %s", s)) - return - } - messageTypeCache.Store(s, t) -} - -// MessageType returns the message type for a named message. -// It returns nil if not found. -// -// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead. -func MessageType(s messageName) reflect.Type { - if t, ok := messageTypeCache.Load(s); ok { - return t.(reflect.Type) - } - - // Derive the message type from the v2 registry. - var t reflect.Type - mt, _ := protoregistry.GlobalTypes.FindMessageByName(pref.FullName(s)) - if mt != nil { - t = reflect.TypeOf(mt.Zero().Interface()) - } - // TODO: Support retrieving Go map types for map entry messages? - - if t != nil { - messageTypeCache.Store(s, t) - } - return t -} - -// MessageName returns the full protobuf name for the given message type. -// -// Deprecated: Use pref.MessageDescriptor.FullName instead. -func MessageName(m Message) messageName { - if m, ok := m.(interface { - XXX_MessageName() messageName - }); ok { - return m.XXX_MessageName() - } - return messageName(protoimpl.X.MessageDescriptorOf(m).FullName()) -} - -// RegisterExtension is called from the generated code and registers -// the extension descriptor. -// -// Deprecated: Use protoregistry.GlobalTypes.Register instead. -func RegisterExtension(d *ExtensionDesc) { - if err := protoregistry.GlobalTypes.RegisterExtension(d); err != nil { - panic(err) - } -} - -type extensionsByNumber = map[int32]*ExtensionDesc - -var extensionCache sync.Map // map[messageName]extensionsByNumber - -// RegisteredExtensions returns a map of the registered extensions for the -// provided protobuf message, indexed by the extension field number. -// -// Deprecated: Use protoregistry.GlobalTypes.RangeExtensionsByMessage instead. -func RegisteredExtensions(m Message) extensionsByNumber { - s := MessageName(m) - if xs, ok := extensionCache.Load(s); ok { - return xs.(extensionsByNumber) - } - - var xs extensionsByNumber - protoregistry.GlobalTypes.RangeExtensionsByMessage(pref.FullName(s), func(xt pref.ExtensionType) bool { - if xs == nil { - xs = make(extensionsByNumber) - } - xs[int32(xt.TypeDescriptor().Number())] = protoimpl.X.ExtensionDescFromType(xt) - return true - }) - - if xs == nil { - return nil - } - if xs, ok := extensionCache.LoadOrStore(s, xs); ok { - return xs.(extensionsByNumber) - } - return xs -} - -// printWarning prints a warning to os.Stderr regarding a registration conflict. -func printWarning(err error) { - // TODO: Provide a link in the warning to a page that explains - // what the user should do instead? - b := make([]byte, 0, 1<<12) - b = append(b, "==================\n"...) - b = append(b, "WARNING: "+err.Error()+"\n"...) - b = append(b, "A future release of proto will panic on registration conflicts.\n\n"...) - b = b[:len(b)+runtime.Stack(b[len(b):cap(b)], false)] - b = append(b, "==================\n"...) - os.Stderr.Write(b) -} diff --git a/internal/proto/text.go b/internal/proto/text.go deleted file mode 100644 index 87872f0509..0000000000 --- a/internal/proto/text.go +++ /dev/null @@ -1,117 +0,0 @@ -// 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 - -// Functions for writing the text protocol buffer format. - -import ( - "bytes" - "encoding" - "io" - "reflect" - - "google.golang.org/protobuf/encoding/prototext" - preg "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// TextMarshaler is a configurable text format marshaler. -type TextMarshaler struct { - Compact bool // use compact text format in one line without the trailing newline character - ExpandAny bool // expand google.protobuf.Any messages of known types -} - -// Marshal writes a given protocol buffer in text format. -func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { - val := reflect.ValueOf(pb) - // V1 supports passing in nil interface or pointer and outputs , while - // V2 will panic on nil interface and outputs nothing for nil pointer. - if pb == nil || val.IsNil() { - w.Write([]byte("")) - return nil - } - - // V1-specific override in marshaling. - if etm, ok := pb.(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = w.Write(text); err != nil { - return err - } - return nil - } - - var ind string - if !tm.Compact { - ind = " " - } - mo := prototext.MarshalOptions{ - AllowPartial: true, - EmitUnknown: true, - Indent: ind, - } - if !tm.ExpandAny { - mo.Resolver = emptyResolver - } - b, err := mo.Marshal(protoimpl.X.MessageOf(pb).Interface()) - mask := nonFatalErrors(err) - // V1 does not return invalid UTF-8 error. - if err != nil && mask&errInvalidUTF8 == 0 { - return err - } - if _, err := w.Write(b); err != nil { - return err - } - return nil -} - -// Text is the same as Marshal, but returns the string directly. -func (tm *TextMarshaler) Text(pb Message) string { - var buf bytes.Buffer - tm.Marshal(&buf, pb) - return buf.String() -} - -var ( - emptyResolver = &preg.Types{} - defaultTextMarshaler = TextMarshaler{} - compactTextMarshaler = TextMarshaler{Compact: true} -) - -// MarshalText writes a given protocol buffer in text format. -func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } - -// MarshalTextString is the same as MarshalText, but returns the string directly. -func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } - -// CompactText writes a given protocol buffer in compact text format (one line). -func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } - -// CompactTextString is the same as CompactText, but returns the string directly. -func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } - -// UnmarshalText reads a protocol buffer in text format. UnmarshalText resets pb -// before starting to unmarshal, so any existing data in pb is always removed. -// If a required field is not set and no other error occurs, UnmarshalText -// returns *RequiredNotSetError. -func UnmarshalText(s string, m Message) error { - if um, ok := m.(encoding.TextUnmarshaler); ok { - return um.UnmarshalText([]byte(s)) - } - err := prototext.Unmarshal([]byte(s), protoimpl.X.MessageOf(m).Interface()) - // Return RequiredNotSetError for required not set errors and ignore invalid - // UTF-8 errors. - mask := nonFatalErrors(err) - if mask&errRequiredNotSet > 0 { - return &RequiredNotSetError{} - } - if mask&errInvalidUTF8 > 0 { - return nil - } - // Otherwise return error which can either be nil or fatal. - return err -} diff --git a/jsonpb/jsonpb_test_proto/test_objects.pb.go b/internal/testprotos/jsonpb_proto/test2.pb.go similarity index 66% rename from jsonpb/jsonpb_test_proto/test_objects.pb.go rename to internal/testprotos/jsonpb_proto/test2.pb.go index 5522376c0d..a27dc0c256 100644 --- a/jsonpb/jsonpb_test_proto/test_objects.pb.go +++ b/internal/testprotos/jsonpb_proto/test2.pb.go @@ -1,16 +1,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: jsonpb_test_proto/test_objects.proto +// source: jsonpb_proto/test2.proto -package jsonpb +package jsonpb_proto import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" - duration "github.com/golang/protobuf/ptypes/duration" - _struct "github.com/golang/protobuf/ptypes/struct" - timestamp "github.com/golang/protobuf/ptypes/timestamp" - wrappers "github.com/golang/protobuf/ptypes/wrappers" + anypb "google.golang.org/protobuf/types/known/anypb" + durationpb "google.golang.org/protobuf/types/known/durationpb" + structpb "google.golang.org/protobuf/types/known/structpb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" math "math" ) @@ -65,7 +65,7 @@ func (x *Widget_Color) UnmarshalJSON(data []byte) error { } func (Widget_Color) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{3, 0} + return fileDescriptor_50cab1d8463dea41, []int{3, 0} } // Test message for holding primitive types. @@ -98,7 +98,7 @@ func (m *Simple) Reset() { *m = Simple{} } func (m *Simple) String() string { return proto.CompactTextString(m) } func (*Simple) ProtoMessage() {} func (*Simple) Descriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{0} + return fileDescriptor_50cab1d8463dea41, []int{0} } func (m *Simple) XXX_Unmarshal(b []byte) error { @@ -269,7 +269,7 @@ func (m *NonFinites) Reset() { *m = NonFinites{} } func (m *NonFinites) String() string { return proto.CompactTextString(m) } func (*NonFinites) ProtoMessage() {} func (*NonFinites) Descriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{1} + return fileDescriptor_50cab1d8463dea41, []int{1} } func (m *NonFinites) XXX_Unmarshal(b []byte) error { @@ -354,7 +354,7 @@ func (m *Repeats) Reset() { *m = Repeats{} } func (m *Repeats) String() string { return proto.CompactTextString(m) } func (*Repeats) ProtoMessage() {} func (*Repeats) Descriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{2} + return fileDescriptor_50cab1d8463dea41, []int{2} } func (m *Repeats) XXX_Unmarshal(b []byte) error { @@ -454,8 +454,8 @@ func (m *Repeats) GetRBytes() [][]byte { // Test message for holding enums and nested messages. type Widget struct { - Color *Widget_Color `protobuf:"varint,1,opt,name=color,enum=jsonpb.Widget_Color" json:"color,omitempty"` - RColor []Widget_Color `protobuf:"varint,2,rep,name=r_color,json=rColor,enum=jsonpb.Widget_Color" json:"r_color,omitempty"` + Color *Widget_Color `protobuf:"varint,1,opt,name=color,enum=jsonpb_test.Widget_Color" json:"color,omitempty"` + RColor []Widget_Color `protobuf:"varint,2,rep,name=r_color,json=rColor,enum=jsonpb_test.Widget_Color" json:"r_color,omitempty"` Simple *Simple `protobuf:"bytes,10,opt,name=simple" json:"simple,omitempty"` RSimple []*Simple `protobuf:"bytes,11,rep,name=r_simple,json=rSimple" json:"r_simple,omitempty"` Repeats *Repeats `protobuf:"bytes,20,opt,name=repeats" json:"repeats,omitempty"` @@ -469,7 +469,7 @@ func (m *Widget) Reset() { *m = Widget{} } func (m *Widget) String() string { return proto.CompactTextString(m) } func (*Widget) ProtoMessage() {} func (*Widget) Descriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{3} + return fileDescriptor_50cab1d8463dea41, []int{3} } func (m *Widget) XXX_Unmarshal(b []byte) error { @@ -544,7 +544,7 @@ func (m *Maps) Reset() { *m = Maps{} } func (m *Maps) String() string { return proto.CompactTextString(m) } func (*Maps) ProtoMessage() {} func (*Maps) Descriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{4} + return fileDescriptor_50cab1d8463dea41, []int{4} } func (m *Maps) XXX_Unmarshal(b []byte) error { @@ -596,7 +596,7 @@ func (m *MsgWithOneof) Reset() { *m = MsgWithOneof{} } func (m *MsgWithOneof) String() string { return proto.CompactTextString(m) } func (*MsgWithOneof) ProtoMessage() {} func (*MsgWithOneof) Descriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{5} + return fileDescriptor_50cab1d8463dea41, []int{5} } func (m *MsgWithOneof) XXX_Unmarshal(b []byte) error { @@ -716,7 +716,7 @@ func (m *Real) Reset() { *m = Real{} } func (m *Real) String() string { return proto.CompactTextString(m) } func (*Real) ProtoMessage() {} func (*Real) Descriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{6} + return fileDescriptor_50cab1d8463dea41, []int{6} } var extRange_Real = []proto.ExtensionRange{ @@ -764,7 +764,7 @@ func (m *Complex) Reset() { *m = Complex{} } func (m *Complex) String() string { return proto.CompactTextString(m) } func (*Complex) ProtoMessage() {} func (*Complex) Descriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{7} + return fileDescriptor_50cab1d8463dea41, []int{7} } var extRange_Complex = []proto.ExtensionRange{ @@ -804,37 +804,37 @@ var E_Complex_RealExtension = &proto.ExtensionDesc{ ExtendedType: (*Real)(nil), ExtensionType: (*Complex)(nil), Field: 123, - Name: "jsonpb.Complex.real_extension", + Name: "jsonpb_test.Complex.real_extension", Tag: "bytes,123,opt,name=real_extension", - Filename: "jsonpb_test_proto/test_objects.proto", + Filename: "jsonpb_proto/test2.proto", } type KnownTypes struct { - An *any.Any `protobuf:"bytes,14,opt,name=an" json:"an,omitempty"` - Dur *duration.Duration `protobuf:"bytes,1,opt,name=dur" json:"dur,omitempty"` - St *_struct.Struct `protobuf:"bytes,12,opt,name=st" json:"st,omitempty"` - Ts *timestamp.Timestamp `protobuf:"bytes,2,opt,name=ts" json:"ts,omitempty"` - Lv *_struct.ListValue `protobuf:"bytes,15,opt,name=lv" json:"lv,omitempty"` - Val *_struct.Value `protobuf:"bytes,16,opt,name=val" json:"val,omitempty"` - Dbl *wrappers.DoubleValue `protobuf:"bytes,3,opt,name=dbl" json:"dbl,omitempty"` - Flt *wrappers.FloatValue `protobuf:"bytes,4,opt,name=flt" json:"flt,omitempty"` - I64 *wrappers.Int64Value `protobuf:"bytes,5,opt,name=i64" json:"i64,omitempty"` - U64 *wrappers.UInt64Value `protobuf:"bytes,6,opt,name=u64" json:"u64,omitempty"` - I32 *wrappers.Int32Value `protobuf:"bytes,7,opt,name=i32" json:"i32,omitempty"` - U32 *wrappers.UInt32Value `protobuf:"bytes,8,opt,name=u32" json:"u32,omitempty"` - Bool *wrappers.BoolValue `protobuf:"bytes,9,opt,name=bool" json:"bool,omitempty"` - Str *wrappers.StringValue `protobuf:"bytes,10,opt,name=str" json:"str,omitempty"` - Bytes *wrappers.BytesValue `protobuf:"bytes,11,opt,name=bytes" json:"bytes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + An *anypb.Any `protobuf:"bytes,14,opt,name=an" json:"an,omitempty"` + Dur *durationpb.Duration `protobuf:"bytes,1,opt,name=dur" json:"dur,omitempty"` + St *structpb.Struct `protobuf:"bytes,12,opt,name=st" json:"st,omitempty"` + Ts *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=ts" json:"ts,omitempty"` + Lv *structpb.ListValue `protobuf:"bytes,15,opt,name=lv" json:"lv,omitempty"` + Val *structpb.Value `protobuf:"bytes,16,opt,name=val" json:"val,omitempty"` + Dbl *wrapperspb.DoubleValue `protobuf:"bytes,3,opt,name=dbl" json:"dbl,omitempty"` + Flt *wrapperspb.FloatValue `protobuf:"bytes,4,opt,name=flt" json:"flt,omitempty"` + I64 *wrapperspb.Int64Value `protobuf:"bytes,5,opt,name=i64" json:"i64,omitempty"` + U64 *wrapperspb.UInt64Value `protobuf:"bytes,6,opt,name=u64" json:"u64,omitempty"` + I32 *wrapperspb.Int32Value `protobuf:"bytes,7,opt,name=i32" json:"i32,omitempty"` + U32 *wrapperspb.UInt32Value `protobuf:"bytes,8,opt,name=u32" json:"u32,omitempty"` + Bool *wrapperspb.BoolValue `protobuf:"bytes,9,opt,name=bool" json:"bool,omitempty"` + Str *wrapperspb.StringValue `protobuf:"bytes,10,opt,name=str" json:"str,omitempty"` + Bytes *wrapperspb.BytesValue `protobuf:"bytes,11,opt,name=bytes" json:"bytes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *KnownTypes) Reset() { *m = KnownTypes{} } func (m *KnownTypes) String() string { return proto.CompactTextString(m) } func (*KnownTypes) ProtoMessage() {} func (*KnownTypes) Descriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{8} + return fileDescriptor_50cab1d8463dea41, []int{8} } func (m *KnownTypes) XXX_Unmarshal(b []byte) error { @@ -855,105 +855,105 @@ func (m *KnownTypes) XXX_DiscardUnknown() { var xxx_messageInfo_KnownTypes proto.InternalMessageInfo -func (m *KnownTypes) GetAn() *any.Any { +func (m *KnownTypes) GetAn() *anypb.Any { if m != nil { return m.An } return nil } -func (m *KnownTypes) GetDur() *duration.Duration { +func (m *KnownTypes) GetDur() *durationpb.Duration { if m != nil { return m.Dur } return nil } -func (m *KnownTypes) GetSt() *_struct.Struct { +func (m *KnownTypes) GetSt() *structpb.Struct { if m != nil { return m.St } return nil } -func (m *KnownTypes) GetTs() *timestamp.Timestamp { +func (m *KnownTypes) GetTs() *timestamppb.Timestamp { if m != nil { return m.Ts } return nil } -func (m *KnownTypes) GetLv() *_struct.ListValue { +func (m *KnownTypes) GetLv() *structpb.ListValue { if m != nil { return m.Lv } return nil } -func (m *KnownTypes) GetVal() *_struct.Value { +func (m *KnownTypes) GetVal() *structpb.Value { if m != nil { return m.Val } return nil } -func (m *KnownTypes) GetDbl() *wrappers.DoubleValue { +func (m *KnownTypes) GetDbl() *wrapperspb.DoubleValue { if m != nil { return m.Dbl } return nil } -func (m *KnownTypes) GetFlt() *wrappers.FloatValue { +func (m *KnownTypes) GetFlt() *wrapperspb.FloatValue { if m != nil { return m.Flt } return nil } -func (m *KnownTypes) GetI64() *wrappers.Int64Value { +func (m *KnownTypes) GetI64() *wrapperspb.Int64Value { if m != nil { return m.I64 } return nil } -func (m *KnownTypes) GetU64() *wrappers.UInt64Value { +func (m *KnownTypes) GetU64() *wrapperspb.UInt64Value { if m != nil { return m.U64 } return nil } -func (m *KnownTypes) GetI32() *wrappers.Int32Value { +func (m *KnownTypes) GetI32() *wrapperspb.Int32Value { if m != nil { return m.I32 } return nil } -func (m *KnownTypes) GetU32() *wrappers.UInt32Value { +func (m *KnownTypes) GetU32() *wrapperspb.UInt32Value { if m != nil { return m.U32 } return nil } -func (m *KnownTypes) GetBool() *wrappers.BoolValue { +func (m *KnownTypes) GetBool() *wrapperspb.BoolValue { if m != nil { return m.Bool } return nil } -func (m *KnownTypes) GetStr() *wrappers.StringValue { +func (m *KnownTypes) GetStr() *wrapperspb.StringValue { if m != nil { return m.Str } return nil } -func (m *KnownTypes) GetBytes() *wrappers.BytesValue { +func (m *KnownTypes) GetBytes() *wrapperspb.BytesValue { if m != nil { return m.Bytes } @@ -972,7 +972,7 @@ func (m *MsgWithRequired) Reset() { *m = MsgWithRequired{} } func (m *MsgWithRequired) String() string { return proto.CompactTextString(m) } func (*MsgWithRequired) ProtoMessage() {} func (*MsgWithRequired) Descriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{9} + return fileDescriptor_50cab1d8463dea41, []int{9} } func (m *MsgWithRequired) XXX_Unmarshal(b []byte) error { @@ -1013,7 +1013,7 @@ func (m *MsgWithIndirectRequired) Reset() { *m = MsgWithIndirectRequired func (m *MsgWithIndirectRequired) String() string { return proto.CompactTextString(m) } func (*MsgWithIndirectRequired) ProtoMessage() {} func (*MsgWithIndirectRequired) Descriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{10} + return fileDescriptor_50cab1d8463dea41, []int{10} } func (m *MsgWithIndirectRequired) XXX_Unmarshal(b []byte) error { @@ -1066,7 +1066,7 @@ func (m *MsgWithRequiredBytes) Reset() { *m = MsgWithRequiredBytes{} } func (m *MsgWithRequiredBytes) String() string { return proto.CompactTextString(m) } func (*MsgWithRequiredBytes) ProtoMessage() {} func (*MsgWithRequiredBytes) Descriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{11} + return fileDescriptor_50cab1d8463dea41, []int{11} } func (m *MsgWithRequiredBytes) XXX_Unmarshal(b []byte) error { @@ -1095,17 +1095,17 @@ func (m *MsgWithRequiredBytes) GetByts() []byte { } type MsgWithRequiredWKT struct { - Str *wrappers.StringValue `protobuf:"bytes,1,req,name=str" json:"str,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Str *wrapperspb.StringValue `protobuf:"bytes,1,req,name=str" json:"str,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *MsgWithRequiredWKT) Reset() { *m = MsgWithRequiredWKT{} } func (m *MsgWithRequiredWKT) String() string { return proto.CompactTextString(m) } func (*MsgWithRequiredWKT) ProtoMessage() {} func (*MsgWithRequiredWKT) Descriptor() ([]byte, []int) { - return fileDescriptor_6b3d96f97365f06c, []int{12} + return fileDescriptor_50cab1d8463dea41, []int{12} } func (m *MsgWithRequiredWKT) XXX_Unmarshal(b []byte) error { @@ -1126,7 +1126,7 @@ func (m *MsgWithRequiredWKT) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWithRequiredWKT proto.InternalMessageInfo -func (m *MsgWithRequiredWKT) GetStr() *wrappers.StringValue { +func (m *MsgWithRequiredWKT) GetStr() *wrapperspb.StringValue { if m != nil { return m.Str } @@ -1137,141 +1137,140 @@ var E_Name = &proto.ExtensionDesc{ ExtendedType: (*Real)(nil), ExtensionType: (*string)(nil), Field: 124, - Name: "jsonpb.name", + Name: "jsonpb_test.name", Tag: "bytes,124,opt,name=name", - Filename: "jsonpb_test_proto/test_objects.proto", + Filename: "jsonpb_proto/test2.proto", } var E_Extm = &proto.ExtensionDesc{ ExtendedType: (*Real)(nil), ExtensionType: (*MsgWithRequired)(nil), Field: 125, - Name: "jsonpb.extm", + Name: "jsonpb_test.extm", Tag: "bytes,125,opt,name=extm", - Filename: "jsonpb_test_proto/test_objects.proto", + Filename: "jsonpb_proto/test2.proto", } func init() { - proto.RegisterEnum("jsonpb.Widget_Color", Widget_Color_name, Widget_Color_value) - proto.RegisterType((*Simple)(nil), "jsonpb.Simple") - proto.RegisterType((*NonFinites)(nil), "jsonpb.NonFinites") - proto.RegisterType((*Repeats)(nil), "jsonpb.Repeats") - proto.RegisterType((*Widget)(nil), "jsonpb.Widget") - proto.RegisterType((*Maps)(nil), "jsonpb.Maps") - proto.RegisterMapType((map[bool]*Simple)(nil), "jsonpb.Maps.MBoolSimpleEntry") - proto.RegisterMapType((map[int64]string)(nil), "jsonpb.Maps.MInt64StrEntry") - proto.RegisterType((*MsgWithOneof)(nil), "jsonpb.MsgWithOneof") - proto.RegisterType((*Real)(nil), "jsonpb.Real") + proto.RegisterEnum("jsonpb_test.Widget_Color", Widget_Color_name, Widget_Color_value) + proto.RegisterType((*Simple)(nil), "jsonpb_test.Simple") + proto.RegisterType((*NonFinites)(nil), "jsonpb_test.NonFinites") + proto.RegisterType((*Repeats)(nil), "jsonpb_test.Repeats") + proto.RegisterType((*Widget)(nil), "jsonpb_test.Widget") + proto.RegisterType((*Maps)(nil), "jsonpb_test.Maps") + proto.RegisterMapType((map[bool]*Simple)(nil), "jsonpb_test.Maps.MBoolSimpleEntry") + proto.RegisterMapType((map[int64]string)(nil), "jsonpb_test.Maps.MInt64StrEntry") + proto.RegisterType((*MsgWithOneof)(nil), "jsonpb_test.MsgWithOneof") + proto.RegisterType((*Real)(nil), "jsonpb_test.Real") proto.RegisterExtension(E_Complex_RealExtension) - proto.RegisterType((*Complex)(nil), "jsonpb.Complex") - proto.RegisterType((*KnownTypes)(nil), "jsonpb.KnownTypes") - proto.RegisterType((*MsgWithRequired)(nil), "jsonpb.MsgWithRequired") - proto.RegisterType((*MsgWithIndirectRequired)(nil), "jsonpb.MsgWithIndirectRequired") - proto.RegisterMapType((map[string]*MsgWithRequired)(nil), "jsonpb.MsgWithIndirectRequired.MapFieldEntry") - proto.RegisterType((*MsgWithRequiredBytes)(nil), "jsonpb.MsgWithRequiredBytes") - proto.RegisterType((*MsgWithRequiredWKT)(nil), "jsonpb.MsgWithRequiredWKT") + proto.RegisterType((*Complex)(nil), "jsonpb_test.Complex") + proto.RegisterType((*KnownTypes)(nil), "jsonpb_test.KnownTypes") + proto.RegisterType((*MsgWithRequired)(nil), "jsonpb_test.MsgWithRequired") + proto.RegisterType((*MsgWithIndirectRequired)(nil), "jsonpb_test.MsgWithIndirectRequired") + proto.RegisterMapType((map[string]*MsgWithRequired)(nil), "jsonpb_test.MsgWithIndirectRequired.MapFieldEntry") + proto.RegisterType((*MsgWithRequiredBytes)(nil), "jsonpb_test.MsgWithRequiredBytes") + proto.RegisterType((*MsgWithRequiredWKT)(nil), "jsonpb_test.MsgWithRequiredWKT") proto.RegisterExtension(E_Name) proto.RegisterExtension(E_Extm) } -func init() { - proto.RegisterFile("jsonpb_test_proto/test_objects.proto", fileDescriptor_6b3d96f97365f06c) -} - -var fileDescriptor_6b3d96f97365f06c = []byte{ - // 1504 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0xdd, 0x72, 0xdb, 0xb8, - 0x15, 0x36, 0x49, 0x51, 0x12, 0x8f, 0xfc, 0x17, 0xc4, 0x49, 0x64, 0x37, 0x4d, 0x39, 0x4a, 0x9a, - 0xaa, 0x49, 0x2d, 0x4f, 0x65, 0x8d, 0x26, 0x75, 0x72, 0x13, 0xc7, 0x4e, 0x93, 0x26, 0x71, 0x3b, - 0xb0, 0xd3, 0xcc, 0xf4, 0x46, 0x43, 0x99, 0x94, 0xcc, 0x94, 0x24, 0x54, 0x00, 0xb2, 0xa3, 0xe9, - 0xee, 0x8c, 0x9f, 0x61, 0x67, 0x9f, 0x60, 0x2f, 0xf6, 0x76, 0xef, 0xf6, 0x62, 0xdf, 0x62, 0xdf, - 0x68, 0x07, 0x07, 0xa0, 0x7e, 0xad, 0xd9, 0xbd, 0xb2, 0x80, 0xef, 0x07, 0x20, 0xce, 0xc7, 0x03, - 0x1a, 0x1e, 0x7d, 0x16, 0x2c, 0x1b, 0x74, 0x3b, 0x32, 0x12, 0xb2, 0x33, 0xe0, 0x4c, 0xb2, 0x3d, - 0xfc, 0xc9, 0xba, 0x9f, 0xa3, 0x73, 0x29, 0x1a, 0x38, 0x45, 0x8a, 0x9a, 0xb5, 0xb3, 0xdd, 0x67, - 0xac, 0x9f, 0x44, 0x7b, 0x38, 0xdb, 0x1d, 0xf6, 0xf6, 0x82, 0x6c, 0xa4, 0x29, 0x3b, 0x0f, 0xe6, - 0xa1, 0x70, 0xc8, 0x03, 0x19, 0xb3, 0xcc, 0xe0, 0xf7, 0xe7, 0x71, 0x21, 0xf9, 0xf0, 0x5c, 0x1a, - 0xf4, 0x0f, 0xf3, 0xa8, 0x8c, 0xd3, 0x48, 0xc8, 0x20, 0x1d, 0x2c, 0xb3, 0xbf, 0xe2, 0xc1, 0x60, - 0x10, 0x71, 0xb3, 0xc3, 0xda, 0x0f, 0x05, 0x28, 0x9e, 0xc6, 0xe9, 0x20, 0x89, 0xc8, 0x1d, 0x28, - 0xb2, 0x4e, 0x97, 0xb1, 0xa4, 0x6a, 0xf9, 0x56, 0xbd, 0x4c, 0x5d, 0x76, 0xc8, 0x58, 0x42, 0xee, - 0x41, 0x89, 0x75, 0xe2, 0x4c, 0xee, 0x37, 0xab, 0xb6, 0x6f, 0xd5, 0x5d, 0x5a, 0x64, 0x6f, 0xd5, - 0x88, 0x3c, 0x80, 0x8a, 0x01, 0x3a, 0x42, 0xf2, 0xaa, 0x83, 0xa0, 0xa7, 0xc1, 0x53, 0xc9, 0xc7, - 0xc2, 0x76, 0xab, 0x5a, 0xf0, 0xad, 0xba, 0xa3, 0x85, 0xed, 0xd6, 0x58, 0xd8, 0x6e, 0xa1, 0xd0, - 0x45, 0xd0, 0xd3, 0xa0, 0x12, 0x6e, 0x43, 0x99, 0x75, 0x86, 0x7a, 0xc9, 0xa2, 0x6f, 0xd5, 0xd7, - 0x68, 0x89, 0x7d, 0xc4, 0x21, 0xf1, 0x61, 0x35, 0x87, 0x50, 0x5b, 0x42, 0x18, 0x0c, 0x3c, 0x23, - 0x6e, 0xb7, 0xaa, 0x65, 0xdf, 0xaa, 0x17, 0x8c, 0xb8, 0xdd, 0x9a, 0x88, 0xcd, 0xc2, 0x1e, 0xc2, - 0x60, 0xe0, 0xb1, 0x58, 0xe8, 0x95, 0xc1, 0xb7, 0xea, 0xb7, 0x68, 0x89, 0x9d, 0x4e, 0xad, 0x2c, - 0x26, 0x2b, 0x57, 0x10, 0x06, 0x03, 0xcf, 0x88, 0xdb, 0xad, 0xea, 0xaa, 0x6f, 0xd5, 0x89, 0x11, - 0xe7, 0x2b, 0x8b, 0xc9, 0xca, 0x6b, 0x08, 0x83, 0x81, 0xc7, 0x87, 0xd5, 0x4b, 0x58, 0x20, 0xab, - 0xeb, 0xbe, 0x55, 0xb7, 0x69, 0x91, 0xbd, 0x56, 0x23, 0x7d, 0x58, 0x08, 0xa0, 0x72, 0x03, 0x41, - 0x4f, 0x83, 0xe3, 0x55, 0x43, 0x36, 0xec, 0x26, 0x51, 0x75, 0xd3, 0xb7, 0xea, 0x16, 0x2d, 0xb1, - 0x23, 0x1c, 0xea, 0x55, 0x35, 0x84, 0xda, 0x5b, 0x08, 0x83, 0x81, 0x27, 0x5b, 0x96, 0x3c, 0xce, - 0xfa, 0x55, 0xe2, 0x5b, 0x75, 0x4f, 0x6d, 0x19, 0x87, 0x7a, 0x43, 0xdd, 0x91, 0x8c, 0x44, 0xf5, - 0xb6, 0x6f, 0xd5, 0x57, 0x69, 0x91, 0x1d, 0xaa, 0x51, 0xed, 0x1b, 0x0b, 0xe0, 0x84, 0x65, 0xaf, - 0xe3, 0x2c, 0x96, 0x91, 0x20, 0xb7, 0xc1, 0xed, 0x75, 0xb2, 0x20, 0xc3, 0xd0, 0xd8, 0xb4, 0xd0, - 0x3b, 0x09, 0x32, 0x15, 0xa5, 0x5e, 0x67, 0x10, 0x67, 0x3d, 0x8c, 0x8c, 0x4d, 0xdd, 0xde, 0xbf, - 0xe2, 0xac, 0xa7, 0xa7, 0x33, 0x35, 0xed, 0x98, 0xe9, 0x13, 0x35, 0x7d, 0x1b, 0xdc, 0x10, 0x2d, - 0x0a, 0xb8, 0xc1, 0x42, 0x68, 0x2c, 0x42, 0x6d, 0xe1, 0xe2, 0xac, 0x1b, 0xe6, 0x16, 0xa1, 0xb6, - 0x28, 0x9a, 0x69, 0x65, 0x51, 0xfb, 0xde, 0x86, 0x12, 0x8d, 0x06, 0x51, 0x20, 0x85, 0xa2, 0xf0, - 0x3c, 0xc7, 0x8e, 0xca, 0x31, 0xcf, 0x73, 0xcc, 0xc7, 0x39, 0x76, 0x54, 0x8e, 0xb9, 0xce, 0x71, - 0x0e, 0xb4, 0x5b, 0x55, 0xc7, 0x77, 0x54, 0x4e, 0xb9, 0xce, 0xe9, 0x36, 0x94, 0x79, 0x9e, 0xc3, - 0x82, 0xef, 0xa8, 0x1c, 0x72, 0x93, 0xc3, 0x31, 0xd4, 0x6e, 0x55, 0x5d, 0xdf, 0x51, 0x29, 0xe3, - 0x26, 0x65, 0x08, 0x89, 0x3c, 0xbd, 0x8e, 0xca, 0x10, 0x3f, 0x9d, 0x52, 0x99, 0x84, 0x94, 0x7c, - 0x47, 0x25, 0x84, 0x9b, 0x84, 0xe0, 0x26, 0x74, 0xfd, 0xcb, 0xbe, 0xa3, 0xea, 0xcf, 0x75, 0xfd, - 0x51, 0x63, 0xea, 0xeb, 0xf9, 0x8e, 0xaa, 0x2f, 0x37, 0xf5, 0xd5, 0x76, 0xba, 0x7a, 0xe0, 0x3b, - 0xaa, 0x7a, 0x7c, 0x52, 0x3d, 0x6e, 0xaa, 0x57, 0xf1, 0x1d, 0x55, 0x3d, 0xae, 0xab, 0xf7, 0xa3, - 0x0d, 0xc5, 0x4f, 0x71, 0xd8, 0x8f, 0x24, 0x79, 0x02, 0xee, 0x39, 0x4b, 0x18, 0xc7, 0xca, 0xad, - 0x37, 0xb7, 0x1a, 0xba, 0x59, 0x35, 0x34, 0xdc, 0x78, 0xa5, 0x30, 0xaa, 0x29, 0x64, 0x57, 0xf9, - 0x69, 0xb6, 0x3a, 0xbc, 0x65, 0xec, 0x22, 0xc7, 0xbf, 0xe4, 0x31, 0x14, 0x05, 0x36, 0x15, 0x7c, - 0x8b, 0x2a, 0xcd, 0xf5, 0x9c, 0xad, 0x5b, 0x0d, 0x35, 0x28, 0xf9, 0xb3, 0x3e, 0x10, 0x64, 0xaa, - 0x7d, 0x2e, 0x32, 0xd5, 0x01, 0x19, 0x6a, 0x89, 0xeb, 0x02, 0x57, 0xb7, 0xd0, 0x73, 0x23, 0x67, - 0x9a, 0xba, 0xd3, 0x1c, 0x27, 0x7f, 0x01, 0x8f, 0x77, 0x72, 0xf2, 0x1d, 0xb4, 0x5d, 0x20, 0x97, - 0xb9, 0xf9, 0x55, 0xfb, 0x23, 0xb8, 0x7a, 0xd3, 0x25, 0x70, 0xe8, 0xf1, 0xd1, 0xe6, 0x0a, 0xf1, - 0xc0, 0xfd, 0x3b, 0x3d, 0x3e, 0x3e, 0xd9, 0xb4, 0x48, 0x19, 0x0a, 0x87, 0xef, 0x3f, 0x1e, 0x6f, - 0xda, 0xb5, 0x6f, 0x6d, 0x28, 0x7c, 0x08, 0x06, 0x82, 0x3c, 0x87, 0x4a, 0x3a, 0xd5, 0xbd, 0x2c, - 0xf4, 0xff, 0x5d, 0xee, 0xaf, 0x28, 0x8d, 0x0f, 0x79, 0x2b, 0x3b, 0xce, 0x24, 0x1f, 0x51, 0x2f, - 0x1d, 0xb7, 0xb6, 0x97, 0xb0, 0x96, 0x62, 0x36, 0xf3, 0xa7, 0xb6, 0x51, 0xfe, 0xfb, 0x59, 0xb9, - 0xca, 0xab, 0x7e, 0x6c, 0x6d, 0x50, 0x49, 0x27, 0x33, 0x3b, 0x2f, 0x60, 0x7d, 0xd6, 0x9f, 0x6c, - 0x82, 0xf3, 0xdf, 0x68, 0x84, 0x65, 0x74, 0xa8, 0xfa, 0x49, 0xb6, 0xc0, 0xbd, 0x0c, 0x92, 0x61, - 0x84, 0xaf, 0x9f, 0x47, 0xf5, 0xe0, 0xc0, 0x7e, 0x66, 0xed, 0x9c, 0xc0, 0xe6, 0xbc, 0xfd, 0xb4, - 0xbe, 0xac, 0xf5, 0x8f, 0xa6, 0xf5, 0x8b, 0x45, 0x99, 0xf8, 0xd5, 0x7e, 0xb6, 0x60, 0xf5, 0x83, - 0xe8, 0x7f, 0x8a, 0xe5, 0xc5, 0x3f, 0xb3, 0x88, 0xf5, 0xc8, 0x5d, 0x70, 0x65, 0x2c, 0x93, 0x08, - 0xed, 0xbc, 0x37, 0x2b, 0x54, 0x0f, 0x49, 0x15, 0x8a, 0x22, 0x48, 0x02, 0x3e, 0x42, 0x4f, 0xe7, - 0xcd, 0x0a, 0x35, 0x63, 0xb2, 0x03, 0xa5, 0x57, 0x6c, 0xa8, 0x76, 0x82, 0x6d, 0x41, 0x69, 0xf2, - 0x09, 0xf2, 0x10, 0x56, 0x2f, 0x58, 0x1a, 0x75, 0x82, 0x30, 0xe4, 0x91, 0x10, 0xd8, 0x21, 0x14, - 0xa1, 0xa2, 0x66, 0x5f, 0xea, 0x49, 0x72, 0x0c, 0xb7, 0x52, 0xd1, 0xef, 0x5c, 0xc5, 0xf2, 0xa2, - 0xc3, 0xa3, 0xff, 0x0d, 0x63, 0x1e, 0x85, 0xd8, 0x35, 0x2a, 0xcd, 0x7b, 0xe3, 0x83, 0xd5, 0x7b, - 0xa4, 0x06, 0x7e, 0xb3, 0x42, 0x37, 0xd2, 0xd9, 0xa9, 0xc3, 0x12, 0xb8, 0xc3, 0x2c, 0x66, 0x59, - 0xed, 0x31, 0x14, 0x68, 0x14, 0x24, 0x93, 0x53, 0xb4, 0x74, 0xab, 0xc1, 0xc1, 0x93, 0x72, 0x39, - 0xdc, 0xbc, 0xbe, 0xbe, 0xbe, 0xb6, 0x6b, 0x57, 0x6a, 0xe3, 0xea, 0x40, 0xbe, 0x90, 0xfb, 0xe0, - 0xc5, 0x69, 0xd0, 0x8f, 0x33, 0xf5, 0x80, 0x9a, 0x3e, 0x99, 0x98, 0x48, 0x9a, 0x47, 0xb0, 0xce, - 0xa3, 0x20, 0xe9, 0x44, 0x5f, 0x64, 0x94, 0x89, 0x98, 0x65, 0x64, 0x75, 0x92, 0xcc, 0x20, 0xa9, - 0xfe, 0x7f, 0x36, 0xda, 0xc6, 0x9e, 0xae, 0x29, 0xd1, 0x71, 0xae, 0xa9, 0xfd, 0xe4, 0x02, 0xbc, - 0xcb, 0xd8, 0x55, 0x76, 0x36, 0x1a, 0x44, 0x82, 0x3c, 0x02, 0x3b, 0xc8, 0xf0, 0xda, 0xa8, 0x34, - 0xb7, 0x1a, 0xfa, 0xc2, 0x6f, 0xe4, 0x17, 0x7e, 0xe3, 0x65, 0x36, 0xa2, 0x76, 0x90, 0x91, 0xa7, - 0xe0, 0x84, 0x43, 0xfd, 0xb2, 0x57, 0x9a, 0xdb, 0x0b, 0xb4, 0x23, 0xf3, 0xd9, 0x41, 0x15, 0x8b, - 0xfc, 0x09, 0x6c, 0x21, 0xf1, 0x16, 0x53, 0x67, 0x38, 0xcf, 0x3d, 0xc5, 0x4f, 0x10, 0x6a, 0x0b, - 0xd5, 0x44, 0x6c, 0x29, 0x4c, 0x4c, 0x76, 0x16, 0x88, 0x67, 0xf9, 0xd7, 0x08, 0xb5, 0xa5, 0x50, - 0xdc, 0xe4, 0x12, 0x6f, 0xb0, 0x9b, 0xb8, 0xef, 0x63, 0x21, 0xff, 0xad, 0x4e, 0x98, 0xda, 0xc9, - 0x25, 0xa9, 0x83, 0x73, 0x19, 0x24, 0x78, 0xa3, 0x55, 0x9a, 0x77, 0x17, 0xc8, 0x9a, 0xa8, 0x28, - 0xa4, 0x01, 0x4e, 0xd8, 0x4d, 0x30, 0x3a, 0x95, 0xe6, 0xfd, 0xc5, 0xe7, 0xc2, 0x5e, 0x69, 0xf8, - 0x61, 0x37, 0x21, 0xbb, 0xe0, 0xf4, 0x12, 0x89, 0x49, 0x52, 0xef, 0xed, 0x3c, 0x1f, 0xbb, 0xae, - 0xa1, 0xf7, 0x12, 0xa9, 0xe8, 0x31, 0x36, 0xf9, 0x9b, 0xe9, 0xf8, 0x26, 0x1a, 0x7a, 0xdc, 0x6e, - 0xa9, 0xdd, 0x0c, 0xdb, 0x2d, 0xbc, 0x9c, 0x6e, 0xda, 0xcd, 0xc7, 0x69, 0xfe, 0xb0, 0xdd, 0x42, - 0xfb, 0xfd, 0x26, 0x7e, 0xc7, 0x2c, 0xb1, 0xdf, 0x6f, 0xe6, 0xf6, 0xfb, 0x4d, 0xb4, 0xdf, 0x6f, - 0xe2, 0x87, 0xcd, 0x32, 0xfb, 0x31, 0x7f, 0x88, 0xfc, 0x02, 0xde, 0x84, 0xde, 0x92, 0x43, 0x57, - 0xad, 0x40, 0xd3, 0x91, 0xa7, 0xfc, 0x55, 0x53, 0x83, 0x25, 0xfe, 0xfa, 0x76, 0x31, 0xfe, 0x42, - 0x72, 0xf2, 0x57, 0x70, 0xf3, 0x5b, 0xe6, 0xe6, 0x07, 0xc0, 0x5b, 0x47, 0x0b, 0x34, 0xb3, 0xf6, - 0x10, 0x36, 0xe6, 0x5e, 0x46, 0xd5, 0x80, 0x74, 0x2b, 0xb5, 0xeb, 0x1e, 0xfa, 0xd6, 0xbe, 0xb3, - 0xe1, 0x9e, 0x61, 0xbd, 0xcd, 0xc2, 0x98, 0x47, 0xe7, 0x72, 0xcc, 0x7e, 0x0a, 0x05, 0x31, 0xec, - 0xa6, 0x26, 0xc9, 0xcb, 0xde, 0x70, 0x8a, 0x24, 0xf2, 0x0f, 0xf0, 0xd2, 0x60, 0xd0, 0xe9, 0xc5, - 0x51, 0x12, 0x9a, 0x66, 0xbb, 0x3b, 0xa7, 0x98, 0x5f, 0x40, 0x35, 0xe1, 0xd7, 0x8a, 0xaf, 0x9b, - 0x6f, 0x39, 0x35, 0x43, 0xf2, 0x0c, 0x2a, 0x22, 0x89, 0xcf, 0x23, 0xe3, 0xe6, 0xa0, 0xdb, 0xd2, - 0xf5, 0x01, 0xb9, 0xa8, 0xdc, 0x39, 0x83, 0xb5, 0x19, 0xd3, 0xe9, 0x96, 0xeb, 0xe9, 0x96, 0xbb, - 0x3b, 0xdb, 0x72, 0x97, 0xda, 0x4e, 0xf5, 0xde, 0x27, 0xb0, 0x35, 0x87, 0xe2, 0x69, 0x13, 0x02, - 0x85, 0xee, 0x48, 0x0a, 0x3c, 0xcf, 0x55, 0x8a, 0xbf, 0x6b, 0x47, 0x40, 0xe6, 0xb8, 0x9f, 0xde, - 0x9d, 0xe5, 0xe5, 0x56, 0xc4, 0xdf, 0x52, 0xee, 0x03, 0x1f, 0x0a, 0x59, 0x90, 0x46, 0x73, 0x4d, - 0xeb, 0x2b, 0x7c, 0x0a, 0x44, 0x0e, 0xfe, 0x06, 0x85, 0xe8, 0x8b, 0x4c, 0xe7, 0x18, 0x5f, 0xff, - 0x4a, 0xa9, 0x94, 0xe4, 0xf0, 0xc5, 0x7f, 0x0e, 0xfa, 0xb1, 0xbc, 0x18, 0x76, 0x1b, 0xe7, 0x2c, - 0xdd, 0xeb, 0xb3, 0x24, 0xc8, 0xfa, 0x93, 0xff, 0x5b, 0xb4, 0x74, 0x6f, 0xe1, 0xdf, 0xae, 0xe7, - 0x7a, 0xe6, 0x97, 0x00, 0x00, 0x00, 0xff, 0xff, 0x66, 0xc2, 0xb5, 0xb6, 0x91, 0x0d, 0x00, 0x00, +func init() { proto.RegisterFile("jsonpb_proto/test2.proto", fileDescriptor_50cab1d8463dea41) } + +var fileDescriptor_50cab1d8463dea41 = []byte{ + // 1510 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0xdd, 0x6e, 0xdb, 0x46, + 0x16, 0x36, 0x49, 0x51, 0x12, 0x8f, 0x6c, 0xc7, 0x1e, 0x3b, 0x09, 0xed, 0x0d, 0xb2, 0x84, 0xb2, + 0xd9, 0xd5, 0x26, 0x58, 0x79, 0x43, 0x0b, 0x42, 0x91, 0x36, 0x40, 0xe3, 0xd8, 0x6e, 0xd2, 0x24, + 0x4e, 0x41, 0x27, 0x0d, 0xda, 0x1b, 0x81, 0x32, 0x29, 0x99, 0x2d, 0xc9, 0x51, 0x67, 0x46, 0x4e, + 0x84, 0xb6, 0x80, 0xfb, 0x0a, 0x7d, 0x85, 0x02, 0xbd, 0xed, 0x5d, 0x2f, 0xfa, 0x1c, 0x45, 0x9f, + 0xa7, 0x98, 0x33, 0x43, 0xfd, 0x59, 0x36, 0x72, 0x65, 0xcd, 0x7c, 0x3f, 0x33, 0x9c, 0xf3, 0xf1, + 0x0c, 0x0d, 0xee, 0x37, 0x9c, 0xe6, 0x83, 0x6e, 0x67, 0xc0, 0xa8, 0xa0, 0x3b, 0x22, 0xe6, 0xc2, + 0x6f, 0xe2, 0x6f, 0x52, 0xd3, 0x88, 0x9c, 0xdb, 0xde, 0xea, 0x53, 0xda, 0x4f, 0xe3, 0x1d, 0x84, + 0xba, 0xc3, 0xde, 0x4e, 0x98, 0x8f, 0x14, 0x6f, 0xfb, 0xf6, 0x3c, 0x14, 0x0d, 0x59, 0x28, 0x12, + 0x9a, 0x6b, 0xfc, 0xd6, 0x3c, 0xce, 0x05, 0x1b, 0x9e, 0x08, 0x8d, 0xfe, 0x73, 0x1e, 0x15, 0x49, + 0x16, 0x73, 0x11, 0x66, 0x83, 0xcb, 0xec, 0xdf, 0xb1, 0x70, 0x30, 0x88, 0x19, 0x57, 0x78, 0xfd, + 0xb7, 0x12, 0x94, 0x8f, 0x93, 0x6c, 0x90, 0xc6, 0xe4, 0x3a, 0x94, 0x69, 0xa7, 0x4b, 0x69, 0xea, + 0x1a, 0x9e, 0xd1, 0xa8, 0x06, 0x36, 0xdd, 0xa3, 0x34, 0x25, 0x37, 0xa1, 0x42, 0x3b, 0x49, 0x2e, + 0x76, 0x7d, 0xd7, 0xf4, 0x8c, 0x86, 0x1d, 0x94, 0xe9, 0x33, 0x39, 0x22, 0xb7, 0xa1, 0xa6, 0x81, + 0x0e, 0x17, 0xcc, 0xb5, 0x10, 0x74, 0x14, 0x78, 0x2c, 0xd8, 0x58, 0xd8, 0x6e, 0xb9, 0x25, 0xcf, + 0x68, 0x58, 0x4a, 0xd8, 0x6e, 0x8d, 0x85, 0xed, 0x16, 0x0a, 0x6d, 0x04, 0x1d, 0x05, 0x4a, 0xe1, + 0x16, 0x54, 0x69, 0x67, 0xa8, 0x96, 0x2c, 0x7b, 0x46, 0x63, 0x25, 0xa8, 0xd0, 0x37, 0x38, 0x24, + 0x1e, 0x2c, 0x17, 0x10, 0x6a, 0x2b, 0x08, 0x83, 0x86, 0x67, 0xc4, 0xed, 0x96, 0x5b, 0xf5, 0x8c, + 0x46, 0x49, 0x8b, 0xdb, 0xad, 0x89, 0x58, 0x2f, 0xec, 0x20, 0x0c, 0x1a, 0x1e, 0x8b, 0xb9, 0x5a, + 0x19, 0x3c, 0xa3, 0xb1, 0x1e, 0x54, 0xe8, 0xf1, 0xd4, 0xca, 0x7c, 0xb2, 0x72, 0x0d, 0x61, 0xd0, + 0xf0, 0x8c, 0xb8, 0xdd, 0x72, 0x97, 0x3d, 0xa3, 0x41, 0xb4, 0xb8, 0x58, 0x99, 0x4f, 0x56, 0x5e, + 0x41, 0x18, 0x34, 0x3c, 0x3e, 0xac, 0x5e, 0x4a, 0x43, 0xe1, 0xae, 0x7a, 0x46, 0xc3, 0x0c, 0xca, + 0xf4, 0x50, 0x8e, 0xd4, 0x61, 0x21, 0x80, 0xca, 0x6b, 0x08, 0x3a, 0x0a, 0x1c, 0xaf, 0x1a, 0xd1, + 0x61, 0x37, 0x8d, 0xdd, 0x35, 0xcf, 0x68, 0x18, 0x41, 0x85, 0xee, 0xe3, 0x50, 0xad, 0xaa, 0x20, + 0xd4, 0xae, 0x23, 0x0c, 0x1a, 0x9e, 0x6c, 0x59, 0xb0, 0x24, 0xef, 0xbb, 0xc4, 0x33, 0x1a, 0x8e, + 0xdc, 0x32, 0x0e, 0xd5, 0x86, 0xba, 0x23, 0x11, 0x73, 0x77, 0xc3, 0x33, 0x1a, 0xcb, 0x41, 0x99, + 0xee, 0xc9, 0x51, 0xfd, 0x67, 0x03, 0xe0, 0x88, 0xe6, 0x87, 0x49, 0x9e, 0x88, 0x98, 0x93, 0x0d, + 0xb0, 0x7b, 0x9d, 0x3c, 0xcc, 0x31, 0x34, 0x66, 0x50, 0xea, 0x1d, 0x85, 0xb9, 0x8c, 0x52, 0xaf, + 0x33, 0x48, 0xf2, 0x1e, 0x46, 0xc6, 0x0c, 0xec, 0xde, 0x17, 0x49, 0xde, 0x53, 0xd3, 0xb9, 0x9c, + 0xb6, 0xf4, 0xf4, 0x91, 0x9c, 0xde, 0x00, 0x3b, 0x42, 0x8b, 0x12, 0x6e, 0xb0, 0x14, 0x69, 0x8b, + 0x48, 0x59, 0xd8, 0x38, 0x6b, 0x47, 0x85, 0x45, 0xa4, 0x2c, 0xca, 0x7a, 0x5a, 0x5a, 0xd4, 0x7f, + 0x35, 0xa1, 0x12, 0xc4, 0x83, 0x38, 0x14, 0x5c, 0x52, 0x58, 0x91, 0x63, 0x4b, 0xe6, 0x98, 0x15, + 0x39, 0x66, 0xe3, 0x1c, 0x5b, 0x32, 0xc7, 0x4c, 0xe5, 0xb8, 0x00, 0xda, 0x2d, 0xd7, 0xf2, 0x2c, + 0x99, 0x53, 0xa6, 0x72, 0xba, 0x05, 0x55, 0x56, 0xe4, 0xb0, 0xe4, 0x59, 0x32, 0x87, 0x4c, 0xe7, + 0x70, 0x0c, 0xb5, 0x5b, 0xae, 0xed, 0x59, 0x32, 0x65, 0x4c, 0xa7, 0x0c, 0x21, 0x5e, 0xa4, 0xd7, + 0x92, 0x19, 0x62, 0xc7, 0x53, 0x2a, 0x9d, 0x90, 0x8a, 0x67, 0xc9, 0x84, 0x30, 0x9d, 0x10, 0xdc, + 0x84, 0xaa, 0x7f, 0xd5, 0xb3, 0x64, 0xfd, 0x99, 0xaa, 0x3f, 0x6a, 0x74, 0x7d, 0x1d, 0xcf, 0x92, + 0xf5, 0x65, 0xba, 0xbe, 0xca, 0x4e, 0x55, 0x0f, 0x3c, 0x4b, 0x56, 0x8f, 0x4d, 0xaa, 0xc7, 0x74, + 0xf5, 0x6a, 0x9e, 0x25, 0xab, 0xc7, 0x54, 0xf5, 0xfe, 0x34, 0xa1, 0xfc, 0x36, 0x89, 0xfa, 0xb1, + 0x20, 0x3b, 0x60, 0x9f, 0xd0, 0x94, 0x32, 0xac, 0xdc, 0xaa, 0xbf, 0xd5, 0x9c, 0xea, 0x58, 0x4d, + 0xc5, 0x69, 0x3e, 0x91, 0x84, 0x40, 0xf1, 0x88, 0x2f, 0x4d, 0x95, 0x44, 0x9e, 0xe0, 0x95, 0x92, + 0x32, 0xc3, 0xbf, 0xe4, 0x3e, 0x94, 0x39, 0xb6, 0x17, 0x7c, 0x9f, 0x6a, 0xfe, 0xc6, 0x8c, 0x44, + 0x75, 0x9e, 0x40, 0x53, 0x48, 0x53, 0x9d, 0x0f, 0xd2, 0xe5, 0xb6, 0x2f, 0xa1, 0xcb, 0x43, 0xd3, + 0xfc, 0x0a, 0x53, 0x45, 0x77, 0x37, 0xd1, 0x7d, 0x73, 0x86, 0xae, 0x03, 0x11, 0x14, 0x24, 0xf2, + 0x00, 0x1c, 0xd6, 0x29, 0x14, 0xd7, 0x71, 0x81, 0xc5, 0x8a, 0x2a, 0xd3, 0xbf, 0xea, 0x77, 0xc1, + 0x56, 0x0f, 0x52, 0x01, 0x2b, 0x38, 0xd8, 0x5f, 0x5b, 0x22, 0x0e, 0xd8, 0x9f, 0x05, 0x07, 0x07, + 0x47, 0x6b, 0x06, 0xa9, 0x42, 0x69, 0xef, 0xc5, 0x9b, 0x83, 0x35, 0xb3, 0xfe, 0x8b, 0x09, 0xa5, + 0x97, 0xe1, 0x80, 0x93, 0x4f, 0xa1, 0x96, 0x4d, 0xf5, 0x36, 0x03, 0x17, 0xf1, 0x66, 0x16, 0x91, + 0xbc, 0xe6, 0xcb, 0xa2, 0xdb, 0x1d, 0xe4, 0x82, 0x8d, 0x02, 0x27, 0x1b, 0x77, 0xbf, 0x43, 0x58, + 0xc9, 0x30, 0xbe, 0xc5, 0x49, 0x98, 0xe8, 0x51, 0x5f, 0xe0, 0x21, 0x73, 0xad, 0x8e, 0x42, 0xb9, + 0xd4, 0xb2, 0xc9, 0xcc, 0xf6, 0x27, 0xb0, 0x3a, 0xbb, 0x08, 0x59, 0x03, 0xeb, 0xdb, 0x78, 0x84, + 0xe5, 0xb6, 0x02, 0xf9, 0x93, 0x6c, 0x82, 0x7d, 0x16, 0xa6, 0xc3, 0x18, 0x5f, 0x53, 0x27, 0x50, + 0x83, 0x87, 0xe6, 0x47, 0xc6, 0xf6, 0x31, 0xac, 0xcd, 0xdb, 0x4f, 0xeb, 0xab, 0x4a, 0xff, 0xdf, + 0x69, 0xfd, 0x25, 0xd5, 0x9a, 0x98, 0xd6, 0xff, 0x32, 0x60, 0xf9, 0x25, 0xef, 0xbf, 0x4d, 0xc4, + 0xe9, 0xab, 0x3c, 0xa6, 0x3d, 0x72, 0x03, 0x6c, 0x91, 0x88, 0x34, 0x46, 0x4f, 0xe7, 0xe9, 0x52, + 0xa0, 0x86, 0xc4, 0x85, 0x32, 0x0f, 0xd3, 0x90, 0x8d, 0xd0, 0xd8, 0x7a, 0xba, 0x14, 0xe8, 0x31, + 0xd9, 0x86, 0xca, 0x13, 0x3a, 0x94, 0xdb, 0xc1, 0x1e, 0x22, 0x35, 0xc5, 0x04, 0xb9, 0x03, 0xcb, + 0xa7, 0x34, 0x8b, 0x3b, 0x61, 0x14, 0xb1, 0x98, 0x73, 0x6c, 0x27, 0x92, 0x50, 0x93, 0xb3, 0x8f, + 0xd5, 0x24, 0xf9, 0x1c, 0xd6, 0x33, 0xde, 0xef, 0xbc, 0x4b, 0xc4, 0x69, 0x87, 0xc5, 0xdf, 0x0d, + 0x13, 0x16, 0x47, 0xd8, 0x62, 0x6a, 0xfe, 0xad, 0xd9, 0x23, 0x56, 0x1b, 0x0d, 0x34, 0xe7, 0xe9, + 0x52, 0x70, 0x2d, 0x9b, 0x9d, 0xda, 0xab, 0x80, 0x3d, 0xcc, 0x13, 0x9a, 0xd7, 0xff, 0x0d, 0xa5, + 0x20, 0x0e, 0xd3, 0xc9, 0x79, 0x1a, 0xaa, 0x39, 0xe1, 0xe0, 0x5e, 0xb5, 0x1a, 0xad, 0x9d, 0x9f, + 0x9f, 0x9f, 0x9b, 0xf5, 0x9f, 0x0c, 0xb9, 0x7d, 0x79, 0x2c, 0xef, 0xc9, 0x2d, 0x70, 0x92, 0x2c, + 0xec, 0x27, 0xb9, 0x7c, 0x4c, 0xc5, 0x9f, 0x4c, 0x4c, 0x34, 0xfe, 0x11, 0xac, 0xb2, 0x38, 0x4c, + 0x3b, 0xf1, 0x7b, 0x11, 0xe7, 0x3c, 0xa1, 0x39, 0x59, 0x9f, 0xcb, 0x6c, 0x98, 0xba, 0xdf, 0x2f, + 0x88, 0xbf, 0x5e, 0x28, 0x58, 0x91, 0xf2, 0x83, 0x42, 0x5d, 0xff, 0xc3, 0x06, 0x78, 0x9e, 0xd3, + 0x77, 0xf9, 0xeb, 0xd1, 0x20, 0xe6, 0xe4, 0x5f, 0x60, 0x86, 0x39, 0xde, 0x39, 0x52, 0xaf, 0xbe, + 0x16, 0x9a, 0xc5, 0xd7, 0x42, 0xf3, 0x71, 0x3e, 0x0a, 0xcc, 0x30, 0x27, 0xf7, 0xc1, 0x8a, 0x86, + 0xaa, 0x53, 0xd4, 0xfc, 0xad, 0x0b, 0xb4, 0x7d, 0xfd, 0xcd, 0x12, 0x48, 0x16, 0xf9, 0x0f, 0x98, + 0x5c, 0xe0, 0x15, 0x58, 0xf3, 0x6f, 0x5e, 0xe0, 0x1e, 0xe3, 0xf7, 0x4b, 0x60, 0x72, 0x41, 0xee, + 0x81, 0x29, 0xb8, 0xce, 0xce, 0xf6, 0x05, 0xe2, 0xeb, 0xe2, 0x53, 0x26, 0x30, 0x05, 0x97, 0xdc, + 0xf4, 0x0c, 0xaf, 0xbf, 0x45, 0xdc, 0x17, 0x09, 0x17, 0x5f, 0xca, 0xc3, 0x0e, 0xcc, 0xf4, 0x8c, + 0x34, 0xc0, 0x3a, 0x0b, 0x53, 0xbc, 0x0e, 0x6b, 0xfe, 0x8d, 0x0b, 0x64, 0x45, 0x94, 0x14, 0xd2, + 0x04, 0x2b, 0xea, 0xa6, 0x18, 0x25, 0x59, 0xff, 0x0b, 0xcf, 0x85, 0x8d, 0x56, 0xf3, 0xa3, 0x6e, + 0x4a, 0xfe, 0x07, 0x56, 0x2f, 0x15, 0x98, 0xac, 0x9a, 0xff, 0x8f, 0x0b, 0x7c, 0x6c, 0xd9, 0x9a, + 0xde, 0x4b, 0x85, 0xa4, 0x27, 0x78, 0x43, 0x2c, 0xa6, 0xe3, 0xeb, 0xa9, 0xe9, 0x49, 0xbb, 0x25, + 0x77, 0x33, 0x6c, 0xb7, 0xf0, 0x66, 0x5b, 0xb4, 0x9b, 0x37, 0xd3, 0xfc, 0x61, 0xbb, 0x85, 0xf6, + 0xbb, 0x3e, 0x7e, 0x04, 0x5d, 0x62, 0xbf, 0xeb, 0x17, 0xf6, 0xbb, 0x3e, 0xda, 0xef, 0xfa, 0xf8, + 0x55, 0x74, 0x99, 0xfd, 0x98, 0x3f, 0x44, 0x7e, 0x09, 0xaf, 0x51, 0xe7, 0x92, 0x43, 0x97, 0xfd, + 0x41, 0xd1, 0x91, 0x27, 0xfd, 0x65, 0xcf, 0x83, 0x4b, 0xfc, 0xd5, 0xd5, 0xa4, 0xfd, 0xb9, 0x60, + 0xe4, 0x01, 0xd8, 0xc5, 0x15, 0xb5, 0xf8, 0x01, 0xf0, 0xca, 0x52, 0x02, 0xc5, 0xac, 0xdf, 0x81, + 0x6b, 0x73, 0xef, 0xa5, 0xec, 0x4a, 0xaa, 0xd3, 0x9a, 0x0d, 0x07, 0x7d, 0xeb, 0xbf, 0x9b, 0x70, + 0x53, 0xb3, 0x9e, 0xe5, 0x51, 0xc2, 0xe2, 0x13, 0x31, 0x66, 0xff, 0x1f, 0x4a, 0x7c, 0xd8, 0xcd, + 0x74, 0x92, 0xaf, 0x7c, 0xe3, 0x03, 0x64, 0x92, 0x57, 0xe0, 0x64, 0xe1, 0xa0, 0xd3, 0x4b, 0xe2, + 0x34, 0xd2, 0xbd, 0xd8, 0x5f, 0x24, 0x9b, 0x5f, 0x4a, 0xf6, 0xe8, 0x43, 0x29, 0x52, 0xbd, 0xb9, + 0x9a, 0xe9, 0x21, 0x79, 0x04, 0x35, 0x9e, 0x26, 0x27, 0xb1, 0xb6, 0xb4, 0xd0, 0xf2, 0xea, 0x9d, + 0x00, 0x0a, 0x50, 0xbe, 0xfd, 0x15, 0xac, 0xcc, 0x38, 0x4f, 0xb7, 0x65, 0x47, 0xb5, 0x65, 0x7f, + 0xb6, 0x2d, 0x5f, 0xed, 0x3d, 0xd5, 0x9f, 0xef, 0xc1, 0xe6, 0x1c, 0x8a, 0x15, 0x20, 0x04, 0x4a, + 0xdd, 0x91, 0xe0, 0x78, 0xc6, 0xcb, 0x01, 0xfe, 0xae, 0xef, 0x03, 0x99, 0xe3, 0xbe, 0x7d, 0xfe, + 0xba, 0x88, 0x80, 0x24, 0x7e, 0x48, 0x04, 0x1e, 0xde, 0x85, 0x52, 0x1e, 0x66, 0xf1, 0xa2, 0x96, + 0xf6, 0x03, 0x3e, 0x0f, 0xc2, 0x0f, 0x9f, 0x40, 0x29, 0x7e, 0x2f, 0xb2, 0x45, 0xb4, 0x1f, 0x3f, + 0xa4, 0x90, 0x52, 0xbc, 0xf7, 0xe8, 0xeb, 0x8f, 0xfb, 0x89, 0x38, 0x1d, 0x76, 0x9b, 0x27, 0x34, + 0xdb, 0xe9, 0xd3, 0x34, 0xcc, 0xfb, 0x93, 0xff, 0x8b, 0x92, 0x5c, 0xc4, 0x2c, 0x0f, 0x53, 0xfc, + 0x27, 0x0e, 0x67, 0xf9, 0xce, 0xf4, 0x3f, 0x77, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xba, 0x6b, + 0x0b, 0xa0, 0xeb, 0x0d, 0x00, 0x00, } diff --git a/jsonpb/jsonpb_test_proto/test_objects.proto b/internal/testprotos/jsonpb_proto/test2.proto similarity index 67% rename from jsonpb/jsonpb_test_proto/test_objects.proto rename to internal/testprotos/jsonpb_proto/test2.proto index 943303ed7c..d34dc33d6b 100644 --- a/jsonpb/jsonpb_test_proto/test_objects.proto +++ b/internal/testprotos/jsonpb_proto/test2.proto @@ -1,37 +1,10 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2015 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 2015 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. syntax = "proto2"; -option go_package = "github.com/golang/protobuf/jsonpb/jsonpb_test_proto;jsonpb"; +option go_package = "github.com/golang/protobuf/internal/testprotos/jsonpb_proto"; import "google/protobuf/any.proto"; import "google/protobuf/duration.proto"; @@ -39,7 +12,7 @@ import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; -package jsonpb; +package jsonpb_test; // Test message for holding primitive types. message Simple { diff --git a/jsonpb/jsonpb_test_proto/more_test_objects.pb.go b/internal/testprotos/jsonpb_proto/test3.pb.go similarity index 65% rename from jsonpb/jsonpb_test_proto/more_test_objects.pb.go rename to internal/testprotos/jsonpb_proto/test3.pb.go index bfc473bcf2..cb9a814112 100644 --- a/jsonpb/jsonpb_test_proto/more_test_objects.pb.go +++ b/internal/testprotos/jsonpb_proto/test3.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: jsonpb_test_proto/more_test_objects.proto +// source: jsonpb_proto/test3.proto -package jsonpb +package jsonpb_proto import ( fmt "fmt" @@ -45,7 +45,7 @@ func (x Numeral) String() string { } func (Numeral) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_59defc22c5ce96e7, []int{0} + return fileDescriptor_813baf511b225405, []int{0} } type Simple3 struct { @@ -59,7 +59,7 @@ func (m *Simple3) Reset() { *m = Simple3{} } func (m *Simple3) String() string { return proto.CompactTextString(m) } func (*Simple3) ProtoMessage() {} func (*Simple3) Descriptor() ([]byte, []int) { - return fileDescriptor_59defc22c5ce96e7, []int{0} + return fileDescriptor_813baf511b225405, []int{0} } func (m *Simple3) XXX_Unmarshal(b []byte) error { @@ -98,7 +98,7 @@ func (m *SimpleSlice3) Reset() { *m = SimpleSlice3{} } func (m *SimpleSlice3) String() string { return proto.CompactTextString(m) } func (*SimpleSlice3) ProtoMessage() {} func (*SimpleSlice3) Descriptor() ([]byte, []int) { - return fileDescriptor_59defc22c5ce96e7, []int{1} + return fileDescriptor_813baf511b225405, []int{1} } func (m *SimpleSlice3) XXX_Unmarshal(b []byte) error { @@ -137,7 +137,7 @@ func (m *SimpleMap3) Reset() { *m = SimpleMap3{} } func (m *SimpleMap3) String() string { return proto.CompactTextString(m) } func (*SimpleMap3) ProtoMessage() {} func (*SimpleMap3) Descriptor() ([]byte, []int) { - return fileDescriptor_59defc22c5ce96e7, []int{2} + return fileDescriptor_813baf511b225405, []int{2} } func (m *SimpleMap3) XXX_Unmarshal(b []byte) error { @@ -176,7 +176,7 @@ func (m *SimpleNull3) Reset() { *m = SimpleNull3{} } func (m *SimpleNull3) String() string { return proto.CompactTextString(m) } func (*SimpleNull3) ProtoMessage() {} func (*SimpleNull3) Descriptor() ([]byte, []int) { - return fileDescriptor_59defc22c5ce96e7, []int{3} + return fileDescriptor_813baf511b225405, []int{3} } func (m *SimpleNull3) XXX_Unmarshal(b []byte) error { @@ -210,7 +210,7 @@ type Mappy struct { Objjy map[int32]*Simple3 `protobuf:"bytes,3,rep,name=objjy,proto3" json:"objjy,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Buggy map[int64]string `protobuf:"bytes,4,rep,name=buggy,proto3" json:"buggy,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Booly map[bool]bool `protobuf:"bytes,5,rep,name=booly,proto3" json:"booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - Enumy map[string]Numeral `protobuf:"bytes,6,rep,name=enumy,proto3" json:"enumy,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=jsonpb.Numeral"` + Enumy map[string]Numeral `protobuf:"bytes,6,rep,name=enumy,proto3" json:"enumy,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=jsonpb_test.Numeral"` S32Booly map[int32]bool `protobuf:"bytes,7,rep,name=s32booly,proto3" json:"s32booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` S64Booly map[int64]bool `protobuf:"bytes,8,rep,name=s64booly,proto3" json:"s64booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` U32Booly map[uint32]bool `protobuf:"bytes,9,rep,name=u32booly,proto3" json:"u32booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` @@ -224,7 +224,7 @@ func (m *Mappy) Reset() { *m = Mappy{} } func (m *Mappy) String() string { return proto.CompactTextString(m) } func (*Mappy) ProtoMessage() {} func (*Mappy) Descriptor() ([]byte, []int) { - return fileDescriptor_59defc22c5ce96e7, []int{4} + return fileDescriptor_813baf511b225405, []int{4} } func (m *Mappy) XXX_Unmarshal(b []byte) error { @@ -316,65 +316,63 @@ func (m *Mappy) GetU64Booly() map[uint64]bool { } func init() { - proto.RegisterEnum("jsonpb.Numeral", Numeral_name, Numeral_value) - proto.RegisterType((*Simple3)(nil), "jsonpb.Simple3") - proto.RegisterType((*SimpleSlice3)(nil), "jsonpb.SimpleSlice3") - proto.RegisterType((*SimpleMap3)(nil), "jsonpb.SimpleMap3") - proto.RegisterMapType((map[string]string)(nil), "jsonpb.SimpleMap3.StringyEntry") - proto.RegisterType((*SimpleNull3)(nil), "jsonpb.SimpleNull3") - proto.RegisterType((*Mappy)(nil), "jsonpb.Mappy") - proto.RegisterMapType((map[bool]bool)(nil), "jsonpb.Mappy.BoolyEntry") - proto.RegisterMapType((map[int64]string)(nil), "jsonpb.Mappy.BuggyEntry") - proto.RegisterMapType((map[string]Numeral)(nil), "jsonpb.Mappy.EnumyEntry") - proto.RegisterMapType((map[int64]int32)(nil), "jsonpb.Mappy.NummyEntry") - proto.RegisterMapType((map[int32]*Simple3)(nil), "jsonpb.Mappy.ObjjyEntry") - proto.RegisterMapType((map[int32]bool)(nil), "jsonpb.Mappy.S32boolyEntry") - proto.RegisterMapType((map[int64]bool)(nil), "jsonpb.Mappy.S64boolyEntry") - proto.RegisterMapType((map[string]string)(nil), "jsonpb.Mappy.StrryEntry") - proto.RegisterMapType((map[uint32]bool)(nil), "jsonpb.Mappy.U32boolyEntry") - proto.RegisterMapType((map[uint64]bool)(nil), "jsonpb.Mappy.U64boolyEntry") -} - -func init() { - proto.RegisterFile("jsonpb_test_proto/more_test_objects.proto", fileDescriptor_59defc22c5ce96e7) -} - -var fileDescriptor_59defc22c5ce96e7 = []byte{ - // 567 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0xdf, 0x8b, 0xd3, 0x4e, - 0x14, 0xc5, 0xbf, 0x69, 0x37, 0x69, 0x7b, 0xbb, 0xfb, 0xb5, 0x0c, 0x22, 0xa1, 0xfb, 0xe0, 0x12, - 0x50, 0x57, 0xc1, 0x04, 0x1a, 0x59, 0xd7, 0xae, 0x2f, 0xad, 0xec, 0xc3, 0x22, 0x4d, 0x21, 0xa5, - 0x08, 0xbe, 0x2c, 0x49, 0x8d, 0xb1, 0x35, 0xc9, 0x84, 0x24, 0x23, 0xe4, 0xd9, 0xbf, 0x5b, 0x90, - 0xf9, 0x91, 0x4d, 0x52, 0xa7, 0x54, 0xdf, 0xe6, 0xce, 0xf9, 0x9c, 0xdc, 0x33, 0x33, 0x97, 0x16, - 0x5e, 0xee, 0x72, 0x9c, 0xa4, 0xfe, 0x7d, 0x11, 0xe4, 0xc5, 0x7d, 0x9a, 0xe1, 0x02, 0x5b, 0x31, - 0xce, 0x02, 0x5e, 0x63, 0x7f, 0x17, 0x6c, 0x8a, 0xdc, 0x64, 0xfb, 0x48, 0xe3, 0xa8, 0x71, 0x0e, - 0xbd, 0xd5, 0x36, 0x4e, 0xa3, 0xc0, 0x46, 0x23, 0xe8, 0x7e, 0x21, 0xbe, 0xae, 0x5c, 0x28, 0x97, - 0x8a, 0x4b, 0x97, 0xc6, 0x73, 0x38, 0xe5, 0xe2, 0x2a, 0xda, 0x6e, 0x02, 0x1b, 0x3d, 0x01, 0x2d, - 0xa7, 0xab, 0x5c, 0x57, 0x2e, 0xba, 0x97, 0x03, 0x57, 0x54, 0xc6, 0x4f, 0x05, 0x80, 0x83, 0x0b, - 0x2f, 0xb5, 0xd1, 0x3b, 0xe8, 0xe5, 0x45, 0xb6, 0x4d, 0xc2, 0x92, 0x71, 0xc3, 0xc9, 0x53, 0x93, - 0x77, 0x33, 0x6b, 0xc8, 0x5c, 0x71, 0xe2, 0x36, 0x29, 0xb2, 0xd2, 0xad, 0xf8, 0xf1, 0x14, 0x4e, - 0x9b, 0x02, 0xcd, 0xf4, 0x3d, 0x28, 0x59, 0xa6, 0x81, 0x4b, 0x97, 0xe8, 0x31, 0xa8, 0x3f, 0xbc, - 0x88, 0x04, 0x7a, 0x87, 0xed, 0xf1, 0x62, 0xda, 0xb9, 0x56, 0x8c, 0x2b, 0x18, 0xf2, 0xef, 0x3b, - 0x24, 0x8a, 0x6c, 0xf4, 0x02, 0xb4, 0x9c, 0x95, 0xcc, 0x3d, 0x9c, 0x3c, 0x6a, 0x87, 0xb0, 0x5d, - 0x21, 0x1b, 0xbf, 0xfa, 0xa0, 0x2e, 0xbc, 0x34, 0x2d, 0x91, 0x09, 0x6a, 0x42, 0xe2, 0xb8, 0x8a, - 0xad, 0x57, 0x0e, 0xa6, 0x9a, 0x0e, 0x95, 0x78, 0x5e, 0x8e, 0x51, 0x3e, 0x2f, 0xb2, 0xac, 0xd4, - 0x3b, 0x32, 0x7e, 0x45, 0x25, 0xc1, 0x33, 0x8c, 0xf2, 0xd8, 0xdf, 0xed, 0x4a, 0xbd, 0x2b, 0xe3, - 0x97, 0x54, 0x12, 0x3c, 0xc3, 0x28, 0xef, 0x93, 0x30, 0x2c, 0xf5, 0x13, 0x19, 0x3f, 0xa7, 0x92, - 0xe0, 0x19, 0xc6, 0x78, 0x8c, 0xa3, 0x52, 0x57, 0xa5, 0x3c, 0x95, 0x2a, 0x9e, 0xae, 0x29, 0x1f, - 0x24, 0x24, 0x2e, 0x75, 0x4d, 0xc6, 0xdf, 0x52, 0x49, 0xf0, 0x0c, 0x43, 0x6f, 0xa1, 0x9f, 0xdb, - 0x13, 0xde, 0xa2, 0xc7, 0x2c, 0xe7, 0x7b, 0x47, 0x16, 0x2a, 0x77, 0x3d, 0xc0, 0xcc, 0x78, 0xf5, - 0x86, 0x1b, 0xfb, 0x52, 0xa3, 0x50, 0x2b, 0xa3, 0x28, 0xa9, 0x91, 0x54, 0x1d, 0x07, 0x32, 0xe3, - 0xba, 0xdd, 0x91, 0x34, 0x3a, 0x92, 0xaa, 0x23, 0x48, 0x8d, 0xed, 0x8e, 0x15, 0x3c, 0xbe, 0x06, - 0xa8, 0x1f, 0xba, 0x39, 0x7f, 0x5d, 0xc9, 0xfc, 0xa9, 0x8d, 0xf9, 0xa3, 0xce, 0xfa, 0xc9, 0xff, - 0x65, 0x72, 0xc7, 0x77, 0x00, 0xf5, 0xe3, 0x37, 0x9d, 0x2a, 0x77, 0x3e, 0x6b, 0x3a, 0x25, 0x93, - 0xdc, 0x0e, 0x51, 0xcf, 0xc5, 0xb1, 0xf8, 0x83, 0x7d, 0xe7, 0xc3, 0x85, 0x34, 0x9d, 0x7d, 0x89, - 0xb3, 0xbf, 0x17, 0xbf, 0x9e, 0x15, 0xc9, 0xc1, 0x5b, 0xf1, 0xff, 0xaf, 0xe3, 0x3b, 0x24, 0x0e, - 0x32, 0x2f, 0x6a, 0x7e, 0xea, 0x06, 0xce, 0x5a, 0x33, 0x24, 0xb9, 0x8c, 0xc3, 0x39, 0xa8, 0xb9, - 0xf9, 0xaa, 0xc7, 0x8e, 0xbf, 0x6f, 0x5e, 0x1f, 0xea, 0x7c, 0xf6, 0x37, 0xe6, 0x43, 0x9d, 0x4f, - 0x8e, 0x98, 0x5f, 0xbd, 0x86, 0x9e, 0xb8, 0x09, 0x34, 0x84, 0xde, 0xda, 0xf9, 0xe8, 0x2c, 0x3f, - 0x39, 0xa3, 0xff, 0x10, 0x80, 0x36, 0x73, 0x67, 0xf3, 0xbb, 0x0f, 0x23, 0x05, 0x0d, 0x40, 0x75, - 0x97, 0x8b, 0x99, 0x33, 0xea, 0xcc, 0xdf, 0x7f, 0x9e, 0x86, 0xdb, 0xe2, 0x1b, 0xf1, 0xcd, 0x0d, - 0x8e, 0xad, 0x10, 0x47, 0x5e, 0x12, 0x5a, 0xec, 0x47, 0xdd, 0x27, 0x5f, 0x2d, 0x7e, 0xb5, 0xd6, - 0x1f, 0x7f, 0x04, 0x37, 0x7c, 0xc7, 0xd7, 0x58, 0x65, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xd5, - 0x45, 0xc4, 0x18, 0x2b, 0x06, 0x00, 0x00, + proto.RegisterEnum("jsonpb_test.Numeral", Numeral_name, Numeral_value) + proto.RegisterType((*Simple3)(nil), "jsonpb_test.Simple3") + proto.RegisterType((*SimpleSlice3)(nil), "jsonpb_test.SimpleSlice3") + proto.RegisterType((*SimpleMap3)(nil), "jsonpb_test.SimpleMap3") + proto.RegisterMapType((map[string]string)(nil), "jsonpb_test.SimpleMap3.StringyEntry") + proto.RegisterType((*SimpleNull3)(nil), "jsonpb_test.SimpleNull3") + proto.RegisterType((*Mappy)(nil), "jsonpb_test.Mappy") + proto.RegisterMapType((map[bool]bool)(nil), "jsonpb_test.Mappy.BoolyEntry") + proto.RegisterMapType((map[int64]string)(nil), "jsonpb_test.Mappy.BuggyEntry") + proto.RegisterMapType((map[string]Numeral)(nil), "jsonpb_test.Mappy.EnumyEntry") + proto.RegisterMapType((map[int64]int32)(nil), "jsonpb_test.Mappy.NummyEntry") + proto.RegisterMapType((map[int32]*Simple3)(nil), "jsonpb_test.Mappy.ObjjyEntry") + proto.RegisterMapType((map[int32]bool)(nil), "jsonpb_test.Mappy.S32boolyEntry") + proto.RegisterMapType((map[int64]bool)(nil), "jsonpb_test.Mappy.S64boolyEntry") + proto.RegisterMapType((map[string]string)(nil), "jsonpb_test.Mappy.StrryEntry") + proto.RegisterMapType((map[uint32]bool)(nil), "jsonpb_test.Mappy.U32boolyEntry") + proto.RegisterMapType((map[uint64]bool)(nil), "jsonpb_test.Mappy.U64boolyEntry") +} + +func init() { proto.RegisterFile("jsonpb_proto/test3.proto", fileDescriptor_813baf511b225405) } + +var fileDescriptor_813baf511b225405 = []byte{ + // 563 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0xdd, 0x8a, 0xd3, 0x40, + 0x14, 0xc7, 0x4d, 0xbb, 0x69, 0x9b, 0xd3, 0x5d, 0x29, 0xc3, 0x22, 0xa1, 0x22, 0x94, 0x22, 0xb2, + 0x2c, 0x9a, 0x40, 0x23, 0xb2, 0x6c, 0x55, 0x68, 0x65, 0x2f, 0x44, 0x9a, 0x42, 0x4a, 0x11, 0xbc, + 0x91, 0x64, 0x8d, 0x31, 0x35, 0x5f, 0x24, 0x19, 0x21, 0x6f, 0xe0, 0x2b, 0xf9, 0x76, 0x32, 0x1f, + 0xd9, 0x4c, 0x4a, 0x86, 0xea, 0xd5, 0x9e, 0x99, 0xf3, 0xff, 0xe5, 0x7c, 0xec, 0xbf, 0x0c, 0xe8, + 0x87, 0x22, 0x4d, 0x32, 0xef, 0x6b, 0x96, 0xa7, 0x65, 0x6a, 0x96, 0x7e, 0x51, 0x5a, 0x06, 0x8d, + 0xd1, 0x98, 0x67, 0xc8, 0xdd, 0xfc, 0x29, 0x0c, 0x77, 0x61, 0x9c, 0x45, 0xbe, 0x85, 0x26, 0xd0, + 0xff, 0x86, 0x3d, 0x5d, 0x99, 0x29, 0x57, 0x8a, 0x43, 0xc2, 0xf9, 0x0b, 0x38, 0x67, 0xc9, 0x5d, + 0x14, 0xde, 0xfb, 0x16, 0x7a, 0x02, 0x83, 0x82, 0x44, 0x85, 0xae, 0xcc, 0xfa, 0x57, 0x9a, 0xc3, + 0x4f, 0xf3, 0xdf, 0x0a, 0x00, 0x13, 0x6e, 0xdc, 0xcc, 0x42, 0xef, 0x61, 0x58, 0x94, 0x79, 0x98, + 0x04, 0x15, 0xd5, 0x8d, 0x17, 0xcf, 0x0d, 0xa1, 0xa4, 0xd1, 0x28, 0x8d, 0x1d, 0x93, 0xdd, 0x25, + 0x65, 0x5e, 0x39, 0x35, 0x34, 0xbd, 0x85, 0x73, 0x31, 0x41, 0x1a, 0xfb, 0xe9, 0x57, 0xb4, 0x31, + 0xcd, 0x21, 0x21, 0xba, 0x04, 0xf5, 0x97, 0x1b, 0x61, 0x5f, 0xef, 0xd1, 0x3b, 0x76, 0xb8, 0xed, + 0xdd, 0x28, 0xf3, 0x25, 0x8c, 0xd9, 0xf7, 0x6d, 0x1c, 0x45, 0x16, 0x7a, 0x09, 0x83, 0x82, 0x1e, + 0x29, 0x3d, 0x5e, 0x5c, 0x76, 0x74, 0x62, 0x39, 0x5c, 0x33, 0xff, 0xa3, 0x81, 0xba, 0x71, 0xb3, + 0xac, 0x42, 0x16, 0xa8, 0x09, 0x8e, 0xe3, 0x7a, 0x80, 0x67, 0x2d, 0x8c, 0x4a, 0x0c, 0x9b, 0xe4, + 0x59, 0xe7, 0x4c, 0x4b, 0xa0, 0xa2, 0xcc, 0xf3, 0x4a, 0xef, 0x49, 0xa1, 0x1d, 0xc9, 0x73, 0x88, + 0x6a, 0x09, 0x94, 0x7a, 0x87, 0x43, 0xa5, 0xf7, 0xa5, 0xd0, 0x96, 0xe4, 0x39, 0x44, 0xb5, 0x04, + 0xf2, 0x70, 0x10, 0x54, 0xfa, 0x99, 0x14, 0x5a, 0x93, 0x3c, 0x87, 0xa8, 0x96, 0x42, 0x69, 0x1a, + 0x55, 0xba, 0x2a, 0x87, 0x48, 0xbe, 0x86, 0x48, 0x4c, 0x20, 0x3f, 0xc1, 0x71, 0xa5, 0x0f, 0xa4, + 0xd0, 0x1d, 0xc9, 0x73, 0x88, 0x6a, 0xd1, 0x5b, 0x18, 0x15, 0xd6, 0x82, 0x15, 0x1b, 0x52, 0x6e, + 0xd6, 0xb5, 0x0b, 0x2e, 0x61, 0xe8, 0x03, 0x41, 0xe9, 0x37, 0xaf, 0x19, 0x3d, 0x92, 0xd3, 0x5c, + 0x52, 0xd3, 0xfc, 0x48, 0x68, 0x5c, 0xd7, 0xd6, 0xa4, 0xf4, 0xbe, 0x5d, 0x1b, 0x0b, 0xb5, 0x71, + 0x5d, 0x1b, 0xe4, 0x74, 0xbb, 0x76, 0x4d, 0x4c, 0x6f, 0x00, 0x1a, 0x57, 0x88, 0xb6, 0xed, 0x77, + 0xd8, 0x56, 0x15, 0x6c, 0x4b, 0xc8, 0xc6, 0x1a, 0xff, 0x63, 0xf8, 0xa9, 0x0d, 0xd0, 0xf8, 0x43, + 0x24, 0x55, 0x46, 0x5e, 0x8b, 0xa4, 0xec, 0x07, 0xd0, 0xee, 0xa4, 0xb1, 0xce, 0xa9, 0x19, 0xb4, + 0x63, 0xf2, 0x61, 0x2b, 0x22, 0x39, 0xea, 0x20, 0x47, 0x47, 0x33, 0x34, 0x26, 0xea, 0x98, 0xbe, + 0x35, 0xc3, 0xe3, 0xa3, 0x19, 0x6c, 0x1c, 0xfb, 0xb9, 0x1b, 0x89, 0xdf, 0x5b, 0xc2, 0x45, 0xcb, + 0x5c, 0x1d, 0x6b, 0x91, 0x37, 0x43, 0x60, 0xf1, 0xff, 0x7b, 0x6a, 0x07, 0xc7, 0xf0, 0x5e, 0x56, + 0xf9, 0xe2, 0x5f, 0x60, 0x59, 0xe5, 0xb3, 0x13, 0xf0, 0xf5, 0x2b, 0x18, 0xf2, 0x4d, 0xa0, 0x31, + 0x0c, 0xf7, 0xf6, 0x27, 0x7b, 0xfb, 0xd9, 0x9e, 0x3c, 0x42, 0x00, 0x83, 0x95, 0xb3, 0x5a, 0x7f, + 0xfc, 0x30, 0x51, 0x90, 0x06, 0xaa, 0xb3, 0xdd, 0xac, 0xec, 0x49, 0x6f, 0xfd, 0xee, 0xcb, 0x32, + 0x08, 0xcb, 0x1f, 0xd8, 0x33, 0xee, 0xd3, 0xd8, 0x0c, 0xd2, 0xc8, 0x4d, 0x02, 0x93, 0xbe, 0x0f, + 0x1e, 0xfe, 0x6e, 0x86, 0x49, 0xe9, 0xe7, 0x89, 0x1b, 0xd1, 0x77, 0x83, 0xde, 0x16, 0xa6, 0xf8, + 0x9e, 0x78, 0x03, 0xfa, 0xc7, 0xfa, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x7c, 0xda, 0x44, 0x24, 0x66, + 0x06, 0x00, 0x00, } diff --git a/internal/testprotos/jsonpb_proto/test3.proto b/internal/testprotos/jsonpb_proto/test3.proto new file mode 100644 index 0000000000..dbeb2b589c --- /dev/null +++ b/internal/testprotos/jsonpb_proto/test3.proto @@ -0,0 +1,44 @@ +// Copyright 2015 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. + +syntax = "proto3"; + +option go_package = "github.com/golang/protobuf/internal/testprotos/jsonpb_proto"; + +package jsonpb_test; + +message Simple3 { + double dub = 1; +} + +message SimpleSlice3 { + repeated string slices = 1; +} + +message SimpleMap3 { + map stringy = 1; +} + +message SimpleNull3 { + Simple3 simple = 1; +} + +enum Numeral { + UNKNOWN = 0; + ARABIC = 1; + ROMAN = 2; +} + +message Mappy { + map nummy = 1; + map strry = 2; + map objjy = 3; + map buggy = 4; + map booly = 5; + map enumy = 6; + map s32booly = 7; + map s64booly = 8; + map u32booly = 9; + map u64booly = 10; +} diff --git a/proto/test_proto/test.pb.go b/internal/testprotos/proto2_proto/test.pb.go similarity index 68% rename from proto/test_proto/test.pb.go rename to internal/testprotos/proto2_proto/test.pb.go index 624e834a45..cd202f971f 100644 --- a/proto/test_proto/test.pb.go +++ b/internal/testprotos/proto2_proto/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: test_proto/test.proto +// source: proto2_proto/test.proto -package test_proto +package proto2_proto import ( fmt "fmt" @@ -54,7 +54,7 @@ func (x *FOO) UnmarshalJSON(data []byte) error { } func (FOO) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{0} + return fileDescriptor_e5b3e7ca68f98362, []int{0} } // An enum, for completeness. @@ -132,7 +132,7 @@ func (x *GoTest_KIND) UnmarshalJSON(data []byte) error { } func (GoTest_KIND) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{2, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{2, 0} } type MyMessage_Color int32 @@ -175,7 +175,7 @@ func (x *MyMessage_Color) UnmarshalJSON(data []byte) error { } func (MyMessage_Color) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{13, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{13, 0} } type DefaultsMessage_DefaultsEnum int32 @@ -218,7 +218,7 @@ func (x *DefaultsMessage_DefaultsEnum) UnmarshalJSON(data []byte) error { } func (DefaultsMessage_DefaultsEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{16, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{16, 0} } type Defaults_Color int32 @@ -261,7 +261,7 @@ func (x *Defaults_Color) UnmarshalJSON(data []byte) error { } func (Defaults_Color) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{21, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{20, 0} } type RepeatedEnum_Color int32 @@ -298,11 +298,11 @@ func (x *RepeatedEnum_Color) UnmarshalJSON(data []byte) error { } func (RepeatedEnum_Color) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{23, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{22, 0} } type GoEnum struct { - Foo *FOO `protobuf:"varint,1,req,name=foo,enum=test_proto.FOO" json:"foo,omitempty"` + Foo *FOO `protobuf:"varint,1,req,name=foo,enum=proto2_test.FOO" json:"foo,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -312,7 +312,7 @@ func (m *GoEnum) Reset() { *m = GoEnum{} } func (m *GoEnum) String() string { return proto.CompactTextString(m) } func (*GoEnum) ProtoMessage() {} func (*GoEnum) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{0} + return fileDescriptor_e5b3e7ca68f98362, []int{0} } func (m *GoEnum) XXX_Unmarshal(b []byte) error { @@ -352,7 +352,7 @@ func (m *GoTestField) Reset() { *m = GoTestField{} } func (m *GoTestField) String() string { return proto.CompactTextString(m) } func (*GoTestField) ProtoMessage() {} func (*GoTestField) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{1} + return fileDescriptor_e5b3e7ca68f98362, []int{1} } func (m *GoTestField) XXX_Unmarshal(b []byte) error { @@ -389,7 +389,7 @@ func (m *GoTestField) GetType() string { type GoTest struct { // Some typical parameters - Kind *GoTest_KIND `protobuf:"varint,1,req,name=Kind,enum=test_proto.GoTest_KIND" json:"Kind,omitempty"` + Kind *GoTest_KIND `protobuf:"varint,1,req,name=Kind,enum=proto2_test.GoTest_KIND" json:"Kind,omitempty"` Table *string `protobuf:"bytes,2,opt,name=Table" json:"Table,omitempty"` Param *int32 `protobuf:"varint,3,opt,name=Param" json:"Param,omitempty"` // Required, repeated and optional foreign fields. @@ -486,7 +486,7 @@ func (m *GoTest) Reset() { *m = GoTest{} } func (m *GoTest) String() string { return proto.CompactTextString(m) } func (*GoTest) ProtoMessage() {} func (*GoTest) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{2} + return fileDescriptor_e5b3e7ca68f98362, []int{2} } func (m *GoTest) XXX_Unmarshal(b []byte) error { @@ -1111,7 +1111,7 @@ func (m *GoTest_RequiredGroup) Reset() { *m = GoTest_RequiredGroup{} } func (m *GoTest_RequiredGroup) String() string { return proto.CompactTextString(m) } func (*GoTest_RequiredGroup) ProtoMessage() {} func (*GoTest_RequiredGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{2, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{2, 0} } func (m *GoTest_RequiredGroup) XXX_Unmarshal(b []byte) error { @@ -1150,7 +1150,7 @@ func (m *GoTest_RepeatedGroup) Reset() { *m = GoTest_RepeatedGroup{} } func (m *GoTest_RepeatedGroup) String() string { return proto.CompactTextString(m) } func (*GoTest_RepeatedGroup) ProtoMessage() {} func (*GoTest_RepeatedGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{2, 1} + return fileDescriptor_e5b3e7ca68f98362, []int{2, 1} } func (m *GoTest_RepeatedGroup) XXX_Unmarshal(b []byte) error { @@ -1189,7 +1189,7 @@ func (m *GoTest_OptionalGroup) Reset() { *m = GoTest_OptionalGroup{} } func (m *GoTest_OptionalGroup) String() string { return proto.CompactTextString(m) } func (*GoTest_OptionalGroup) ProtoMessage() {} func (*GoTest_OptionalGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{2, 2} + return fileDescriptor_e5b3e7ca68f98362, []int{2, 2} } func (m *GoTest_OptionalGroup) XXX_Unmarshal(b []byte) error { @@ -1229,7 +1229,7 @@ func (m *GoTestRequiredGroupField) Reset() { *m = GoTestRequiredGroupFie func (m *GoTestRequiredGroupField) String() string { return proto.CompactTextString(m) } func (*GoTestRequiredGroupField) ProtoMessage() {} func (*GoTestRequiredGroupField) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{3} + return fileDescriptor_e5b3e7ca68f98362, []int{3} } func (m *GoTestRequiredGroupField) XXX_Unmarshal(b []byte) error { @@ -1268,7 +1268,7 @@ func (m *GoTestRequiredGroupField_Group) Reset() { *m = GoTestRequiredGr func (m *GoTestRequiredGroupField_Group) String() string { return proto.CompactTextString(m) } func (*GoTestRequiredGroupField_Group) ProtoMessage() {} func (*GoTestRequiredGroupField_Group) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{3, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{3, 0} } func (m *GoTestRequiredGroupField_Group) XXX_Unmarshal(b []byte) error { @@ -1314,7 +1314,7 @@ func (m *GoSkipTest) Reset() { *m = GoSkipTest{} } func (m *GoSkipTest) String() string { return proto.CompactTextString(m) } func (*GoSkipTest) ProtoMessage() {} func (*GoSkipTest) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{4} + return fileDescriptor_e5b3e7ca68f98362, []int{4} } func (m *GoSkipTest) XXX_Unmarshal(b []byte) error { @@ -1382,7 +1382,7 @@ func (m *GoSkipTest_SkipGroup) Reset() { *m = GoSkipTest_SkipGroup{} } func (m *GoSkipTest_SkipGroup) String() string { return proto.CompactTextString(m) } func (*GoSkipTest_SkipGroup) ProtoMessage() {} func (*GoSkipTest_SkipGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{4, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{4, 0} } func (m *GoSkipTest_SkipGroup) XXX_Unmarshal(b []byte) error { @@ -1430,7 +1430,7 @@ func (m *NonPackedTest) Reset() { *m = NonPackedTest{} } func (m *NonPackedTest) String() string { return proto.CompactTextString(m) } func (*NonPackedTest) ProtoMessage() {} func (*NonPackedTest) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{5} + return fileDescriptor_e5b3e7ca68f98362, []int{5} } func (m *NonPackedTest) XXX_Unmarshal(b []byte) error { @@ -1469,7 +1469,7 @@ func (m *PackedTest) Reset() { *m = PackedTest{} } func (m *PackedTest) String() string { return proto.CompactTextString(m) } func (*PackedTest) ProtoMessage() {} func (*PackedTest) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{6} + return fileDescriptor_e5b3e7ca68f98362, []int{6} } func (m *PackedTest) XXX_Unmarshal(b []byte) error { @@ -1509,7 +1509,7 @@ func (m *MaxTag) Reset() { *m = MaxTag{} } func (m *MaxTag) String() string { return proto.CompactTextString(m) } func (*MaxTag) ProtoMessage() {} func (*MaxTag) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{7} + return fileDescriptor_e5b3e7ca68f98362, []int{7} } func (m *MaxTag) XXX_Unmarshal(b []byte) error { @@ -1549,7 +1549,7 @@ func (m *OldMessage) Reset() { *m = OldMessage{} } func (m *OldMessage) String() string { return proto.CompactTextString(m) } func (*OldMessage) ProtoMessage() {} func (*OldMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{8} + return fileDescriptor_e5b3e7ca68f98362, []int{8} } func (m *OldMessage) XXX_Unmarshal(b []byte) error { @@ -1595,7 +1595,7 @@ func (m *OldMessage_Nested) Reset() { *m = OldMessage_Nested{} } func (m *OldMessage_Nested) String() string { return proto.CompactTextString(m) } func (*OldMessage_Nested) ProtoMessage() {} func (*OldMessage_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{8, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{8, 0} } func (m *OldMessage_Nested) XXX_Unmarshal(b []byte) error { @@ -1638,7 +1638,7 @@ func (m *NewMessage) Reset() { *m = NewMessage{} } func (m *NewMessage) String() string { return proto.CompactTextString(m) } func (*NewMessage) ProtoMessage() {} func (*NewMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{9} + return fileDescriptor_e5b3e7ca68f98362, []int{9} } func (m *NewMessage) XXX_Unmarshal(b []byte) error { @@ -1685,7 +1685,7 @@ func (m *NewMessage_Nested) Reset() { *m = NewMessage_Nested{} } func (m *NewMessage_Nested) String() string { return proto.CompactTextString(m) } func (*NewMessage_Nested) ProtoMessage() {} func (*NewMessage_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{9, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{9, 0} } func (m *NewMessage_Nested) XXX_Unmarshal(b []byte) error { @@ -1733,7 +1733,7 @@ func (m *InnerMessage) Reset() { *m = InnerMessage{} } func (m *InnerMessage) String() string { return proto.CompactTextString(m) } func (*InnerMessage) ProtoMessage() {} func (*InnerMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{10} + return fileDescriptor_e5b3e7ca68f98362, []int{10} } func (m *InnerMessage) XXX_Unmarshal(b []byte) error { @@ -1792,7 +1792,7 @@ func (m *OtherMessage) Reset() { *m = OtherMessage{} } func (m *OtherMessage) String() string { return proto.CompactTextString(m) } func (*OtherMessage) ProtoMessage() {} func (*OtherMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{11} + return fileDescriptor_e5b3e7ca68f98362, []int{11} } var extRange_OtherMessage = []proto.ExtensionRange{ @@ -1860,7 +1860,7 @@ func (m *RequiredInnerMessage) Reset() { *m = RequiredInnerMessage{} } func (m *RequiredInnerMessage) String() string { return proto.CompactTextString(m) } func (*RequiredInnerMessage) ProtoMessage() {} func (*RequiredInnerMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{12} + return fileDescriptor_e5b3e7ca68f98362, []int{12} } func (m *RequiredInnerMessage) XXX_Unmarshal(b []byte) error { @@ -1897,7 +1897,7 @@ type MyMessage struct { Others []*OtherMessage `protobuf:"bytes,6,rep,name=others" json:"others,omitempty"` WeMustGoDeeper *RequiredInnerMessage `protobuf:"bytes,13,opt,name=we_must_go_deeper,json=weMustGoDeeper" json:"we_must_go_deeper,omitempty"` RepInner []*InnerMessage `protobuf:"bytes,12,rep,name=rep_inner,json=repInner" json:"rep_inner,omitempty"` - Bikeshed *MyMessage_Color `protobuf:"varint,7,opt,name=bikeshed,enum=test_proto.MyMessage_Color" json:"bikeshed,omitempty"` + Bikeshed *MyMessage_Color `protobuf:"varint,7,opt,name=bikeshed,enum=proto2_test.MyMessage_Color" json:"bikeshed,omitempty"` Somegroup *MyMessage_SomeGroup `protobuf:"group,8,opt,name=SomeGroup,json=somegroup" json:"somegroup,omitempty"` // This field becomes [][]byte in the generated code. RepBytes [][]byte `protobuf:"bytes,10,rep,name=rep_bytes,json=repBytes" json:"rep_bytes,omitempty"` @@ -1912,7 +1912,7 @@ func (m *MyMessage) Reset() { *m = MyMessage{} } func (m *MyMessage) String() string { return proto.CompactTextString(m) } func (*MyMessage) ProtoMessage() {} func (*MyMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{13} + return fileDescriptor_e5b3e7ca68f98362, []int{13} } var extRange_MyMessage = []proto.ExtensionRange{ @@ -2036,7 +2036,7 @@ func (m *MyMessage_SomeGroup) Reset() { *m = MyMessage_SomeGroup{} } func (m *MyMessage_SomeGroup) String() string { return proto.CompactTextString(m) } func (*MyMessage_SomeGroup) ProtoMessage() {} func (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{13, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{13, 0} } func (m *MyMessage_SomeGroup) XXX_Unmarshal(b []byte) error { @@ -2076,7 +2076,7 @@ func (m *Ext) Reset() { *m = Ext{} } func (m *Ext) String() string { return proto.CompactTextString(m) } func (*Ext) ProtoMessage() {} func (*Ext) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{14} + return fileDescriptor_e5b3e7ca68f98362, []int{14} } func (m *Ext) XXX_Unmarshal(b []byte) error { @@ -2115,27 +2115,27 @@ var E_Ext_More = &proto.ExtensionDesc{ ExtendedType: (*MyMessage)(nil), ExtensionType: (*Ext)(nil), Field: 103, - Name: "test_proto.Ext.more", + Name: "proto2_test.Ext.more", Tag: "bytes,103,opt,name=more", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_Ext_Text = &proto.ExtensionDesc{ ExtendedType: (*MyMessage)(nil), ExtensionType: (*string)(nil), Field: 104, - Name: "test_proto.Ext.text", + Name: "proto2_test.Ext.text", Tag: "bytes,104,opt,name=text", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_Ext_Number = &proto.ExtensionDesc{ ExtendedType: (*MyMessage)(nil), ExtensionType: (*int32)(nil), Field: 105, - Name: "test_proto.Ext.number", + Name: "proto2_test.Ext.number", Tag: "varint,105,opt,name=number", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } type ComplexExtension struct { @@ -2151,7 +2151,7 @@ func (m *ComplexExtension) Reset() { *m = ComplexExtension{} } func (m *ComplexExtension) String() string { return proto.CompactTextString(m) } func (*ComplexExtension) ProtoMessage() {} func (*ComplexExtension) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{15} + return fileDescriptor_e5b3e7ca68f98362, []int{15} } func (m *ComplexExtension) XXX_Unmarshal(b []byte) error { @@ -2204,7 +2204,7 @@ func (m *DefaultsMessage) Reset() { *m = DefaultsMessage{} } func (m *DefaultsMessage) String() string { return proto.CompactTextString(m) } func (*DefaultsMessage) ProtoMessage() {} func (*DefaultsMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{16} + return fileDescriptor_e5b3e7ca68f98362, []int{16} } var extRange_DefaultsMessage = []proto.ExtensionRange{ @@ -2233,46 +2233,6 @@ func (m *DefaultsMessage) XXX_DiscardUnknown() { var xxx_messageInfo_DefaultsMessage proto.InternalMessageInfo -type MyMessageSet struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `protobuf_messageset:"1" json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MyMessageSet) Reset() { *m = MyMessageSet{} } -func (m *MyMessageSet) String() string { return proto.CompactTextString(m) } -func (*MyMessageSet) ProtoMessage() {} -func (*MyMessageSet) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{17} -} - -var extRange_MyMessageSet = []proto.ExtensionRange{ - {Start: 100, End: 2147483646}, -} - -func (*MyMessageSet) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_MyMessageSet -} - -func (m *MyMessageSet) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MyMessageSet.Unmarshal(m, b) -} -func (m *MyMessageSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MyMessageSet.Marshal(b, m, deterministic) -} -func (m *MyMessageSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_MyMessageSet.Merge(m, src) -} -func (m *MyMessageSet) XXX_Size() int { - return xxx_messageInfo_MyMessageSet.Size(m) -} -func (m *MyMessageSet) XXX_DiscardUnknown() { - xxx_messageInfo_MyMessageSet.DiscardUnknown(m) -} - -var xxx_messageInfo_MyMessageSet proto.InternalMessageInfo - type Empty struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -2283,7 +2243,7 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{18} + return fileDescriptor_e5b3e7ca68f98362, []int{17} } func (m *Empty) XXX_Unmarshal(b []byte) error { @@ -2315,7 +2275,7 @@ func (m *MessageList) Reset() { *m = MessageList{} } func (m *MessageList) String() string { return proto.CompactTextString(m) } func (*MessageList) ProtoMessage() {} func (*MessageList) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{19} + return fileDescriptor_e5b3e7ca68f98362, []int{18} } func (m *MessageList) XXX_Unmarshal(b []byte) error { @@ -2355,7 +2315,7 @@ func (m *MessageList_Message) Reset() { *m = MessageList_Message{} } func (m *MessageList_Message) String() string { return proto.CompactTextString(m) } func (*MessageList_Message) ProtoMessage() {} func (*MessageList_Message) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{19, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{18, 0} } func (m *MessageList_Message) XXX_Unmarshal(b []byte) error { @@ -2402,7 +2362,7 @@ func (m *Strings) Reset() { *m = Strings{} } func (m *Strings) String() string { return proto.CompactTextString(m) } func (*Strings) ProtoMessage() {} func (*Strings) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{20} + return fileDescriptor_e5b3e7ca68f98362, []int{19} } func (m *Strings) XXX_Unmarshal(b []byte) error { @@ -2453,7 +2413,7 @@ type Defaults struct { F_Bytes []byte `protobuf:"bytes,11,opt,name=F_Bytes,json=FBytes,def=Bignose" json:"F_Bytes,omitempty"` F_Sint32 *int32 `protobuf:"zigzag32,12,opt,name=F_Sint32,json=FSint32,def=-32" json:"F_Sint32,omitempty"` F_Sint64 *int64 `protobuf:"zigzag64,13,opt,name=F_Sint64,json=FSint64,def=-64" json:"F_Sint64,omitempty"` - F_Enum *Defaults_Color `protobuf:"varint,14,opt,name=F_Enum,json=FEnum,enum=test_proto.Defaults_Color,def=1" json:"F_Enum,omitempty"` + F_Enum *Defaults_Color `protobuf:"varint,14,opt,name=F_Enum,json=FEnum,enum=proto2_test.Defaults_Color,def=1" json:"F_Enum,omitempty"` // More fields with crazy defaults. F_Pinf *float32 `protobuf:"fixed32,15,opt,name=F_Pinf,json=FPinf,def=inf" json:"F_Pinf,omitempty"` F_Ninf *float32 `protobuf:"fixed32,16,opt,name=F_Ninf,json=FNinf,def=-inf" json:"F_Ninf,omitempty"` @@ -2471,7 +2431,7 @@ func (m *Defaults) Reset() { *m = Defaults{} } func (m *Defaults) String() string { return proto.CompactTextString(m) } func (*Defaults) ProtoMessage() {} func (*Defaults) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{21} + return fileDescriptor_e5b3e7ca68f98362, []int{20} } func (m *Defaults) XXX_Unmarshal(b []byte) error { @@ -2657,7 +2617,7 @@ func (m *SubDefaults) Reset() { *m = SubDefaults{} } func (m *SubDefaults) String() string { return proto.CompactTextString(m) } func (*SubDefaults) ProtoMessage() {} func (*SubDefaults) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{22} + return fileDescriptor_e5b3e7ca68f98362, []int{21} } func (m *SubDefaults) XXX_Unmarshal(b []byte) error { @@ -2688,7 +2648,7 @@ func (m *SubDefaults) GetN() int64 { } type RepeatedEnum struct { - Color []RepeatedEnum_Color `protobuf:"varint,1,rep,name=color,enum=test_proto.RepeatedEnum_Color" json:"color,omitempty"` + Color []RepeatedEnum_Color `protobuf:"varint,1,rep,name=color,enum=proto2_test.RepeatedEnum_Color" json:"color,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2698,7 +2658,7 @@ func (m *RepeatedEnum) Reset() { *m = RepeatedEnum{} } func (m *RepeatedEnum) String() string { return proto.CompactTextString(m) } func (*RepeatedEnum) ProtoMessage() {} func (*RepeatedEnum) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{23} + return fileDescriptor_e5b3e7ca68f98362, []int{22} } func (m *RepeatedEnum) XXX_Unmarshal(b []byte) error { @@ -2743,7 +2703,7 @@ func (m *MoreRepeated) Reset() { *m = MoreRepeated{} } func (m *MoreRepeated) String() string { return proto.CompactTextString(m) } func (*MoreRepeated) ProtoMessage() {} func (*MoreRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{24} + return fileDescriptor_e5b3e7ca68f98362, []int{23} } func (m *MoreRepeated) XXX_Unmarshal(b []byte) error { @@ -2824,7 +2784,7 @@ func (m *GroupOld) Reset() { *m = GroupOld{} } func (m *GroupOld) String() string { return proto.CompactTextString(m) } func (*GroupOld) ProtoMessage() {} func (*GroupOld) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{25} + return fileDescriptor_e5b3e7ca68f98362, []int{24} } func (m *GroupOld) XXX_Unmarshal(b []byte) error { @@ -2863,7 +2823,7 @@ func (m *GroupOld_G) Reset() { *m = GroupOld_G{} } func (m *GroupOld_G) String() string { return proto.CompactTextString(m) } func (*GroupOld_G) ProtoMessage() {} func (*GroupOld_G) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{25, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{24, 0} } func (m *GroupOld_G) XXX_Unmarshal(b []byte) error { @@ -2902,7 +2862,7 @@ func (m *GroupNew) Reset() { *m = GroupNew{} } func (m *GroupNew) String() string { return proto.CompactTextString(m) } func (*GroupNew) ProtoMessage() {} func (*GroupNew) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{26} + return fileDescriptor_e5b3e7ca68f98362, []int{25} } func (m *GroupNew) XXX_Unmarshal(b []byte) error { @@ -2942,7 +2902,7 @@ func (m *GroupNew_G) Reset() { *m = GroupNew_G{} } func (m *GroupNew_G) String() string { return proto.CompactTextString(m) } func (*GroupNew_G) ProtoMessage() {} func (*GroupNew_G) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{26, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{25, 0} } func (m *GroupNew_G) XXX_Unmarshal(b []byte) error { @@ -2989,7 +2949,7 @@ func (m *FloatingPoint) Reset() { *m = FloatingPoint{} } func (m *FloatingPoint) String() string { return proto.CompactTextString(m) } func (*FloatingPoint) ProtoMessage() {} func (*FloatingPoint) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{27} + return fileDescriptor_e5b3e7ca68f98362, []int{26} } func (m *FloatingPoint) XXX_Unmarshal(b []byte) error { @@ -3038,7 +2998,7 @@ func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } func (*MessageWithMap) ProtoMessage() {} func (*MessageWithMap) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{28} + return fileDescriptor_e5b3e7ca68f98362, []int{27} } func (m *MessageWithMap) XXX_Unmarshal(b []byte) error { @@ -3119,7 +3079,7 @@ func (m *Oneof) Reset() { *m = Oneof{} } func (m *Oneof) String() string { return proto.CompactTextString(m) } func (*Oneof) ProtoMessage() {} func (*Oneof) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{29} + return fileDescriptor_e5b3e7ca68f98362, []int{28} } func (m *Oneof) XXX_Unmarshal(b []byte) error { @@ -3197,7 +3157,7 @@ type Oneof_F_Sint64 struct { } type Oneof_F_Enum struct { - F_Enum MyMessage_Color `protobuf:"varint,14,opt,name=F_Enum,json=FEnum,enum=test_proto.MyMessage_Color,oneof"` + F_Enum MyMessage_Color `protobuf:"varint,14,opt,name=F_Enum,json=FEnum,enum=proto2_test.MyMessage_Color,oneof"` } type Oneof_F_Message struct { @@ -3431,7 +3391,7 @@ func (m *Oneof_F_Group) Reset() { *m = Oneof_F_Group{} } func (m *Oneof_F_Group) String() string { return proto.CompactTextString(m) } func (*Oneof_F_Group) ProtoMessage() {} func (*Oneof_F_Group) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{29, 0} + return fileDescriptor_e5b3e7ca68f98362, []int{28, 0} } func (m *Oneof_F_Group) XXX_Unmarshal(b []byte) error { @@ -3480,7 +3440,7 @@ func (m *Communique) Reset() { *m = Communique{} } func (m *Communique) String() string { return proto.CompactTextString(m) } func (*Communique) ProtoMessage() {} func (*Communique) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{30} + return fileDescriptor_e5b3e7ca68f98362, []int{29} } func (m *Communique) XXX_Unmarshal(b []byte) error { @@ -3529,7 +3489,7 @@ type Communique_TempC struct { } type Communique_Col struct { - Col MyMessage_Color `protobuf:"varint,9,opt,name=col,enum=test_proto.MyMessage_Color,oneof"` + Col MyMessage_Color `protobuf:"varint,9,opt,name=col,enum=proto2_test.MyMessage_Color,oneof"` } type Communique_Msg struct { @@ -3626,7 +3586,7 @@ func (m *TestUTF8) Reset() { *m = TestUTF8{} } func (m *TestUTF8) String() string { return proto.CompactTextString(m) } func (*TestUTF8) ProtoMessage() {} func (*TestUTF8) Descriptor() ([]byte, []int) { - return fileDescriptor_8ca34d01332f1402, []int{31} + return fileDescriptor_e5b3e7ca68f98362, []int{30} } func (m *TestUTF8) XXX_Unmarshal(b []byte) error { @@ -3710,828 +3670,377 @@ var E_Greeting = &proto.ExtensionDesc{ ExtendedType: (*MyMessage)(nil), ExtensionType: ([]string)(nil), Field: 106, - Name: "test_proto.greeting", + Name: "proto2_test.greeting", Tag: "bytes,106,rep,name=greeting", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_Complex = &proto.ExtensionDesc{ ExtendedType: (*OtherMessage)(nil), ExtensionType: (*ComplexExtension)(nil), Field: 200, - Name: "test_proto.complex", + Name: "proto2_test.complex", Tag: "bytes,200,opt,name=complex", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_RComplex = &proto.ExtensionDesc{ ExtendedType: (*OtherMessage)(nil), ExtensionType: ([]*ComplexExtension)(nil), Field: 201, - Name: "test_proto.r_complex", + Name: "proto2_test.r_complex", Tag: "bytes,201,rep,name=r_complex", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultDouble = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*float64)(nil), Field: 101, - Name: "test_proto.no_default_double", + Name: "proto2_test.no_default_double", Tag: "fixed64,101,opt,name=no_default_double", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultFloat = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*float32)(nil), Field: 102, - Name: "test_proto.no_default_float", + Name: "proto2_test.no_default_float", Tag: "fixed32,102,opt,name=no_default_float", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultInt32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int32)(nil), Field: 103, - Name: "test_proto.no_default_int32", + Name: "proto2_test.no_default_int32", Tag: "varint,103,opt,name=no_default_int32", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultInt64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int64)(nil), Field: 104, - Name: "test_proto.no_default_int64", + Name: "proto2_test.no_default_int64", Tag: "varint,104,opt,name=no_default_int64", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultUint32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint32)(nil), Field: 105, - Name: "test_proto.no_default_uint32", + Name: "proto2_test.no_default_uint32", Tag: "varint,105,opt,name=no_default_uint32", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultUint64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint64)(nil), Field: 106, - Name: "test_proto.no_default_uint64", + Name: "proto2_test.no_default_uint64", Tag: "varint,106,opt,name=no_default_uint64", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultSint32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int32)(nil), Field: 107, - Name: "test_proto.no_default_sint32", + Name: "proto2_test.no_default_sint32", Tag: "zigzag32,107,opt,name=no_default_sint32", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultSint64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int64)(nil), Field: 108, - Name: "test_proto.no_default_sint64", + Name: "proto2_test.no_default_sint64", Tag: "zigzag64,108,opt,name=no_default_sint64", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultFixed32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint32)(nil), Field: 109, - Name: "test_proto.no_default_fixed32", + Name: "proto2_test.no_default_fixed32", Tag: "fixed32,109,opt,name=no_default_fixed32", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultFixed64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint64)(nil), Field: 110, - Name: "test_proto.no_default_fixed64", + Name: "proto2_test.no_default_fixed64", Tag: "fixed64,110,opt,name=no_default_fixed64", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultSfixed32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int32)(nil), Field: 111, - Name: "test_proto.no_default_sfixed32", + Name: "proto2_test.no_default_sfixed32", Tag: "fixed32,111,opt,name=no_default_sfixed32", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultSfixed64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int64)(nil), Field: 112, - Name: "test_proto.no_default_sfixed64", + Name: "proto2_test.no_default_sfixed64", Tag: "fixed64,112,opt,name=no_default_sfixed64", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultBool = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*bool)(nil), Field: 113, - Name: "test_proto.no_default_bool", + Name: "proto2_test.no_default_bool", Tag: "varint,113,opt,name=no_default_bool", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultString = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*string)(nil), Field: 114, - Name: "test_proto.no_default_string", + Name: "proto2_test.no_default_string", Tag: "bytes,114,opt,name=no_default_string", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultBytes = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: ([]byte)(nil), Field: 115, - Name: "test_proto.no_default_bytes", + Name: "proto2_test.no_default_bytes", Tag: "bytes,115,opt,name=no_default_bytes", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_NoDefaultEnum = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*DefaultsMessage_DefaultsEnum)(nil), Field: 116, - Name: "test_proto.no_default_enum", - Tag: "varint,116,opt,name=no_default_enum,enum=test_proto.DefaultsMessage_DefaultsEnum", - Filename: "test_proto/test.proto", + Name: "proto2_test.no_default_enum", + Tag: "varint,116,opt,name=no_default_enum,enum=proto2_test.DefaultsMessage_DefaultsEnum", + Filename: "proto2_proto/test.proto", } var E_DefaultDouble = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*float64)(nil), Field: 201, - Name: "test_proto.default_double", + Name: "proto2_test.default_double", Tag: "fixed64,201,opt,name=default_double,def=3.1415", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultFloat = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*float32)(nil), Field: 202, - Name: "test_proto.default_float", + Name: "proto2_test.default_float", Tag: "fixed32,202,opt,name=default_float,def=3.14", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultInt32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int32)(nil), Field: 203, - Name: "test_proto.default_int32", + Name: "proto2_test.default_int32", Tag: "varint,203,opt,name=default_int32,def=42", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultInt64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int64)(nil), Field: 204, - Name: "test_proto.default_int64", + Name: "proto2_test.default_int64", Tag: "varint,204,opt,name=default_int64,def=43", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultUint32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint32)(nil), Field: 205, - Name: "test_proto.default_uint32", + Name: "proto2_test.default_uint32", Tag: "varint,205,opt,name=default_uint32,def=44", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultUint64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint64)(nil), Field: 206, - Name: "test_proto.default_uint64", + Name: "proto2_test.default_uint64", Tag: "varint,206,opt,name=default_uint64,def=45", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultSint32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int32)(nil), Field: 207, - Name: "test_proto.default_sint32", + Name: "proto2_test.default_sint32", Tag: "zigzag32,207,opt,name=default_sint32,def=46", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultSint64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int64)(nil), Field: 208, - Name: "test_proto.default_sint64", + Name: "proto2_test.default_sint64", Tag: "zigzag64,208,opt,name=default_sint64,def=47", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultFixed32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint32)(nil), Field: 209, - Name: "test_proto.default_fixed32", + Name: "proto2_test.default_fixed32", Tag: "fixed32,209,opt,name=default_fixed32,def=48", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultFixed64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint64)(nil), Field: 210, - Name: "test_proto.default_fixed64", + Name: "proto2_test.default_fixed64", Tag: "fixed64,210,opt,name=default_fixed64,def=49", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultSfixed32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int32)(nil), Field: 211, - Name: "test_proto.default_sfixed32", + Name: "proto2_test.default_sfixed32", Tag: "fixed32,211,opt,name=default_sfixed32,def=50", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultSfixed64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int64)(nil), Field: 212, - Name: "test_proto.default_sfixed64", + Name: "proto2_test.default_sfixed64", Tag: "fixed64,212,opt,name=default_sfixed64,def=51", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultBool = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*bool)(nil), Field: 213, - Name: "test_proto.default_bool", + Name: "proto2_test.default_bool", Tag: "varint,213,opt,name=default_bool,def=1", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultString = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*string)(nil), Field: 214, - Name: "test_proto.default_string", + Name: "proto2_test.default_string", Tag: "bytes,214,opt,name=default_string,def=Hello, string,def=foo", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultBytes = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: ([]byte)(nil), Field: 215, - Name: "test_proto.default_bytes", + Name: "proto2_test.default_bytes", Tag: "bytes,215,opt,name=default_bytes,def=Hello, bytes", - Filename: "test_proto/test.proto", + Filename: "proto2_proto/test.proto", } var E_DefaultEnum = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*DefaultsMessage_DefaultsEnum)(nil), Field: 216, - Name: "test_proto.default_enum", - Tag: "varint,216,opt,name=default_enum,enum=test_proto.DefaultsMessage_DefaultsEnum,def=1", - Filename: "test_proto/test.proto", -} - -var E_X201 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 201, - Name: "test_proto.x201", - Tag: "bytes,201,opt,name=x201", - Filename: "test_proto/test.proto", -} - -var E_X202 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 202, - Name: "test_proto.x202", - Tag: "bytes,202,opt,name=x202", - Filename: "test_proto/test.proto", -} - -var E_X203 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 203, - Name: "test_proto.x203", - Tag: "bytes,203,opt,name=x203", - Filename: "test_proto/test.proto", -} - -var E_X204 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 204, - Name: "test_proto.x204", - Tag: "bytes,204,opt,name=x204", - Filename: "test_proto/test.proto", -} - -var E_X205 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 205, - Name: "test_proto.x205", - Tag: "bytes,205,opt,name=x205", - Filename: "test_proto/test.proto", -} - -var E_X206 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 206, - Name: "test_proto.x206", - Tag: "bytes,206,opt,name=x206", - Filename: "test_proto/test.proto", -} - -var E_X207 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 207, - Name: "test_proto.x207", - Tag: "bytes,207,opt,name=x207", - Filename: "test_proto/test.proto", -} - -var E_X208 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 208, - Name: "test_proto.x208", - Tag: "bytes,208,opt,name=x208", - Filename: "test_proto/test.proto", -} - -var E_X209 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 209, - Name: "test_proto.x209", - Tag: "bytes,209,opt,name=x209", - Filename: "test_proto/test.proto", -} - -var E_X210 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 210, - Name: "test_proto.x210", - Tag: "bytes,210,opt,name=x210", - Filename: "test_proto/test.proto", -} - -var E_X211 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 211, - Name: "test_proto.x211", - Tag: "bytes,211,opt,name=x211", - Filename: "test_proto/test.proto", -} - -var E_X212 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 212, - Name: "test_proto.x212", - Tag: "bytes,212,opt,name=x212", - Filename: "test_proto/test.proto", -} - -var E_X213 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 213, - Name: "test_proto.x213", - Tag: "bytes,213,opt,name=x213", - Filename: "test_proto/test.proto", -} - -var E_X214 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 214, - Name: "test_proto.x214", - Tag: "bytes,214,opt,name=x214", - Filename: "test_proto/test.proto", -} - -var E_X215 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 215, - Name: "test_proto.x215", - Tag: "bytes,215,opt,name=x215", - Filename: "test_proto/test.proto", -} - -var E_X216 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 216, - Name: "test_proto.x216", - Tag: "bytes,216,opt,name=x216", - Filename: "test_proto/test.proto", -} - -var E_X217 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 217, - Name: "test_proto.x217", - Tag: "bytes,217,opt,name=x217", - Filename: "test_proto/test.proto", -} - -var E_X218 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 218, - Name: "test_proto.x218", - Tag: "bytes,218,opt,name=x218", - Filename: "test_proto/test.proto", -} - -var E_X219 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 219, - Name: "test_proto.x219", - Tag: "bytes,219,opt,name=x219", - Filename: "test_proto/test.proto", -} - -var E_X220 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 220, - Name: "test_proto.x220", - Tag: "bytes,220,opt,name=x220", - Filename: "test_proto/test.proto", -} - -var E_X221 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 221, - Name: "test_proto.x221", - Tag: "bytes,221,opt,name=x221", - Filename: "test_proto/test.proto", -} - -var E_X222 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 222, - Name: "test_proto.x222", - Tag: "bytes,222,opt,name=x222", - Filename: "test_proto/test.proto", -} - -var E_X223 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 223, - Name: "test_proto.x223", - Tag: "bytes,223,opt,name=x223", - Filename: "test_proto/test.proto", -} - -var E_X224 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 224, - Name: "test_proto.x224", - Tag: "bytes,224,opt,name=x224", - Filename: "test_proto/test.proto", -} - -var E_X225 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 225, - Name: "test_proto.x225", - Tag: "bytes,225,opt,name=x225", - Filename: "test_proto/test.proto", -} - -var E_X226 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 226, - Name: "test_proto.x226", - Tag: "bytes,226,opt,name=x226", - Filename: "test_proto/test.proto", -} - -var E_X227 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 227, - Name: "test_proto.x227", - Tag: "bytes,227,opt,name=x227", - Filename: "test_proto/test.proto", -} - -var E_X228 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 228, - Name: "test_proto.x228", - Tag: "bytes,228,opt,name=x228", - Filename: "test_proto/test.proto", -} - -var E_X229 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 229, - Name: "test_proto.x229", - Tag: "bytes,229,opt,name=x229", - Filename: "test_proto/test.proto", -} - -var E_X230 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 230, - Name: "test_proto.x230", - Tag: "bytes,230,opt,name=x230", - Filename: "test_proto/test.proto", -} - -var E_X231 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 231, - Name: "test_proto.x231", - Tag: "bytes,231,opt,name=x231", - Filename: "test_proto/test.proto", -} - -var E_X232 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 232, - Name: "test_proto.x232", - Tag: "bytes,232,opt,name=x232", - Filename: "test_proto/test.proto", -} - -var E_X233 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 233, - Name: "test_proto.x233", - Tag: "bytes,233,opt,name=x233", - Filename: "test_proto/test.proto", -} - -var E_X234 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 234, - Name: "test_proto.x234", - Tag: "bytes,234,opt,name=x234", - Filename: "test_proto/test.proto", -} - -var E_X235 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 235, - Name: "test_proto.x235", - Tag: "bytes,235,opt,name=x235", - Filename: "test_proto/test.proto", -} - -var E_X236 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 236, - Name: "test_proto.x236", - Tag: "bytes,236,opt,name=x236", - Filename: "test_proto/test.proto", -} - -var E_X237 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 237, - Name: "test_proto.x237", - Tag: "bytes,237,opt,name=x237", - Filename: "test_proto/test.proto", -} - -var E_X238 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 238, - Name: "test_proto.x238", - Tag: "bytes,238,opt,name=x238", - Filename: "test_proto/test.proto", -} - -var E_X239 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 239, - Name: "test_proto.x239", - Tag: "bytes,239,opt,name=x239", - Filename: "test_proto/test.proto", -} - -var E_X240 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 240, - Name: "test_proto.x240", - Tag: "bytes,240,opt,name=x240", - Filename: "test_proto/test.proto", -} - -var E_X241 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 241, - Name: "test_proto.x241", - Tag: "bytes,241,opt,name=x241", - Filename: "test_proto/test.proto", -} - -var E_X242 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 242, - Name: "test_proto.x242", - Tag: "bytes,242,opt,name=x242", - Filename: "test_proto/test.proto", -} - -var E_X243 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 243, - Name: "test_proto.x243", - Tag: "bytes,243,opt,name=x243", - Filename: "test_proto/test.proto", -} - -var E_X244 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 244, - Name: "test_proto.x244", - Tag: "bytes,244,opt,name=x244", - Filename: "test_proto/test.proto", -} - -var E_X245 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 245, - Name: "test_proto.x245", - Tag: "bytes,245,opt,name=x245", - Filename: "test_proto/test.proto", -} - -var E_X246 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 246, - Name: "test_proto.x246", - Tag: "bytes,246,opt,name=x246", - Filename: "test_proto/test.proto", -} - -var E_X247 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 247, - Name: "test_proto.x247", - Tag: "bytes,247,opt,name=x247", - Filename: "test_proto/test.proto", -} - -var E_X248 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 248, - Name: "test_proto.x248", - Tag: "bytes,248,opt,name=x248", - Filename: "test_proto/test.proto", -} - -var E_X249 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 249, - Name: "test_proto.x249", - Tag: "bytes,249,opt,name=x249", - Filename: "test_proto/test.proto", -} - -var E_X250 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 250, - Name: "test_proto.x250", - Tag: "bytes,250,opt,name=x250", - Filename: "test_proto/test.proto", + Name: "proto2_test.default_enum", + Tag: "varint,216,opt,name=default_enum,enum=proto2_test.DefaultsMessage_DefaultsEnum,def=1", + Filename: "proto2_proto/test.proto", } func init() { - proto.RegisterEnum("test_proto.FOO", FOO_name, FOO_value) - proto.RegisterEnum("test_proto.GoTest_KIND", GoTest_KIND_name, GoTest_KIND_value) - proto.RegisterEnum("test_proto.MyMessage_Color", MyMessage_Color_name, MyMessage_Color_value) - proto.RegisterEnum("test_proto.DefaultsMessage_DefaultsEnum", DefaultsMessage_DefaultsEnum_name, DefaultsMessage_DefaultsEnum_value) - proto.RegisterEnum("test_proto.Defaults_Color", Defaults_Color_name, Defaults_Color_value) - proto.RegisterEnum("test_proto.RepeatedEnum_Color", RepeatedEnum_Color_name, RepeatedEnum_Color_value) - proto.RegisterType((*GoEnum)(nil), "test_proto.GoEnum") - proto.RegisterType((*GoTestField)(nil), "test_proto.GoTestField") - proto.RegisterType((*GoTest)(nil), "test_proto.GoTest") - proto.RegisterType((*GoTest_RequiredGroup)(nil), "test_proto.GoTest.RequiredGroup") - proto.RegisterType((*GoTest_RepeatedGroup)(nil), "test_proto.GoTest.RepeatedGroup") - proto.RegisterType((*GoTest_OptionalGroup)(nil), "test_proto.GoTest.OptionalGroup") - proto.RegisterType((*GoTestRequiredGroupField)(nil), "test_proto.GoTestRequiredGroupField") - proto.RegisterType((*GoTestRequiredGroupField_Group)(nil), "test_proto.GoTestRequiredGroupField.Group") - proto.RegisterType((*GoSkipTest)(nil), "test_proto.GoSkipTest") - proto.RegisterType((*GoSkipTest_SkipGroup)(nil), "test_proto.GoSkipTest.SkipGroup") - proto.RegisterType((*NonPackedTest)(nil), "test_proto.NonPackedTest") - proto.RegisterType((*PackedTest)(nil), "test_proto.PackedTest") - proto.RegisterType((*MaxTag)(nil), "test_proto.MaxTag") - proto.RegisterType((*OldMessage)(nil), "test_proto.OldMessage") - proto.RegisterType((*OldMessage_Nested)(nil), "test_proto.OldMessage.Nested") - proto.RegisterType((*NewMessage)(nil), "test_proto.NewMessage") - proto.RegisterType((*NewMessage_Nested)(nil), "test_proto.NewMessage.Nested") - proto.RegisterType((*InnerMessage)(nil), "test_proto.InnerMessage") - proto.RegisterType((*OtherMessage)(nil), "test_proto.OtherMessage") - proto.RegisterType((*RequiredInnerMessage)(nil), "test_proto.RequiredInnerMessage") - proto.RegisterType((*MyMessage)(nil), "test_proto.MyMessage") - proto.RegisterType((*MyMessage_SomeGroup)(nil), "test_proto.MyMessage.SomeGroup") + proto.RegisterEnum("proto2_test.FOO", FOO_name, FOO_value) + proto.RegisterEnum("proto2_test.GoTest_KIND", GoTest_KIND_name, GoTest_KIND_value) + proto.RegisterEnum("proto2_test.MyMessage_Color", MyMessage_Color_name, MyMessage_Color_value) + proto.RegisterEnum("proto2_test.DefaultsMessage_DefaultsEnum", DefaultsMessage_DefaultsEnum_name, DefaultsMessage_DefaultsEnum_value) + proto.RegisterEnum("proto2_test.Defaults_Color", Defaults_Color_name, Defaults_Color_value) + proto.RegisterEnum("proto2_test.RepeatedEnum_Color", RepeatedEnum_Color_name, RepeatedEnum_Color_value) + proto.RegisterType((*GoEnum)(nil), "proto2_test.GoEnum") + proto.RegisterType((*GoTestField)(nil), "proto2_test.GoTestField") + proto.RegisterType((*GoTest)(nil), "proto2_test.GoTest") + proto.RegisterType((*GoTest_RequiredGroup)(nil), "proto2_test.GoTest.RequiredGroup") + proto.RegisterType((*GoTest_RepeatedGroup)(nil), "proto2_test.GoTest.RepeatedGroup") + proto.RegisterType((*GoTest_OptionalGroup)(nil), "proto2_test.GoTest.OptionalGroup") + proto.RegisterType((*GoTestRequiredGroupField)(nil), "proto2_test.GoTestRequiredGroupField") + proto.RegisterType((*GoTestRequiredGroupField_Group)(nil), "proto2_test.GoTestRequiredGroupField.Group") + proto.RegisterType((*GoSkipTest)(nil), "proto2_test.GoSkipTest") + proto.RegisterType((*GoSkipTest_SkipGroup)(nil), "proto2_test.GoSkipTest.SkipGroup") + proto.RegisterType((*NonPackedTest)(nil), "proto2_test.NonPackedTest") + proto.RegisterType((*PackedTest)(nil), "proto2_test.PackedTest") + proto.RegisterType((*MaxTag)(nil), "proto2_test.MaxTag") + proto.RegisterType((*OldMessage)(nil), "proto2_test.OldMessage") + proto.RegisterType((*OldMessage_Nested)(nil), "proto2_test.OldMessage.Nested") + proto.RegisterType((*NewMessage)(nil), "proto2_test.NewMessage") + proto.RegisterType((*NewMessage_Nested)(nil), "proto2_test.NewMessage.Nested") + proto.RegisterType((*InnerMessage)(nil), "proto2_test.InnerMessage") + proto.RegisterType((*OtherMessage)(nil), "proto2_test.OtherMessage") + proto.RegisterType((*RequiredInnerMessage)(nil), "proto2_test.RequiredInnerMessage") + proto.RegisterType((*MyMessage)(nil), "proto2_test.MyMessage") + proto.RegisterType((*MyMessage_SomeGroup)(nil), "proto2_test.MyMessage.SomeGroup") proto.RegisterExtension(E_Ext_More) proto.RegisterExtension(E_Ext_Text) proto.RegisterExtension(E_Ext_Number) - proto.RegisterType((*Ext)(nil), "test_proto.Ext") - proto.RegisterMapType((map[int32]int32)(nil), "test_proto.Ext.MapFieldEntry") - proto.RegisterType((*ComplexExtension)(nil), "test_proto.ComplexExtension") - proto.RegisterType((*DefaultsMessage)(nil), "test_proto.DefaultsMessage") - proto.RegisterType((*MyMessageSet)(nil), "test_proto.MyMessageSet") - proto.RegisterType((*Empty)(nil), "test_proto.Empty") - proto.RegisterType((*MessageList)(nil), "test_proto.MessageList") - proto.RegisterType((*MessageList_Message)(nil), "test_proto.MessageList.Message") - proto.RegisterType((*Strings)(nil), "test_proto.Strings") - proto.RegisterType((*Defaults)(nil), "test_proto.Defaults") - proto.RegisterType((*SubDefaults)(nil), "test_proto.SubDefaults") - proto.RegisterType((*RepeatedEnum)(nil), "test_proto.RepeatedEnum") - proto.RegisterType((*MoreRepeated)(nil), "test_proto.MoreRepeated") - proto.RegisterType((*GroupOld)(nil), "test_proto.GroupOld") - proto.RegisterType((*GroupOld_G)(nil), "test_proto.GroupOld.G") - proto.RegisterType((*GroupNew)(nil), "test_proto.GroupNew") - proto.RegisterType((*GroupNew_G)(nil), "test_proto.GroupNew.G") - proto.RegisterType((*FloatingPoint)(nil), "test_proto.FloatingPoint") - proto.RegisterType((*MessageWithMap)(nil), "test_proto.MessageWithMap") - proto.RegisterMapType((map[bool][]byte)(nil), "test_proto.MessageWithMap.ByteMappingEntry") - proto.RegisterMapType((map[int64]*FloatingPoint)(nil), "test_proto.MessageWithMap.MsgMappingEntry") - proto.RegisterMapType((map[int32]string)(nil), "test_proto.MessageWithMap.NameMappingEntry") - proto.RegisterMapType((map[string]string)(nil), "test_proto.MessageWithMap.StrToStrEntry") - proto.RegisterType((*Oneof)(nil), "test_proto.Oneof") - proto.RegisterType((*Oneof_F_Group)(nil), "test_proto.Oneof.F_Group") - proto.RegisterType((*Communique)(nil), "test_proto.Communique") - proto.RegisterType((*TestUTF8)(nil), "test_proto.TestUTF8") - proto.RegisterMapType((map[string]int64)(nil), "test_proto.TestUTF8.MapKeyEntry") - proto.RegisterMapType((map[int64]string)(nil), "test_proto.TestUTF8.MapValueEntry") + proto.RegisterType((*Ext)(nil), "proto2_test.Ext") + proto.RegisterMapType((map[int32]int32)(nil), "proto2_test.Ext.MapFieldEntry") + proto.RegisterType((*ComplexExtension)(nil), "proto2_test.ComplexExtension") + proto.RegisterType((*DefaultsMessage)(nil), "proto2_test.DefaultsMessage") + proto.RegisterType((*Empty)(nil), "proto2_test.Empty") + proto.RegisterType((*MessageList)(nil), "proto2_test.MessageList") + proto.RegisterType((*MessageList_Message)(nil), "proto2_test.MessageList.Message") + proto.RegisterType((*Strings)(nil), "proto2_test.Strings") + proto.RegisterType((*Defaults)(nil), "proto2_test.Defaults") + proto.RegisterType((*SubDefaults)(nil), "proto2_test.SubDefaults") + proto.RegisterType((*RepeatedEnum)(nil), "proto2_test.RepeatedEnum") + proto.RegisterType((*MoreRepeated)(nil), "proto2_test.MoreRepeated") + proto.RegisterType((*GroupOld)(nil), "proto2_test.GroupOld") + proto.RegisterType((*GroupOld_G)(nil), "proto2_test.GroupOld.G") + proto.RegisterType((*GroupNew)(nil), "proto2_test.GroupNew") + proto.RegisterType((*GroupNew_G)(nil), "proto2_test.GroupNew.G") + proto.RegisterType((*FloatingPoint)(nil), "proto2_test.FloatingPoint") + proto.RegisterType((*MessageWithMap)(nil), "proto2_test.MessageWithMap") + proto.RegisterMapType((map[bool][]byte)(nil), "proto2_test.MessageWithMap.ByteMappingEntry") + proto.RegisterMapType((map[int64]*FloatingPoint)(nil), "proto2_test.MessageWithMap.MsgMappingEntry") + proto.RegisterMapType((map[int32]string)(nil), "proto2_test.MessageWithMap.NameMappingEntry") + proto.RegisterMapType((map[string]string)(nil), "proto2_test.MessageWithMap.StrToStrEntry") + proto.RegisterType((*Oneof)(nil), "proto2_test.Oneof") + proto.RegisterType((*Oneof_F_Group)(nil), "proto2_test.Oneof.F_Group") + proto.RegisterType((*Communique)(nil), "proto2_test.Communique") + proto.RegisterType((*TestUTF8)(nil), "proto2_test.TestUTF8") + proto.RegisterMapType((map[string]int64)(nil), "proto2_test.TestUTF8.MapKeyEntry") + proto.RegisterMapType((map[int64]string)(nil), "proto2_test.TestUTF8.MapValueEntry") proto.RegisterExtension(E_Greeting) proto.RegisterExtension(E_Complex) proto.RegisterExtension(E_RComplex) @@ -4567,360 +4076,281 @@ func init() { proto.RegisterExtension(E_DefaultString) proto.RegisterExtension(E_DefaultBytes) proto.RegisterExtension(E_DefaultEnum) - proto.RegisterExtension(E_X201) - proto.RegisterExtension(E_X202) - proto.RegisterExtension(E_X203) - proto.RegisterExtension(E_X204) - proto.RegisterExtension(E_X205) - proto.RegisterExtension(E_X206) - proto.RegisterExtension(E_X207) - proto.RegisterExtension(E_X208) - proto.RegisterExtension(E_X209) - proto.RegisterExtension(E_X210) - proto.RegisterExtension(E_X211) - proto.RegisterExtension(E_X212) - proto.RegisterExtension(E_X213) - proto.RegisterExtension(E_X214) - proto.RegisterExtension(E_X215) - proto.RegisterExtension(E_X216) - proto.RegisterExtension(E_X217) - proto.RegisterExtension(E_X218) - proto.RegisterExtension(E_X219) - proto.RegisterExtension(E_X220) - proto.RegisterExtension(E_X221) - proto.RegisterExtension(E_X222) - proto.RegisterExtension(E_X223) - proto.RegisterExtension(E_X224) - proto.RegisterExtension(E_X225) - proto.RegisterExtension(E_X226) - proto.RegisterExtension(E_X227) - proto.RegisterExtension(E_X228) - proto.RegisterExtension(E_X229) - proto.RegisterExtension(E_X230) - proto.RegisterExtension(E_X231) - proto.RegisterExtension(E_X232) - proto.RegisterExtension(E_X233) - proto.RegisterExtension(E_X234) - proto.RegisterExtension(E_X235) - proto.RegisterExtension(E_X236) - proto.RegisterExtension(E_X237) - proto.RegisterExtension(E_X238) - proto.RegisterExtension(E_X239) - proto.RegisterExtension(E_X240) - proto.RegisterExtension(E_X241) - proto.RegisterExtension(E_X242) - proto.RegisterExtension(E_X243) - proto.RegisterExtension(E_X244) - proto.RegisterExtension(E_X245) - proto.RegisterExtension(E_X246) - proto.RegisterExtension(E_X247) - proto.RegisterExtension(E_X248) - proto.RegisterExtension(E_X249) - proto.RegisterExtension(E_X250) -} - -func init() { proto.RegisterFile("test_proto/test.proto", fileDescriptor_8ca34d01332f1402) } - -var fileDescriptor_8ca34d01332f1402 = []byte{ - // 4795 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5b, 0xd9, 0x73, 0x1b, 0x47, - 0x7a, 0xd7, 0x0c, 0xee, 0x0f, 0x20, 0x31, 0x6c, 0xc9, 0x12, 0x44, 0x59, 0xd2, 0x08, 0x6b, 0xaf, - 0x61, 0xc9, 0xa2, 0x48, 0x60, 0x08, 0x49, 0x70, 0xec, 0x58, 0x07, 0x41, 0xb3, 0x24, 0x12, 0xf2, - 0x90, 0xb6, 0xb3, 0xca, 0x03, 0x0a, 0x24, 0x06, 0x20, 0x56, 0xc0, 0x0c, 0x0c, 0x0c, 0x56, 0x64, - 0x52, 0xa9, 0xf2, 0x63, 0xaa, 0xf2, 0x94, 0x4d, 0x52, 0x95, 0xf7, 0xbc, 0xe4, 0x25, 0xd7, 0x43, - 0xf2, 0x37, 0xc4, 0xd7, 0x7a, 0x77, 0xbd, 0x57, 0x92, 0x4d, 0x36, 0xf7, 0x9d, 0xcd, 0xbd, 0x47, - 0x5e, 0x9c, 0xea, 0xaf, 0x7b, 0x66, 0x7a, 0x06, 0x50, 0x93, 0x7c, 0xe2, 0x74, 0xf7, 0xef, 0xfb, - 0xf5, 0xf5, 0x9b, 0xef, 0xfb, 0xba, 0x31, 0x84, 0xe7, 0x5c, 0x6b, 0xec, 0x36, 0x87, 0x23, 0xc7, - 0x75, 0x6e, 0xd0, 0xc7, 0x25, 0x7c, 0x24, 0x10, 0x54, 0x17, 0xaf, 0x41, 0x72, 0xdd, 0x59, 0xb3, - 0x27, 0x03, 0x72, 0x05, 0x62, 0x1d, 0xc7, 0x29, 0x28, 0xba, 0x5a, 0x9a, 0x2f, 0xe7, 0x97, 0x02, - 0xcc, 0x52, 0xbd, 0xd1, 0x30, 0x69, 0x5b, 0xf1, 0x26, 0x64, 0xd7, 0x9d, 0x1d, 0x6b, 0xec, 0xd6, - 0x7b, 0x56, 0xbf, 0x4d, 0xce, 0x40, 0xe2, 0x61, 0x6b, 0xd7, 0xea, 0xa3, 0x4d, 0xc6, 0x64, 0x05, - 0x42, 0x20, 0xbe, 0x73, 0x38, 0xb4, 0x0a, 0x2a, 0x56, 0xe2, 0x73, 0xf1, 0x0f, 0x8b, 0xb4, 0x1b, - 0x6a, 0x49, 0xae, 0x41, 0xfc, 0x41, 0xcf, 0x6e, 0xf3, 0x7e, 0xce, 0x89, 0xfd, 0x30, 0xc4, 0xd2, - 0x83, 0x8d, 0xad, 0xfb, 0x26, 0x82, 0x68, 0x0f, 0x3b, 0xad, 0xdd, 0x3e, 0x25, 0x53, 0x68, 0x0f, - 0x58, 0xa0, 0xb5, 0x8f, 0x5a, 0xa3, 0xd6, 0xa0, 0x10, 0xd3, 0x95, 0x52, 0xc2, 0x64, 0x05, 0xf2, - 0x1a, 0xcc, 0x99, 0xd6, 0x7b, 0x93, 0xde, 0xc8, 0x6a, 0xe3, 0xf0, 0x0a, 0x71, 0x5d, 0x2d, 0x65, - 0x67, 0xf5, 0x80, 0xcd, 0x66, 0x18, 0xcd, 0xcc, 0x87, 0x56, 0xcb, 0xf5, 0xcc, 0x13, 0x7a, 0xec, - 0x08, 0x73, 0x01, 0x4d, 0xcd, 0x1b, 0x43, 0xb7, 0xe7, 0xd8, 0xad, 0x3e, 0x33, 0x4f, 0xea, 0x8a, - 0xd4, 0x3c, 0x84, 0x26, 0x5f, 0x84, 0x7c, 0xbd, 0x79, 0xd7, 0x71, 0xfa, 0xcd, 0x11, 0x1f, 0x55, - 0x01, 0x74, 0xb5, 0x94, 0x36, 0xe7, 0xea, 0xb4, 0xd6, 0x1b, 0x2a, 0x29, 0x81, 0x56, 0x6f, 0x6e, - 0xd8, 0x6e, 0xa5, 0x1c, 0x00, 0xb3, 0xba, 0x5a, 0x4a, 0x98, 0xf3, 0x75, 0xac, 0x9e, 0x42, 0x56, - 0x8d, 0x00, 0x99, 0xd3, 0xd5, 0x52, 0x8c, 0x21, 0xab, 0x86, 0x8f, 0x7c, 0x05, 0x48, 0xbd, 0x59, - 0xef, 0x1d, 0x58, 0x6d, 0x91, 0x75, 0x4e, 0x57, 0x4b, 0x29, 0x53, 0xab, 0xf3, 0x86, 0x19, 0x68, - 0x91, 0x79, 0x5e, 0x57, 0x4b, 0x49, 0x0f, 0x2d, 0x70, 0x5f, 0x85, 0x85, 0x7a, 0xf3, 0xed, 0x5e, - 0x78, 0xc0, 0x79, 0x5d, 0x2d, 0xcd, 0x99, 0xf9, 0x3a, 0xab, 0x9f, 0xc6, 0x8a, 0xc4, 0x9a, 0xae, - 0x96, 0xe2, 0x1c, 0x2b, 0xf0, 0xe2, 0xec, 0xea, 0x7d, 0xa7, 0xe5, 0x06, 0xd0, 0x05, 0x5d, 0x2d, - 0xa9, 0xe6, 0x7c, 0x1d, 0xab, 0xc3, 0xac, 0xf7, 0x9d, 0xc9, 0x6e, 0xdf, 0x0a, 0xa0, 0x44, 0x57, - 0x4b, 0x8a, 0x99, 0xaf, 0xb3, 0xfa, 0x30, 0x76, 0xdb, 0x1d, 0xf5, 0xec, 0x6e, 0x80, 0x3d, 0x8d, - 0x3a, 0xce, 0xd7, 0x59, 0x7d, 0x78, 0x04, 0x77, 0x0f, 0x5d, 0x6b, 0x1c, 0x40, 0x2d, 0x5d, 0x2d, - 0xe5, 0xcc, 0xf9, 0x3a, 0x56, 0x47, 0x58, 0x23, 0x6b, 0xd0, 0xd1, 0xd5, 0xd2, 0x02, 0x65, 0x9d, - 0xb1, 0x06, 0xdb, 0x91, 0x35, 0xe8, 0xea, 0x6a, 0x89, 0x70, 0xac, 0xb0, 0x06, 0x4b, 0x70, 0xba, - 0xde, 0xdc, 0xee, 0x44, 0x37, 0x6e, 0x5f, 0x57, 0x4b, 0x79, 0x73, 0xa1, 0xee, 0xb5, 0xcc, 0xc2, - 0x8b, 0xec, 0x3d, 0x5d, 0x2d, 0x69, 0x3e, 0x5e, 0xe0, 0x17, 0x35, 0xc9, 0xa4, 0x5e, 0x38, 0xa3, - 0xc7, 0x04, 0x4d, 0xb2, 0xca, 0xb0, 0x26, 0x39, 0xf0, 0x39, 0x3d, 0x26, 0x6a, 0x32, 0x82, 0xc4, - 0xee, 0x39, 0xf2, 0xac, 0x1e, 0x13, 0x35, 0xc9, 0x91, 0x11, 0x4d, 0x72, 0xec, 0x39, 0x3d, 0x16, - 0xd6, 0xe4, 0x14, 0x5a, 0x64, 0x2e, 0xe8, 0xb1, 0xb0, 0x26, 0x39, 0x3a, 0xac, 0x49, 0x0e, 0x3e, - 0xaf, 0xc7, 0x42, 0x9a, 0x8c, 0x62, 0x45, 0xe2, 0x45, 0x3d, 0x16, 0xd2, 0xa4, 0x38, 0x3b, 0x4f, - 0x93, 0x1c, 0x7a, 0x41, 0x8f, 0x89, 0x9a, 0x14, 0x59, 0x7d, 0x4d, 0x72, 0xe8, 0xf3, 0x7a, 0x2c, - 0xa4, 0x49, 0x11, 0xeb, 0x6b, 0x92, 0x63, 0x2f, 0xea, 0xb1, 0x90, 0x26, 0x39, 0xf6, 0x65, 0x51, - 0x93, 0x1c, 0xfa, 0x81, 0xa2, 0xc7, 0x44, 0x51, 0x72, 0xe8, 0xb5, 0x90, 0x28, 0x39, 0xf6, 0x43, - 0x8a, 0x15, 0x55, 0x19, 0x05, 0x8b, 0xab, 0xf0, 0x11, 0x05, 0x8b, 0xb2, 0xe4, 0xe0, 0x1b, 0x11, - 0x59, 0x72, 0xf8, 0xc7, 0x14, 0x1e, 0xd6, 0xe5, 0xb4, 0x81, 0xc8, 0xff, 0x09, 0x35, 0x08, 0x0b, - 0x93, 0x1b, 0x04, 0xc2, 0x74, 0xb8, 0x13, 0x2d, 0x5c, 0xd2, 0x15, 0x5f, 0x98, 0x9e, 0x67, 0x15, - 0x85, 0xe9, 0x03, 0x2f, 0x63, 0xc8, 0xe0, 0xc2, 0x9c, 0x42, 0x56, 0x8d, 0x00, 0xa9, 0xeb, 0x4a, - 0x20, 0x4c, 0x1f, 0x19, 0x12, 0xa6, 0x8f, 0xbd, 0xa2, 0x2b, 0xa2, 0x30, 0x67, 0xa0, 0x45, 0xe6, - 0xa2, 0xae, 0x88, 0xc2, 0xf4, 0xd1, 0xa2, 0x30, 0x7d, 0xf0, 0x17, 0x74, 0x45, 0x10, 0xe6, 0x34, - 0x56, 0x24, 0x7e, 0x41, 0x57, 0x04, 0x61, 0x86, 0x67, 0xc7, 0x84, 0xe9, 0x43, 0x5f, 0xd4, 0x95, - 0x40, 0x98, 0x61, 0x56, 0x2e, 0x4c, 0x1f, 0xfa, 0x45, 0x5d, 0x11, 0x84, 0x19, 0xc6, 0x72, 0x61, - 0xfa, 0xd8, 0x97, 0x30, 0x4e, 0x7b, 0xc2, 0xf4, 0xb1, 0x82, 0x30, 0x7d, 0xe8, 0xef, 0xd0, 0x98, - 0xee, 0x0b, 0xd3, 0x87, 0x8a, 0xc2, 0xf4, 0xb1, 0xbf, 0x4b, 0xb1, 0x81, 0x30, 0xa7, 0xc1, 0xe2, - 0x2a, 0xfc, 0x1e, 0x05, 0x07, 0xc2, 0xf4, 0xc1, 0x61, 0x61, 0xfa, 0xf0, 0xdf, 0xa7, 0x70, 0x51, - 0x98, 0xb3, 0x0c, 0x44, 0xfe, 0x3f, 0xa0, 0x06, 0xa2, 0x30, 0x7d, 0x83, 0x25, 0x9c, 0x26, 0x15, - 0x66, 0xdb, 0xea, 0xb4, 0x26, 0x7d, 0x2a, 0xe3, 0x12, 0x55, 0x66, 0x2d, 0xee, 0x8e, 0x26, 0x16, - 0x9d, 0xab, 0xe3, 0xf4, 0xef, 0x7b, 0x6d, 0x64, 0x89, 0x0e, 0x9f, 0x09, 0x34, 0x30, 0x78, 0x99, - 0x2a, 0xb4, 0xa6, 0x56, 0xca, 0x66, 0x9e, 0xa9, 0x74, 0x1a, 0x5f, 0x35, 0x04, 0xfc, 0x55, 0xaa, - 0xd3, 0x9a, 0x5a, 0x35, 0x18, 0xbe, 0x6a, 0x04, 0xf8, 0x0a, 0x9d, 0x80, 0x27, 0xd6, 0xc0, 0xe2, - 0x1a, 0x55, 0x6b, 0x2d, 0x56, 0x29, 0x2f, 0x9b, 0x0b, 0x9e, 0x64, 0x67, 0x19, 0x85, 0xba, 0x79, - 0x85, 0x8a, 0xb6, 0x16, 0xab, 0x1a, 0xbe, 0x91, 0xd8, 0x53, 0x99, 0x0a, 0x9d, 0x4b, 0x37, 0xb0, - 0xb9, 0x4e, 0xb5, 0x5b, 0x8b, 0x57, 0xca, 0xcb, 0xcb, 0xa6, 0xc6, 0x15, 0x3c, 0xc3, 0x26, 0xd4, - 0xcf, 0x12, 0xd5, 0x70, 0x2d, 0x5e, 0x35, 0x7c, 0x9b, 0x70, 0x3f, 0x0b, 0x9e, 0x94, 0x03, 0x93, - 0x1b, 0x54, 0xcb, 0xb5, 0x64, 0x65, 0xc5, 0x58, 0x59, 0xbd, 0x6d, 0xe6, 0x99, 0xa6, 0x03, 0x1b, - 0x83, 0xf6, 0xc3, 0x45, 0x1d, 0x18, 0x2d, 0x53, 0x55, 0xd7, 0x92, 0xe5, 0x9b, 0x2b, 0xb7, 0xca, - 0xb7, 0x4c, 0x8d, 0xab, 0x3b, 0xb0, 0x7a, 0x9d, 0x5a, 0x71, 0x79, 0x07, 0x56, 0x2b, 0x54, 0xdf, - 0x35, 0x6d, 0xdf, 0xea, 0xf7, 0x9d, 0x57, 0xf4, 0xe2, 0x53, 0x67, 0xd4, 0x6f, 0x5f, 0x29, 0x82, - 0xa9, 0x71, 0xc5, 0x8b, 0xbd, 0x2e, 0x78, 0x92, 0x0f, 0xcc, 0x7f, 0x95, 0x66, 0xac, 0xb9, 0x5a, - 0xea, 0x6e, 0xaf, 0x6b, 0x3b, 0x63, 0xcb, 0xcc, 0x33, 0xf1, 0x47, 0xd6, 0x64, 0x3b, 0xba, 0x8e, - 0x5f, 0xa5, 0x66, 0x0b, 0xb5, 0xd8, 0xf5, 0x4a, 0x99, 0xf6, 0x34, 0x6b, 0x1d, 0xb7, 0xa3, 0xeb, - 0xf8, 0x6b, 0xd4, 0x86, 0xd4, 0x62, 0xd7, 0xab, 0x06, 0xb7, 0x11, 0xd7, 0xb1, 0x0a, 0x67, 0x84, - 0x77, 0x21, 0xb0, 0xfa, 0x75, 0x6a, 0x95, 0x67, 0x3d, 0x11, 0xff, 0x8d, 0x98, 0x69, 0x17, 0xea, - 0xed, 0x37, 0xa8, 0x9d, 0xc6, 0x7a, 0x23, 0xfe, 0x8b, 0x11, 0xd8, 0xdd, 0x84, 0xb3, 0x91, 0x5c, - 0xa2, 0x39, 0x6c, 0xed, 0x3d, 0xb1, 0xda, 0x85, 0x32, 0x4d, 0x29, 0xee, 0xaa, 0x9a, 0x62, 0x9e, - 0x0e, 0xa5, 0x15, 0x8f, 0xb0, 0x99, 0xdc, 0x86, 0x73, 0xd1, 0xe4, 0xc2, 0xb3, 0xac, 0xd0, 0x1c, - 0x03, 0x2d, 0xcf, 0x84, 0xf3, 0x8c, 0x88, 0xa9, 0x10, 0x54, 0x3c, 0x53, 0x83, 0x26, 0x1d, 0x81, - 0x69, 0x10, 0x5b, 0xb8, 0xe9, 0x6b, 0x70, 0x7e, 0x3a, 0xfd, 0xf0, 0x8c, 0x57, 0x69, 0x16, 0x82, - 0xc6, 0x67, 0xa3, 0x99, 0xc8, 0x94, 0xf9, 0x8c, 0xbe, 0xab, 0x34, 0x2d, 0x11, 0xcd, 0xa7, 0x7a, - 0x7f, 0x15, 0x0a, 0x53, 0x09, 0x8a, 0x67, 0x7d, 0x93, 0xe6, 0x29, 0x68, 0xfd, 0x5c, 0x24, 0x57, - 0x89, 0x1a, 0xcf, 0xe8, 0xfa, 0x16, 0x4d, 0x5c, 0x04, 0xe3, 0xa9, 0x9e, 0x71, 0xc9, 0xc2, 0x29, - 0x8c, 0x67, 0x7b, 0x9b, 0x66, 0x32, 0x7c, 0xc9, 0x42, 0xd9, 0x8c, 0xd8, 0x6f, 0x24, 0xa7, 0xf1, - 0x6c, 0x6b, 0x34, 0xb5, 0xe1, 0xfd, 0x86, 0xd3, 0x1b, 0x6e, 0xfc, 0x33, 0xd4, 0x78, 0x7b, 0xf6, - 0x8c, 0x7f, 0x14, 0xa3, 0x49, 0x09, 0xb7, 0xde, 0x9e, 0x35, 0x65, 0xdf, 0x7a, 0xc6, 0x94, 0x7f, - 0x4c, 0xad, 0x89, 0x60, 0x3d, 0x35, 0xe7, 0x37, 0x60, 0x71, 0x46, 0xbe, 0xe2, 0xd9, 0xff, 0x84, - 0xda, 0xe7, 0xd1, 0xfe, 0xdc, 0x54, 0xea, 0x32, 0xcd, 0x30, 0x63, 0x04, 0x3f, 0xa5, 0x0c, 0x5a, - 0x88, 0x61, 0x6a, 0x0c, 0x75, 0x98, 0xf3, 0xf2, 0xf1, 0xee, 0xc8, 0x99, 0x0c, 0x0b, 0x75, 0x5d, - 0x2d, 0x41, 0x59, 0x9f, 0x71, 0x3a, 0xf6, 0xd2, 0xf3, 0x75, 0x8a, 0x33, 0xc3, 0x66, 0x8c, 0x87, - 0x31, 0x33, 0x9e, 0x47, 0x7a, 0xec, 0x99, 0x3c, 0x0c, 0xe7, 0xf3, 0x08, 0x66, 0x94, 0xc7, 0x0b, - 0x77, 0x8c, 0xe7, 0xb1, 0xae, 0x3c, 0x83, 0xc7, 0x0b, 0x7e, 0x9c, 0x27, 0x64, 0xb6, 0xb8, 0x1a, - 0x9c, 0xc9, 0xb1, 0x9d, 0xbc, 0x10, 0x3d, 0xa4, 0xaf, 0xe3, 0xe9, 0x2a, 0x5c, 0xc9, 0xcc, 0x84, - 0xe1, 0x4d, 0x9b, 0xbd, 0xf5, 0x0c, 0xb3, 0xd0, 0x68, 0xa6, 0xcd, 0x7e, 0x7e, 0x86, 0x59, 0xf1, - 0x37, 0x15, 0x88, 0x3f, 0xd8, 0xd8, 0xba, 0x4f, 0xd2, 0x10, 0x7f, 0xa7, 0xb1, 0x71, 0x5f, 0x3b, - 0x45, 0x9f, 0xee, 0x36, 0x1a, 0x0f, 0x35, 0x85, 0x64, 0x20, 0x71, 0xf7, 0x4b, 0x3b, 0x6b, 0xdb, - 0x9a, 0x4a, 0xf2, 0x90, 0xad, 0x6f, 0x6c, 0xad, 0xaf, 0x99, 0x8f, 0xcc, 0x8d, 0xad, 0x1d, 0x2d, - 0x46, 0xdb, 0xea, 0x0f, 0x1b, 0x77, 0x76, 0xb4, 0x38, 0x49, 0x41, 0x8c, 0xd6, 0x25, 0x08, 0x40, - 0x72, 0x7b, 0xc7, 0xdc, 0xd8, 0x5a, 0xd7, 0x92, 0x94, 0x65, 0x67, 0x63, 0x73, 0x4d, 0x4b, 0x51, - 0xe4, 0xce, 0xdb, 0x8f, 0x1e, 0xae, 0x69, 0x69, 0xfa, 0x78, 0xc7, 0x34, 0xef, 0x7c, 0x49, 0xcb, - 0x50, 0xa3, 0xcd, 0x3b, 0x8f, 0x34, 0xc0, 0xe6, 0x3b, 0x77, 0x1f, 0xae, 0x69, 0x59, 0x92, 0x83, - 0x74, 0xfd, 0xed, 0xad, 0x7b, 0x3b, 0x1b, 0x8d, 0x2d, 0x2d, 0x57, 0xfc, 0x45, 0x28, 0xb0, 0x65, - 0x0e, 0xad, 0x22, 0xbb, 0x32, 0x78, 0x03, 0x12, 0x6c, 0x6f, 0x14, 0xd4, 0xca, 0xd5, 0xe9, 0xbd, - 0x99, 0x36, 0x5a, 0x62, 0xbb, 0xc4, 0x0c, 0x17, 0x2f, 0x42, 0x82, 0xad, 0xd3, 0x19, 0x48, 0xb0, - 0xf5, 0x51, 0xf1, 0x2a, 0x81, 0x15, 0x8a, 0xbf, 0xa5, 0x02, 0xac, 0x3b, 0xdb, 0x4f, 0x7a, 0x43, - 0xbc, 0xb8, 0xb9, 0x08, 0x30, 0x7e, 0xd2, 0x1b, 0x36, 0xf1, 0x0d, 0xe4, 0x97, 0x0e, 0x19, 0x5a, - 0x83, 0xbe, 0x97, 0x5c, 0x81, 0x1c, 0x36, 0xf3, 0x57, 0x04, 0xef, 0x1a, 0x52, 0x66, 0x96, 0xd6, - 0x71, 0x27, 0x19, 0x86, 0x54, 0x0d, 0xbc, 0x62, 0x48, 0x0a, 0x90, 0xaa, 0x41, 0x2e, 0x03, 0x16, - 0x9b, 0x63, 0x8c, 0xa6, 0x78, 0xad, 0x90, 0x31, 0xb1, 0x5f, 0x16, 0x5f, 0xc9, 0xeb, 0x80, 0x7d, - 0xb2, 0x99, 0xe7, 0x67, 0xbd, 0x25, 0xde, 0x80, 0x97, 0xe8, 0x03, 0x9b, 0x6f, 0x60, 0xb2, 0xd8, - 0x80, 0x8c, 0x5f, 0x4f, 0x7b, 0xc3, 0x5a, 0x3e, 0x27, 0x0d, 0xe7, 0x04, 0x58, 0xe5, 0x4f, 0x8a, - 0x01, 0xf8, 0x78, 0x16, 0x70, 0x3c, 0xcc, 0x88, 0x0d, 0xa8, 0x78, 0x11, 0xe6, 0xb6, 0x1c, 0x9b, - 0xbd, 0xc7, 0xb8, 0x4e, 0x39, 0x50, 0x5a, 0x05, 0x05, 0xcf, 0xbf, 0x4a, 0xab, 0x78, 0x09, 0x40, - 0x68, 0xd3, 0x40, 0xd9, 0x65, 0x6d, 0xe8, 0x0f, 0x94, 0xdd, 0xe2, 0x35, 0x48, 0x6e, 0xb6, 0x0e, - 0x76, 0x5a, 0x5d, 0x72, 0x05, 0xa0, 0xdf, 0x1a, 0xbb, 0xcd, 0x0e, 0xee, 0xc4, 0xe7, 0x9f, 0x7f, - 0xfe, 0xb9, 0x82, 0xc9, 0x74, 0x86, 0xd6, 0xb2, 0x1d, 0x19, 0x03, 0x34, 0xfa, 0xed, 0x4d, 0x6b, - 0x3c, 0x6e, 0x75, 0x2d, 0xb2, 0x0a, 0x49, 0xdb, 0x1a, 0xd3, 0xe8, 0xab, 0xe0, 0x5d, 0xd3, 0x45, - 0x71, 0x1d, 0x02, 0xdc, 0xd2, 0x16, 0x82, 0x4c, 0x0e, 0x26, 0x1a, 0xc4, 0xec, 0xc9, 0x00, 0x6f, - 0xd4, 0x12, 0x26, 0x7d, 0x5c, 0x7c, 0x1e, 0x92, 0x0c, 0x43, 0x08, 0xc4, 0xed, 0xd6, 0xc0, 0x2a, - 0xb0, 0x9e, 0xf1, 0xb9, 0xf8, 0x55, 0x05, 0x60, 0xcb, 0x7a, 0x7a, 0xac, 0x5e, 0x03, 0x9c, 0xa4, - 0xd7, 0x18, 0xeb, 0xf5, 0x55, 0x59, 0xaf, 0x54, 0x6d, 0x1d, 0xc7, 0x69, 0x37, 0xd9, 0x46, 0xb3, - 0xeb, 0xbf, 0x0c, 0xad, 0xc1, 0x9d, 0x2b, 0x3e, 0x86, 0xdc, 0x86, 0x6d, 0x5b, 0x23, 0x6f, 0x54, - 0x04, 0xe2, 0xfb, 0xce, 0xd8, 0xe5, 0x37, 0x91, 0xf8, 0x4c, 0x0a, 0x10, 0x1f, 0x3a, 0x23, 0x97, - 0xcd, 0xb4, 0x16, 0x37, 0x96, 0x97, 0x97, 0x4d, 0xac, 0x21, 0xcf, 0x43, 0x66, 0xcf, 0xb1, 0x6d, - 0x6b, 0x8f, 0x4e, 0x23, 0x86, 0x47, 0xc7, 0xa0, 0xa2, 0xf8, 0xcb, 0x0a, 0xe4, 0x1a, 0xee, 0x7e, - 0x40, 0xae, 0x41, 0xec, 0x89, 0x75, 0x88, 0xc3, 0x8b, 0x99, 0xf4, 0x91, 0xbe, 0x30, 0x5f, 0x69, - 0xf5, 0x27, 0xec, 0x5e, 0x32, 0x67, 0xb2, 0x02, 0x39, 0x0b, 0xc9, 0xa7, 0x56, 0xaf, 0xbb, 0xef, - 0x22, 0xa7, 0x6a, 0xf2, 0x12, 0x59, 0x82, 0x44, 0x8f, 0x0e, 0xb6, 0x10, 0xc7, 0x15, 0x2b, 0x88, - 0x2b, 0x26, 0xce, 0xc2, 0x64, 0xb0, 0xab, 0xe9, 0x74, 0x5b, 0x7b, 0xff, 0xfd, 0xf7, 0xdf, 0x57, - 0x8b, 0xfb, 0x70, 0xc6, 0x7b, 0x89, 0x43, 0xd3, 0x7d, 0x04, 0x85, 0xbe, 0xe5, 0x34, 0x3b, 0x3d, - 0xbb, 0xd5, 0xef, 0x1f, 0x36, 0x9f, 0x3a, 0x76, 0xb3, 0x65, 0x37, 0x9d, 0xf1, 0x5e, 0x6b, 0x84, - 0x4b, 0x20, 0xeb, 0xe4, 0x4c, 0xdf, 0x72, 0xea, 0xcc, 0xf0, 0x5d, 0xc7, 0xbe, 0x63, 0x37, 0xa8, - 0x55, 0xf1, 0xb3, 0x38, 0x64, 0x36, 0x0f, 0x3d, 0xfe, 0x33, 0x90, 0xd8, 0x73, 0x26, 0x36, 0x5b, - 0xcf, 0x84, 0xc9, 0x0a, 0xfe, 0x3e, 0xa9, 0xc2, 0x3e, 0x9d, 0x81, 0xc4, 0x7b, 0x13, 0xc7, 0xb5, - 0x70, 0xca, 0x19, 0x93, 0x15, 0xe8, 0x8a, 0x0d, 0x2d, 0xb7, 0x10, 0xc7, 0x6b, 0x0a, 0xfa, 0x18, - 0xac, 0x41, 0xe2, 0x58, 0x6b, 0x40, 0x96, 0x21, 0xe9, 0xd0, 0x3d, 0x18, 0x17, 0x92, 0x78, 0x0f, - 0x1b, 0x32, 0x10, 0x77, 0xc7, 0xe4, 0x38, 0xf2, 0x00, 0x16, 0x9e, 0x5a, 0xcd, 0xc1, 0x64, 0xec, - 0x36, 0xbb, 0x4e, 0xb3, 0x6d, 0x59, 0x43, 0x6b, 0x54, 0x98, 0xc3, 0xde, 0x42, 0x1e, 0x62, 0xd6, - 0x82, 0x9a, 0xf3, 0x4f, 0xad, 0xcd, 0xc9, 0xd8, 0x5d, 0x77, 0xee, 0xa3, 0x1d, 0x59, 0x85, 0xcc, - 0xc8, 0xa2, 0x7e, 0x81, 0x0e, 0x39, 0x37, 0x3d, 0x82, 0x90, 0x71, 0x7a, 0x64, 0x0d, 0xb1, 0x82, - 0xdc, 0x84, 0xf4, 0x6e, 0xef, 0x89, 0x35, 0xde, 0xb7, 0xda, 0x85, 0x94, 0xae, 0x94, 0xe6, 0xcb, - 0x17, 0x44, 0x2b, 0x7f, 0x81, 0x97, 0xee, 0x39, 0x7d, 0x67, 0x64, 0xfa, 0x60, 0xf2, 0x1a, 0x64, - 0xc6, 0xce, 0xc0, 0x62, 0x6a, 0x4f, 0x63, 0xb0, 0xbd, 0x3c, 0xdb, 0x72, 0xdb, 0x19, 0x58, 0x9e, - 0x57, 0xf3, 0x2c, 0xc8, 0x05, 0x36, 0xdc, 0x5d, 0x7a, 0x98, 0x28, 0x00, 0x5e, 0xf8, 0xd0, 0x41, - 0xe1, 0xe1, 0x82, 0x2c, 0xd2, 0x41, 0x75, 0x3b, 0x34, 0x67, 0x2b, 0x64, 0xf1, 0x2c, 0xef, 0x97, - 0x17, 0x5f, 0x81, 0x8c, 0x4f, 0x18, 0xb8, 0x43, 0xe6, 0x82, 0x32, 0xe8, 0x21, 0x98, 0x3b, 0x64, - 0xfe, 0xe7, 0x45, 0x48, 0xe0, 0xc0, 0x69, 0xe4, 0x32, 0xd7, 0x68, 0xa0, 0xcc, 0x40, 0x62, 0xdd, - 0x5c, 0x5b, 0xdb, 0xd2, 0x14, 0x8c, 0x99, 0x0f, 0xdf, 0x5e, 0xd3, 0x54, 0x41, 0xbf, 0xbf, 0xad, - 0x42, 0x6c, 0xed, 0x00, 0x95, 0xd3, 0x6e, 0xb9, 0x2d, 0xef, 0x0d, 0xa7, 0xcf, 0xa4, 0x06, 0x99, - 0x41, 0xcb, 0xeb, 0x4b, 0xc5, 0x25, 0x0e, 0xf9, 0x92, 0xb5, 0x03, 0x77, 0x69, 0xb3, 0xc5, 0x7a, - 0x5e, 0xb3, 0xdd, 0xd1, 0xa1, 0x99, 0x1e, 0xf0, 0xe2, 0xe2, 0xab, 0x30, 0x17, 0x6a, 0x12, 0x5f, - 0xd1, 0xc4, 0x8c, 0x57, 0x34, 0xc1, 0x5f, 0xd1, 0x9a, 0x7a, 0x4b, 0x29, 0xd7, 0x20, 0x3e, 0x70, - 0x46, 0x16, 0x79, 0x6e, 0xe6, 0x02, 0x17, 0xba, 0x28, 0x99, 0x7c, 0x64, 0x28, 0x26, 0xda, 0x94, - 0x5f, 0x86, 0xb8, 0x6b, 0x1d, 0xb8, 0xcf, 0xb2, 0xdd, 0x67, 0xf3, 0xa3, 0x90, 0xf2, 0x75, 0x48, - 0xda, 0x93, 0xc1, 0xae, 0x35, 0x7a, 0x16, 0xb8, 0x87, 0x03, 0xe3, 0xa0, 0xe2, 0x3b, 0xa0, 0xdd, - 0x73, 0x06, 0xc3, 0xbe, 0x75, 0xb0, 0x76, 0xe0, 0x5a, 0xf6, 0xb8, 0xe7, 0xd8, 0x74, 0x0e, 0x9d, - 0xde, 0x08, 0xdd, 0x1a, 0xce, 0x01, 0x0b, 0xd4, 0xcd, 0x8c, 0xad, 0x3d, 0xc7, 0x6e, 0xf3, 0xa9, - 0xf1, 0x12, 0x45, 0xbb, 0xfb, 0xbd, 0x11, 0xf5, 0x68, 0x34, 0xf8, 0xb0, 0x42, 0x71, 0x1d, 0xf2, - 0xfc, 0x18, 0x36, 0xe6, 0x1d, 0x17, 0xaf, 0x42, 0xce, 0xab, 0xc2, 0x5f, 0x7e, 0xd2, 0x10, 0x7f, - 0xbc, 0x66, 0x36, 0xb4, 0x53, 0x74, 0x5f, 0x1b, 0x5b, 0x6b, 0x9a, 0x42, 0x1f, 0x76, 0xde, 0x6d, - 0x84, 0xf6, 0xf2, 0x79, 0xc8, 0xf9, 0x63, 0xdf, 0xb6, 0x5c, 0x6c, 0xa1, 0x51, 0x2a, 0x55, 0x53, - 0xd3, 0x4a, 0x31, 0x05, 0x89, 0xb5, 0xc1, 0xd0, 0x3d, 0x2c, 0xfe, 0x12, 0x64, 0x39, 0xe8, 0x61, - 0x6f, 0xec, 0x92, 0xdb, 0x90, 0x1a, 0xf0, 0xf9, 0x2a, 0x98, 0x8b, 0x86, 0x65, 0x1d, 0x20, 0xbd, - 0x67, 0xd3, 0xc3, 0x2f, 0x56, 0x20, 0x25, 0xb8, 0x77, 0xee, 0x79, 0x54, 0xd1, 0xf3, 0x30, 0x1f, - 0x15, 0x13, 0x7c, 0x54, 0x71, 0x13, 0x52, 0x2c, 0x30, 0x8f, 0x31, 0xdd, 0x60, 0xe7, 0x77, 0xa6, - 0x31, 0x26, 0xbe, 0x2c, 0xab, 0x63, 0x39, 0xd4, 0x65, 0xc8, 0xe2, 0x3b, 0xe3, 0xab, 0x90, 0x7a, - 0x73, 0xc0, 0x2a, 0xa6, 0xf8, 0x3f, 0x4a, 0x40, 0xda, 0x5b, 0x2b, 0x72, 0x01, 0x92, 0xec, 0x10, - 0x8b, 0x54, 0xde, 0xa5, 0x4e, 0x02, 0x8f, 0xad, 0xe4, 0x02, 0xa4, 0xf8, 0x41, 0x95, 0x07, 0x1c, - 0xb5, 0x52, 0x36, 0x93, 0xec, 0x60, 0xea, 0x37, 0x56, 0x0d, 0xf4, 0x93, 0xec, 0xba, 0x26, 0xc9, - 0x8e, 0x9e, 0x44, 0x87, 0x8c, 0x7f, 0xd8, 0xc4, 0x10, 0xc1, 0xef, 0x66, 0xd2, 0xde, 0xe9, 0x52, - 0x40, 0x54, 0x0d, 0x74, 0xa0, 0xfc, 0x22, 0x26, 0x5d, 0x0f, 0xf2, 0xa6, 0xb4, 0x77, 0x64, 0xc4, - 0x5f, 0x9e, 0xbc, 0x5b, 0x97, 0x14, 0x3f, 0x24, 0x06, 0x80, 0xaa, 0x81, 0x9e, 0xc9, 0xbb, 0x62, - 0x49, 0xf1, 0x83, 0x20, 0xb9, 0x4c, 0x87, 0x88, 0x07, 0x3b, 0xf4, 0x3f, 0xc1, 0x7d, 0x4a, 0x92, - 0x1d, 0xf7, 0xc8, 0x15, 0xca, 0xc0, 0x4e, 0x6f, 0xe8, 0x1a, 0x82, 0xcb, 0x93, 0x14, 0x3f, 0xd4, - 0x91, 0x6b, 0x14, 0xc2, 0x96, 0xbf, 0x00, 0xcf, 0xb8, 0x29, 0x49, 0xf1, 0x9b, 0x12, 0xa2, 0xd3, - 0x0e, 0xd1, 0x43, 0xa1, 0x57, 0x12, 0x6e, 0x45, 0x92, 0xec, 0x56, 0x84, 0x5c, 0x42, 0x3a, 0x36, - 0xa9, 0x5c, 0x70, 0x03, 0x92, 0xe2, 0xa7, 0xc0, 0xa0, 0x1d, 0x73, 0x49, 0xff, 0xb6, 0x23, 0xc5, - 0xcf, 0x79, 0xe4, 0x16, 0xdd, 0x2f, 0xaa, 0xf0, 0xc2, 0x3c, 0xfa, 0xe2, 0x45, 0x51, 0x7a, 0xde, - 0xae, 0x32, 0x57, 0x5c, 0x63, 0x6e, 0xcc, 0x4c, 0xd4, 0xf1, 0x8d, 0x58, 0xa4, 0x96, 0x8f, 0x7a, - 0x76, 0xa7, 0x90, 0xc7, 0xb5, 0x88, 0xf5, 0xec, 0x8e, 0x99, 0xa8, 0xd3, 0x1a, 0xa6, 0x82, 0x2d, - 0xda, 0xa6, 0x61, 0x5b, 0xfc, 0x3a, 0x6b, 0xa4, 0x55, 0xa4, 0x00, 0x89, 0x7a, 0x73, 0xab, 0x65, - 0x17, 0x16, 0x98, 0x9d, 0xdd, 0xb2, 0xcd, 0x78, 0x7d, 0xab, 0x65, 0x93, 0x97, 0x21, 0x36, 0x9e, - 0xec, 0x16, 0xc8, 0xf4, 0xcf, 0x82, 0xdb, 0x93, 0x5d, 0x6f, 0x30, 0x26, 0xc5, 0x90, 0x0b, 0x90, - 0x1e, 0xbb, 0xa3, 0xe6, 0x2f, 0x58, 0x23, 0xa7, 0x70, 0x1a, 0x97, 0xf1, 0x94, 0x99, 0x1a, 0xbb, - 0xa3, 0xc7, 0xd6, 0xc8, 0x39, 0xa6, 0x0f, 0x2e, 0x5e, 0x82, 0xac, 0xc0, 0x4b, 0xf2, 0xa0, 0xd8, - 0x2c, 0x81, 0xa9, 0x29, 0x37, 0x4d, 0xc5, 0x2e, 0xbe, 0x03, 0x39, 0xef, 0x88, 0x85, 0x33, 0x36, - 0xe8, 0xdb, 0xd4, 0x77, 0x46, 0xf8, 0x96, 0xce, 0x97, 0x2f, 0x85, 0x23, 0x66, 0x00, 0xe4, 0x91, - 0x8b, 0x81, 0x8b, 0x5a, 0x64, 0x30, 0x4a, 0xf1, 0x07, 0x0a, 0xe4, 0x36, 0x9d, 0x51, 0xf0, 0xfb, - 0xc5, 0x19, 0x48, 0xec, 0x3a, 0x4e, 0x7f, 0x8c, 0xc4, 0x69, 0x93, 0x15, 0xc8, 0x8b, 0x90, 0xc3, - 0x07, 0xef, 0x90, 0xac, 0xfa, 0xb7, 0x40, 0x59, 0xac, 0xe7, 0xe7, 0x62, 0x02, 0xf1, 0x9e, 0xed, - 0x8e, 0xb9, 0x47, 0xc3, 0x67, 0xf2, 0x05, 0xc8, 0xd2, 0xbf, 0x9e, 0x65, 0xdc, 0xcf, 0xa6, 0x81, - 0x56, 0x73, 0xc3, 0x97, 0x60, 0x0e, 0x35, 0xe0, 0xc3, 0x52, 0xfe, 0x8d, 0x4f, 0x8e, 0x35, 0x70, - 0x60, 0x01, 0x52, 0xcc, 0x21, 0x8c, 0xf1, 0x07, 0xdf, 0x8c, 0xe9, 0x15, 0xa9, 0x9b, 0xc5, 0x83, - 0x0a, 0xcb, 0x40, 0x52, 0x26, 0x2f, 0x15, 0xef, 0x41, 0x1a, 0xc3, 0x65, 0xa3, 0xdf, 0x26, 0x2f, - 0x80, 0xd2, 0x2d, 0x58, 0x18, 0xae, 0xcf, 0x86, 0x4e, 0x21, 0x1c, 0xb0, 0xb4, 0x6e, 0x2a, 0xdd, - 0xc5, 0x05, 0x50, 0xd6, 0xe9, 0xb1, 0xe0, 0x80, 0x3b, 0x6c, 0xe5, 0xa0, 0xf8, 0x16, 0x27, 0xd9, - 0xb2, 0x9e, 0xca, 0x49, 0xb6, 0xac, 0xa7, 0x8c, 0xe4, 0xf2, 0x14, 0x09, 0x2d, 0x1d, 0xf2, 0xdf, - 0xc0, 0x95, 0xc3, 0x62, 0x05, 0xe6, 0xf0, 0x45, 0xed, 0xd9, 0xdd, 0x47, 0x4e, 0xcf, 0xc6, 0x83, - 0x48, 0x07, 0x13, 0x38, 0xc5, 0x54, 0x3a, 0x74, 0x1f, 0xac, 0x83, 0xd6, 0x1e, 0x4b, 0x87, 0xd3, - 0x26, 0x2b, 0x14, 0xbf, 0x1f, 0x87, 0x79, 0xee, 0x64, 0xdf, 0xed, 0xb9, 0xfb, 0x9b, 0xad, 0x21, - 0xd9, 0x82, 0x1c, 0xf5, 0xaf, 0xcd, 0x41, 0x6b, 0x38, 0xa4, 0x2f, 0xb2, 0x82, 0xa1, 0xf9, 0xda, - 0x0c, 0xb7, 0xcd, 0x2d, 0x96, 0xb6, 0x5a, 0x03, 0x6b, 0x93, 0xa1, 0x59, 0xa0, 0xce, 0xda, 0x41, - 0x0d, 0x79, 0x00, 0xd9, 0xc1, 0xb8, 0xeb, 0xd3, 0xb1, 0x48, 0x7f, 0x55, 0x42, 0xb7, 0x39, 0xee, - 0x86, 0xd8, 0x60, 0xe0, 0x57, 0xd0, 0xc1, 0x51, 0xef, 0xec, 0xb3, 0xc5, 0x8e, 0x1c, 0x1c, 0x75, - 0x25, 0xe1, 0xc1, 0xed, 0x06, 0x35, 0xa4, 0x0e, 0x40, 0x5f, 0x35, 0xd7, 0xa1, 0x27, 0x3c, 0xd4, - 0x52, 0xb6, 0x5c, 0x92, 0xb0, 0x6d, 0xbb, 0xa3, 0x1d, 0x67, 0xdb, 0x1d, 0xf1, 0x84, 0x64, 0xcc, - 0x8b, 0x8b, 0xaf, 0x83, 0x16, 0x5d, 0x85, 0xa3, 0x72, 0x92, 0x8c, 0x90, 0x93, 0x2c, 0xfe, 0x1c, - 0xe4, 0x23, 0xd3, 0x16, 0xcd, 0x09, 0x33, 0xbf, 0x21, 0x9a, 0x67, 0xcb, 0xe7, 0x43, 0xdf, 0x68, - 0x88, 0x5b, 0x2f, 0x32, 0xbf, 0x0e, 0x5a, 0x74, 0x09, 0x44, 0xea, 0xb4, 0xe4, 0x40, 0x83, 0xf6, - 0xaf, 0xc2, 0x5c, 0x68, 0xd2, 0xa2, 0x71, 0xe6, 0x88, 0x69, 0x15, 0x7f, 0x25, 0x01, 0x89, 0x86, - 0x6d, 0x39, 0x1d, 0x72, 0x2e, 0x1c, 0x3b, 0xdf, 0x3c, 0xe5, 0xc5, 0xcd, 0xf3, 0x91, 0xb8, 0xf9, - 0xe6, 0x29, 0x3f, 0x6a, 0x9e, 0x8f, 0x44, 0x4d, 0xaf, 0xa9, 0x6a, 0x90, 0x8b, 0x53, 0x31, 0xf3, - 0xcd, 0x53, 0x42, 0xc0, 0xbc, 0x38, 0x15, 0x30, 0x83, 0xe6, 0xaa, 0x41, 0x1d, 0x6c, 0x38, 0x5a, - 0xbe, 0x79, 0x2a, 0x88, 0x94, 0x17, 0xa2, 0x91, 0xd2, 0x6f, 0xac, 0x1a, 0x6c, 0x48, 0x42, 0x94, - 0xc4, 0x21, 0xb1, 0xf8, 0x78, 0x21, 0x1a, 0x1f, 0xd1, 0x8e, 0x47, 0xc6, 0x0b, 0xd1, 0xc8, 0x88, - 0x8d, 0x3c, 0x12, 0x9e, 0x8f, 0x44, 0x42, 0x24, 0x65, 0x21, 0xf0, 0x42, 0x34, 0x04, 0x32, 0x3b, - 0x61, 0xa4, 0x62, 0xfc, 0xf3, 0x1b, 0xab, 0x06, 0x31, 0x22, 0xc1, 0x4f, 0x76, 0x10, 0xc1, 0xdd, - 0xc0, 0x30, 0x50, 0xa5, 0x0b, 0xe7, 0x25, 0xa8, 0x79, 0xe9, 0x27, 0x2c, 0xb8, 0xa2, 0x5e, 0x82, - 0x66, 0x40, 0xaa, 0xc3, 0xcf, 0xea, 0x1a, 0x7a, 0xb2, 0x90, 0x38, 0x51, 0x02, 0x4b, 0xf5, 0x26, - 0x7a, 0x34, 0x3a, 0xbb, 0x0e, 0x3b, 0x70, 0x94, 0x60, 0xae, 0xde, 0x7c, 0xd8, 0x1a, 0x75, 0x29, - 0x74, 0xa7, 0xd5, 0xf5, 0x6f, 0x3d, 0xa8, 0x0a, 0xb2, 0x75, 0xde, 0xb2, 0xd3, 0xea, 0x92, 0xb3, - 0x9e, 0xc4, 0xda, 0xd8, 0xaa, 0x70, 0x91, 0x2d, 0x9e, 0xa3, 0x4b, 0xc7, 0xc8, 0xd0, 0x37, 0x2e, - 0x70, 0xdf, 0x78, 0x37, 0x05, 0x89, 0x89, 0xdd, 0x73, 0xec, 0xbb, 0x19, 0x48, 0xb9, 0xce, 0x68, - 0xd0, 0x72, 0x9d, 0xe2, 0x0f, 0x15, 0x80, 0x7b, 0xce, 0x60, 0x30, 0xb1, 0x7b, 0xef, 0x4d, 0x2c, - 0x72, 0x09, 0xb2, 0x83, 0xd6, 0x13, 0xab, 0x39, 0xb0, 0x9a, 0x7b, 0x23, 0xef, 0x6d, 0xc8, 0xd0, - 0xaa, 0x4d, 0xeb, 0xde, 0xe8, 0x90, 0x14, 0xbc, 0x04, 0x1e, 0x15, 0x84, 0xc2, 0xe4, 0x09, 0xfd, - 0x19, 0x9e, 0x8e, 0x26, 0xf9, 0x4e, 0x7a, 0x09, 0x29, 0x3b, 0xe4, 0xa4, 0xf8, 0x1e, 0xb2, 0x63, - 0xce, 0x39, 0x48, 0xba, 0xd6, 0x60, 0xd8, 0xdc, 0x43, 0xc1, 0x50, 0x51, 0x24, 0x68, 0xf9, 0x1e, - 0xb9, 0x01, 0xb1, 0x3d, 0xa7, 0x8f, 0x52, 0x39, 0x72, 0x77, 0x28, 0x92, 0xbc, 0x04, 0xb1, 0xc1, - 0x98, 0xc9, 0x27, 0x5b, 0x3e, 0x1d, 0xca, 0x20, 0x58, 0xc8, 0xa2, 0xc0, 0xc1, 0xb8, 0xeb, 0xcf, - 0xbd, 0xf8, 0xa9, 0x0a, 0x69, 0xba, 0x5f, 0x6f, 0xef, 0xd4, 0x6f, 0xe1, 0xb1, 0x61, 0xaf, 0xd5, - 0xc7, 0x1b, 0x02, 0xfa, 0x9a, 0xf2, 0x12, 0xad, 0xff, 0x8a, 0xb5, 0xe7, 0x3a, 0x23, 0x74, 0xcd, - 0x19, 0x93, 0x97, 0xe8, 0x92, 0xb3, 0xac, 0x38, 0xc6, 0x67, 0xc9, 0x8a, 0x98, 0xd1, 0xb7, 0x86, - 0x4d, 0xea, 0x03, 0x98, 0xbf, 0x0c, 0x9d, 0xae, 0xbd, 0xee, 0xe8, 0xd1, 0xed, 0x81, 0x75, 0xc8, - 0xfc, 0x64, 0x72, 0x80, 0x05, 0xf2, 0xb3, 0xec, 0xc8, 0xc7, 0x76, 0x92, 0x7d, 0x5f, 0x55, 0x7c, - 0x96, 0xf1, 0x3b, 0x14, 0x14, 0x9c, 0xfb, 0xb0, 0xb8, 0x78, 0x1b, 0xb2, 0x02, 0xef, 0x51, 0xae, - 0x28, 0x16, 0xf1, 0x63, 0x21, 0xd6, 0xa3, 0x6e, 0x75, 0x44, 0x3f, 0x46, 0x57, 0xd4, 0xa1, 0x1a, - 0xbe, 0x9a, 0x87, 0x58, 0xbd, 0xd1, 0xa0, 0x79, 0x56, 0xbd, 0xd1, 0x58, 0xd1, 0x94, 0xda, 0x0a, - 0xa4, 0xbb, 0x23, 0xcb, 0xa2, 0xae, 0xf7, 0x59, 0xe7, 0xbc, 0x2f, 0xe3, 0xb2, 0xfa, 0xb0, 0xda, - 0x5b, 0x90, 0xda, 0x63, 0x27, 0x3d, 0xf2, 0xcc, 0x5b, 0x8d, 0xc2, 0x1f, 0xb3, 0xdb, 0xb5, 0xe7, - 0x45, 0x40, 0xf4, 0x7c, 0x68, 0x7a, 0x3c, 0xb5, 0x1d, 0xc8, 0x8c, 0x9a, 0x47, 0x93, 0x7e, 0xc0, - 0x62, 0xb9, 0x9c, 0x34, 0x3d, 0xe2, 0x55, 0xb5, 0x75, 0x58, 0xb0, 0x1d, 0xef, 0x47, 0xbe, 0x66, - 0x9b, 0x7b, 0xb2, 0x59, 0x49, 0xb4, 0xd7, 0x81, 0xc5, 0x3e, 0x15, 0xb0, 0x1d, 0xde, 0xc0, 0xbc, - 0x5f, 0x6d, 0x0d, 0x34, 0x81, 0xa8, 0xc3, 0xdc, 0xa5, 0x8c, 0xa7, 0xc3, 0xbe, 0x4e, 0xf0, 0x79, - 0xd0, 0xc3, 0x46, 0x68, 0xb8, 0x0f, 0x94, 0xd1, 0x74, 0xd9, 0xc7, 0x1e, 0x3e, 0x0d, 0x86, 0x95, - 0x69, 0x1a, 0x1a, 0x11, 0x64, 0x34, 0xfb, 0xec, 0x4b, 0x10, 0x91, 0xa6, 0x6a, 0x44, 0x56, 0x67, - 0x72, 0x8c, 0xe1, 0xf4, 0xd8, 0xa7, 0x1c, 0x3e, 0x0f, 0x0b, 0x38, 0x33, 0x88, 0x8e, 0x1a, 0xd0, - 0x97, 0xd9, 0x77, 0x1e, 0x21, 0xa2, 0xa9, 0x11, 0x8d, 0x8f, 0x31, 0xa2, 0x27, 0xec, 0xb3, 0x0a, - 0x9f, 0x68, 0x7b, 0xd6, 0x88, 0xc6, 0xc7, 0x18, 0x51, 0x9f, 0x7d, 0x72, 0x11, 0x22, 0xaa, 0x1a, - 0xb5, 0x0d, 0x20, 0xe2, 0xc6, 0xf3, 0xe8, 0x2c, 0x65, 0x1a, 0xb0, 0x4f, 0x69, 0x82, 0xad, 0x67, - 0x46, 0xb3, 0xa8, 0x8e, 0x1a, 0x94, 0xcd, 0xbe, 0xb3, 0x09, 0x53, 0x55, 0x8d, 0xda, 0x03, 0x38, - 0x2d, 0x4e, 0xef, 0x58, 0xc3, 0x72, 0xd8, 0x47, 0x22, 0xc1, 0x04, 0xb9, 0xd5, 0x4c, 0xb2, 0xa3, - 0x06, 0x36, 0x64, 0x1f, 0x90, 0x44, 0xc8, 0xaa, 0x46, 0xed, 0x1e, 0xe4, 0x05, 0xb2, 0x5d, 0xbc, - 0x57, 0x90, 0x11, 0xbd, 0xc7, 0x3e, 0x7b, 0xf2, 0x89, 0x68, 0x46, 0x15, 0xdd, 0x3d, 0x96, 0x63, - 0x48, 0x69, 0x46, 0xec, 0xab, 0x9d, 0x60, 0x3c, 0x68, 0x13, 0x79, 0x51, 0x76, 0x59, 0x42, 0x22, - 0xe3, 0x19, 0xb3, 0x2f, 0x7a, 0x82, 0xe1, 0x50, 0x93, 0xda, 0x20, 0x34, 0x29, 0x8b, 0xa6, 0x19, - 0x52, 0x16, 0x17, 0x23, 0x62, 0x49, 0x02, 0x59, 0x12, 0xaf, 0xaf, 0x84, 0xe9, 0xd3, 0x62, 0xed, - 0x01, 0xcc, 0x9f, 0xc4, 0x65, 0x7d, 0xa0, 0xb0, 0xbb, 0x8c, 0xca, 0xd2, 0x8a, 0xb1, 0xb2, 0x6a, - 0xce, 0xb5, 0x43, 0x9e, 0x6b, 0x1d, 0xe6, 0x4e, 0xe0, 0xb6, 0x3e, 0x54, 0xd8, 0x8d, 0x00, 0xe5, - 0x32, 0x73, 0xed, 0xb0, 0xef, 0x9a, 0x3b, 0x81, 0xe3, 0xfa, 0x48, 0x61, 0x57, 0x48, 0x46, 0xd9, - 0xa7, 0xf1, 0x7c, 0xd7, 0xdc, 0x09, 0x1c, 0xd7, 0xc7, 0xec, 0xc4, 0xaf, 0x1a, 0x15, 0x91, 0x06, - 0x3d, 0xc5, 0xfc, 0x49, 0x1c, 0xd7, 0x27, 0x0a, 0x5e, 0x29, 0xa9, 0x86, 0xe1, 0xaf, 0x8f, 0xef, - 0xbb, 0xe6, 0x4f, 0xe2, 0xb8, 0xbe, 0xa6, 0xe0, 0xd5, 0x93, 0x6a, 0xac, 0x86, 0x88, 0xc2, 0x23, - 0x3a, 0x8e, 0xe3, 0xfa, 0x54, 0xc1, 0xfb, 0x20, 0xd5, 0xa8, 0xfa, 0x44, 0xdb, 0x53, 0x23, 0x3a, - 0x8e, 0xe3, 0xfa, 0x3a, 0x9e, 0xaf, 0x6a, 0xaa, 0x71, 0x33, 0x44, 0x84, 0xbe, 0x2b, 0x7f, 0x22, - 0xc7, 0xf5, 0x0d, 0x05, 0xaf, 0xee, 0x54, 0xe3, 0x96, 0xe9, 0x8d, 0x20, 0xf0, 0x5d, 0xf9, 0x13, - 0x39, 0xae, 0x6f, 0x2a, 0x78, 0xc7, 0xa7, 0x1a, 0xb7, 0xc3, 0x54, 0xe8, 0xbb, 0xb4, 0x93, 0x39, - 0xae, 0xcf, 0x14, 0xfc, 0xa2, 0x47, 0x5d, 0x5d, 0x36, 0xbd, 0x41, 0x08, 0xbe, 0x4b, 0x3b, 0x99, - 0xe3, 0xfa, 0x96, 0x82, 0x9f, 0xf9, 0xa8, 0xab, 0x2b, 0x11, 0xb2, 0xaa, 0x51, 0x5b, 0x83, 0xdc, - 0xf1, 0x1d, 0xd7, 0xb7, 0xc5, 0x1b, 0xd4, 0x6c, 0x5b, 0xf0, 0x5e, 0x8f, 0x85, 0xfd, 0x3b, 0x86, - 0xeb, 0xfa, 0x0e, 0x26, 0x7f, 0xb5, 0xe7, 0xde, 0x64, 0xf7, 0x8c, 0xcc, 0xe4, 0x95, 0xb6, 0xd5, - 0x79, 0xad, 0xe3, 0x38, 0xc1, 0x96, 0x32, 0x87, 0xd6, 0x08, 0xde, 0x9e, 0x63, 0x78, 0xb3, 0xef, - 0x2a, 0x78, 0x2d, 0x99, 0xe3, 0xd4, 0x68, 0xe1, 0xbf, 0x47, 0xcc, 0xb5, 0xd9, 0xc1, 0x9c, 0x8f, - 0xf6, 0x6b, 0xdf, 0x53, 0x4e, 0xe6, 0xd8, 0x6a, 0xb1, 0xc6, 0xd6, 0x9a, 0xbf, 0x38, 0x58, 0xf3, - 0x06, 0xc4, 0x0f, 0xca, 0xcb, 0x2b, 0xe1, 0x14, 0x4f, 0xbc, 0x95, 0x67, 0xee, 0x2c, 0x5b, 0x5e, - 0x08, 0xfd, 0x7c, 0x31, 0x18, 0xba, 0x87, 0x26, 0x5a, 0x72, 0x86, 0xb2, 0x84, 0xe1, 0x43, 0x29, - 0x43, 0x99, 0x33, 0x54, 0x24, 0x0c, 0x1f, 0x49, 0x19, 0x2a, 0x9c, 0xc1, 0x90, 0x30, 0x7c, 0x2c, - 0x65, 0x30, 0x38, 0xc3, 0xaa, 0x84, 0xe1, 0x13, 0x29, 0xc3, 0x2a, 0x67, 0xa8, 0x4a, 0x18, 0xbe, - 0x26, 0x65, 0xa8, 0x72, 0x86, 0x9b, 0x12, 0x86, 0x4f, 0xa5, 0x0c, 0x37, 0x39, 0xc3, 0x2d, 0x09, - 0xc3, 0xd7, 0xa5, 0x0c, 0xb7, 0x38, 0xc3, 0x6d, 0x09, 0xc3, 0x37, 0xa4, 0x0c, 0xb7, 0x19, 0xc3, - 0xca, 0xb2, 0x84, 0xe1, 0x9b, 0x32, 0x86, 0x95, 0x65, 0xce, 0x20, 0xd3, 0xe4, 0x67, 0x52, 0x06, - 0xae, 0xc9, 0x15, 0x99, 0x26, 0xbf, 0x25, 0x65, 0xe0, 0x9a, 0x5c, 0x91, 0x69, 0xf2, 0xdb, 0x52, - 0x06, 0xae, 0xc9, 0x15, 0x99, 0x26, 0xbf, 0x23, 0x65, 0xe0, 0x9a, 0x5c, 0x91, 0x69, 0xf2, 0xbb, - 0x52, 0x06, 0xae, 0xc9, 0x15, 0x99, 0x26, 0xbf, 0x27, 0x65, 0xe0, 0x9a, 0x5c, 0x91, 0x69, 0xf2, - 0x4f, 0xa4, 0x0c, 0x5c, 0x93, 0x2b, 0x32, 0x4d, 0xfe, 0xa9, 0x94, 0x81, 0x6b, 0x72, 0x45, 0xa6, - 0xc9, 0x3f, 0x93, 0x32, 0x70, 0x4d, 0x96, 0x65, 0x9a, 0xfc, 0xbe, 0x8c, 0xa1, 0xcc, 0x35, 0x59, - 0x96, 0x69, 0xf2, 0xcf, 0xa5, 0x0c, 0x5c, 0x93, 0x65, 0x99, 0x26, 0xff, 0x42, 0xca, 0xc0, 0x35, - 0x59, 0x96, 0x69, 0xf2, 0x07, 0x52, 0x06, 0xae, 0xc9, 0xb2, 0x4c, 0x93, 0x7f, 0x29, 0x65, 0xe0, - 0x9a, 0x2c, 0xcb, 0x34, 0xf9, 0x57, 0x52, 0x06, 0xae, 0xc9, 0xb2, 0x4c, 0x93, 0x7f, 0x2d, 0x65, - 0xe0, 0x9a, 0x2c, 0xcb, 0x34, 0xf9, 0x37, 0x52, 0x06, 0xae, 0xc9, 0xb2, 0x4c, 0x93, 0x7f, 0x2b, - 0x65, 0xe0, 0x9a, 0x2c, 0xcb, 0x34, 0xf9, 0x77, 0x52, 0x06, 0xae, 0xc9, 0x8a, 0x4c, 0x93, 0x7f, - 0x2f, 0x63, 0xa8, 0x70, 0x4d, 0x56, 0x64, 0x9a, 0xfc, 0x07, 0x29, 0x03, 0xd7, 0x64, 0x45, 0xa6, - 0xc9, 0x7f, 0x94, 0x32, 0x70, 0x4d, 0x56, 0x64, 0x9a, 0xfc, 0x27, 0x29, 0x03, 0xd7, 0x64, 0x45, - 0xa6, 0xc9, 0x7f, 0x96, 0x32, 0x70, 0x4d, 0x56, 0x64, 0x9a, 0xfc, 0x17, 0x29, 0x03, 0xd7, 0x64, - 0x45, 0xa6, 0xc9, 0x7f, 0x95, 0x32, 0x70, 0x4d, 0x56, 0x64, 0x9a, 0xfc, 0x37, 0x29, 0x03, 0xd7, - 0x64, 0x45, 0xa6, 0xc9, 0x1f, 0x4a, 0x19, 0xb8, 0x26, 0x2b, 0x32, 0x4d, 0xfe, 0xbb, 0x94, 0x81, - 0x6b, 0xd2, 0x90, 0x69, 0xf2, 0x3f, 0x64, 0x0c, 0x06, 0xd7, 0xa4, 0x21, 0xd3, 0xe4, 0x7f, 0x4a, - 0x19, 0xb8, 0x26, 0x0d, 0x99, 0x26, 0xff, 0x4b, 0xca, 0xc0, 0x35, 0x69, 0xc8, 0x34, 0xf9, 0xdf, - 0x52, 0x06, 0xae, 0x49, 0x43, 0xa6, 0xc9, 0xff, 0x91, 0x32, 0x70, 0x4d, 0x1a, 0x32, 0x4d, 0xfe, - 0xaf, 0x94, 0x81, 0x6b, 0xd2, 0x90, 0x69, 0xf2, 0x47, 0x52, 0x06, 0xae, 0x49, 0x43, 0xa6, 0xc9, - 0x1f, 0x4b, 0x19, 0xb8, 0x26, 0x0d, 0x99, 0x26, 0x7f, 0x22, 0x65, 0xe0, 0x9a, 0x34, 0x64, 0x9a, - 0xfc, 0xa9, 0x94, 0x81, 0x6b, 0x72, 0x55, 0xa6, 0xc9, 0xff, 0x93, 0x31, 0xac, 0x2e, 0xdf, 0xbd, - 0xfe, 0xf8, 0x5a, 0xb7, 0xe7, 0xee, 0x4f, 0x76, 0x97, 0xf6, 0x9c, 0xc1, 0x8d, 0xae, 0xd3, 0x6f, - 0xd9, 0xdd, 0x1b, 0x08, 0xdb, 0x9d, 0x74, 0x6e, 0x04, 0xff, 0xcc, 0xce, 0x4c, 0xff, 0x3f, 0x00, - 0x00, 0xff, 0xff, 0x8e, 0xb4, 0x0c, 0xbd, 0xe4, 0x3e, 0x00, 0x00, +} + +func init() { proto.RegisterFile("proto2_proto/test.proto", fileDescriptor_e5b3e7ca68f98362) } + +var fileDescriptor_e5b3e7ca68f98362 = []byte{ + // 4330 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5b, 0x4b, 0x73, 0xdb, 0x58, + 0x76, 0x36, 0xc0, 0xf7, 0x21, 0x25, 0x42, 0xb7, 0xd5, 0x36, 0x2d, 0xb5, 0x6d, 0x98, 0x3d, 0x3d, + 0xc3, 0xb6, 0xdd, 0xb4, 0x4c, 0x51, 0xb4, 0x4d, 0x4f, 0x3b, 0x63, 0xd9, 0xa2, 0xac, 0xb4, 0x24, + 0x7a, 0x20, 0xb9, 0xbb, 0xda, 0xb3, 0x60, 0x41, 0x22, 0x48, 0x71, 0x4c, 0x02, 0x6c, 0x12, 0x1c, + 0x4b, 0xa9, 0x54, 0xaa, 0xb7, 0xd9, 0xa4, 0x2a, 0x99, 0xa4, 0x2a, 0x3f, 0x20, 0xdb, 0xc9, 0x63, + 0x97, 0x45, 0x7e, 0x40, 0x7a, 0x1e, 0x49, 0x26, 0xef, 0xac, 0x52, 0xf9, 0x07, 0x59, 0xe5, 0xb1, + 0xea, 0xa9, 0x73, 0xee, 0x05, 0x70, 0x01, 0x52, 0xaf, 0x95, 0x70, 0xef, 0xfd, 0xbe, 0x73, 0x5f, + 0x1f, 0xce, 0x39, 0xf7, 0x12, 0x82, 0x6b, 0xc3, 0x91, 0xe3, 0x3a, 0x95, 0x16, 0xfd, 0xb9, 0xef, + 0x5a, 0x63, 0xb7, 0x4c, 0x8f, 0x2c, 0x2b, 0x1a, 0xb0, 0xaa, 0x78, 0x0f, 0x92, 0x9b, 0xce, 0x86, + 0x3d, 0x19, 0xb0, 0x22, 0xc4, 0x3a, 0x8e, 0x53, 0x50, 0x74, 0xb5, 0x34, 0x5f, 0xd1, 0xca, 0x12, + 0xa8, 0xdc, 0x68, 0x36, 0x0d, 0x6c, 0x2c, 0x3e, 0x84, 0xec, 0xa6, 0xb3, 0x6f, 0x8d, 0xdd, 0x46, + 0xcf, 0xea, 0xb7, 0xd9, 0x22, 0x24, 0xb6, 0xcd, 0x03, 0xab, 0x4f, 0xa4, 0x8c, 0xc1, 0x0b, 0x8c, + 0x41, 0x7c, 0xff, 0x64, 0x68, 0x15, 0x54, 0xaa, 0xa4, 0xe7, 0xe2, 0xdf, 0x14, 0xb1, 0x1f, 0x64, + 0xb2, 0x7b, 0x10, 0xff, 0xac, 0x67, 0xb7, 0x45, 0x47, 0x85, 0x50, 0x47, 0x1c, 0x52, 0xfe, 0x6c, + 0x6b, 0xf7, 0x85, 0x41, 0x28, 0xec, 0x62, 0xdf, 0x3c, 0xe8, 0xa3, 0x35, 0x05, 0xbb, 0xa0, 0x02, + 0xd6, 0xbe, 0x32, 0x47, 0xe6, 0xa0, 0x10, 0xd3, 0x95, 0x52, 0xc2, 0xe0, 0x05, 0xf6, 0x14, 0xe6, + 0x0c, 0xeb, 0xab, 0x49, 0x6f, 0x64, 0xb5, 0x69, 0x7c, 0x85, 0xb8, 0xae, 0x96, 0xb2, 0x33, 0xbb, + 0xa0, 0x76, 0x23, 0x0c, 0xe7, 0xfc, 0xa1, 0x65, 0xba, 0x1e, 0x3f, 0xa1, 0xc7, 0xce, 0xe3, 0x4b, + 0x70, 0xe4, 0x37, 0x87, 0x6e, 0xcf, 0xb1, 0xcd, 0x3e, 0xe7, 0x27, 0x75, 0xe5, 0x6c, 0x7e, 0x08, + 0xce, 0xbe, 0x0b, 0xf9, 0x46, 0x6b, 0xdd, 0x71, 0xfa, 0xad, 0x91, 0x18, 0x57, 0x01, 0x74, 0xb5, + 0x94, 0x36, 0xe6, 0x1a, 0x58, 0xeb, 0x0d, 0x96, 0x95, 0x40, 0x6b, 0xb4, 0xb6, 0x6c, 0x77, 0xb5, + 0x12, 0x00, 0xb3, 0xba, 0x5a, 0x4a, 0x18, 0xf3, 0x0d, 0xaa, 0x9e, 0x42, 0xd6, 0xaa, 0x01, 0x32, + 0xa7, 0xab, 0xa5, 0x18, 0x47, 0xd6, 0xaa, 0x3e, 0xf2, 0x1e, 0xb0, 0x46, 0xab, 0xd1, 0x3b, 0xb6, + 0xda, 0xb2, 0xd5, 0x39, 0x5d, 0x2d, 0xa5, 0x0c, 0xad, 0x21, 0x1a, 0x66, 0xa0, 0x65, 0xcb, 0xf3, + 0xba, 0x5a, 0x4a, 0x7a, 0x68, 0xc9, 0xf6, 0x1d, 0x58, 0x68, 0xb4, 0x5e, 0xf7, 0xc2, 0x03, 0xce, + 0xeb, 0x6a, 0x69, 0xce, 0xc8, 0x37, 0x78, 0xfd, 0x34, 0x56, 0x36, 0xac, 0xe9, 0x6a, 0x29, 0x2e, + 0xb0, 0x92, 0x5d, 0x9a, 0x5d, 0xa3, 0xef, 0x98, 0x6e, 0x00, 0x5d, 0xd0, 0xd5, 0x92, 0x6a, 0xcc, + 0x37, 0xa8, 0x3a, 0x6c, 0xf5, 0x85, 0x33, 0x39, 0xe8, 0x5b, 0x01, 0x94, 0xe9, 0x6a, 0x49, 0x31, + 0xf2, 0x0d, 0x5e, 0x1f, 0xc6, 0xee, 0xb9, 0xa3, 0x9e, 0xdd, 0x0d, 0xb0, 0xef, 0x91, 0x96, 0xf3, + 0x0d, 0x5e, 0x1f, 0x1e, 0xc1, 0xfa, 0x89, 0x6b, 0x8d, 0x03, 0xa8, 0xa5, 0xab, 0xa5, 0x9c, 0x31, + 0xdf, 0xa0, 0xea, 0x88, 0xd5, 0xc8, 0x1a, 0x74, 0x74, 0xb5, 0xb4, 0x80, 0x56, 0x67, 0xac, 0xc1, + 0x5e, 0x64, 0x0d, 0xba, 0xba, 0x5a, 0x62, 0x02, 0x2b, 0xad, 0x41, 0x19, 0xde, 0x6b, 0xb4, 0xf6, + 0x3a, 0xd1, 0x8d, 0x3b, 0xd2, 0xd5, 0x52, 0xde, 0x58, 0x68, 0x78, 0x2d, 0xb3, 0xf0, 0xb2, 0xf5, + 0x9e, 0xae, 0x96, 0x34, 0x1f, 0x2f, 0xd9, 0x97, 0x35, 0xc9, 0xb5, 0x5e, 0x58, 0xd4, 0x63, 0x92, + 0x26, 0x79, 0x65, 0x58, 0x93, 0x02, 0xf8, 0xbe, 0x1e, 0x93, 0x35, 0x19, 0x41, 0x52, 0xf7, 0x02, + 0x79, 0x55, 0x8f, 0xc9, 0x9a, 0x14, 0xc8, 0x88, 0x26, 0x05, 0xf6, 0x9a, 0x1e, 0x0b, 0x6b, 0x72, + 0x0a, 0x2d, 0x5b, 0x2e, 0xe8, 0xb1, 0xb0, 0x26, 0x05, 0x3a, 0xac, 0x49, 0x01, 0xbe, 0xae, 0xc7, + 0x42, 0x9a, 0x8c, 0x62, 0x65, 0xc3, 0x4b, 0x7a, 0x2c, 0xa4, 0x49, 0x79, 0x76, 0x9e, 0x26, 0x05, + 0x74, 0x59, 0x8f, 0xc9, 0x9a, 0x94, 0xad, 0xfa, 0x9a, 0x14, 0xd0, 0x0f, 0xf4, 0x58, 0x48, 0x93, + 0x32, 0xd6, 0xd7, 0xa4, 0xc0, 0xde, 0xd0, 0x63, 0x21, 0x4d, 0x0a, 0xec, 0xc7, 0xb2, 0x26, 0x05, + 0xf4, 0x1b, 0x45, 0x8f, 0xc9, 0xa2, 0x14, 0xd0, 0xbb, 0x21, 0x51, 0x0a, 0xec, 0xcf, 0x11, 0x2b, + 0xab, 0x32, 0x0a, 0x96, 0x57, 0xe1, 0x17, 0x08, 0x96, 0x65, 0x29, 0xc0, 0xf7, 0x23, 0xb2, 0x14, + 0xf0, 0x5f, 0x22, 0x3c, 0xac, 0xcb, 0x69, 0x82, 0x6c, 0xff, 0x57, 0x48, 0x08, 0x0b, 0x53, 0x10, + 0x02, 0x61, 0x3a, 0xc2, 0x89, 0x16, 0x6e, 0xea, 0x8a, 0x2f, 0x4c, 0xcf, 0xb3, 0xca, 0xc2, 0xf4, + 0x81, 0xb7, 0x28, 0x6a, 0x08, 0x61, 0x4e, 0x21, 0x6b, 0xd5, 0x00, 0xa9, 0xeb, 0x4a, 0x20, 0x4c, + 0x1f, 0x19, 0x12, 0xa6, 0x8f, 0xbd, 0xad, 0x2b, 0xb2, 0x30, 0x67, 0xa0, 0x65, 0xcb, 0x45, 0x5d, + 0x91, 0x85, 0xe9, 0xa3, 0x65, 0x61, 0xfa, 0xe0, 0x0f, 0x75, 0x45, 0x12, 0xe6, 0x34, 0x56, 0x36, + 0xfc, 0x1d, 0x5d, 0x91, 0x84, 0x19, 0x9e, 0x1d, 0x17, 0xa6, 0x0f, 0xfd, 0x48, 0x57, 0x02, 0x61, + 0x86, 0xad, 0x0a, 0x61, 0xfa, 0xd0, 0xef, 0xea, 0x8a, 0x24, 0xcc, 0x30, 0x56, 0x08, 0xd3, 0xc7, + 0x7e, 0x8f, 0x42, 0xb5, 0x27, 0x4c, 0x1f, 0x2b, 0x09, 0xd3, 0x87, 0xfe, 0x0c, 0xc3, 0xba, 0x2f, + 0x4c, 0x1f, 0x2a, 0x0b, 0xd3, 0xc7, 0xfe, 0x39, 0x62, 0x03, 0x61, 0x4e, 0x83, 0xe5, 0x55, 0xf8, + 0x0b, 0x04, 0x07, 0xc2, 0xf4, 0xc1, 0x61, 0x61, 0xfa, 0xf0, 0xbf, 0x44, 0xb8, 0x2c, 0xcc, 0x59, + 0x04, 0xd9, 0xfe, 0x5f, 0x21, 0x41, 0x16, 0xa6, 0x4f, 0x28, 0xd3, 0x34, 0x51, 0x98, 0x6d, 0xab, + 0x63, 0x4e, 0xfa, 0x28, 0xe3, 0x12, 0x2a, 0xb3, 0x1e, 0x77, 0x47, 0x13, 0x0b, 0xe7, 0xea, 0x38, + 0xfd, 0x17, 0x5e, 0x1b, 0x2b, 0xe3, 0xf0, 0xb9, 0x40, 0x03, 0xc2, 0xc7, 0xa8, 0xd0, 0xba, 0xba, + 0x5a, 0x31, 0xf2, 0x5c, 0xa5, 0xd3, 0xf8, 0x5a, 0x55, 0xc2, 0xdf, 0x41, 0x9d, 0xd6, 0xd5, 0x5a, + 0x95, 0xe3, 0x6b, 0xd5, 0x00, 0xbf, 0x8a, 0x13, 0xf0, 0xc4, 0x1a, 0x30, 0xee, 0xa2, 0x5a, 0xeb, + 0xb1, 0xd5, 0xca, 0x8a, 0xb1, 0xe0, 0x49, 0x76, 0x16, 0x29, 0xd4, 0xcd, 0x3d, 0x14, 0x6d, 0x3d, + 0x56, 0xab, 0xfa, 0x24, 0xb9, 0xa7, 0x0a, 0x0a, 0x5d, 0x48, 0x37, 0xe0, 0x7c, 0x82, 0xda, 0xad, + 0xc7, 0x57, 0x2b, 0x2b, 0x2b, 0x86, 0x26, 0x14, 0x3c, 0x83, 0x13, 0xea, 0xa7, 0x8c, 0x1a, 0xae, + 0xc7, 0x6b, 0x55, 0x9f, 0x13, 0xee, 0x67, 0xc1, 0x93, 0x72, 0x40, 0xb9, 0x8f, 0x5a, 0xae, 0x27, + 0x57, 0x1f, 0x54, 0x1f, 0xac, 0x3d, 0x36, 0xf2, 0x5c, 0xd3, 0x01, 0xa7, 0x8a, 0xfd, 0x08, 0x51, + 0x07, 0xa4, 0x15, 0x54, 0x75, 0x3d, 0x59, 0x79, 0xf8, 0xe0, 0x51, 0xe5, 0x91, 0xa1, 0x09, 0x75, + 0x07, 0xac, 0xa7, 0xc8, 0x12, 0xf2, 0x0e, 0x58, 0x0f, 0x50, 0xdf, 0x75, 0xed, 0xc8, 0xea, 0xf7, + 0x9d, 0x7b, 0x7a, 0xf1, 0x9d, 0x33, 0xea, 0xb7, 0x6f, 0x17, 0xc1, 0xd0, 0x84, 0xe2, 0xe5, 0x5e, + 0x17, 0x3c, 0xc9, 0x07, 0xf4, 0x3f, 0xc4, 0xa4, 0x35, 0x57, 0x4f, 0xad, 0xf7, 0xba, 0xb6, 0x33, + 0xb6, 0x8c, 0x3c, 0x17, 0x7f, 0x64, 0x4d, 0xf6, 0xa2, 0xeb, 0xf8, 0x47, 0x48, 0x5b, 0xa8, 0xc7, + 0x3e, 0x59, 0xad, 0x60, 0x4f, 0xb3, 0xd6, 0x71, 0x2f, 0xba, 0x8e, 0x3f, 0x45, 0x0e, 0xab, 0xc7, + 0x3e, 0xa9, 0x55, 0x05, 0x47, 0x5e, 0xc7, 0x1a, 0x2c, 0x4a, 0xef, 0x42, 0xc0, 0xfa, 0x63, 0x64, + 0xe5, 0x79, 0x4f, 0xcc, 0x7f, 0x23, 0x66, 0xf2, 0x42, 0xbd, 0xfd, 0x09, 0xf2, 0x34, 0xde, 0x1b, + 0xf3, 0x5f, 0x8c, 0x80, 0xf7, 0x10, 0xae, 0x46, 0x72, 0x89, 0xd6, 0xd0, 0x3c, 0x7c, 0x6b, 0xb5, + 0x0b, 0x15, 0x4c, 0x29, 0xd6, 0x55, 0x4d, 0x31, 0xde, 0x0b, 0xa5, 0x15, 0xaf, 0xa8, 0x99, 0x3d, + 0x86, 0x6b, 0xd1, 0xe4, 0xc2, 0x63, 0xae, 0x62, 0x8e, 0x41, 0xcc, 0xc5, 0x70, 0x9e, 0x11, 0xa1, + 0x4a, 0x41, 0xc5, 0xa3, 0x56, 0x31, 0xe9, 0x08, 0xa8, 0x41, 0x6c, 0x11, 0xd4, 0x4f, 0xe1, 0xfa, + 0x74, 0xfa, 0xe1, 0x91, 0xd7, 0x30, 0x0b, 0x21, 0xf2, 0xd5, 0x68, 0x26, 0x32, 0x45, 0x9f, 0xd1, + 0x77, 0x0d, 0xd3, 0x12, 0x99, 0x3e, 0xd5, 0xfb, 0x13, 0x28, 0x4c, 0x25, 0x28, 0x1e, 0xfb, 0x21, + 0xe6, 0x29, 0xc4, 0x7e, 0x3f, 0x92, 0xab, 0x44, 0xc9, 0x33, 0xba, 0x7e, 0x84, 0x89, 0x8b, 0x44, + 0x9e, 0xea, 0x99, 0x96, 0x2c, 0x9c, 0xc2, 0x78, 0xdc, 0xc7, 0x98, 0xc9, 0x88, 0x25, 0x0b, 0x65, + 0x33, 0x72, 0xbf, 0x91, 0x9c, 0xc6, 0xe3, 0xd6, 0x31, 0xb5, 0x11, 0xfd, 0x86, 0xd3, 0x1b, 0x41, + 0xfe, 0x3e, 0x92, 0xf7, 0x66, 0xcf, 0xf8, 0x7f, 0x62, 0x98, 0x94, 0x08, 0xf6, 0xde, 0xac, 0x29, + 0xfb, 0xec, 0x19, 0x53, 0xfe, 0x5f, 0x64, 0x33, 0x89, 0x3d, 0x35, 0xe7, 0x1f, 0xc0, 0xd2, 0x8c, + 0x7c, 0xc5, 0xe3, 0xff, 0x1f, 0xf2, 0xf3, 0xc4, 0xbf, 0x36, 0x95, 0xba, 0x4c, 0x5b, 0x98, 0x31, + 0x82, 0xff, 0x47, 0x0b, 0x5a, 0xc8, 0xc2, 0xd4, 0x18, 0x36, 0x61, 0xce, 0xcb, 0xc7, 0xbb, 0x23, + 0x67, 0x32, 0x2c, 0x34, 0x74, 0xb5, 0x04, 0x95, 0xdb, 0xb3, 0x4e, 0xc8, 0x5e, 0x7e, 0xbe, 0x89, + 0x40, 0x23, 0xcc, 0xe3, 0x86, 0xb8, 0x69, 0x6e, 0xe8, 0x95, 0x1e, 0x3b, 0xdd, 0x10, 0x07, 0xfa, + 0x86, 0x24, 0x1e, 0x1a, 0xf2, 0x02, 0x1e, 0x37, 0xf4, 0x46, 0x57, 0x4e, 0x33, 0xe4, 0xc5, 0x3f, + 0x61, 0x28, 0xc4, 0x5b, 0x5a, 0x0b, 0x4e, 0xe6, 0xd4, 0xce, 0xbe, 0x13, 0x3d, 0xaa, 0x6f, 0xd2, + 0x01, 0x2b, 0x5c, 0xc9, 0x69, 0xd2, 0xf8, 0xa6, 0x69, 0x3f, 0x3c, 0x85, 0x16, 0x1a, 0xcd, 0x34, + 0xed, 0x47, 0x33, 0x68, 0xc5, 0x3f, 0x55, 0x20, 0xfe, 0xd9, 0xd6, 0xee, 0x0b, 0x96, 0x86, 0xf8, + 0xe7, 0xcd, 0xad, 0x17, 0xda, 0x15, 0x7c, 0x5a, 0x6f, 0x36, 0xb7, 0x35, 0x85, 0x65, 0x20, 0xb1, + 0xfe, 0xe5, 0xfe, 0xc6, 0x9e, 0xa6, 0xb2, 0x3c, 0x64, 0x1b, 0x5b, 0xbb, 0x9b, 0x1b, 0xc6, 0x2b, + 0x63, 0x6b, 0x77, 0x5f, 0x8b, 0x61, 0x5b, 0x63, 0xbb, 0xf9, 0x6c, 0x5f, 0x8b, 0xb3, 0x14, 0xc4, + 0xb0, 0x2e, 0xc1, 0x00, 0x92, 0x7b, 0xfb, 0xc6, 0xd6, 0xee, 0xa6, 0x96, 0x44, 0x2b, 0xfb, 0x5b, + 0x3b, 0x1b, 0x5a, 0x0a, 0x91, 0xfb, 0xaf, 0x5f, 0x6d, 0x6f, 0x68, 0x69, 0x7c, 0x7c, 0x66, 0x18, + 0xcf, 0xbe, 0xd4, 0x32, 0x48, 0xda, 0x79, 0xf6, 0x4a, 0x03, 0x6a, 0x7e, 0xb6, 0xbe, 0xbd, 0xa1, + 0x65, 0x59, 0x0e, 0xd2, 0x8d, 0xd7, 0xbb, 0xcf, 0xf7, 0xb7, 0x9a, 0xbb, 0x5a, 0xae, 0xf8, 0xbb, + 0x50, 0xe0, 0xcb, 0x1c, 0x5a, 0x45, 0x7e, 0x6b, 0xf0, 0x0c, 0x12, 0x7c, 0x73, 0x14, 0x92, 0xcb, + 0xdd, 0x19, 0x9b, 0x33, 0xcd, 0x2a, 0xf3, 0x6d, 0xe2, 0xcc, 0xa5, 0x1b, 0x90, 0xe0, 0x0b, 0xb5, + 0x08, 0x09, 0xbe, 0x40, 0x2a, 0x5d, 0x27, 0xf0, 0x42, 0xf1, 0xcf, 0x54, 0x80, 0x4d, 0x67, 0xef, + 0x6d, 0x6f, 0x48, 0x17, 0x38, 0x37, 0x00, 0xc6, 0x6f, 0x7b, 0xc3, 0x16, 0xbd, 0x85, 0xe2, 0xe2, + 0x21, 0x83, 0x35, 0xe4, 0x7f, 0xd9, 0x6d, 0xc8, 0x51, 0xb3, 0x78, 0x4d, 0xe8, 0xbe, 0x21, 0x65, + 0x64, 0xb1, 0x4e, 0x38, 0xca, 0x30, 0xa4, 0x56, 0xa5, 0x6b, 0x86, 0xa4, 0x04, 0xa9, 0x55, 0xd9, + 0x2d, 0xa0, 0x62, 0x6b, 0x4c, 0x11, 0x95, 0xae, 0x16, 0x32, 0x06, 0xf5, 0xcb, 0x63, 0x2c, 0xfb, + 0x2d, 0xa0, 0x3e, 0xf9, 0xd4, 0xf3, 0x33, 0xdf, 0x14, 0x6f, 0xc4, 0x65, 0x7c, 0xe0, 0x13, 0x0e, + 0x38, 0x4b, 0x4d, 0xc8, 0xf8, 0xf5, 0xd8, 0x1d, 0xd5, 0x8a, 0x49, 0x69, 0x34, 0x29, 0xa0, 0x2a, + 0x7f, 0x56, 0x1c, 0x20, 0x06, 0xb4, 0x40, 0x03, 0xe2, 0x24, 0x3e, 0xa2, 0xe2, 0x0d, 0x98, 0xdb, + 0x75, 0x6c, 0xfe, 0x32, 0xd3, 0x42, 0xe5, 0x40, 0x31, 0x0b, 0x0a, 0x1d, 0x82, 0x15, 0xb3, 0x78, + 0x13, 0x40, 0x6a, 0xd3, 0x40, 0x39, 0xe0, 0x6d, 0xe4, 0x14, 0x94, 0x83, 0xe2, 0x5d, 0x48, 0xee, + 0x98, 0xc7, 0xfb, 0x66, 0x97, 0xdd, 0x06, 0xe8, 0x9b, 0x63, 0xb7, 0xd5, 0xa1, 0xad, 0xf8, 0xf6, + 0xdb, 0x6f, 0xbf, 0x55, 0x28, 0xa3, 0xce, 0x60, 0x2d, 0xdf, 0x12, 0x17, 0xa0, 0xd9, 0x6f, 0xef, + 0x58, 0xe3, 0xb1, 0xd9, 0xb5, 0x58, 0x0d, 0x92, 0xb6, 0x35, 0xc6, 0x10, 0xac, 0xd0, 0x8d, 0xd3, + 0xcd, 0xd0, 0x42, 0x04, 0xc0, 0xf2, 0x2e, 0xa1, 0x0c, 0x81, 0x66, 0x1a, 0xc4, 0xec, 0xc9, 0x80, + 0xae, 0xd6, 0x12, 0x06, 0x3e, 0x2e, 0x7d, 0x00, 0x49, 0x8e, 0x61, 0x0c, 0xe2, 0xb6, 0x39, 0xb0, + 0x0a, 0xbc, 0x6b, 0x7a, 0x2e, 0xfe, 0x54, 0x01, 0xd8, 0xb5, 0xde, 0x5d, 0xac, 0xdb, 0x00, 0x78, + 0x46, 0xb7, 0x31, 0xde, 0xed, 0x93, 0xb3, 0xba, 0x45, 0xc1, 0x75, 0x1c, 0xa7, 0xdd, 0xe2, 0x7b, + 0xcd, 0x2f, 0x02, 0x33, 0x58, 0x43, 0x7b, 0x57, 0x7c, 0x03, 0xb9, 0x2d, 0xdb, 0xb6, 0x46, 0xde, + 0xb0, 0x18, 0xc4, 0x8f, 0x9c, 0xb1, 0x2b, 0x2e, 0x25, 0xe9, 0x99, 0x15, 0x20, 0x3e, 0x74, 0x46, + 0x2e, 0x9f, 0x6a, 0x3d, 0x5e, 0x5d, 0x59, 0x59, 0x31, 0xa8, 0x86, 0x7d, 0x00, 0x99, 0x43, 0xc7, + 0xb6, 0xad, 0x43, 0x9c, 0x47, 0x8c, 0x4e, 0x90, 0x41, 0x45, 0xf1, 0xf7, 0x15, 0xc8, 0x35, 0xdd, + 0xa3, 0xc0, 0xb8, 0x06, 0xb1, 0xb7, 0xd6, 0x09, 0x0d, 0x2f, 0x66, 0xe0, 0x23, 0xbe, 0x33, 0x3f, + 0x31, 0xfb, 0x13, 0x7e, 0x43, 0x99, 0x33, 0x78, 0x81, 0x5d, 0x85, 0xe4, 0x3b, 0xab, 0xd7, 0x3d, + 0x72, 0xc9, 0xa6, 0x6a, 0x88, 0x12, 0xbb, 0x0f, 0x89, 0x1e, 0x0e, 0xb6, 0x10, 0xa7, 0x25, 0xbb, + 0x1e, 0x5a, 0x32, 0x79, 0x1a, 0x06, 0xc7, 0xdd, 0x49, 0xa7, 0xdb, 0xda, 0xd7, 0x5f, 0x7f, 0xfd, + 0xb5, 0x5a, 0xec, 0xc1, 0xa2, 0xf7, 0x22, 0x87, 0xe6, 0xfb, 0x43, 0x28, 0xf4, 0x2d, 0xa7, 0xd5, + 0xe9, 0xd9, 0x66, 0xbf, 0x7f, 0xd2, 0x7a, 0xe7, 0xd8, 0x2d, 0xd3, 0x6e, 0x39, 0xe3, 0x43, 0x73, + 0x44, 0x6b, 0x70, 0x66, 0x2f, 0x8b, 0x7d, 0xcb, 0x69, 0x70, 0xe6, 0x17, 0x8e, 0xfd, 0xcc, 0x6e, + 0x22, 0xad, 0xf8, 0x1f, 0x71, 0xc8, 0xec, 0x9c, 0x78, 0x1d, 0x2c, 0x42, 0xe2, 0xd0, 0x99, 0xd8, + 0x7c, 0x45, 0x13, 0x06, 0x2f, 0xf8, 0x3b, 0xa5, 0x4a, 0x3b, 0xb5, 0x08, 0x89, 0xaf, 0x26, 0x8e, + 0x6b, 0xd1, 0xa4, 0x33, 0x06, 0x2f, 0xe0, 0x9a, 0x0d, 0x2d, 0xb7, 0x10, 0xa7, 0xfb, 0x0a, 0x7c, + 0x0c, 0x56, 0x21, 0x71, 0xb1, 0x55, 0x60, 0x0f, 0x20, 0xe9, 0xe0, 0x36, 0x8c, 0x0b, 0x49, 0xba, + 0x93, 0x0d, 0x33, 0xe4, 0x1d, 0x32, 0x04, 0x90, 0x6d, 0xc3, 0xc2, 0x3b, 0xab, 0x35, 0x98, 0x8c, + 0xdd, 0x56, 0xd7, 0x69, 0xb5, 0x2d, 0x6b, 0x68, 0x8d, 0x0a, 0x73, 0xd4, 0x5f, 0xd8, 0x51, 0xcc, + 0x5a, 0x54, 0x63, 0xfe, 0x9d, 0xb5, 0x33, 0x19, 0xbb, 0x9b, 0xce, 0x0b, 0x22, 0xb2, 0x1a, 0x64, + 0x46, 0x16, 0xba, 0x07, 0x1c, 0x75, 0x6e, 0xc6, 0x18, 0x42, 0xec, 0xf4, 0xc8, 0x1a, 0x52, 0x05, + 0x7b, 0x04, 0xe9, 0x83, 0xde, 0x5b, 0x6b, 0x7c, 0x64, 0xb5, 0x0b, 0x29, 0x5d, 0x29, 0xcd, 0x57, + 0x3e, 0x08, 0xd1, 0xfc, 0x55, 0x2e, 0x3f, 0x77, 0xfa, 0xce, 0xc8, 0xf0, 0xd1, 0xec, 0x29, 0x64, + 0xc6, 0xce, 0xc0, 0xe2, 0xa2, 0x4f, 0x53, 0xe0, 0xd5, 0x4f, 0xa1, 0xee, 0x39, 0x03, 0xcb, 0xf3, + 0x6f, 0x1e, 0x85, 0x2d, 0xf3, 0x11, 0x1f, 0xe0, 0xd9, 0xa2, 0x00, 0x74, 0xff, 0x83, 0xc3, 0xa2, + 0xb3, 0x06, 0x5b, 0xc2, 0x61, 0x75, 0x3b, 0x98, 0xc2, 0x15, 0xb2, 0x74, 0xb4, 0xf7, 0xcb, 0x4b, + 0xf7, 0x20, 0xe3, 0x1b, 0x0c, 0x1c, 0x23, 0x77, 0x46, 0x19, 0x72, 0x15, 0xdc, 0x31, 0x72, 0x4f, + 0xf4, 0x11, 0x24, 0x68, 0xe4, 0x18, 0xc5, 0x8c, 0x0d, 0x0c, 0x9a, 0x19, 0x48, 0x6c, 0x1a, 0x1b, + 0x1b, 0xbb, 0x9a, 0x42, 0xf1, 0x73, 0xfb, 0xf5, 0x86, 0xa6, 0x4a, 0x32, 0xfe, 0x99, 0x0a, 0xb1, + 0x8d, 0x63, 0xd2, 0x4f, 0xdb, 0x74, 0x4d, 0xef, 0x4d, 0xc7, 0x67, 0xf6, 0x04, 0x32, 0x03, 0xd3, + 0xeb, 0x4b, 0xa5, 0x55, 0x0e, 0x3b, 0x95, 0x8d, 0x63, 0xb7, 0xbc, 0x63, 0xf2, 0xae, 0x37, 0x6c, + 0x77, 0x74, 0x62, 0xa4, 0x07, 0xa2, 0xb8, 0xf4, 0x04, 0xe6, 0x42, 0x4d, 0xf2, 0xbb, 0x9a, 0x98, + 0xf1, 0xae, 0x26, 0xc4, 0xbb, 0x5a, 0x57, 0x1f, 0x29, 0x95, 0xef, 0x43, 0x7c, 0xe0, 0x8c, 0x2c, + 0x76, 0x75, 0xf6, 0x12, 0x17, 0xba, 0x24, 0x1c, 0x2d, 0x3a, 0x18, 0x83, 0x58, 0x95, 0x3b, 0x10, + 0x77, 0xad, 0x63, 0xf7, 0x54, 0xf6, 0x11, 0x9f, 0x23, 0x62, 0x2a, 0x65, 0x48, 0xda, 0x93, 0xc1, + 0x81, 0x35, 0x3a, 0x15, 0xdd, 0xa3, 0xc1, 0x09, 0x54, 0xf1, 0x73, 0xd0, 0x9e, 0x3b, 0x83, 0x61, + 0xdf, 0x3a, 0xde, 0x38, 0x76, 0x2d, 0x7b, 0xdc, 0x73, 0x6c, 0x9c, 0x47, 0xa7, 0x37, 0x22, 0x1f, + 0x47, 0xf3, 0xa0, 0x02, 0xfa, 0x9c, 0xb1, 0x75, 0xe8, 0xd8, 0x6d, 0x31, 0x3d, 0x51, 0x42, 0xb4, + 0x7b, 0xd4, 0x1b, 0xa1, 0x7b, 0xc3, 0x58, 0xc4, 0x0b, 0xc5, 0x4d, 0xc8, 0x8b, 0xa3, 0xd9, 0x58, + 0x74, 0x5c, 0xbc, 0x03, 0x39, 0xaf, 0x8a, 0x7e, 0x12, 0x4a, 0x43, 0xfc, 0xcd, 0x86, 0xd1, 0xd4, + 0xae, 0xe0, 0xe6, 0x36, 0x77, 0x37, 0x34, 0x05, 0x1f, 0xf6, 0xbf, 0x68, 0x86, 0x36, 0x34, 0x05, + 0x89, 0x8d, 0xc1, 0xd0, 0x3d, 0x29, 0xfe, 0x1e, 0x64, 0x85, 0xa5, 0xed, 0xde, 0xd8, 0x65, 0x75, + 0x48, 0x0d, 0xc4, 0x8c, 0x14, 0x4a, 0x40, 0x23, 0xf2, 0x0d, 0xa0, 0xde, 0xb3, 0xe1, 0x11, 0x96, + 0x56, 0x21, 0x25, 0xb9, 0x73, 0xe1, 0x67, 0x54, 0xd9, 0xcf, 0x70, 0x8f, 0x14, 0x93, 0x3c, 0x52, + 0x71, 0x07, 0x52, 0x3c, 0x14, 0x8f, 0x29, 0xc3, 0xe0, 0xc7, 0x76, 0xae, 0x25, 0x2e, 0xb2, 0x2c, + 0xaf, 0xe3, 0x79, 0xd3, 0x2d, 0xc8, 0xd2, 0xbb, 0xe1, 0xab, 0x0d, 0xbd, 0x37, 0x50, 0x15, 0x57, + 0xf6, 0x5f, 0x27, 0x20, 0xed, 0x2d, 0x07, 0x5b, 0x86, 0x24, 0x3f, 0xbb, 0x92, 0x29, 0xef, 0x2e, + 0x27, 0x41, 0xa7, 0x55, 0xb6, 0x0c, 0x29, 0x71, 0x3e, 0x15, 0x01, 0x46, 0x5d, 0xad, 0x18, 0x49, + 0x7e, 0x1e, 0xf5, 0x1b, 0x6b, 0x55, 0xf2, 0x8a, 0xfc, 0x96, 0x26, 0xc9, 0x4f, 0x9c, 0x4c, 0x87, + 0x8c, 0x7f, 0xc6, 0xa4, 0x90, 0x20, 0xae, 0x64, 0xd2, 0xde, 0xa1, 0x52, 0x42, 0xd4, 0xaa, 0xe4, + 0x2e, 0xc5, 0xfd, 0x4b, 0xba, 0x11, 0xa4, 0x4a, 0x69, 0xef, 0xa4, 0x48, 0xbf, 0x38, 0x79, 0x97, + 0x2d, 0x29, 0x71, 0x36, 0x0c, 0x00, 0xb5, 0x2a, 0xf9, 0x20, 0xef, 0x66, 0x25, 0x25, 0xce, 0x7f, + 0xec, 0x16, 0x0e, 0x91, 0xce, 0x73, 0xe4, 0x68, 0x82, 0x6b, 0x94, 0x24, 0x3f, 0xe5, 0xb1, 0xdb, + 0x68, 0x81, 0x1f, 0xda, 0xc8, 0x05, 0x04, 0x77, 0x26, 0x29, 0x71, 0x96, 0x63, 0x77, 0x11, 0xc2, + 0x97, 0xbf, 0x00, 0xa7, 0x5c, 0x90, 0xa4, 0xc4, 0x05, 0x09, 0xd3, 0xb1, 0x43, 0xf2, 0x44, 0xe4, + 0x7d, 0xa4, 0xcb, 0x90, 0x24, 0xbf, 0x0c, 0x61, 0x37, 0xc9, 0x1c, 0x9f, 0x54, 0x2e, 0xb8, 0xf8, + 0x48, 0x89, 0xc3, 0x5f, 0xd0, 0x4e, 0xe9, 0xa3, 0x7f, 0xc9, 0x91, 0x12, 0xc7, 0x3b, 0xf6, 0x18, + 0xf7, 0x0b, 0x45, 0x5c, 0x98, 0x27, 0xaf, 0xbb, 0x1c, 0xd2, 0x9e, 0xb7, 0xad, 0xdc, 0xe9, 0xd6, + 0xb9, 0xbf, 0x32, 0x12, 0x0d, 0x52, 0xfd, 0x12, 0x52, 0x5f, 0xf5, 0xec, 0x4e, 0x21, 0x4f, 0x8b, + 0x11, 0xeb, 0xd9, 0x1d, 0x23, 0xd1, 0xc0, 0x1a, 0x2e, 0x83, 0x5d, 0x6c, 0xd3, 0xa8, 0x2d, 0xfe, + 0x09, 0x6f, 0xc4, 0x2a, 0x56, 0x80, 0x44, 0xa3, 0xb5, 0x6b, 0xda, 0x85, 0x05, 0xce, 0xb3, 0x4d, + 0xdb, 0x88, 0x37, 0x76, 0x4d, 0x9b, 0xdd, 0x81, 0xd8, 0x78, 0x72, 0x50, 0x60, 0x33, 0x7e, 0x0f, + 0xdc, 0x9b, 0x1c, 0x78, 0xa3, 0x31, 0x10, 0xc4, 0x96, 0x21, 0x3d, 0x76, 0x47, 0xad, 0xdf, 0xb1, + 0x46, 0x4e, 0xe1, 0x3d, 0x5a, 0xc8, 0x2b, 0x46, 0x6a, 0xec, 0x8e, 0xde, 0x58, 0x23, 0xe7, 0x82, + 0xde, 0xb6, 0x78, 0x13, 0xb2, 0x92, 0x5d, 0x96, 0x07, 0xc5, 0xe6, 0x29, 0x4b, 0x5d, 0x79, 0x68, + 0x28, 0x76, 0xf1, 0x0b, 0xc8, 0x79, 0x07, 0x2b, 0x9a, 0xf2, 0x1a, 0xbe, 0x4f, 0x7d, 0x67, 0x44, + 0x2f, 0xea, 0x7c, 0xe5, 0x56, 0x24, 0x3e, 0x06, 0x48, 0x11, 0xa5, 0x38, 0xba, 0xa8, 0x45, 0x46, + 0xa3, 0x14, 0xff, 0x53, 0x81, 0xdc, 0x8e, 0x33, 0x0a, 0x7e, 0xb9, 0x58, 0x84, 0xc4, 0x81, 0xe3, + 0xf4, 0xc7, 0x64, 0x39, 0x6d, 0xf0, 0x02, 0xfb, 0x08, 0x72, 0xf4, 0xe0, 0x1d, 0x8f, 0x55, 0xff, + 0xfe, 0x27, 0x4b, 0xf5, 0xe2, 0x44, 0xcc, 0x20, 0xde, 0xb3, 0xdd, 0xb1, 0xf0, 0x5b, 0xf4, 0xcc, + 0x3e, 0x84, 0x2c, 0xfe, 0xf5, 0x98, 0x71, 0x3f, 0x85, 0x06, 0xac, 0x16, 0xc4, 0xef, 0xc1, 0x1c, + 0xc9, 0xc0, 0x87, 0xa5, 0xfc, 0xbb, 0x9e, 0x1c, 0x6f, 0x10, 0xc0, 0x02, 0xa4, 0xb8, 0x4f, 0x18, + 0xd3, 0x8f, 0xbd, 0x19, 0xc3, 0x2b, 0xa2, 0x33, 0xa5, 0xe3, 0x09, 0xcf, 0x38, 0x52, 0x86, 0x28, + 0x15, 0x5f, 0x40, 0x9a, 0x22, 0x63, 0xb3, 0xdf, 0x66, 0x1f, 0x81, 0xd2, 0x2d, 0x58, 0x14, 0x9a, + 0xaf, 0x85, 0xcf, 0x1e, 0x02, 0x51, 0xde, 0x34, 0x94, 0xee, 0xd2, 0x02, 0x28, 0x9b, 0x78, 0x18, + 0x38, 0x16, 0x7e, 0x59, 0x39, 0x2e, 0x1a, 0xc2, 0xca, 0xae, 0xf5, 0xee, 0x1c, 0x2b, 0xbb, 0xd6, + 0x3b, 0x6e, 0xe5, 0xd6, 0x94, 0x15, 0x2c, 0x9d, 0x88, 0x9f, 0xc0, 0x95, 0x93, 0xe2, 0x2a, 0xcc, + 0xd1, 0xdb, 0xda, 0xb3, 0xbb, 0xaf, 0x9c, 0x9e, 0x4d, 0xe7, 0x8f, 0x0e, 0xe5, 0x6c, 0x8a, 0xa1, + 0x74, 0x70, 0x27, 0xac, 0x63, 0xf3, 0x90, 0xe7, 0xc0, 0x69, 0x83, 0x17, 0x8a, 0xff, 0x15, 0x87, + 0x79, 0xe1, 0x69, 0xbf, 0xe8, 0xb9, 0x47, 0x3b, 0xe6, 0x90, 0x35, 0x21, 0x87, 0x4e, 0xb6, 0x35, + 0x30, 0x87, 0x43, 0x7c, 0x9b, 0x15, 0x8a, 0xc3, 0xf7, 0x66, 0x39, 0x6f, 0x41, 0x29, 0xef, 0x9a, + 0x03, 0x6b, 0x87, 0xc3, 0x79, 0x54, 0xce, 0xda, 0x41, 0x0d, 0xdb, 0x86, 0xec, 0x60, 0xdc, 0xf5, + 0xed, 0xf1, 0xb8, 0x7e, 0xf7, 0x2c, 0x7b, 0x3b, 0xe3, 0x6e, 0xc8, 0x1c, 0x0c, 0xfc, 0x0a, 0x1c, + 0x1e, 0x3a, 0x69, 0xdf, 0x5c, 0xec, 0xfc, 0xe1, 0xa1, 0x4b, 0x09, 0x0f, 0xef, 0x20, 0xa8, 0x61, + 0x9b, 0x00, 0xf8, 0xc2, 0xb9, 0x0e, 0x9e, 0xed, 0x48, 0x50, 0xd9, 0xca, 0xc7, 0x67, 0x99, 0xdb, + 0x73, 0x47, 0xfb, 0xce, 0x9e, 0x3b, 0x12, 0x09, 0xc8, 0x58, 0x14, 0x97, 0x9e, 0x82, 0x16, 0x5d, + 0x88, 0xf3, 0x72, 0x90, 0x8c, 0x94, 0x83, 0x2c, 0x7d, 0x09, 0xf9, 0xc8, 0xc4, 0x65, 0x3a, 0xe3, + 0xf4, 0x15, 0x99, 0x9e, 0xad, 0x2c, 0x85, 0x3f, 0xd4, 0x90, 0xf7, 0x5f, 0x36, 0xfd, 0x14, 0xb4, + 0xe8, 0x22, 0xc8, 0xb6, 0xd3, 0x67, 0x1c, 0x65, 0x88, 0xff, 0x04, 0xe6, 0x42, 0xb3, 0x96, 0xc9, + 0x99, 0x73, 0xe6, 0x55, 0xfc, 0x83, 0x04, 0x24, 0x9a, 0xb6, 0xe5, 0x74, 0xd8, 0xb5, 0x70, 0x14, + 0x7d, 0x79, 0xc5, 0x8b, 0xa0, 0xd7, 0x23, 0x11, 0xf4, 0xe5, 0x15, 0x3f, 0x7e, 0x5e, 0x8f, 0xc4, + 0x4f, 0xaf, 0xa9, 0x56, 0x65, 0x37, 0xa6, 0xa2, 0xe7, 0xcb, 0x2b, 0x52, 0xe8, 0xbc, 0x31, 0x15, + 0x3a, 0x83, 0xe6, 0x5a, 0x15, 0x1d, 0x6d, 0x38, 0x6e, 0xbe, 0xbc, 0x12, 0xc4, 0xcc, 0xe5, 0x68, + 0xcc, 0xf4, 0x1b, 0x6b, 0x55, 0x3e, 0x24, 0x29, 0x5e, 0xd2, 0x90, 0x78, 0xa4, 0x5c, 0x8e, 0x46, + 0x4a, 0xe2, 0x89, 0x18, 0xb9, 0x1c, 0x8d, 0x91, 0xd4, 0x28, 0x62, 0xe2, 0xf5, 0x48, 0x4c, 0x24, + 0xa3, 0x3c, 0x18, 0x2e, 0x47, 0x83, 0x21, 0xe7, 0x49, 0x23, 0x95, 0x23, 0xa1, 0xdf, 0x58, 0xab, + 0xb2, 0xb5, 0x48, 0x18, 0x3c, 0xf3, 0xf0, 0x41, 0xdb, 0x41, 0xf1, 0xe0, 0x21, 0xae, 0x9c, 0x97, + 0x8e, 0xe6, 0xcf, 0xfe, 0x8a, 0x85, 0xd6, 0xd4, 0x4b, 0xd6, 0xd6, 0x20, 0xd5, 0x11, 0xe7, 0x74, + 0x8d, 0x3c, 0x5a, 0x58, 0x9f, 0xa4, 0x82, 0x72, 0xa3, 0x45, 0x9e, 0x0d, 0x27, 0xd8, 0xe1, 0xa7, + 0x8c, 0x12, 0xcc, 0x35, 0x5a, 0xdb, 0xe6, 0xa8, 0x6b, 0x8d, 0xdd, 0xd6, 0xbe, 0xd9, 0xf5, 0x2f, + 0x3d, 0x50, 0x08, 0xd9, 0x86, 0x68, 0xd9, 0x37, 0xbb, 0xec, 0xaa, 0xa7, 0xb2, 0x36, 0xb5, 0x2a, + 0x42, 0x67, 0x4b, 0xd7, 0x70, 0xf5, 0xb8, 0x31, 0xf2, 0x91, 0x0b, 0xc2, 0x47, 0xae, 0xa7, 0x20, + 0x31, 0xb1, 0x7b, 0x8e, 0xbd, 0x9e, 0x81, 0x94, 0xeb, 0x8c, 0x06, 0xa6, 0xeb, 0x14, 0xff, 0x5b, + 0x01, 0x78, 0xee, 0x0c, 0x06, 0x13, 0xbb, 0xf7, 0xd5, 0xc4, 0x62, 0x37, 0x21, 0x3b, 0x30, 0xdf, + 0x5a, 0xad, 0x81, 0xd5, 0x3a, 0x1c, 0x79, 0x2f, 0x44, 0x06, 0xab, 0x76, 0xac, 0xe7, 0xa3, 0x13, + 0x56, 0xf0, 0x32, 0x76, 0x12, 0x11, 0x69, 0x53, 0x64, 0xf0, 0x8b, 0x22, 0x37, 0x4d, 0x8a, 0xcd, + 0xf4, 0xb2, 0x53, 0x7e, 0xb2, 0x49, 0x89, 0x6d, 0xe4, 0x67, 0x9b, 0x6b, 0x90, 0x74, 0xad, 0xc1, + 0xb0, 0x75, 0x48, 0x9a, 0x41, 0x5d, 0x24, 0xb0, 0xfc, 0x9c, 0xad, 0x40, 0xec, 0xd0, 0xe9, 0x93, + 0x5a, 0xce, 0xdf, 0x20, 0x84, 0xb2, 0x12, 0xc4, 0x06, 0x63, 0x2e, 0xa1, 0x6c, 0x65, 0x31, 0x9c, + 0x4e, 0xf0, 0xf0, 0x85, 0xc8, 0xc1, 0xb8, 0xeb, 0xcf, 0xbe, 0xf8, 0x6b, 0x15, 0xd2, 0xb8, 0x65, + 0xaf, 0xf7, 0x1b, 0x8f, 0xe8, 0xa0, 0x70, 0x68, 0xf6, 0xe9, 0x7e, 0x00, 0xdf, 0x55, 0x51, 0xc2, + 0xfa, 0x9f, 0x58, 0x87, 0xae, 0x33, 0x22, 0x1f, 0x9d, 0x31, 0x44, 0x09, 0x17, 0x9d, 0x27, 0xc9, + 0x31, 0x31, 0x4f, 0x5e, 0xa4, 0x0c, 0xdf, 0x1c, 0xb6, 0xd0, 0x11, 0x70, 0xb7, 0x19, 0x3e, 0x58, + 0x7b, 0xfd, 0xe1, 0x89, 0xed, 0x33, 0xeb, 0x84, 0xbb, 0xcb, 0xe4, 0x80, 0x0a, 0xec, 0x07, 0xfc, + 0xa8, 0xc7, 0x37, 0x93, 0x7f, 0x68, 0xf5, 0xe1, 0xa9, 0xec, 0xcf, 0x11, 0x15, 0x9c, 0xf7, 0xa8, + 0xb8, 0xf4, 0x18, 0xb2, 0x92, 0xe1, 0xf3, 0x3c, 0x52, 0x2c, 0xe2, 0xce, 0x42, 0x56, 0xcf, 0xbb, + 0xd6, 0x91, 0xdd, 0x19, 0xae, 0xa9, 0x83, 0x3a, 0xbe, 0x93, 0x87, 0x58, 0xa3, 0xd9, 0xc4, 0xb4, + 0xab, 0xd1, 0x6c, 0x3e, 0xd0, 0x94, 0x7a, 0x05, 0xd2, 0xdd, 0x91, 0x65, 0xa1, 0x07, 0x3e, 0xf5, + 0x70, 0xf7, 0x63, 0x5a, 0x59, 0x1f, 0x57, 0xdf, 0x83, 0xd4, 0x21, 0x3f, 0xde, 0xb1, 0xd3, 0x2f, + 0x35, 0x0a, 0x7f, 0xcb, 0x6f, 0xd8, 0x6e, 0x84, 0x10, 0xd1, 0x63, 0xa1, 0xe1, 0x59, 0xaa, 0x7f, + 0x0e, 0x99, 0x51, 0xeb, 0x02, 0x66, 0xbf, 0xe1, 0xb1, 0xfd, 0x1c, 0xb3, 0xe9, 0x91, 0xa8, 0xaa, + 0xbf, 0x84, 0x05, 0xdb, 0xf1, 0x7e, 0xf1, 0x6b, 0xb5, 0xb9, 0x57, 0xfb, 0x60, 0x66, 0x6a, 0xed, + 0x75, 0x61, 0xf1, 0x0f, 0x07, 0x6c, 0x47, 0x34, 0x70, 0x57, 0x58, 0x6f, 0x80, 0x26, 0x59, 0xa2, + 0x8b, 0x87, 0x73, 0x0c, 0x75, 0xf8, 0xc7, 0x0a, 0xbe, 0x21, 0xf2, 0xb7, 0x11, 0x3b, 0xdc, 0x23, + 0x9e, 0x6d, 0xa7, 0xcb, 0x3f, 0xfe, 0xf0, 0xed, 0x50, 0x94, 0x99, 0xb6, 0x53, 0xab, 0x9e, 0x63, + 0xe7, 0x88, 0x7f, 0x1a, 0x22, 0xdb, 0xa9, 0x55, 0x23, 0x2b, 0x34, 0xb9, 0xc8, 0x80, 0x7a, 0xfc, + 0xe3, 0x0e, 0xdf, 0x10, 0x8f, 0x40, 0x33, 0x2c, 0x9d, 0x3b, 0xa4, 0x1f, 0xf3, 0x4f, 0x3f, 0x42, + 0x96, 0xa6, 0xc6, 0x34, 0xbe, 0xc8, 0x98, 0xde, 0xf2, 0x4f, 0x2d, 0x7c, 0x4b, 0x7b, 0xb3, 0xc6, + 0x34, 0xbe, 0xc8, 0x98, 0xfa, 0xfc, 0x3b, 0x8c, 0x90, 0xa5, 0x5a, 0xb5, 0xfe, 0xdb, 0xc0, 0xe4, + 0xfd, 0x17, 0x11, 0xfb, 0x6c, 0x53, 0x03, 0xfe, 0x81, 0x4d, 0xa0, 0x00, 0xce, 0x9a, 0x65, 0xeb, + 0xdc, 0x61, 0xd9, 0xfc, 0xf3, 0x9b, 0xb0, 0xad, 0x5a, 0xb5, 0xbe, 0x0d, 0xef, 0xc9, 0x33, 0xbc, + 0xd8, 0xc0, 0x1c, 0xfe, 0xf1, 0x48, 0x30, 0x47, 0x41, 0x9b, 0x69, 0xed, 0xdc, 0xa1, 0x0d, 0xf9, + 0x97, 0x25, 0x11, 0x6b, 0xb5, 0x6a, 0xfd, 0x05, 0xe4, 0x25, 0x6b, 0x78, 0x50, 0x3a, 0xc7, 0xd2, + 0x57, 0xfc, 0x83, 0x28, 0xdf, 0x12, 0xa6, 0x5a, 0xd1, 0x3d, 0xe4, 0xc9, 0xc7, 0xd9, 0x76, 0x46, + 0xfc, 0x83, 0x9e, 0x60, 0x44, 0x44, 0x8a, 0xbc, 0x33, 0x74, 0x73, 0x72, 0x8e, 0xa1, 0x31, 0xff, + 0xda, 0x27, 0x18, 0x10, 0x72, 0xea, 0x4e, 0x68, 0x5e, 0x16, 0x26, 0x20, 0x67, 0x9b, 0x71, 0x29, + 0x54, 0x7e, 0x7c, 0x16, 0xa6, 0x2c, 0x5f, 0x64, 0x49, 0x4b, 0x80, 0xc5, 0xfa, 0x36, 0xcc, 0x5f, + 0xca, 0x87, 0x7d, 0xa3, 0xf0, 0x3b, 0x8f, 0xd5, 0xf2, 0x83, 0xea, 0x83, 0x35, 0x63, 0xae, 0x1d, + 0x72, 0x65, 0x2f, 0x61, 0xee, 0x32, 0x7e, 0xec, 0xe7, 0x0a, 0xbf, 0x39, 0x40, 0x63, 0x46, 0xae, + 0x1d, 0x76, 0x66, 0x73, 0x97, 0xf1, 0x64, 0xbf, 0x50, 0xf8, 0x65, 0x53, 0xb5, 0xe2, 0xdb, 0xf1, + 0x9c, 0xd9, 0xdc, 0x65, 0x3c, 0xd9, 0x2f, 0xf9, 0xd5, 0x80, 0x5a, 0x5d, 0x95, 0xed, 0x90, 0xe3, + 0x98, 0xbf, 0x94, 0x27, 0xfb, 0x95, 0x42, 0xd7, 0x4f, 0x6a, 0xb5, 0xea, 0xaf, 0x91, 0xef, 0xcc, + 0xe6, 0x2f, 0xe5, 0xc9, 0xfe, 0x4e, 0xa1, 0x7b, 0x2a, 0xb5, 0xba, 0x16, 0xb2, 0x14, 0x1e, 0xd3, + 0x85, 0x3c, 0xd9, 0xdf, 0x2b, 0x74, 0x7b, 0xa4, 0x56, 0x6b, 0xbe, 0xa5, 0xbd, 0xa9, 0x31, 0x5d, + 0xc8, 0x93, 0xfd, 0x03, 0x9d, 0xc2, 0xea, 0x6a, 0xf5, 0x61, 0xc8, 0x12, 0x39, 0xb3, 0xfc, 0xe5, + 0x3c, 0xd9, 0xaf, 0x15, 0xba, 0xea, 0x53, 0xab, 0x8f, 0x0c, 0x6f, 0x0c, 0x81, 0x33, 0xcb, 0x5f, + 0xce, 0x93, 0xfd, 0xa3, 0x42, 0x97, 0x82, 0x6a, 0xf5, 0x71, 0xd8, 0x16, 0x39, 0x33, 0xed, 0x92, + 0x9e, 0xec, 0x9f, 0x14, 0xfa, 0xf4, 0x47, 0x5d, 0x5b, 0x31, 0xbc, 0x61, 0x48, 0xce, 0x4c, 0xbb, + 0xa4, 0x27, 0xfb, 0x67, 0x85, 0x3e, 0x08, 0x52, 0xd7, 0x1e, 0x44, 0xac, 0xd5, 0xaa, 0xf5, 0x06, + 0xe4, 0x2e, 0xe1, 0xc9, 0xfe, 0x45, 0xbe, 0x75, 0xcd, 0xb6, 0x25, 0x77, 0xf6, 0x23, 0x69, 0x17, + 0x2f, 0xe2, 0xcb, 0xfe, 0x95, 0x12, 0xc4, 0xfa, 0xfb, 0x2f, 0xf9, 0xe5, 0x24, 0xe7, 0xdc, 0x6b, + 0x5b, 0x9d, 0x4f, 0x3b, 0x8e, 0x13, 0x6c, 0x2c, 0xf7, 0x70, 0xaf, 0x82, 0x17, 0xe9, 0x22, 0xee, + 0xed, 0xdf, 0x14, 0xba, 0xcc, 0xcc, 0x09, 0xdb, 0x44, 0xf1, 0x5f, 0x29, 0xee, 0xeb, 0x86, 0xc1, + 0xb4, 0x2f, 0xe0, 0xe8, 0xfe, 0x5d, 0xb9, 0xa4, 0xa7, 0xab, 0xc7, 0x9a, 0xbb, 0x1b, 0xfe, 0x02, + 0x61, 0xcd, 0xfa, 0xa7, 0x6f, 0x9e, 0x74, 0x7b, 0xee, 0xd1, 0xe4, 0xa0, 0x7c, 0xe8, 0x0c, 0xee, + 0x77, 0x9d, 0xbe, 0x69, 0x77, 0xef, 0x93, 0xbd, 0x83, 0x49, 0xe7, 0x7e, 0xcf, 0x76, 0xad, 0x91, + 0x6d, 0xf6, 0xe9, 0x1f, 0x44, 0xa8, 0x76, 0x7c, 0x5f, 0xfe, 0xc7, 0x91, 0xdf, 0x04, 0x00, 0x00, + 0xff, 0xff, 0x4a, 0x65, 0x66, 0xff, 0x47, 0x32, 0x00, 0x00, } diff --git a/proto/test_proto/test.proto b/internal/testprotos/proto2_proto/test.proto similarity index 79% rename from proto/test_proto/test.proto rename to internal/testprotos/proto2_proto/test.proto index f339e05c83..3b9fe04e24 100644 --- a/proto/test_proto/test.proto +++ b/internal/testprotos/proto2_proto/test.proto @@ -1,41 +1,14 @@ -// 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. // A feature-rich test file for the protocol compiler and libraries. syntax = "proto2"; -option go_package = "github.com/golang/protobuf/proto/test_proto"; +option go_package = "github.com/golang/protobuf/internal/testprotos/proto2_proto"; -package test_proto; +package proto2_test; enum FOO { FOO1 = 1; }; @@ -361,67 +334,9 @@ extend DefaultsMessage { optional DefaultsMessage.DefaultsEnum default_enum = 216 [default = ONE]; } -message MyMessageSet { - option message_set_wire_format = true; - extensions 100 to max; -} - message Empty { } -extend MyMessageSet { - optional Empty x201 = 201; - optional Empty x202 = 202; - optional Empty x203 = 203; - optional Empty x204 = 204; - optional Empty x205 = 205; - optional Empty x206 = 206; - optional Empty x207 = 207; - optional Empty x208 = 208; - optional Empty x209 = 209; - optional Empty x210 = 210; - optional Empty x211 = 211; - optional Empty x212 = 212; - optional Empty x213 = 213; - optional Empty x214 = 214; - optional Empty x215 = 215; - optional Empty x216 = 216; - optional Empty x217 = 217; - optional Empty x218 = 218; - optional Empty x219 = 219; - optional Empty x220 = 220; - optional Empty x221 = 221; - optional Empty x222 = 222; - optional Empty x223 = 223; - optional Empty x224 = 224; - optional Empty x225 = 225; - optional Empty x226 = 226; - optional Empty x227 = 227; - optional Empty x228 = 228; - optional Empty x229 = 229; - optional Empty x230 = 230; - optional Empty x231 = 231; - optional Empty x232 = 232; - optional Empty x233 = 233; - optional Empty x234 = 234; - optional Empty x235 = 235; - optional Empty x236 = 236; - optional Empty x237 = 237; - optional Empty x238 = 238; - optional Empty x239 = 239; - optional Empty x240 = 240; - optional Empty x241 = 241; - optional Empty x242 = 242; - optional Empty x243 = 243; - optional Empty x244 = 244; - optional Empty x245 = 245; - optional Empty x246 = 246; - optional Empty x247 = 247; - optional Empty x248 = 248; - optional Empty x249 = 249; - optional Empty x250 = 250; -} - message MessageList { repeated group Message = 1 { required string name = 2; diff --git a/proto/proto3_proto/proto3.pb.go b/internal/testprotos/proto3_proto/test.pb.go similarity index 51% rename from proto/proto3_proto/proto3.pb.go rename to internal/testprotos/proto3_proto/test.pb.go index 4dd9476edf..0aa2d9d073 100644 --- a/proto/proto3_proto/proto3.pb.go +++ b/internal/testprotos/proto3_proto/test.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: proto3_proto/proto3.proto +// source: proto3_proto/test.proto package proto3_proto import ( fmt "fmt" + proto2_proto "github.com/golang/protobuf/internal/testprotos/proto2_proto" proto "github.com/golang/protobuf/proto" - test_proto "github.com/golang/protobuf/proto/test_proto" - any "github.com/golang/protobuf/ptypes/any" + anypb "google.golang.org/protobuf/types/known/anypb" math "math" ) @@ -50,39 +50,39 @@ func (x Message_Humour) String() string { } func (Message_Humour) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{0, 0} + return fileDescriptor_ff83f0b8d2b92afa, []int{0, 0} } type Message struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Hilarity Message_Humour `protobuf:"varint,2,opt,name=hilarity,proto3,enum=proto3_proto.Message_Humour" json:"hilarity,omitempty"` - HeightInCm uint32 `protobuf:"varint,3,opt,name=height_in_cm,json=heightInCm,proto3" json:"height_in_cm,omitempty"` - Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` - ResultCount int64 `protobuf:"varint,7,opt,name=result_count,json=resultCount,proto3" json:"result_count,omitempty"` - TrueScotsman bool `protobuf:"varint,8,opt,name=true_scotsman,json=trueScotsman,proto3" json:"true_scotsman,omitempty"` - Score float32 `protobuf:"fixed32,9,opt,name=score,proto3" json:"score,omitempty"` - Key []uint64 `protobuf:"varint,5,rep,packed,name=key,proto3" json:"key,omitempty"` - ShortKey []int32 `protobuf:"varint,19,rep,packed,name=short_key,json=shortKey,proto3" json:"short_key,omitempty"` - Nested *Nested `protobuf:"bytes,6,opt,name=nested,proto3" json:"nested,omitempty"` - RFunny []Message_Humour `protobuf:"varint,16,rep,packed,name=r_funny,json=rFunny,proto3,enum=proto3_proto.Message_Humour" json:"r_funny,omitempty"` - Terrain map[string]*Nested `protobuf:"bytes,10,rep,name=terrain,proto3" json:"terrain,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Proto2Field *test_proto.SubDefaults `protobuf:"bytes,11,opt,name=proto2_field,json=proto2Field,proto3" json:"proto2_field,omitempty"` - Proto2Value map[string]*test_proto.SubDefaults `protobuf:"bytes,13,rep,name=proto2_value,json=proto2Value,proto3" json:"proto2_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Anything *any.Any `protobuf:"bytes,14,opt,name=anything,proto3" json:"anything,omitempty"` - ManyThings []*any.Any `protobuf:"bytes,15,rep,name=many_things,json=manyThings,proto3" json:"many_things,omitempty"` - Submessage *Message `protobuf:"bytes,17,opt,name=submessage,proto3" json:"submessage,omitempty"` - Children []*Message `protobuf:"bytes,18,rep,name=children,proto3" json:"children,omitempty"` - StringMap map[string]string `protobuf:"bytes,20,rep,name=string_map,json=stringMap,proto3" json:"string_map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Hilarity Message_Humour `protobuf:"varint,2,opt,name=hilarity,proto3,enum=proto3_test.Message_Humour" json:"hilarity,omitempty"` + HeightInCm uint32 `protobuf:"varint,3,opt,name=height_in_cm,json=heightInCm,proto3" json:"height_in_cm,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + ResultCount int64 `protobuf:"varint,7,opt,name=result_count,json=resultCount,proto3" json:"result_count,omitempty"` + TrueScotsman bool `protobuf:"varint,8,opt,name=true_scotsman,json=trueScotsman,proto3" json:"true_scotsman,omitempty"` + Score float32 `protobuf:"fixed32,9,opt,name=score,proto3" json:"score,omitempty"` + Key []uint64 `protobuf:"varint,5,rep,packed,name=key,proto3" json:"key,omitempty"` + ShortKey []int32 `protobuf:"varint,19,rep,packed,name=short_key,json=shortKey,proto3" json:"short_key,omitempty"` + Nested *Nested `protobuf:"bytes,6,opt,name=nested,proto3" json:"nested,omitempty"` + RFunny []Message_Humour `protobuf:"varint,16,rep,packed,name=r_funny,json=rFunny,proto3,enum=proto3_test.Message_Humour" json:"r_funny,omitempty"` + Terrain map[string]*Nested `protobuf:"bytes,10,rep,name=terrain,proto3" json:"terrain,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Proto2Field *proto2_proto.SubDefaults `protobuf:"bytes,11,opt,name=proto2_field,json=proto2Field,proto3" json:"proto2_field,omitempty"` + Proto2Value map[string]*proto2_proto.SubDefaults `protobuf:"bytes,13,rep,name=proto2_value,json=proto2Value,proto3" json:"proto2_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Anything *anypb.Any `protobuf:"bytes,14,opt,name=anything,proto3" json:"anything,omitempty"` + ManyThings []*anypb.Any `protobuf:"bytes,15,rep,name=many_things,json=manyThings,proto3" json:"many_things,omitempty"` + Submessage *Message `protobuf:"bytes,17,opt,name=submessage,proto3" json:"submessage,omitempty"` + Children []*Message `protobuf:"bytes,18,rep,name=children,proto3" json:"children,omitempty"` + StringMap map[string]string `protobuf:"bytes,20,rep,name=string_map,json=stringMap,proto3" json:"string_map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Message) Reset() { *m = Message{} } func (m *Message) String() string { return proto.CompactTextString(m) } func (*Message) ProtoMessage() {} func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{0} + return fileDescriptor_ff83f0b8d2b92afa, []int{0} } func (m *Message) XXX_Unmarshal(b []byte) error { @@ -187,28 +187,28 @@ func (m *Message) GetTerrain() map[string]*Nested { return nil } -func (m *Message) GetProto2Field() *test_proto.SubDefaults { +func (m *Message) GetProto2Field() *proto2_proto.SubDefaults { if m != nil { return m.Proto2Field } return nil } -func (m *Message) GetProto2Value() map[string]*test_proto.SubDefaults { +func (m *Message) GetProto2Value() map[string]*proto2_proto.SubDefaults { if m != nil { return m.Proto2Value } return nil } -func (m *Message) GetAnything() *any.Any { +func (m *Message) GetAnything() *anypb.Any { if m != nil { return m.Anything } return nil } -func (m *Message) GetManyThings() []*any.Any { +func (m *Message) GetManyThings() []*anypb.Any { if m != nil { return m.ManyThings } @@ -248,7 +248,7 @@ func (m *Nested) Reset() { *m = Nested{} } func (m *Nested) String() string { return proto.CompactTextString(m) } func (*Nested) ProtoMessage() {} func (*Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{1} + return fileDescriptor_ff83f0b8d2b92afa, []int{1} } func (m *Nested) XXX_Unmarshal(b []byte) error { @@ -294,7 +294,7 @@ func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } func (*MessageWithMap) ProtoMessage() {} func (*MessageWithMap) Descriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{2} + return fileDescriptor_ff83f0b8d2b92afa, []int{2} } func (m *MessageWithMap) XXX_Unmarshal(b []byte) error { @@ -333,7 +333,7 @@ func (m *IntMap) Reset() { *m = IntMap{} } func (m *IntMap) String() string { return proto.CompactTextString(m) } func (*IntMap) ProtoMessage() {} func (*IntMap) Descriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{3} + return fileDescriptor_ff83f0b8d2b92afa, []int{3} } func (m *IntMap) XXX_Unmarshal(b []byte) error { @@ -372,7 +372,7 @@ func (m *IntMaps) Reset() { *m = IntMaps{} } func (m *IntMaps) String() string { return proto.CompactTextString(m) } func (*IntMaps) ProtoMessage() {} func (*IntMaps) Descriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{4} + return fileDescriptor_ff83f0b8d2b92afa, []int{4} } func (m *IntMaps) XXX_Unmarshal(b []byte) error { @@ -417,7 +417,7 @@ func (m *TestUTF8) Reset() { *m = TestUTF8{} } func (m *TestUTF8) String() string { return proto.CompactTextString(m) } func (*TestUTF8) ProtoMessage() {} func (*TestUTF8) Descriptor() ([]byte, []int) { - return fileDescriptor_1c50d9b824d4ac38, []int{5} + return fileDescriptor_ff83f0b8d2b92afa, []int{5} } func (m *TestUTF8) XXX_Unmarshal(b []byte) error { @@ -498,82 +498,82 @@ func (*TestUTF8) XXX_OneofWrappers() []interface{} { } func init() { - proto.RegisterEnum("proto3_proto.Message_Humour", Message_Humour_name, Message_Humour_value) - proto.RegisterType((*Message)(nil), "proto3_proto.Message") - proto.RegisterMapType((map[string]*test_proto.SubDefaults)(nil), "proto3_proto.Message.Proto2ValueEntry") - proto.RegisterMapType((map[string]string)(nil), "proto3_proto.Message.StringMapEntry") - proto.RegisterMapType((map[string]*Nested)(nil), "proto3_proto.Message.TerrainEntry") - proto.RegisterType((*Nested)(nil), "proto3_proto.Nested") - proto.RegisterType((*MessageWithMap)(nil), "proto3_proto.MessageWithMap") - proto.RegisterMapType((map[bool][]byte)(nil), "proto3_proto.MessageWithMap.ByteMappingEntry") - proto.RegisterType((*IntMap)(nil), "proto3_proto.IntMap") - proto.RegisterMapType((map[int32]int32)(nil), "proto3_proto.IntMap.RttEntry") - proto.RegisterType((*IntMaps)(nil), "proto3_proto.IntMaps") - proto.RegisterType((*TestUTF8)(nil), "proto3_proto.TestUTF8") - proto.RegisterMapType((map[string]int64)(nil), "proto3_proto.TestUTF8.MapKeyEntry") - proto.RegisterMapType((map[int64]string)(nil), "proto3_proto.TestUTF8.MapValueEntry") -} - -func init() { proto.RegisterFile("proto3_proto/proto3.proto", fileDescriptor_1c50d9b824d4ac38) } - -var fileDescriptor_1c50d9b824d4ac38 = []byte{ - // 920 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xff, 0x6e, 0xe3, 0x44, - 0x10, 0x3e, 0xc7, 0xf9, 0xe1, 0x4c, 0x92, 0x5e, 0x58, 0x72, 0xc7, 0x5e, 0x00, 0xc9, 0x04, 0x84, - 0x2c, 0x44, 0x1d, 0xc8, 0xa9, 0xa8, 0xdc, 0x9d, 0x40, 0x4d, 0xb9, 0xea, 0xa2, 0x36, 0x21, 0x72, - 0x52, 0x2a, 0xf8, 0xc7, 0xda, 0xa4, 0x9b, 0xc4, 0x22, 0x5e, 0x07, 0xef, 0xfa, 0x24, 0xbf, 0x00, - 0x0f, 0xc2, 0x2b, 0xf1, 0x42, 0x68, 0x77, 0x9d, 0xd6, 0x39, 0xb9, 0xf4, 0xaf, 0xec, 0x7c, 0xf9, - 0x66, 0xbe, 0xd9, 0x99, 0xd9, 0x31, 0xbc, 0xd8, 0xc5, 0x91, 0x88, 0x5e, 0xfa, 0xea, 0xa7, 0xaf, - 0x0d, 0x57, 0xfd, 0xa0, 0x66, 0xfe, 0xaf, 0xee, 0x8b, 0x75, 0x14, 0xad, 0xb7, 0x54, 0x53, 0x16, - 0xc9, 0xaa, 0x4f, 0x58, 0xaa, 0x89, 0xdd, 0x67, 0x82, 0x72, 0x91, 0x45, 0x90, 0x47, 0x0d, 0xf7, - 0xfe, 0xae, 0x43, 0x6d, 0x4c, 0x39, 0x27, 0x6b, 0x8a, 0x10, 0x94, 0x19, 0x09, 0x29, 0x36, 0x6c, - 0xc3, 0xa9, 0x7b, 0xea, 0x8c, 0x4e, 0xc1, 0xda, 0x04, 0x5b, 0x12, 0x07, 0x22, 0xc5, 0x25, 0xdb, - 0x70, 0x8e, 0x06, 0x9f, 0xb9, 0x79, 0x49, 0x37, 0x73, 0x76, 0xdf, 0x25, 0x61, 0x94, 0xc4, 0xde, - 0x1d, 0x1b, 0xd9, 0xd0, 0xdc, 0xd0, 0x60, 0xbd, 0x11, 0x7e, 0xc0, 0xfc, 0x65, 0x88, 0x4d, 0xdb, - 0x70, 0x5a, 0x1e, 0x68, 0x6c, 0xc4, 0xce, 0x43, 0xa9, 0x77, 0x4b, 0x04, 0xc1, 0x65, 0xdb, 0x70, - 0x9a, 0x9e, 0x3a, 0xa3, 0x2f, 0xa0, 0x19, 0x53, 0x9e, 0x6c, 0x85, 0xbf, 0x8c, 0x12, 0x26, 0x70, - 0xcd, 0x36, 0x1c, 0xd3, 0x6b, 0x68, 0xec, 0x5c, 0x42, 0xe8, 0x4b, 0x68, 0x89, 0x38, 0xa1, 0x3e, - 0x5f, 0x46, 0x82, 0x87, 0x84, 0x61, 0xcb, 0x36, 0x1c, 0xcb, 0x6b, 0x4a, 0x70, 0x96, 0x61, 0xa8, - 0x03, 0x15, 0xbe, 0x8c, 0x62, 0x8a, 0xeb, 0xb6, 0xe1, 0x94, 0x3c, 0x6d, 0xa0, 0x36, 0x98, 0x7f, - 0xd2, 0x14, 0x57, 0x6c, 0xd3, 0x29, 0x7b, 0xf2, 0x88, 0x3e, 0x85, 0x3a, 0xdf, 0x44, 0xb1, 0xf0, - 0x25, 0xfe, 0xb1, 0x6d, 0x3a, 0x15, 0xcf, 0x52, 0xc0, 0x25, 0x4d, 0xd1, 0xb7, 0x50, 0x65, 0x94, - 0x0b, 0x7a, 0x8b, 0xab, 0xb6, 0xe1, 0x34, 0x06, 0x9d, 0xc3, 0xab, 0x4f, 0xd4, 0x7f, 0x5e, 0xc6, - 0x41, 0x27, 0x50, 0x8b, 0xfd, 0x55, 0xc2, 0x58, 0x8a, 0xdb, 0xb6, 0xf9, 0x68, 0xa5, 0xaa, 0xf1, - 0x85, 0xe4, 0xa2, 0x37, 0x50, 0x13, 0x34, 0x8e, 0x49, 0xc0, 0x30, 0xd8, 0xa6, 0xd3, 0x18, 0xf4, - 0x8a, 0xdd, 0xe6, 0x9a, 0xf4, 0x96, 0x89, 0x38, 0xf5, 0xf6, 0x2e, 0xe8, 0x15, 0xe8, 0x09, 0x18, - 0xf8, 0xab, 0x80, 0x6e, 0x6f, 0x71, 0x43, 0x25, 0xfa, 0x89, 0x7b, 0xdf, 0x6d, 0x77, 0x96, 0x2c, - 0x7e, 0xa1, 0x2b, 0x92, 0x6c, 0x05, 0xf7, 0x1a, 0x9a, 0x7c, 0x21, 0xb9, 0x68, 0x74, 0xe7, 0xfb, - 0x9e, 0x6c, 0x13, 0x8a, 0x5b, 0x4a, 0xfe, 0xeb, 0x62, 0xf9, 0xa9, 0x62, 0xfe, 0x26, 0x89, 0x3a, - 0x85, 0x2c, 0x94, 0x42, 0xd0, 0x77, 0x60, 0x11, 0x96, 0x8a, 0x4d, 0xc0, 0xd6, 0xf8, 0x28, 0xab, - 0x95, 0x9e, 0x45, 0x77, 0x3f, 0x8b, 0xee, 0x19, 0x4b, 0xbd, 0x3b, 0x16, 0x3a, 0x81, 0x46, 0x48, - 0x58, 0xea, 0x2b, 0x8b, 0xe3, 0xa7, 0x4a, 0xbb, 0xd8, 0x09, 0x24, 0x71, 0xae, 0x78, 0xe8, 0x04, - 0x80, 0x27, 0x8b, 0x50, 0x27, 0x85, 0x3f, 0x52, 0x52, 0xcf, 0x0a, 0x33, 0xf6, 0x72, 0x44, 0xf4, - 0x3d, 0x58, 0xcb, 0x4d, 0xb0, 0xbd, 0x8d, 0x29, 0xc3, 0x48, 0x49, 0x3d, 0xe0, 0x74, 0x47, 0x43, - 0xe7, 0x00, 0x5c, 0xc4, 0x01, 0x5b, 0xfb, 0x21, 0xd9, 0xe1, 0x8e, 0x72, 0xfa, 0xaa, 0xb8, 0x36, - 0x33, 0xc5, 0x1b, 0x93, 0x9d, 0xae, 0x4c, 0x9d, 0xef, 0xed, 0xee, 0x14, 0x9a, 0xf9, 0xbe, 0xed, - 0x07, 0x50, 0xbf, 0x30, 0x35, 0x80, 0xdf, 0x40, 0x45, 0x57, 0xbf, 0xf4, 0x3f, 0x23, 0xa6, 0x29, - 0xaf, 0x4a, 0xa7, 0x46, 0xf7, 0x06, 0xda, 0x1f, 0xb6, 0xa2, 0x20, 0xea, 0xf1, 0x61, 0xd4, 0x07, - 0xe7, 0x21, 0x17, 0xf8, 0x0d, 0x1c, 0x1d, 0xde, 0xa3, 0x20, 0x6c, 0x27, 0x1f, 0xb6, 0x9e, 0xf3, - 0xee, 0xfd, 0x0c, 0x55, 0x3d, 0xd7, 0xa8, 0x01, 0xb5, 0xeb, 0xc9, 0xe5, 0xe4, 0xd7, 0x9b, 0x49, - 0xfb, 0x09, 0xb2, 0xa0, 0x3c, 0xbd, 0x9e, 0xcc, 0xda, 0x06, 0x6a, 0x41, 0x7d, 0x76, 0x75, 0x36, - 0x9d, 0xcd, 0x47, 0xe7, 0x97, 0xed, 0x12, 0x7a, 0x0a, 0x8d, 0xe1, 0xe8, 0xea, 0xca, 0x1f, 0x9e, - 0x8d, 0xae, 0xde, 0xfe, 0xde, 0x36, 0x7b, 0x03, 0xa8, 0xea, 0xcb, 0x4a, 0x91, 0x85, 0x7a, 0x45, - 0x5a, 0x58, 0x1b, 0x72, 0x59, 0x2c, 0x13, 0xa1, 0x95, 0x2d, 0x4f, 0x9d, 0x7b, 0xff, 0x18, 0x70, - 0x94, 0xf5, 0xe0, 0x26, 0x10, 0x9b, 0x31, 0xd9, 0xa1, 0x29, 0x34, 0x17, 0xa9, 0xa0, 0xb2, 0x67, - 0x3b, 0x39, 0x8c, 0x86, 0xea, 0xdb, 0x71, 0x61, 0xdf, 0x32, 0x1f, 0x77, 0x98, 0x0a, 0x3a, 0xd6, - 0xfc, 0x6c, 0xb4, 0x17, 0xf7, 0x48, 0xf7, 0x27, 0x68, 0x7f, 0x48, 0xc8, 0x57, 0xc6, 0x2a, 0xa8, - 0x4c, 0x33, 0x5f, 0x99, 0xbf, 0xa0, 0x3a, 0x62, 0x42, 0xe6, 0xd6, 0x07, 0x33, 0x16, 0x22, 0x4b, - 0xe9, 0xf3, 0xc3, 0x94, 0x34, 0xc5, 0xf5, 0x84, 0xd0, 0x29, 0x48, 0x66, 0xf7, 0x07, 0xb0, 0xf6, - 0x40, 0x5e, 0xb2, 0x52, 0x20, 0x59, 0xc9, 0x4b, 0xbe, 0x84, 0x9a, 0x8e, 0xc7, 0x91, 0x03, 0xe5, - 0x90, 0xec, 0x78, 0x26, 0xda, 0x29, 0x12, 0xf5, 0x14, 0xa3, 0xf7, 0x6f, 0x09, 0xac, 0x39, 0xe5, - 0xe2, 0x7a, 0x7e, 0x71, 0x8a, 0x9e, 0x43, 0x95, 0x2f, 0xc9, 0x96, 0xc4, 0x59, 0x13, 0x32, 0x4b, - 0xe2, 0xef, 0xe9, 0x52, 0x44, 0x31, 0x2e, 0xd9, 0xa6, 0xc4, 0xb5, 0x85, 0x9e, 0x43, 0x45, 0xef, - 0x1f, 0xb9, 0xe5, 0xeb, 0xef, 0x9e, 0x78, 0xda, 0x44, 0xaf, 0xa1, 0x16, 0x92, 0x9d, 0x5a, 0xae, - 0xe5, 0xa2, 0xe5, 0xb6, 0x17, 0x74, 0xc7, 0x64, 0x77, 0x49, 0x53, 0x7d, 0xf7, 0x6a, 0xa8, 0x0c, - 0x74, 0x06, 0x75, 0xe9, 0xac, 0x2f, 0x59, 0x29, 0x7a, 0x80, 0x79, 0xf7, 0xdc, 0x6a, 0xb2, 0xc2, - 0xcc, 0xec, 0xfe, 0x08, 0x8d, 0x5c, 0xe4, 0xc7, 0x26, 0xda, 0xcc, 0xbf, 0x87, 0xd7, 0xd0, 0x3a, - 0x88, 0x9a, 0x77, 0x36, 0x1f, 0x79, 0x0e, 0xc3, 0x1a, 0x54, 0x22, 0x46, 0xa3, 0xd5, 0xb0, 0xff, - 0xc7, 0xf1, 0x3a, 0x10, 0x9b, 0x64, 0xe1, 0x2e, 0xa3, 0xb0, 0xbf, 0x8e, 0xb6, 0x84, 0xad, 0xef, - 0x3f, 0xcf, 0xf9, 0x0f, 0xba, 0xbe, 0xd2, 0xa2, 0xaa, 0xad, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, - 0xae, 0xc1, 0x78, 0xeb, 0xf4, 0x07, 0x00, 0x00, + proto.RegisterEnum("proto3_test.Message_Humour", Message_Humour_name, Message_Humour_value) + proto.RegisterType((*Message)(nil), "proto3_test.Message") + proto.RegisterMapType((map[string]*proto2_proto.SubDefaults)(nil), "proto3_test.Message.Proto2ValueEntry") + proto.RegisterMapType((map[string]string)(nil), "proto3_test.Message.StringMapEntry") + proto.RegisterMapType((map[string]*Nested)(nil), "proto3_test.Message.TerrainEntry") + proto.RegisterType((*Nested)(nil), "proto3_test.Nested") + proto.RegisterType((*MessageWithMap)(nil), "proto3_test.MessageWithMap") + proto.RegisterMapType((map[bool][]byte)(nil), "proto3_test.MessageWithMap.ByteMappingEntry") + proto.RegisterType((*IntMap)(nil), "proto3_test.IntMap") + proto.RegisterMapType((map[int32]int32)(nil), "proto3_test.IntMap.RttEntry") + proto.RegisterType((*IntMaps)(nil), "proto3_test.IntMaps") + proto.RegisterType((*TestUTF8)(nil), "proto3_test.TestUTF8") + proto.RegisterMapType((map[string]int64)(nil), "proto3_test.TestUTF8.MapKeyEntry") + proto.RegisterMapType((map[int64]string)(nil), "proto3_test.TestUTF8.MapValueEntry") +} + +func init() { proto.RegisterFile("proto3_proto/test.proto", fileDescriptor_ff83f0b8d2b92afa) } + +var fileDescriptor_ff83f0b8d2b92afa = []byte{ + // 926 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0x6d, 0x6f, 0xdb, 0x36, + 0x10, 0xae, 0x2c, 0xbf, 0xc8, 0x67, 0x3b, 0xf5, 0x98, 0xa0, 0xe3, 0xdc, 0x7d, 0x50, 0x5d, 0x0c, + 0xd3, 0xb0, 0x41, 0x1e, 0xbc, 0x6e, 0xeb, 0x9a, 0xbd, 0xc5, 0x59, 0x83, 0x18, 0x89, 0x9d, 0x40, + 0x76, 0xd6, 0x6d, 0x5f, 0x04, 0xda, 0xa1, 0x6d, 0x61, 0x12, 0x65, 0x88, 0x54, 0x01, 0xfd, 0x9c, + 0xfd, 0xa4, 0xfd, 0xa2, 0x0d, 0x24, 0xe5, 0x54, 0x6e, 0x15, 0xe4, 0x93, 0x79, 0x8f, 0x9f, 0xbb, + 0xe7, 0x78, 0x77, 0x3c, 0xc1, 0xc7, 0xdb, 0x24, 0x16, 0xf1, 0x37, 0xbe, 0xfa, 0x19, 0x08, 0xca, + 0x85, 0xab, 0x8e, 0xa8, 0x95, 0xff, 0x21, 0xa1, 0xde, 0x27, 0xeb, 0x38, 0x5e, 0x87, 0x74, 0xa0, + 0xb0, 0x45, 0xba, 0x1a, 0x10, 0x96, 0x69, 0x5e, 0x4f, 0x07, 0x18, 0x7e, 0x10, 0xa0, 0xff, 0x9f, + 0x05, 0x8d, 0x09, 0xe5, 0x9c, 0xac, 0x29, 0x42, 0x50, 0x65, 0x24, 0xa2, 0xd8, 0xb0, 0x0d, 0xa7, + 0xe9, 0xa9, 0x33, 0xfa, 0x1e, 0xac, 0x4d, 0x10, 0x92, 0x24, 0x10, 0x19, 0xae, 0xd8, 0x86, 0x73, + 0x30, 0x7c, 0xea, 0x16, 0x34, 0xdd, 0xdc, 0xd7, 0x3d, 0x4f, 0xa3, 0x38, 0x4d, 0xbc, 0x3b, 0x32, + 0xb2, 0xa1, 0xbd, 0xa1, 0xc1, 0x7a, 0x23, 0xfc, 0x80, 0xf9, 0xcb, 0x08, 0x9b, 0xb6, 0xe1, 0x74, + 0x3c, 0xd0, 0xd8, 0x98, 0x9d, 0x46, 0x52, 0xee, 0x96, 0x08, 0x82, 0xab, 0xb6, 0xe1, 0xb4, 0x3d, + 0x75, 0x46, 0xcf, 0xa0, 0x9d, 0x50, 0x9e, 0x86, 0xc2, 0x5f, 0xc6, 0x29, 0x13, 0xb8, 0x61, 0x1b, + 0x8e, 0xe9, 0xb5, 0x34, 0x76, 0x2a, 0x21, 0xf4, 0x1c, 0x3a, 0x22, 0x49, 0xa9, 0xcf, 0x97, 0xb1, + 0xe0, 0x11, 0x61, 0xd8, 0xb2, 0x0d, 0xc7, 0xf2, 0xda, 0x12, 0x9c, 0xe5, 0x18, 0x3a, 0x82, 0x1a, + 0x5f, 0xc6, 0x09, 0xc5, 0x4d, 0xdb, 0x70, 0x2a, 0x9e, 0x36, 0x50, 0x17, 0xcc, 0xbf, 0x69, 0x86, + 0x6b, 0xb6, 0xe9, 0x54, 0x3d, 0x79, 0x44, 0x4f, 0xa1, 0xc9, 0x37, 0x71, 0x22, 0x7c, 0x89, 0x1f, + 0xda, 0xa6, 0x53, 0xf3, 0x2c, 0x05, 0x5c, 0xd0, 0x0c, 0x7d, 0x09, 0x75, 0x46, 0xb9, 0xa0, 0xb7, + 0xb8, 0x6e, 0x1b, 0x4e, 0x6b, 0x78, 0xb8, 0x77, 0xf3, 0xa9, 0xfa, 0xcb, 0xcb, 0x29, 0xe8, 0x05, + 0x34, 0x12, 0x7f, 0x95, 0x32, 0x96, 0xe1, 0xae, 0x6d, 0x3e, 0x54, 0xa7, 0x7a, 0x72, 0x26, 0xa9, + 0xe8, 0x18, 0x1a, 0x82, 0x26, 0x09, 0x09, 0x18, 0x06, 0xdb, 0x74, 0x5a, 0xc3, 0x67, 0xa5, 0x5e, + 0x73, 0xcd, 0x79, 0xcd, 0x44, 0x92, 0x79, 0x3b, 0x0f, 0x74, 0x0c, 0xed, 0xbc, 0xad, 0xab, 0x80, + 0x86, 0xb7, 0xb8, 0xa5, 0xb2, 0xc4, 0x6e, 0x0e, 0xaa, 0x08, 0xb3, 0x74, 0xf1, 0x1b, 0x5d, 0x91, + 0x34, 0x14, 0xdc, 0xd3, 0xc3, 0x32, 0x3c, 0x93, 0x64, 0x74, 0x7e, 0xe7, 0xfc, 0x96, 0x84, 0x29, + 0xc5, 0x1d, 0x25, 0xff, 0x59, 0xa9, 0xfc, 0xb5, 0x22, 0xfe, 0x2e, 0x79, 0x3a, 0x85, 0x3c, 0x92, + 0x42, 0xd0, 0xd7, 0x60, 0x11, 0x96, 0x89, 0x4d, 0xc0, 0xd6, 0xf8, 0x40, 0xa5, 0x70, 0xe4, 0xea, + 0x49, 0x74, 0x77, 0x93, 0xe8, 0x9e, 0xb0, 0xcc, 0xbb, 0x63, 0xa1, 0x6f, 0xa1, 0x15, 0x11, 0x96, + 0xf9, 0xca, 0xe2, 0xf8, 0xb1, 0x92, 0x2e, 0x77, 0x02, 0x49, 0x9c, 0x2b, 0x1e, 0x7a, 0x01, 0xc0, + 0xd3, 0x45, 0xa4, 0x93, 0xc2, 0x1f, 0xe5, 0x52, 0x25, 0x09, 0x7b, 0x05, 0x9e, 0x4c, 0x6f, 0xb9, + 0x09, 0xc2, 0xdb, 0x84, 0x32, 0x8c, 0x72, 0xa5, 0x32, 0x9f, 0x3b, 0x16, 0x1a, 0x01, 0x70, 0x91, + 0x04, 0x6c, 0xed, 0x47, 0x64, 0x8b, 0x8f, 0x94, 0xcf, 0xf3, 0xd2, 0xc2, 0xcc, 0x14, 0x6d, 0x42, + 0xb6, 0xba, 0x2c, 0x4d, 0xbe, 0xb3, 0x7b, 0x57, 0xd0, 0x2e, 0x36, 0x6d, 0x37, 0x7a, 0xfa, 0x69, + 0xa9, 0xd1, 0xfb, 0x02, 0x6a, 0xba, 0xf2, 0x95, 0xfb, 0x87, 0x4b, 0x33, 0x5e, 0x55, 0x5e, 0x1a, + 0xbd, 0x3f, 0xa0, 0xfb, 0x7e, 0x1b, 0x4a, 0x82, 0xba, 0xfb, 0x41, 0xef, 0x9f, 0x85, 0x42, 0xe4, + 0x1f, 0xe1, 0x60, 0xff, 0x1e, 0x25, 0x71, 0x8f, 0x8a, 0x71, 0x9b, 0x05, 0xef, 0xfe, 0x2f, 0x50, + 0xd7, 0x33, 0x8d, 0x5a, 0xd0, 0xb8, 0x99, 0x5e, 0x4c, 0xaf, 0xde, 0x4c, 0xbb, 0x8f, 0x90, 0x05, + 0xd5, 0xeb, 0x9b, 0xe9, 0xac, 0x6b, 0xa0, 0x0e, 0x34, 0x67, 0x97, 0x27, 0xd7, 0xb3, 0xf9, 0xf8, + 0xf4, 0xa2, 0x5b, 0x41, 0x8f, 0xa1, 0x35, 0x1a, 0x5f, 0x5e, 0xfa, 0xa3, 0x93, 0xf1, 0xe5, 0xeb, + 0x3f, 0xbb, 0x66, 0x7f, 0x08, 0x75, 0x7d, 0x5b, 0x29, 0xb2, 0x50, 0x0f, 0x48, 0x0b, 0x6b, 0x43, + 0xae, 0x89, 0x65, 0x2a, 0xb4, 0xb2, 0xe5, 0xa9, 0x73, 0xff, 0x1f, 0x03, 0x0e, 0xf2, 0x1e, 0xbc, + 0x09, 0xc4, 0x66, 0x42, 0xb6, 0xe8, 0x0a, 0xda, 0x8b, 0x4c, 0x50, 0xd9, 0xb2, 0xad, 0x9c, 0x44, + 0x43, 0xb5, 0xed, 0xab, 0xb2, 0xb6, 0xe5, 0x2e, 0xee, 0x28, 0x13, 0x74, 0xa2, 0xe9, 0xf9, 0x58, + 0x2f, 0xde, 0x21, 0xbd, 0x9f, 0xa1, 0xfb, 0x3e, 0xa1, 0x58, 0x18, 0xab, 0xa4, 0x30, 0xed, 0x62, + 0x61, 0xb6, 0x50, 0x1f, 0x33, 0x21, 0x53, 0x73, 0xc1, 0x4c, 0x84, 0xc8, 0x33, 0xfa, 0x74, 0x2f, + 0x23, 0xcd, 0x70, 0x3d, 0x21, 0x74, 0x06, 0x92, 0xd8, 0xfb, 0x0e, 0xac, 0x1d, 0x50, 0x54, 0xac, + 0x95, 0x28, 0xd6, 0x8a, 0x8a, 0x43, 0x68, 0xe8, 0x78, 0x1c, 0x7d, 0x0e, 0xd5, 0x88, 0x6c, 0x79, + 0xae, 0x79, 0x58, 0xa2, 0xe9, 0x29, 0x42, 0xff, 0xdf, 0x0a, 0x58, 0x73, 0xca, 0xc5, 0xcd, 0xfc, + 0xec, 0x25, 0x7a, 0x02, 0x75, 0xbe, 0x24, 0x21, 0x49, 0xf2, 0x0e, 0xe4, 0x96, 0xc4, 0xdf, 0xd2, + 0xa5, 0x88, 0x13, 0x5c, 0xb1, 0x4d, 0x89, 0x6b, 0x0b, 0x3d, 0x81, 0x9a, 0xde, 0x3c, 0x72, 0xb9, + 0x37, 0xcf, 0x1f, 0x79, 0xda, 0x44, 0xaf, 0xa0, 0x11, 0x91, 0xad, 0xda, 0xa9, 0xd5, 0x92, 0xad, + 0xb6, 0xd3, 0x73, 0x27, 0x64, 0x7b, 0x41, 0x33, 0x7d, 0xf3, 0x7a, 0xa4, 0x0c, 0xf4, 0x2b, 0x34, + 0xa5, 0xaf, 0xbe, 0x62, 0xad, 0xe4, 0xed, 0x15, 0xbd, 0x0b, 0x2b, 0xc9, 0x8a, 0x72, 0xb3, 0xf7, + 0x03, 0xb4, 0x0a, 0x81, 0x1f, 0x1a, 0x66, 0xb3, 0xf8, 0x14, 0x8e, 0xa1, 0xb3, 0x17, 0xb5, 0xe8, + 0x6c, 0x3e, 0xf0, 0x12, 0x46, 0x0d, 0xa8, 0xc5, 0x8c, 0xc6, 0xab, 0xd1, 0x4f, 0x7f, 0x1d, 0xaf, + 0x03, 0xb1, 0x49, 0x17, 0xee, 0x32, 0x8e, 0x06, 0xeb, 0x38, 0x24, 0x6c, 0xfd, 0xee, 0xa3, 0x1c, + 0x30, 0x41, 0x13, 0x46, 0x42, 0xf5, 0x15, 0x56, 0x28, 0x1f, 0x14, 0x3f, 0xef, 0x8b, 0xba, 0xb6, + 0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x10, 0x03, 0x1b, 0x06, 0xf5, 0x07, 0x00, 0x00, } diff --git a/internal/testprotos/proto3_proto/test.proto b/internal/testprotos/proto3_proto/test.proto new file mode 100644 index 0000000000..b1c6749d1f --- /dev/null +++ b/internal/testprotos/proto3_proto/test.proto @@ -0,0 +1,72 @@ +// Copyright 2014 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. + +syntax = "proto3"; + +option go_package = "github.com/golang/protobuf/internal/testprotos/proto3_proto"; + +import "google/protobuf/any.proto"; +import "proto2_proto/test.proto"; + +package proto3_test; + +message Message { + enum Humour { + UNKNOWN = 0; + PUNS = 1; + SLAPSTICK = 2; + BILL_BAILEY = 3; + } + + string name = 1; + Humour hilarity = 2; + uint32 height_in_cm = 3; + bytes data = 4; + int64 result_count = 7; + bool true_scotsman = 8; + float score = 9; + + repeated uint64 key = 5; + repeated int32 short_key = 19; + Nested nested = 6; + repeated Humour r_funny = 16; + + map terrain = 10; + proto2_test.SubDefaults proto2_field = 11; + map proto2_value = 13; + + google.protobuf.Any anything = 14; + repeated google.protobuf.Any many_things = 15; + + Message submessage = 17; + repeated Message children = 18; + + map string_map = 20; +} + +message Nested { + string bunny = 1; + bool cute = 2; +} + +message MessageWithMap { + map byte_mapping = 1; +} + + +message IntMap { + map rtt = 1; +} + +message IntMaps { + repeated IntMap maps = 1; +} + +message TestUTF8 { + string scalar = 1; + repeated string vector = 2; + oneof oneof { string field = 3; } + map map_key = 4; + map map_value = 5; +} diff --git a/internal/testprotos/regenerate.bash b/internal/testprotos/regenerate.bash new file mode 100755 index 0000000000..c2eb29703b --- /dev/null +++ b/internal/testprotos/regenerate.bash @@ -0,0 +1,17 @@ +#!/bin/bash +# Copyright 2020 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. + +# NOTE: The integration scripts deliberately do not check to +# make sure that the test protos have been regenerated. +# It is intentional that older versions of the .pb.go files +# are checked in to ensure that they continue to function. +# +# Versions used: +# protoc: v3.9.1 +# protoc-gen-go: v1.3.2 + +for X in $(find . -name "*.proto" | sed "s|^\./||"); do + protoc -I$(pwd) --go_out=paths=source_relative:. $X +done diff --git a/internal/wire/wire.go b/internal/wire/wire.go index f4282e0f1e..ee993de8e5 100644 --- a/internal/wire/wire.go +++ b/internal/wire/wire.go @@ -168,7 +168,6 @@ func SizeTag(num Number) int { // AppendVarint appends v to b as a varint-encoded uint64. func AppendVarint(b []byte, v uint64) []byte { - // TODO: Specialize for sizes 1 and 2 with mid-stack inlining. switch { case v < 1<<7: b = append(b, byte(v)) @@ -251,7 +250,6 @@ func AppendVarint(b []byte, v uint64) []byte { // ConsumeVarint parses b as a varint-encoded uint64, reporting its length. // This returns a negative length upon an error (see ParseError). func ConsumeVarint(b []byte) (v uint64, n int) { - // TODO: Specialize for sizes 1 and 2 with mid-stack inlining. var y uint64 if len(b) <= 0 { return 0, errCodeTruncated @@ -435,6 +433,18 @@ func SizeBytes(n int) int { return SizeVarint(uint64(n)) + n } +// AppendString appends v to b as a length-prefixed bytes value. +func AppendString(b []byte, v string) []byte { + return append(AppendVarint(b, uint64(len(v))), v...) +} + +// ConsumeString parses b as a length-prefixed bytes value, reporting its length. +// This returns a negative length upon an error (see ParseError). +func ConsumeString(b []byte) (v string, n int) { + bb, n := ConsumeBytes(b) + return string(bb), n +} + // AppendGroup appends v to b as group value, with a trailing end group marker. // The value v must not contain the end marker. func AppendGroup(b []byte, num Number, v []byte) []byte { @@ -469,7 +479,7 @@ func SizeGroup(num Number, n int) int { } // DecodeTag decodes the field Number and wire Type from its unified form. -// The Number is -1 if the decoded field number overflows. +// The Number is -1 if the decoded field number overflows int32. // Other than overflow, this does not check for field number validity. func DecodeTag(x uint64) (Number, Type) { // NOTE: MessageSet allows for larger field numbers than normal. diff --git a/jsonpb/decode.go b/jsonpb/decode.go new file mode 100644 index 0000000000..22c8eca744 --- /dev/null +++ b/jsonpb/decode.go @@ -0,0 +1,512 @@ +// Copyright 2015 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 jsonpb + +import ( + "encoding/json" + "errors" + "fmt" + "io" + "math" + "reflect" + "strconv" + "strings" + "time" + + "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/encoding/protojson" + protoV2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/runtime/protoimpl" +) + +const wrapJSONUnmarshalV2 = false + +// UnmarshalNext unmarshals the next object in a JSON object stream into m. +func UnmarshalNext(d *json.Decoder, m proto.Message) error { + return new(Unmarshaler).UnmarshalNext(d, m) +} + +// Unmarshal unmarshals a JSON object from r into m. +func Unmarshal(r io.Reader, m proto.Message) error { + return new(Unmarshaler).Unmarshal(r, m) +} + +// UnmarshalString unmarshals a JSON object from s into m. +func UnmarshalString(s string, m proto.Message) error { + return new(Unmarshaler).Unmarshal(strings.NewReader(s), m) +} + +// Unmarshaler is a configurable object for converting from a JSON +// representation to a protocol buffer object. +type Unmarshaler struct { + // AllowUnknownFields specifies whether to allow messages to contain + // unknown JSON fields, as opposed to failing to unmarshal. + AllowUnknownFields bool + + // AnyResolver is used to resolve the google.protobuf.Any well-known type. + // If unset, the global registry is used by default. + AnyResolver AnyResolver +} + +// JSONPBUnmarshaler is implemented by protobuf messages that customize the way +// they are unmarshaled from JSON. Messages that implement this should also +// implement JSONPBMarshaler so that the custom format can be produced. +// +// The JSON unmarshaling must follow the JSON to proto specification: +// https://developers.google.com/protocol-buffers/docs/proto3#json +// +// Deprecated: Custom types should implement protobuf reflection instead. +type JSONPBUnmarshaler interface { + UnmarshalJSONPB(*Unmarshaler, []byte) error +} + +// Unmarshal unmarshals a JSON object from r into m. +func (u *Unmarshaler) Unmarshal(r io.Reader, m proto.Message) error { + return u.UnmarshalNext(json.NewDecoder(r), m) +} + +// UnmarshalNext unmarshals the next object in a JSON object stream into m. +func (u *Unmarshaler) UnmarshalNext(d *json.Decoder, m proto.Message) error { + if m == nil { + return errors.New("invalid nil message") + } + + // Parse the next JSON object from the stream. + raw := json.RawMessage{} + if err := d.Decode(&raw); err != nil { + return err + } + + // Check for custom unmarshalers first since they may not properly + // implement protobuf reflection that the logic below relies on. + if jsu, ok := m.(JSONPBUnmarshaler); ok { + return jsu.UnmarshalJSONPB(u, raw) + } + + mr := protoimpl.X.MessageOf(m) + + // NOTE: For historical reasons, a top-level null is treated as a noop. + // This is incorrect, but kept for compatibility. + if string(raw) == "null" && mr.Descriptor().FullName() != "google.protobuf.Value" { + return nil + } + + if wrapJSONUnmarshalV2 { + // NOTE: If input message is non-empty, we need to preserve merge semantics + // of the old jsonpb implementation. These semantics are not supported by + // the protobuf JSON specification. + isEmpty := true + mr.Range(func(protoreflect.FieldDescriptor, protoreflect.Value) bool { + isEmpty = false // at least one iteration implies non-empty + return false + }) + if !isEmpty { + // Perform unmarshaling into a newly allocated, empty message. + mr = mr.New() + + // Use a defer to copy all unmarshaled fields into the original message. + dst := protoimpl.X.MessageOf(m) + defer mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { + dst.Set(fd, v) + return true + }) + } + + // Unmarshal using the v2 JSON unmarshaler. + opts := protojson.UnmarshalOptions{ + DiscardUnknown: u.AllowUnknownFields, + } + if u.AnyResolver != nil { + opts.Resolver = anyResolver{u.AnyResolver} + } + return opts.Unmarshal(raw, mr.Interface()) + } else { + if err := u.unmarshalMessage(mr, raw); err != nil { + return err + } + return protoV2.IsInitialized(mr.Interface()) + } +} + +func (u *Unmarshaler) unmarshalMessage(m protoreflect.Message, in []byte) error { + md := m.Descriptor() + fds := md.Fields() + + if string(in) == "null" && md.FullName() != "google.protobuf.Value" { + return nil + } + + if jsu, ok := protoimpl.X.ProtoMessageV1Of(m.Interface()).(JSONPBUnmarshaler); ok { + return jsu.UnmarshalJSONPB(u, in) + } + + switch wellKnownType(md.FullName()) { + case "Any": + var jsonObject map[string]json.RawMessage + if err := json.Unmarshal(in, &jsonObject); err != nil { + return err + } + + rawTypeURL, ok := jsonObject["@type"] + if !ok { + return errors.New("Any JSON doesn't have '@type'") + } + typeURL, err := unquoteString(string(rawTypeURL)) + if err != nil { + return fmt.Errorf("can't unmarshal Any's '@type': %q", rawTypeURL) + } + m.Set(fds.ByNumber(1), protoreflect.ValueOfString(typeURL)) + + var m2 protoreflect.Message + if u.AnyResolver != nil { + mi, err := u.AnyResolver.Resolve(typeURL) + if err != nil { + return err + } + m2 = protoimpl.X.MessageOf(mi) + } else { + mt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL) + if err != nil { + if err == protoregistry.NotFound { + return fmt.Errorf("could not resolve Any message type: %v", typeURL) + } + return err + } + m2 = mt.New() + } + + if wellKnownType(m2.Descriptor().FullName()) != "" { + rawValue, ok := jsonObject["value"] + if !ok { + return errors.New("Any JSON doesn't have 'value'") + } + if err := u.unmarshalMessage(m2, rawValue); err != nil { + return fmt.Errorf("can't unmarshal Any nested proto %v: %v", typeURL, err) + } + } else { + delete(jsonObject, "@type") + rawJSON, err := json.Marshal(jsonObject) + if err != nil { + return fmt.Errorf("can't generate JSON for Any's nested proto to be unmarshaled: %v", err) + } + if err = u.unmarshalMessage(m2, rawJSON); err != nil { + return fmt.Errorf("can't unmarshal Any nested proto %v: %v", typeURL, err) + } + } + + rawWire, err := protoV2.Marshal(m2.Interface()) + if err != nil { + return fmt.Errorf("can't marshal proto %v into Any.Value: %v", typeURL, err) + } + m.Set(fds.ByNumber(2), protoreflect.ValueOfBytes(rawWire)) + return nil + case "BoolValue", "BytesValue", "StringValue", + "Int32Value", "UInt32Value", "FloatValue", + "Int64Value", "UInt64Value", "DoubleValue": + fd := fds.ByNumber(1) + v, err := u.unmarshalValue(m.NewField(fd), in, fd) + if err != nil { + return err + } + m.Set(fd, v) + return nil + case "Duration": + v, err := unquoteString(string(in)) + if err != nil { + return err + } + d, err := time.ParseDuration(v) + if err != nil { + return fmt.Errorf("bad Duration: %v", err) + } + + sec := d.Nanoseconds() / 1e9 + nsec := d.Nanoseconds() % 1e9 + m.Set(fds.ByNumber(1), protoreflect.ValueOfInt64(int64(sec))) + m.Set(fds.ByNumber(2), protoreflect.ValueOfInt32(int32(nsec))) + return nil + case "Timestamp": + v, err := unquoteString(string(in)) + if err != nil { + return err + } + t, err := time.Parse(time.RFC3339Nano, v) + if err != nil { + return fmt.Errorf("bad Timestamp: %v", err) + } + + sec := t.Unix() + nsec := t.Nanosecond() + m.Set(fds.ByNumber(1), protoreflect.ValueOfInt64(int64(sec))) + m.Set(fds.ByNumber(2), protoreflect.ValueOfInt32(int32(nsec))) + return nil + case "Value": + switch { + case string(in) == "null": + m.Set(fds.ByNumber(1), protoreflect.ValueOfEnum(0)) + case string(in) == "true": + m.Set(fds.ByNumber(4), protoreflect.ValueOfBool(true)) + case string(in) == "false": + m.Set(fds.ByNumber(4), protoreflect.ValueOfBool(false)) + case hasPrefixAndSuffix('"', in, '"'): + s, err := unquoteString(string(in)) + if err != nil { + return fmt.Errorf("unrecognized type for Value %q", in) + } + m.Set(fds.ByNumber(3), protoreflect.ValueOfString(s)) + case hasPrefixAndSuffix('[', in, ']'): + v := m.Mutable(fds.ByNumber(6)) + return u.unmarshalMessage(v.Message(), in) + case hasPrefixAndSuffix('{', in, '}'): + v := m.Mutable(fds.ByNumber(5)) + return u.unmarshalMessage(v.Message(), in) + default: + f, err := strconv.ParseFloat(string(in), 0) + if err != nil { + return fmt.Errorf("unrecognized type for Value %q", in) + } + m.Set(fds.ByNumber(2), protoreflect.ValueOfFloat64(f)) + } + return nil + case "ListValue": + var jsonArray []json.RawMessage + if err := json.Unmarshal(in, &jsonArray); err != nil { + return fmt.Errorf("bad ListValue: %v", err) + } + + lv := m.Mutable(fds.ByNumber(1)).List() + for _, raw := range jsonArray { + ve := lv.NewElement() + if err := u.unmarshalMessage(ve.Message(), raw); err != nil { + return err + } + lv.Append(ve) + } + return nil + case "Struct": + var jsonObject map[string]json.RawMessage + if err := json.Unmarshal(in, &jsonObject); err != nil { + return fmt.Errorf("bad StructValue: %v", err) + } + + mv := m.Mutable(fds.ByNumber(1)).Map() + for key, raw := range jsonObject { + kv := protoreflect.ValueOf(key).MapKey() + vv := mv.NewValue() + if err := u.unmarshalMessage(vv.Message(), raw); err != nil { + return fmt.Errorf("bad value in StructValue for key %q: %v", key, err) + } + mv.Set(kv, vv) + } + return nil + } + + var jsonObject map[string]json.RawMessage + if err := json.Unmarshal(in, &jsonObject); err != nil { + return err + } + + // Handle known fields. + for i := 0; i < fds.Len(); i++ { + fd := fds.Get(i) + if fd.IsWeak() && fd.Message().IsPlaceholder() { + continue // weak reference is not linked in + } + + // Search for any raw JSON value associated with this field. + var raw json.RawMessage + name := string(fd.Name()) + if fd.Kind() == protoreflect.GroupKind { + name = string(fd.Message().Name()) + } + if v, ok := jsonObject[name]; ok { + delete(jsonObject, name) + raw = v + } + name = string(fd.JSONName()) + if v, ok := jsonObject[name]; ok { + delete(jsonObject, name) + raw = v + } + + // Unmarshal the field value. + if raw == nil || (string(raw) == "null" && !isSingularWellKnownValue(fd)) { + continue + } + v, err := u.unmarshalValue(m.NewField(fd), raw, fd) + if err != nil { + return err + } + m.Set(fd, v) + } + + // Handle extension fields. + for name, raw := range jsonObject { + if !strings.HasPrefix(name, "[") || !strings.HasSuffix(name, "]") { + continue + } + + // Resolve the extension field by name. + xname := protoreflect.FullName(name[len("[") : len(name)-len("]")]) + xt, _ := protoregistry.GlobalTypes.FindExtensionByName(xname) + if xt == nil && isMessageSet(md) { + xt, _ = protoregistry.GlobalTypes.FindExtensionByName(xname.Append("message_set_extension")) + } + if xt == nil { + continue + } + delete(jsonObject, name) + fd := xt.TypeDescriptor() + + // Unmarshal the field value. + if raw == nil || (string(raw) == "null" && !isSingularWellKnownValue(fd)) { + continue + } + v, err := u.unmarshalValue(m.NewField(fd), raw, fd) + if err != nil { + return err + } + m.Set(fd, v) + } + + if !u.AllowUnknownFields && len(jsonObject) > 0 { + for name := range jsonObject { + return fmt.Errorf("unknown field %q in %v", name, md.FullName()) + } + } + return nil +} + +func isSingularWellKnownValue(fd protoreflect.FieldDescriptor) bool { + if md := fd.Message(); md != nil { + return md.FullName() == "google.protobuf.Value" && fd.Cardinality() != protoreflect.Repeated + } + return false +} + +func (u *Unmarshaler) unmarshalValue(v protoreflect.Value, in []byte, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { + switch { + case fd.IsList(): + var jsonArray []json.RawMessage + if err := json.Unmarshal(in, &jsonArray); err != nil { + return v, err + } + lv := v.List() + for _, raw := range jsonArray { + ve, err := u.unmarshalSingularValue(lv.NewElement(), raw, fd) + if err != nil { + return v, err + } + lv.Append(ve) + } + return v, nil + case fd.IsMap(): + var jsonObject map[string]json.RawMessage + if err := json.Unmarshal(in, &jsonObject); err != nil { + return v, err + } + kfd := fd.MapKey() + vfd := fd.MapValue() + mv := v.Map() + for key, raw := range jsonObject { + var kv protoreflect.MapKey + if kfd.Kind() == protoreflect.StringKind { + kv = protoreflect.ValueOf(key).MapKey() + } else { + v, err := u.unmarshalSingularValue(kfd.Default(), []byte(key), kfd) + if err != nil { + return v, err + } + kv = v.MapKey() + } + + vv, err := u.unmarshalSingularValue(mv.NewValue(), raw, vfd) + if err != nil { + return v, err + } + mv.Set(kv, vv) + } + return v, nil + default: + return u.unmarshalSingularValue(v, in, fd) + } +} + +var nonFinite = map[string]float64{ + `"NaN"`: math.NaN(), + `"Infinity"`: math.Inf(+1), + `"-Infinity"`: math.Inf(-1), +} + +func (u *Unmarshaler) unmarshalSingularValue(v protoreflect.Value, in []byte, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { + switch fd.Kind() { + case protoreflect.BoolKind: + return unmarshalValue(in, new(bool)) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + return unmarshalValue(trimQuote(in), new(int32)) + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + return unmarshalValue(trimQuote(in), new(int64)) + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + return unmarshalValue(trimQuote(in), new(uint32)) + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + return unmarshalValue(trimQuote(in), new(uint64)) + case protoreflect.FloatKind: + if f, ok := nonFinite[string(in)]; ok { + return protoreflect.ValueOfFloat32(float32(f)), nil + } + return unmarshalValue(trimQuote(in), new(float32)) + case protoreflect.DoubleKind: + if f, ok := nonFinite[string(in)]; ok { + return protoreflect.ValueOfFloat64(float64(f)), nil + } + return unmarshalValue(trimQuote(in), new(float64)) + case protoreflect.StringKind: + return unmarshalValue(in, new(string)) + case protoreflect.BytesKind: + return unmarshalValue(in, new([]byte)) + case protoreflect.EnumKind: + if hasPrefixAndSuffix('"', in, '"') { + vd := fd.Enum().Values().ByName(protoreflect.Name(trimQuote(in))) + if vd == nil { + return v, fmt.Errorf("unknown value %v for enum %s", in, fd.Enum().FullName()) + } + return protoreflect.ValueOfEnum(vd.Number()), nil + } + return unmarshalValue(in, new(protoreflect.EnumNumber)) + case protoreflect.MessageKind, protoreflect.GroupKind: + err := u.unmarshalMessage(v.Message(), in) + return v, err + default: + panic(fmt.Sprintf("invalid kind %v", fd.Kind())) + } +} + +func unmarshalValue(in []byte, v interface{}) (protoreflect.Value, error) { + err := json.Unmarshal(in, v) + return protoreflect.ValueOf(reflect.ValueOf(v).Elem().Interface()), err +} + +func unquoteString(in string) (out string, err error) { + err = json.Unmarshal([]byte(in), &out) + return out, err +} + +func hasPrefixAndSuffix(prefix byte, in []byte, suffix byte) bool { + if len(in) >= 2 && in[0] == prefix && in[len(in)-1] == suffix { + return true + } + return false +} + +// trimQuote is like unquoteString but simply strips surrounding quotes. +// This is incorrect, but is behavior done by the legacy implementation. +func trimQuote(in []byte) []byte { + if len(in) >= 2 && in[0] == '"' && in[len(in)-1] == '"' { + in = in[1 : len(in)-1] + } + return in +} diff --git a/jsonpb/encode.go b/jsonpb/encode.go new file mode 100644 index 0000000000..72b48ea296 --- /dev/null +++ b/jsonpb/encode.go @@ -0,0 +1,555 @@ +// Copyright 2015 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 jsonpb + +import ( + "encoding/json" + "errors" + "fmt" + "io" + "math" + "reflect" + "sort" + "strconv" + "strings" + "time" + + "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/encoding/protojson" + protoV2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/runtime/protoimpl" +) + +const wrapJSONMarshalV2 = false + +// Marshaler is a configurable object for marshaling protocol buffer messages +// to the specified JSON representation. +type Marshaler struct { + // OrigName specifies whether to use the original protobuf name for fields. + OrigName bool + + // EnumsAsInts specifies whether to render enum values as integers, + // as opposed to string values. + EnumsAsInts bool + + // EmitDefaults specifies Whether to render fields with zero values. + EmitDefaults bool + + // Indent controls whether the output is compact or not. + // If empty, the output is compact JSON. If non-empty, every JSON object + // entry and JSON array value will be on its own line. + // Each line will be preceded by repeated copies of Indent, where the + // number of copies is the current indentation depth. + Indent string + + // AnyResolver is used to resolve the google.protobuf.Any well-known type. + // If unset, the global registry is used by default. + AnyResolver AnyResolver +} + +// JSONPBMarshaler is implemented by protobuf messages that customize the +// way they are marshaled to JSON. Messages that implement this should also +// implement JSONPBUnmarshaler so that the custom format can be parsed. +// +// The JSON marshaling must follow the proto to JSON specification: +// https://developers.google.com/protocol-buffers/docs/proto3#json +// +// Deprecated: Custom types should implement protobuf reflection instead. +type JSONPBMarshaler interface { + MarshalJSONPB(*Marshaler) ([]byte, error) +} + +// Marshal marshals a protocol buffer into JSON. +func (jm *Marshaler) Marshal(w io.Writer, m proto.Message) error { + b, err := jm.marshal(m) + if len(b) > 0 { + if _, err := w.Write(b); err != nil { + return err + } + } + return err +} + +// MarshalToString converts a protocol buffer object to JSON string. +func (jm *Marshaler) MarshalToString(m proto.Message) (string, error) { + b, err := jm.marshal(m) + if err != nil { + return "", err + } + return string(b), nil +} + +func (jm *Marshaler) marshal(m proto.Message) ([]byte, error) { + v := reflect.ValueOf(m) + if m == nil || (v.Kind() == reflect.Ptr && v.IsNil()) { + return nil, errors.New("Marshal called with nil") + } + + // Check for custom marshalers first since they may not properly + // implement protobuf reflection that the logic below relies on. + if jsm, ok := m.(JSONPBMarshaler); ok { + return jsm.MarshalJSONPB(jm) + } + + if wrapJSONMarshalV2 { + opts := protojson.MarshalOptions{ + UseProtoNames: jm.OrigName, + UseEnumNumbers: jm.EnumsAsInts, + EmitUnpopulated: jm.EmitDefaults, + Indent: jm.Indent, + } + if jm.AnyResolver != nil { + opts.Resolver = anyResolver{jm.AnyResolver} + } + return opts.Marshal(protoimpl.X.MessageOf(m).Interface()) + } else { + // Check for unpopulated required fields first. + m2 := protoimpl.X.MessageOf(m) + if err := protoV2.IsInitialized(m2.Interface()); err != nil { + return nil, err + } + + w := jsonWriter{Marshaler: jm} + err := w.marshalMessage(m2, "", "") + return w.buf, err + } +} + +type jsonWriter struct { + *Marshaler + buf []byte +} + +func (w *jsonWriter) write(s string) { + w.buf = append(w.buf, s...) +} + +func (w *jsonWriter) marshalMessage(m protoreflect.Message, indent, typeURL string) error { + if jsm, ok := protoimpl.X.ProtoMessageV1Of(m.Interface()).(JSONPBMarshaler); ok { + b, err := jsm.MarshalJSONPB(w.Marshaler) + if err != nil { + return err + } + if typeURL != "" { + // we are marshaling this object to an Any type + var js map[string]*json.RawMessage + if err = json.Unmarshal(b, &js); err != nil { + return fmt.Errorf("type %T produced invalid JSON: %v", m.Interface(), err) + } + turl, err := json.Marshal(typeURL) + if err != nil { + return fmt.Errorf("failed to marshal type URL %q to JSON: %v", typeURL, err) + } + js["@type"] = (*json.RawMessage)(&turl) + if b, err = json.Marshal(js); err != nil { + return err + } + } + w.write(string(b)) + return nil + } + + md := m.Descriptor() + fds := md.Fields() + + // Handle well-known types. + const secondInNanos = int64(time.Second / time.Nanosecond) + switch wellKnownType(md.FullName()) { + case "Any": + return w.marshalAny(m, indent) + case "BoolValue", "BytesValue", "StringValue", + "Int32Value", "UInt32Value", "FloatValue", + "Int64Value", "UInt64Value", "DoubleValue": + fd := fds.ByNumber(1) + return w.marshalValue(fd, m.Get(fd), indent) + case "Duration": + // "Generated output always contains 0, 3, 6, or 9 fractional digits, + // depending on required precision." + s := m.Get(fds.ByNumber(1)).Int() + ns := m.Get(fds.ByNumber(2)).Int() + if ns <= -secondInNanos || ns >= secondInNanos { + return fmt.Errorf("ns out of range (%v, %v)", -secondInNanos, secondInNanos) + } + if (s > 0 && ns < 0) || (s < 0 && ns > 0) { + return errors.New("signs of seconds and nanos do not match") + } + if s < 0 { + ns = -ns + } + x := fmt.Sprintf("%d.%09d", s, ns) + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, ".000") + w.write(fmt.Sprintf(`"%vs"`, x)) + return nil + case "Timestamp": + // "RFC 3339, where generated output will always be Z-normalized + // and uses 0, 3, 6 or 9 fractional digits." + s := m.Get(fds.ByNumber(1)).Int() + ns := m.Get(fds.ByNumber(2)).Int() + if ns < 0 || ns >= secondInNanos { + return fmt.Errorf("ns out of range [0, %v)", secondInNanos) + } + t := time.Unix(s, ns).UTC() + // time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits). + x := t.Format("2006-01-02T15:04:05.000000000") + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, ".000") + w.write(fmt.Sprintf(`"%vZ"`, x)) + return nil + case "Value": + // JSON value; which is a null, number, string, bool, object, or array. + od := md.Oneofs().Get(0) + fd := m.WhichOneof(od) + if fd == nil { + return errors.New("nil Value") + } + return w.marshalValue(fd, m.Get(fd), indent) + case "Struct", "ListValue": + // JSON object or array. + fd := fds.ByNumber(1) + return w.marshalValue(fd, m.Get(fd), indent) + } + + w.write("{") + if w.Indent != "" { + w.write("\n") + } + + firstField := true + if typeURL != "" { + if err := w.marshalTypeURL(indent, typeURL); err != nil { + return err + } + firstField = false + } + + for i := 0; i < fds.Len(); { + fd := fds.Get(i) + if od := fd.ContainingOneof(); od != nil { + fd = m.WhichOneof(od) + i += od.Fields().Len() + if fd == nil { + continue + } + } else { + i++ + } + + v := m.Get(fd) + + if !m.Has(fd) { + if !w.EmitDefaults || fd.ContainingOneof() != nil { + continue + } + if fd.Cardinality() != protoreflect.Repeated && (fd.Message() != nil || fd.Syntax() == protoreflect.Proto2) { + v = protoreflect.Value{} // use "null" for singular messages or proto2 scalars + } + } + + if !firstField { + w.writeComma() + } + if err := w.marshalField(fd, v, indent); err != nil { + return err + } + firstField = false + } + + // Handle proto2 extensions. + if md.ExtensionRanges().Len() > 0 { + // Collect a sorted list of all extension descriptor and values. + type ext struct { + desc protoreflect.FieldDescriptor + val protoreflect.Value + } + var exts []ext + m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { + if fd.IsExtension() { + exts = append(exts, ext{fd, v}) + } + return true + }) + sort.Slice(exts, func(i, j int) bool { + return exts[i].desc.Number() < exts[j].desc.Number() + }) + + for _, ext := range exts { + if !firstField { + w.writeComma() + } + if err := w.marshalField(ext.desc, ext.val, indent); err != nil { + return err + } + firstField = false + } + } + + if w.Indent != "" { + w.write("\n") + w.write(indent) + } + w.write("}") + return nil +} + +func (w *jsonWriter) writeComma() { + if w.Indent != "" { + w.write(",\n") + } else { + w.write(",") + } +} + +func (w *jsonWriter) marshalAny(m protoreflect.Message, indent string) error { + // "If the Any contains a value that has a special JSON mapping, + // it will be converted as follows: {"@type": xxx, "value": yyy}. + // Otherwise, the value will be converted into a JSON object, + // and the "@type" field will be inserted to indicate the actual data type." + md := m.Descriptor() + typeURL := m.Get(md.Fields().ByNumber(1)).String() + rawVal := m.Get(md.Fields().ByNumber(2)).Bytes() + + var m2 protoreflect.Message + if w.AnyResolver != nil { + mi, err := w.AnyResolver.Resolve(typeURL) + if err != nil { + return err + } + m2 = protoimpl.X.MessageOf(mi) + } else { + mt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL) + if err != nil { + return err + } + m2 = mt.New() + } + + if err := protoV2.Unmarshal(rawVal, m2.Interface()); err != nil { + return err + } + + if wellKnownType(m2.Descriptor().FullName()) == "" { + return w.marshalMessage(m2, indent, typeURL) + } + + w.write("{") + if w.Indent != "" { + w.write("\n") + } + if err := w.marshalTypeURL(indent, typeURL); err != nil { + return err + } + w.writeComma() + if w.Indent != "" { + w.write(indent) + w.write(w.Indent) + w.write(`"value": `) + } else { + w.write(`"value":`) + } + if err := w.marshalMessage(m2, indent+w.Indent, ""); err != nil { + return err + } + if w.Indent != "" { + w.write("\n") + w.write(indent) + } + w.write("}") + return nil +} + +func (w *jsonWriter) marshalTypeURL(indent, typeURL string) error { + if w.Indent != "" { + w.write(indent) + w.write(w.Indent) + } + w.write(`"@type":`) + if w.Indent != "" { + w.write(" ") + } + b, err := json.Marshal(typeURL) + if err != nil { + return err + } + w.write(string(b)) + return nil +} + +// marshalField writes field description and value to the Writer. +func (w *jsonWriter) marshalField(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error { + if w.Indent != "" { + w.write(indent) + w.write(w.Indent) + } + w.write(`"`) + switch { + case fd.IsExtension(): + // For message set, use the fname of the message as the extension name. + name := string(fd.FullName()) + if isMessageSet(fd.ContainingMessage()) { + name = strings.TrimSuffix(name, ".message_set_extension") + } + + w.write("[" + name + "]") + case w.OrigName: + name := string(fd.Name()) + if fd.Kind() == protoreflect.GroupKind { + name = string(fd.Message().Name()) + } + w.write(name) + default: + w.write(string(fd.JSONName())) + } + w.write(`":`) + if w.Indent != "" { + w.write(" ") + } + return w.marshalValue(fd, v, indent) +} + +func (w *jsonWriter) marshalValue(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error { + switch { + case fd.IsList(): + w.write("[") + comma := "" + lv := v.List() + for i := 0; i < lv.Len(); i++ { + w.write(comma) + if w.Indent != "" { + w.write("\n") + w.write(indent) + w.write(w.Indent) + w.write(w.Indent) + } + if err := w.marshalSingularValue(fd, lv.Get(i), indent+w.Indent); err != nil { + return err + } + comma = "," + } + if w.Indent != "" { + w.write("\n") + w.write(indent) + w.write(w.Indent) + } + w.write("]") + return nil + case fd.IsMap(): + kfd := fd.MapKey() + vfd := fd.MapValue() + mv := v.Map() + + // Collect a sorted list of all map keys and values. + type entry struct{ key, val protoreflect.Value } + var entries []entry + mv.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool { + entries = append(entries, entry{k.Value(), v}) + return true + }) + sort.Slice(entries, func(i, j int) bool { + switch kfd.Kind() { + case protoreflect.BoolKind: + return !entries[i].key.Bool() && entries[j].key.Bool() + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + return entries[i].key.Int() < entries[j].key.Int() + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + return entries[i].key.Uint() < entries[j].key.Uint() + case protoreflect.StringKind: + return entries[i].key.String() < entries[j].key.String() + default: + panic("invalid kind") + } + }) + + w.write(`{`) + comma := "" + for _, entry := range entries { + w.write(comma) + if w.Indent != "" { + w.write("\n") + w.write(indent) + w.write(w.Indent) + w.write(w.Indent) + } + + s := fmt.Sprint(entry.key.Interface()) + b, err := json.Marshal(s) + if err != nil { + return err + } + w.write(string(b)) + + w.write(`:`) + if w.Indent != "" { + w.write(` `) + } + + if err := w.marshalSingularValue(vfd, entry.val, indent+w.Indent); err != nil { + return err + } + comma = "," + } + if w.Indent != "" { + w.write("\n") + w.write(indent) + w.write(w.Indent) + } + w.write(`}`) + return nil + default: + return w.marshalSingularValue(fd, v, indent) + } +} + +func (w *jsonWriter) marshalSingularValue(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error { + switch { + case !v.IsValid(): + w.write("null") + return nil + case fd.Message() != nil: + return w.marshalMessage(v.Message(), indent+w.Indent, "") + case fd.Enum() != nil: + if fd.Enum().FullName() == "google.protobuf.NullValue" { + w.write("null") + return nil + } + + vd := fd.Enum().Values().ByNumber(v.Enum()) + if vd == nil || w.EnumsAsInts { + w.write(strconv.Itoa(int(v.Enum()))) + } else { + w.write(`"` + string(vd.Name()) + `"`) + } + return nil + default: + switch v.Interface().(type) { + case float32, float64: + switch { + case math.IsInf(v.Float(), +1): + w.write(`"Infinity"`) + return nil + case math.IsInf(v.Float(), -1): + w.write(`"-Infinity"`) + return nil + case math.IsNaN(v.Float()): + w.write(`"NaN"`) + return nil + } + case int64, uint64: + w.write(fmt.Sprintf(`"%d"`, v.Interface())) + return nil + } + + b, err := json.Marshal(v.Interface()) + if err != nil { + return err + } + w.write(string(b)) + return nil + } +} diff --git a/jsonpb/json.go b/jsonpb/json.go new file mode 100644 index 0000000000..6b744104b3 --- /dev/null +++ b/jsonpb/json.go @@ -0,0 +1,69 @@ +// Copyright 2015 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 jsonpb provides marshaling and unmarshaling between a protocol buffer +// message and JSON. It follows the specification at +// https://developers.google.com/protocol-buffers/docs/proto3#json. +// +// Do not rely on the default behavior of the standard encoding/json package +// when called on generated message types as it does not operate correctly. +// +// Deprecated: Use the "google.golang.org/protobuf/encoding/protojson" +// package instead. +package jsonpb + +import ( + "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/runtime/protoimpl" +) + +// AnyResolver takes a type URL, present in an Any message, and resolves it into +// an instance of the associated message. +type AnyResolver interface { + Resolve(typeURL string) (proto.Message, error) +} + +type anyResolver struct{ AnyResolver } + +func (r anyResolver) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) { + return r.FindMessageByURL(string(message)) +} + +func (r anyResolver) FindMessageByURL(url string) (protoreflect.MessageType, error) { + m, err := r.Resolve(url) + if err != nil { + return nil, err + } + return protoimpl.X.MessageTypeOf(m), nil +} + +func (r anyResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { + return protoregistry.GlobalTypes.FindExtensionByName(field) +} + +func (r anyResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { + return protoregistry.GlobalTypes.FindExtensionByNumber(message, field) +} + +func wellKnownType(s protoreflect.FullName) string { + if s.Parent() == "google.protobuf" { + switch s.Name() { + case "Empty", "Any", + "BoolValue", "BytesValue", "StringValue", + "Int32Value", "UInt32Value", "FloatValue", + "Int64Value", "UInt64Value", "DoubleValue", + "Duration", "Timestamp", + "NullValue", "Struct", "Value", "ListValue": + return string(s.Name()) + } + } + return "" +} + +func isMessageSet(md protoreflect.MessageDescriptor) bool { + ms, ok := md.(interface{ IsMessageSet() bool }) + return ok && ms.IsMessageSet() +} diff --git a/jsonpb/jsonpb_test.go b/jsonpb/json_test.go similarity index 66% rename from jsonpb/jsonpb_test.go rename to jsonpb/json_test.go index d58a803749..027a2289ee 100644 --- a/jsonpb/jsonpb_test.go +++ b/jsonpb/json_test.go @@ -15,11 +15,11 @@ import ( "testing" "github.com/golang/protobuf/proto" - - pb "github.com/golang/protobuf/jsonpb/jsonpb_test_proto" - proto3pb "github.com/golang/protobuf/proto/proto3_proto" - descriptorpb "github.com/golang/protobuf/protoc-gen-go/descriptor" "github.com/golang/protobuf/ptypes" + + pb2 "github.com/golang/protobuf/internal/testprotos/jsonpb_proto" + pb3 "github.com/golang/protobuf/internal/testprotos/proto3_proto" + descpb "github.com/golang/protobuf/protoc-gen-go/descriptor" anypb "github.com/golang/protobuf/ptypes/any" durpb "github.com/golang/protobuf/ptypes/duration" stpb "github.com/golang/protobuf/ptypes/struct" @@ -34,7 +34,7 @@ var ( Indent: " ", } - simpleObject = &pb.Simple{ + simpleObject = &pb2.Simple{ OInt32: proto.Int32(-32), OInt32Str: proto.Int32(-32), OInt64: proto.Int64(-6400000000), @@ -144,7 +144,7 @@ var ( "oBytes": "YmVlcCBib29w" }` - repeatsObject = &pb.Repeats{ + repeatsObject = &pb2.Repeats{ RBool: []bool{true, false, true}, RInt32: []int32{-3, -4, -5}, RInt64: []int64{-123456789, -987654321}, @@ -223,17 +223,17 @@ var ( ] }` - innerSimple = &pb.Simple{OInt32: proto.Int32(-32)} - innerSimple2 = &pb.Simple{OInt64: proto.Int64(25)} - innerRepeats = &pb.Repeats{RString: []string{"roses", "red"}} - innerRepeats2 = &pb.Repeats{RString: []string{"violets", "blue"}} - complexObject = &pb.Widget{ - Color: pb.Widget_GREEN.Enum(), - RColor: []pb.Widget_Color{pb.Widget_RED, pb.Widget_GREEN, pb.Widget_BLUE}, + innerSimple = &pb2.Simple{OInt32: proto.Int32(-32)} + innerSimple2 = &pb2.Simple{OInt64: proto.Int64(25)} + innerRepeats = &pb2.Repeats{RString: []string{"roses", "red"}} + innerRepeats2 = &pb2.Repeats{RString: []string{"violets", "blue"}} + complexObject = &pb2.Widget{ + Color: pb2.Widget_GREEN.Enum(), + RColor: []pb2.Widget_Color{pb2.Widget_RED, pb2.Widget_GREEN, pb2.Widget_BLUE}, Simple: innerSimple, - RSimple: []*pb.Simple{innerSimple, innerSimple2}, + RSimple: []*pb2.Simple{innerSimple, innerSimple2}, Repeats: innerRepeats, - RRepeats: []*pb.Repeats{innerRepeats, innerRepeats2}, + RRepeats: []*pb2.Repeats{innerRepeats, innerRepeats2}, } complexObjectJSON = `{"color":"GREEN",` + @@ -309,33 +309,33 @@ var ( } } }` - realNumber = &pb.Real{Value: proto.Float64(3.14159265359)} + realNumber = &pb2.Real{Value: proto.Float64(3.14159265359)} realNumberName = "Pi" - complexNumber = &pb.Complex{Imaginary: proto.Float64(0.5772156649)} + complexNumber = &pb2.Complex{Imaginary: proto.Float64(0.5772156649)} realNumberJSON = `{` + `"value":3.14159265359,` + - `"[jsonpb.Complex.real_extension]":{"imaginary":0.5772156649},` + - `"[jsonpb.name]":"Pi"` + + `"[jsonpb_test.Complex.real_extension]":{"imaginary":0.5772156649},` + + `"[jsonpb_test.name]":"Pi"` + `}` - anySimple = &pb.KnownTypes{ + anySimple = &pb2.KnownTypes{ An: &anypb.Any{ - TypeUrl: "something.example.com/jsonpb.Simple", + TypeUrl: "something.example.com/jsonpb_test.Simple", Value: []byte{ - // &pb.Simple{OBool:true} + // &pb2.Simple{OBool:true} 1 << 3, 1, }, }, } - anySimpleJSON = `{"an":{"@type":"something.example.com/jsonpb.Simple","oBool":true}}` + anySimpleJSON = `{"an":{"@type":"something.example.com/jsonpb_test.Simple","oBool":true}}` anySimplePrettyJSON = `{ "an": { - "@type": "something.example.com/jsonpb.Simple", + "@type": "something.example.com/jsonpb_test.Simple", "oBool": true } }` - anyWellKnown = &pb.KnownTypes{ + anyWellKnown = &pb2.KnownTypes{ An: &anypb.Any{ TypeUrl: "type.googleapis.com/google.protobuf.Duration", Value: []byte{ @@ -353,7 +353,7 @@ var ( } }` - nonFinites = &pb.NonFinites{ + nonFinites = &pb2.NonFinites{ FNan: proto.Float32(float32(math.NaN())), FPinf: proto.Float32(float32(math.Inf(1))), FNinf: proto.Float32(float32(math.Inf(-1))), @@ -372,10 +372,10 @@ var ( ) func init() { - if err := proto.SetExtension(realNumber, pb.E_Name, &realNumberName); err != nil { + if err := proto.SetExtension(realNumber, pb2.E_Name, &realNumberName); err != nil { panic(err) } - if err := proto.SetExtension(realNumber, pb.E_Complex_RealExtension, complexNumber); err != nil { + if err := proto.SetExtension(realNumber, pb2.E_Complex_RealExtension, complexNumber); err != nil { panic(err) } } @@ -394,83 +394,83 @@ var marshalingTests = []struct { {"nested message/enum flat object", marshaler, complexObject, complexObjectJSON}, {"nested message/enum pretty object", marshalerAllOptions, complexObject, complexObjectPrettyJSON}, {"enum-string flat object", Marshaler{}, - &pb.Widget{Color: pb.Widget_BLUE.Enum()}, `{"color":"BLUE"}`}, + &pb2.Widget{Color: pb2.Widget_BLUE.Enum()}, `{"color":"BLUE"}`}, {"enum-value pretty object", Marshaler{EnumsAsInts: true, Indent: " "}, - &pb.Widget{Color: pb.Widget_BLUE.Enum()}, colorPrettyJSON}, + &pb2.Widget{Color: pb2.Widget_BLUE.Enum()}, colorPrettyJSON}, {"unknown enum value object", marshalerAllOptions, - &pb.Widget{Color: pb.Widget_Color(1000).Enum(), RColor: []pb.Widget_Color{pb.Widget_RED}}, colorListPrettyJSON}, + &pb2.Widget{Color: pb2.Widget_Color(1000).Enum(), RColor: []pb2.Widget_Color{pb2.Widget_RED}}, colorListPrettyJSON}, {"repeated proto3 enum", Marshaler{}, - &proto3pb.Message{RFunny: []proto3pb.Message_Humour{ - proto3pb.Message_PUNS, - proto3pb.Message_SLAPSTICK, + &pb3.Message{RFunny: []pb3.Message_Humour{ + pb3.Message_PUNS, + pb3.Message_SLAPSTICK, }}, `{"rFunny":["PUNS","SLAPSTICK"]}`}, {"repeated proto3 enum as int", Marshaler{EnumsAsInts: true}, - &proto3pb.Message{RFunny: []proto3pb.Message_Humour{ - proto3pb.Message_PUNS, - proto3pb.Message_SLAPSTICK, + &pb3.Message{RFunny: []pb3.Message_Humour{ + pb3.Message_PUNS, + pb3.Message_SLAPSTICK, }}, `{"rFunny":[1,2]}`}, - {"empty value", marshaler, &pb.Simple3{}, `{}`}, - {"empty value emitted", Marshaler{EmitDefaults: true}, &pb.Simple3{}, `{"dub":0}`}, - {"empty repeated emitted", Marshaler{EmitDefaults: true}, &pb.SimpleSlice3{}, `{"slices":[]}`}, - {"empty map emitted", Marshaler{EmitDefaults: true}, &pb.SimpleMap3{}, `{"stringy":{}}`}, - {"nested struct null", Marshaler{EmitDefaults: true}, &pb.SimpleNull3{}, `{"simple":null}`}, - {"map", marshaler, &pb.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}, `{"nummy":{"1":2,"3":4}}`}, - {"map", marshalerAllOptions, &pb.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}, nummyPrettyJSON}, + {"empty value", marshaler, &pb2.Simple3{}, `{}`}, + {"empty value emitted", Marshaler{EmitDefaults: true}, &pb2.Simple3{}, `{"dub":0}`}, + {"empty repeated emitted", Marshaler{EmitDefaults: true}, &pb2.SimpleSlice3{}, `{"slices":[]}`}, + {"empty map emitted", Marshaler{EmitDefaults: true}, &pb2.SimpleMap3{}, `{"stringy":{}}`}, + {"nested struct null", Marshaler{EmitDefaults: true}, &pb2.SimpleNull3{}, `{"simple":null}`}, + {"map", marshaler, &pb2.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}, `{"nummy":{"1":2,"3":4}}`}, + {"map", marshalerAllOptions, &pb2.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}, nummyPrettyJSON}, {"map", marshaler, - &pb.Mappy{Strry: map[string]string{`"one"`: "two", "three": "four"}}, + &pb2.Mappy{Strry: map[string]string{`"one"`: "two", "three": "four"}}, `{"strry":{"\"one\"":"two","three":"four"}}`}, {"map", marshaler, - &pb.Mappy{Objjy: map[int32]*pb.Simple3{1: {Dub: 1}}}, `{"objjy":{"1":{"dub":1}}}`}, + &pb2.Mappy{Objjy: map[int32]*pb2.Simple3{1: {Dub: 1}}}, `{"objjy":{"1":{"dub":1}}}`}, {"map", marshalerAllOptions, - &pb.Mappy{Objjy: map[int32]*pb.Simple3{1: {Dub: 1}}}, objjyPrettyJSON}, - {"map", marshaler, &pb.Mappy{Buggy: map[int64]string{1234: "yup"}}, + &pb2.Mappy{Objjy: map[int32]*pb2.Simple3{1: {Dub: 1}}}, objjyPrettyJSON}, + {"map", marshaler, &pb2.Mappy{Buggy: map[int64]string{1234: "yup"}}, `{"buggy":{"1234":"yup"}}`}, - {"map", marshaler, &pb.Mappy{Booly: map[bool]bool{false: true}}, `{"booly":{"false":true}}`}, - {"map", marshaler, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}, `{"enumy":{"XIV":"ROMAN"}}`}, - {"map", Marshaler{EnumsAsInts: true}, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}, `{"enumy":{"XIV":2}}`}, - {"map", marshaler, &pb.Mappy{S32Booly: map[int32]bool{1: true, 3: false, 10: true, 12: false}}, `{"s32booly":{"1":true,"3":false,"10":true,"12":false}}`}, - {"map", marshaler, &pb.Mappy{S64Booly: map[int64]bool{1: true, 3: false, 10: true, 12: false}}, `{"s64booly":{"1":true,"3":false,"10":true,"12":false}}`}, - {"map", marshaler, &pb.Mappy{U32Booly: map[uint32]bool{1: true, 3: false, 10: true, 12: false}}, `{"u32booly":{"1":true,"3":false,"10":true,"12":false}}`}, - {"map", marshaler, &pb.Mappy{U64Booly: map[uint64]bool{1: true, 3: false, 10: true, 12: false}}, `{"u64booly":{"1":true,"3":false,"10":true,"12":false}}`}, - {"proto2 map", marshaler, &pb.Maps{MInt64Str: map[int64]string{213: "cat"}}, + {"map", marshaler, &pb2.Mappy{Booly: map[bool]bool{false: true}}, `{"booly":{"false":true}}`}, + {"map", marshaler, &pb2.Mappy{Enumy: map[string]pb2.Numeral{"XIV": pb2.Numeral_ROMAN}}, `{"enumy":{"XIV":"ROMAN"}}`}, + {"map", Marshaler{EnumsAsInts: true}, &pb2.Mappy{Enumy: map[string]pb2.Numeral{"XIV": pb2.Numeral_ROMAN}}, `{"enumy":{"XIV":2}}`}, + {"map", marshaler, &pb2.Mappy{S32Booly: map[int32]bool{1: true, 3: false, 10: true, 12: false}}, `{"s32booly":{"1":true,"3":false,"10":true,"12":false}}`}, + {"map", marshaler, &pb2.Mappy{S64Booly: map[int64]bool{1: true, 3: false, 10: true, 12: false}}, `{"s64booly":{"1":true,"3":false,"10":true,"12":false}}`}, + {"map", marshaler, &pb2.Mappy{U32Booly: map[uint32]bool{1: true, 3: false, 10: true, 12: false}}, `{"u32booly":{"1":true,"3":false,"10":true,"12":false}}`}, + {"map", marshaler, &pb2.Mappy{U64Booly: map[uint64]bool{1: true, 3: false, 10: true, 12: false}}, `{"u64booly":{"1":true,"3":false,"10":true,"12":false}}`}, + {"proto2 map", marshaler, &pb2.Maps{MInt64Str: map[int64]string{213: "cat"}}, `{"mInt64Str":{"213":"cat"}}`}, {"proto2 map", marshaler, - &pb.Maps{MBoolSimple: map[bool]*pb.Simple{true: {OInt32: proto.Int32(1)}}}, + &pb2.Maps{MBoolSimple: map[bool]*pb2.Simple{true: {OInt32: proto.Int32(1)}}}, `{"mBoolSimple":{"true":{"oInt32":1}}}`}, - {"oneof, not set", marshaler, &pb.MsgWithOneof{}, `{}`}, - {"oneof, set", marshaler, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Title{"Grand Poobah"}}, `{"title":"Grand Poobah"}`}, - {"force orig_name", Marshaler{OrigName: true}, &pb.Simple{OInt32: proto.Int32(4)}, + {"oneof, not set", marshaler, &pb2.MsgWithOneof{}, `{}`}, + {"oneof, set", marshaler, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_Title{"Grand Poobah"}}, `{"title":"Grand Poobah"}`}, + {"force orig_name", Marshaler{OrigName: true}, &pb2.Simple{OInt32: proto.Int32(4)}, `{"o_int32":4}`}, {"proto2 extension", marshaler, realNumber, realNumberJSON}, {"Any with message", marshaler, anySimple, anySimpleJSON}, {"Any with message and indent", marshalerAllOptions, anySimple, anySimplePrettyJSON}, {"Any with WKT", marshaler, anyWellKnown, anyWellKnownJSON}, {"Any with WKT and indent", marshalerAllOptions, anyWellKnown, anyWellKnownPrettyJSON}, - {"Duration", marshaler, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}, `{"dur":"3s"}`}, - {"Duration", marshaler, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 3, Nanos: 1e6}}, `{"dur":"3.001s"}`}, - {"Duration beyond float64 precision", marshaler, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 100000000, Nanos: 1}}, `{"dur":"100000000.000000001s"}`}, - {"negative Duration", marshaler, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: -123, Nanos: -456}}, `{"dur":"-123.000000456s"}`}, - {"Struct", marshaler, &pb.KnownTypes{St: &stpb.Struct{ + {"Duration", marshaler, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}, `{"dur":"3s"}`}, + {"Duration", marshaler, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 3, Nanos: 1e6}}, `{"dur":"3.001s"}`}, + {"Duration beyond float64 precision", marshaler, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 100000000, Nanos: 1}}, `{"dur":"100000000.000000001s"}`}, + {"negative Duration", marshaler, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: -123, Nanos: -456}}, `{"dur":"-123.000000456s"}`}, + {"Struct", marshaler, &pb2.KnownTypes{St: &stpb.Struct{ Fields: map[string]*stpb.Value{ "one": {Kind: &stpb.Value_StringValue{"loneliest number"}}, "two": {Kind: &stpb.Value_NullValue{stpb.NullValue_NULL_VALUE}}, }, }}, `{"st":{"one":"loneliest number","two":null}}`}, - {"empty ListValue", marshaler, &pb.KnownTypes{Lv: &stpb.ListValue{}}, `{"lv":[]}`}, - {"basic ListValue", marshaler, &pb.KnownTypes{Lv: &stpb.ListValue{Values: []*stpb.Value{ + {"empty ListValue", marshaler, &pb2.KnownTypes{Lv: &stpb.ListValue{}}, `{"lv":[]}`}, + {"basic ListValue", marshaler, &pb2.KnownTypes{Lv: &stpb.ListValue{Values: []*stpb.Value{ {Kind: &stpb.Value_StringValue{"x"}}, {Kind: &stpb.Value_NullValue{}}, {Kind: &stpb.Value_NumberValue{3}}, {Kind: &stpb.Value_BoolValue{true}}, }}}, `{"lv":["x",null,3,true]}`}, - {"Timestamp", marshaler, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 21e6}}, `{"ts":"2014-05-13T16:53:20.021Z"}`}, - {"Timestamp", marshaler, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 0}}, `{"ts":"2014-05-13T16:53:20Z"}`}, - {"number Value", marshaler, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NumberValue{1}}}, `{"val":1}`}, - {"null Value", marshaler, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NullValue{stpb.NullValue_NULL_VALUE}}}, `{"val":null}`}, - {"string number value", marshaler, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_StringValue{"9223372036854775807"}}}, `{"val":"9223372036854775807"}`}, - {"list of lists Value", marshaler, &pb.KnownTypes{Val: &stpb.Value{ + {"Timestamp", marshaler, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 21e6}}, `{"ts":"2014-05-13T16:53:20.021Z"}`}, + {"Timestamp", marshaler, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 0}}, `{"ts":"2014-05-13T16:53:20Z"}`}, + {"number Value", marshaler, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NumberValue{1}}}, `{"val":1}`}, + {"null Value", marshaler, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NullValue{stpb.NullValue_NULL_VALUE}}}, `{"val":null}`}, + {"string number value", marshaler, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_StringValue{"9223372036854775807"}}}, `{"val":"9223372036854775807"}`}, + {"list of lists Value", marshaler, &pb2.KnownTypes{Val: &stpb.Value{ Kind: &stpb.Value_ListValue{&stpb.ListValue{ Values: []*stpb.Value{ {Kind: &stpb.Value_StringValue{"x"}}, @@ -486,18 +486,18 @@ var marshalingTests = []struct { }}, }}, `{"val":["x",[["y"],"z"]]}`}, - {"DoubleValue", marshaler, &pb.KnownTypes{Dbl: &wpb.DoubleValue{Value: 1.2}}, `{"dbl":1.2}`}, - {"FloatValue", marshaler, &pb.KnownTypes{Flt: &wpb.FloatValue{Value: 1.2}}, `{"flt":1.2}`}, - {"Int64Value", marshaler, &pb.KnownTypes{I64: &wpb.Int64Value{Value: -3}}, `{"i64":"-3"}`}, - {"UInt64Value", marshaler, &pb.KnownTypes{U64: &wpb.UInt64Value{Value: 3}}, `{"u64":"3"}`}, - {"Int32Value", marshaler, &pb.KnownTypes{I32: &wpb.Int32Value{Value: -4}}, `{"i32":-4}`}, - {"UInt32Value", marshaler, &pb.KnownTypes{U32: &wpb.UInt32Value{Value: 4}}, `{"u32":4}`}, - {"BoolValue", marshaler, &pb.KnownTypes{Bool: &wpb.BoolValue{Value: true}}, `{"bool":true}`}, - {"StringValue", marshaler, &pb.KnownTypes{Str: &wpb.StringValue{Value: "plush"}}, `{"str":"plush"}`}, - {"BytesValue", marshaler, &pb.KnownTypes{Bytes: &wpb.BytesValue{Value: []byte("wow")}}, `{"bytes":"d293"}`}, - - {"required", marshaler, &pb.MsgWithRequired{Str: proto.String("hello")}, `{"str":"hello"}`}, - {"required bytes", marshaler, &pb.MsgWithRequiredBytes{Byts: []byte{}}, `{"byts":""}`}, + {"DoubleValue", marshaler, &pb2.KnownTypes{Dbl: &wpb.DoubleValue{Value: 1.2}}, `{"dbl":1.2}`}, + {"FloatValue", marshaler, &pb2.KnownTypes{Flt: &wpb.FloatValue{Value: 1.2}}, `{"flt":1.2}`}, + {"Int64Value", marshaler, &pb2.KnownTypes{I64: &wpb.Int64Value{Value: -3}}, `{"i64":"-3"}`}, + {"UInt64Value", marshaler, &pb2.KnownTypes{U64: &wpb.UInt64Value{Value: 3}}, `{"u64":"3"}`}, + {"Int32Value", marshaler, &pb2.KnownTypes{I32: &wpb.Int32Value{Value: -4}}, `{"i32":-4}`}, + {"UInt32Value", marshaler, &pb2.KnownTypes{U32: &wpb.UInt32Value{Value: 4}}, `{"u32":4}`}, + {"BoolValue", marshaler, &pb2.KnownTypes{Bool: &wpb.BoolValue{Value: true}}, `{"bool":true}`}, + {"StringValue", marshaler, &pb2.KnownTypes{Str: &wpb.StringValue{Value: "plush"}}, `{"str":"plush"}`}, + {"BytesValue", marshaler, &pb2.KnownTypes{Bytes: &wpb.BytesValue{Value: []byte("wow")}}, `{"bytes":"d293"}`}, + + {"required", marshaler, &pb2.MsgWithRequired{Str: proto.String("hello")}, `{"str":"hello"}`}, + {"required bytes", marshaler, &pb2.MsgWithRequiredBytes{Byts: []byte{}}, `{"byts":""}`}, } func TestMarshaling(t *testing.T) { @@ -512,7 +512,7 @@ func TestMarshaling(t *testing.T) { } func TestMarshalingNil(t *testing.T) { - var msg *pb.Simple + var msg *pb2.Simple m := &Marshaler{} if _, err := m.MarshalToString(msg); err == nil { t.Errorf("mashaling nil returned no error") @@ -524,15 +524,15 @@ func TestMarshalIllegalTime(t *testing.T) { pb proto.Message fail bool }{ - {&pb.KnownTypes{Dur: &durpb.Duration{Seconds: 1, Nanos: 0}}, false}, - {&pb.KnownTypes{Dur: &durpb.Duration{Seconds: -1, Nanos: 0}}, false}, - {&pb.KnownTypes{Dur: &durpb.Duration{Seconds: 1, Nanos: -1}}, true}, - {&pb.KnownTypes{Dur: &durpb.Duration{Seconds: -1, Nanos: 1}}, true}, - {&pb.KnownTypes{Dur: &durpb.Duration{Seconds: 1, Nanos: 1000000000}}, true}, - {&pb.KnownTypes{Dur: &durpb.Duration{Seconds: -1, Nanos: -1000000000}}, true}, - {&pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 1, Nanos: 1}}, false}, - {&pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 1, Nanos: -1}}, true}, - {&pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 1, Nanos: 1000000000}}, true}, + {&pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 1, Nanos: 0}}, false}, + {&pb2.KnownTypes{Dur: &durpb.Duration{Seconds: -1, Nanos: 0}}, false}, + {&pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 1, Nanos: -1}}, true}, + {&pb2.KnownTypes{Dur: &durpb.Duration{Seconds: -1, Nanos: 1}}, true}, + {&pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 1, Nanos: 1000000000}}, true}, + {&pb2.KnownTypes{Dur: &durpb.Duration{Seconds: -1, Nanos: -1000000000}}, true}, + {&pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 1, Nanos: 1}}, false}, + {&pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 1, Nanos: -1}}, true}, + {&pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 1, Nanos: 1000000000}}, true}, } for _, tt := range tests { _, err := marshaler.MarshalToString(tt.pb) @@ -590,8 +590,8 @@ func TestMarshalWithCustomValidation(t *testing.T) { // Test marshaling message containing unset required fields should produce error. func TestMarshalUnsetRequiredFields(t *testing.T) { - msgExt := &pb.Real{} - proto.SetExtension(msgExt, pb.E_Extm, &pb.MsgWithRequired{}) + msgExt := &pb2.Real{} + proto.SetExtension(msgExt, pb2.E_Extm, &pb2.MsgWithRequired{}) tests := []struct { desc string @@ -601,43 +601,43 @@ func TestMarshalUnsetRequiredFields(t *testing.T) { { desc: "direct required field", marshaler: &Marshaler{}, - pb: &pb.MsgWithRequired{}, + pb: &pb2.MsgWithRequired{}, }, { desc: "direct required field + emit defaults", marshaler: &Marshaler{EmitDefaults: true}, - pb: &pb.MsgWithRequired{}, + pb: &pb2.MsgWithRequired{}, }, { desc: "indirect required field", marshaler: &Marshaler{}, - pb: &pb.MsgWithIndirectRequired{Subm: &pb.MsgWithRequired{}}, + pb: &pb2.MsgWithIndirectRequired{Subm: &pb2.MsgWithRequired{}}, }, { desc: "indirect required field + emit defaults", marshaler: &Marshaler{EmitDefaults: true}, - pb: &pb.MsgWithIndirectRequired{Subm: &pb.MsgWithRequired{}}, + pb: &pb2.MsgWithIndirectRequired{Subm: &pb2.MsgWithRequired{}}, }, { desc: "direct required wkt field", marshaler: &Marshaler{}, - pb: &pb.MsgWithRequiredWKT{}, + pb: &pb2.MsgWithRequiredWKT{}, }, { desc: "direct required wkt field + emit defaults", marshaler: &Marshaler{EmitDefaults: true}, - pb: &pb.MsgWithRequiredWKT{}, + pb: &pb2.MsgWithRequiredWKT{}, }, { desc: "direct required bytes field", marshaler: &Marshaler{}, - pb: &pb.MsgWithRequiredBytes{}, + pb: &pb2.MsgWithRequiredBytes{}, }, { desc: "required in map value", marshaler: &Marshaler{}, - pb: &pb.MsgWithIndirectRequired{ - MapField: map[string]*pb.MsgWithRequired{ + pb: &pb2.MsgWithIndirectRequired{ + MapField: map[string]*pb2.MsgWithRequired{ "key": {}, }, }, @@ -645,8 +645,8 @@ func TestMarshalUnsetRequiredFields(t *testing.T) { { desc: "required in repeated item", marshaler: &Marshaler{}, - pb: &pb.MsgWithIndirectRequired{ - SliceField: []*pb.MsgWithRequired{ + pb: &pb2.MsgWithIndirectRequired{ + SliceField: []*pb2.MsgWithRequired{ {Str: proto.String("hello")}, {}, }, @@ -655,8 +655,8 @@ func TestMarshalUnsetRequiredFields(t *testing.T) { { desc: "required inside oneof", marshaler: &Marshaler{}, - pb: &pb.MsgWithOneof{ - Union: &pb.MsgWithOneof_MsgWithRequired{&pb.MsgWithRequired{}}, + pb: &pb2.MsgWithOneof{ + Union: &pb2.MsgWithOneof_MsgWithRequired{&pb2.MsgWithRequired{}}, }, }, { @@ -685,72 +685,72 @@ var unmarshalingTests = []struct { {"repeated fields pretty object", Unmarshaler{}, repeatsObjectPrettyJSON, repeatsObject}, {"nested message/enum flat object", Unmarshaler{}, complexObjectJSON, complexObject}, {"nested message/enum pretty object", Unmarshaler{}, complexObjectPrettyJSON, complexObject}, - {"enum-string object", Unmarshaler{}, `{"color":"BLUE"}`, &pb.Widget{Color: pb.Widget_BLUE.Enum()}}, - {"enum-value object", Unmarshaler{}, "{\n \"color\": 2\n}", &pb.Widget{Color: pb.Widget_BLUE.Enum()}}, - {"unknown field with allowed option", Unmarshaler{AllowUnknownFields: true}, `{"unknown": "foo"}`, new(pb.Simple)}, - {"proto3 enum string", Unmarshaler{}, `{"hilarity":"PUNS"}`, &proto3pb.Message{Hilarity: proto3pb.Message_PUNS}}, - {"proto3 enum value", Unmarshaler{}, `{"hilarity":1}`, &proto3pb.Message{Hilarity: proto3pb.Message_PUNS}}, + {"enum-string object", Unmarshaler{}, `{"color":"BLUE"}`, &pb2.Widget{Color: pb2.Widget_BLUE.Enum()}}, + {"enum-value object", Unmarshaler{}, "{\n \"color\": 2\n}", &pb2.Widget{Color: pb2.Widget_BLUE.Enum()}}, + {"unknown field with allowed option", Unmarshaler{AllowUnknownFields: true}, `{"unknown": "foo"}`, new(pb2.Simple)}, + {"proto3 enum string", Unmarshaler{}, `{"hilarity":"PUNS"}`, &pb3.Message{Hilarity: pb3.Message_PUNS}}, + {"proto3 enum value", Unmarshaler{}, `{"hilarity":1}`, &pb3.Message{Hilarity: pb3.Message_PUNS}}, {"unknown enum value object", Unmarshaler{}, "{\n \"color\": 1000,\n \"r_color\": [\n \"RED\"\n ]\n}", - &pb.Widget{Color: pb.Widget_Color(1000).Enum(), RColor: []pb.Widget_Color{pb.Widget_RED}}}, + &pb2.Widget{Color: pb2.Widget_Color(1000).Enum(), RColor: []pb2.Widget_Color{pb2.Widget_RED}}}, {"repeated proto3 enum", Unmarshaler{}, `{"rFunny":["PUNS","SLAPSTICK"]}`, - &proto3pb.Message{RFunny: []proto3pb.Message_Humour{ - proto3pb.Message_PUNS, - proto3pb.Message_SLAPSTICK, + &pb3.Message{RFunny: []pb3.Message_Humour{ + pb3.Message_PUNS, + pb3.Message_SLAPSTICK, }}}, {"repeated proto3 enum as int", Unmarshaler{}, `{"rFunny":[1,2]}`, - &proto3pb.Message{RFunny: []proto3pb.Message_Humour{ - proto3pb.Message_PUNS, - proto3pb.Message_SLAPSTICK, + &pb3.Message{RFunny: []pb3.Message_Humour{ + pb3.Message_PUNS, + pb3.Message_SLAPSTICK, }}}, {"repeated proto3 enum as mix of strings and ints", Unmarshaler{}, `{"rFunny":["PUNS",2]}`, - &proto3pb.Message{RFunny: []proto3pb.Message_Humour{ - proto3pb.Message_PUNS, - proto3pb.Message_SLAPSTICK, + &pb3.Message{RFunny: []pb3.Message_Humour{ + pb3.Message_PUNS, + pb3.Message_SLAPSTICK, }}}, - {"unquoted int64 object", Unmarshaler{}, `{"oInt64":-314}`, &pb.Simple{OInt64: proto.Int64(-314)}}, - {"unquoted uint64 object", Unmarshaler{}, `{"oUint64":123}`, &pb.Simple{OUint64: proto.Uint64(123)}}, - {"NaN", Unmarshaler{}, `{"oDouble":"NaN"}`, &pb.Simple{ODouble: proto.Float64(math.NaN())}}, - {"Inf", Unmarshaler{}, `{"oFloat":"Infinity"}`, &pb.Simple{OFloat: proto.Float32(float32(math.Inf(1)))}}, - {"-Inf", Unmarshaler{}, `{"oDouble":"-Infinity"}`, &pb.Simple{ODouble: proto.Float64(math.Inf(-1))}}, - {"map", Unmarshaler{}, `{"nummy":{"1":2,"3":4}}`, &pb.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}}, - {"map", Unmarshaler{}, `{"strry":{"\"one\"":"two","three":"four"}}`, &pb.Mappy{Strry: map[string]string{`"one"`: "two", "three": "four"}}}, - {"map", Unmarshaler{}, `{"objjy":{"1":{"dub":1}}}`, &pb.Mappy{Objjy: map[int32]*pb.Simple3{1: {Dub: 1}}}}, + {"unquoted int64 object", Unmarshaler{}, `{"oInt64":-314}`, &pb2.Simple{OInt64: proto.Int64(-314)}}, + {"unquoted uint64 object", Unmarshaler{}, `{"oUint64":123}`, &pb2.Simple{OUint64: proto.Uint64(123)}}, + {"NaN", Unmarshaler{}, `{"oDouble":"NaN"}`, &pb2.Simple{ODouble: proto.Float64(math.NaN())}}, + {"Inf", Unmarshaler{}, `{"oFloat":"Infinity"}`, &pb2.Simple{OFloat: proto.Float32(float32(math.Inf(1)))}}, + {"-Inf", Unmarshaler{}, `{"oDouble":"-Infinity"}`, &pb2.Simple{ODouble: proto.Float64(math.Inf(-1))}}, + {"map", Unmarshaler{}, `{"nummy":{"1":2,"3":4}}`, &pb2.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}}, + {"map", Unmarshaler{}, `{"strry":{"\"one\"":"two","three":"four"}}`, &pb2.Mappy{Strry: map[string]string{`"one"`: "two", "three": "four"}}}, + {"map", Unmarshaler{}, `{"objjy":{"1":{"dub":1}}}`, &pb2.Mappy{Objjy: map[int32]*pb2.Simple3{1: {Dub: 1}}}}, {"proto2 extension", Unmarshaler{}, realNumberJSON, realNumber}, {"Any with message", Unmarshaler{}, anySimpleJSON, anySimple}, {"Any with message and indent", Unmarshaler{}, anySimplePrettyJSON, anySimple}, {"Any with WKT", Unmarshaler{}, anyWellKnownJSON, anyWellKnown}, {"Any with WKT and indent", Unmarshaler{}, anyWellKnownPrettyJSON, anyWellKnown}, - {"map", Unmarshaler{}, `{"enumy":{"XIV":"ROMAN"}}`, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}}, - {"map", Unmarshaler{}, `{"enumy":{"XIV":2}}`, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}}, - {"oneof", Unmarshaler{}, `{"salary":31000}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Salary{31000}}}, - {"oneof spec name", Unmarshaler{}, `{"Country":"Australia"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Country{"Australia"}}}, - {"oneof orig_name", Unmarshaler{}, `{"Country":"Australia"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Country{"Australia"}}}, - {"oneof spec name2", Unmarshaler{}, `{"homeAddress":"Australia"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_HomeAddress{"Australia"}}}, - {"oneof orig_name2", Unmarshaler{}, `{"home_address":"Australia"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_HomeAddress{"Australia"}}}, - {"orig_name input", Unmarshaler{}, `{"o_bool":true}`, &pb.Simple{OBool: proto.Bool(true)}}, - {"camelName input", Unmarshaler{}, `{"oBool":true}`, &pb.Simple{OBool: proto.Bool(true)}}, - - {"Duration", Unmarshaler{}, `{"dur":"3.000s"}`, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}}, - {"Duration", Unmarshaler{}, `{"dur":"4s"}`, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 4}}}, - {"Duration with unicode", Unmarshaler{}, `{"dur": "3\u0073"}`, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}}, - {"null Duration", Unmarshaler{}, `{"dur":null}`, &pb.KnownTypes{Dur: nil}}, - {"Timestamp", Unmarshaler{}, `{"ts":"2014-05-13T16:53:20.021Z"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 21e6}}}, - {"Timestamp", Unmarshaler{}, `{"ts":"2014-05-13T16:53:20Z"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 0}}}, - {"Timestamp with unicode", Unmarshaler{}, `{"ts": "2014-05-13T16:53:20\u005a"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 0}}}, - {"PreEpochTimestamp", Unmarshaler{}, `{"ts":"1969-12-31T23:59:58.999999995Z"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: -2, Nanos: 999999995}}}, - {"ZeroTimeTimestamp", Unmarshaler{}, `{"ts":"0001-01-01T00:00:00Z"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: -62135596800, Nanos: 0}}}, - {"null Timestamp", Unmarshaler{}, `{"ts":null}`, &pb.KnownTypes{Ts: nil}}, - {"null Struct", Unmarshaler{}, `{"st": null}`, &pb.KnownTypes{St: nil}}, - {"empty Struct", Unmarshaler{}, `{"st": {}}`, &pb.KnownTypes{St: &stpb.Struct{}}}, - {"basic Struct", Unmarshaler{}, `{"st": {"a": "x", "b": null, "c": 3, "d": true}}`, &pb.KnownTypes{St: &stpb.Struct{Fields: map[string]*stpb.Value{ + {"map", Unmarshaler{}, `{"enumy":{"XIV":"ROMAN"}}`, &pb2.Mappy{Enumy: map[string]pb2.Numeral{"XIV": pb2.Numeral_ROMAN}}}, + {"map", Unmarshaler{}, `{"enumy":{"XIV":2}}`, &pb2.Mappy{Enumy: map[string]pb2.Numeral{"XIV": pb2.Numeral_ROMAN}}}, + {"oneof", Unmarshaler{}, `{"salary":31000}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_Salary{31000}}}, + {"oneof spec name", Unmarshaler{}, `{"Country":"Australia"}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_Country{"Australia"}}}, + {"oneof orig_name", Unmarshaler{}, `{"Country":"Australia"}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_Country{"Australia"}}}, + {"oneof spec name2", Unmarshaler{}, `{"homeAddress":"Australia"}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_HomeAddress{"Australia"}}}, + {"oneof orig_name2", Unmarshaler{}, `{"home_address":"Australia"}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_HomeAddress{"Australia"}}}, + {"orig_name input", Unmarshaler{}, `{"o_bool":true}`, &pb2.Simple{OBool: proto.Bool(true)}}, + {"camelName input", Unmarshaler{}, `{"oBool":true}`, &pb2.Simple{OBool: proto.Bool(true)}}, + + {"Duration", Unmarshaler{}, `{"dur":"3.000s"}`, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}}, + {"Duration", Unmarshaler{}, `{"dur":"4s"}`, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 4}}}, + {"Duration with unicode", Unmarshaler{}, `{"dur": "3\u0073"}`, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}}, + {"null Duration", Unmarshaler{}, `{"dur":null}`, &pb2.KnownTypes{Dur: nil}}, + {"Timestamp", Unmarshaler{}, `{"ts":"2014-05-13T16:53:20.021Z"}`, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 21e6}}}, + {"Timestamp", Unmarshaler{}, `{"ts":"2014-05-13T16:53:20Z"}`, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 0}}}, + {"Timestamp with unicode", Unmarshaler{}, `{"ts": "2014-05-13T16:53:20\u005a"}`, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 0}}}, + {"PreEpochTimestamp", Unmarshaler{}, `{"ts":"1969-12-31T23:59:58.999999995Z"}`, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: -2, Nanos: 999999995}}}, + {"ZeroTimeTimestamp", Unmarshaler{}, `{"ts":"0001-01-01T00:00:00Z"}`, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: -62135596800, Nanos: 0}}}, + {"null Timestamp", Unmarshaler{}, `{"ts":null}`, &pb2.KnownTypes{Ts: nil}}, + {"null Struct", Unmarshaler{}, `{"st": null}`, &pb2.KnownTypes{St: nil}}, + {"empty Struct", Unmarshaler{}, `{"st": {}}`, &pb2.KnownTypes{St: &stpb.Struct{}}}, + {"basic Struct", Unmarshaler{}, `{"st": {"a": "x", "b": null, "c": 3, "d": true}}`, &pb2.KnownTypes{St: &stpb.Struct{Fields: map[string]*stpb.Value{ "a": {Kind: &stpb.Value_StringValue{"x"}}, "b": {Kind: &stpb.Value_NullValue{}}, "c": {Kind: &stpb.Value_NumberValue{3}}, "d": {Kind: &stpb.Value_BoolValue{true}}, }}}}, - {"nested Struct", Unmarshaler{}, `{"st": {"a": {"b": 1, "c": [{"d": true}, "f"]}}}`, &pb.KnownTypes{St: &stpb.Struct{Fields: map[string]*stpb.Value{ + {"nested Struct", Unmarshaler{}, `{"st": {"a": {"b": 1, "c": [{"d": true}, "f"]}}}`, &pb2.KnownTypes{St: &stpb.Struct{Fields: map[string]*stpb.Value{ "a": {Kind: &stpb.Value_StructValue{&stpb.Struct{Fields: map[string]*stpb.Value{ "b": {Kind: &stpb.Value_NumberValue{1}}, "c": {Kind: &stpb.Value_ListValue{&stpb.ListValue{Values: []*stpb.Value{ @@ -759,20 +759,20 @@ var unmarshalingTests = []struct { }}}}, }}}}, }}}}, - {"null ListValue", Unmarshaler{}, `{"lv": null}`, &pb.KnownTypes{Lv: nil}}, - {"empty ListValue", Unmarshaler{}, `{"lv": []}`, &pb.KnownTypes{Lv: &stpb.ListValue{}}}, - {"basic ListValue", Unmarshaler{}, `{"lv": ["x", null, 3, true]}`, &pb.KnownTypes{Lv: &stpb.ListValue{Values: []*stpb.Value{ + {"null ListValue", Unmarshaler{}, `{"lv": null}`, &pb2.KnownTypes{Lv: nil}}, + {"empty ListValue", Unmarshaler{}, `{"lv": []}`, &pb2.KnownTypes{Lv: &stpb.ListValue{}}}, + {"basic ListValue", Unmarshaler{}, `{"lv": ["x", null, 3, true]}`, &pb2.KnownTypes{Lv: &stpb.ListValue{Values: []*stpb.Value{ {Kind: &stpb.Value_StringValue{"x"}}, {Kind: &stpb.Value_NullValue{}}, {Kind: &stpb.Value_NumberValue{3}}, {Kind: &stpb.Value_BoolValue{true}}, }}}}, - {"number Value", Unmarshaler{}, `{"val":1}`, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NumberValue{1}}}}, - {"null Value", Unmarshaler{}, `{"val":null}`, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NullValue{stpb.NullValue_NULL_VALUE}}}}, - {"bool Value", Unmarshaler{}, `{"val":true}`, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_BoolValue{true}}}}, - {"string Value", Unmarshaler{}, `{"val":"x"}`, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_StringValue{"x"}}}}, - {"string number value", Unmarshaler{}, `{"val":"9223372036854775807"}`, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_StringValue{"9223372036854775807"}}}}, - {"list of lists Value", Unmarshaler{}, `{"val":["x", [["y"], "z"]]}`, &pb.KnownTypes{Val: &stpb.Value{ + {"number Value", Unmarshaler{}, `{"val":1}`, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NumberValue{1}}}}, + {"null Value", Unmarshaler{}, `{"val":null}`, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NullValue{stpb.NullValue_NULL_VALUE}}}}, + {"bool Value", Unmarshaler{}, `{"val":true}`, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_BoolValue{true}}}}, + {"string Value", Unmarshaler{}, `{"val":"x"}`, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_StringValue{"x"}}}}, + {"string number value", Unmarshaler{}, `{"val":"9223372036854775807"}`, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_StringValue{"9223372036854775807"}}}}, + {"list of lists Value", Unmarshaler{}, `{"val":["x", [["y"], "z"]]}`, &pb2.KnownTypes{Val: &stpb.Value{ Kind: &stpb.Value_ListValue{&stpb.ListValue{ Values: []*stpb.Value{ {Kind: &stpb.Value_StringValue{"x"}}, @@ -787,15 +787,15 @@ var unmarshalingTests = []struct { }, }}}}}, - {"DoubleValue", Unmarshaler{}, `{"dbl":1.2}`, &pb.KnownTypes{Dbl: &wpb.DoubleValue{Value: 1.2}}}, - {"FloatValue", Unmarshaler{}, `{"flt":1.2}`, &pb.KnownTypes{Flt: &wpb.FloatValue{Value: 1.2}}}, - {"Int64Value", Unmarshaler{}, `{"i64":"-3"}`, &pb.KnownTypes{I64: &wpb.Int64Value{Value: -3}}}, - {"UInt64Value", Unmarshaler{}, `{"u64":"3"}`, &pb.KnownTypes{U64: &wpb.UInt64Value{Value: 3}}}, - {"Int32Value", Unmarshaler{}, `{"i32":-4}`, &pb.KnownTypes{I32: &wpb.Int32Value{Value: -4}}}, - {"UInt32Value", Unmarshaler{}, `{"u32":4}`, &pb.KnownTypes{U32: &wpb.UInt32Value{Value: 4}}}, - {"BoolValue", Unmarshaler{}, `{"bool":true}`, &pb.KnownTypes{Bool: &wpb.BoolValue{Value: true}}}, - {"StringValue", Unmarshaler{}, `{"str":"plush"}`, &pb.KnownTypes{Str: &wpb.StringValue{Value: "plush"}}}, - {"StringValue containing escaped character", Unmarshaler{}, `{"str":"a\/b"}`, &pb.KnownTypes{Str: &wpb.StringValue{Value: "a/b"}}}, + {"DoubleValue", Unmarshaler{}, `{"dbl":1.2}`, &pb2.KnownTypes{Dbl: &wpb.DoubleValue{Value: 1.2}}}, + {"FloatValue", Unmarshaler{}, `{"flt":1.2}`, &pb2.KnownTypes{Flt: &wpb.FloatValue{Value: 1.2}}}, + {"Int64Value", Unmarshaler{}, `{"i64":"-3"}`, &pb2.KnownTypes{I64: &wpb.Int64Value{Value: -3}}}, + {"UInt64Value", Unmarshaler{}, `{"u64":"3"}`, &pb2.KnownTypes{U64: &wpb.UInt64Value{Value: 3}}}, + {"Int32Value", Unmarshaler{}, `{"i32":-4}`, &pb2.KnownTypes{I32: &wpb.Int32Value{Value: -4}}}, + {"UInt32Value", Unmarshaler{}, `{"u32":4}`, &pb2.KnownTypes{U32: &wpb.UInt32Value{Value: 4}}}, + {"BoolValue", Unmarshaler{}, `{"bool":true}`, &pb2.KnownTypes{Bool: &wpb.BoolValue{Value: true}}}, + {"StringValue", Unmarshaler{}, `{"str":"plush"}`, &pb2.KnownTypes{Str: &wpb.StringValue{Value: "plush"}}}, + {"StringValue containing escaped character", Unmarshaler{}, `{"str":"a\/b"}`, &pb2.KnownTypes{Str: &wpb.StringValue{Value: "a/b"}}}, {"StructValue containing StringValue's", Unmarshaler{}, `{"escaped": "a\/b", "unicode": "\u00004E16\u0000754C"}`, &stpb.Struct{ Fields: map[string]*stpb.Value{ @@ -803,21 +803,21 @@ var unmarshalingTests = []struct { "unicode": {Kind: &stpb.Value_StringValue{"\u00004E16\u0000754C"}}, }, }}, - {"BytesValue", Unmarshaler{}, `{"bytes":"d293"}`, &pb.KnownTypes{Bytes: &wpb.BytesValue{Value: []byte("wow")}}}, + {"BytesValue", Unmarshaler{}, `{"bytes":"d293"}`, &pb2.KnownTypes{Bytes: &wpb.BytesValue{Value: []byte("wow")}}}, // Ensure that `null` as a value ends up with a nil pointer instead of a [type]Value struct. - {"null DoubleValue", Unmarshaler{}, `{"dbl":null}`, &pb.KnownTypes{Dbl: nil}}, - {"null FloatValue", Unmarshaler{}, `{"flt":null}`, &pb.KnownTypes{Flt: nil}}, - {"null Int64Value", Unmarshaler{}, `{"i64":null}`, &pb.KnownTypes{I64: nil}}, - {"null UInt64Value", Unmarshaler{}, `{"u64":null}`, &pb.KnownTypes{U64: nil}}, - {"null Int32Value", Unmarshaler{}, `{"i32":null}`, &pb.KnownTypes{I32: nil}}, - {"null UInt32Value", Unmarshaler{}, `{"u32":null}`, &pb.KnownTypes{U32: nil}}, - {"null BoolValue", Unmarshaler{}, `{"bool":null}`, &pb.KnownTypes{Bool: nil}}, - {"null StringValue", Unmarshaler{}, `{"str":null}`, &pb.KnownTypes{Str: nil}}, - {"null BytesValue", Unmarshaler{}, `{"bytes":null}`, &pb.KnownTypes{Bytes: nil}}, - - {"required", Unmarshaler{}, `{"str":"hello"}`, &pb.MsgWithRequired{Str: proto.String("hello")}}, - {"required bytes", Unmarshaler{}, `{"byts": []}`, &pb.MsgWithRequiredBytes{Byts: []byte{}}}, + {"null DoubleValue", Unmarshaler{}, `{"dbl":null}`, &pb2.KnownTypes{Dbl: nil}}, + {"null FloatValue", Unmarshaler{}, `{"flt":null}`, &pb2.KnownTypes{Flt: nil}}, + {"null Int64Value", Unmarshaler{}, `{"i64":null}`, &pb2.KnownTypes{I64: nil}}, + {"null UInt64Value", Unmarshaler{}, `{"u64":null}`, &pb2.KnownTypes{U64: nil}}, + {"null Int32Value", Unmarshaler{}, `{"i32":null}`, &pb2.KnownTypes{I32: nil}}, + {"null UInt32Value", Unmarshaler{}, `{"u32":null}`, &pb2.KnownTypes{U32: nil}}, + {"null BoolValue", Unmarshaler{}, `{"bool":null}`, &pb2.KnownTypes{Bool: nil}}, + {"null StringValue", Unmarshaler{}, `{"str":null}`, &pb2.KnownTypes{Str: nil}}, + {"null BytesValue", Unmarshaler{}, `{"bytes":null}`, &pb2.KnownTypes{Bytes: nil}}, + + {"required", Unmarshaler{}, `{"str":"hello"}`, &pb2.MsgWithRequired{Str: proto.String("hello")}}, + {"required bytes", Unmarshaler{}, `{"byts": []}`, &pb2.MsgWithRequiredBytes{Byts: []byte{}}}, } func TestUnmarshaling(t *testing.T) { @@ -841,21 +841,21 @@ func TestUnmarshaling(t *testing.T) { } func TestUnmarshalNullArray(t *testing.T) { - var repeats pb.Repeats + var repeats pb2.Repeats if err := UnmarshalString(`{"rBool":null}`, &repeats); err != nil { t.Fatal(err) } - if !reflect.DeepEqual(repeats, pb.Repeats{}) { + if !proto.Equal(&repeats, &pb2.Repeats{}) { t.Errorf("got non-nil fields in [%#v]", repeats) } } func TestUnmarshalNullObject(t *testing.T) { - var maps pb.Maps + var maps pb2.Maps if err := UnmarshalString(`{"mInt64Str":null}`, &maps); err != nil { t.Fatal(err) } - if !reflect.DeepEqual(maps, pb.Maps{}) { + if !proto.Equal(&maps, &pb2.Maps{}) { t.Errorf("got non-nil fields in [%#v]", maps) } } @@ -889,7 +889,7 @@ func TestUnmarshalNext(t *testing.T) { } } - p := &pb.Simple{} + p := &pb2.Simple{} err := new(Unmarshaler).UnmarshalNext(dec, p) if err != io.EOF { t.Errorf("eof: got %v, expected io.EOF", err) @@ -901,15 +901,15 @@ var unmarshalingShouldError = []struct { in string pb proto.Message }{ - {"a value", "666", new(pb.Simple)}, - {"gibberish", "{adskja123;l23=-=", new(pb.Simple)}, - {"unknown field", `{"unknown": "foo"}`, new(pb.Simple)}, - {"unknown enum name", `{"hilarity":"DAVE"}`, new(proto3pb.Message)}, - {"Duration containing invalid character", `{"dur": "3\U0073"}`, &pb.KnownTypes{}}, - {"Timestamp containing invalid character", `{"ts": "2014-05-13T16:53:20\U005a"}`, &pb.KnownTypes{}}, - {"StringValue containing invalid character", `{"str": "\U00004E16\U0000754C"}`, &pb.KnownTypes{}}, + {"a value", "666", new(pb2.Simple)}, + {"gibberish", "{adskja123;l23=-=", new(pb2.Simple)}, + {"unknown field", `{"unknown": "foo"}`, new(pb2.Simple)}, + {"unknown enum name", `{"hilarity":"DAVE"}`, new(pb3.Message)}, + {"Duration containing invalid character", `{"dur": "3\U0073"}`, &pb2.KnownTypes{}}, + {"Timestamp containing invalid character", `{"ts": "2014-05-13T16:53:20\U005a"}`, &pb2.KnownTypes{}}, + {"StringValue containing invalid character", `{"str": "\U00004E16\U0000754C"}`, &pb2.KnownTypes{}}, {"StructValue containing invalid character", `{"str": "\U00004E16\U0000754C"}`, &stpb.Struct{}}, - {"repeated proto3 enum with non array input", `{"rFunny":"PUNS"}`, &proto3pb.Message{RFunny: []proto3pb.Message_Humour{}}}, + {"repeated proto3 enum with non array input", `{"rFunny":"PUNS"}`, &pb3.Message{RFunny: []pb3.Message_Humour{}}}, } func TestUnmarshalingBadInput(t *testing.T) { @@ -931,9 +931,9 @@ func TestAnyWithCustomResolver(t *testing.T) { var resolvedTypeUrls []string resolver := funcResolver(func(turl string) (proto.Message, error) { resolvedTypeUrls = append(resolvedTypeUrls, turl) - return new(pb.Simple), nil + return new(pb2.Simple), nil }) - msg := &pb.Simple{ + msg := &pb2.Simple{ OBytes: []byte{1, 2, 3, 4}, OBool: proto.Bool(true), OString: proto.String("foobar"), @@ -998,7 +998,7 @@ func TestUnmarshalNullWithJSONPBUnmarshaler(t *testing.T) { t.Errorf("unmarshal error: %v", err) } - want := ptrFieldMessage{StringField: &stringField{IsSet: true, StringValue: "null"}} + want := ptrFieldMessage{} if !proto.Equal(&ptrFieldMsg, &want) { t.Errorf("unmarshal result StringField: got %v, want %v", ptrFieldMsg, want) } @@ -1021,7 +1021,7 @@ func TestUnmarshalAnyJSONPBUnmarshaler(t *testing.T) { } if !proto.Equal(&got, &want) { - t.Errorf("message contents not set correctly after unmarshalling JSON: got %v, wanted %v", got, want) + t.Errorf("message contents not set correctly after unmarshalling JSON: got %v, wanted %v", &got, &want) } } @@ -1112,7 +1112,7 @@ func (m *dynamicMessage) UnmarshalJSONPB(jum *Unmarshaler, js []byte) error { } var testMessageFD = func() []byte { - fd := new(descriptorpb.FileDescriptorProto) + fd := new(descpb.FileDescriptorProto) proto.UnmarshalText(` name: "jsonpb.proto" package: "github_com.golang.protobuf.jsonpb" @@ -1153,92 +1153,92 @@ func TestUnmarshalUnsetRequiredFields(t *testing.T) { }{ { desc: "direct required field missing", - pb: &pb.MsgWithRequired{}, + pb: &pb2.MsgWithRequired{}, json: `{}`, }, { desc: "direct required field set to null", - pb: &pb.MsgWithRequired{}, + pb: &pb2.MsgWithRequired{}, json: `{"str": null}`, }, { desc: "indirect required field missing", - pb: &pb.MsgWithIndirectRequired{}, + pb: &pb2.MsgWithIndirectRequired{}, json: `{"subm": {}}`, }, { desc: "indirect required field set to null", - pb: &pb.MsgWithIndirectRequired{}, + pb: &pb2.MsgWithIndirectRequired{}, json: `{"subm": {"str": null}}`, }, { desc: "direct required bytes field missing", - pb: &pb.MsgWithRequiredBytes{}, + pb: &pb2.MsgWithRequiredBytes{}, json: `{}`, }, { desc: "direct required bytes field set to null", - pb: &pb.MsgWithRequiredBytes{}, + pb: &pb2.MsgWithRequiredBytes{}, json: `{"byts": null}`, }, { desc: "direct required wkt field missing", - pb: &pb.MsgWithRequiredWKT{}, + pb: &pb2.MsgWithRequiredWKT{}, json: `{}`, }, { desc: "direct required wkt field set to null", - pb: &pb.MsgWithRequiredWKT{}, + pb: &pb2.MsgWithRequiredWKT{}, json: `{"str": null}`, }, { desc: "any containing message with required field set to null", - pb: &pb.KnownTypes{}, + pb: &pb2.KnownTypes{}, json: `{"an": {"@type": "example.com/jsonpb.MsgWithRequired", "str": null}}`, }, { desc: "any containing message with missing required field", - pb: &pb.KnownTypes{}, + pb: &pb2.KnownTypes{}, json: `{"an": {"@type": "example.com/jsonpb.MsgWithRequired"}}`, }, { desc: "missing required in map value", - pb: &pb.MsgWithIndirectRequired{}, + pb: &pb2.MsgWithIndirectRequired{}, json: `{"map_field": {"a": {}, "b": {"str": "hi"}}}`, }, { desc: "required in map value set to null", - pb: &pb.MsgWithIndirectRequired{}, + pb: &pb2.MsgWithIndirectRequired{}, json: `{"map_field": {"a": {"str": "hello"}, "b": {"str": null}}}`, }, { desc: "missing required in slice item", - pb: &pb.MsgWithIndirectRequired{}, + pb: &pb2.MsgWithIndirectRequired{}, json: `{"slice_field": [{}, {"str": "hi"}]}`, }, { desc: "required in slice item set to null", - pb: &pb.MsgWithIndirectRequired{}, + pb: &pb2.MsgWithIndirectRequired{}, json: `{"slice_field": [{"str": "hello"}, {"str": null}]}`, }, { desc: "required inside oneof missing", - pb: &pb.MsgWithOneof{}, + pb: &pb2.MsgWithOneof{}, json: `{"msgWithRequired": {}}`, }, { desc: "required inside oneof set to null", - pb: &pb.MsgWithOneof{}, + pb: &pb2.MsgWithOneof{}, json: `{"msgWithRequired": {"str": null}}`, }, { desc: "required field in extension missing", - pb: &pb.Real{}, + pb: &pb2.Real{}, json: `{"[jsonpb.extm]":{}}`, }, { desc: "required field in extension set to null", - pb: &pb.Real{}, + pb: &pb2.Real{}, json: `{"[jsonpb.extm]":{"str": null}}`, }, } diff --git a/jsonpb/jsonpb.go b/jsonpb/jsonpb.go deleted file mode 100644 index 90c2b33217..0000000000 --- a/jsonpb/jsonpb.go +++ /dev/null @@ -1,1291 +0,0 @@ -// Copyright 2015 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 jsonpb provides marshaling and unmarshaling between protocol buffers and JSON. -// It follows the specification at https://developers.google.com/protocol-buffers/docs/proto3#json. -// -// This package produces a different output than the standard "encoding/json" package, -// which does not operate correctly on protocol buffers. -package jsonpb - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io" - "math" - "reflect" - "sort" - "strconv" - "strings" - "time" - - "github.com/golang/protobuf/proto" - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - - stpb "github.com/golang/protobuf/ptypes/struct" -) - -const secondInNanos = int64(time.Second / time.Nanosecond) - -// Marshaler is a configurable object for converting between -// protocol buffer objects and a JSON representation for them. -type Marshaler struct { - // Whether to render enum values as integers, as opposed to string values. - EnumsAsInts bool - - // Whether to render fields with zero values. - EmitDefaults bool - - // A string to indent each level by. The presence of this field will - // also cause a space to appear between the field separator and - // value, and for newlines to be appear between fields and array - // elements. - Indent string - - // Whether to use the original (.proto) name for fields. - OrigName bool - - // A custom URL resolver to use when marshaling Any messages to JSON. - // If unset, the default resolution strategy is to extract the - // fully-qualified type name from the type URL and pass that to - // proto.MessageType(string). - AnyResolver AnyResolver -} - -// AnyResolver takes a type URL, present in an Any message, and resolves it into -// an instance of the associated message. -type AnyResolver interface { - Resolve(typeUrl string) (proto.Message, error) -} - -func defaultResolveAny(typeUrl string) (proto.Message, error) { - // Only the part of typeUrl after the last slash is relevant. - mname := typeUrl - if slash := strings.LastIndex(mname, "/"); slash >= 0 { - mname = mname[slash+1:] - } - mt := proto.MessageType(mname) - if mt == nil { - return nil, fmt.Errorf("unknown message type %q", mname) - } - return reflect.New(mt.Elem()).Interface().(proto.Message), nil -} - -// JSONPBMarshaler is implemented by protobuf messages that customize the -// way they are marshaled to JSON. Messages that implement this should -// also implement JSONPBUnmarshaler so that the custom format can be -// parsed. -// -// The JSON marshaling must follow the proto to JSON specification: -// https://developers.google.com/protocol-buffers/docs/proto3#json -type JSONPBMarshaler interface { - MarshalJSONPB(*Marshaler) ([]byte, error) -} - -// JSONPBUnmarshaler is implemented by protobuf messages that customize -// the way they are unmarshaled from JSON. Messages that implement this -// should also implement JSONPBMarshaler so that the custom format can be -// produced. -// -// The JSON unmarshaling must follow the JSON to proto specification: -// https://developers.google.com/protocol-buffers/docs/proto3#json -type JSONPBUnmarshaler interface { - UnmarshalJSONPB(*Unmarshaler, []byte) error -} - -// Marshal marshals a protocol buffer into JSON. -func (m *Marshaler) Marshal(out io.Writer, pb proto.Message) error { - v := reflect.ValueOf(pb) - if pb == nil || (v.Kind() == reflect.Ptr && v.IsNil()) { - return errors.New("Marshal called with nil") - } - // Check for unset required fields first. - if err := checkRequiredFields(pb); err != nil { - return err - } - writer := &errWriter{writer: out} - return m.marshalObject(writer, pb, "", "") -} - -// MarshalToString converts a protocol buffer object to JSON string. -func (m *Marshaler) MarshalToString(pb proto.Message) (string, error) { - var buf bytes.Buffer - if err := m.Marshal(&buf, pb); err != nil { - return "", err - } - return buf.String(), nil -} - -type int32Slice []int32 - -var nonFinite = map[string]float64{ - `"NaN"`: math.NaN(), - `"Infinity"`: math.Inf(1), - `"-Infinity"`: math.Inf(-1), -} - -// For sorting extensions ids to ensure stable output. -func (s int32Slice) Len() int { return len(s) } -func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } -func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -func wellKnownType(v interface{}) string { - var s protoreflect.FullName - switch v := v.(type) { - case interface{ XXX_WellKnownType() string }: - return v.XXX_WellKnownType() - case protoreflect.Enum: - s = v.Descriptor().FullName() - case protoreflect.ProtoMessage: - s = v.ProtoReflect().Descriptor().FullName() - } - if s.Parent() == "google.protobuf" { - switch s.Name() { - case "Empty", - "Any", - "BoolValue", - "FloatValue", "DoubleValue", - "Int32Value", "Int64Value", - "UInt32Value", "UInt64Value", - "BytesValue", "StringValue", - "Duration", "Timestamp", - "NullValue", "Struct", "Value", "ListValue": - return string(s.Name()) - } - } - return "" -} - -// marshalObject writes a struct to the Writer. -func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeURL string) error { - if jsm, ok := v.(JSONPBMarshaler); ok { - b, err := jsm.MarshalJSONPB(m) - if err != nil { - return err - } - if typeURL != "" { - // we are marshaling this object to an Any type - var js map[string]*json.RawMessage - if err = json.Unmarshal(b, &js); err != nil { - return fmt.Errorf("type %T produced invalid JSON: %v", v, err) - } - turl, err := json.Marshal(typeURL) - if err != nil { - return fmt.Errorf("failed to marshal type URL %q to JSON: %v", typeURL, err) - } - js["@type"] = (*json.RawMessage)(&turl) - if b, err = json.Marshal(js); err != nil { - return err - } - } - - out.write(string(b)) - return out.err - } - - s := reflect.ValueOf(v).Elem() - - // Handle well-known types. - switch wellKnownType(v) { - case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", - "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": - // "Wrappers use the same representation in JSON - // as the wrapped primitive type, ..." - sprop := proto.GetProperties(s.Type()) - return m.marshalValue(out, sprop.Prop[1], s.FieldByName("Value"), indent) - case "Any": - // Any is a bit more involved. - return m.marshalAny(out, v, indent) - case "Duration": - // "Generated output always contains 0, 3, 6, or 9 fractional digits, - // depending on required precision." - s, ns := s.FieldByName("Seconds").Int(), s.FieldByName("Nanos").Int() - if ns <= -secondInNanos || ns >= secondInNanos { - return fmt.Errorf("ns out of range (%v, %v)", -secondInNanos, secondInNanos) - } - if (s > 0 && ns < 0) || (s < 0 && ns > 0) { - return errors.New("signs of seconds and nanos do not match") - } - if s < 0 { - ns = -ns - } - x := fmt.Sprintf("%d.%09d", s, ns) - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, ".000") - out.write(`"`) - out.write(x) - out.write(`s"`) - return out.err - case "Struct": - // Let marshalValue handle the `Struct.fields` map. - // TODO: pass the correct Properties if needed. - return m.marshalValue(out, &proto.Properties{}, s.FieldByName("Fields"), indent) - case "ListValue": - // Let marshalValue handle the `ListValue.values` slice. - // TODO: pass the correct Properties if needed. - return m.marshalValue(out, &proto.Properties{}, s.FieldByName("Values"), indent) - case "Timestamp": - // "RFC 3339, where generated output will always be Z-normalized - // and uses 0, 3, 6 or 9 fractional digits." - s, ns := s.FieldByName("Seconds").Int(), s.FieldByName("Nanos").Int() - if ns < 0 || ns >= secondInNanos { - return fmt.Errorf("ns out of range [0, %v)", secondInNanos) - } - t := time.Unix(s, ns).UTC() - // time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits). - x := t.Format("2006-01-02T15:04:05.000000000") - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, ".000") - out.write(`"`) - out.write(x) - out.write(`Z"`) - return out.err - case "Value": - // Value has a single oneof. - kind := s.FieldByName("Kind") - if kind.IsNil() { - // "absence of any variant indicates an error" - return errors.New("nil Value") - } - // oneof -> *T -> T -> T.F - x := kind.Elem().Elem().Field(0) - // TODO: pass the correct Properties if needed. - return m.marshalValue(out, &proto.Properties{}, x, indent) - } - - out.write("{") - if m.Indent != "" { - out.write("\n") - } - - firstField := true - - if typeURL != "" { - if err := m.marshalTypeURL(out, indent, typeURL); err != nil { - return err - } - firstField = false - } - - for i := 0; i < s.NumField(); i++ { - if f := s.Type().Field(i); strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { - continue - } - value := s.Field(i) - valueField := s.Type().Field(i) - - // IsNil will panic on most value kinds. - switch value.Kind() { - case reflect.Chan, reflect.Func, reflect.Interface: - if value.IsNil() { - continue - } - } - - if !m.EmitDefaults { - switch value.Kind() { - case reflect.Bool: - if !value.Bool() { - continue - } - case reflect.Int32, reflect.Int64: - if value.Int() == 0 { - continue - } - case reflect.Uint32, reflect.Uint64: - if value.Uint() == 0 { - continue - } - case reflect.Float32, reflect.Float64: - if value.Float() == 0 { - continue - } - case reflect.String: - if value.Len() == 0 { - continue - } - case reflect.Map, reflect.Ptr, reflect.Slice: - if value.IsNil() { - continue - } - } - } - - // Oneof fields need special handling. - if valueField.Tag.Get("protobuf_oneof") != "" { - // value is an interface containing &T{real_value}. - sv := value.Elem().Elem() // interface -> *T -> T - value = sv.Field(0) - valueField = sv.Type().Field(0) - } - prop := jsonProperties(valueField, m.OrigName) - if !firstField { - m.writeSep(out) - } - if err := m.marshalField(out, prop, value, indent); err != nil { - return err - } - firstField = false - } - - // Handle proto2 extensions. - if ep, ok := v.(proto.Message); ok { - extensions := proto.RegisteredExtensions(v) - // Sort extensions for stable output. - ids := make([]int32, 0, len(extensions)) - for id, desc := range extensions { - if !proto.HasExtension(ep, desc) { - continue - } - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) - for _, id := range ids { - desc := extensions[id] - if desc == nil { - // unknown extension - continue - } - ext, extErr := proto.GetExtension(ep, desc) - if extErr != nil { - return extErr - } - value := reflect.ValueOf(ext) - var prop proto.Properties - prop.Parse(desc.Tag) - name := desc.Name - if strings.HasSuffix(name, ".message_set_extension") && isMessageSet(s.Type()) { - name = strings.TrimSuffix(name, ".message_set_extension") - } - prop.JSONName = fmt.Sprintf("[%s]", name) - if !firstField { - m.writeSep(out) - } - if err := m.marshalField(out, &prop, value, indent); err != nil { - return err - } - firstField = false - } - - } - - if m.Indent != "" { - out.write("\n") - out.write(indent) - } - out.write("}") - return out.err -} - -func (m *Marshaler) writeSep(out *errWriter) { - if m.Indent != "" { - out.write(",\n") - } else { - out.write(",") - } -} - -func (m *Marshaler) marshalAny(out *errWriter, any proto.Message, indent string) error { - // "If the Any contains a value that has a special JSON mapping, - // it will be converted as follows: {"@type": xxx, "value": yyy}. - // Otherwise, the value will be converted into a JSON object, - // and the "@type" field will be inserted to indicate the actual data type." - v := reflect.ValueOf(any).Elem() - turl := v.FieldByName("TypeUrl").String() - val := v.FieldByName("Value").Bytes() - - var msg proto.Message - var err error - if m.AnyResolver != nil { - msg, err = m.AnyResolver.Resolve(turl) - } else { - msg, err = defaultResolveAny(turl) - } - if err != nil { - return err - } - - if err := proto.Unmarshal(val, msg); err != nil { - return err - } - - if wellKnownType(msg) != "" { - out.write("{") - if m.Indent != "" { - out.write("\n") - } - if err := m.marshalTypeURL(out, indent, turl); err != nil { - return err - } - m.writeSep(out) - if m.Indent != "" { - out.write(indent) - out.write(m.Indent) - out.write(`"value": `) - } else { - out.write(`"value":`) - } - if err := m.marshalObject(out, msg, indent+m.Indent, ""); err != nil { - return err - } - if m.Indent != "" { - out.write("\n") - out.write(indent) - } - out.write("}") - return out.err - } - - return m.marshalObject(out, msg, indent, turl) -} - -func (m *Marshaler) marshalTypeURL(out *errWriter, indent, typeURL string) error { - if m.Indent != "" { - out.write(indent) - out.write(m.Indent) - } - out.write(`"@type":`) - if m.Indent != "" { - out.write(" ") - } - b, err := json.Marshal(typeURL) - if err != nil { - return err - } - out.write(string(b)) - return out.err -} - -// marshalField writes field description and value to the Writer. -func (m *Marshaler) marshalField(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error { - if m.Indent != "" { - out.write(indent) - out.write(m.Indent) - } - out.write(`"`) - out.write(prop.JSONName) - out.write(`":`) - if m.Indent != "" { - out.write(" ") - } - if err := m.marshalValue(out, prop, v, indent); err != nil { - return err - } - return nil -} - -// marshalValue writes the value to the Writer. -func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error { - var err error - v = reflect.Indirect(v) - - // Handle nil pointer - if v.Kind() == reflect.Invalid { - out.write("null") - return out.err - } - - // Handle repeated elements. - if v.Kind() == reflect.Slice && v.Type().Elem().Kind() != reflect.Uint8 { - out.write("[") - comma := "" - for i := 0; i < v.Len(); i++ { - sliceVal := v.Index(i) - out.write(comma) - if m.Indent != "" { - out.write("\n") - out.write(indent) - out.write(m.Indent) - out.write(m.Indent) - } - if err := m.marshalValue(out, prop, sliceVal, indent+m.Indent); err != nil { - return err - } - comma = "," - } - if m.Indent != "" { - out.write("\n") - out.write(indent) - out.write(m.Indent) - } - out.write("]") - return out.err - } - - // Handle well-known types. - // Most are handled up in marshalObject (because 99% are messages). - switch wellKnownType(v.Interface()) { - case "NullValue": - out.write("null") - return out.err - } - - // Handle enumerations. - if !m.EnumsAsInts && prop.Enum != "" { - // Unknown enum values will are stringified by the proto library as their - // value. Such values should _not_ be quoted or they will be interpreted - // as an enum string instead of their value. - enumStr := v.Interface().(fmt.Stringer).String() - var valStr string - if v.Kind() == reflect.Ptr { - valStr = strconv.Itoa(int(v.Elem().Int())) - } else { - valStr = strconv.Itoa(int(v.Int())) - } - isKnownEnum := enumStr != valStr - if isKnownEnum { - out.write(`"`) - } - out.write(enumStr) - if isKnownEnum { - out.write(`"`) - } - return out.err - } - - // Handle nested messages. - if v.Kind() == reflect.Struct { - return m.marshalObject(out, v.Addr().Interface().(proto.Message), indent+m.Indent, "") - } - - // Handle maps. - // Since Go randomizes map iteration, we sort keys for stable output. - if v.Kind() == reflect.Map { - out.write(`{`) - keys := v.MapKeys() - sort.Sort(mapKeys(keys)) - for i, k := range keys { - if i > 0 { - out.write(`,`) - } - if m.Indent != "" { - out.write("\n") - out.write(indent) - out.write(m.Indent) - out.write(m.Indent) - } - - // TODO handle map key prop properly - b, err := json.Marshal(k.Interface()) - if err != nil { - return err - } - s := string(b) - - // If the JSON is not a string value, encode it again to make it one. - if !strings.HasPrefix(s, `"`) { - b, err := json.Marshal(s) - if err != nil { - return err - } - s = string(b) - } - - out.write(s) - out.write(`:`) - if m.Indent != "" { - out.write(` `) - } - - vprop := prop - if prop != nil && prop.MapValProp != nil { - vprop = prop.MapValProp - } - if err := m.marshalValue(out, vprop, v.MapIndex(k), indent+m.Indent); err != nil { - return err - } - } - if m.Indent != "" { - out.write("\n") - out.write(indent) - out.write(m.Indent) - } - out.write(`}`) - return out.err - } - - // Handle non-finite floats, e.g. NaN, Infinity and -Infinity. - if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { - f := v.Float() - var sval string - switch { - case math.IsInf(f, 1): - sval = `"Infinity"` - case math.IsInf(f, -1): - sval = `"-Infinity"` - case math.IsNaN(f): - sval = `"NaN"` - } - if sval != "" { - out.write(sval) - return out.err - } - } - - // Default handling defers to the encoding/json library. - b, err := json.Marshal(v.Interface()) - if err != nil { - return err - } - needToQuote := string(b[0]) != `"` && (v.Kind() == reflect.Int64 || v.Kind() == reflect.Uint64) - if needToQuote { - out.write(`"`) - } - out.write(string(b)) - if needToQuote { - out.write(`"`) - } - return out.err -} - -// Unmarshaler is a configurable object for converting from a JSON -// representation to a protocol buffer object. -type Unmarshaler struct { - // Whether to allow messages to contain unknown fields, as opposed to - // failing to unmarshal. - AllowUnknownFields bool - - // A custom URL resolver to use when unmarshaling Any messages from JSON. - // If unset, the default resolution strategy is to extract the - // fully-qualified type name from the type URL and pass that to - // proto.MessageType(string). - AnyResolver AnyResolver -} - -// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream. -// This function is lenient and will decode any options permutations of the -// related Marshaler. -func (u *Unmarshaler) UnmarshalNext(dec *json.Decoder, pb proto.Message) error { - inputValue := json.RawMessage{} - if err := dec.Decode(&inputValue); err != nil { - return err - } - if err := u.unmarshalValue(reflect.ValueOf(pb).Elem(), inputValue, nil); err != nil { - return err - } - return checkRequiredFields(pb) -} - -// Unmarshal unmarshals a JSON object stream into a protocol -// buffer. This function is lenient and will decode any options -// permutations of the related Marshaler. -func (u *Unmarshaler) Unmarshal(r io.Reader, pb proto.Message) error { - dec := json.NewDecoder(r) - return u.UnmarshalNext(dec, pb) -} - -// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream. -// This function is lenient and will decode any options permutations of the -// related Marshaler. -func UnmarshalNext(dec *json.Decoder, pb proto.Message) error { - return new(Unmarshaler).UnmarshalNext(dec, pb) -} - -// Unmarshal unmarshals a JSON object stream into a protocol -// buffer. This function is lenient and will decode any options -// permutations of the related Marshaler. -func Unmarshal(r io.Reader, pb proto.Message) error { - return new(Unmarshaler).Unmarshal(r, pb) -} - -// UnmarshalString will populate the fields of a protocol buffer based -// on a JSON string. This function is lenient and will decode any options -// permutations of the related Marshaler. -func UnmarshalString(str string, pb proto.Message) error { - return new(Unmarshaler).Unmarshal(strings.NewReader(str), pb) -} - -// unmarshalValue converts/copies a value into the target. -// prop may be nil. -func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMessage, prop *proto.Properties) error { - targetType := target.Type() - - // Allocate memory for pointer fields. - if targetType.Kind() == reflect.Ptr { - // If input value is "null" and target is a pointer type, then the field should be treated as not set - // UNLESS the target is structpb.Value, in which case it should be set to structpb.NullValue. - _, isJSONPBUnmarshaler := target.Interface().(JSONPBUnmarshaler) - if string(inputValue) == "null" && targetType != reflect.TypeOf(&stpb.Value{}) && !isJSONPBUnmarshaler { - return nil - } - target.Set(reflect.New(targetType.Elem())) - - return u.unmarshalValue(target.Elem(), inputValue, prop) - } - - if jsu, ok := target.Addr().Interface().(JSONPBUnmarshaler); ok { - return jsu.UnmarshalJSONPB(u, []byte(inputValue)) - } - - // Handle well-known types that are not pointers. - switch wellKnownType(target.Addr().Interface()) { - case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", - "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": - return u.unmarshalValue(target.FieldByName("Value"), inputValue, prop) - case "Any": - // Use json.RawMessage pointer type instead of value to support pre-1.8 version. - // 1.8 changed RawMessage.MarshalJSON from pointer type to value type, see - // https://github.com/golang/go/issues/14493 - var jsonFields map[string]*json.RawMessage - if err := json.Unmarshal(inputValue, &jsonFields); err != nil { - return err - } - - val, ok := jsonFields["@type"] - if !ok || val == nil { - return errors.New("Any JSON doesn't have '@type'") - } - - var turl string - if err := json.Unmarshal([]byte(*val), &turl); err != nil { - return fmt.Errorf("can't unmarshal Any's '@type': %q", *val) - } - target.FieldByName("TypeUrl").SetString(turl) - - var m proto.Message - var err error - if u.AnyResolver != nil { - m, err = u.AnyResolver.Resolve(turl) - } else { - m, err = defaultResolveAny(turl) - } - if err != nil { - return err - } - - if wellKnownType(m) != "" { - val, ok := jsonFields["value"] - if !ok { - return errors.New("Any JSON doesn't have 'value'") - } - - if err := u.unmarshalValue(reflect.ValueOf(m).Elem(), *val, nil); err != nil { - return fmt.Errorf("can't unmarshal Any nested proto %T: %v", m, err) - } - } else { - delete(jsonFields, "@type") - nestedProto, err := json.Marshal(jsonFields) - if err != nil { - return fmt.Errorf("can't generate JSON for Any's nested proto to be unmarshaled: %v", err) - } - - if err = u.unmarshalValue(reflect.ValueOf(m).Elem(), nestedProto, nil); err != nil { - return fmt.Errorf("can't unmarshal Any nested proto %T: %v", m, err) - } - } - - b, err := proto.Marshal(m) - if err != nil { - return fmt.Errorf("can't marshal proto %T into Any.Value: %v", m, err) - } - target.FieldByName("Value").SetBytes(b) - - return nil - case "Duration": - unq, err := unquote(string(inputValue)) - if err != nil { - return err - } - - d, err := time.ParseDuration(unq) - if err != nil { - return fmt.Errorf("bad Duration: %v", err) - } - - ns := d.Nanoseconds() - s := ns / 1e9 - ns %= 1e9 - target.FieldByName("Seconds").SetInt(s) - target.FieldByName("Nanos").SetInt(ns) - return nil - case "Timestamp": - unq, err := unquote(string(inputValue)) - if err != nil { - return err - } - - t, err := time.Parse(time.RFC3339Nano, unq) - if err != nil { - return fmt.Errorf("bad Timestamp: %v", err) - } - - target.FieldByName("Seconds").SetInt(t.Unix()) - target.FieldByName("Nanos").SetInt(int64(t.Nanosecond())) - return nil - case "Struct": - var m map[string]json.RawMessage - if err := json.Unmarshal(inputValue, &m); err != nil { - return fmt.Errorf("bad StructValue: %v", err) - } - - target.FieldByName("Fields").Set(reflect.ValueOf(map[string]*stpb.Value{})) - for k, jv := range m { - pv := &stpb.Value{} - if err := u.unmarshalValue(reflect.ValueOf(pv).Elem(), jv, prop); err != nil { - return fmt.Errorf("bad value in StructValue for key %q: %v", k, err) - } - target.FieldByName("Fields").SetMapIndex(reflect.ValueOf(k), reflect.ValueOf(pv)) - } - return nil - case "ListValue": - var s []json.RawMessage - if err := json.Unmarshal(inputValue, &s); err != nil { - return fmt.Errorf("bad ListValue: %v", err) - } - - target.FieldByName("Values").Set(reflect.ValueOf(make([]*stpb.Value, len(s)))) - for i, sv := range s { - if err := u.unmarshalValue(target.FieldByName("Values").Index(i), sv, prop); err != nil { - return err - } - } - return nil - case "Value": - ivStr := string(inputValue) - if ivStr == "null" { - target.FieldByName("Kind").Set(reflect.ValueOf(&stpb.Value_NullValue{})) - } else if v, err := strconv.ParseFloat(ivStr, 0); err == nil { - target.FieldByName("Kind").Set(reflect.ValueOf(&stpb.Value_NumberValue{v})) - } else if v, err := unquote(ivStr); err == nil { - target.FieldByName("Kind").Set(reflect.ValueOf(&stpb.Value_StringValue{v})) - } else if v, err := strconv.ParseBool(ivStr); err == nil { - target.FieldByName("Kind").Set(reflect.ValueOf(&stpb.Value_BoolValue{v})) - } else if err := json.Unmarshal(inputValue, &[]json.RawMessage{}); err == nil { - lv := &stpb.ListValue{} - target.FieldByName("Kind").Set(reflect.ValueOf(&stpb.Value_ListValue{lv})) - return u.unmarshalValue(reflect.ValueOf(lv).Elem(), inputValue, prop) - } else if err := json.Unmarshal(inputValue, &map[string]json.RawMessage{}); err == nil { - sv := &stpb.Struct{} - target.FieldByName("Kind").Set(reflect.ValueOf(&stpb.Value_StructValue{sv})) - return u.unmarshalValue(reflect.ValueOf(sv).Elem(), inputValue, prop) - } else { - return fmt.Errorf("unrecognized type for Value %q", ivStr) - } - return nil - } - - // Handle enums, which have an underlying type of int32, - // and may appear as strings. - // The case of an enum appearing as a number is handled - // at the bottom of this function. - if inputValue[0] == '"' && prop != nil && prop.Enum != "" { - vmap := proto.EnumValueMap(prop.Enum) - // Don't need to do unquoting; valid enum names - // are from a limited character set. - s := inputValue[1 : len(inputValue)-1] - n, ok := vmap[string(s)] - if !ok { - return fmt.Errorf("unknown value %q for enum %s", s, prop.Enum) - } - if target.Kind() == reflect.Ptr { // proto2 - target.Set(reflect.New(targetType.Elem())) - target = target.Elem() - } - if targetType.Kind() != reflect.Int32 { - return fmt.Errorf("invalid target %q for enum %s", targetType.Kind(), prop.Enum) - } - target.SetInt(int64(n)) - return nil - } - - // Handle nested messages. - if targetType.Kind() == reflect.Struct { - var jsonFields map[string]json.RawMessage - if err := json.Unmarshal(inputValue, &jsonFields); err != nil { - return err - } - - consumeField := func(prop *proto.Properties) (json.RawMessage, bool) { - // Be liberal in what names we accept; both orig_name and camelName are okay. - fieldNames := acceptedJSONFieldNames(prop) - - vOrig, okOrig := jsonFields[fieldNames.orig] - vCamel, okCamel := jsonFields[fieldNames.camel] - if !okOrig && !okCamel { - return nil, false - } - // If, for some reason, both are present in the data, favour the camelName. - var raw json.RawMessage - if okOrig { - raw = vOrig - delete(jsonFields, fieldNames.orig) - } - if okCamel { - raw = vCamel - delete(jsonFields, fieldNames.camel) - } - return raw, true - } - - sprops := proto.GetProperties(targetType) - for i := 0; i < target.NumField(); i++ { - ft := target.Type().Field(i) - if f := ft; strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { - continue - } - - valueForField, ok := consumeField(sprops.Prop[i]) - if !ok { - continue - } - - if err := u.unmarshalValue(target.Field(i), valueForField, sprops.Prop[i]); err != nil { - return err - } - } - // Check for any oneof fields. - if len(jsonFields) > 0 { - for _, oop := range sprops.OneofTypes { - raw, ok := consumeField(oop.Prop) - if !ok { - continue - } - nv := reflect.New(oop.Type.Elem()) - target.Field(oop.Field).Set(nv) - if err := u.unmarshalValue(nv.Elem().Field(0), raw, oop.Prop); err != nil { - return err - } - } - } - // Handle proto2 extensions. - if len(jsonFields) > 0 { - if ep, ok := target.Addr().Interface().(proto.Message); ok { - for _, ext := range proto.RegisteredExtensions(ep) { - name := fmt.Sprintf("[%s]", ext.Name) - raw, ok := jsonFields[name] - if !ok { - continue - } - delete(jsonFields, name) - nv := reflect.New(reflect.TypeOf(ext.ExtensionType).Elem()) - if err := u.unmarshalValue(nv.Elem(), raw, nil); err != nil { - return err - } - if err := proto.SetExtension(ep, ext, nv.Interface()); err != nil { - return err - } - } - if isMessageSet(target.Type()) { - for _, ext := range proto.RegisteredExtensions(ep) { - name := fmt.Sprintf("[%s]", strings.TrimSuffix(ext.Name, ".message_set_extension")) - raw, ok := jsonFields[name] - if !ok { - continue - } - delete(jsonFields, name) - nv := reflect.New(reflect.TypeOf(ext.ExtensionType).Elem()) - if err := u.unmarshalValue(nv.Elem(), raw, nil); err != nil { - return err - } - if err := proto.SetExtension(ep, ext, nv.Interface()); err != nil { - return err - } - } - } - } - } - if !u.AllowUnknownFields && len(jsonFields) > 0 { - // Pick any field to be the scapegoat. - var f string - for fname := range jsonFields { - f = fname - break - } - return fmt.Errorf("unknown field %q in %v", f, targetType) - } - return nil - } - - // Handle arrays (which aren't encoded bytes) - if targetType.Kind() == reflect.Slice && targetType.Elem().Kind() != reflect.Uint8 { - var slc []json.RawMessage - if err := json.Unmarshal(inputValue, &slc); err != nil { - return err - } - if slc != nil { - l := len(slc) - target.Set(reflect.MakeSlice(targetType, l, l)) - for i := 0; i < l; i++ { - if err := u.unmarshalValue(target.Index(i), slc[i], prop); err != nil { - return err - } - } - } - return nil - } - - // Handle maps (whose keys are always strings) - if targetType.Kind() == reflect.Map { - var mp map[string]json.RawMessage - if err := json.Unmarshal(inputValue, &mp); err != nil { - return err - } - if mp != nil { - target.Set(reflect.MakeMap(targetType)) - for ks, raw := range mp { - // Unmarshal map key. The core json library already decoded the key into a - // string, so we handle that specially. Other types were quoted post-serialization. - var k reflect.Value - if targetType.Key().Kind() == reflect.String { - k = reflect.ValueOf(ks) - } else { - k = reflect.New(targetType.Key()).Elem() - var kprop *proto.Properties - if prop != nil && prop.MapKeyProp != nil { - kprop = prop.MapKeyProp - } - if err := u.unmarshalValue(k, json.RawMessage(ks), kprop); err != nil { - return err - } - } - - // Unmarshal map value. - v := reflect.New(targetType.Elem()).Elem() - var vprop *proto.Properties - if prop != nil && prop.MapValProp != nil { - vprop = prop.MapValProp - } - if err := u.unmarshalValue(v, raw, vprop); err != nil { - return err - } - target.SetMapIndex(k, v) - } - } - return nil - } - - // Non-finite numbers can be encoded as strings. - isFloat := targetType.Kind() == reflect.Float32 || targetType.Kind() == reflect.Float64 - if isFloat { - if num, ok := nonFinite[string(inputValue)]; ok { - target.SetFloat(num) - return nil - } - } - - // integers & floats can be encoded as strings. In this case we drop - // the quotes and proceed as normal. - isNum := targetType.Kind() == reflect.Int64 || targetType.Kind() == reflect.Uint64 || - targetType.Kind() == reflect.Int32 || targetType.Kind() == reflect.Uint32 || - targetType.Kind() == reflect.Float32 || targetType.Kind() == reflect.Float64 - if isNum && strings.HasPrefix(string(inputValue), `"`) { - inputValue = inputValue[1 : len(inputValue)-1] - } - - // Use the encoding/json for parsing other value types. - return json.Unmarshal(inputValue, target.Addr().Interface()) -} - -func unquote(s string) (string, error) { - var ret string - err := json.Unmarshal([]byte(s), &ret) - return ret, err -} - -// jsonProperties returns parsed proto.Properties for the field and corrects JSONName attribute. -func jsonProperties(f reflect.StructField, origName bool) *proto.Properties { - var prop proto.Properties - prop.Init(f.Type, f.Name, f.Tag.Get("protobuf"), &f) - if origName || prop.JSONName == "" { - prop.JSONName = prop.OrigName - } - return &prop -} - -type fieldNames struct { - orig, camel string -} - -func acceptedJSONFieldNames(prop *proto.Properties) fieldNames { - opts := fieldNames{orig: prop.OrigName, camel: prop.OrigName} - if prop.JSONName != "" { - opts.camel = prop.JSONName - } - return opts -} - -// Writer wrapper inspired by https://blog.golang.org/errors-are-values -type errWriter struct { - writer io.Writer - err error -} - -func (w *errWriter) write(str string) { - if w.err != nil { - return - } - _, w.err = w.writer.Write([]byte(str)) -} - -// Map fields may have key types of non-float scalars, strings and enums. -// The easiest way to sort them in some deterministic order is to use fmt. -// If this turns out to be inefficient we can always consider other options, -// such as doing a Schwartzian transform. -// -// Numeric keys are sorted in numeric order per -// https://developers.google.com/protocol-buffers/docs/proto#maps. -type mapKeys []reflect.Value - -func (s mapKeys) Len() int { return len(s) } -func (s mapKeys) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -func (s mapKeys) Less(i, j int) bool { - if k := s[i].Kind(); k == s[j].Kind() { - switch k { - case reflect.String: - return s[i].String() < s[j].String() - case reflect.Int32, reflect.Int64: - return s[i].Int() < s[j].Int() - case reflect.Uint32, reflect.Uint64: - return s[i].Uint() < s[j].Uint() - } - } - return fmt.Sprint(s[i].Interface()) < fmt.Sprint(s[j].Interface()) -} - -// checkRequiredFields returns an error if any required field in the given proto message is not set. -// This function is used by both Marshal and Unmarshal. While required fields only exist in a -// proto2 message, a proto3 message can contain proto2 message(s). -func checkRequiredFields(pb proto.Message) error { - // Most well-known type messages do not contain required fields. The "Any" type may contain - // a message that has required fields. - // - // When an Any message is being marshaled, the code will invoked proto.Unmarshal on Any.Value - // field in order to transform that into JSON, and that should have returned an error if a - // required field is not set in the embedded message. - // - // When an Any message is being unmarshaled, the code will have invoked proto.Marshal on the - // embedded message to store the serialized message in Any.Value field, and that should have - // returned an error if a required field is not set. - if wellKnownType(pb) != "" { - return nil - } - - v := reflect.ValueOf(pb) - // Skip message if it is not a struct pointer. - if v.Kind() != reflect.Ptr { - return nil - } - v = v.Elem() - if v.Kind() != reflect.Struct { - return nil - } - - for i := 0; i < v.NumField(); i++ { - if f := v.Type().Field(i); strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { - continue - } - field := v.Field(i) - sfield := v.Type().Field(i) - - // Oneof field is an interface implemented by wrapper structs containing the actual oneof - // field, i.e. an interface containing &T{real_value}. - if sfield.Tag.Get("protobuf_oneof") != "" { - if field.Kind() != reflect.Interface { - continue - } - v := field.Elem() - if v.Kind() != reflect.Ptr || v.IsNil() { - continue - } - v = v.Elem() - if v.Kind() != reflect.Struct || v.NumField() < 1 { - continue - } - field = v.Field(0) - sfield = v.Type().Field(0) - } - - protoTag := sfield.Tag.Get("protobuf") - if protoTag == "" { - continue - } - var prop proto.Properties - prop.Init(sfield.Type, sfield.Name, protoTag, &sfield) - - switch field.Kind() { - case reflect.Map: - if field.IsNil() { - continue - } - // Check each map value. - keys := field.MapKeys() - for _, k := range keys { - v := field.MapIndex(k) - if err := checkRequiredFieldsInValue(v); err != nil { - return err - } - } - case reflect.Slice: - // Handle non-repeated type, e.g. bytes. - if !prop.Repeated { - if prop.Required && field.IsNil() { - return fmt.Errorf("required field %q is not set", prop.Name) - } - continue - } - - // Handle repeated type. - if field.IsNil() { - continue - } - // Check each slice item. - for i := 0; i < field.Len(); i++ { - v := field.Index(i) - if err := checkRequiredFieldsInValue(v); err != nil { - return err - } - } - case reflect.Ptr: - if field.IsNil() { - if prop.Required { - return fmt.Errorf("required field %q is not set", prop.Name) - } - continue - } - if err := checkRequiredFieldsInValue(field); err != nil { - return err - } - } - } - - // Handle proto2 extensions. - for _, ext := range proto.RegisteredExtensions(pb) { - if !proto.HasExtension(pb, ext) { - continue - } - ep, err := proto.GetExtension(pb, ext) - if err != nil { - return err - } - err = checkRequiredFieldsInValue(reflect.ValueOf(ep)) - if err != nil { - return err - } - } - - return nil -} - -func checkRequiredFieldsInValue(v reflect.Value) error { - if pm, ok := v.Interface().(proto.Message); ok { - return checkRequiredFields(pm) - } - return nil -} - -// isMessageSet determines whether t is a MessageSet message, -// where t must be a named struct type. -func isMessageSet(t reflect.Type) bool { - if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoV2.Message); ok { - md := m.ProtoReflect().Descriptor() - xmd, ok := md.(interface{ IsMessageSet() bool }) - return ok && xmd.IsMessageSet() - } - return false -} diff --git a/jsonpb/jsonpb_test_proto/more_test_objects.proto b/jsonpb/jsonpb_test_proto/more_test_objects.proto deleted file mode 100644 index abe98ef30e..0000000000 --- a/jsonpb/jsonpb_test_proto/more_test_objects.proto +++ /dev/null @@ -1,71 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2015 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. - -syntax = "proto3"; - -option go_package = "github.com/golang/protobuf/jsonpb/jsonpb_test_proto;jsonpb"; - -package jsonpb; - -message Simple3 { - double dub = 1; -} - -message SimpleSlice3 { - repeated string slices = 1; -} - -message SimpleMap3 { - map stringy = 1; -} - -message SimpleNull3 { - Simple3 simple = 1; -} - -enum Numeral { - UNKNOWN = 0; - ARABIC = 1; - ROMAN = 2; -} - -message Mappy { - map nummy = 1; - map strry = 2; - map objjy = 3; - map buggy = 4; - map booly = 5; - map enumy = 6; - map s32booly = 7; - map s64booly = 8; - map u32booly = 9; - map u64booly = 10; -} diff --git a/proto/buffer.go b/proto/buffer.go new file mode 100644 index 0000000000..e61a675773 --- /dev/null +++ b/proto/buffer.go @@ -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" + + "github.com/golang/protobuf/internal/wire" + "google.golang.org/protobuf/encoding/prototext" + "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 wire.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 wire.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 := wire.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 := protoimpl.X.MessageOf(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 = wire.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 = wire.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 = wire.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 = wire.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 = wire.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 = wire.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 := wire.ConsumeVarint(b.buf[b.idx:]) + if n < 0 { + return 0, wire.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 := wire.ConsumeFixed32(b.buf[b.idx:]) + if n < 0 { + return 0, wire.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 := wire.ConsumeFixed64(b.buf[b.idx:]) + if n < 0 { + return 0, wire.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 := wire.ConsumeBytes(b.buf[b.idx:]) + if n < 0 { + return nil, wire.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 := wire.ConsumeString(b.buf[b.idx:]) + if n < 0 { + return "", wire.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 := wire.ConsumeTag(b) + if tagLen < 0 { + return nil, 0, wire.ParseError(tagLen) + } + b = b[tagLen:] + + var valLen int + switch wtyp { + case wire.VarintType: + _, valLen = wire.ConsumeVarint(b) + case wire.Fixed32Type: + _, valLen = wire.ConsumeFixed32(b) + case wire.Fixed64Type: + _, valLen = wire.ConsumeFixed64(b) + case wire.BytesType: + _, valLen = wire.ConsumeBytes(b) + case wire.StartGroupType: + depth++ + case wire.EndGroupType: + depth-- + default: + return nil, 0, errors.New("proto: cannot parse reserved wire type") + } + if valLen < 0 { + return nil, 0, wire.ParseError(valLen) + } + b = b[valLen:] + + if depth == 0 { + return b0[:len(b0)-len(b)-tagLen], len(b0) - len(b), nil + } + } +} diff --git a/proto/clone.go b/proto/clone.go deleted file mode 100644 index c753078df4..0000000000 --- a/proto/clone.go +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright 2011 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. - -// Protocol buffer deep copy and merge. -// TODO: RawMessage. - -package proto - -import ( - "fmt" - "log" - "reflect" - "strings" - - "google.golang.org/protobuf/reflect/protoreflect" -) - -// 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_") || f.PkgPath != "" { - 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()) - if emIn != nil { - mergeExtension(emOut, emIn) - } - } - - uf := unknownFieldsValue(in) - if !uf.IsValid() { - return - } - uin := uf.Bytes() - if len(uin) > 0 { - unknownFieldsValue(out).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 *extensionMap) { - in.Range(func(extNum protoreflect.FieldNumber, eIn Extension) bool { - var eOut Extension - eOut.SetType(eIn.GetType()) - if eIn.HasValue() { - v := reflect.New(reflect.TypeOf(eIn.GetValue())).Elem() - mergeAny(v, reflect.ValueOf(eIn.GetValue()), false, nil) - eOut.SetEagerValue(v.Interface()) - } - - out.Set(extNum, eOut) - return true - }) -} diff --git a/proto/decode.go b/proto/decode.go deleted file mode 100644 index 03db804418..0000000000 --- a/proto/decode.go +++ /dev/null @@ -1,396 +0,0 @@ -// 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 - -/* - * 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") - -// 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 -} diff --git a/proto/defaults.go b/proto/defaults.go new file mode 100644 index 0000000000..1c3a27efbf --- /dev/null +++ b/proto/defaults.go @@ -0,0 +1,64 @@ +// 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" + "google.golang.org/protobuf/runtime/protoimpl" +) + +// 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(protoimpl.X.MessageOf(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 + }) +} diff --git a/proto/deprecated.go b/proto/deprecated.go index 7db76d4a39..b49c629730 100644 --- a/proto/deprecated.go +++ b/proto/deprecated.go @@ -12,7 +12,22 @@ import ( ) // Deprecated: Do not use. -var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") +const ( + ProtoPackageIsVersion1 = true + ProtoPackageIsVersion2 = true + ProtoPackageIsVersion3 = true +) + +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 } @@ -45,29 +60,40 @@ func RegisterMessageSetType(Message, int32, string) {} // Deprecated: Do not use. func EnumName(m map[int32]string, v int32) string { - if s, ok := m[v]; ok { + s, ok := m[v] + if ok { return s } return strconv.Itoa(int(v)) } // Deprecated: Do not use. -func UnmarshalJSONEnum(m map[string]int32, b []byte, enumName string) (int32, error) { - if b[0] == '"' { - var s string - if err := json.Unmarshal(b, &s); err != nil { - return 0, fmt.Errorf("proto: invalid input for enum %v: %s", enumName, b) +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 } - v, ok := m[s] + val, ok := m[repr] if !ok { - return 0, fmt.Errorf("proto: invalid value for enum %v: %s", enumName, b) + return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) } - return v, nil - } else { - var v int32 - if err := json.Unmarshal(b, &v); err != nil { - return 0, fmt.Errorf("proto: invalid input for enum %v: %s", enumName, b) - } - return v, nil + 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") } diff --git a/proto/discard.go b/proto/discard.go index 8e61be3648..7c82e0241f 100644 --- a/proto/discard.go +++ b/proto/discard.go @@ -1,23 +1,14 @@ -// Copyright 2017 The Go Authors. All rights reserved. +// 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" + "google.golang.org/protobuf/runtime/protoimpl" ) -type generatedDiscarder interface { - XXX_DiscardUnknown() -} - // DiscardUnknown recursively discards all unknown fields from this message // and all embedded messages. // @@ -26,310 +17,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 discardUnknownAlt != nil { - discardUnknownAlt(m) // populated by hooks_enabled.go - return - } - - 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 - } - 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 { - em.Range(func(_ protoreflect.FieldNumber, mx Extension) bool { - if m, ok := mx.GetValue().(Message); ok { - DiscardUnknown(m) - } - return true - }) - } - - 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_") || f.PkgPath != "" { - continue - } - - dfi := discardFieldInfo{field: toField(&f, nil)} - 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) - } - } - } - 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)) - } - } - } - } - default: - continue - } - di.fields = append(di.fields, dfi) + if m != nil { + discardUnknown(protoimpl.X.MessageOf(m)) } - - expFunc := exporterFunc(t) - 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, nil) - } - if f, ok := t.FieldByName("unknownFields"); ok { - if f.Type != reflect.TypeOf([]byte{}) { - panic("expected unknownFields to be of type []byte") - } - di.unrecognized = toField(&f, expFunc) - } - - 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_") || f.PkgPath != "" { - continue - } - vf := v.Field(i) - 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("%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)) +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()) } - 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)) - } + // 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.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)) - } - } - } + // 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 + }) } } - } + return true + }) - if vf := unknownFieldsValue(v); vf.IsValid() { - if vf.Type() != reflect.TypeOf([]byte{}) { - panic("expected unknown fields 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 { - em.Range(func(_ protoreflect.FieldNumber, mx Extension) bool { - if m, ok := mx.GetValue().(Message); ok { - discardLegacy(m) - } - return true - }) + // Discard unknown fields. + if len(m.GetUnknown()) > 0 { + m.SetUnknown(nil) } } diff --git a/proto/discard_test.go b/proto/discard_test.go index 1c9dab94cd..bd1cd1d203 100644 --- a/proto/discard_test.go +++ b/proto/discard_test.go @@ -9,8 +9,8 @@ import ( "github.com/golang/protobuf/proto" - proto3pb "github.com/golang/protobuf/proto/proto3_proto" - pb "github.com/golang/protobuf/proto/test_proto" + pb2 "github.com/golang/protobuf/internal/testprotos/proto2_proto" + pb3 "github.com/golang/protobuf/internal/testprotos/proto3_proto" ) const rawFields = "\x2d\xc3\xd2\xe1\xf0" @@ -24,81 +24,81 @@ func TestDiscardUnknown(t *testing.T) { in: nil, want: nil, // Should not panic }, { desc: "NilPtr", - in: (*proto3pb.Message)(nil), want: (*proto3pb.Message)(nil), // Should not panic + in: (*pb3.Message)(nil), want: (*pb3.Message)(nil), // Should not panic }, { desc: "Nested", - in: &proto3pb.Message{ + in: &pb3.Message{ Name: "Aaron", - Nested: &proto3pb.Nested{Cute: true, XXX_unrecognized: []byte(rawFields)}, + Nested: &pb3.Nested{Cute: true, XXX_unrecognized: []byte(rawFields)}, XXX_unrecognized: []byte(rawFields), }, - want: &proto3pb.Message{ + want: &pb3.Message{ Name: "Aaron", - Nested: &proto3pb.Nested{Cute: true}, + Nested: &pb3.Nested{Cute: true}, }, }, { desc: "Slice", - in: &proto3pb.Message{ + in: &pb3.Message{ Name: "Aaron", - Children: []*proto3pb.Message{ + Children: []*pb3.Message{ {Name: "Sarah", XXX_unrecognized: []byte(rawFields)}, {Name: "Abraham", XXX_unrecognized: []byte(rawFields)}, }, XXX_unrecognized: []byte(rawFields), }, - want: &proto3pb.Message{ + want: &pb3.Message{ Name: "Aaron", - Children: []*proto3pb.Message{ + Children: []*pb3.Message{ {Name: "Sarah"}, {Name: "Abraham"}, }, }, }, { desc: "OneOf", - in: &pb.Communique{ - Union: &pb.Communique_Msg{&pb.Strings{ + in: &pb2.Communique{ + Union: &pb2.Communique_Msg{&pb2.Strings{ StringField: proto.String("123"), XXX_unrecognized: []byte(rawFields), }}, XXX_unrecognized: []byte(rawFields), }, - want: &pb.Communique{ - Union: &pb.Communique_Msg{&pb.Strings{StringField: proto.String("123")}}, + want: &pb2.Communique{ + Union: &pb2.Communique_Msg{&pb2.Strings{StringField: proto.String("123")}}, }, }, { desc: "Map", - in: &pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{ - 0x4002: &pb.FloatingPoint{ + in: &pb2.MessageWithMap{MsgMapping: map[int64]*pb2.FloatingPoint{ + 0x4002: &pb2.FloatingPoint{ Exact: proto.Bool(true), XXX_unrecognized: []byte(rawFields), }, }}, - want: &pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{ - 0x4002: &pb.FloatingPoint{Exact: proto.Bool(true)}, + want: &pb2.MessageWithMap{MsgMapping: map[int64]*pb2.FloatingPoint{ + 0x4002: &pb2.FloatingPoint{Exact: proto.Bool(true)}, }}, }, { desc: "Extension", in: func() proto.Message { - m := &pb.MyMessage{ + m := &pb2.MyMessage{ Count: proto.Int32(42), - Somegroup: &pb.MyMessage_SomeGroup{ + Somegroup: &pb2.MyMessage_SomeGroup{ GroupField: proto.Int32(6), XXX_unrecognized: []byte(rawFields), }, XXX_unrecognized: []byte(rawFields), } - proto.SetExtension(m, pb.E_Ext_More, &pb.Ext{ + proto.SetExtension(m, pb2.E_Ext_More, &pb2.Ext{ Data: proto.String("extension"), XXX_unrecognized: []byte(rawFields), }) return m }(), want: func() proto.Message { - m := &pb.MyMessage{ + m := &pb2.MyMessage{ Count: proto.Int32(42), - Somegroup: &pb.MyMessage_SomeGroup{GroupField: proto.Int32(6)}, + Somegroup: &pb2.MyMessage_SomeGroup{GroupField: proto.Int32(6)}, } - proto.SetExtension(m, pb.E_Ext_More, &pb.Ext{Data: proto.String("extension")}) + proto.SetExtension(m, pb2.E_Ext_More, &pb2.Ext{Data: proto.String("extension")}) return m }(), }} diff --git a/proto/encode.go b/proto/encode.go deleted file mode 100644 index 2d7135354e..0000000000 --- a/proto/encode.go +++ /dev/null @@ -1,176 +0,0 @@ -// 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 - -/* - * 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 -} diff --git a/proto/equal.go b/proto/equal.go deleted file mode 100644 index b2a69e15ed..0000000000 --- a/proto/equal.go +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright 2011 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. - -// Protocol buffer comparison. - -package proto - -import ( - "bytes" - "log" - "reflect" - "strings" - - "google.golang.org/protobuf/reflect/protoreflect" -) - -/* -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_") || f.PkgPath != "" { - 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 := extensionFieldsValue(v1); em1.IsValid() { - em2 := extensionFieldsValue(v2) - m1 := extensionFieldsOf(em1.Addr().Interface()) - m2 := extensionFieldsOf(em2.Addr().Interface()) - if !equalExtensions(v1.Type(), m1, m2) { - return false - } - } - - if uf := unknownFieldsValue(v1); uf.IsValid() { - u1 := uf.Bytes() - u2 := unknownFieldsValue(v2).Bytes() - if !bytes.Equal(u1, u2) { - return false - } - } - - return true -} - -// 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 -} - -func equalExtensions(base reflect.Type, em1, em2 *extensionMap) bool { - if em1.Len() != em2.Len() { - return false - } - - equal := true - em1.Range(func(extNum protoreflect.FieldNumber, e1 Extension) bool { - if !em2.Has(extNum) { - equal = false - return false - } - e2 := em2.Get(extNum) - - m1 := extensionAsLegacyType(e1.GetValue()) - m2 := extensionAsLegacyType(e2.GetValue()) - - if m1 == nil && m2 == nil { - return true - } - - if m1 != nil && m2 != nil { - // Both are unencoded. - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - equal = false - return false - } - return true - } - - equal = false - return false - }) - - return equal -} diff --git a/proto/equal_test.go b/proto/equal_test.go deleted file mode 100644 index 6f94c39bac..0000000000 --- a/proto/equal_test.go +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright 2011 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_test - -import ( - "testing" - - . "github.com/golang/protobuf/proto" - proto3pb "github.com/golang/protobuf/proto/proto3_proto" - pb "github.com/golang/protobuf/proto/test_proto" -) - -// Four identical base messages. -// The init function adds extensions to some of them. -var messageWithoutExtension = &pb.MyMessage{Count: Int32(7)} -var messageWithExtension1a = &pb.MyMessage{Count: Int32(7)} -var messageWithExtension1b = &pb.MyMessage{Count: Int32(7)} -var messageWithExtension2 = &pb.MyMessage{Count: Int32(7)} -var messageWithExtension3a = &pb.MyMessage{Count: Int32(7)} -var messageWithExtension3b = &pb.MyMessage{Count: Int32(7)} -var messageWithExtension3c = &pb.MyMessage{Count: Int32(7)} - -// Two messages with non-message extensions. -var messageWithInt32Extension1 = &pb.MyMessage{Count: Int32(8)} -var messageWithInt32Extension2 = &pb.MyMessage{Count: Int32(8)} - -func init() { - ext1 := &pb.Ext{Data: String("Kirk")} - ext2 := &pb.Ext{Data: String("Picard")} - - // messageWithExtension1a has ext1, but never marshals it. - if err := SetExtension(messageWithExtension1a, pb.E_Ext_More, ext1); err != nil { - panic("SetExtension on 1a failed: " + err.Error()) - } - - // messageWithExtension1b is the unmarshaled form of messageWithExtension1a. - if err := SetExtension(messageWithExtension1b, pb.E_Ext_More, ext1); err != nil { - panic("SetExtension on 1b failed: " + err.Error()) - } - buf, err := Marshal(messageWithExtension1b) - if err != nil { - panic("Marshal of 1b failed: " + err.Error()) - } - messageWithExtension1b.Reset() - if err := Unmarshal(buf, messageWithExtension1b); err != nil { - panic("Unmarshal of 1b failed: " + err.Error()) - } - - // messageWithExtension2 has ext2. - if err := SetExtension(messageWithExtension2, pb.E_Ext_More, ext2); err != nil { - panic("SetExtension on 2 failed: " + err.Error()) - } - - if err := SetExtension(messageWithInt32Extension1, pb.E_Ext_Number, Int32(23)); err != nil { - panic("SetExtension on Int32-1 failed: " + err.Error()) - } - if err := SetExtension(messageWithInt32Extension1, pb.E_Ext_Number, Int32(24)); err != nil { - panic("SetExtension on Int32-2 failed: " + err.Error()) - } - - // messageWithExtension3{a,b,c} has unregistered extension. - if RegisteredExtensions(messageWithExtension3a)[200] != nil { - panic("expect extension 200 unregistered") - } - bytes := []byte{ - 0xc0, 0x0c, 0x01, // id=200, wiretype=0 (varint), data=1 - } - bytes2 := []byte{ - 0xc0, 0x0c, 0x02, // id=200, wiretype=0 (varint), data=2 - } - SetRawExtension(messageWithExtension3a, 200, bytes) - SetRawExtension(messageWithExtension3b, 200, bytes) - SetRawExtension(messageWithExtension3c, 200, bytes2) -} - -var EqualTests = []struct { - desc string - a, b Message - exp bool -}{ - {"different types", &pb.GoEnum{}, &pb.GoTestField{}, false}, - {"equal empty", &pb.GoEnum{}, &pb.GoEnum{}, true}, - {"nil vs nil", nil, nil, true}, - {"typed nil vs typed nil", (*pb.GoEnum)(nil), (*pb.GoEnum)(nil), true}, - {"typed nil vs empty", (*pb.GoEnum)(nil), &pb.GoEnum{}, false}, - {"different typed nil", (*pb.GoEnum)(nil), (*pb.GoTestField)(nil), false}, - - {"one set field, one unset field", &pb.GoTestField{Label: String("foo")}, &pb.GoTestField{}, false}, - {"one set field zero, one unset field", &pb.GoTest{Param: Int32(0)}, &pb.GoTest{}, false}, - {"different set fields", &pb.GoTestField{Label: String("foo")}, &pb.GoTestField{Label: String("bar")}, false}, - {"equal set", &pb.GoTestField{Label: String("foo")}, &pb.GoTestField{Label: String("foo")}, true}, - - {"repeated, one set", &pb.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb.GoTest{}, false}, - {"repeated, different length", &pb.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb.GoTest{F_Int32Repeated: []int32{2}}, false}, - {"repeated, different value", &pb.GoTest{F_Int32Repeated: []int32{2}}, &pb.GoTest{F_Int32Repeated: []int32{3}}, false}, - {"repeated, equal", &pb.GoTest{F_Int32Repeated: []int32{2, 4}}, &pb.GoTest{F_Int32Repeated: []int32{2, 4}}, true}, - {"repeated, nil equal nil", &pb.GoTest{F_Int32Repeated: nil}, &pb.GoTest{F_Int32Repeated: nil}, true}, - {"repeated, nil equal empty", &pb.GoTest{F_Int32Repeated: nil}, &pb.GoTest{F_Int32Repeated: []int32{}}, true}, - {"repeated, empty equal nil", &pb.GoTest{F_Int32Repeated: []int32{}}, &pb.GoTest{F_Int32Repeated: nil}, true}, - - { - "nested, different", - &pb.GoTest{RequiredField: &pb.GoTestField{Label: String("foo")}}, - &pb.GoTest{RequiredField: &pb.GoTestField{Label: String("bar")}}, - false, - }, - { - "nested, equal", - &pb.GoTest{RequiredField: &pb.GoTestField{Label: String("wow")}}, - &pb.GoTest{RequiredField: &pb.GoTestField{Label: String("wow")}}, - true, - }, - - {"bytes", &pb.OtherMessage{Value: []byte("foo")}, &pb.OtherMessage{Value: []byte("foo")}, true}, - {"bytes, empty", &pb.OtherMessage{Value: []byte{}}, &pb.OtherMessage{Value: []byte{}}, true}, - {"bytes, empty vs nil", &pb.OtherMessage{Value: []byte{}}, &pb.OtherMessage{Value: nil}, false}, - { - "repeated bytes", - &pb.MyMessage{RepBytes: [][]byte{[]byte("sham"), []byte("wow")}}, - &pb.MyMessage{RepBytes: [][]byte{[]byte("sham"), []byte("wow")}}, - true, - }, - // In proto3, []byte{} and []byte(nil) are equal. - {"proto3 bytes, empty vs nil", &proto3pb.Message{Data: []byte{}}, &proto3pb.Message{Data: nil}, true}, - - {"extension vs. no extension", messageWithoutExtension, messageWithExtension1a, false}, - {"extension vs. same extension", messageWithExtension1a, messageWithExtension1b, true}, - {"extension vs. different extension", messageWithExtension1a, messageWithExtension2, false}, - - {"int32 extension vs. itself", messageWithInt32Extension1, messageWithInt32Extension1, true}, - {"int32 extension vs. a different int32", messageWithInt32Extension1, messageWithInt32Extension2, false}, - - {"unregistered extension same", messageWithExtension3a, messageWithExtension3b, true}, - {"unregistered extension different", messageWithExtension3a, messageWithExtension3c, false}, - - { - "message with group", - &pb.MyMessage{ - Count: Int32(1), - Somegroup: &pb.MyMessage_SomeGroup{ - GroupField: Int32(5), - }, - }, - &pb.MyMessage{ - Count: Int32(1), - Somegroup: &pb.MyMessage_SomeGroup{ - GroupField: Int32(5), - }, - }, - true, - }, - - { - "map same", - &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}}, - &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}}, - true, - }, - { - "map different entry", - &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}}, - &pb.MessageWithMap{NameMapping: map[int32]string{2: "Rob"}}, - false, - }, - { - "map different key only", - &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}}, - &pb.MessageWithMap{NameMapping: map[int32]string{2: "Ken"}}, - false, - }, - { - "map different value only", - &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}}, - &pb.MessageWithMap{NameMapping: map[int32]string{1: "Rob"}}, - false, - }, - { - "zero-length maps same", - &pb.MessageWithMap{NameMapping: map[int32]string{}}, - &pb.MessageWithMap{NameMapping: nil}, - true, - }, - { - "orders in map don't matter", - &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken", 2: "Rob"}}, - &pb.MessageWithMap{NameMapping: map[int32]string{2: "Rob", 1: "Ken"}}, - true, - }, - { - "oneof same", - &pb.Communique{Union: &pb.Communique_Number{41}}, - &pb.Communique{Union: &pb.Communique_Number{41}}, - true, - }, - { - "oneof one nil", - &pb.Communique{Union: &pb.Communique_Number{41}}, - &pb.Communique{}, - false, - }, - { - "oneof different", - &pb.Communique{Union: &pb.Communique_Number{41}}, - &pb.Communique{Union: &pb.Communique_Name{"Bobby Tables"}}, - false, - }, -} - -func TestEqual(t *testing.T) { - for _, tc := range EqualTests { - if res := Equal(tc.a, tc.b); res != tc.exp { - t.Errorf("%v: Equal(%v, %v) = %v, want %v", tc.desc, tc.a, tc.b, res, tc.exp) - } - } -} diff --git a/proto/extensions.go b/proto/extensions.go index 91709b0ced..53abf45c0d 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -4,227 +4,108 @@ package proto -/* - * Types and routines for supporting protocol buffer extensions. - */ - import ( "errors" "fmt" - "io" "reflect" - "sync" "github.com/golang/protobuf/internal/wire" + "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" ) -// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. -var ErrMissingExtension = errors.New("proto: missing extension") +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 extensionFieldsOf(p interface{}) *extensionMap { - if p, ok := p.(*map[int32]Extension); ok { - return (*extensionMap)(p) - } - panic(fmt.Sprintf("invalid extension fields type: %T", p)) -} + // ExtensionRange represents a range of message extensions. + // Used in code generated by protoc-gen-go. + ExtensionRange = protoiface.ExtensionRangeV1 -type extensionMap map[int32]Extension + // Deprecated: Do not use; this is an internal type. + Extension = protoimpl.ExtensionFieldV1 -func (m extensionMap) Len() int { - return len(m) -} -func (m extensionMap) Has(n protoreflect.FieldNumber) bool { - _, ok := m[int32(n)] - return ok -} -func (m extensionMap) Get(n protoreflect.FieldNumber) Extension { - return m[int32(n)] -} -func (m *extensionMap) Set(n protoreflect.FieldNumber, x Extension) { - if *m == nil { - *m = make(map[int32]Extension) - } - (*m)[int32(n)] = x -} -func (m *extensionMap) Clear(n protoreflect.FieldNumber) { - delete(*m, int32(n)) -} -func (m extensionMap) Range(f func(protoreflect.FieldNumber, Extension) bool) { - for n, x := range m { - if !f(protoreflect.FieldNumber(n), x) { - return - } - } -} - -func extendable(p interface{}) (*extensionMap, error) { - type extendableProto interface { - Message - ExtensionRangeArray() []ExtensionRange - } - if _, ok := p.(extendableProto); ok { - v := reflect.ValueOf(p) - if v.Kind() == reflect.Ptr && !v.IsNil() { - v = v.Elem() - if vf := extensionFieldsValue(v); vf.IsValid() { - return extensionFieldsOf(vf.Addr().Interface()), nil - } - } - } - // Don't allocate a specific error containing %T: - // this is the hot path for Clone and MarshalText. - return nil, errNotExtendable -} - -var errNotExtendable = errors.New("proto: not an extendable proto.Message") - -type ( - ExtensionRange = protoiface.ExtensionRangeV1 - ExtensionDesc = protoimpl.ExtensionInfo - Extension = protoimpl.ExtensionFieldV1 + // Deprecated: Do not use; this is an internal type. XXX_InternalExtensions = protoimpl.ExtensionFields ) -func isRepeatedExtension(ed *ExtensionDesc) bool { - t := reflect.TypeOf(ed.ExtensionType) - return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 -} - -// SetRawExtension is for testing only. -func SetRawExtension(base Message, id int32, b []byte) { - v := reflect.ValueOf(base) - if !v.IsValid() || v.Kind() != reflect.Ptr || v.IsNil() || v.Elem().Kind() != reflect.Struct { - return - } - v = unknownFieldsValue(v.Elem()) - if !v.IsValid() { - return - } - - // Verify that the raw field is valid. - for b0 := b; len(b0) > 0; { - fieldNum, _, n := wire.ConsumeField(b0) - if int32(fieldNum) != id { - panic(fmt.Sprintf("mismatching field number: got %d, want %d", fieldNum, id)) - } - b0 = b0[n:] - } - - fnum := protoreflect.FieldNumber(id) - v.SetBytes(append(removeRawFields(v.Bytes(), fnum), b...)) -} - -func removeRawFields(b []byte, fnum protoreflect.FieldNumber) []byte { - out := b[:0] - for len(b) > 0 { - got, _, n := wire.ConsumeField(b) - if got != fnum { - out = append(out, b[:n]...) - } - b = b[n:] - } - return out -} +// ErrMissingExtension reports whether the extension was not present. +var ErrMissingExtension = errors.New("proto: missing extension") -// isExtensionField returns true iff the given field number is in an extension range. -func isExtensionField(pb Message, field int32) bool { - m, ok := pb.(interface{ ExtensionRangeArray() []ExtensionRange }) - if ok { - for _, er := range m.ExtensionRangeArray() { - if er.Start <= field && field <= er.End { - return true - } - } - } - return false -} +var errNotExtendable = errors.New("proto: not an extendable proto.Message") -// checkExtensionTypeAndRanges checks that the given extension is valid for pb. -func checkExtensionTypeAndRanges(pb Message, extension *ExtensionDesc) error { - // Check the extended type. - if extension.ExtendedType != nil { - if a, b := reflect.TypeOf(pb), 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") +// 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 := protoimpl.X.MessageOf(m) + if mr == nil || !mr.IsValid() { + return false } - 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(pb Message, ed *ExtensionDesc) *Properties { - key := extPropKey{base: reflect.TypeOf(pb), field: ed.Field} - - extProp.RLock() - if prop, ok := extProp.m[key]; ok { - extProp.RUnlock() - return prop + // 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 + }) } - extProp.RUnlock() - extProp.Lock() - defer extProp.Unlock() - // Check again. - if prop, ok := extProp.m[key]; ok { - return prop + // Check whether any unknown field matches the field number. + for b := mr.GetUnknown(); !has && len(b) > 0; { + num, _, n := wire.ConsumeField(b) + has = int32(num) == xt.Field + b = b[n:] } - - prop := new(Properties) - prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil) - extProp.m[key] = prop - return prop + return has } -// 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 || epb == nil { - return false - } - if epb.Has(protoreflect.FieldNumber(extension.Field)) { - return true +// 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 := protoimpl.X.MessageOf(m) + if mr == nil || !mr.IsValid() { + return } - // Check whether this field exists in raw form. - unrecognized := unknownFieldsValue(reflect.ValueOf(pb).Elem()) - fnum := protoreflect.FieldNumber(extension.Field) - for b := unrecognized.Bytes(); len(b) > 0; { - got, _, n := wire.ConsumeField(b) - if got == fnum { + 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 - } - b = b[n:] + }) } - return false + 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 := protoimpl.X.MessageOf(m) + if mr == nil || !mr.IsValid() { return } - // TODO: Check types, field numbers, etc.? - epb.Clear(protoreflect.FieldNumber(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. @@ -234,276 +115,240 @@ 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 - } - - // can only check type if this is a complete descriptor - if err := checkExtensionTypeAndRanges(pb, extension); err != nil { - return nil, err - } - - unrecognized := unknownFieldsValue(reflect.ValueOf(pb).Elem()) - var out []byte - fnum := protoreflect.FieldNumber(extension.Field) - for b := unrecognized.Bytes(); len(b) > 0; { - got, _, n := wire.ConsumeField(b) - if got == fnum { - out = append(out, b[:n]...) +// 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 := protoimpl.X.MessageOf(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 := wire.ConsumeField(bi) + if int32(num) == xt.Field { + bo = append(bo, bi[:n]...) } - b = b[n:] + bi = bi[n:] } - if !epb.Has(protoreflect.FieldNumber(extension.Field)) && len(out) == 0 { - // defaultExtensionValue returns the default value or - // ErrMissingExtension if there is no default. - return defaultExtensionValue(pb, extension) + // For type incomplete descriptors, only retrieve the unknown fields. + if xt.ExtensionType == nil { + return []byte(bo), nil } - e := epb.Get(protoreflect.FieldNumber(extension.Field)) - if e.HasValue() { - // Already decoded. Check the descriptor, though. - if protoimpl.X.ExtensionDescFromType(e.GetType()) != 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") + // If the extension field only exists as unknown fields, unmarshal it. + // This is rarely done since proto.Unmarshal eagerly unmarshals extensions. + xtd := xt.TypeDescriptor() + if !isValidExtension(mr.Descriptor(), xtd) { + return nil, fmt.Errorf("proto: bad extended type; %T does not extend %T", xt.ExtendedType, m) + } + if !mr.Has(xtd) && len(bo) > 0 { + m2 := mr.New() + if err := (proto.UnmarshalOptions{ + Resolver: extensionResolver{xt}, + }.Unmarshal(bo, m2.Interface())); err != nil { + return nil, err + } + if m2.Has(xtd) { + mr.Set(xtd, m2.Get(xtd)) + clearUnknown(mr, fieldNum(xt.Field)) } - return extensionAsLegacyType(e.GetValue()), nil } - // Descriptor without type information. - if extension.ExtensionType == nil { - return out, nil + // Check whether the message has the extension field set or a default. + var pv protoreflect.Value + switch { + case mr.Has(xtd): + pv = mr.Get(xtd) + case xtd.HasDefault(): + pv = xtd.Default() + default: + return nil, ErrMissingExtension } - // TODO: Remove this logic for automatically unmarshaling the unknown fields. - v, err := decodeExtension(out, extension) - if err != nil { - return nil, err + v := xt.InterfaceOf(pv) + rv := reflect.ValueOf(v) + if isScalarKind(rv.Kind()) { + rv2 := reflect.New(rv.Type()) + rv2.Elem().Set(rv) + v = rv2.Interface() } - - // Remember the decoded version and drop the encoded version. - // That way it is safe to mutate what we return. - e.SetType(extension) - e.SetEagerValue(extensionAsStorageType(v)) - unrecognized.SetBytes(removeRawFields(unrecognized.Bytes(), fnum)) - epb.Set(protoreflect.FieldNumber(extension.Field), e) - return extensionAsLegacyType(e.GetValue()), nil + return v, nil } -// defaultExtensionValue returns the default value for extension. -// If no default for an extension is defined ErrMissingExtension is returned. -func defaultExtensionValue(pb Message, extension *ExtensionDesc) (interface{}, error) { - if extension.ExtensionType == nil { - // incomplete descriptor, so no default - return nil, ErrMissingExtension - } +// extensionResolver is a custom extension resolver that stores a single +// extension type that takes precedence over the global registry. +type extensionResolver struct{ xt protoreflect.ExtensionType } - t := reflect.TypeOf(extension.ExtensionType) - props := extensionProperties(pb, extension) - - sf, _, err := fieldDefault(t, props) - if err != nil { - return nil, err +func (r extensionResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { + if xtd := r.xt.TypeDescriptor(); xtd.FullName() == field { + return r.xt, nil } + return protoregistry.GlobalTypes.FindExtensionByName(field) +} - if sf == nil || sf.value == nil { - // There is no default value. - return nil, ErrMissingExtension +func (r extensionResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { + if xtd := r.xt.TypeDescriptor(); xtd.ContainingMessage().FullName() == message && xtd.Number() == field { + return r.xt, nil } + return protoregistry.GlobalTypes.FindExtensionByNumber(message, field) +} - if t.Kind() != reflect.Ptr { - // We do not need to return a Ptr, we can directly return sf.value. - return sf.value, nil +// GetExtensions returns a list of the extensions values present in m, +// corresponding with the provided list of extension descriptors, xts. +// If an extension is missing in m, the corresponding value is nil. +func GetExtensions(m Message, xts []*ExtensionDesc) ([]interface{}, error) { + mr := protoimpl.X.MessageOf(m) + if mr == nil || !mr.IsValid() { + return nil, errNotExtendable } - // We need to return an interface{} that is a pointer to sf.value. - value := reflect.New(t).Elem() - value.Set(reflect.New(value.Type().Elem())) - if sf.kind == reflect.Int32 { - // We may have an int32 or an enum, but the underlying data is int32. - // Since we can't set an int32 into a non int32 reflect.Value directly - // set it as a int32. - value.Elem().SetInt(int64(sf.value.(int32))) - } else { - value.Elem().Set(reflect.ValueOf(sf.value)) + vs := make([]interface{}, len(xts)) + for i, xt := range xts { + v, err := GetExtension(m, xt) + if err != nil { + if err == ErrMissingExtension { + continue + } + return vs, err + } + vs[i] = v } - return value.Interface(), nil + return vs, nil } -// decodeExtension decodes an extension encoded in b. -func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { - t := reflect.TypeOf(extension.ExtensionType) - unmarshal := typeUnmarshaler(t, extension.Tag) - - // t is a pointer to a struct, pointer to basic type or a slice. - // Allocate space to store the pointer/slice. - value := reflect.New(t).Elem() +// SetExtension sets an extension field in m to the provided value. +func SetExtension(m Message, xt *ExtensionDesc, v interface{}) error { + mr := protoimpl.X.MessageOf(m) + if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { + return errNotExtendable + } - var err error - for { - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF + rv := reflect.ValueOf(v) + if reflect.TypeOf(v) != reflect.TypeOf(xt.ExtensionType) { + return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", v, xt.ExtensionType) + } + if rv.Kind() == reflect.Ptr { + if rv.IsNil() { + return fmt.Errorf("proto: SetExtension called with nil value of type %T", v) } - b = b[n:] - wire := int(x) & 7 - - b, err = unmarshal(b, valToPointer(value.Addr()), wire) - if err != nil { - return nil, err + if isScalarKind(rv.Elem().Kind()) { + v = rv.Elem().Interface() } + } - if len(b) == 0 { - break - } + xtd := xt.TypeDescriptor() + if !isValidExtension(mr.Descriptor(), xtd) { + return fmt.Errorf("proto: bad extended type; %T does not extend %T", xt.ExtendedType, m) } - return value.Interface(), nil + mr.Set(xtd, xt.ValueOf(v)) + clearUnknown(mr, fieldNum(xt.Field)) + return nil } -// GetExtensions returns a slice of the extensions present in pb that are also listed in es. -// The returned slice has the same length as es; missing extensions will appear as nil elements. -func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { - _, err = extendable(pb) - if err != nil { - return nil, err +// SetRawExtension inserts b into the unknown fields of m. +// +// Deprecated: Use Message.ProtoReflect.SetUnknown instead. +func SetRawExtension(m Message, fnum int32, b []byte) { + mr := protoimpl.X.MessageOf(m) + if mr == nil || !mr.IsValid() { + return } - extensions = make([]interface{}, len(es)) - for i, e := range es { - extensions[i], err = GetExtension(pb, e) - if err == ErrMissingExtension { - err = nil - } - if err != nil { - return + + // Verify that the raw field is valid. + for b0 := b; len(b0) > 0; { + num, _, n := wire.ConsumeField(b0) + if int32(num) != fnum { + panic(fmt.Sprintf("mismatching field number: got %d, want %d", num, fnum)) } + b0 = b0[n:] } - return -} -// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order. -// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing -// just the Field field, which defines the extension's field number. -func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { - epb, err := extendable(pb) - if err != nil { - return nil, err - } - registeredExtensions := RegisteredExtensions(pb) + ClearExtension(m, &ExtensionDesc{Field: fnum}) + mr.SetUnknown(append(mr.GetUnknown(), b...)) +} - if epb == nil { - return nil, nil - } - extensions := make([]*ExtensionDesc, 0, epb.Len()) - epb.Range(func(extid protoreflect.FieldNumber, e Extension) bool { - desc := protoimpl.X.ExtensionDescFromType(e.GetType()) - if desc == nil { - desc = registeredExtensions[int32(extid)] - if desc == nil { - desc = &ExtensionDesc{Field: int32(extid)} - } +// ExtensionDescs returns a list of extension descriptors found in m, +// containing descriptors for both populated extension fields in m and +// also unknown fields of m that are in the extension range. +// For the later case, an type incomplete descriptor is provided where only +// the ExtensionDesc.Field field is populated. +// The order of the extension descriptors is undefined. +func ExtensionDescs(m Message) ([]*ExtensionDesc, error) { + mr := protoimpl.X.MessageOf(m) + if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { + return nil, errNotExtendable + } + + // Collect a set of known extension descriptors. + extDescs := make(map[protoreflect.FieldNumber]*ExtensionDesc) + mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { + if fd.IsExtension() { + xts := fd.(protoreflect.ExtensionTypeDescriptor) + extDescs[fd.Number()] = protoimpl.X.ExtensionDescFromType(xts.Type()) } - - extensions = append(extensions, desc) return true }) - unrecognized := unknownFieldsValue(reflect.ValueOf(pb).Elem()) - if b := unrecognized.Bytes(); len(b) > 0 { - fieldNums := make(map[int32]bool) - for len(b) > 0 { - fnum, _, n := wire.ConsumeField(b) - if isExtensionField(pb, int32(fnum)) { - fieldNums[int32(fnum)] = true - } - b = b[n:] - } - - for id := range fieldNums { - desc := registeredExtensions[id] - if desc == nil { - desc = &ExtensionDesc{Field: id} - } - extensions = append(extensions, desc) + // Collect a set of unknown extension descriptors. + extRanges := mr.Descriptor().ExtensionRanges() + for b := mr.GetUnknown(); len(b) > 0; { + num, _, n := wire.ConsumeField(b) + if extRanges.Has(num) && extDescs[num] == nil { + extDescs[num] = nil } + b = b[n:] } - return extensions, nil -} - -// SetExtension sets the specified extension of pb to the specified value. -func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { - epb, err := extendable(pb) - if err != nil { - return err - } - if err := checkExtensionTypeAndRanges(pb, extension); err != nil { - return err - } - typ := reflect.TypeOf(extension.ExtensionType) - if typ != reflect.TypeOf(value) { - return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", value, extension.ExtensionType) - } - // nil extension values need to be caught early, because the - // encoder can't distinguish an ErrNil due to a nil extension - // from an ErrNil due to a missing field. Extensions are - // always optional, so the encoder would just swallow the error - // and drop all the extensions from the encoded message. - if reflect.ValueOf(value).IsNil() { - return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) + // Transpose the set of descriptors into a list. + var xts []*ExtensionDesc + for num, xt := range extDescs { + if xt == nil { + xt = &ExtensionDesc{Field: int32(num)} + } + xts = append(xts, xt) } - - var x Extension - x.SetType(extension) - x.SetEagerValue(extensionAsStorageType(value)) - epb.Set(protoreflect.FieldNumber(extension.Field), x) - return nil + return xts, nil } -// ClearAllExtensions clears all extensions from pb. -func ClearAllExtensions(pb Message) { - epb, err := extendable(pb) - if err != nil { - return - } - epb.Range(func(k protoreflect.FieldNumber, _ Extension) bool { - epb.Clear(k) - return true - }) +// isValidExtension reports whether xtd is a valid extension descriptor for md. +func isValidExtension(md protoreflect.MessageDescriptor, xtd protoreflect.ExtensionTypeDescriptor) bool { + return xtd.ContainingMessage() == md && md.ExtensionRanges().Has(xtd.Number()) } -// extensionAsLegacyType converts an value in the storage type as the API type. -// See Extension.Value. -func extensionAsLegacyType(v interface{}) interface{} { - switch rv := reflect.ValueOf(v); rv.Kind() { +// isScalarKind reports whether k is a protobuf scalar kind (except bytes). +// This function exists for historical reasons since the representation of +// scalars differs between v1 and v2, where v1 uses *T and v2 uses T. +func isScalarKind(k reflect.Kind) bool { + switch k { case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: - // Represent primitive types as a pointer to the value. - rv2 := reflect.New(rv.Type()) - rv2.Elem().Set(rv) - v = rv2.Interface() + return true + default: + return false } - return v } -// extensionAsStorageType converts an value in the API type as the storage type. -// See Extension.Value. -func extensionAsStorageType(v interface{}) interface{} { - switch rv := reflect.ValueOf(v); rv.Kind() { - case reflect.Ptr: - // Represent non-slice types as the value itself. - switch rv.Type().Elem().Kind() { - case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: - if rv.IsNil() { - v = reflect.Zero(rv.Type().Elem()).Interface() - } else { - v = rv.Elem().Interface() - } +// clearUnknown removes unknown fields from m where remover.Has reports true. +func clearUnknown(m protoreflect.Message, remover interface { + Has(protoreflect.FieldNumber) bool +}) { + var bo protoreflect.RawFields + for bi := m.GetUnknown(); len(bi) > 0; { + num, _, n := wire.ConsumeField(bi) + if !remover.Has(num) { + bo = append(bo, bi[:n]...) } + bi = bi[n:] } - return v + if bi := m.GetUnknown(); len(bi) != len(bo) { + m.SetUnknown(bo) + } +} + +type fieldNum protoreflect.FieldNumber + +func (n1 fieldNum) Has(n2 protoreflect.FieldNumber) bool { + return protoreflect.FieldNumber(n1) == n2 } diff --git a/proto/extensions_test.go b/proto/extensions_test.go index e06812a0f1..5978159421 100644 --- a/proto/extensions_test.go +++ b/proto/extensions_test.go @@ -14,18 +14,19 @@ import ( "testing" "github.com/golang/protobuf/proto" - pb "github.com/golang/protobuf/proto/test_proto" + + pb2 "github.com/golang/protobuf/internal/testprotos/proto2_proto" ) func TestGetExtensionsWithMissingExtensions(t *testing.T) { - msg := &pb.MyMessage{} - ext1 := &pb.Ext{} - if err := proto.SetExtension(msg, pb.E_Ext_More, ext1); err != nil { + msg := &pb2.MyMessage{} + ext1 := &pb2.Ext{} + if err := proto.SetExtension(msg, pb2.E_Ext_More, ext1); err != nil { t.Fatalf("Could not set ext1: %s", err) } exts, err := proto.GetExtensions(msg, []*proto.ExtensionDesc{ - pb.E_Ext_More, - pb.E_Ext_Text, + pb2.E_Ext_More, + pb2.E_Ext_Text, }) if err != nil { t.Fatalf("GetExtensions() failed: %s", err) @@ -39,9 +40,9 @@ func TestGetExtensionsWithMissingExtensions(t *testing.T) { } func TestGetExtensionForIncompleteDesc(t *testing.T) { - msg := &pb.MyMessage{Count: proto.Int32(0)} + msg := &pb2.MyMessage{Count: proto.Int32(0)} extdesc1 := &proto.ExtensionDesc{ - ExtendedType: (*pb.MyMessage)(nil), + ExtendedType: (*pb2.MyMessage)(nil), ExtensionType: (*bool)(nil), Field: 123456789, Name: "a.b", @@ -52,7 +53,7 @@ func TestGetExtensionForIncompleteDesc(t *testing.T) { t.Fatalf("Could not set ext1: %s", err) } extdesc2 := &proto.ExtensionDesc{ - ExtendedType: (*pb.MyMessage)(nil), + ExtendedType: (*pb2.MyMessage)(nil), ExtensionType: ([]byte)(nil), Field: 123456790, Name: "a.c", @@ -63,13 +64,13 @@ func TestGetExtensionForIncompleteDesc(t *testing.T) { t.Fatalf("Could not set ext2: %s", err) } extdesc3 := &proto.ExtensionDesc{ - ExtendedType: (*pb.MyMessage)(nil), - ExtensionType: (*pb.Ext)(nil), + ExtendedType: (*pb2.MyMessage)(nil), + ExtensionType: (*pb2.Ext)(nil), Field: 123456791, Name: "a.d", Tag: "bytes,123456791,opt", } - ext3 := &pb.Ext{Data: proto.String("foo")} + ext3 := &pb2.Ext{Data: proto.String("foo")} if err := proto.SetExtension(msg, extdesc3, ext3); err != nil { t.Fatalf("Could not set ext3: %s", err) } @@ -128,18 +129,18 @@ func TestGetExtensionForIncompleteDesc(t *testing.T) { } func TestExtensionDescsWithUnregisteredExtensions(t *testing.T) { - msg := &pb.MyMessage{Count: proto.Int32(0)} - extdesc1 := pb.E_Ext_More + msg := &pb2.MyMessage{Count: proto.Int32(0)} + extdesc1 := pb2.E_Ext_More if descs, err := proto.ExtensionDescs(msg); len(descs) != 0 || err != nil { t.Errorf("proto.ExtensionDescs: got %d descs, error %v; want 0, nil", len(descs), err) } - ext1 := &pb.Ext{} + ext1 := &pb2.Ext{} if err := proto.SetExtension(msg, extdesc1, ext1); err != nil { t.Fatalf("Could not set ext1: %s", err) } extdesc2 := &proto.ExtensionDesc{ - ExtendedType: (*pb.MyMessage)(nil), + ExtendedType: (*pb2.MyMessage)(nil), ExtensionType: (*bool)(nil), Field: 123456789, Name: "a.b", @@ -180,20 +181,20 @@ func sortExtDescs(s []*proto.ExtensionDesc) { } func TestGetExtensionStability(t *testing.T) { - check := func(m *pb.MyMessage) bool { - ext1, err := proto.GetExtension(m, pb.E_Ext_More) + check := func(m *pb2.MyMessage) bool { + ext1, err := proto.GetExtension(m, pb2.E_Ext_More) if err != nil { t.Fatalf("GetExtension() failed: %s", err) } - ext2, err := proto.GetExtension(m, pb.E_Ext_More) + ext2, err := proto.GetExtension(m, pb2.E_Ext_More) if err != nil { t.Fatalf("GetExtension() failed: %s", err) } return ext1 == ext2 } - msg := &pb.MyMessage{Count: proto.Int32(4)} - ext0 := &pb.Ext{} - if err := proto.SetExtension(msg, pb.E_Ext_More, ext0); err != nil { + msg := &pb2.MyMessage{Count: proto.Int32(4)} + ext0 := &pb2.Ext{} + if err := proto.SetExtension(msg, pb2.E_Ext_More, ext0); err != nil { t.Fatalf("Could not set ext1: %s", ext0) } if !check(msg) { @@ -203,7 +204,7 @@ func TestGetExtensionStability(t *testing.T) { if err != nil { t.Fatalf("Marshal() failed: %s", err) } - msg1 := &pb.MyMessage{} + msg1 := &pb2.MyMessage{} err = proto.Unmarshal(bb, msg1) if err != nil { t.Fatalf("Unmarshal() failed: %s", err) @@ -224,7 +225,7 @@ func TestGetExtensionDefaults(t *testing.T) { var setBool2 = false var setString = "Goodnight string" var setBytes = []byte("Goodnight bytes") - var setEnum = pb.DefaultsMessage_TWO + var setEnum = pb2.DefaultsMessage_TWO type testcase struct { ext *proto.ExtensionDesc // Extension we are testing. @@ -232,43 +233,43 @@ func TestGetExtensionDefaults(t *testing.T) { def interface{} // Expected value of extension after ClearExtension(). } tests := []testcase{ - {pb.E_NoDefaultDouble, setFloat64, nil}, - {pb.E_NoDefaultFloat, setFloat32, nil}, - {pb.E_NoDefaultInt32, setInt32, nil}, - {pb.E_NoDefaultInt64, setInt64, nil}, - {pb.E_NoDefaultUint32, setUint32, nil}, - {pb.E_NoDefaultUint64, setUint64, nil}, - {pb.E_NoDefaultSint32, setInt32, nil}, - {pb.E_NoDefaultSint64, setInt64, nil}, - {pb.E_NoDefaultFixed32, setUint32, nil}, - {pb.E_NoDefaultFixed64, setUint64, nil}, - {pb.E_NoDefaultSfixed32, setInt32, nil}, - {pb.E_NoDefaultSfixed64, setInt64, nil}, - {pb.E_NoDefaultBool, setBool, nil}, - {pb.E_NoDefaultBool, setBool2, nil}, - {pb.E_NoDefaultString, setString, nil}, - {pb.E_NoDefaultBytes, setBytes, nil}, - {pb.E_NoDefaultEnum, setEnum, nil}, - {pb.E_DefaultDouble, setFloat64, float64(3.1415)}, - {pb.E_DefaultFloat, setFloat32, float32(3.14)}, - {pb.E_DefaultInt32, setInt32, int32(42)}, - {pb.E_DefaultInt64, setInt64, int64(43)}, - {pb.E_DefaultUint32, setUint32, uint32(44)}, - {pb.E_DefaultUint64, setUint64, uint64(45)}, - {pb.E_DefaultSint32, setInt32, int32(46)}, - {pb.E_DefaultSint64, setInt64, int64(47)}, - {pb.E_DefaultFixed32, setUint32, uint32(48)}, - {pb.E_DefaultFixed64, setUint64, uint64(49)}, - {pb.E_DefaultSfixed32, setInt32, int32(50)}, - {pb.E_DefaultSfixed64, setInt64, int64(51)}, - {pb.E_DefaultBool, setBool, true}, - {pb.E_DefaultBool, setBool2, true}, - {pb.E_DefaultString, setString, "Hello, string,def=foo"}, - {pb.E_DefaultBytes, setBytes, []byte("Hello, bytes")}, - {pb.E_DefaultEnum, setEnum, pb.DefaultsMessage_ONE}, - } - - checkVal := func(t *testing.T, name string, test testcase, msg *pb.DefaultsMessage, valWant interface{}) { + {pb2.E_NoDefaultDouble, setFloat64, nil}, + {pb2.E_NoDefaultFloat, setFloat32, nil}, + {pb2.E_NoDefaultInt32, setInt32, nil}, + {pb2.E_NoDefaultInt64, setInt64, nil}, + {pb2.E_NoDefaultUint32, setUint32, nil}, + {pb2.E_NoDefaultUint64, setUint64, nil}, + {pb2.E_NoDefaultSint32, setInt32, nil}, + {pb2.E_NoDefaultSint64, setInt64, nil}, + {pb2.E_NoDefaultFixed32, setUint32, nil}, + {pb2.E_NoDefaultFixed64, setUint64, nil}, + {pb2.E_NoDefaultSfixed32, setInt32, nil}, + {pb2.E_NoDefaultSfixed64, setInt64, nil}, + {pb2.E_NoDefaultBool, setBool, nil}, + {pb2.E_NoDefaultBool, setBool2, nil}, + {pb2.E_NoDefaultString, setString, nil}, + {pb2.E_NoDefaultBytes, setBytes, nil}, + {pb2.E_NoDefaultEnum, setEnum, nil}, + {pb2.E_DefaultDouble, setFloat64, float64(3.1415)}, + {pb2.E_DefaultFloat, setFloat32, float32(3.14)}, + {pb2.E_DefaultInt32, setInt32, int32(42)}, + {pb2.E_DefaultInt64, setInt64, int64(43)}, + {pb2.E_DefaultUint32, setUint32, uint32(44)}, + {pb2.E_DefaultUint64, setUint64, uint64(45)}, + {pb2.E_DefaultSint32, setInt32, int32(46)}, + {pb2.E_DefaultSint64, setInt64, int64(47)}, + {pb2.E_DefaultFixed32, setUint32, uint32(48)}, + {pb2.E_DefaultFixed64, setUint64, uint64(49)}, + {pb2.E_DefaultSfixed32, setInt32, int32(50)}, + {pb2.E_DefaultSfixed64, setInt64, int64(51)}, + {pb2.E_DefaultBool, setBool, true}, + {pb2.E_DefaultBool, setBool2, true}, + {pb2.E_DefaultString, setString, "Hello, string,def=foo"}, + {pb2.E_DefaultBytes, setBytes, []byte("Hello, bytes")}, + {pb2.E_DefaultEnum, setEnum, pb2.DefaultsMessage_ONE}, + } + + checkVal := func(t *testing.T, name string, test testcase, msg *pb2.DefaultsMessage, valWant interface{}) { t.Run(name, func(t *testing.T) { val, err := proto.GetExtension(msg, test.ext) if err != nil { @@ -328,7 +329,7 @@ func TestGetExtensionDefaults(t *testing.T) { } for _, test := range tests { - msg := &pb.DefaultsMessage{} + msg := &pb2.DefaultsMessage{} name := test.ext.Name // Check the initial value. @@ -349,7 +350,7 @@ func TestGetExtensionDefaults(t *testing.T) { func TestNilMessage(t *testing.T) { name := "nil interface" - if got, err := proto.GetExtension(nil, pb.E_Ext_More); err == nil { + if got, err := proto.GetExtension(nil, pb2.E_Ext_More); err == nil { t.Errorf("%s: got %T %v, expected to fail", name, got, got) } else if !strings.Contains(err.Error(), "extendable") { t.Errorf("%s: got error %v, expected not-extendable error", name, err) @@ -358,8 +359,8 @@ func TestNilMessage(t *testing.T) { // Regression tests: all functions of the Extension API // used to panic when passed (*M)(nil), where M is a concrete message // type. Now they handle this gracefully as a no-op or reported error. - var nilMsg *pb.MyMessage - desc := pb.E_Ext_More + var nilMsg *pb2.MyMessage + desc := pb2.E_Ext_More isNotExtendable := func(err error) bool { return strings.Contains(fmt.Sprint(err), "not an extendable") @@ -386,58 +387,52 @@ func TestNilMessage(t *testing.T) { } func TestExtensionsRoundTrip(t *testing.T) { - msg := &pb.MyMessage{} - ext1 := &pb.Ext{ + msg := &pb2.MyMessage{} + ext1 := &pb2.Ext{ Data: proto.String("hi"), } - ext2 := &pb.Ext{ + ext2 := &pb2.Ext{ Data: proto.String("there"), } - exists := proto.HasExtension(msg, pb.E_Ext_More) + exists := proto.HasExtension(msg, pb2.E_Ext_More) if exists { t.Error("Extension More present unexpectedly") } - if err := proto.SetExtension(msg, pb.E_Ext_More, ext1); err != nil { + if err := proto.SetExtension(msg, pb2.E_Ext_More, ext1); err != nil { t.Error(err) } - if err := proto.SetExtension(msg, pb.E_Ext_More, ext2); err != nil { + if err := proto.SetExtension(msg, pb2.E_Ext_More, ext2); err != nil { t.Error(err) } - e, err := proto.GetExtension(msg, pb.E_Ext_More) + e, err := proto.GetExtension(msg, pb2.E_Ext_More) if err != nil { t.Error(err) } - x, ok := e.(*pb.Ext) + x, ok := e.(*pb2.Ext) if !ok { t.Errorf("e has type %T, expected test_proto.Ext", e) } else if *x.Data != "there" { t.Errorf("SetExtension failed to overwrite, got %+v, not 'there'", x) } - proto.ClearExtension(msg, pb.E_Ext_More) - if _, err = proto.GetExtension(msg, pb.E_Ext_More); err != proto.ErrMissingExtension { + proto.ClearExtension(msg, pb2.E_Ext_More) + if _, err = proto.GetExtension(msg, pb2.E_Ext_More); err != proto.ErrMissingExtension { t.Errorf("got %v, expected ErrMissingExtension", e) } - if _, err := proto.GetExtension(msg, pb.E_X215); err == nil { - t.Error("expected bad extension error, got nil") - } - if err := proto.SetExtension(msg, pb.E_X215, 12); err == nil { - t.Error("expected extension err") - } - if err := proto.SetExtension(msg, pb.E_Ext_More, 12); err == nil { + if err := proto.SetExtension(msg, pb2.E_Ext_More, 12); err == nil { t.Error("expected some sort of type mismatch error, got nil") } } func TestNilExtension(t *testing.T) { - msg := &pb.MyMessage{ + msg := &pb2.MyMessage{ Count: proto.Int32(1), } - if err := proto.SetExtension(msg, pb.E_Ext_Text, proto.String("hello")); err != nil { + if err := proto.SetExtension(msg, pb2.E_Ext_Text, proto.String("hello")); err != nil { t.Fatal(err) } - if err := proto.SetExtension(msg, pb.E_Ext_More, (*pb.Ext)(nil)); err == nil { + if err := proto.SetExtension(msg, pb2.E_Ext_More, (*pb2.Ext)(nil)); err == nil { t.Error("expected SetExtension to fail due to a nil extension") - } else if want := fmt.Sprintf("proto: SetExtension called with nil value of type %T", new(pb.Ext)); err.Error() != want { + } else if want := fmt.Sprintf("proto: SetExtension called with nil value of type %T", new(pb2.Ext)); err.Error() != want { t.Errorf("expected error %v, got %v", want, err) } // Note: if the behavior of Marshal is ever changed to ignore nil extensions, update @@ -448,25 +443,25 @@ func TestMarshalUnmarshalRepeatedExtension(t *testing.T) { // Add a repeated extension to the result. tests := []struct { name string - ext []*pb.ComplexExtension + ext []*pb2.ComplexExtension }{ { "two fields", - []*pb.ComplexExtension{ + []*pb2.ComplexExtension{ {First: proto.Int32(7)}, {Second: proto.Int32(11)}, }, }, { "repeated field", - []*pb.ComplexExtension{ + []*pb2.ComplexExtension{ {Third: []int32{1000}}, {Third: []int32{2000}}, }, }, { "two fields and repeated field", - []*pb.ComplexExtension{ + []*pb2.ComplexExtension{ {Third: []int32{1000}}, {First: proto.Int32(9)}, {Second: proto.Int32(21)}, @@ -476,8 +471,8 @@ func TestMarshalUnmarshalRepeatedExtension(t *testing.T) { } for _, test := range tests { // Marshal message with a repeated extension. - msg1 := new(pb.OtherMessage) - err := proto.SetExtension(msg1, pb.E_RComplex, test.ext) + msg1 := new(pb2.OtherMessage) + err := proto.SetExtension(msg1, pb2.E_RComplex, test.ext) if err != nil { t.Fatalf("[%s] Error setting extension: %v", test.name, err) } @@ -487,16 +482,16 @@ func TestMarshalUnmarshalRepeatedExtension(t *testing.T) { } // Unmarshal and read the merged proto. - msg2 := new(pb.OtherMessage) + msg2 := new(pb2.OtherMessage) err = proto.Unmarshal(b, msg2) if err != nil { t.Fatalf("[%s] Error unmarshaling message: %v", test.name, err) } - e, err := proto.GetExtension(msg2, pb.E_RComplex) + e, err := proto.GetExtension(msg2, pb2.E_RComplex) if err != nil { t.Fatalf("[%s] Error getting extension: %v", test.name, err) } - ext := e.([]*pb.ComplexExtension) + ext := e.([]*pb2.ComplexExtension) if ext == nil { t.Fatalf("[%s] Invalid extension", test.name) } @@ -517,25 +512,25 @@ func TestUnmarshalRepeatingNonRepeatedExtension(t *testing.T) { // this way. Here, we verify that we merge the extensions together. tests := []struct { name string - ext []*pb.ComplexExtension + ext []*pb2.ComplexExtension }{ { "two fields", - []*pb.ComplexExtension{ + []*pb2.ComplexExtension{ {First: proto.Int32(7)}, {Second: proto.Int32(11)}, }, }, { "repeated field", - []*pb.ComplexExtension{ + []*pb2.ComplexExtension{ {Third: []int32{1000}}, {Third: []int32{2000}}, }, }, { "two fields and repeated field", - []*pb.ComplexExtension{ + []*pb2.ComplexExtension{ {Third: []int32{1000}}, {First: proto.Int32(9)}, {Second: proto.Int32(21)}, @@ -545,7 +540,7 @@ func TestUnmarshalRepeatingNonRepeatedExtension(t *testing.T) { } for _, test := range tests { var buf bytes.Buffer - var want pb.ComplexExtension + var want pb2.ComplexExtension // Generate a serialized representation of a repeated extension // by catenating bytes together. @@ -554,8 +549,8 @@ func TestUnmarshalRepeatingNonRepeatedExtension(t *testing.T) { proto.Merge(&want, e) // serialize the message - msg := new(pb.OtherMessage) - err := proto.SetExtension(msg, pb.E_Complex, e) + msg := new(pb2.OtherMessage) + err := proto.SetExtension(msg, pb2.E_Complex, e) if err != nil { t.Fatalf("[%s] Error setting extension %d: %v", test.name, i, err) } @@ -567,16 +562,16 @@ func TestUnmarshalRepeatingNonRepeatedExtension(t *testing.T) { } // Unmarshal and read the merged proto. - msg2 := new(pb.OtherMessage) + msg2 := new(pb2.OtherMessage) err := proto.Unmarshal(buf.Bytes(), msg2) if err != nil { t.Fatalf("[%s] Error unmarshaling message: %v", test.name, err) } - e, err := proto.GetExtension(msg2, pb.E_Complex) + e, err := proto.GetExtension(msg2, pb2.E_Complex) if err != nil { t.Fatalf("[%s] Error getting extension: %v", test.name, err) } - ext := e.(*pb.ComplexExtension) + ext := e.(*pb2.ComplexExtension) if ext == nil { t.Fatalf("[%s] Invalid extension", test.name) } @@ -589,13 +584,13 @@ func TestUnmarshalRepeatingNonRepeatedExtension(t *testing.T) { func TestClearAllExtensions(t *testing.T) { // unregistered extension desc := &proto.ExtensionDesc{ - ExtendedType: (*pb.MyMessage)(nil), + ExtendedType: (*pb2.MyMessage)(nil), ExtensionType: (*bool)(nil), Field: 101010100, Name: "emptyextension", Tag: "varint,0,opt", } - m := &pb.MyMessage{} + m := &pb2.MyMessage{} if proto.HasExtension(m, desc) { t.Errorf("proto.HasExtension(%s): got true, want false", proto.MarshalTextString(m)) } @@ -612,9 +607,9 @@ func TestClearAllExtensions(t *testing.T) { } func TestMarshalRace(t *testing.T) { - ext := &pb.Ext{} - m := &pb.MyMessage{Count: proto.Int32(4)} - if err := proto.SetExtension(m, pb.E_Ext_More, ext); err != nil { + ext := &pb2.Ext{} + m := &pb2.MyMessage{Count: proto.Int32(4)} + if err := proto.SetExtension(m, pb2.E_Ext_More, ext); err != nil { t.Fatalf("proto.SetExtension(m, desc, true): got error %q, want nil", err) } diff --git a/proto/hooks_disabled.go b/proto/hooks_disabled.go deleted file mode 100644 index 09485c945d..0000000000 --- a/proto/hooks_disabled.go +++ /dev/null @@ -1,152 +0,0 @@ -// 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. - -// +build use_golang_protobuf_v1 - -package proto - -import ( - "io" - "reflect" - - "google.golang.org/protobuf/types/descriptorpb" - "google.golang.org/protobuf/types/known/anypb" - "google.golang.org/protobuf/types/known/apipb" - "google.golang.org/protobuf/types/known/durationpb" - "google.golang.org/protobuf/types/known/emptypb" - "google.golang.org/protobuf/types/known/fieldmaskpb" - "google.golang.org/protobuf/types/known/sourcecontextpb" - "google.golang.org/protobuf/types/known/structpb" - "google.golang.org/protobuf/types/known/timestamppb" - "google.golang.org/protobuf/types/known/typepb" - "google.golang.org/protobuf/types/known/wrapperspb" -) - -var ( - // Hooks for lib.go. - setDefaultsAlt func(Message) - - // Hooks for discard.go. - discardUnknownAlt func(Message) - - // Hooks for registry.go. - registerEnumAlt func(string, map[int32]string, map[string]int32) - enumValueMapAlt func(string) map[string]int32 - registerTypeAlt func(Message, string) - registerMapTypeAlt func(interface{}, string) - messageNameAlt func(Message) string - messageTypeAlt func(string) reflect.Type - registerFileAlt func(string, []byte) - fileDescriptorAlt func(string) []byte - registerExtensionAlt func(*ExtensionDesc) - registeredExtensionsAlt func(Message) map[int32]*ExtensionDesc - - // Hooks for text.go - marshalTextAlt func(io.Writer, Message) error - marshalTextStringAlt func(Message) string - compactTextAlt func(io.Writer, Message) error - compactTextStringAlt func(Message) string - - // Hooks for text_parser.go - unmarshalTextAlt func(string, Message) error -) - -// Hooks for lib.go. -type RequiredNotSetError = requiredNotSetError - -// Hooks for text.go -type TextMarshaler = textMarshaler - -// The v2 descriptor no longer registers with v1. -// If we're only relying on the v1 registry, we need to manually register the -// types in descriptor. -func init() { - // TODO: This should be eventually deleted once the v1 repository is fully - // switched over to wrap the v2 repository. - rawDesc, _ := (*descriptorpb.DescriptorProto)(nil).Descriptor() - RegisterFile("google/protobuf/descriptor.proto", rawDesc) - RegisterEnum("google.protobuf.FieldDescriptorProto_Type", descriptorpb.FieldDescriptorProto_Type_name, descriptorpb.FieldDescriptorProto_Type_value) - RegisterEnum("google.protobuf.FieldDescriptorProto_Label", descriptorpb.FieldDescriptorProto_Label_name, descriptorpb.FieldDescriptorProto_Label_value) - RegisterEnum("google.protobuf.FileOptions_OptimizeMode", descriptorpb.FileOptions_OptimizeMode_name, descriptorpb.FileOptions_OptimizeMode_value) - RegisterEnum("google.protobuf.FieldOptions_CType", descriptorpb.FieldOptions_CType_name, descriptorpb.FieldOptions_CType_value) - RegisterEnum("google.protobuf.FieldOptions_JSType", descriptorpb.FieldOptions_JSType_name, descriptorpb.FieldOptions_JSType_value) - RegisterEnum("google.protobuf.MethodOptions_IdempotencyLevel", descriptorpb.MethodOptions_IdempotencyLevel_name, descriptorpb.MethodOptions_IdempotencyLevel_value) - RegisterType((*descriptorpb.FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") - RegisterType((*descriptorpb.FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") - RegisterType((*descriptorpb.DescriptorProto)(nil), "google.protobuf.DescriptorProto") - RegisterType((*descriptorpb.ExtensionRangeOptions)(nil), "google.protobuf.ExtensionRangeOptions") - RegisterType((*descriptorpb.FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") - RegisterType((*descriptorpb.OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") - RegisterType((*descriptorpb.EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") - RegisterType((*descriptorpb.EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") - RegisterType((*descriptorpb.ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") - RegisterType((*descriptorpb.MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") - RegisterType((*descriptorpb.FileOptions)(nil), "google.protobuf.FileOptions") - RegisterType((*descriptorpb.MessageOptions)(nil), "google.protobuf.MessageOptions") - RegisterType((*descriptorpb.FieldOptions)(nil), "google.protobuf.FieldOptions") - RegisterType((*descriptorpb.OneofOptions)(nil), "google.protobuf.OneofOptions") - RegisterType((*descriptorpb.EnumOptions)(nil), "google.protobuf.EnumOptions") - RegisterType((*descriptorpb.EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") - RegisterType((*descriptorpb.ServiceOptions)(nil), "google.protobuf.ServiceOptions") - RegisterType((*descriptorpb.MethodOptions)(nil), "google.protobuf.MethodOptions") - RegisterType((*descriptorpb.UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") - RegisterType((*descriptorpb.SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") - RegisterType((*descriptorpb.GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") - RegisterType((*descriptorpb.DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") - RegisterType((*descriptorpb.DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") - RegisterType((*descriptorpb.EnumDescriptorProto_EnumReservedRange)(nil), "google.protobuf.EnumDescriptorProto.EnumReservedRange") - RegisterType((*descriptorpb.UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") - RegisterType((*descriptorpb.SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") - RegisterType((*descriptorpb.GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") - - // any.proto - RegisterType((*anypb.Any)(nil), "google.protobuf.Any") - - // api.proto - RegisterType((*apipb.Api)(nil), "google.protobuf.Api") - RegisterType((*apipb.Method)(nil), "google.protobuf.Method") - RegisterType((*apipb.Mixin)(nil), "google.protobuf.Mixin") - - // duration.proto - RegisterType((*durationpb.Duration)(nil), "google.protobuf.Duration") - - // empty.proto - RegisterType((*emptypb.Empty)(nil), "google.protobuf.Empty") - - // field_mask.proto - RegisterType((*fieldmaskpb.FieldMask)(nil), "google.protobuf.FieldMask") - - // source_context.proto - RegisterType((*sourcecontextpb.SourceContext)(nil), "google.protobuf.SourceContext") - - // struct.proto - RegisterEnum("google.protobuf.NullValue", structpb.NullValue_name, structpb.NullValue_value) - RegisterType((*structpb.Struct)(nil), "google.protobuf.Struct") - RegisterType((*structpb.Value)(nil), "google.protobuf.Value") - RegisterType((*structpb.ListValue)(nil), "google.protobuf.ListValue") - - // timestamp.proto - RegisterType((*timestamppb.Timestamp)(nil), "google.protobuf.Timestamp") - - // type.proto - RegisterEnum("google.protobuf.Syntax", typepb.Syntax_name, typepb.Syntax_value) - RegisterEnum("google.protobuf.Field_Kind", typepb.Field_Kind_name, typepb.Field_Kind_value) - RegisterEnum("google.protobuf.Field_Cardinality", typepb.Field_Cardinality_name, typepb.Field_Cardinality_value) - RegisterType((*typepb.Type)(nil), "google.protobuf.Type") - RegisterType((*typepb.Field)(nil), "google.protobuf.Field") - RegisterType((*typepb.Enum)(nil), "google.protobuf.Enum") - RegisterType((*typepb.EnumValue)(nil), "google.protobuf.EnumValue") - RegisterType((*typepb.Option)(nil), "google.protobuf.Option") - - // wrapper.proto - RegisterType((*wrapperspb.DoubleValue)(nil), "google.protobuf.DoubleValue") - RegisterType((*wrapperspb.FloatValue)(nil), "google.protobuf.FloatValue") - RegisterType((*wrapperspb.Int64Value)(nil), "google.protobuf.Int64Value") - RegisterType((*wrapperspb.UInt64Value)(nil), "google.protobuf.UInt64Value") - RegisterType((*wrapperspb.Int32Value)(nil), "google.protobuf.Int32Value") - RegisterType((*wrapperspb.UInt32Value)(nil), "google.protobuf.UInt32Value") - RegisterType((*wrapperspb.BoolValue)(nil), "google.protobuf.BoolValue") - RegisterType((*wrapperspb.StringValue)(nil), "google.protobuf.StringValue") - RegisterType((*wrapperspb.BytesValue)(nil), "google.protobuf.BytesValue") -} diff --git a/proto/hooks_enabled.go b/proto/hooks_enabled.go deleted file mode 100644 index 67f3b01111..0000000000 --- a/proto/hooks_enabled.go +++ /dev/null @@ -1,46 +0,0 @@ -// 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. - -// +build !use_golang_protobuf_v1 - -package proto - -import ( - "github.com/golang/protobuf/internal/proto" -) - -var ( - // Hooks for lib.go. - setDefaultsAlt = proto.SetDefaults - - // Hooks for discard.go. - discardUnknownAlt = proto.DiscardUnknown - - // Hooks for registry.go. - registerEnumAlt = proto.RegisterEnum - enumValueMapAlt = proto.EnumValueMap - registerTypeAlt = proto.RegisterType - registerMapTypeAlt = proto.RegisterMapType - messageNameAlt = proto.MessageName - messageTypeAlt = proto.MessageType - registerFileAlt = proto.RegisterFile - fileDescriptorAlt = proto.FileDescriptor - registerExtensionAlt = proto.RegisterExtension - registeredExtensionsAlt = proto.RegisteredExtensions - - // Hooks for text.go - marshalTextAlt = proto.MarshalText - marshalTextStringAlt = proto.MarshalTextString - compactTextAlt = proto.CompactText - compactTextStringAlt = proto.CompactTextString - - // Hooks for text_parser.go - unmarshalTextAlt = proto.UnmarshalText -) - -// Hooks for lib.go. -type RequiredNotSetError = proto.RequiredNotSetError - -// Hooks for text.go -type TextMarshaler = proto.TextMarshaler diff --git a/proto/lib.go b/proto/lib.go deleted file mode 100644 index ada7b33fee..0000000000 --- a/proto/lib.go +++ /dev/null @@ -1,692 +0,0 @@ -// 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 marshals and unmarshals protocol buffer messages as the -// wire-format and text-format. For more information, see: -// https://developers.google.com/protocol-buffers/docs/gotutorial -package proto - -import ( - "fmt" - "log" - "reflect" - "sort" - "strconv" - "sync" - - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/runtime/protoiface" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// requiredNotSetError is an error type returned by either Marshal or Unmarshal. -// Marshal reports this when a required field is not initialized. -// Unmarshal reports this when a required field is missing from the wire data. -type requiredNotSetError struct{ field string } - -func (e *requiredNotSetError) Error() string { - if e.field == "" { - return fmt.Sprintf("proto: required field not set") - } - return fmt.Sprintf("proto: required field %q not set", e.field) -} -func (e *requiredNotSetError) RequiredNotSet() bool { - return true -} - -type invalidUTF8Error struct{ field string } - -func (e *invalidUTF8Error) Error() string { - if e.field == "" { - return "proto: invalid UTF-8 detected" - } - return fmt.Sprintf("proto: field %q contains invalid UTF-8", e.field) -} -func (e *invalidUTF8Error) InvalidUTF8() bool { - return true -} - -// errInvalidUTF8 is a sentinel error to identify fields with invalid UTF-8. -// This error should not be exposed to the external API as such errors should -// be recreated with the field information. -var errInvalidUTF8 = &invalidUTF8Error{} - -// isNonFatal reports whether the error is either a RequiredNotSet error -// or a InvalidUTF8 error. -func isNonFatal(err error) bool { - if re, ok := err.(interface{ RequiredNotSet() bool }); ok && re.RequiredNotSet() { - return true - } - if re, ok := err.(interface{ InvalidUTF8() bool }); ok && re.InvalidUTF8() { - return true - } - return false -} - -type nonFatal struct{ E error } - -// Merge merges err into nf and reports whether it was successful. -// Otherwise it returns false for any fatal non-nil errors. -func (nf *nonFatal) Merge(err error) (ok bool) { - if err == nil { - return true // not an error - } - if !isNonFatal(err) { - return false // fatal error - } - if nf.E == nil { - nf.E = err // store first instance of non-fatal error - } - return true -} - -// Message is implemented by generated protocol buffer messages. -type Message = protoiface.MessageV1 - -var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() - -var marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() - -type ( - oneofFuncsIface interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) - } - oneofWrappersIface interface { - XXX_OneofWrappers() []interface{} - } -) - -// oneofWrappers returns a list of oneof wrappers for t, -// which must be a named struct type. -func oneofWrappers(t reflect.Type) []interface{} { - var oos []interface{} - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oos = m.XXX_OneofFuncs() - case oneofWrappersIface: - oos = m.XXX_OneofWrappers() - case protoV2.Message: - if m, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *protoimpl.MessageInfo }); ok { - oos = m.ProtoMessageInfo().OneofWrappers - } - } - return oos -} - -// unknownFieldsValue retrieves the value for unknown fields from v, -// which must be a name struct type. -func unknownFieldsValue(v reflect.Value) reflect.Value { - if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() { - return vf - } - if vf := fieldByName(v, "unknownFields"); vf.IsValid() { - return vf - } - return reflect.Value{} -} - -// extensionFieldsValue retrieves the value for extension fields from v, -// which must be a name struct type. -func extensionFieldsValue(v reflect.Value) reflect.Value { - if vf := v.FieldByName("XXX_InternalExtensions"); vf.IsValid() { - return vf - } - if vf := v.FieldByName("XXX_extensions"); vf.IsValid() { - return vf - } - if vf := fieldByName(v, "extensionFields"); vf.IsValid() { - return vf - } - return reflect.Value{} -} - -// exporterFunc retrieves the field exporter function for t, -// which must be a named struct type. -func exporterFunc(t reflect.Type) func(interface{}, int) interface{} { - if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoV2.Message); ok { - if m, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *protoimpl.MessageInfo }); ok { - return m.ProtoMessageInfo().Exporter - } - } - return nil -} - -// isMessageSet determines whether t is a MessageSet message, -// where t must be a named struct type. -func isMessageSet(t reflect.Type) bool { - if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoV2.Message); ok { - md := m.ProtoReflect().Descriptor() - xmd, ok := md.(interface{ IsMessageSet() bool }) - return ok && xmd.IsMessageSet() - } - return false -} - -// A Buffer is a buffer manager for marshaling and unmarshaling -// protocol buffers. It may be reused between invocations to -// reduce memory usage. It is not necessary to use a Buffer; -// the global functions Marshal and Unmarshal create a -// temporary Buffer and are fine for most applications. -type Buffer struct { - buf []byte // encode/decode byte stream - index int // read point - - deterministic bool -} - -// NewBuffer allocates a new Buffer and initializes its internal data to -// the contents of the argument slice. -func NewBuffer(e []byte) *Buffer { - return &Buffer{buf: e} -} - -// Reset resets the Buffer, ready for marshaling a new protocol buffer. -func (p *Buffer) Reset() { - p.buf = p.buf[0:0] // for reading/writing - p.index = 0 // for reading -} - -// SetBuf replaces the internal buffer with the slice, -// ready for unmarshaling the contents of the slice. -func (p *Buffer) SetBuf(s []byte) { - p.buf = s - p.index = 0 -} - -// Bytes returns the contents of the Buffer. -func (p *Buffer) Bytes() []byte { return p.buf } - -// SetDeterministic sets 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 (p *Buffer) SetDeterministic(deterministic bool) { - p.deterministic = deterministic -} - -// DebugPrint dumps the encoded data in b in a debugging format with a header -// including the string s. Used in testing but made available for general debugging. -func (p *Buffer) DebugPrint(s string, b []byte) { - var u uint64 - - obuf := p.buf - index := p.index - p.buf = b - p.index = 0 - depth := 0 - - fmt.Printf("\n--- %s ---\n", s) - -out: - for { - for i := 0; i < depth; i++ { - fmt.Print(" ") - } - - index := p.index - if index == len(p.buf) { - break - } - - op, err := p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: fetching op err %v\n", index, err) - break out - } - tag := op >> 3 - wire := op & 7 - - switch wire { - default: - fmt.Printf("%3d: t=%3d unknown wire=%d\n", - index, tag, wire) - break out - - case WireBytes: - var r []byte - - r, err = p.DecodeRawBytes(false) - if err != nil { - break out - } - fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r)) - if len(r) <= 6 { - for i := 0; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } else { - for i := 0; i < 3; i++ { - fmt.Printf(" %.2x", r[i]) - } - fmt.Printf(" ..") - for i := len(r) - 3; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } - fmt.Printf("\n") - - case WireFixed32: - u, err = p.DecodeFixed32() - if err != nil { - fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u) - - case WireFixed64: - u, err = p.DecodeFixed64() - if err != nil { - fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u) - - case WireVarint: - u, err = p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u) - - case WireStartGroup: - fmt.Printf("%3d: t=%3d start\n", index, tag) - depth++ - - case WireEndGroup: - depth-- - fmt.Printf("%3d: t=%3d end\n", index, tag) - } - } - - if depth != 0 { - fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth) - } - fmt.Printf("\n") - - p.buf = obuf - p.index = index -} - -// SetDefaults sets unset protocol buffer fields to their default values. -// It only modifies fields that are both unset and have defined defaults. -// It recursively sets default values in any non-nil sub-messages. -func SetDefaults(pb Message) { - if setDefaultsAlt != nil { - setDefaultsAlt(pb) // populated by hooks_enabled.go - return - } - setDefaults(reflect.ValueOf(pb), true, false) -} - -// v is a pointer to a struct. -func setDefaults(v reflect.Value, recur, zeros bool) { - v = v.Elem() - - defaultMu.RLock() - dm, ok := defaults[v.Type()] - defaultMu.RUnlock() - if !ok { - dm = buildDefaultMessage(v.Type()) - defaultMu.Lock() - defaults[v.Type()] = dm - defaultMu.Unlock() - } - - for _, sf := range dm.scalars { - f := v.Field(sf.index) - if !f.IsNil() { - // field already set - continue - } - dv := sf.value - if dv == nil && !zeros { - // no explicit default, and don't want to set zeros - continue - } - fptr := f.Addr().Interface() // **T - // TODO: Consider batching the allocations we do here. - switch sf.kind { - case reflect.Bool: - b := new(bool) - if dv != nil { - *b = dv.(bool) - } - *(fptr.(**bool)) = b - case reflect.Float32: - f := new(float32) - if dv != nil { - *f = dv.(float32) - } - *(fptr.(**float32)) = f - case reflect.Float64: - f := new(float64) - if dv != nil { - *f = dv.(float64) - } - *(fptr.(**float64)) = f - case reflect.Int32: - // might be an enum - if ft := f.Type(); ft != int32PtrType { - // enum - f.Set(reflect.New(ft.Elem())) - if dv != nil { - f.Elem().SetInt(int64(dv.(int32))) - } - } else { - // int32 field - i := new(int32) - if dv != nil { - *i = dv.(int32) - } - *(fptr.(**int32)) = i - } - case reflect.Int64: - i := new(int64) - if dv != nil { - *i = dv.(int64) - } - *(fptr.(**int64)) = i - case reflect.String: - s := new(string) - if dv != nil { - *s = dv.(string) - } - *(fptr.(**string)) = s - case reflect.Uint8: - // exceptional case: []byte - var b []byte - if dv != nil { - db := dv.([]byte) - b = make([]byte, len(db)) - copy(b, db) - } else { - b = []byte{} - } - *(fptr.(*[]byte)) = b - case reflect.Uint32: - u := new(uint32) - if dv != nil { - *u = dv.(uint32) - } - *(fptr.(**uint32)) = u - case reflect.Uint64: - u := new(uint64) - if dv != nil { - *u = dv.(uint64) - } - *(fptr.(**uint64)) = u - default: - log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind) - } - } - - for _, ni := range dm.nested { - f := v.Field(ni) - // f is *T or []*T or map[T]*T - switch f.Kind() { - case reflect.Ptr: - if f.IsNil() { - continue - } - setDefaults(f, recur, zeros) - - case reflect.Slice: - for i := 0; i < f.Len(); i++ { - e := f.Index(i) - if e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - - case reflect.Map: - for _, k := range f.MapKeys() { - e := f.MapIndex(k) - if e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - } - } -} - -var ( - // defaults maps a protocol buffer struct type to a slice of the fields, - // with its scalar fields set to their proto-declared non-zero default values. - defaultMu sync.RWMutex - defaults = make(map[reflect.Type]defaultMessage) - - int32PtrType = reflect.TypeOf((*int32)(nil)) -) - -// defaultMessage represents information about the default values of a message. -type defaultMessage struct { - scalars []scalarField - nested []int // struct field index of nested messages -} - -type scalarField struct { - index int // struct field index - kind reflect.Kind // element type (the T in *T or []T) - value interface{} // the proto-declared default value, or nil -} - -// t is a struct type. -func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { - sprop := GetProperties(t) - for fi, prop := range sprop.Prop { - if prop.Tag <= 0 { - // XXX_unrecognized - continue - } - ft := t.Field(fi).Type - - sf, nested, err := fieldDefault(ft, prop) - switch { - case err != nil: - log.Print(err) - case nested: - dm.nested = append(dm.nested, fi) - case sf != nil: - sf.index = fi - dm.scalars = append(dm.scalars, *sf) - } - } - - return dm -} - -// fieldDefault returns the scalarField for field type ft. -// sf will be nil if the field can not have a default. -// nestedMessage will be true if this is a nested message. -// Note that sf.index is not set on return. -func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { - var canHaveDefault bool - switch ft.Kind() { - case reflect.Ptr: - if ft.Elem().Kind() == reflect.Struct { - nestedMessage = true - } else { - canHaveDefault = true // proto2 scalar field - } - - case reflect.Slice: - switch ft.Elem().Kind() { - case reflect.Ptr: - nestedMessage = true // repeated message - case reflect.Uint8: - canHaveDefault = true // bytes field - } - - case reflect.Map: - if ft.Elem().Kind() == reflect.Ptr { - nestedMessage = true // map with message values - } - } - - if !canHaveDefault { - if nestedMessage { - return nil, true, nil - } - return nil, false, nil - } - - // We now know that ft is a pointer or slice. - sf = &scalarField{kind: ft.Elem().Kind()} - - // scalar fields without defaults - if !prop.HasDefault { - return sf, false, nil - } - - // a scalar field: either *T or []byte - switch ft.Elem().Kind() { - case reflect.Bool: - x, err := strconv.ParseBool(prop.Default) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Float32: - x, err := strconv.ParseFloat(prop.Default, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err) - } - sf.value = float32(x) - case reflect.Float64: - x, err := strconv.ParseFloat(prop.Default, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Int32: - x, err := strconv.ParseInt(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err) - } - sf.value = int32(x) - case reflect.Int64: - x, err := strconv.ParseInt(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.String: - sf.value = prop.Default - case reflect.Uint8: - // []byte (not *uint8) - sf.value = []byte(prop.Default) - case reflect.Uint32: - x, err := strconv.ParseUint(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err) - } - sf.value = uint32(x) - case reflect.Uint64: - x, err := strconv.ParseUint(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err) - } - sf.value = x - default: - return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind()) - } - - return sf, false, nil -} - -// mapKeys returns a sort.Interface to be used for sorting the map keys. -// Map fields may have key types of non-float scalars, strings and enums. -func mapKeys(vs []reflect.Value) sort.Interface { - s := mapKeySorter{vs: vs} - - // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps. - if len(vs) == 0 { - return s - } - switch vs[0].Kind() { - case reflect.Int32, reflect.Int64: - s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } - case reflect.Uint32, reflect.Uint64: - s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } - case reflect.Bool: - s.less = func(a, b reflect.Value) bool { return !a.Bool() && b.Bool() } // false < true - case reflect.String: - s.less = func(a, b reflect.Value) bool { return a.String() < b.String() } - default: - panic(fmt.Sprintf("unsupported map key type: %v", vs[0].Kind())) - } - - return s -} - -type mapKeySorter struct { - vs []reflect.Value - less func(a, b reflect.Value) bool -} - -func (s mapKeySorter) Len() int { return len(s.vs) } -func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] } -func (s mapKeySorter) Less(i, j int) bool { - return s.less(s.vs[i], s.vs[j]) -} - -// isProto3Zero reports whether v is a zero proto3 value. -func isProto3Zero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return !v.Bool() - case reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint32, reflect.Uint64: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.String: - return v.String() == "" - } - return false -} - -const ( - // ProtoPackageIsVersion3 is referenced from generated protocol buffer files - // to assert that that code is compatible with this version of the proto package. - ProtoPackageIsVersion3 = true - - // ProtoPackageIsVersion2 is referenced from generated protocol buffer files - // to assert that that code is compatible with this version of the proto package. - ProtoPackageIsVersion2 = true - - // ProtoPackageIsVersion1 is referenced from generated protocol buffer files - // to assert that that code is compatible with this version of the proto package. - ProtoPackageIsVersion1 = true -) - -// InternalMessageInfo is a type used internally by generated .pb.go files. -// This type is not intended to be used by non-generated code. -// This type is not subject to any compatibility guarantee. -type InternalMessageInfo struct { - marshal *marshalInfo - unmarshal *unmarshalInfo - merge *mergeInfo - discard *discardInfo -} diff --git a/proto/map_test.go b/proto/map_test.go deleted file mode 100644 index d61d402283..0000000000 --- a/proto/map_test.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2016 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_test - -import ( - "fmt" - "reflect" - "testing" - - "github.com/golang/protobuf/proto" - ppb "github.com/golang/protobuf/proto/proto3_proto" -) - -func TestMap(t *testing.T) { - var b []byte - fmt.Sscanf("a2010c0a044b657931120456616c31a201130a044b657932120556616c3261120456616c32a201240a044b6579330d05000000120556616c33621a0556616c3361120456616c331505000000a20100a201260a044b657934130a07536f6d6555524c1209536f6d655469746c651a08536e69707065743114", "%x", &b) - - var m ppb.Message - if err := proto.Unmarshal(b, &m); err != nil { - t.Fatalf("proto.Unmarshal error: %v", err) - } - - got := m.StringMap - want := map[string]string{ - "": "", - "Key1": "Val1", - "Key2": "Val2", - "Key3": "Val3", - "Key4": "", - } - - if !reflect.DeepEqual(got, want) { - t.Errorf("maps differ:\ngot %#v\nwant %#v", got, want) - } -} - -func marshalled() []byte { - m := &ppb.IntMaps{} - for i := 0; i < 1000; i++ { - m.Maps = append(m.Maps, &ppb.IntMap{ - Rtt: map[int32]int32{1: 2}, - }) - } - b, err := proto.Marshal(m) - if err != nil { - panic(fmt.Sprintf("Can't marshal %+v: %v", m, err)) - } - return b -} - -func BenchmarkConcurrentMapUnmarshal(b *testing.B) { - in := marshalled() - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - var out ppb.IntMaps - if err := proto.Unmarshal(in, &out); err != nil { - b.Errorf("Can't unmarshal ppb.IntMaps: %v", err) - } - } - }) -} - -func BenchmarkSequentialMapUnmarshal(b *testing.B) { - in := marshalled() - b.ResetTimer() - for i := 0; i < b.N; i++ { - var out ppb.IntMaps - if err := proto.Unmarshal(in, &out); err != nil { - b.Errorf("Can't unmarshal ppb.IntMaps: %v", err) - } - } -} diff --git a/proto/message_set.go b/proto/message_set.go deleted file mode 100644 index 201030d467..0000000000 --- a/proto/message_set.go +++ /dev/null @@ -1,140 +0,0 @@ -// 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 - -/* - * Support for message sets. - */ - -import ( - "errors" - "reflect" - - "google.golang.org/protobuf/reflect/protoreflect" -) - -// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. -// A message type ID is required for storing a protocol buffer in a message set. -var errNoMessageTypeID = errors.New("proto does not have a message type ID") - -// The first two types (_MessageSet_Item and messageSet) -// model what the protocol compiler produces for the following protocol message: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } -// That is the MessageSet wire format. We can't use a proto to generate these -// because that would introduce a circular dependency between it and this package. - -type _MessageSet_Item struct { - TypeId *int32 `protobuf:"varint,2,req,name=type_id"` - Message []byte `protobuf:"bytes,3,req,name=message"` -} - -type messageSet struct { - Item []*_MessageSet_Item `protobuf:"group,1,rep"` - XXX_unrecognized []byte - // TODO: caching? -} - -// Make sure messageSet is a Message. -var _ Message = (*messageSet)(nil) - -// messageTypeIder is an interface satisfied by a protocol buffer type -// that may be stored in a MessageSet. -type messageTypeIder interface { - MessageTypeId() int32 -} - -func (ms *messageSet) find(pb Message) *_MessageSet_Item { - mti, ok := pb.(messageTypeIder) - if !ok { - return nil - } - id := mti.MessageTypeId() - for _, item := range ms.Item { - if *item.TypeId == id { - return item - } - } - return nil -} - -func (ms *messageSet) Has(pb Message) bool { - return ms.find(pb) != nil -} - -func (ms *messageSet) Unmarshal(pb Message) error { - if item := ms.find(pb); item != nil { - return Unmarshal(item.Message, pb) - } - if _, ok := pb.(messageTypeIder); !ok { - return errNoMessageTypeID - } - return nil // TODO: return error instead? -} - -func (ms *messageSet) Marshal(pb Message) error { - msg, err := Marshal(pb) - if err != nil { - return err - } - if item := ms.find(pb); item != nil { - // reuse existing item - item.Message = msg - return nil - } - - mti, ok := pb.(messageTypeIder) - if !ok { - return errNoMessageTypeID - } - - mtid := mti.MessageTypeId() - ms.Item = append(ms.Item, &_MessageSet_Item{ - TypeId: &mtid, - Message: msg, - }) - return nil -} - -func (ms *messageSet) Reset() { *ms = messageSet{} } -func (ms *messageSet) String() string { return CompactTextString(ms) } -func (*messageSet) ProtoMessage() {} - -// Support for the message_set_wire_format message option. - -func skipVarint(buf []byte) []byte { - i := 0 - for ; buf[i]&0x80 != 0; i++ { - } - return buf[i+1:] -} - -// unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. -// It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. -func unmarshalMessageSet(buf []byte, mi Message, exts interface{}) error { - ms := new(messageSet) - if err := Unmarshal(buf, ms); err != nil { - return err - } - unrecognized := unknownFieldsValue(reflect.ValueOf(mi).Elem()).Addr().Interface().(*[]byte) - - for _, item := range ms.Item { - id := protoreflect.FieldNumber(*item.TypeId) - msg := item.Message - - // Restore wire type and field number varint, plus length varint. - b := EncodeVarint(uint64(id)<<3 | WireBytes) - b = append(b, EncodeVarint(uint64(len(msg)))...) - b = append(b, msg...) - - *unrecognized = append(*unrecognized, b...) - } - - return unmarshalExtensions(mi, unrecognized) -} diff --git a/proto/message_set_test.go b/proto/message_set_test.go deleted file mode 100644 index a61e2b6c7a..0000000000 --- a/proto/message_set_test.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2014 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_test - -import ( - "bytes" - "fmt" - "testing" - - "github.com/golang/protobuf/proto" - . "github.com/golang/protobuf/proto/test_proto" -) - -func TestUnmarshalMessageSetWithDuplicate(t *testing.T) { - /* - Message{ - Tag{1, StartGroup}, - Message{ - Tag{2, Varint}, Uvarint(12345), - Tag{3, Bytes}, Bytes("hoo"), - }, - Tag{1, EndGroup}, - Tag{1, StartGroup}, - Message{ - Tag{2, Varint}, Uvarint(12345), - Tag{3, Bytes}, Bytes("hah"), - }, - Tag{1, EndGroup}, - } - */ - var in []byte - fmt.Sscanf("0b10b9601a03686f6f0c0b10b9601a036861680c", "%x", &in) - - /* - Message{ - Tag{1, StartGroup}, - Message{ - Tag{2, Varint}, Uvarint(12345), - Tag{3, Bytes}, Bytes("hoo"), - }, - Tag{1, EndGroup}, - Tag{1, StartGroup}, - Message{ - Tag{2, Varint}, Uvarint(12345), - Tag{3, Bytes}, Bytes("hah"), - }, - Tag{1, EndGroup}, - } - */ - var want []byte - fmt.Sscanf("0b10b9601a03686f6f0c0b10b9601a036861680c", "%x", &want) - - var m MyMessageSet - if err := proto.Unmarshal(in, &m); err != nil { - t.Fatalf("unexpected Unmarshal error: %v", err) - } - got, err := proto.Marshal(&m) - if err != nil { - t.Fatalf("unexpected Marshal error: %v", err) - } - - if !bytes.Equal(got, want) { - t.Errorf("output mismatch:\ngot %x\nwant %x", got, want) - } -} diff --git a/proto/pointer_reflect.go b/proto/pointer_reflect.go deleted file mode 100644 index 0b764bc682..0000000000 --- a/proto/pointer_reflect.go +++ /dev/null @@ -1,371 +0,0 @@ -// Copyright 2012 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. - -// +build purego - -// This file contains an implementation of proto field accesses using package reflect. -// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can -// be used on App Engine. - -package proto - -import ( - "reflect" - "sync" - "unicode" - "unicode/utf8" -) - -const unsafeAllowed = false - -// A field identifies a field in a struct, accessible from a pointer. -// In this implementation, a field is identified by the sequence of field indices -// passed to reflect's FieldByIndex. -type field struct { - index int - export exporter -} - -type exporter = func(interface{}, int) interface{} - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField, x exporter) field { - if len(f.Index) != 1 { - panic("embedded structs are not supported") - } - if f.PkgPath == "" { - return field{index: f.Index[0]} // field is already exported - } - if x == nil { - panic("exporter must be provided for unexported field: " + f.Name) - } - return field{index: f.Index[0], export: x} -} - -// invalidField is an invalid field identifier. -var invalidField = field{index: -1} - -// zeroField is a noop when calling pointer.offset. -var zeroField = field{index: 0} - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { return f.index >= 0 } - -// The pointer type is for the table-driven decoder. -// The implementation here uses a reflect.Value of pointer type to -// create a generic pointer. In pointer_unsafe.go we use unsafe -// instead of reflect to implement the same (but faster) interface. -type pointer struct { - v reflect.Value -} - -// toPointer converts an interface of pointer type to a pointer -// that points to the same target. -func toPointer(i *Message) pointer { - return pointer{v: reflect.ValueOf(*i)} -} - -// toAddrPointer converts an interface to a pointer that points to -// the interface data. -func toAddrPointer(i *interface{}, isptr, deref bool) pointer { - v := reflect.ValueOf(*i) - u := reflect.New(v.Type()) - u.Elem().Set(v) - if deref { - u = u.Elem() - } - return pointer{v: u} -} - -// valToPointer converts v to a pointer. v must be of pointer type. -func valToPointer(v reflect.Value) pointer { - return pointer{v: v} -} - -// offset converts from a pointer to a structure to a pointer to -// one of its fields. -func (p pointer) offset(f field) pointer { - if f.export != nil { - if v := reflect.ValueOf(f.export(p.v.Interface(), f.index)); v.IsValid() { - return pointer{v: v} - } - } - return pointer{v: p.v.Elem().Field(f.index).Addr()} -} - -func (p pointer) isNil() bool { - return p.v.IsNil() -} - -// grow updates the slice s in place to make it one element longer. -// s must be addressable. -// Returns the (addressable) new element. -func grow(s reflect.Value) reflect.Value { - n, m := s.Len(), s.Cap() - if n < m { - s.SetLen(n + 1) - } else { - s.Set(reflect.Append(s, reflect.Zero(s.Type().Elem()))) - } - return s.Index(n) -} - -func (p pointer) toInt64() *int64 { - return p.v.Interface().(*int64) -} -func (p pointer) toInt64Ptr() **int64 { - return p.v.Interface().(**int64) -} -func (p pointer) toInt64Slice() *[]int64 { - return p.v.Interface().(*[]int64) -} - -var int32ptr = reflect.TypeOf((*int32)(nil)) - -func (p pointer) toInt32() *int32 { - return p.v.Convert(int32ptr).Interface().(*int32) -} - -// The toInt32Ptr/Slice methods don't work because of enums. -// Instead, we must use set/get methods for the int32ptr/slice case. -/* - func (p pointer) toInt32Ptr() **int32 { - return p.v.Interface().(**int32) -} - func (p pointer) toInt32Slice() *[]int32 { - return p.v.Interface().(*[]int32) -} -*/ -func (p pointer) getInt32Ptr() *int32 { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - return p.v.Elem().Interface().(*int32) - } - // an enum - return p.v.Elem().Convert(int32PtrType).Interface().(*int32) -} -func (p pointer) setInt32Ptr(v int32) { - // Allocate value in a *int32. Possibly convert that to a *enum. - // Then assign it to a **int32 or **enum. - // Note: we can convert *int32 to *enum, but we can't convert - // **int32 to **enum! - p.v.Elem().Set(reflect.ValueOf(&v).Convert(p.v.Type().Elem())) -} - -// getInt32Slice copies []int32 from p as a new slice. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) getInt32Slice() []int32 { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - return p.v.Elem().Interface().([]int32) - } - // an enum - // Allocate a []int32, then assign []enum's values into it. - // Note: we can't convert []enum to []int32. - slice := p.v.Elem() - s := make([]int32, slice.Len()) - for i := 0; i < slice.Len(); i++ { - s[i] = int32(slice.Index(i).Int()) - } - return s -} - -// setInt32Slice copies []int32 into p as a new slice. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) setInt32Slice(v []int32) { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - p.v.Elem().Set(reflect.ValueOf(v)) - return - } - // an enum - // Allocate a []enum, then assign []int32's values into it. - // Note: we can't convert []enum to []int32. - slice := reflect.MakeSlice(p.v.Type().Elem(), len(v), cap(v)) - for i, x := range v { - slice.Index(i).SetInt(int64(x)) - } - p.v.Elem().Set(slice) -} -func (p pointer) appendInt32Slice(v int32) { - grow(p.v.Elem()).SetInt(int64(v)) -} - -func (p pointer) toUint64() *uint64 { - return p.v.Interface().(*uint64) -} -func (p pointer) toUint64Ptr() **uint64 { - return p.v.Interface().(**uint64) -} -func (p pointer) toUint64Slice() *[]uint64 { - return p.v.Interface().(*[]uint64) -} -func (p pointer) toUint32() *uint32 { - return p.v.Interface().(*uint32) -} -func (p pointer) toUint32Ptr() **uint32 { - return p.v.Interface().(**uint32) -} -func (p pointer) toUint32Slice() *[]uint32 { - return p.v.Interface().(*[]uint32) -} -func (p pointer) toBool() *bool { - return p.v.Interface().(*bool) -} -func (p pointer) toBoolPtr() **bool { - return p.v.Interface().(**bool) -} -func (p pointer) toBoolSlice() *[]bool { - return p.v.Interface().(*[]bool) -} -func (p pointer) toFloat64() *float64 { - return p.v.Interface().(*float64) -} -func (p pointer) toFloat64Ptr() **float64 { - return p.v.Interface().(**float64) -} -func (p pointer) toFloat64Slice() *[]float64 { - return p.v.Interface().(*[]float64) -} -func (p pointer) toFloat32() *float32 { - return p.v.Interface().(*float32) -} -func (p pointer) toFloat32Ptr() **float32 { - return p.v.Interface().(**float32) -} -func (p pointer) toFloat32Slice() *[]float32 { - return p.v.Interface().(*[]float32) -} -func (p pointer) toString() *string { - return p.v.Interface().(*string) -} -func (p pointer) toStringPtr() **string { - return p.v.Interface().(**string) -} -func (p pointer) toStringSlice() *[]string { - return p.v.Interface().(*[]string) -} -func (p pointer) toBytes() *[]byte { - return p.v.Interface().(*[]byte) -} -func (p pointer) toBytesSlice() *[][]byte { - return p.v.Interface().(*[][]byte) -} -func (p pointer) toExtensions() *XXX_InternalExtensions { - return p.v.Interface().(*XXX_InternalExtensions) -} -func (p pointer) toOldExtensions() *map[int32]Extension { - return p.v.Interface().(*map[int32]Extension) -} -func (p pointer) getPointer() pointer { - return pointer{v: p.v.Elem()} -} -func (p pointer) setPointer(q pointer) { - p.v.Elem().Set(q.v) -} -func (p pointer) appendPointer(q pointer) { - grow(p.v.Elem()).Set(q.v) -} - -// getPointerSlice copies []*T from p as a new []pointer. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) getPointerSlice() []pointer { - if p.v.IsNil() { - return nil - } - n := p.v.Elem().Len() - s := make([]pointer, n) - for i := 0; i < n; i++ { - s[i] = pointer{v: p.v.Elem().Index(i)} - } - return s -} - -// setPointerSlice copies []pointer into p as a new []*T. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) setPointerSlice(v []pointer) { - if v == nil { - p.v.Elem().Set(reflect.New(p.v.Elem().Type()).Elem()) - return - } - s := reflect.MakeSlice(p.v.Elem().Type(), 0, len(v)) - for _, p := range v { - s = reflect.Append(s, p.v) - } - p.v.Elem().Set(s) -} - -// getInterfacePointer returns a pointer that points to the -// interface data of the interface pointed by p. -func (p pointer) getInterfacePointer() pointer { - if p.v.Elem().IsNil() { - return pointer{v: p.v.Elem()} - } - return pointer{v: p.v.Elem().Elem().Elem().Field(0).Addr()} // *interface -> interface -> *struct -> struct -} - -func (p pointer) asPointerTo(t reflect.Type) reflect.Value { - // TODO: check that p.v.Type().Elem() == t? - return p.v -} - -func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} - -var atomicLock sync.Mutex - -// fieldByName is equivalent to reflect.Value.FieldByName, but is able to -// descend into unexported fields for prop -func fieldByName(v reflect.Value, s string) reflect.Value { - if r, _ := utf8.DecodeRuneInString(s); unicode.IsUpper(r) { - return v.FieldByName(s) - } - t := v.Type() - if x := exporterFunc(t); x != nil { - sf, ok := t.FieldByName(s) - if ok { - vi := x(v.Addr().Interface(), sf.Index[0]) - return reflect.ValueOf(vi).Elem() - } - } - return v.FieldByName(s) -} diff --git a/proto/pointer_unsafe.go b/proto/pointer_unsafe.go deleted file mode 100644 index 20269f45a8..0000000000 --- a/proto/pointer_unsafe.go +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright 2012 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. - -// +build !purego - -// This file contains the implementation of the proto field accesses using package unsafe. - -package proto - -import ( - "reflect" - "sync/atomic" - "unicode" - "unicode/utf8" - "unsafe" -) - -const unsafeAllowed = true - -// A field identifies a field in a struct, accessible from a pointer. -// In this implementation, a field is identified by its byte offset from the start of the struct. -type field uintptr - -type exporter = func(interface{}, int) interface{} - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField, x exporter) field { - return field(f.Offset) -} - -// invalidField is an invalid field identifier. -const invalidField = ^field(0) - -// zeroField is a noop when calling pointer.offset. -const zeroField = field(0) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { - return f != invalidField -} - -// The pointer type below is for the new table-driven encoder/decoder. -// The implementation here uses unsafe.Pointer to create a generic pointer. -// In pointer_reflect.go we use reflect instead of unsafe to implement -// the same (but slower) interface. -type pointer struct { - p unsafe.Pointer -} - -// size of pointer -var ptrSize = unsafe.Sizeof(uintptr(0)) - -// toPointer converts an interface of pointer type to a pointer -// that points to the same target. -func toPointer(i *Message) pointer { - // Super-tricky - read pointer out of data word of interface value. - // Saves ~25ns over the equivalent: - // return valToPointer(reflect.ValueOf(*i)) - return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} -} - -// toAddrPointer converts an interface to a pointer that points to -// the interface data. -func toAddrPointer(i *interface{}, isptr, deref bool) (p pointer) { - // Super-tricky - read or get the address of data word of interface value. - if isptr { - // The interface is of pointer type, thus it is a direct interface. - // The data word is the pointer data itself. We take its address. - p = pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} - } else { - // The interface is not of pointer type. The data word is the pointer - // to the data. - p = pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} - } - if deref { - p.p = *(*unsafe.Pointer)(p.p) - } - return p -} - -// valToPointer converts v to a pointer. v must be of pointer type. -func valToPointer(v reflect.Value) pointer { - return pointer{p: unsafe.Pointer(v.Pointer())} -} - -// offset converts from a pointer to a structure to a pointer to -// one of its fields. -func (p pointer) offset(f field) pointer { - // For safety, we should panic if !f.IsValid, however calling panic causes - // this to no longer be inlineable, which is a serious performance cost. - /* - if !f.IsValid() { - panic("invalid field") - } - */ - return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))} -} - -func (p pointer) isNil() bool { - return p.p == nil -} - -func (p pointer) toInt64() *int64 { - return (*int64)(p.p) -} -func (p pointer) toInt64Ptr() **int64 { - return (**int64)(p.p) -} -func (p pointer) toInt64Slice() *[]int64 { - return (*[]int64)(p.p) -} -func (p pointer) toInt32() *int32 { - return (*int32)(p.p) -} - -// See pointer_reflect.go for why toInt32Ptr/Slice doesn't exist. -/* - func (p pointer) toInt32Ptr() **int32 { - return (**int32)(p.p) - } - func (p pointer) toInt32Slice() *[]int32 { - return (*[]int32)(p.p) - } -*/ -func (p pointer) getInt32Ptr() *int32 { - return *(**int32)(p.p) -} -func (p pointer) setInt32Ptr(v int32) { - *(**int32)(p.p) = &v -} - -// getInt32Slice loads a []int32 from p. -// The value returned is aliased with the original slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) getInt32Slice() []int32 { - return *(*[]int32)(p.p) -} - -// setInt32Slice stores a []int32 to p. -// The value set is aliased with the input slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) setInt32Slice(v []int32) { - *(*[]int32)(p.p) = v -} - -// TODO: Can we get rid of appendInt32Slice and use setInt32Slice instead? -func (p pointer) appendInt32Slice(v int32) { - s := (*[]int32)(p.p) - *s = append(*s, v) -} - -func (p pointer) toUint64() *uint64 { - return (*uint64)(p.p) -} -func (p pointer) toUint64Ptr() **uint64 { - return (**uint64)(p.p) -} -func (p pointer) toUint64Slice() *[]uint64 { - return (*[]uint64)(p.p) -} -func (p pointer) toUint32() *uint32 { - return (*uint32)(p.p) -} -func (p pointer) toUint32Ptr() **uint32 { - return (**uint32)(p.p) -} -func (p pointer) toUint32Slice() *[]uint32 { - return (*[]uint32)(p.p) -} -func (p pointer) toBool() *bool { - return (*bool)(p.p) -} -func (p pointer) toBoolPtr() **bool { - return (**bool)(p.p) -} -func (p pointer) toBoolSlice() *[]bool { - return (*[]bool)(p.p) -} -func (p pointer) toFloat64() *float64 { - return (*float64)(p.p) -} -func (p pointer) toFloat64Ptr() **float64 { - return (**float64)(p.p) -} -func (p pointer) toFloat64Slice() *[]float64 { - return (*[]float64)(p.p) -} -func (p pointer) toFloat32() *float32 { - return (*float32)(p.p) -} -func (p pointer) toFloat32Ptr() **float32 { - return (**float32)(p.p) -} -func (p pointer) toFloat32Slice() *[]float32 { - return (*[]float32)(p.p) -} -func (p pointer) toString() *string { - return (*string)(p.p) -} -func (p pointer) toStringPtr() **string { - return (**string)(p.p) -} -func (p pointer) toStringSlice() *[]string { - return (*[]string)(p.p) -} -func (p pointer) toBytes() *[]byte { - return (*[]byte)(p.p) -} -func (p pointer) toBytesSlice() *[][]byte { - return (*[][]byte)(p.p) -} -func (p pointer) toExtensions() *XXX_InternalExtensions { - return (*XXX_InternalExtensions)(p.p) -} -func (p pointer) toOldExtensions() *map[int32]Extension { - return (*map[int32]Extension)(p.p) -} - -// getPointerSlice loads []*T from p as a []pointer. -// The value returned is aliased with the original slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) getPointerSlice() []pointer { - // Super-tricky - p should point to a []*T where T is a - // message type. We load it as []pointer. - return *(*[]pointer)(p.p) -} - -// setPointerSlice stores []pointer into p as a []*T. -// The value set is aliased with the input slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) setPointerSlice(v []pointer) { - // Super-tricky - p should point to a []*T where T is a - // message type. We store it as []pointer. - *(*[]pointer)(p.p) = v -} - -// getPointer loads the pointer at p and returns it. -func (p pointer) getPointer() pointer { - return pointer{p: *(*unsafe.Pointer)(p.p)} -} - -// setPointer stores the pointer q at p. -func (p pointer) setPointer(q pointer) { - *(*unsafe.Pointer)(p.p) = q.p -} - -// append q to the slice pointed to by p. -func (p pointer) appendPointer(q pointer) { - s := (*[]unsafe.Pointer)(p.p) - *s = append(*s, q.p) -} - -// getInterfacePointer returns a pointer that points to the -// interface data of the interface pointed by p. -func (p pointer) getInterfacePointer() pointer { - // Super-tricky - read pointer out of data word of interface value. - return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]} -} - -// asPointerTo returns a reflect.Value that is a pointer to an -// object of type t stored at p. -func (p pointer) asPointerTo(t reflect.Type) reflect.Value { - return reflect.NewAt(t, p.p) -} - -func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { - return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { - return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { - return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { - return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} - -// fieldByName is equivalent to reflect.Value.FieldByName, but is able to -// descend into unexported fields for prop -func fieldByName(v reflect.Value, s string) reflect.Value { - if r, _ := utf8.DecodeRuneInString(s); unicode.IsUpper(r) { - return v.FieldByName(s) - } - sf, ok := v.Type().FieldByName(s) - if !ok { - return reflect.Value{} - } - return reflect.NewAt(sf.Type, unsafe.Pointer(v.UnsafeAddr()+sf.Offset)).Elem() -} diff --git a/proto/properties.go b/proto/properties.go index 88f6bb72f1..dcdc2202fa 100644 --- a/proto/properties.go +++ b/proto/properties.go @@ -2,68 +2,97 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build use_golang_protobuf_v1 - package proto import ( + "fmt" "reflect" "strconv" "strings" "sync" -) -// Constants that identify the encoding of a value on the wire. -const ( - WireVarint = 0 - WireFixed32 = 5 - WireFixed64 = 1 - WireBytes = 2 - WireStartGroup = 3 - WireEndGroup = 4 + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/runtime/protoimpl" ) -// StructProperties represents properties for all the fields of a struct. +// StructProperties represents protocol buffer type information for a +// generated protobuf message in the open-struct API. +// +// Deprecated: Do not use. type StructProperties struct { - Prop []*Properties // properties for each field + // Prop are the properties for each field. + // + // Fields belonging to a oneof are stored in OneofTypes instead, with a + // single Properties representing the parent oneof held here. + // + // The order of Prop matches the order of fields in the Go struct. + // Struct fields that are not related to protobufs have a "XXX_" prefix + // in the Properties.Name and must be ignored by the user. + Prop []*Properties // OneofTypes contains information about the oneof fields in this message. - // It is keyed by the original name of a field. + // It is keyed by the protobuf field name. OneofTypes map[string]*OneofProperties } -// OneofProperties represents information about a specific field in a oneof. -type OneofProperties struct { - Type reflect.Type // pointer to generated struct type for this oneof field - Field int // struct field number of the containing oneof in the message - Prop *Properties -} - -func (sp *StructProperties) Len() int { return len(sp.Prop) } -func (sp *StructProperties) Less(i, j int) bool { return false } -func (sp *StructProperties) Swap(i, j int) { return } - -// Properties represents the protocol-specific behavior of a single struct field. +// Properties represents the type information for a protobuf message field. +// +// Deprecated: Do not use. type Properties struct { - Name string // name of the field, for error messages - OrigName string // original name before protocol compiler (always set) - JSONName string // name to use for JSON; determined by protoc - Wire string + // Name is a placeholder name with little meaningful semantic value. + // If the name has an "XXX_" prefix, the entire Properties must be ignored. + Name string + // OrigName is the protobuf field name or oneof name. + OrigName string + // JSONName is the JSON name for the protobuf field. + JSONName string + // Enum is a placeholder name for enums. + // For historical reasons, this is neither the Go name for the enum, + // nor the protobuf name for the enum. + Enum string // Deprecated: Do not use. + // Weak contains the full name of the weakly referenced message. + Weak string + // Wire is a string representation of the wire type. + Wire string + // WireType is the protobuf wire type for the field. WireType int - Tag int + // Tag is the protobuf field number. + Tag int + // Required reports whether this is a required field. Required bool + // Optional reports whether this is a optional field. Optional bool + // Repeated reports whether this is a repeated field. Repeated bool - Packed bool // relevant for repeated primitives only - Enum string // set for enum types only - Proto3 bool // whether this is known to be a proto3 field - Oneof bool // whether this is a oneof field + // Packed reports whether this is a packed repeated field of scalars. + Packed bool + // Proto3 reports whether this field operates under the proto3 syntax. + Proto3 bool + // Oneof reports whether this field belongs within a oneof. + Oneof bool - Default string // default value - HasDefault bool // whether an explicit default was provided + // Default is the default value in string form. + Default string + // HasDefault reports whether the field has a default value. + HasDefault bool - MapKeyProp *Properties // set for map types only - MapValProp *Properties // set for map types only + // MapKeyProp is the properties for the key field for a map field. + MapKeyProp *Properties + // MapValProp is the properties for the value field for a map field. + MapValProp *Properties +} + +// OneofProperties represents the type information for a protobuf oneof. +// +// Deprecated: Do not use. +type OneofProperties struct { + // Type is a pointer to the generated wrapper type for the field value. + // This is nil for messages that are not in the open-struct API. + Type reflect.Type + // Field is the index into StructProperties.Prop for the containing oneof. + Field int + // Prop is the properties for the field. + Prop *Properties } // String formats the properties in the protobuf struct field tag style. @@ -86,15 +115,18 @@ func (p *Properties) String() string { if p.JSONName != "" { s += ",json=" + p.JSONName } + if len(p.Enum) > 0 { + s += ",enum=" + p.Enum + } + if len(p.Weak) > 0 { + s += ",weak=" + p.Weak + } if p.Proto3 { s += ",proto3" } if p.Oneof { s += ",oneof" } - if len(p.Enum) > 0 { - s += ",enum=" + p.Enum - } if p.HasDefault { s += ",def=" + p.Default } @@ -116,6 +148,8 @@ func (p *Properties) Parse(tag string) { p.JSONName = s[len("json="):] case strings.HasPrefix(s, "enum="): p.Enum = s[len("enum="):] + case strings.HasPrefix(s, "weak="): + p.Weak = s[len("weak="):] case strings.Trim(s, "0123456789") == "": n, _ := strconv.ParseUint(s, 10, 32) p.Tag = int(n) @@ -157,11 +191,9 @@ func (p *Properties) Parse(tag string) { } // Init populates the properties from a protocol buffer struct tag. +// +// Deprecated: Do not use. func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.init(typ, name, tag, f) -} - -func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField) { p.Name = name p.OrigName = name if tag == "" { @@ -171,16 +203,19 @@ func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructF if typ != nil && typ.Kind() == reflect.Map { p.MapKeyProp = new(Properties) - p.MapKeyProp.init(nil, "Key", f.Tag.Get("protobuf_key"), nil) + p.MapKeyProp.Init(nil, "Key", f.Tag.Get("protobuf_key"), nil) p.MapValProp = new(Properties) - p.MapValProp.init(nil, "Value", f.Tag.Get("protobuf_val"), nil) + p.MapValProp.Init(nil, "Value", f.Tag.Get("protobuf_val"), nil) } } var propertiesCache sync.Map // map[reflect.Type]*StructProperties -// GetProperties returns the list of properties for the type represented by t. -// t must represent a generated struct type of a protocol message. +// GetProperties returns the list of properties for the type represented by t, +// which must be a generated protocol buffer message in the open-struct API, +// where protobuf message fields are represented by exported Go struct fields. +// +// Deprecated: Use protobuf reflection instead. func GetProperties(t reflect.Type) *StructProperties { if p, ok := propertiesCache.Load(t); ok { return p.(*StructProperties) @@ -191,27 +226,54 @@ func GetProperties(t reflect.Type) *StructProperties { func newProperties(t reflect.Type) *StructProperties { if t.Kind() != reflect.Struct { - panic("proto: type must have kind struct") + panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) } + var hasOneof bool prop := new(StructProperties) // Construct a list of properties for each field in the struct. for i := 0; i < t.NumField(); i++ { p := new(Properties) f := t.Field(i) - p.init(f.Type, f.Name, f.Tag.Get("protobuf"), &f) + tagField := f.Tag.Get("protobuf") + p.Init(f.Type, f.Name, tagField, &f) - if name := f.Tag.Get("protobuf_oneof"); name != "" { - p.OrigName = name + tagOneof := f.Tag.Get("protobuf_oneof") + if tagOneof != "" { + hasOneof = true + p.OrigName = tagOneof } + + // Rename unrelated struct fields with the "XXX_" prefix since so much + // user code simply checks for this to exclude special fields. + if tagField == "" && tagOneof == "" && !strings.HasPrefix(p.Name, "XXX_") { + p.Name = "XXX_" + p.Name + p.OrigName = "XXX_" + p.OrigName + } else if p.Weak != "" { + p.Name = p.OrigName // avoid possible "XXX_" prefix on weak field + } + prop.Prop = append(prop.Prop, p) } // Construct a mapping of oneof field names to properties. - if oneofImplementors := oneofWrappers(t); len(oneofImplementors) > 0 { + if hasOneof { + var oneofWrappers []interface{} + if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofFuncs"); ok { + oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[3].Interface().([]interface{}) + } + if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok { + oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0].Interface().([]interface{}) + } + if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoreflect.ProtoMessage); ok { + if m, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *protoimpl.MessageInfo }); ok { + oneofWrappers = m.ProtoMessageInfo().OneofWrappers + } + } + prop.OneofTypes = make(map[string]*OneofProperties) - for _, wrapper := range oneofImplementors { + for _, wrapper := range oneofWrappers { p := &OneofProperties{ Type: reflect.ValueOf(wrapper).Type(), // *T Prop: new(Properties), @@ -222,15 +284,23 @@ func newProperties(t reflect.Type) *StructProperties { // Determine the struct field that contains this oneof. // Each wrapper is assignable to exactly one parent field. - for i := 0; i < t.NumField(); i++ { + var foundOneof bool + for i := 0; i < t.NumField() && !foundOneof; i++ { if p.Type.AssignableTo(t.Field(i).Type) { p.Field = i - break + foundOneof = true } } + if !foundOneof { + panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) + } prop.OneofTypes[p.Prop.OrigName] = p } } return prop } + +func (sp *StructProperties) Len() int { return len(sp.Prop) } +func (sp *StructProperties) Less(i, j int) bool { return false } +func (sp *StructProperties) Swap(i, j int) { return } diff --git a/proto/properties_alt.go b/proto/properties_alt.go deleted file mode 100644 index 56b8a66d11..0000000000 --- a/proto/properties_alt.go +++ /dev/null @@ -1,33 +0,0 @@ -// 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. - -// +build !use_golang_protobuf_v1 - -package proto - -import ( - "reflect" - - "github.com/golang/protobuf/internal/proto" -) - -// Constants that identify the encoding of a value on the wire. -const ( - WireVarint = 0 - WireFixed64 = 1 - WireBytes = 2 - WireStartGroup = 3 - WireEndGroup = 4 - WireFixed32 = 5 -) - -type ( - Properties = proto.Properties - StructProperties = proto.StructProperties - OneofProperties = proto.OneofProperties -) - -func GetProperties(t reflect.Type) *StructProperties { - return proto.GetProperties(t) -} diff --git a/proto/proto.go b/proto/proto.go new file mode 100644 index 0000000000..65851ca5c4 --- /dev/null +++ b/proto/proto.go @@ -0,0 +1,140 @@ +// 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 provides functionality for handling protocol buffer messages. +// In particular, it provides marshaling and unmarshaling between a protobuf +// message and the binary wire format. +// +// See https://developers.google.com/protocol-buffers/docs/gotutorial for +// more information. +// +// Deprecated: Use the "google.golang.org/protobuf/proto" package instead. +package proto + +import ( + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/runtime/protoiface" + "google.golang.org/protobuf/runtime/protoimpl" +) + +// Message is a protocol buffer message. +type Message = protoiface.MessageV1 + +// Marshaler is implemented by messages that can marshal themselves. +// This interface is used by the following functions: Size, Marshal, +// Buffer.Marshal, and Buffer.EncodeMessage. +// +// Deprecated: Do not implement. +type Marshaler interface { + // Marshal formats the encoded bytes of the message. + // It should be deterministic and emit valid protobuf wire data. + // The caller takes ownership of the returned buffer. + Marshal() ([]byte, error) +} + +// Unmarshaler is implemented by messages that can unmarshal themselves. +// This interface is used by the following functions: Unmarshal, UnmarshalMerge, +// Buffer.Unmarshal, Buffer.DecodeMessage, and Buffer.DecodeGroup. +// +// Deprecated: Do not implement. +type Unmarshaler interface { + // Unmarshal parses the encoded bytes of the protobuf wire input. + // The provided buffer is only valid for during method call. + // It should not reset the receiver message. + Unmarshal([]byte) error +} + +// Merger is implemented by messages that can merge themselves. +// This interface is used by the following functions: Clone and Merge. +// +// Deprecated: Do not implement. +type Merger interface { + // Merge merges the contents of src into the receiver message. + // It clones all data structures in src such that it aliases no mutable + // memory referenced by src. + Merge(src Message) +} + +// RequiredNotSetError is an error type returned when +// marshaling or unmarshaling a message with missing required fields. +type RequiredNotSetError struct { + err error +} + +func (e *RequiredNotSetError) Error() string { + if e.err != nil { + return e.err.Error() + } + return "proto: required field not set" +} +func (e *RequiredNotSetError) RequiredNotSet() bool { + return true +} + +func checkRequiredNotSet(m proto.Message) error { + if err := proto.IsInitialized(m); err != nil { + return &RequiredNotSetError{err: err} + } + return nil +} + +// Clone returns a deep copy of src. +func Clone(src Message) Message { + srcMsg := protoimpl.X.MessageOf(src) + if srcMsg == nil || !srcMsg.IsValid() { + return src + } + + dst := protoimpl.X.ProtoMessageV1Of(srcMsg.New().Interface()) + Merge(dst, src) + return dst +} + +// Merge merges src into dst, which must be messages of the same type. +// +// Populated scalar fields in src are copied to dst, while populated +// singular messages in src are merged into dst by recursively calling Merge. +// The elements of every list field in src is appended to the corresponded +// list fields in dst. The entries of every map field in src is copied into +// the corresponding map field in dst, possibly replacing existing entries. +// The unknown fields of src are appended to the unknown fields of dst. +func Merge(dst, src Message) { + // TODO: Drop this type assertion if the aberrant wrapper in v2 calls this. + if m, ok := dst.(Merger); ok { + m.Merge(src) + return + } + proto.Merge( + protoimpl.X.ProtoMessageV2Of(dst), + protoimpl.X.ProtoMessageV2Of(src), + ) +} + +// Equal reports whether two messages are equal. +// If two messages marshal to the same bytes under deterministic serialization, +// then Equal is guaranteed to report true. +// +// Two messages are equal if they are the same protobuf message type, +// have the same set of populated known and extension field values, +// and the same set of unknown fields values. +// +// Scalar values are compared with the equivalent of the == operator in Go, +// except bytes values which are compared using bytes.Equal and +// floating point values which specially treat NaNs as equal. +// Message values are compared by recursively calling Equal. +// Lists are equal if each element value is also equal. +// Maps are equal if they have the same set of keys, where the pair of values +// for each key is also equal. +func Equal(x, y Message) bool { + return proto.Equal( + protoimpl.X.ProtoMessageV2Of(x), + protoimpl.X.ProtoMessageV2Of(y), + ) +} + +func isMessageSet(md protoreflect.MessageDescriptor) bool { + ms, ok := md.(interface{ IsMessageSet() bool }) + return ok && ms.IsMessageSet() +} diff --git a/proto/proto3_proto/proto3.proto b/proto/proto3_proto/proto3.proto deleted file mode 100644 index a6341481ed..0000000000 --- a/proto/proto3_proto/proto3.proto +++ /dev/null @@ -1,99 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2014 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. - -syntax = "proto3"; - -option go_package = "github.com/golang/protobuf/proto/proto3_proto"; - -import "google/protobuf/any.proto"; -import "test_proto/test.proto"; - -package proto3_proto; - -message Message { - enum Humour { - UNKNOWN = 0; - PUNS = 1; - SLAPSTICK = 2; - BILL_BAILEY = 3; - } - - string name = 1; - Humour hilarity = 2; - uint32 height_in_cm = 3; - bytes data = 4; - int64 result_count = 7; - bool true_scotsman = 8; - float score = 9; - - repeated uint64 key = 5; - repeated int32 short_key = 19; - Nested nested = 6; - repeated Humour r_funny = 16; - - map terrain = 10; - test_proto.SubDefaults proto2_field = 11; - map proto2_value = 13; - - google.protobuf.Any anything = 14; - repeated google.protobuf.Any many_things = 15; - - Message submessage = 17; - repeated Message children = 18; - - map string_map = 20; -} - -message Nested { - string bunny = 1; - bool cute = 2; -} - -message MessageWithMap { - map byte_mapping = 1; -} - - -message IntMap { - map rtt = 1; -} - -message IntMaps { - repeated IntMap maps = 1; -} - -message TestUTF8 { - string scalar = 1; - repeated string vector = 2; - oneof oneof { string field = 3; } - map map_key = 4; - map map_value = 5; -} diff --git a/proto/proto3_test.go b/proto/proto3_test.go deleted file mode 100644 index 943ca20326..0000000000 --- a/proto/proto3_test.go +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2014 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_test - -import ( - "bytes" - "testing" - - "github.com/golang/protobuf/proto" - pb "github.com/golang/protobuf/proto/proto3_proto" - tpb "github.com/golang/protobuf/proto/test_proto" -) - -func TestProto3ZeroValues(t *testing.T) { - tests := []struct { - desc string - m proto.Message - }{ - {"zero message", &pb.Message{}}, - {"empty bytes field", &pb.Message{Data: []byte{}}}, - } - for _, test := range tests { - b, err := proto.Marshal(test.m) - if err != nil { - t.Errorf("%s: proto.Marshal: %v", test.desc, err) - continue - } - if len(b) > 0 { - t.Errorf("%s: Encoding is non-empty: %q", test.desc, b) - } - } -} - -func TestRoundTripProto3(t *testing.T) { - m := &pb.Message{ - Name: "David", // (2 | 1<<3): 0x0a 0x05 "David" - Hilarity: pb.Message_PUNS, // (0 | 2<<3): 0x10 0x01 - HeightInCm: 178, // (0 | 3<<3): 0x18 0xb2 0x01 - Data: []byte("roboto"), // (2 | 4<<3): 0x20 0x06 "roboto" - ResultCount: 47, // (0 | 7<<3): 0x38 0x2f - TrueScotsman: true, // (0 | 8<<3): 0x40 0x01 - Score: 8.1, // (5 | 9<<3): 0x4d <8.1> - - Key: []uint64{1, 0xdeadbeef}, - Nested: &pb.Nested{ - Bunny: "Monty", - }, - } - t.Logf(" m: %v", m) - - b, err := proto.Marshal(m) - if err != nil { - t.Fatalf("proto.Marshal: %v", err) - } - t.Logf(" b: %q", b) - - m2 := new(pb.Message) - if err := proto.Unmarshal(b, m2); err != nil { - t.Fatalf("proto.Unmarshal: %v", err) - } - t.Logf("m2: %v", m2) - - if !proto.Equal(m, m2) { - t.Errorf("proto.Equal returned false:\n m: %v\nm2: %v", m, m2) - } -} - -func TestGettersForBasicTypesExist(t *testing.T) { - var m pb.Message - if got := m.GetNested().GetBunny(); got != "" { - t.Errorf("m.GetNested().GetBunny() = %q, want empty string", got) - } - if got := m.GetNested().GetCute(); got { - t.Errorf("m.GetNested().GetCute() = %t, want false", got) - } -} - -func TestProto3SetDefaults(t *testing.T) { - in := &pb.Message{ - Terrain: map[string]*pb.Nested{ - "meadow": new(pb.Nested), - }, - Proto2Field: new(tpb.SubDefaults), - Proto2Value: map[string]*tpb.SubDefaults{ - "badlands": new(tpb.SubDefaults), - }, - } - - got := proto.Clone(in).(*pb.Message) - proto.SetDefaults(got) - - // There are no defaults in proto3. Everything should be the zero value, but - // we need to remember to set defaults for nested proto2 messages. - want := &pb.Message{ - Terrain: map[string]*pb.Nested{ - "meadow": new(pb.Nested), - }, - Proto2Field: &tpb.SubDefaults{N: proto.Int64(7)}, - Proto2Value: map[string]*tpb.SubDefaults{ - "badlands": &tpb.SubDefaults{N: proto.Int64(7)}, - }, - } - - if !proto.Equal(got, want) { - t.Errorf("with in = %v\nproto.SetDefaults(in) =>\ngot %v\nwant %v", in, got, want) - } -} - -func TestUnknownFieldPreservation(t *testing.T) { - b1 := "\x0a\x05David" // Known tag 1 - b2 := "\xc2\x0c\x06Google" // Unknown tag 200 - b := []byte(b1 + b2) - - m := new(pb.Message) - if err := proto.Unmarshal(b, m); err != nil { - t.Fatalf("proto.Unmarshal: %v", err) - } - - if !bytes.Equal(m.XXX_unrecognized, []byte(b2)) { - t.Fatalf("mismatching unknown fields:\ngot %q\nwant %q", m.XXX_unrecognized, b2) - } -} diff --git a/proto/clone_test.go b/proto/proto_clone_test.go similarity index 55% rename from proto/clone_test.go rename to proto/proto_clone_test.go index d83a058a77..d9ae24f1b1 100644 --- a/proto/clone_test.go +++ b/proto/proto_clone_test.go @@ -9,48 +9,48 @@ import ( "github.com/golang/protobuf/proto" - proto3pb "github.com/golang/protobuf/proto/proto3_proto" - pb "github.com/golang/protobuf/proto/test_proto" + pb2 "github.com/golang/protobuf/internal/testprotos/proto2_proto" + pb3 "github.com/golang/protobuf/internal/testprotos/proto3_proto" ) -var cloneTestMessage = &pb.MyMessage{ +var cloneTestMessage = &pb2.MyMessage{ Count: proto.Int32(42), Name: proto.String("Dave"), Pet: []string{"bunny", "kitty", "horsey"}, - Inner: &pb.InnerMessage{ + Inner: &pb2.InnerMessage{ Host: proto.String("niles"), Port: proto.Int32(9099), Connected: proto.Bool(true), }, - Others: []*pb.OtherMessage{ + Others: []*pb2.OtherMessage{ { Value: []byte("some bytes"), }, }, - Somegroup: &pb.MyMessage_SomeGroup{ + Somegroup: &pb2.MyMessage_SomeGroup{ GroupField: proto.Int32(6), }, RepBytes: [][]byte{[]byte("sham"), []byte("wow")}, } func init() { - ext := &pb.Ext{ + ext := &pb2.Ext{ Data: proto.String("extension"), } - if err := proto.SetExtension(cloneTestMessage, pb.E_Ext_More, ext); err != nil { + if err := proto.SetExtension(cloneTestMessage, pb2.E_Ext_More, ext); err != nil { panic("SetExtension: " + err.Error()) } - if err := proto.SetExtension(cloneTestMessage, pb.E_Ext_Text, proto.String("hello")); err != nil { + if err := proto.SetExtension(cloneTestMessage, pb2.E_Ext_Text, proto.String("hello")); err != nil { panic("SetExtension: " + err.Error()) } - if err := proto.SetExtension(cloneTestMessage, pb.E_Greeting, []string{"one", "two"}); err != nil { + if err := proto.SetExtension(cloneTestMessage, pb2.E_Greeting, []string{"one", "two"}); err != nil { panic("SetExtension: " + err.Error()) } } func TestClone(t *testing.T) { // Create a clone using a marshal/unmarshal roundtrip. - vanilla := new(pb.MyMessage) + vanilla := new(pb2.MyMessage) b, err := proto.Marshal(cloneTestMessage) if err != nil { t.Errorf("unexpected Marshal error: %v", err) @@ -60,26 +60,26 @@ func TestClone(t *testing.T) { } // Create a clone using Clone and verify that it is equal to the original. - m := proto.Clone(cloneTestMessage).(*pb.MyMessage) + m := proto.Clone(cloneTestMessage).(*pb2.MyMessage) if !proto.Equal(m, cloneTestMessage) { t.Fatalf("Clone(%v) = %v", cloneTestMessage, m) } // Mutate the clone, which should not affect the original. - x1, err := proto.GetExtension(m, pb.E_Ext_More) + x1, err := proto.GetExtension(m, pb2.E_Ext_More) if err != nil { - t.Errorf("unexpected GetExtension(%v) error: %v", pb.E_Ext_More.Name, err) + t.Errorf("unexpected GetExtension(%v) error: %v", pb2.E_Ext_More.Name, err) } - x2, err := proto.GetExtension(m, pb.E_Ext_Text) + x2, err := proto.GetExtension(m, pb2.E_Ext_Text) if err != nil { - t.Errorf("unexpected GetExtension(%v) error: %v", pb.E_Ext_Text.Name, err) + t.Errorf("unexpected GetExtension(%v) error: %v", pb2.E_Ext_Text.Name, err) } - x3, err := proto.GetExtension(m, pb.E_Greeting) + x3, err := proto.GetExtension(m, pb2.E_Greeting) if err != nil { - t.Errorf("unexpected GetExtension(%v) error: %v", pb.E_Greeting.Name, err) + t.Errorf("unexpected GetExtension(%v) error: %v", pb2.E_Greeting.Name, err) } *m.Inner.Port++ - *(x1.(*pb.Ext)).Data = "blah blah" + *(x1.(*pb2.Ext)).Data = "blah blah" *(x2.(*string)) = "goodbye" x3.([]string)[0] = "zero" if !proto.Equal(cloneTestMessage, vanilla) { @@ -88,7 +88,7 @@ func TestClone(t *testing.T) { } func TestCloneNil(t *testing.T) { - var m *pb.MyMessage + var m *pb2.MyMessage if c := proto.Clone(m); !proto.Equal(m, c) { t.Errorf("Clone(%v) = %v", m, c) } @@ -98,37 +98,37 @@ var mergeTests = []struct { src, dst, want proto.Message }{ { - src: &pb.MyMessage{ + src: &pb2.MyMessage{ Count: proto.Int32(42), }, - dst: &pb.MyMessage{ + dst: &pb2.MyMessage{ Name: proto.String("Dave"), }, - want: &pb.MyMessage{ + want: &pb2.MyMessage{ Count: proto.Int32(42), Name: proto.String("Dave"), }, }, { - src: &pb.MyMessage{ - Inner: &pb.InnerMessage{ + src: &pb2.MyMessage{ + Inner: &pb2.InnerMessage{ Host: proto.String("hey"), Connected: proto.Bool(true), }, Pet: []string{"horsey"}, - Others: []*pb.OtherMessage{ + Others: []*pb2.OtherMessage{ { Value: []byte("some bytes"), }, }, }, - dst: &pb.MyMessage{ - Inner: &pb.InnerMessage{ + dst: &pb2.MyMessage{ + Inner: &pb2.InnerMessage{ Host: proto.String("niles"), Port: proto.Int32(9099), }, Pet: []string{"bunny", "kitty"}, - Others: []*pb.OtherMessage{ + Others: []*pb2.OtherMessage{ { Key: proto.Int64(31415926535), }, @@ -138,14 +138,14 @@ var mergeTests = []struct { }, }, }, - want: &pb.MyMessage{ - Inner: &pb.InnerMessage{ + want: &pb2.MyMessage{ + Inner: &pb2.InnerMessage{ Host: proto.String("hey"), Connected: proto.Bool(true), Port: proto.Int32(9099), }, Pet: []string{"bunny", "kitty", "horsey"}, - Others: []*pb.OtherMessage{ + Others: []*pb2.OtherMessage{ { Key: proto.Int64(31415926535), }, @@ -157,17 +157,17 @@ var mergeTests = []struct { }, }, { - src: &pb.MyMessage{ + src: &pb2.MyMessage{ RepBytes: [][]byte{[]byte("wow")}, }, - dst: &pb.MyMessage{ - Somegroup: &pb.MyMessage_SomeGroup{ + dst: &pb2.MyMessage{ + Somegroup: &pb2.MyMessage_SomeGroup{ GroupField: proto.Int32(6), }, RepBytes: [][]byte{[]byte("sham")}, }, - want: &pb.MyMessage{ - Somegroup: &pb.MyMessage_SomeGroup{ + want: &pb2.MyMessage{ + Somegroup: &pb2.MyMessage_SomeGroup{ GroupField: proto.Int32(6), }, RepBytes: [][]byte{[]byte("sham"), []byte("wow")}, @@ -175,41 +175,41 @@ var mergeTests = []struct { }, // Check that a scalar bytes field replaces rather than appends. { - src: &pb.OtherMessage{Value: []byte("foo")}, - dst: &pb.OtherMessage{Value: []byte("bar")}, - want: &pb.OtherMessage{Value: []byte("foo")}, + src: &pb2.OtherMessage{Value: []byte("foo")}, + dst: &pb2.OtherMessage{Value: []byte("bar")}, + want: &pb2.OtherMessage{Value: []byte("foo")}, }, { - src: &pb.MessageWithMap{ + src: &pb2.MessageWithMap{ NameMapping: map[int32]string{6: "Nigel"}, - MsgMapping: map[int64]*pb.FloatingPoint{ - 0x4001: &pb.FloatingPoint{F: proto.Float64(2.0)}, - 0x4002: &pb.FloatingPoint{ + MsgMapping: map[int64]*pb2.FloatingPoint{ + 0x4001: &pb2.FloatingPoint{F: proto.Float64(2.0)}, + 0x4002: &pb2.FloatingPoint{ F: proto.Float64(2.0), }, }, ByteMapping: map[bool][]byte{true: []byte("wowsa")}, }, - dst: &pb.MessageWithMap{ + dst: &pb2.MessageWithMap{ NameMapping: map[int32]string{ 6: "Bruce", // should be overwritten 7: "Andrew", }, - MsgMapping: map[int64]*pb.FloatingPoint{ - 0x4002: &pb.FloatingPoint{ + MsgMapping: map[int64]*pb2.FloatingPoint{ + 0x4002: &pb2.FloatingPoint{ F: proto.Float64(3.0), Exact: proto.Bool(true), }, // the entire message should be overwritten }, }, - want: &pb.MessageWithMap{ + want: &pb2.MessageWithMap{ NameMapping: map[int32]string{ 6: "Nigel", 7: "Andrew", }, - MsgMapping: map[int64]*pb.FloatingPoint{ - 0x4001: &pb.FloatingPoint{F: proto.Float64(2.0)}, - 0x4002: &pb.FloatingPoint{ + MsgMapping: map[int64]*pb2.FloatingPoint{ + 0x4001: &pb2.FloatingPoint{F: proto.Float64(2.0)}, + 0x4002: &pb2.FloatingPoint{ F: proto.Float64(2.0), }, }, @@ -219,83 +219,83 @@ var mergeTests = []struct { // proto3 shouldn't merge zero values, // in the same way that proto2 shouldn't merge nils. { - src: &proto3pb.Message{ + src: &pb3.Message{ Name: "Aaron", Data: []byte(""), // zero value, but not nil }, - dst: &proto3pb.Message{ + dst: &pb3.Message{ HeightInCm: 176, Data: []byte("texas!"), }, - want: &proto3pb.Message{ + want: &pb3.Message{ Name: "Aaron", HeightInCm: 176, Data: []byte("texas!"), }, }, { // Oneof fields should merge by assignment. - src: &pb.Communique{Union: &pb.Communique_Number{41}}, - dst: &pb.Communique{Union: &pb.Communique_Name{"Bobby Tables"}}, - want: &pb.Communique{Union: &pb.Communique_Number{41}}, + src: &pb2.Communique{Union: &pb2.Communique_Number{41}}, + dst: &pb2.Communique{Union: &pb2.Communique_Name{"Bobby Tables"}}, + want: &pb2.Communique{Union: &pb2.Communique_Number{41}}, }, { // Oneof nil is the same as not set. - src: &pb.Communique{}, - dst: &pb.Communique{Union: &pb.Communique_Name{"Bobby Tables"}}, - want: &pb.Communique{Union: &pb.Communique_Name{"Bobby Tables"}}, + src: &pb2.Communique{}, + dst: &pb2.Communique{Union: &pb2.Communique_Name{"Bobby Tables"}}, + want: &pb2.Communique{Union: &pb2.Communique_Name{"Bobby Tables"}}, }, { - src: &pb.Communique{Union: &pb.Communique_Number{1337}}, - dst: &pb.Communique{}, - want: &pb.Communique{Union: &pb.Communique_Number{1337}}, + src: &pb2.Communique{Union: &pb2.Communique_Number{1337}}, + dst: &pb2.Communique{}, + want: &pb2.Communique{Union: &pb2.Communique_Number{1337}}, }, { - src: &pb.Communique{Union: &pb.Communique_Col{pb.MyMessage_RED}}, - dst: &pb.Communique{}, - want: &pb.Communique{Union: &pb.Communique_Col{pb.MyMessage_RED}}, + src: &pb2.Communique{Union: &pb2.Communique_Col{pb2.MyMessage_RED}}, + dst: &pb2.Communique{}, + want: &pb2.Communique{Union: &pb2.Communique_Col{pb2.MyMessage_RED}}, }, { - src: &pb.Communique{Union: &pb.Communique_Data{[]byte("hello")}}, - dst: &pb.Communique{}, - want: &pb.Communique{Union: &pb.Communique_Data{[]byte("hello")}}, + src: &pb2.Communique{Union: &pb2.Communique_Data{[]byte("hello")}}, + dst: &pb2.Communique{}, + want: &pb2.Communique{Union: &pb2.Communique_Data{[]byte("hello")}}, }, { - src: &pb.Communique{Union: &pb.Communique_Msg{&pb.Strings{BytesField: []byte{1, 2, 3}}}}, - dst: &pb.Communique{}, - want: &pb.Communique{Union: &pb.Communique_Msg{&pb.Strings{BytesField: []byte{1, 2, 3}}}}, + src: &pb2.Communique{Union: &pb2.Communique_Msg{&pb2.Strings{BytesField: []byte{1, 2, 3}}}}, + dst: &pb2.Communique{}, + want: &pb2.Communique{Union: &pb2.Communique_Msg{&pb2.Strings{BytesField: []byte{1, 2, 3}}}}, }, { - src: &pb.Communique{Union: &pb.Communique_Msg{}}, - dst: &pb.Communique{}, - want: &pb.Communique{Union: &pb.Communique_Msg{}}, + src: &pb2.Communique{Union: &pb2.Communique_Msg{}}, + dst: &pb2.Communique{}, + want: &pb2.Communique{Union: &pb2.Communique_Msg{}}, }, { - src: &pb.Communique{Union: &pb.Communique_Msg{&pb.Strings{StringField: proto.String("123")}}}, - dst: &pb.Communique{Union: &pb.Communique_Msg{&pb.Strings{BytesField: []byte{1, 2, 3}}}}, - want: &pb.Communique{Union: &pb.Communique_Msg{&pb.Strings{StringField: proto.String("123"), BytesField: []byte{1, 2, 3}}}}, + src: &pb2.Communique{Union: &pb2.Communique_Msg{&pb2.Strings{StringField: proto.String("123")}}}, + dst: &pb2.Communique{Union: &pb2.Communique_Msg{&pb2.Strings{BytesField: []byte{1, 2, 3}}}}, + want: &pb2.Communique{Union: &pb2.Communique_Msg{&pb2.Strings{StringField: proto.String("123"), BytesField: []byte{1, 2, 3}}}}, }, { - src: &proto3pb.Message{ - Terrain: map[string]*proto3pb.Nested{ - "kay_a": &proto3pb.Nested{Cute: true}, // replace - "kay_b": &proto3pb.Nested{Bunny: "rabbit"}, // insert + src: &pb3.Message{ + Terrain: map[string]*pb3.Nested{ + "kay_a": &pb3.Nested{Cute: true}, // replace + "kay_b": &pb3.Nested{Bunny: "rabbit"}, // insert }, }, - dst: &proto3pb.Message{ - Terrain: map[string]*proto3pb.Nested{ - "kay_a": &proto3pb.Nested{Bunny: "lost"}, // replaced - "kay_c": &proto3pb.Nested{Bunny: "bunny"}, // keep + dst: &pb3.Message{ + Terrain: map[string]*pb3.Nested{ + "kay_a": &pb3.Nested{Bunny: "lost"}, // replaced + "kay_c": &pb3.Nested{Bunny: "bunny"}, // keep }, }, - want: &proto3pb.Message{ - Terrain: map[string]*proto3pb.Nested{ - "kay_a": &proto3pb.Nested{Cute: true}, - "kay_b": &proto3pb.Nested{Bunny: "rabbit"}, - "kay_c": &proto3pb.Nested{Bunny: "bunny"}, + want: &pb3.Message{ + Terrain: map[string]*pb3.Nested{ + "kay_a": &pb3.Nested{Cute: true}, + "kay_b": &pb3.Nested{Bunny: "rabbit"}, + "kay_c": &pb3.Nested{Bunny: "bunny"}, }, }, }, { - src: &pb.GoTest{ + src: &pb2.GoTest{ F_BoolRepeated: []bool{}, F_Int32Repeated: []int32{}, F_Int64Repeated: []int64{}, @@ -306,8 +306,8 @@ var mergeTests = []struct { F_StringRepeated: []string{}, F_BytesRepeated: [][]byte{}, }, - dst: &pb.GoTest{}, - want: &pb.GoTest{ + dst: &pb2.GoTest{}, + want: &pb2.GoTest{ F_BoolRepeated: []bool{}, F_Int32Repeated: []int32{}, F_Int64Repeated: []int64{}, @@ -320,8 +320,8 @@ var mergeTests = []struct { }, }, { - src: &pb.GoTest{}, - dst: &pb.GoTest{ + src: &pb2.GoTest{}, + dst: &pb2.GoTest{ F_BoolRepeated: []bool{}, F_Int32Repeated: []int32{}, F_Int64Repeated: []int64{}, @@ -332,7 +332,7 @@ var mergeTests = []struct { F_StringRepeated: []string{}, F_BytesRepeated: [][]byte{}, }, - want: &pb.GoTest{ + want: &pb2.GoTest{ F_BoolRepeated: []bool{}, F_Int32Repeated: []int32{}, F_Int64Repeated: []int64{}, @@ -345,21 +345,21 @@ var mergeTests = []struct { }, }, { - src: &pb.GoTest{ + src: &pb2.GoTest{ F_BytesRepeated: [][]byte{nil, []byte{}, []byte{0}}, }, - dst: &pb.GoTest{}, - want: &pb.GoTest{ + dst: &pb2.GoTest{}, + want: &pb2.GoTest{ F_BytesRepeated: [][]byte{nil, []byte{}, []byte{0}}, }, }, { - src: &pb.MyMessage{ - Others: []*pb.OtherMessage{}, + src: &pb2.MyMessage{ + Others: []*pb2.OtherMessage{}, }, - dst: &pb.MyMessage{}, - want: &pb.MyMessage{ - Others: []*pb.OtherMessage{}, + dst: &pb2.MyMessage{}, + want: &pb2.MyMessage{ + Others: []*pb2.OtherMessage{}, }, }, } diff --git a/proto/proto_equal_test.go b/proto/proto_equal_test.go new file mode 100644 index 0000000000..d5b2541a0e --- /dev/null +++ b/proto/proto_equal_test.go @@ -0,0 +1,218 @@ +// Copyright 2011 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_test + +import ( + "testing" + + "github.com/golang/protobuf/proto" + + pb2 "github.com/golang/protobuf/internal/testprotos/proto2_proto" + pb3 "github.com/golang/protobuf/internal/testprotos/proto3_proto" +) + +// Four identical base messages. +// The init function adds extensions to some of them. +var messageWithoutExtension = &pb2.MyMessage{Count: proto.Int32(7)} +var messageWithExtension1a = &pb2.MyMessage{Count: proto.Int32(7)} +var messageWithExtension1b = &pb2.MyMessage{Count: proto.Int32(7)} +var messageWithExtension2 = &pb2.MyMessage{Count: proto.Int32(7)} +var messageWithExtension3a = &pb2.MyMessage{Count: proto.Int32(7)} +var messageWithExtension3b = &pb2.MyMessage{Count: proto.Int32(7)} +var messageWithExtension3c = &pb2.MyMessage{Count: proto.Int32(7)} + +// Two messages with non-message extensions. +var messageWithInt32Extension1 = &pb2.MyMessage{Count: proto.Int32(8)} +var messageWithInt32Extension2 = &pb2.MyMessage{Count: proto.Int32(8)} + +func init() { + ext1 := &pb2.Ext{Data: proto.String("Kirk")} + ext2 := &pb2.Ext{Data: proto.String("Picard")} + + // messageWithExtension1a has ext1, but never marshals it. + if err := proto.SetExtension(messageWithExtension1a, pb2.E_Ext_More, ext1); err != nil { + panic("proto.SetExtension on 1a failed: " + err.Error()) + } + + // messageWithExtension1b is the unmarshaled form of messageWithExtension1a. + if err := proto.SetExtension(messageWithExtension1b, pb2.E_Ext_More, ext1); err != nil { + panic("proto.SetExtension on 1b failed: " + err.Error()) + } + buf, err := proto.Marshal(messageWithExtension1b) + if err != nil { + panic("proto.Marshal of 1b failed: " + err.Error()) + } + messageWithExtension1b.Reset() + if err := proto.Unmarshal(buf, messageWithExtension1b); err != nil { + panic("proto.Unmarshal of 1b failed: " + err.Error()) + } + + // messageWithExtension2 has ext2. + if err := proto.SetExtension(messageWithExtension2, pb2.E_Ext_More, ext2); err != nil { + panic("proto.SetExtension on 2 failed: " + err.Error()) + } + + if err := proto.SetExtension(messageWithInt32Extension1, pb2.E_Ext_Number, proto.Int32(23)); err != nil { + panic("proto.SetExtension on Int32-1 failed: " + err.Error()) + } + if err := proto.SetExtension(messageWithInt32Extension1, pb2.E_Ext_Number, proto.Int32(24)); err != nil { + panic("proto.SetExtension on Int32-2 failed: " + err.Error()) + } + + // messageWithExtension3{a,b,c} has unregistered extension. + if proto.RegisteredExtensions(messageWithExtension3a)[200] != nil { + panic("expect extension 200 unregistered") + } + bytes := []byte{ + 0xc0, 0x0c, 0x01, // id=200, wiretype=0 (varint), data=1 + } + bytes2 := []byte{ + 0xc0, 0x0c, 0x02, // id=200, wiretype=0 (varint), data=2 + } + proto.SetRawExtension(messageWithExtension3a, 200, bytes) + proto.SetRawExtension(messageWithExtension3b, 200, bytes) + proto.SetRawExtension(messageWithExtension3c, 200, bytes2) +} + +var EqualTests = []struct { + desc string + a, b proto.Message + exp bool +}{ + {"different types", &pb2.GoEnum{}, &pb2.GoTestField{}, false}, + {"equal empty", &pb2.GoEnum{}, &pb2.GoEnum{}, true}, + {"nil vs nil", nil, nil, true}, + {"typed nil vs typed nil", (*pb2.GoEnum)(nil), (*pb2.GoEnum)(nil), true}, + {"typed nil vs empty", (*pb2.GoEnum)(nil), &pb2.GoEnum{}, false}, + {"different typed nil", (*pb2.GoEnum)(nil), (*pb2.GoTestField)(nil), false}, + + {"one set field, one unset field", &pb2.GoTestField{Label: proto.String("foo")}, &pb2.GoTestField{}, false}, + {"one set field zero, one unset field", &pb2.GoTest{Param: proto.Int32(0)}, &pb2.GoTest{}, false}, + {"different set fields", &pb2.GoTestField{Label: proto.String("foo")}, &pb2.GoTestField{Label: proto.String("bar")}, false}, + {"equal set", &pb2.GoTestField{Label: proto.String("foo")}, &pb2.GoTestField{Label: proto.String("foo")}, true}, + + {"repeated, one set", &pb2.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb2.GoTest{}, false}, + {"repeated, different length", &pb2.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb2.GoTest{F_Int32Repeated: []int32{2}}, false}, + {"repeated, different value", &pb2.GoTest{F_Int32Repeated: []int32{2}}, &pb2.GoTest{F_Int32Repeated: []int32{3}}, false}, + {"repeated, equal", &pb2.GoTest{F_Int32Repeated: []int32{2, 4}}, &pb2.GoTest{F_Int32Repeated: []int32{2, 4}}, true}, + {"repeated, nil equal nil", &pb2.GoTest{F_Int32Repeated: nil}, &pb2.GoTest{F_Int32Repeated: nil}, true}, + {"repeated, nil equal empty", &pb2.GoTest{F_Int32Repeated: nil}, &pb2.GoTest{F_Int32Repeated: []int32{}}, true}, + {"repeated, empty equal nil", &pb2.GoTest{F_Int32Repeated: []int32{}}, &pb2.GoTest{F_Int32Repeated: nil}, true}, + + { + "nested, different", + &pb2.GoTest{RequiredField: &pb2.GoTestField{Label: proto.String("foo")}}, + &pb2.GoTest{RequiredField: &pb2.GoTestField{Label: proto.String("bar")}}, + false, + }, + { + "nested, equal", + &pb2.GoTest{RequiredField: &pb2.GoTestField{Label: proto.String("wow")}}, + &pb2.GoTest{RequiredField: &pb2.GoTestField{Label: proto.String("wow")}}, + true, + }, + + {"bytes", &pb2.OtherMessage{Value: []byte("foo")}, &pb2.OtherMessage{Value: []byte("foo")}, true}, + {"bytes, empty", &pb2.OtherMessage{Value: []byte{}}, &pb2.OtherMessage{Value: []byte{}}, true}, + {"bytes, empty vs nil", &pb2.OtherMessage{Value: []byte{}}, &pb2.OtherMessage{Value: nil}, false}, + { + "repeated bytes", + &pb2.MyMessage{RepBytes: [][]byte{[]byte("sham"), []byte("wow")}}, + &pb2.MyMessage{RepBytes: [][]byte{[]byte("sham"), []byte("wow")}}, + true, + }, + // In proto3, []byte{} and []byte(nil) are equal. + {"proto3 bytes, empty vs nil", &pb3.Message{Data: []byte{}}, &pb3.Message{Data: nil}, true}, + + {"extension vs. no extension", messageWithoutExtension, messageWithExtension1a, false}, + {"extension vs. same extension", messageWithExtension1a, messageWithExtension1b, true}, + {"extension vs. different extension", messageWithExtension1a, messageWithExtension2, false}, + + {"int32 extension vs. itself", messageWithInt32Extension1, messageWithInt32Extension1, true}, + {"int32 extension vs. a different int32", messageWithInt32Extension1, messageWithInt32Extension2, false}, + + {"unregistered extension same", messageWithExtension3a, messageWithExtension3b, true}, + {"unregistered extension different", messageWithExtension3a, messageWithExtension3c, false}, + + { + "message with group", + &pb2.MyMessage{ + Count: proto.Int32(1), + Somegroup: &pb2.MyMessage_SomeGroup{ + GroupField: proto.Int32(5), + }, + }, + &pb2.MyMessage{ + Count: proto.Int32(1), + Somegroup: &pb2.MyMessage_SomeGroup{ + GroupField: proto.Int32(5), + }, + }, + true, + }, + + { + "map same", + &pb2.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}}, + &pb2.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}}, + true, + }, + { + "map different entry", + &pb2.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}}, + &pb2.MessageWithMap{NameMapping: map[int32]string{2: "Rob"}}, + false, + }, + { + "map different key only", + &pb2.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}}, + &pb2.MessageWithMap{NameMapping: map[int32]string{2: "Ken"}}, + false, + }, + { + "map different value only", + &pb2.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}}, + &pb2.MessageWithMap{NameMapping: map[int32]string{1: "Rob"}}, + false, + }, + { + "zero-length maps same", + &pb2.MessageWithMap{NameMapping: map[int32]string{}}, + &pb2.MessageWithMap{NameMapping: nil}, + true, + }, + { + "orders in map don't matter", + &pb2.MessageWithMap{NameMapping: map[int32]string{1: "Ken", 2: "Rob"}}, + &pb2.MessageWithMap{NameMapping: map[int32]string{2: "Rob", 1: "Ken"}}, + true, + }, + { + "oneof same", + &pb2.Communique{Union: &pb2.Communique_Number{41}}, + &pb2.Communique{Union: &pb2.Communique_Number{41}}, + true, + }, + { + "oneof one nil", + &pb2.Communique{Union: &pb2.Communique_Number{41}}, + &pb2.Communique{}, + false, + }, + { + "oneof different", + &pb2.Communique{Union: &pb2.Communique_Number{41}}, + &pb2.Communique{Union: &pb2.Communique_Name{"Bobby Tables"}}, + false, + }, +} + +func TestEqual(t *testing.T) { + for _, tc := range EqualTests { + if res := proto.Equal(tc.a, tc.b); res != tc.exp { + t.Errorf("%v: Equal(%v, %v) = %v, want %v", tc.desc, tc.a, tc.b, res, tc.exp) + } + } +} diff --git a/proto/all_test.go b/proto/proto_test.go similarity index 69% rename from proto/all_test.go rename to proto/proto_test.go index 2c8e3aadc0..be702c6f37 100644 --- a/proto/all_test.go +++ b/proto/proto_test.go @@ -18,17 +18,18 @@ import ( "testing" "time" - . "github.com/golang/protobuf/proto" - pb3 "github.com/golang/protobuf/proto/proto3_proto" - . "github.com/golang/protobuf/proto/test_proto" - tpb "google.golang.org/protobuf/types/known/timestamppb" + "github.com/golang/protobuf/proto" + + pb2 "github.com/golang/protobuf/internal/testprotos/proto2_proto" + pb3 "github.com/golang/protobuf/internal/testprotos/proto3_proto" + tspb "github.com/golang/protobuf/ptypes/timestamp" ) -var globalO *Buffer +var globalO *proto.Buffer -func old() *Buffer { +func old() *proto.Buffer { if globalO == nil { - globalO = NewBuffer(nil) + globalO = proto.NewBuffer(nil) } globalO.Reset() return globalO @@ -46,71 +47,71 @@ func equalbytes(b1, b2 []byte, t *testing.T) { } } -func initGoTestField() *GoTestField { - f := new(GoTestField) - f.Label = String("label") - f.Type = String("type") +func initGoTestField() *pb2.GoTestField { + f := new(pb2.GoTestField) + f.Label = proto.String("label") + f.Type = proto.String("type") return f } // These are all structurally equivalent but the tag numbers differ. // (It's remarkable that required, optional, and repeated all have // 8 letters.) -func initGoTest_RequiredGroup() *GoTest_RequiredGroup { - return &GoTest_RequiredGroup{ - RequiredField: String("required"), +func initGoTest_RequiredGroup() *pb2.GoTest_RequiredGroup { + return &pb2.GoTest_RequiredGroup{ + RequiredField: proto.String("required"), } } -func initGoTest_OptionalGroup() *GoTest_OptionalGroup { - return &GoTest_OptionalGroup{ - RequiredField: String("optional"), +func initGoTest_OptionalGroup() *pb2.GoTest_OptionalGroup { + return &pb2.GoTest_OptionalGroup{ + RequiredField: proto.String("optional"), } } -func initGoTest_RepeatedGroup() *GoTest_RepeatedGroup { - return &GoTest_RepeatedGroup{ - RequiredField: String("repeated"), +func initGoTest_RepeatedGroup() *pb2.GoTest_RepeatedGroup { + return &pb2.GoTest_RepeatedGroup{ + RequiredField: proto.String("repeated"), } } -func initGoTest(setdefaults bool) *GoTest { - pb := new(GoTest) +func initGoTest(setdefaults bool) *pb2.GoTest { + pb := new(pb2.GoTest) if setdefaults { - pb.F_BoolDefaulted = Bool(Default_GoTest_F_BoolDefaulted) - pb.F_Int32Defaulted = Int32(Default_GoTest_F_Int32Defaulted) - pb.F_Int64Defaulted = Int64(Default_GoTest_F_Int64Defaulted) - pb.F_Fixed32Defaulted = Uint32(Default_GoTest_F_Fixed32Defaulted) - pb.F_Fixed64Defaulted = Uint64(Default_GoTest_F_Fixed64Defaulted) - pb.F_Uint32Defaulted = Uint32(Default_GoTest_F_Uint32Defaulted) - pb.F_Uint64Defaulted = Uint64(Default_GoTest_F_Uint64Defaulted) - pb.F_FloatDefaulted = Float32(Default_GoTest_F_FloatDefaulted) - pb.F_DoubleDefaulted = Float64(Default_GoTest_F_DoubleDefaulted) - pb.F_StringDefaulted = String(Default_GoTest_F_StringDefaulted) - pb.F_BytesDefaulted = Default_GoTest_F_BytesDefaulted - pb.F_Sint32Defaulted = Int32(Default_GoTest_F_Sint32Defaulted) - pb.F_Sint64Defaulted = Int64(Default_GoTest_F_Sint64Defaulted) - pb.F_Sfixed32Defaulted = Int32(Default_GoTest_F_Sfixed32Defaulted) - pb.F_Sfixed64Defaulted = Int64(Default_GoTest_F_Sfixed64Defaulted) - } - - pb.Kind = GoTest_TIME.Enum() + pb.F_BoolDefaulted = proto.Bool(pb2.Default_GoTest_F_BoolDefaulted) + pb.F_Int32Defaulted = proto.Int32(pb2.Default_GoTest_F_Int32Defaulted) + pb.F_Int64Defaulted = proto.Int64(pb2.Default_GoTest_F_Int64Defaulted) + pb.F_Fixed32Defaulted = proto.Uint32(pb2.Default_GoTest_F_Fixed32Defaulted) + pb.F_Fixed64Defaulted = proto.Uint64(pb2.Default_GoTest_F_Fixed64Defaulted) + pb.F_Uint32Defaulted = proto.Uint32(pb2.Default_GoTest_F_Uint32Defaulted) + pb.F_Uint64Defaulted = proto.Uint64(pb2.Default_GoTest_F_Uint64Defaulted) + pb.F_FloatDefaulted = proto.Float32(pb2.Default_GoTest_F_FloatDefaulted) + pb.F_DoubleDefaulted = proto.Float64(pb2.Default_GoTest_F_DoubleDefaulted) + pb.F_StringDefaulted = proto.String(pb2.Default_GoTest_F_StringDefaulted) + pb.F_BytesDefaulted = pb2.Default_GoTest_F_BytesDefaulted + pb.F_Sint32Defaulted = proto.Int32(pb2.Default_GoTest_F_Sint32Defaulted) + pb.F_Sint64Defaulted = proto.Int64(pb2.Default_GoTest_F_Sint64Defaulted) + pb.F_Sfixed32Defaulted = proto.Int32(pb2.Default_GoTest_F_Sfixed32Defaulted) + pb.F_Sfixed64Defaulted = proto.Int64(pb2.Default_GoTest_F_Sfixed64Defaulted) + } + + pb.Kind = pb2.GoTest_TIME.Enum() pb.RequiredField = initGoTestField() - pb.F_BoolRequired = Bool(true) - pb.F_Int32Required = Int32(3) - pb.F_Int64Required = Int64(6) - pb.F_Fixed32Required = Uint32(32) - pb.F_Fixed64Required = Uint64(64) - pb.F_Uint32Required = Uint32(3232) - pb.F_Uint64Required = Uint64(6464) - pb.F_FloatRequired = Float32(3232) - pb.F_DoubleRequired = Float64(6464) - pb.F_StringRequired = String("string") + pb.F_BoolRequired = proto.Bool(true) + pb.F_Int32Required = proto.Int32(3) + pb.F_Int64Required = proto.Int64(6) + pb.F_Fixed32Required = proto.Uint32(32) + pb.F_Fixed64Required = proto.Uint64(64) + pb.F_Uint32Required = proto.Uint32(3232) + pb.F_Uint64Required = proto.Uint64(6464) + pb.F_FloatRequired = proto.Float32(3232) + pb.F_DoubleRequired = proto.Float64(6464) + pb.F_StringRequired = proto.String("string") pb.F_BytesRequired = []byte("bytes") - pb.F_Sint32Required = Int32(-32) - pb.F_Sint64Required = Int64(-64) - pb.F_Sfixed32Required = Int32(-32) - pb.F_Sfixed64Required = Int64(-64) + pb.F_Sint32Required = proto.Int32(-32) + pb.F_Sint64Required = proto.Int64(-64) + pb.F_Sfixed32Required = proto.Int32(-32) + pb.F_Sfixed64Required = proto.Int64(-64) pb.Requiredgroup = initGoTest_RequiredGroup() return pb @@ -146,7 +147,7 @@ func equal(b []byte, s string, t *testing.T) bool { return true } -func overify(t *testing.T, pb *GoTest, expected string) { +func overify(t *testing.T, pb *pb2.GoTest, expected string) { o := old() err := o.Marshal(pb) if err != nil { @@ -160,7 +161,7 @@ func overify(t *testing.T, pb *GoTest, expected string) { } // Now test Unmarshal by recreating the original buffer. - pbd := new(GoTest) + pbd := new(pb2.GoTest) err = o.Unmarshal(pbd) if err != nil { t.Fatalf("overify unmarshal err = %v", err) @@ -275,7 +276,7 @@ type msgWithFakeMarshaler struct { M *fakeMarshaler `protobuf:"bytes,1,opt,name=fake"` } -func (m *msgWithFakeMarshaler) String() string { return CompactTextString(m) } +func (m *msgWithFakeMarshaler) String() string { return proto.CompactTextString(m) } func (m *msgWithFakeMarshaler) ProtoMessage() {} func (m *msgWithFakeMarshaler) Reset() {} @@ -283,7 +284,7 @@ func (m *msgWithFakeMarshaler) Reset() {} func TestMarshalerEncoding(t *testing.T) { tests := []struct { name string - m Message + m proto.Message want []byte errType reflect.Type }{ @@ -293,27 +294,17 @@ func TestMarshalerEncoding(t *testing.T) { err: errors.New("some marshal err"), b: []byte{5, 6, 7}, }, - // Since the Marshal method returned bytes, they should be written to the - // buffer. (For efficiency, we assume that Marshal implementations are - // always correct w.r.t. RequiredNotSetError and output.) - want: []byte{5, 6, 7}, errType: reflect.TypeOf(errors.New("some marshal err")), }, { name: "Marshaler that fails with RequiredNotSetError", m: &msgWithFakeMarshaler{ M: &fakeMarshaler{ - err: &RequiredNotSetError{}, + err: &proto.RequiredNotSetError{}, b: []byte{5, 6, 7}, }, }, - // Since there's an error that can be continued after, - // the buffer should be written. - want: []byte{ - 10, 3, // for &msgWithFakeMarshaler - 5, 6, 7, // for &fakeMarshaler - }, - errType: reflect.TypeOf(&RequiredNotSetError{}), + errType: reflect.TypeOf(&proto.RequiredNotSetError{}), }, { name: "Marshaler that succeeds", @@ -324,67 +315,62 @@ func TestMarshalerEncoding(t *testing.T) { }, } for _, test := range tests { - b := NewBuffer(nil) - err := b.Marshal(test.m) - if reflect.TypeOf(err) != test.errType { - t.Errorf("%s: got err %T(%v) wanted %T", test.name, err, err, test.errType) - } - if !reflect.DeepEqual(test.want, b.Bytes()) { - t.Errorf("%s: got bytes %v wanted %v", test.name, b.Bytes(), test.want) - } - if size := Size(test.m); size != len(b.Bytes()) { - t.Errorf("%s: Size(_) = %v, but marshaled to %v bytes", test.name, size, len(b.Bytes())) - } + t.Run(test.name, func(t *testing.T) { + b := proto.NewBuffer(nil) + err := b.Marshal(test.m) + if reflect.TypeOf(err) != test.errType { + t.Errorf("got err %T(%v) wanted %T", err, err, test.errType) + } + if err != nil { + return // skip comparing output when marshal fails. + } + if !reflect.DeepEqual(test.want, b.Bytes()) { + t.Errorf("got bytes %v wanted %v", b.Bytes(), test.want) + } + if size := proto.Size(test.m); size != len(b.Bytes()) { + t.Errorf("Size(_) = %v, but marshaled to %v bytes", size, len(b.Bytes())) + } - m, mErr := Marshal(test.m) - if !bytes.Equal(b.Bytes(), m) { - t.Errorf("%s: Marshal returned %v, but (*Buffer).Marshal wrote %v", test.name, m, b.Bytes()) - } - if !reflect.DeepEqual(err, mErr) { - t.Errorf("%s: Marshal err = %q, but (*Buffer).Marshal returned %q", - test.name, fmt.Sprint(mErr), fmt.Sprint(err)) - } + m, mErr := proto.Marshal(test.m) + if !bytes.Equal(b.Bytes(), m) { + t.Errorf("Marshal returned %v, but (*Buffer).Marshal wrote %v", m, b.Bytes()) + } + if !reflect.DeepEqual(err, mErr) { + t.Errorf("Marshal err = %v, but (*Buffer).Marshal returned %v", mErr, err) + } + }) } } // Ensure that Buffer.Marshal uses O(N) memory for N messages func TestBufferMarshalAllocs(t *testing.T) { - value := &OtherMessage{Key: Int64(1)} - msg := &MyMessage{Count: Int32(1), Others: []*OtherMessage{value}} - - reallocSize := func(t *testing.T, items int, prealloc int) (int64, int64) { - var b Buffer - b.SetBuf(make([]byte, 0, prealloc)) + value := &pb2.OtherMessage{Key: proto.Int64(1)} + msg := &pb2.MyMessage{Count: proto.Int32(1), Others: []*pb2.OtherMessage{value}} - var allocSpace int64 - prevCap := cap(b.Bytes()) - for i := 0; i < items; i++ { + for _, prealloc := range []int{0, 100, 10000} { + const count = 1000 + var b proto.Buffer + s := make([]byte, 0, proto.Size(msg)) + marshalAllocs := testing.AllocsPerRun(count, func() { + b.SetBuf(s) err := b.Marshal(msg) if err != nil { t.Errorf("Marshal err = %q", err) - break } - if c := cap(b.Bytes()); prevCap != c { - allocSpace += int64(c) - prevCap = c - } - } - needSpace := int64(len(b.Bytes())) - return allocSpace, needSpace - } - - for _, prealloc := range []int{0, 100, 10000} { - for _, items := range []int{1, 2, 5, 10, 20, 50, 100, 200, 500, 1000} { - runtimeSpace, need := reallocSize(t, items, prealloc) - totalSpace := int64(prealloc) + runtimeSpace + }) - runtimeRatio := float64(runtimeSpace) / float64(need) - totalRatio := float64(totalSpace) / float64(need) - - if totalRatio < 1 || runtimeRatio > 4 { - t.Errorf("needed %dB, allocated %dB total (ratio %.1f), allocated %dB at runtime (ratio %.1f)", - need, totalSpace, totalRatio, runtimeSpace, runtimeRatio) + b.SetBuf(make([]byte, 0, prealloc)) + bufferAllocs := testing.AllocsPerRun(count, func() { + err := b.Marshal(msg) + if err != nil { + t.Errorf("Marshal err = %q", err) } + }) + + if marshalAllocs != bufferAllocs { + t.Errorf("%v allocs/op when writing to a preallocated buffer", marshalAllocs) + t.Errorf("%v allocs/op when repeatedly appending to a buffer", bufferAllocs) + t.Errorf("expect amortized allocs/op to be identical") } } } @@ -422,7 +408,7 @@ func TestStringPrimitives(t *testing.T) { // Do we catch the "required bit not set" case? func TestRequiredBit(t *testing.T) { o := old() - pb := new(GoTest) + pb := new(pb2.GoTest) err := o.Marshal(pb) if err == nil { t.Error("did not catch missing required fields") @@ -435,7 +421,7 @@ func TestRequiredBit(t *testing.T) { // Clearly silly, and a residue from a more interesting test with an earlier, // different initialization property, but it once caught a compiler bug so // it lives. -func checkInitialized(pb *GoTest, t *testing.T) { +func checkInitialized(pb *pb2.GoTest, t *testing.T) { if pb.F_BoolDefaulted != nil { t.Error("New or Reset did not set boolean:", *pb.F_BoolDefaulted) } @@ -481,19 +467,19 @@ func checkInitialized(pb *GoTest, t *testing.T) { func TestReset(t *testing.T) { pb := initGoTest(true) // muck with some values - pb.F_BoolDefaulted = Bool(false) - pb.F_Int32Defaulted = Int32(237) - pb.F_Int64Defaulted = Int64(12346) - pb.F_Fixed32Defaulted = Uint32(32000) - pb.F_Fixed64Defaulted = Uint64(666) - pb.F_Uint32Defaulted = Uint32(323232) + pb.F_BoolDefaulted = proto.Bool(false) + pb.F_Int32Defaulted = proto.Int32(237) + pb.F_Int64Defaulted = proto.Int64(12346) + pb.F_Fixed32Defaulted = proto.Uint32(32000) + pb.F_Fixed64Defaulted = proto.Uint64(666) + pb.F_Uint32Defaulted = proto.Uint32(323232) pb.F_Uint64Defaulted = nil pb.F_FloatDefaulted = nil - pb.F_DoubleDefaulted = Float64(0) - pb.F_StringDefaulted = String("gotcha") + pb.F_DoubleDefaulted = proto.Float64(0) + pb.F_StringDefaulted = proto.String("gotcha") pb.F_BytesDefaulted = []byte("asdfasdf") - pb.F_Sint32Defaulted = Int32(123) - pb.F_Sint64Defaulted = Int64(789) + pb.F_Sint32Defaulted = proto.Int32(123) + pb.F_Sint64Defaulted = proto.Int64(789) pb.Reset() checkInitialized(pb, t) } @@ -569,21 +555,21 @@ func TestEncodeDecode2(t *testing.T) { // All default fields set to their default value by hand func TestEncodeDecode3(t *testing.T) { pb := initGoTest(false) - pb.F_BoolDefaulted = Bool(true) - pb.F_Int32Defaulted = Int32(32) - pb.F_Int64Defaulted = Int64(64) - pb.F_Fixed32Defaulted = Uint32(320) - pb.F_Fixed64Defaulted = Uint64(640) - pb.F_Uint32Defaulted = Uint32(3200) - pb.F_Uint64Defaulted = Uint64(6400) - pb.F_FloatDefaulted = Float32(314159) - pb.F_DoubleDefaulted = Float64(271828) - pb.F_StringDefaulted = String("hello, \"world!\"\n") + pb.F_BoolDefaulted = proto.Bool(true) + pb.F_Int32Defaulted = proto.Int32(32) + pb.F_Int64Defaulted = proto.Int64(64) + pb.F_Fixed32Defaulted = proto.Uint32(320) + pb.F_Fixed64Defaulted = proto.Uint64(640) + pb.F_Uint32Defaulted = proto.Uint32(3200) + pb.F_Uint64Defaulted = proto.Uint64(6400) + pb.F_FloatDefaulted = proto.Float32(314159) + pb.F_DoubleDefaulted = proto.Float64(271828) + pb.F_StringDefaulted = proto.String("hello, \"world!\"\n") pb.F_BytesDefaulted = []byte("Bignose") - pb.F_Sint32Defaulted = Int32(-32) - pb.F_Sint64Defaulted = Int64(-64) - pb.F_Sfixed32Defaulted = Int32(-32) - pb.F_Sfixed64Defaulted = Int64(-64) + pb.F_Sint32Defaulted = proto.Int32(-32) + pb.F_Sint64Defaulted = proto.Int64(-64) + pb.F_Sfixed32Defaulted = proto.Int32(-32) + pb.F_Sfixed64Defaulted = proto.Int64(-64) overify(t, pb, "0807"+ // field 1, encoding 0, value 7 @@ -627,24 +613,24 @@ func TestEncodeDecode3(t *testing.T) { // All required fields set, defaults provided, all non-defaulted optional fields have values. func TestEncodeDecode4(t *testing.T) { pb := initGoTest(true) - pb.Table = String("hello") - pb.Param = Int32(7) + pb.Table = proto.String("hello") + pb.Param = proto.Int32(7) pb.OptionalField = initGoTestField() - pb.F_BoolOptional = Bool(true) - pb.F_Int32Optional = Int32(32) - pb.F_Int64Optional = Int64(64) - pb.F_Fixed32Optional = Uint32(3232) - pb.F_Fixed64Optional = Uint64(6464) - pb.F_Uint32Optional = Uint32(323232) - pb.F_Uint64Optional = Uint64(646464) - pb.F_FloatOptional = Float32(32.) - pb.F_DoubleOptional = Float64(64.) - pb.F_StringOptional = String("hello") + pb.F_BoolOptional = proto.Bool(true) + pb.F_Int32Optional = proto.Int32(32) + pb.F_Int64Optional = proto.Int64(64) + pb.F_Fixed32Optional = proto.Uint32(3232) + pb.F_Fixed64Optional = proto.Uint64(6464) + pb.F_Uint32Optional = proto.Uint32(323232) + pb.F_Uint64Optional = proto.Uint64(646464) + pb.F_FloatOptional = proto.Float32(32.) + pb.F_DoubleOptional = proto.Float64(64.) + pb.F_StringOptional = proto.String("hello") pb.F_BytesOptional = []byte("Bignose") - pb.F_Sint32Optional = Int32(-32) - pb.F_Sint64Optional = Int64(-64) - pb.F_Sfixed32Optional = Int32(-32) - pb.F_Sfixed64Optional = Int64(-64) + pb.F_Sint32Optional = proto.Int32(-32) + pb.F_Sint64Optional = proto.Int64(-64) + pb.F_Sfixed32Optional = proto.Int32(-32) + pb.F_Sfixed64Optional = proto.Int64(-64) pb.Optionalgroup = initGoTest_OptionalGroup() overify(t, pb, @@ -710,7 +696,7 @@ func TestEncodeDecode4(t *testing.T) { // All required fields set, defaults provided, all repeated fields given two values. func TestEncodeDecode5(t *testing.T) { pb := initGoTest(true) - pb.RepeatedField = []*GoTestField{initGoTestField(), initGoTestField()} + pb.RepeatedField = []*pb2.GoTestField{initGoTestField(), initGoTestField()} pb.F_BoolRepeated = []bool{false, true} pb.F_Int32Repeated = []int32{32, 33} pb.F_Int64Repeated = []int64{64, 65} @@ -726,7 +712,7 @@ func TestEncodeDecode5(t *testing.T) { pb.F_Sint64Repeated = []int64{64, -64} pb.F_Sfixed32Repeated = []int32{32, -32} pb.F_Sfixed64Repeated = []int64{64, -64} - pb.Repeatedgroup = []*GoTest_RepeatedGroup{initGoTest_RepeatedGroup(), initGoTest_RepeatedGroup()} + pb.Repeatedgroup = []*pb2.GoTest_RepeatedGroup{initGoTest_RepeatedGroup(), initGoTest_RepeatedGroup()} overify(t, pb, "0807"+ // field 1, encoding 0, value 7 @@ -878,13 +864,13 @@ func TestEncodeDecodeBytes1(t *testing.T) { pb.F_BytesRepeated = [][]byte{{}} pb.F_BytesOptional = []byte{} - d, err := Marshal(pb) + d, err := proto.Marshal(pb) if err != nil { t.Error(err) } - pbd := new(GoTest) - if err := Unmarshal(d, pbd); err != nil { + pbd := new(pb2.GoTest) + if err := proto.Unmarshal(d, pbd); err != nil { t.Error(err) } @@ -907,13 +893,13 @@ func TestEncodeDecodeBytes2(t *testing.T) { // Create our bytes pb.F_BytesRepeated = [][]byte{nil} - d, err := Marshal(pb) + d, err := proto.Marshal(pb) if err != nil { t.Error(err) } - pbd := new(GoTest) - if err := Unmarshal(d, pbd); err != nil { + pbd := new(pb2.GoTest) + if err := proto.Unmarshal(d, pbd); err != nil { t.Error(err) } @@ -931,25 +917,25 @@ func TestSkippingUnrecognizedFields(t *testing.T) { o.Marshal(pb) // Now new a GoSkipTest record. - skip := &GoSkipTest{ - SkipInt32: Int32(32), - SkipFixed32: Uint32(3232), - SkipFixed64: Uint64(6464), - SkipString: String("skipper"), - Skipgroup: &GoSkipTest_SkipGroup{ - GroupInt32: Int32(75), - GroupString: String("wxyz"), + skip := &pb2.GoSkipTest{ + SkipInt32: proto.Int32(32), + SkipFixed32: proto.Uint32(3232), + SkipFixed64: proto.Uint64(6464), + SkipString: proto.String("skipper"), + Skipgroup: &pb2.GoSkipTest_SkipGroup{ + GroupInt32: proto.Int32(75), + GroupString: proto.String("wxyz"), }, } // Marshal it into same buffer. o.Marshal(skip) - pbd := new(GoTestField) + pbd := new(pb2.GoTestField) o.Unmarshal(pbd) // The __unrecognized field should be a marshaling of GoSkipTest - skipd := new(GoSkipTest) + skipd := new(pb2.GoSkipTest) o.SetBuf(pbd.XXX_unrecognized) o.Unmarshal(skipd) @@ -976,59 +962,59 @@ func TestSkippingUnrecognizedFields(t *testing.T) { // Check that unrecognized fields of a submessage are preserved. func TestSubmessageUnrecognizedFields(t *testing.T) { - nm := &NewMessage{ - Nested: &NewMessage_Nested{ - Name: String("Nigel"), - FoodGroup: String("carbs"), + nm := &pb2.NewMessage{ + Nested: &pb2.NewMessage_Nested{ + Name: proto.String("Nigel"), + FoodGroup: proto.String("carbs"), }, } - b, err := Marshal(nm) + b, err := proto.Marshal(nm) if err != nil { t.Fatalf("Marshal of NewMessage: %v", err) } // Unmarshal into an OldMessage. - om := new(OldMessage) - if err := Unmarshal(b, om); err != nil { + om := new(pb2.OldMessage) + if err := proto.Unmarshal(b, om); err != nil { t.Fatalf("Unmarshal to OldMessage: %v", err) } - exp := &OldMessage{ - Nested: &OldMessage_Nested{ - Name: String("Nigel"), + exp := &pb2.OldMessage{ + Nested: &pb2.OldMessage_Nested{ + Name: proto.String("Nigel"), // normal protocol buffer users should not do this XXX_unrecognized: []byte("\x12\x05carbs"), }, } - if !Equal(om, exp) { + if !proto.Equal(om, exp) { t.Errorf("om = %v, want %v", om, exp) } // Clone the OldMessage. - om = Clone(om).(*OldMessage) - if !Equal(om, exp) { + om = proto.Clone(om).(*pb2.OldMessage) + if !proto.Equal(om, exp) { t.Errorf("Clone(om) = %v, want %v", om, exp) } // Marshal the OldMessage, then unmarshal it into an empty NewMessage. - if b, err = Marshal(om); err != nil { + if b, err = proto.Marshal(om); err != nil { t.Fatalf("Marshal of OldMessage: %v", err) } t.Logf("Marshal(%v) -> %q", om, b) - nm2 := new(NewMessage) - if err := Unmarshal(b, nm2); err != nil { + nm2 := new(pb2.NewMessage) + if err := proto.Unmarshal(b, nm2); err != nil { t.Fatalf("Unmarshal to NewMessage: %v", err) } - if !Equal(nm, nm2) { + if !proto.Equal(nm, nm2) { t.Errorf("NewMessage round-trip: %v => %v", nm, nm2) } } // Check that an int32 field can be upgraded to an int64 field. func TestNegativeInt32(t *testing.T) { - om := &OldMessage{ - Num: Int32(-1), + om := &pb2.OldMessage{ + Num: proto.Int32(-1), } - b, err := Marshal(om) + b, err := proto.Marshal(om) if err != nil { t.Fatalf("Marshal of OldMessage: %v", err) } @@ -1040,14 +1026,14 @@ func TestNegativeInt32(t *testing.T) { } // Unmarshal into a NewMessage. - nm := new(NewMessage) - if err := Unmarshal(b, nm); err != nil { + nm := new(pb2.NewMessage) + if err := proto.Unmarshal(b, nm); err != nil { t.Fatalf("Unmarshal to NewMessage: %v", err) } - want := &NewMessage{ - Num: Int64(-1), + want := &pb2.NewMessage{ + Num: proto.Int64(-1), } - if !Equal(nm, want) { + if !proto.Equal(nm, want) { t.Errorf("nm = %v, want %v", nm, want) } } @@ -1063,7 +1049,7 @@ func TestBigRepeated(t *testing.T) { // Create the arrays const N = 50 // Internally the library starts much smaller. - pb.Repeatedgroup = make([]*GoTest_RepeatedGroup, N) + pb.Repeatedgroup = make([]*pb2.GoTest_RepeatedGroup, N) pb.F_Sint64Repeated = make([]int64, N) pb.F_Sint32Repeated = make([]int32, N) pb.F_BytesRepeated = make([][]byte, N) @@ -1077,7 +1063,7 @@ func TestBigRepeated(t *testing.T) { pb.F_Int64Repeated = make([]int64, N) pb.F_Int32Repeated = make([]int32, N) pb.F_BoolRepeated = make([]bool, N) - pb.RepeatedField = make([]*GoTestField, N) + pb.RepeatedField = make([]*pb2.GoTestField, N) // Fill in the arrays with checkable values. igtf := initGoTestField() @@ -1102,15 +1088,15 @@ func TestBigRepeated(t *testing.T) { } // Marshal. - buf, _ := Marshal(pb) + buf, _ := proto.Marshal(pb) // Now test Unmarshal by recreating the original buffer. - pbd := new(GoTest) - Unmarshal(buf, pbd) + pbd := new(pb2.GoTest) + proto.Unmarshal(buf, pbd) // Check the checkable values for i := uint64(0); i < N; i++ { - if pbd.Repeatedgroup[i] == nil { // TODO: more checking? + if pbd.Repeatedgroup[i] == nil { t.Error("pbd.Repeatedgroup bad") } if x := uint64(pbd.F_Sint64Repeated[i]); x != i { @@ -1151,7 +1137,7 @@ func TestBigRepeated(t *testing.T) { if x := pbd.F_BoolRepeated[i]; x != (i%2 == 0) { t.Error("pbd.F_BoolRepeated bad", x, i) } - if pbd.RepeatedField[i] == nil { // TODO: more checking? + if pbd.RepeatedField[i] == nil { t.Error("pbd.RepeatedField bad") } } @@ -1161,8 +1147,8 @@ func TestBadWireTypeUnknown(t *testing.T) { var b []byte fmt.Sscanf("0a01780d00000000080b101612036161611521000000202c220362626225370000002203636363214200000000000000584d5a036464645900000000000056405d63000000", "%x", &b) - m := new(MyMessage) - if err := Unmarshal(b, m); err != nil { + m := new(pb2.MyMessage) + if err := proto.Unmarshal(b, m); err != nil { t.Errorf("unexpected Unmarshal error: %v", err) } @@ -1171,26 +1157,26 @@ func TestBadWireTypeUnknown(t *testing.T) { if !bytes.Equal(m.XXX_unrecognized, unknown) { t.Errorf("unknown bytes mismatch:\ngot %x\nwant %x", m.XXX_unrecognized, unknown) } - DiscardUnknown(m) + proto.DiscardUnknown(m) - want := &MyMessage{Count: Int32(11), Name: String("aaa"), Pet: []string{"bbb", "ccc"}, Bigfloat: Float64(88)} - if !Equal(m, want) { + want := &pb2.MyMessage{Count: proto.Int32(11), Name: proto.String("aaa"), Pet: []string{"bbb", "ccc"}, Bigfloat: proto.Float64(88)} + if !proto.Equal(m, want) { t.Errorf("message mismatch:\ngot %v\nwant %v", m, want) } } -func encodeDecode(t *testing.T, in, out Message, msg string) { - buf, err := Marshal(in) +func encodeDecode(t *testing.T, in, out proto.Message, msg string) { + buf, err := proto.Marshal(in) if err != nil { t.Fatalf("failed marshaling %v: %v", msg, err) } - if err := Unmarshal(buf, out); err != nil { + if err := proto.Unmarshal(buf, out); err != nil { t.Fatalf("failed unmarshaling %v: %v", msg, err) } } func TestPackedNonPackedDecoderSwitching(t *testing.T) { - np, p := new(NonPackedTest), new(PackedTest) + np, p := new(pb2.NonPackedTest), new(pb2.PackedTest) // non-packed -> packed np.A = []int32{0, 1, 1, 2, 3, 5} @@ -1209,11 +1195,11 @@ func TestPackedNonPackedDecoderSwitching(t *testing.T) { } func TestProto1RepeatedGroup(t *testing.T) { - pb := &MessageList{ - Message: []*MessageList_Message{ + pb := &pb2.MessageList{ + Message: []*pb2.MessageList_Message{ { - Name: String("blah"), - Count: Int32(7), + Name: proto.String("blah"), + Count: proto.Int32(7), }, // NOTE: pb.Message[1] is a nil nil, @@ -1222,8 +1208,11 @@ func TestProto1RepeatedGroup(t *testing.T) { o := old() err := o.Marshal(pb) - if err == nil || !strings.Contains(err.Error(), "repeated field Message has nil") { - t.Fatalf("unexpected or no error when marshaling: %v", err) + if err == nil { + t.Fatalf("expected error when marshaling repeted nil MessageList.Message") + } + if _, ok := err.(*proto.RequiredNotSetError); !ok { + t.Fatalf("unexpected error when marshaling: %v", err) } } @@ -1231,17 +1220,17 @@ func TestProto1RepeatedGroup(t *testing.T) { // named types instead of int32: newInt32FromUint64 would crash with // a type mismatch in reflect.PointTo. func TestEnum(t *testing.T) { - pb := new(GoEnum) - pb.Foo = FOO_FOO1.Enum() + pb := new(pb2.GoEnum) + pb.Foo = pb2.FOO_FOO1.Enum() o := old() if err := o.Marshal(pb); err != nil { t.Fatal("error encoding enum:", err) } - pb1 := new(GoEnum) + pb1 := new(pb2.GoEnum) if err := o.Unmarshal(pb1); err != nil { t.Fatal("error decoding enum:", err) } - if *pb1.Foo != FOO_FOO1 { + if *pb1.Foo != pb2.FOO_FOO1 { t.Error("expected 7 but got ", *pb1.Foo) } } @@ -1249,14 +1238,14 @@ func TestEnum(t *testing.T) { // Enum types have String methods. Check that enum fields can be printed. // We don't care what the value actually is, just as long as it doesn't crash. func TestPrintingNilEnumFields(t *testing.T) { - pb := new(GoEnum) + pb := new(pb2.GoEnum) _ = fmt.Sprintf("%+v", pb) } // Verify that absent required fields cause Marshal/Unmarshal to return errors. func TestRequiredFieldEnforcement(t *testing.T) { - pb := new(GoTestField) - _, err := Marshal(pb) + pb := new(pb2.GoTestField) + _, err := proto.Marshal(pb) if err == nil { t.Error("marshal: expected error, got nil") } else if !isRequiredNotSetError(err) { @@ -1267,26 +1256,25 @@ func TestRequiredFieldEnforcement(t *testing.T) { // so simply counting the required fields is insufficient. // field 1, encoding 2, value "hi" buf := []byte("\x0A\x02hi\x0A\x02hi") - err = Unmarshal(buf, pb) + err = proto.Unmarshal(buf, pb) if err == nil { t.Error("unmarshal: expected error, got nil") } else if !isRequiredNotSetError(err) { - // TODO: remove unknown cases once we commit to the new unmarshaler. t.Errorf("unmarshal: bad error type: %v", err) } } // Verify that absent required fields in groups cause Marshal/Unmarshal to return errors. func TestRequiredFieldEnforcementGroups(t *testing.T) { - pb := &GoTestRequiredGroupField{Group: &GoTestRequiredGroupField_Group{}} - if _, err := Marshal(pb); err == nil { + pb := &pb2.GoTestRequiredGroupField{Group: &pb2.GoTestRequiredGroupField_Group{}} + if _, err := proto.Marshal(pb); err == nil { t.Error("marshal: expected error, got nil") } else if !isRequiredNotSetError(err) { t.Errorf("marshal: bad error type: %v", err) } buf := []byte{11, 12} - if err := Unmarshal(buf, pb); err == nil { + if err := proto.Unmarshal(buf, pb); err == nil { t.Error("unmarshal: expected error, got nil") } else if !isRequiredNotSetError(err) { t.Errorf("unmarshal: bad error type: %v", err) @@ -1295,18 +1283,17 @@ func TestRequiredFieldEnforcementGroups(t *testing.T) { func TestTypedNilMarshal(t *testing.T) { // A typed nil should return ErrNil and not crash. - { - var m *GoEnum - if _, err := Marshal(m); err != ErrNil { - t.Errorf("Marshal(%#v): got %v, want ErrNil", m, err) - } + var m *pb2.GoEnum + if _, err := proto.Marshal(m); err != proto.ErrNil { + t.Errorf("Marshal(%#v): got %v, want ErrNil", m, err) } +} - { - m := &Communique{Union: &Communique_Msg{nil}} - if _, err := Marshal(m); err == nil || err == ErrNil { - t.Errorf("Marshal(%#v): got %v, want errOneofHasNil", m, err) - } +func TestTypedNilMarshalInOneof(t *testing.T) { + // It should not panic. + m := &pb2.Communique{Union: &pb2.Communique_Msg{nil}} + if _, err := proto.Marshal(m); err == proto.ErrNil { + t.Errorf("Marshal(%#v): got %v, want nil or errOneofHasNil", m, err) } } @@ -1314,7 +1301,7 @@ func TestTypedNilMarshal(t *testing.T) { type nonNillableInt uint64 func (nni nonNillableInt) Marshal() ([]byte, error) { - return EncodeVarint(uint64(nni)), nil + return proto.EncodeVarint(uint64(nni)), nil } type NNIMessage struct { @@ -1336,118 +1323,118 @@ func TestNilMarshaler(t *testing.T) { // Try a struct with a Marshaler field that is nil. // It should be directly marshable. nmm := new(NMMessage) - if _, err := Marshal(nmm); err != nil { + if _, err := proto.Marshal(nmm); err != nil { t.Error("unexpected error marshaling nmm: ", err) } // Try a struct with a Marshaler field that is not nillable. nnim := new(NNIMessage) nnim.nni = 7 - var _ Marshaler = nnim.nni // verify it is truly a Marshaler - if _, err := Marshal(nnim); err != nil { + var _ proto.Marshaler = nnim.nni // verify it is truly a Marshaler + if _, err := proto.Marshal(nnim); err != nil { t.Error("unexpected error marshaling nnim: ", err) } } func TestAllSetDefaults(t *testing.T) { // Exercise SetDefaults with all scalar field types. - m := &Defaults{ + m := &pb2.Defaults{ // NaN != NaN, so override that here. - F_Nan: Float32(1.7), - } - expected := &Defaults{ - F_Bool: Bool(true), - F_Int32: Int32(32), - F_Int64: Int64(64), - F_Fixed32: Uint32(320), - F_Fixed64: Uint64(640), - F_Uint32: Uint32(3200), - F_Uint64: Uint64(6400), - F_Float: Float32(314159), - F_Double: Float64(271828), - F_String: String(`hello, "world!"` + "\n"), + F_Nan: proto.Float32(1.7), + } + expected := &pb2.Defaults{ + F_Bool: proto.Bool(true), + F_Int32: proto.Int32(32), + F_Int64: proto.Int64(64), + F_Fixed32: proto.Uint32(320), + F_Fixed64: proto.Uint64(640), + F_Uint32: proto.Uint32(3200), + F_Uint64: proto.Uint64(6400), + F_Float: proto.Float32(314159), + F_Double: proto.Float64(271828), + F_String: proto.String(`hello, "world!"` + "\n"), F_Bytes: []byte("Bignose"), - F_Sint32: Int32(-32), - F_Sint64: Int64(-64), - F_Enum: Defaults_GREEN.Enum(), - F_Pinf: Float32(float32(math.Inf(1))), - F_Ninf: Float32(float32(math.Inf(-1))), - F_Nan: Float32(1.7), - StrZero: String(""), - } - SetDefaults(m) - if !Equal(m, expected) { + F_Sint32: proto.Int32(-32), + F_Sint64: proto.Int64(-64), + F_Enum: pb2.Defaults_GREEN.Enum(), + F_Pinf: proto.Float32(float32(math.Inf(1))), + F_Ninf: proto.Float32(float32(math.Inf(-1))), + F_Nan: proto.Float32(1.7), + StrZero: proto.String(""), + } + proto.SetDefaults(m) + if !proto.Equal(m, expected) { t.Errorf("SetDefaults failed\n got %v\nwant %v", m, expected) } } func TestSetDefaultsWithSetField(t *testing.T) { // Check that a set value is not overridden. - m := &Defaults{ - F_Int32: Int32(12), + m := &pb2.Defaults{ + F_Int32: proto.Int32(12), } - SetDefaults(m) + proto.SetDefaults(m) if v := m.GetF_Int32(); v != 12 { t.Errorf("m.FInt32 = %v, want 12", v) } } func TestSetDefaultsWithSubMessage(t *testing.T) { - m := &OtherMessage{ - Key: Int64(123), - Inner: &InnerMessage{ - Host: String("gopher"), + m := &pb2.OtherMessage{ + Key: proto.Int64(123), + Inner: &pb2.InnerMessage{ + Host: proto.String("gopher"), }, } - expected := &OtherMessage{ - Key: Int64(123), - Inner: &InnerMessage{ - Host: String("gopher"), - Port: Int32(4000), + expected := &pb2.OtherMessage{ + Key: proto.Int64(123), + Inner: &pb2.InnerMessage{ + Host: proto.String("gopher"), + Port: proto.Int32(4000), }, } - SetDefaults(m) - if !Equal(m, expected) { + proto.SetDefaults(m) + if !proto.Equal(m, expected) { t.Errorf("\n got %v\nwant %v", m, expected) } } func TestSetDefaultsWithRepeatedSubMessage(t *testing.T) { - m := &MyMessage{ - RepInner: []*InnerMessage{{}}, + m := &pb2.MyMessage{ + RepInner: []*pb2.InnerMessage{{}}, } - expected := &MyMessage{ - RepInner: []*InnerMessage{{ - Port: Int32(4000), + expected := &pb2.MyMessage{ + RepInner: []*pb2.InnerMessage{{ + Port: proto.Int32(4000), }}, } - SetDefaults(m) - if !Equal(m, expected) { + proto.SetDefaults(m) + if !proto.Equal(m, expected) { t.Errorf("\n got %v\nwant %v", m, expected) } } func TestSetDefaultWithRepeatedNonMessage(t *testing.T) { - m := &MyMessage{ + m := &pb2.MyMessage{ Pet: []string{"turtle", "wombat"}, } - expected := Clone(m) - SetDefaults(m) - if !Equal(m, expected) { + expected := proto.Clone(m) + proto.SetDefaults(m) + if !proto.Equal(m, expected) { t.Errorf("\n got %v\nwant %v", m, expected) } } func TestMaximumTagNumber(t *testing.T) { - m := &MaxTag{ - LastField: String("natural goat essence"), + m := &pb2.MaxTag{ + LastField: proto.String("natural goat essence"), } - buf, err := Marshal(m) + buf, err := proto.Marshal(m) if err != nil { t.Fatalf("proto.Marshal failed: %v", err) } - m2 := new(MaxTag) - if err := Unmarshal(buf, m2); err != nil { + m2 := new(pb2.MaxTag) + if err := proto.Unmarshal(buf, m2); err != nil { t.Fatalf("proto.Unmarshal failed: %v", err) } if got, want := m2.GetLastField(), *m.LastField; got != want { @@ -1456,13 +1443,13 @@ func TestMaximumTagNumber(t *testing.T) { } func TestJSON(t *testing.T) { - m := &MyMessage{ - Count: Int32(4), + m := &pb2.MyMessage{ + Count: proto.Int32(4), Pet: []string{"bunny", "kitty"}, - Inner: &InnerMessage{ - Host: String("cauchy"), + Inner: &pb2.InnerMessage{ + Host: proto.String("cauchy"), }, - Bikeshed: MyMessage_GREEN.Enum(), + Bikeshed: pb2.MyMessage_GREEN.Enum(), } const expected = `{"count":4,"pet":["bunny","kitty"],"inner":{"host":"cauchy"},"bikeshed":1}` @@ -1475,11 +1462,11 @@ func TestJSON(t *testing.T) { t.Errorf("got %s\nwant %s", s, expected) } - received := new(MyMessage) + received := new(pb2.MyMessage) if err := json.Unmarshal(b, received); err != nil { t.Fatalf("json.Unmarshal failed: %v", err) } - if !Equal(received, m) { + if !proto.Equal(received, m) { t.Fatalf("got %s, want %s", received, m) } @@ -1489,37 +1476,35 @@ func TestJSON(t *testing.T) { if err := json.Unmarshal([]byte(old), received); err != nil { t.Fatalf("json.Unmarshal failed: %v", err) } - if !Equal(received, m) { + if !proto.Equal(received, m) { t.Fatalf("got %s, want %s", received, m) } } func TestBadWireType(t *testing.T) { b := []byte{7<<3 | 6} // field 7, wire type 6 - pb := new(OtherMessage) - if err := Unmarshal(b, pb); err == nil { + pb := new(pb2.OtherMessage) + if err := proto.Unmarshal(b, pb); err == nil { t.Errorf("Unmarshal did not fail") - } else if !strings.Contains(err.Error(), "unknown wire type") { - t.Errorf("wrong error: %v", err) } } func TestBytesWithInvalidLength(t *testing.T) { // If a byte sequence has an invalid (negative) length, Unmarshal should not panic. - b := []byte{2<<3 | WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0} - Unmarshal(b, new(MyMessage)) + b := []byte{2<<3 | proto.WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0} + proto.Unmarshal(b, new(pb2.MyMessage)) } func TestLengthOverflow(t *testing.T) { // Overflowing a length should not panic. - b := []byte{2<<3 | WireBytes, 1, 1, 3<<3 | WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x01} - Unmarshal(b, new(MyMessage)) + b := []byte{2<<3 | proto.WireBytes, 1, 1, 3<<3 | proto.WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x01} + proto.Unmarshal(b, new(pb2.MyMessage)) } func TestVarintOverflow(t *testing.T) { // Overflowing a 64-bit length should not be allowed. - b := []byte{1<<3 | WireVarint, 0x01, 3<<3 | WireBytes, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01} - if err := Unmarshal(b, new(MyMessage)); err == nil { + b := []byte{1<<3 | proto.WireVarint, 0x01, 3<<3 | proto.WireBytes, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01} + if err := proto.Unmarshal(b, new(pb2.MyMessage)); err == nil { t.Fatalf("Overflowed uint64 length without error") } } @@ -1527,7 +1512,7 @@ func TestVarintOverflow(t *testing.T) { func TestBytesWithInvalidLengthInGroup(t *testing.T) { // Overflowing a 64-bit length should not be allowed. b := []byte{0xbb, 0x30, 0xb2, 0x30, 0xb0, 0xb2, 0x83, 0xf1, 0xb0, 0xb2, 0xef, 0xbf, 0xbd, 0x01} - if err := Unmarshal(b, new(MyMessage)); err == nil { + if err := proto.Unmarshal(b, new(pb2.MyMessage)); err == nil { t.Fatalf("Overflowed uint64 length without error") } } @@ -1547,28 +1532,28 @@ func TestUnmarshalFuzz(t *testing.T) { } func TestMergeMessages(t *testing.T) { - pb := &MessageList{Message: []*MessageList_Message{{Name: String("x"), Count: Int32(1)}}} - data, err := Marshal(pb) + pb := &pb2.MessageList{Message: []*pb2.MessageList_Message{{Name: proto.String("x"), Count: proto.Int32(1)}}} + data, err := proto.Marshal(pb) if err != nil { t.Fatalf("Marshal: %v", err) } - pb1 := new(MessageList) - if err := Unmarshal(data, pb1); err != nil { + pb1 := new(pb2.MessageList) + if err := proto.Unmarshal(data, pb1); err != nil { t.Fatalf("first Unmarshal: %v", err) } - if err := Unmarshal(data, pb1); err != nil { + if err := proto.Unmarshal(data, pb1); err != nil { t.Fatalf("second Unmarshal: %v", err) } if len(pb1.Message) != 1 { t.Errorf("two Unmarshals produced %d Messages, want 1", len(pb1.Message)) } - pb2 := new(MessageList) - if err := UnmarshalMerge(data, pb2); err != nil { + pb2 := new(pb2.MessageList) + if err := proto.UnmarshalMerge(data, pb2); err != nil { t.Fatalf("first UnmarshalMerge: %v", err) } - if err := UnmarshalMerge(data, pb2); err != nil { + if err := proto.UnmarshalMerge(data, pb2); err != nil { t.Fatalf("second UnmarshalMerge: %v", err) } if len(pb2.Message) != 2 { @@ -1577,21 +1562,21 @@ func TestMergeMessages(t *testing.T) { } func TestExtensionMarshalOrder(t *testing.T) { - m := &MyMessage{Count: Int(123)} - if err := SetExtension(m, E_Ext_More, &Ext{Data: String("alpha")}); err != nil { + m := &pb2.MyMessage{Count: proto.Int(123)} + if err := proto.SetExtension(m, pb2.E_Ext_More, &pb2.Ext{Data: proto.String("alpha")}); err != nil { t.Fatalf("SetExtension: %v", err) } - if err := SetExtension(m, E_Ext_Text, String("aleph")); err != nil { + if err := proto.SetExtension(m, pb2.E_Ext_Text, proto.String("aleph")); err != nil { t.Fatalf("SetExtension: %v", err) } - if err := SetExtension(m, E_Ext_Number, Int32(1)); err != nil { + if err := proto.SetExtension(m, pb2.E_Ext_Number, proto.Int32(1)); err != nil { t.Fatalf("SetExtension: %v", err) } // Serialize m several times, and check we get the same bytes each time. var orig []byte for i := 0; i < 100; i++ { - b, err := Marshal(m) + b, err := proto.Marshal(m) if err != nil { t.Fatalf("Marshal: %v", err) } @@ -1606,12 +1591,12 @@ func TestExtensionMarshalOrder(t *testing.T) { } func TestExtensionMapFieldMarshalDeterministic(t *testing.T) { - m := &MyMessage{Count: Int(123)} - if err := SetExtension(m, E_Ext_More, &Ext{MapField: map[int32]int32{1: 1, 2: 2, 3: 3, 4: 4}}); err != nil { + m := &pb2.MyMessage{Count: proto.Int(123)} + if err := proto.SetExtension(m, pb2.E_Ext_More, &pb2.Ext{MapField: map[int32]int32{1: 1, 2: 2, 3: 3, 4: 4}}); err != nil { t.Fatalf("SetExtension: %v", err) } - marshal := func(m Message) []byte { - var b Buffer + marshal := func(m proto.Message) []byte { + var b proto.Buffer b.SetDeterministic(true) if err := b.Marshal(m); err != nil { t.Fatalf("Marshal failed: %v", err) @@ -1627,136 +1612,45 @@ func TestExtensionMapFieldMarshalDeterministic(t *testing.T) { } } -// Many extensions, because small maps might not iterate differently on each iteration. -var exts = []*ExtensionDesc{ - E_X201, - E_X202, - E_X203, - E_X204, - E_X205, - E_X206, - E_X207, - E_X208, - E_X209, - E_X210, - E_X211, - E_X212, - E_X213, - E_X214, - E_X215, - E_X216, - E_X217, - E_X218, - E_X219, - E_X220, - E_X221, - E_X222, - E_X223, - E_X224, - E_X225, - E_X226, - E_X227, - E_X228, - E_X229, - E_X230, - E_X231, - E_X232, - E_X233, - E_X234, - E_X235, - E_X236, - E_X237, - E_X238, - E_X239, - E_X240, - E_X241, - E_X242, - E_X243, - E_X244, - E_X245, - E_X246, - E_X247, - E_X248, - E_X249, - E_X250, -} - -func TestMessageSetMarshalOrder(t *testing.T) { - m := &MyMessageSet{} - for _, x := range exts { - if err := SetExtension(m, x, &Empty{}); err != nil { - t.Fatalf("SetExtension: %v", err) - } - } - - buf, err := Marshal(m) - if err != nil { - t.Fatalf("Marshal: %v", err) - } - - // Serialize m several times, and check we get the same bytes each time. - for i := 0; i < 10; i++ { - b1, err := Marshal(m) - if err != nil { - t.Fatalf("Marshal: %v", err) - } - if !bytes.Equal(b1, buf) { - t.Errorf("Bytes differ on re-Marshal #%d", i) - } - - m2 := &MyMessageSet{} - if err := Unmarshal(buf, m2); err != nil { - t.Errorf("Unmarshal: %v", err) - } - b2, err := Marshal(m2) - if err != nil { - t.Errorf("re-Marshal: %v", err) - } - if !bytes.Equal(b2, buf) { - t.Errorf("Bytes differ on round-trip #%d", i) - } - } -} - func TestUnmarshalMergesMessages(t *testing.T) { // If a nested message occurs twice in the input, // the fields should be merged when decoding. - a := &OtherMessage{ - Key: Int64(123), - Inner: &InnerMessage{ - Host: String("polhode"), - Port: Int32(1234), + a := &pb2.OtherMessage{ + Key: proto.Int64(123), + Inner: &pb2.InnerMessage{ + Host: proto.String("polhode"), + Port: proto.Int32(1234), }, } - aData, err := Marshal(a) + aData, err := proto.Marshal(a) if err != nil { t.Fatalf("Marshal(a): %v", err) } - b := &OtherMessage{ - Weight: Float32(1.2), - Inner: &InnerMessage{ - Host: String("herpolhode"), - Connected: Bool(true), + b := &pb2.OtherMessage{ + Weight: proto.Float32(1.2), + Inner: &pb2.InnerMessage{ + Host: proto.String("herpolhode"), + Connected: proto.Bool(true), }, } - bData, err := Marshal(b) + bData, err := proto.Marshal(b) if err != nil { t.Fatalf("Marshal(b): %v", err) } - want := &OtherMessage{ - Key: Int64(123), - Weight: Float32(1.2), - Inner: &InnerMessage{ - Host: String("herpolhode"), - Port: Int32(1234), - Connected: Bool(true), + want := &pb2.OtherMessage{ + Key: proto.Int64(123), + Weight: proto.Float32(1.2), + Inner: &pb2.InnerMessage{ + Host: proto.String("herpolhode"), + Port: proto.Int32(1234), + Connected: proto.Bool(true), }, } - got := new(OtherMessage) - if err := Unmarshal(append(aData, bData...), got); err != nil { + got := new(pb2.OtherMessage) + if err := proto.Unmarshal(append(aData, bData...), got); err != nil { t.Fatalf("Unmarshal: %v", err) } - if !Equal(got, want) { + if !proto.Equal(got, want) { t.Errorf("\n got %v\nwant %v", got, want) } } @@ -1764,52 +1658,52 @@ func TestUnmarshalMergesMessages(t *testing.T) { func TestUnmarshalMergesGroups(t *testing.T) { // If a nested group occurs twice in the input, // the fields should be merged when decoding. - a := &GroupNew{ - G: &GroupNew_G{ - X: Int32(7), - Y: Int32(8), + a := &pb2.GroupNew{ + G: &pb2.GroupNew_G{ + X: proto.Int32(7), + Y: proto.Int32(8), }, } - aData, err := Marshal(a) + aData, err := proto.Marshal(a) if err != nil { t.Fatalf("Marshal(a): %v", err) } - b := &GroupNew{ - G: &GroupNew_G{ - X: Int32(9), + b := &pb2.GroupNew{ + G: &pb2.GroupNew_G{ + X: proto.Int32(9), }, } - bData, err := Marshal(b) + bData, err := proto.Marshal(b) if err != nil { t.Fatalf("Marshal(b): %v", err) } - want := &GroupNew{ - G: &GroupNew_G{ - X: Int32(9), - Y: Int32(8), + want := &pb2.GroupNew{ + G: &pb2.GroupNew_G{ + X: proto.Int32(9), + Y: proto.Int32(8), }, } - got := new(GroupNew) - if err := Unmarshal(append(aData, bData...), got); err != nil { + got := new(pb2.GroupNew) + if err := proto.Unmarshal(append(aData, bData...), got); err != nil { t.Fatalf("Unmarshal: %v", err) } - if !Equal(got, want) { + if !proto.Equal(got, want) { t.Errorf("\n got %v\nwant %v", got, want) } } func TestEncodingSizes(t *testing.T) { tests := []struct { - m Message + m proto.Message n int }{ - {&Defaults{F_Int32: Int32(math.MaxInt32)}, 6}, - {&Defaults{F_Int32: Int32(math.MinInt32)}, 11}, - {&Defaults{F_Uint32: Uint32(uint32(math.MaxInt32) + 1)}, 6}, - {&Defaults{F_Uint32: Uint32(math.MaxUint32)}, 6}, + {&pb2.Defaults{F_Int32: proto.Int32(math.MaxInt32)}, 6}, + {&pb2.Defaults{F_Int32: proto.Int32(math.MinInt32)}, 11}, + {&pb2.Defaults{F_Uint32: proto.Uint32(uint32(math.MaxInt32) + 1)}, 6}, + {&pb2.Defaults{F_Uint32: proto.Uint32(math.MaxUint32)}, 6}, } for _, test := range tests { - b, err := Marshal(test.m) + b, err := proto.Marshal(test.m) if err != nil { t.Errorf("Marshal(%v): %v", test.m, err) continue @@ -1846,40 +1740,31 @@ func TestRequiredNotSetError(t *testing.T) { "c906c0ffffffffffffff" // field 105, encoding 1, -64 fixed64 o := old() - bytes, err := Marshal(pb) + bytes, err := proto.Marshal(pb) if !isRequiredNotSetError(err) { fmt.Printf("marshal-1 err = %v, want *RequiredNotSetError", err) o.DebugPrint("", bytes) t.Fatalf("expected = %s", expected) } - if !strings.Contains(err.Error(), "RequiredField.Label") { - t.Errorf("marshal-1 wrong err msg: %v", err) - } if !equal(bytes, expected, t) { o.DebugPrint("neq 1", bytes) t.Fatalf("expected = %s", expected) } // Now test Unmarshal by recreating the original buffer. - pbd := new(GoTest) - err = Unmarshal(bytes, pbd) + pbd := new(pb2.GoTest) + err = proto.Unmarshal(bytes, pbd) if !isRequiredNotSetError(err) { t.Fatalf("unmarshal err = %v, want *RequiredNotSetError", err) o.DebugPrint("", bytes) t.Fatalf("string = %s", expected) } - if !strings.Contains(err.Error(), "RequiredField.Label") && !strings.Contains(err.Error(), "RequiredField.{Unknown}") { - t.Errorf("unmarshal wrong err msg: %v", err) - } - bytes, err = Marshal(pbd) + bytes, err = proto.Marshal(pbd) if !isRequiredNotSetError(err) { t.Errorf("marshal-2 err = %v, want *RequiredNotSetError", err) o.DebugPrint("", bytes) t.Fatalf("string = %s", expected) } - if !strings.Contains(err.Error(), "RequiredField.Label") { - t.Errorf("marshal-2 wrong err msg: %v", err) - } if !equal(bytes, expected, t) { o.DebugPrint("neq 2", bytes) t.Fatalf("string = %s", expected) @@ -1888,16 +1773,16 @@ func TestRequiredNotSetError(t *testing.T) { func TestRequiredNotSetErrorWithBadWireTypes(t *testing.T) { // Required field expects a varint, and properly found a varint. - if err := Unmarshal([]byte{0x08, 0x00}, new(GoEnum)); err != nil { + if err := proto.Unmarshal([]byte{0x08, 0x00}, new(pb2.GoEnum)); err != nil { t.Errorf("Unmarshal = %v, want nil", err) } // Required field expects a varint, but found a fixed32 instead. - if err := Unmarshal([]byte{0x0d, 0x00, 0x00, 0x00, 0x00}, new(GoEnum)); err == nil { + if err := proto.Unmarshal([]byte{0x0d, 0x00, 0x00, 0x00, 0x00}, new(pb2.GoEnum)); err == nil { t.Errorf("Unmarshal = nil, want RequiredNotSetError") } // Required field expects a varint, and found both a varint and fixed32 (ignored). - m := new(GoEnum) - if err := Unmarshal([]byte{0x08, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00}, m); err != nil { + m := new(pb2.GoEnum) + if err := proto.Unmarshal([]byte{0x08, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00}, m); err != nil { t.Errorf("Unmarshal = %v, want nil", err) } if !bytes.Equal(m.XXX_unrecognized, []byte{0x0d, 0x00, 0x00, 0x00, 0x00}) { @@ -1914,19 +1799,19 @@ func fuzzUnmarshal(t *testing.T, data []byte) { } }() - pb := new(MyMessage) - Unmarshal(data, pb) + pb := new(pb2.MyMessage) + proto.Unmarshal(data, pb) } func TestMapFieldMarshal(t *testing.T) { - m := &MessageWithMap{ + m := &pb2.MessageWithMap{ NameMapping: map[int32]string{ 1: "Rob", 4: "Ian", 8: "Dave", }, } - b, err := Marshal(m) + b, err := proto.Marshal(m) if err != nil { t.Fatalf("Marshal: %v", err) } @@ -1959,12 +1844,10 @@ func TestMapFieldMarshal(t *testing.T) { t.Fatalf("Incorrect Marshal output.\n got %q\nwant %q (or a permutation of that)", b, parts[0]+parts[1]+parts[2]) } t.Logf("FYI b: %q", b) - - (new(Buffer)).DebugPrint("Dump of b", b) } func TestMapFieldDeterministicMarshal(t *testing.T) { - m := &MessageWithMap{ + m := &pb2.MessageWithMap{ NameMapping: map[int32]string{ 1: "Rob", 4: "Ian", @@ -1972,8 +1855,8 @@ func TestMapFieldDeterministicMarshal(t *testing.T) { }, } - marshal := func(m Message) []byte { - var b Buffer + marshal := func(m proto.Message) []byte { + var b proto.Buffer b.SetDeterministic(true) if err := b.Marshal(m); err != nil { t.Fatalf("Marshal failed: %v", err) @@ -1990,72 +1873,71 @@ func TestMapFieldDeterministicMarshal(t *testing.T) { } func TestMapFieldRoundTrips(t *testing.T) { - m := &MessageWithMap{ + m := &pb2.MessageWithMap{ NameMapping: map[int32]string{ 1: "Rob", 4: "Ian", 8: "Dave", }, - MsgMapping: map[int64]*FloatingPoint{ - 0x7001: {F: Float64(2.0)}, + MsgMapping: map[int64]*pb2.FloatingPoint{ + 0x7001: {F: proto.Float64(2.0)}, }, ByteMapping: map[bool][]byte{ false: []byte("that's not right!"), true: []byte("aye, 'tis true!"), }, } - b, err := Marshal(m) + b, err := proto.Marshal(m) if err != nil { t.Fatalf("Marshal: %v", err) } t.Logf("FYI b: %q", b) - m2 := new(MessageWithMap) - if err := Unmarshal(b, m2); err != nil { + m2 := new(pb2.MessageWithMap) + if err := proto.Unmarshal(b, m2); err != nil { t.Fatalf("Unmarshal: %v", err) } - if !Equal(m, m2) { + if !proto.Equal(m, m2) { t.Errorf("Map did not survive a round trip.\ninitial: %v\n final: %v", m, m2) } } func TestMapFieldWithNil(t *testing.T) { - m1 := &MessageWithMap{ - MsgMapping: map[int64]*FloatingPoint{ + m1 := &pb2.MessageWithMap{ + MsgMapping: map[int64]*pb2.FloatingPoint{ 1: nil, }, } - b, err := Marshal(m1) - if err != nil { - t.Fatalf("Marshal: %v", err) + b, err := proto.Marshal(m1) + if _, ok := err.(*proto.RequiredNotSetError); !ok { + t.Fatalf("Marshal(%v): err=%v, want RequiredNotSet", m1, err) } - m2 := new(MessageWithMap) - if err := Unmarshal(b, m2); err != nil { - t.Fatalf("Unmarshal: %v, got these bytes: %v", err, b) + m2 := new(pb2.MessageWithMap) + err = proto.Unmarshal(b, m2) + if _, ok := err.(*proto.RequiredNotSetError); !ok { + t.Fatalf("Unmarshal(%v): err=%v, want RequiredNotSet", m1, err) } - if v, ok := m2.MsgMapping[1]; !ok { - t.Error("msg_mapping[1] not present") - } else if v != nil { - t.Errorf("msg_mapping[1] not nil: %v", v) + if !proto.Equal(m1, m2) { + t.Fatalf("roundtrip marshal/unmarshal changed message; got:\n%v\nwant:\n%v", m2, m1) } } func TestMapFieldWithNilBytes(t *testing.T) { - m1 := &MessageWithMap{ + m1 := &pb2.MessageWithMap{ ByteMapping: map[bool][]byte{ false: {}, true: nil, }, } - n := Size(m1) - b, err := Marshal(m1) + n := proto.Size(m1) + b, err := proto.Marshal(m1) if err != nil { t.Fatalf("Marshal: %v", err) } if n != len(b) { t.Errorf("Size(m1) = %d; want len(Marshal(m1)) = %d", n, len(b)) } - m2 := new(MessageWithMap) - if err := Unmarshal(b, m2); err != nil { + m2 := new(pb2.MessageWithMap) + if err := proto.Unmarshal(b, m2); err != nil { t.Fatalf("Unmarshal: %v, got these bytes: %v", err, b) } if v, ok := m2.ByteMapping[false]; !ok { @@ -2076,13 +1958,13 @@ func TestDecodeMapFieldMissingKey(t *testing.T) { // no key 0x12, 0x01, 0x6D, // string value of length 1 byte, value "m" } - got := &MessageWithMap{} - err := Unmarshal(b, got) + got := &pb2.MessageWithMap{} + err := proto.Unmarshal(b, got) if err != nil { t.Fatalf("failed to marshal map with missing key: %v", err) } - want := &MessageWithMap{NameMapping: map[int32]string{0: "m"}} - if !Equal(got, want) { + want := &pb2.MessageWithMap{NameMapping: map[int32]string{0: "m"}} + if !proto.Equal(got, want) { t.Errorf("Unmarshaled map with no key was not as expected. got: %v, want %v", got, want) } } @@ -2093,20 +1975,20 @@ func TestDecodeMapFieldMissingValue(t *testing.T) { 0x08, 0x01, // varint key, value 1 // no value } - got := &MessageWithMap{} - err := Unmarshal(b, got) + got := &pb2.MessageWithMap{} + err := proto.Unmarshal(b, got) if err != nil { t.Fatalf("failed to marshal map with missing value: %v", err) } - want := &MessageWithMap{NameMapping: map[int32]string{1: ""}} - if !Equal(got, want) { + want := &pb2.MessageWithMap{NameMapping: map[int32]string{1: ""}} + if !proto.Equal(got, want) { t.Errorf("Unmarshaled map with no value was not as expected. got: %v, want %v", got, want) } } func TestOneof(t *testing.T) { - m := &Communique{} - b, err := Marshal(m) + m := &pb2.Communique{} + b, err := proto.Marshal(m) if err != nil { t.Fatalf("Marshal of empty message with oneof: %v", err) } @@ -2114,12 +1996,12 @@ func TestOneof(t *testing.T) { t.Errorf("Marshal of empty message yielded too many bytes: %v", b) } - m = &Communique{ - Union: &Communique_Name{"Barry"}, + m = &pb2.Communique{ + Union: &pb2.Communique_Name{"Barry"}, } // Round-trip. - b, err = Marshal(m) + b, err = proto.Marshal(m) if err != nil { t.Fatalf("Marshal of message with oneof: %v", err) } @@ -2127,10 +2009,10 @@ func TestOneof(t *testing.T) { t.Errorf("Incorrect marshal of message with oneof: %v", b) } m.Reset() - if err := Unmarshal(b, m); err != nil { + if err := proto.Unmarshal(b, m); err != nil { t.Fatalf("Unmarshal of message with oneof: %v", err) } - if x, ok := m.Union.(*Communique_Name); !ok || x.Name != "Barry" { + if x, ok := m.Union.(*pb2.Communique_Name); !ok || x.Name != "Barry" { t.Errorf("After round trip, Union = %+v", m.Union) } if name := m.GetName(); name != "Barry" { @@ -2138,8 +2020,8 @@ func TestOneof(t *testing.T) { } // Let's try with a message in the oneof. - m.Union = &Communique_Msg{&Strings{StringField: String("deep deep string")}} - b, err = Marshal(m) + m.Union = &pb2.Communique_Msg{&pb2.Strings{StringField: proto.String("deep deep string")}} + b, err = proto.Marshal(m) if err != nil { t.Fatalf("Marshal of message with oneof set to message: %v", err) } @@ -2147,10 +2029,10 @@ func TestOneof(t *testing.T) { t.Errorf("Incorrect marshal of message with oneof set to message: %v", b) } m.Reset() - if err := Unmarshal(b, m); err != nil { + if err := proto.Unmarshal(b, m); err != nil { t.Fatalf("Unmarshal of message with oneof set to message: %v", err) } - ss, ok := m.Union.(*Communique_Msg) + ss, ok := m.Union.(*pb2.Communique_Msg) if !ok || ss.Msg.GetStringField() != "deep deep string" { t.Errorf("After round trip with oneof set to message, Union = %+v", m.Union) } @@ -2158,8 +2040,8 @@ func TestOneof(t *testing.T) { func TestOneofNilBytes(t *testing.T) { // A oneof with nil byte slice should marshal to tag + 0 (size), with no error. - m := &Communique{Union: &Communique_Data{Data: nil}} - b, err := Marshal(m) + m := &pb2.Communique{Union: &pb2.Communique_Data{Data: nil}} + b, err := proto.Marshal(m) if err != nil { t.Fatalf("Marshal failed: %v", err) } @@ -2180,7 +2062,7 @@ func TestInefficientPackedBool(t *testing.T) { // but it is permitted to be any varint. 0xb9, 0x30, } - if err := Unmarshal(inp, new(MoreRepeated)); err != nil { + if err := proto.Unmarshal(inp, new(pb2.MoreRepeated)); err != nil { t.Error(err) } } @@ -2188,19 +2070,19 @@ func TestInefficientPackedBool(t *testing.T) { // Make sure pure-reflect-based implementation handles // []int32-[]enum conversion correctly. func TestRepeatedEnum2(t *testing.T) { - pb := &RepeatedEnum{ - Color: []RepeatedEnum_Color{RepeatedEnum_RED}, + pb := &pb2.RepeatedEnum{ + Color: []pb2.RepeatedEnum_Color{pb2.RepeatedEnum_RED}, } - b, err := Marshal(pb) + b, err := proto.Marshal(pb) if err != nil { t.Fatalf("Marshal failed: %v", err) } - x := new(RepeatedEnum) - err = Unmarshal(b, x) + x := new(pb2.RepeatedEnum) + err = proto.Unmarshal(b, x) if err != nil { t.Fatalf("Unmarshal failed: %v", err) } - if !Equal(pb, x) { + if !proto.Equal(pb, x) { t.Errorf("Incorrect result: want: %v got: %v", pb, x) } } @@ -2218,7 +2100,7 @@ func TestConcurrentMarshal(t *testing.T) { go func(i int) { defer wg.Done() var err error - b[i], err = Marshal(pb) + b[i], err = proto.Marshal(pb) if err != nil { t.Errorf("marshal error: %v", err) } @@ -2237,39 +2119,39 @@ func TestInvalidUTF8(t *testing.T) { const invalidUTF8 = "\xde\xad\xbe\xef\x80\x00\xff" tests := []struct { label string - proto2 Message - proto3 Message + proto2 proto.Message + proto3 proto.Message want []byte }{{ label: "Scalar", - proto2: &TestUTF8{Scalar: String(invalidUTF8)}, + proto2: &pb2.TestUTF8{Scalar: proto.String(invalidUTF8)}, proto3: &pb3.TestUTF8{Scalar: invalidUTF8}, want: []byte{0x0a, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff}, }, { label: "Vector", - proto2: &TestUTF8{Vector: []string{invalidUTF8}}, + proto2: &pb2.TestUTF8{Vector: []string{invalidUTF8}}, proto3: &pb3.TestUTF8{Vector: []string{invalidUTF8}}, want: []byte{0x12, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff}, }, { label: "Oneof", - proto2: &TestUTF8{Oneof: &TestUTF8_Field{invalidUTF8}}, + proto2: &pb2.TestUTF8{Oneof: &pb2.TestUTF8_Field{invalidUTF8}}, proto3: &pb3.TestUTF8{Oneof: &pb3.TestUTF8_Field{invalidUTF8}}, want: []byte{0x1a, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff}, }, { label: "MapKey", - proto2: &TestUTF8{MapKey: map[string]int64{invalidUTF8: 0}}, + proto2: &pb2.TestUTF8{MapKey: map[string]int64{invalidUTF8: 0}}, proto3: &pb3.TestUTF8{MapKey: map[string]int64{invalidUTF8: 0}}, want: []byte{0x22, 0x0b, 0x0a, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff, 0x10, 0x00}, }, { label: "MapValue", - proto2: &TestUTF8{MapValue: map[int64]string{0: invalidUTF8}}, + proto2: &pb2.TestUTF8{MapValue: map[int64]string{0: invalidUTF8}}, proto3: &pb3.TestUTF8{MapValue: map[int64]string{0: invalidUTF8}}, want: []byte{0x2a, 0x0b, 0x08, 0x00, 0x12, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff}, }} for _, tt := range tests { // Proto2 should not validate UTF-8. - b, err := Marshal(tt.proto2) + b, err := proto.Marshal(tt.proto2) if err != nil { t.Errorf("Marshal(proto2.%s) = %v, want nil", tt.label, err) } @@ -2277,41 +2159,33 @@ func TestInvalidUTF8(t *testing.T) { t.Errorf("Marshal(proto2.%s) = %x, want %x", tt.label, b, tt.want) } - m := Clone(tt.proto2) + m := proto.Clone(tt.proto2) m.Reset() - if err = Unmarshal(tt.want, m); err != nil { + if err = proto.Unmarshal(tt.want, m); err != nil { t.Errorf("Unmarshal(proto2.%s) = %v, want nil", tt.label, err) } - if !Equal(m, tt.proto2) { + if !proto.Equal(m, tt.proto2) { t.Errorf("proto2.%s: output mismatch:\ngot %v\nwant %v", tt.label, m, tt.proto2) } // Proto3 should validate UTF-8. - b, err = Marshal(tt.proto3) - if err == nil { + if _, err := proto.Marshal(tt.proto3); err == nil { t.Errorf("Marshal(proto3.%s) = %v, want non-nil", tt.label, err) } - if !bytes.Equal(b, tt.want) { - t.Errorf("Marshal(proto3.%s) = %x, want %x", tt.label, b, tt.want) - } - m = Clone(tt.proto3) + m = proto.Clone(tt.proto3) m.Reset() - err = Unmarshal(tt.want, m) - if err == nil { + if err := proto.Unmarshal(tt.want, m); err == nil { t.Errorf("Unmarshal(proto3.%s) = %v, want non-nil", tt.label, err) } - if !Equal(m, tt.proto3) { - t.Errorf("proto3.%s: output mismatch:\ngot %v\nwant %v", tt.label, m, tt.proto2) - } } } func TestRequired(t *testing.T) { // The F_BoolRequired field appears after all of the required fields. // It should still be handled even after multiple required field violations. - m := &GoTest{F_BoolRequired: Bool(true)} - got, err := Marshal(m) + m := &pb2.GoTest{F_BoolRequired: proto.Bool(true)} + got, err := proto.Marshal(m) if !isRequiredNotSetError(err) { t.Errorf("Marshal() = %v, want RequiredNotSetError error", err) } @@ -2319,8 +2193,8 @@ func TestRequired(t *testing.T) { t.Errorf("Marshal() = %x, want %x", got, want) } - m = new(GoTest) - err = Unmarshal(got, m) + m = new(pb2.GoTest) + err = proto.Unmarshal(got, m) if !isRequiredNotSetError(err) { t.Errorf("Marshal() = %v, want RequiredNotSetError error", err) } @@ -2330,9 +2204,9 @@ func TestRequired(t *testing.T) { } func TestUnknownV2(t *testing.T) { - m := new(tpb.Timestamp) + m := new(tspb.Timestamp) m.ProtoReflect().SetUnknown([]byte("\x92\x4d\x12unknown field 1234")) - got := CompactTextString(m) + got := proto.CompactTextString(m) if !strings.Contains(got, "unknown field 1234") { t.Errorf("got %q, want contains %q", got, "unknown field 1234") } @@ -2340,7 +2214,7 @@ func TestUnknownV2(t *testing.T) { // Benchmarks -func testMsg() *GoTest { +func testMsg() *pb2.GoTest { pb := initGoTest(true) const N = 1000 // Internally the library starts much smaller. pb.F_Int32Repeated = make([]int32, N) @@ -2352,7 +2226,7 @@ func testMsg() *GoTest { return pb } -func bytesMsg() *GoTest { +func bytesMsg() *pb2.GoTest { pb := initGoTest(true) buf := make([]byte, 4000) for i := range buf { @@ -2362,7 +2236,7 @@ func bytesMsg() *GoTest { return pb } -func benchmarkMarshal(b *testing.B, pb Message, marshal func(Message) ([]byte, error)) { +func benchmarkMarshal(b *testing.B, pb proto.Message, marshal func(proto.Message) ([]byte, error)) { d, _ := marshal(pb) b.SetBytes(int64(len(d))) b.ResetTimer() @@ -2371,32 +2245,32 @@ func benchmarkMarshal(b *testing.B, pb Message, marshal func(Message) ([]byte, e } } -func benchmarkBufferMarshal(b *testing.B, pb Message) { - p := NewBuffer(nil) - benchmarkMarshal(b, pb, func(pb0 Message) ([]byte, error) { +func benchmarkBufferMarshal(b *testing.B, pb proto.Message) { + p := proto.NewBuffer(nil) + benchmarkMarshal(b, pb, func(pb0 proto.Message) ([]byte, error) { p.Reset() err := p.Marshal(pb0) return p.Bytes(), err }) } -func benchmarkSize(b *testing.B, pb Message) { - benchmarkMarshal(b, pb, func(pb0 Message) ([]byte, error) { - Size(pb) +func benchmarkSize(b *testing.B, pb proto.Message) { + benchmarkMarshal(b, pb, func(pb0 proto.Message) ([]byte, error) { + proto.Size(pb) return nil, nil }) } -func newOf(pb Message) Message { +func newOf(pb proto.Message) proto.Message { in := reflect.ValueOf(pb) if in.IsNil() { return pb } - return reflect.New(in.Type().Elem()).Interface().(Message) + return reflect.New(in.Type().Elem()).Interface().(proto.Message) } -func benchmarkUnmarshal(b *testing.B, pb Message, unmarshal func([]byte, Message) error) { - d, _ := Marshal(pb) +func benchmarkUnmarshal(b *testing.B, pb proto.Message, unmarshal func([]byte, proto.Message) error) { + d, _ := proto.Marshal(pb) b.SetBytes(int64(len(d))) pbd := newOf(pb) @@ -2406,9 +2280,9 @@ func benchmarkUnmarshal(b *testing.B, pb Message, unmarshal func([]byte, Message } } -func benchmarkBufferUnmarshal(b *testing.B, pb Message) { - p := NewBuffer(nil) - benchmarkUnmarshal(b, pb, func(d []byte, pb0 Message) error { +func benchmarkBufferUnmarshal(b *testing.B, pb proto.Message) { + p := proto.NewBuffer(nil) + benchmarkUnmarshal(b, pb, func(d []byte, pb0 proto.Message) error { p.SetBuf(d) return p.Unmarshal(pb0) }) @@ -2417,7 +2291,7 @@ func benchmarkBufferUnmarshal(b *testing.B, pb Message) { // Benchmark{Marshal,BufferMarshal,Size,Unmarshal,BufferUnmarshal}{,Bytes} func BenchmarkMarshal(b *testing.B) { - benchmarkMarshal(b, testMsg(), Marshal) + benchmarkMarshal(b, testMsg(), proto.Marshal) } func BenchmarkBufferMarshal(b *testing.B) { @@ -2429,7 +2303,7 @@ func BenchmarkSize(b *testing.B) { } func BenchmarkUnmarshal(b *testing.B) { - benchmarkUnmarshal(b, testMsg(), Unmarshal) + benchmarkUnmarshal(b, testMsg(), proto.Unmarshal) } func BenchmarkBufferUnmarshal(b *testing.B) { @@ -2437,7 +2311,7 @@ func BenchmarkBufferUnmarshal(b *testing.B) { } func BenchmarkMarshalBytes(b *testing.B) { - benchmarkMarshal(b, bytesMsg(), Marshal) + benchmarkMarshal(b, bytesMsg(), proto.Marshal) } func BenchmarkBufferMarshalBytes(b *testing.B) { @@ -2449,7 +2323,7 @@ func BenchmarkSizeBytes(b *testing.B) { } func BenchmarkUnmarshalBytes(b *testing.B) { - benchmarkUnmarshal(b, bytesMsg(), Unmarshal) + benchmarkUnmarshal(b, bytesMsg(), proto.Unmarshal) } func BenchmarkBufferUnmarshalBytes(b *testing.B) { @@ -2459,22 +2333,22 @@ func BenchmarkBufferUnmarshalBytes(b *testing.B) { func BenchmarkUnmarshalUnrecognizedFields(b *testing.B) { b.StopTimer() pb := initGoTestField() - skip := &GoSkipTest{ - SkipInt32: Int32(32), - SkipFixed32: Uint32(3232), - SkipFixed64: Uint64(6464), - SkipString: String("skipper"), - Skipgroup: &GoSkipTest_SkipGroup{ - GroupInt32: Int32(75), - GroupString: String("wxyz"), + skip := &pb2.GoSkipTest{ + SkipInt32: proto.Int32(32), + SkipFixed32: proto.Uint32(3232), + SkipFixed64: proto.Uint64(6464), + SkipString: proto.String("skipper"), + Skipgroup: &pb2.GoSkipTest_SkipGroup{ + GroupInt32: proto.Int32(75), + GroupString: proto.String("wxyz"), }, } - pbd := new(GoTestField) - p := NewBuffer(nil) + pbd := new(pb2.GoTestField) + p := proto.NewBuffer(nil) p.Marshal(pb) p.Marshal(skip) - p2 := NewBuffer(nil) + p2 := proto.NewBuffer(nil) b.StartTimer() for i := 0; i < b.N; i++ { @@ -2482,3 +2356,173 @@ func BenchmarkUnmarshalUnrecognizedFields(b *testing.B) { p2.Unmarshal(pbd) } } + +func TestProto3ZeroValues(t *testing.T) { + tests := []struct { + desc string + m proto.Message + }{ + {"zero message", &pb3.Message{}}, + {"empty bytes field", &pb3.Message{Data: []byte{}}}, + } + for _, test := range tests { + b, err := proto.Marshal(test.m) + if err != nil { + t.Errorf("%s: proto.Marshal: %v", test.desc, err) + continue + } + if len(b) > 0 { + t.Errorf("%s: Encoding is non-empty: %q", test.desc, b) + } + } +} + +func TestRoundTripProto3(t *testing.T) { + m := &pb3.Message{ + Name: "David", // (2 | 1<<3): 0x0a 0x05 "David" + Hilarity: pb3.Message_PUNS, // (0 | 2<<3): 0x10 0x01 + HeightInCm: 178, // (0 | 3<<3): 0x18 0xb2 0x01 + Data: []byte("roboto"), // (2 | 4<<3): 0x20 0x06 "roboto" + ResultCount: 47, // (0 | 7<<3): 0x38 0x2f + TrueScotsman: true, // (0 | 8<<3): 0x40 0x01 + Score: 8.1, // (5 | 9<<3): 0x4d <8.1> + + Key: []uint64{1, 0xdeadbeef}, + Nested: &pb3.Nested{ + Bunny: "Monty", + }, + } + t.Logf(" m: %v", m) + + b, err := proto.Marshal(m) + if err != nil { + t.Fatalf("proto.Marshal: %v", err) + } + t.Logf(" b: %q", b) + + m2 := new(pb3.Message) + if err := proto.Unmarshal(b, m2); err != nil { + t.Fatalf("proto.Unmarshal: %v", err) + } + t.Logf("m2: %v", m2) + + if !proto.Equal(m, m2) { + t.Errorf("proto.Equal returned false:\n m: %v\nm2: %v", m, m2) + } +} + +func TestGettersForBasicTypesExist(t *testing.T) { + var m pb3.Message + if got := m.GetNested().GetBunny(); got != "" { + t.Errorf("m.GetNested().GetBunny() = %q, want empty string", got) + } + if got := m.GetNested().GetCute(); got { + t.Errorf("m.GetNested().GetCute() = %t, want false", got) + } +} + +func TestProto3SetDefaults(t *testing.T) { + in := &pb3.Message{ + Terrain: map[string]*pb3.Nested{ + "meadow": new(pb3.Nested), + }, + Proto2Field: new(pb2.SubDefaults), + Proto2Value: map[string]*pb2.SubDefaults{ + "badlands": new(pb2.SubDefaults), + }, + } + + got := proto.Clone(in).(*pb3.Message) + proto.SetDefaults(got) + + // There are no defaults in proto3. Everything should be the zero value, but + // we need to remember to set defaults for nested proto2 messages. + want := &pb3.Message{ + Terrain: map[string]*pb3.Nested{ + "meadow": new(pb3.Nested), + }, + Proto2Field: &pb2.SubDefaults{N: proto.Int64(7)}, + Proto2Value: map[string]*pb2.SubDefaults{ + "badlands": &pb2.SubDefaults{N: proto.Int64(7)}, + }, + } + + if !proto.Equal(got, want) { + t.Errorf("with in = %v\nproto.SetDefaults(in) =>\ngot %v\nwant %v", in, got, want) + } +} + +func TestUnknownFieldPreservation(t *testing.T) { + b1 := "\x0a\x05David" // Known tag 1 + b2 := "\xc2\x0c\x06Google" // Unknown tag 200 + b := []byte(b1 + b2) + + m := new(pb3.Message) + if err := proto.Unmarshal(b, m); err != nil { + t.Fatalf("proto.Unmarshal: %v", err) + } + + if !bytes.Equal(m.XXX_unrecognized, []byte(b2)) { + t.Fatalf("mismatching unknown fields:\ngot %q\nwant %q", m.XXX_unrecognized, b2) + } +} + +func TestMap(t *testing.T) { + var b []byte + fmt.Sscanf("a2010c0a044b657931120456616c31a201130a044b657932120556616c3261120456616c32a201240a044b6579330d05000000120556616c33621a0556616c3361120456616c331505000000a20100a201260a044b657934130a07536f6d6555524c1209536f6d655469746c651a08536e69707065743114", "%x", &b) + + var m pb3.Message + if err := proto.Unmarshal(b, &m); err != nil { + t.Fatalf("proto.Unmarshal error: %v", err) + } + + got := m.StringMap + want := map[string]string{ + "": "", + "Key1": "Val1", + "Key2": "Val2", + "Key3": "Val3", + "Key4": "", + } + + if !reflect.DeepEqual(got, want) { + t.Errorf("maps differ:\ngot %#v\nwant %#v", got, want) + } +} + +func marshalled() []byte { + m := &pb3.IntMaps{} + for i := 0; i < 1000; i++ { + m.Maps = append(m.Maps, &pb3.IntMap{ + Rtt: map[int32]int32{1: 2}, + }) + } + b, err := proto.Marshal(m) + if err != nil { + panic(fmt.Sprintf("Can't marshal %+v: %v", m, err)) + } + return b +} + +func BenchmarkConcurrentMapUnmarshal(b *testing.B) { + in := marshalled() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + var out pb3.IntMaps + if err := proto.Unmarshal(in, &out); err != nil { + b.Errorf("Can't unmarshal ppb.IntMaps: %v", err) + } + } + }) +} + +func BenchmarkSequentialMapUnmarshal(b *testing.B) { + in := marshalled() + b.ResetTimer() + for i := 0; i < b.N; i++ { + var out pb3.IntMaps + if err := proto.Unmarshal(in, &out); err != nil { + b.Errorf("Can't unmarshal ppb.IntMaps: %v", err) + } + } +} diff --git a/proto/registry.go b/proto/registry.go index 49732ce8e3..8c927ae3c6 100644 --- a/proto/registry.go +++ b/proto/registry.go @@ -1,166 +1,323 @@ -// Copyright 2018 The Go Authors. All rights reserved. +// 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 ( + "bytes" + "compress/gzip" "fmt" - "log" + "io/ioutil" "reflect" - "strconv" + "strings" + "sync" + + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/runtime/protoimpl" ) -var enumValueMaps = make(map[string]map[string]int32) +// filePath is the path to the proto source file. +type filePath = string // e.g., "google/protobuf/descriptor.proto" + +// fileDescGZIP is the compressed contents of the encoded FileDescriptorProto. +type fileDescGZIP = []byte + +var fileCache sync.Map // map[filePath]fileDescGZIP -// RegisterEnum is called from the generated code to install the enum descriptor -// maps into the global table to aid parsing text format protocol buffers. -func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { - if registerEnumAlt != nil { - registerEnumAlt(typeName, unusedNameMap, valueMap) // populated by hooks_enabled.go - return +// RegisterFile is called from generated code to register the compressed +// FileDescriptorProto with the file path for a proto source file. +// +// Deprecated: Use protoregistry.GlobalFiles.Register instead. +func RegisterFile(s filePath, d fileDescGZIP) { + // Decompress the descriptor. + zr, err := gzip.NewReader(bytes.NewReader(d)) + if err != nil { + panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) } - if _, ok := enumValueMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) + b, err := ioutil.ReadAll(zr) + if err != nil { + panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) } - enumValueMaps[typeName] = valueMap + + // Construct a protoreflect.FileDescriptor from the raw descriptor. + // Note that DescBuilder.Build automatically registers the constructed + // file descriptor with the v2 registry. + protoimpl.DescBuilder{RawDescriptor: b}.Build() + + // Locally cache the raw descriptor form for the file. + fileCache.Store(s, d) } -// EnumValueMap returns the mapping from names to integers of the -// enum type enumType, or a nil if not found. -func EnumValueMap(enumType string) map[string]int32 { - if enumValueMapAlt != nil { - return enumValueMapAlt(enumType) // populated by hooks_enabled.go +// FileDescriptor returns the compressed FileDescriptorProto given the file path +// for a proto source file. It returns nil if not found. +// +// Deprecated: Use protoregistry.GlobalFiles.RangeFilesByPath instead. +func FileDescriptor(s filePath) fileDescGZIP { + if v, ok := fileCache.Load(s); ok { + return v.(fileDescGZIP) } - return enumValueMaps[enumType] + + // Find the descriptor in the v2 registry. + var b []byte + if fd, _ := protoregistry.GlobalFiles.FindFileByPath(s); fd != nil { + if fd, ok := fd.(interface{ ProtoLegacyRawDesc() []byte }); ok { + b = fd.ProtoLegacyRawDesc() + } else { + // TODO: Use protodesc.ToFileDescriptorProto to construct + // a descriptorpb.FileDescriptorProto and marshal it. + // However, doing so causes the proto package to have a dependency + // on descriptorpb, leading to cyclic dependency issues. + } + } + + // Locally cache the raw descriptor form for the file. + if len(b) > 0 { + v, _ := fileCache.LoadOrStore(s, protoimpl.X.CompressGZIP(b)) + return v.(fileDescGZIP) + } + return nil } -// A registry of all linked message types. -// The string is a fully-qualified proto name ("pkg.Message"). -var ( - protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers - protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types - revProtoTypes = make(map[reflect.Type]string) -) +// enumName is the name of an enum. For historical reasons, the enum name is +// neither the full Go name nor the full protobuf name of the enum. +// The name is the dot-separated combination of just the proto package that the +// enum is declared within followed by the Go type name of the generated enum. +type enumName = string // e.g., "my.proto.package.GoMessage_GoEnum" -// RegisterType is called from generated code and maps from the fully qualified -// proto name to the type (pointer to struct) of the protocol buffer. -func RegisterType(x Message, name string) { - if registerTypeAlt != nil { - registerTypeAlt(x, name) // populated by hooks_enabled.go - return - } - if _, ok := protoTypedNils[name]; ok { - // TODO: Some day, make this a panic. - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { - // Generated code always calls RegisterType with nil x. - // This check is just for extra safety. - protoTypedNils[name] = x - } else { - protoTypedNils[name] = reflect.Zero(t).Interface().(Message) - } - revProtoTypes[t] = name +// enumsByName maps enum values by name to their numeric counterpart. +type enumsByName = map[string]int32 + +// enumsByNumber maps enum values by number to their name counterpart. +type enumsByNumber = map[int32]string + +var enumCache sync.Map // map[enumName]enumsByName +var numFilesCache sync.Map // map[protoreflect.FullName]int + +// RegisterEnum is called from the generated code to register the mapping of +// enum value names to enum numbers for the enum identified by s. +// +// Deprecated: Use protoregistry.GlobalTypes.Register instead. +func RegisterEnum(s enumName, _ enumsByNumber, m enumsByName) { + if _, ok := enumCache.Load(s); ok { + panic("proto: duplicate enum registered: " + s) + } + enumCache.Store(s, m) + + // This does not forward registration to the v2 registry since this API + // lacks sufficient information to construct a complete v2 enum descriptor. } -// RegisterMapType is called from generated code and maps from the fully qualified -// proto name to the native map type of the proto map definition. -func RegisterMapType(x interface{}, name string) { - if registerMapTypeAlt != nil { - registerMapTypeAlt(x, name) // populated by hooks_enabled.go - return +// EnumValueMap returns the mapping from enum value names to enum numbers for +// the enum of the given name. It returns nil if not found. +// +// Deprecated: Use protoregistry.GlobalTypes.FindEnumByName instead. +func EnumValueMap(s enumName) enumsByName { + if v, ok := enumCache.Load(s); ok { + return v.(enumsByName) } - if reflect.TypeOf(x).Kind() != reflect.Map { - panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) + + // Check whether the cache is stale. If the number of files in the current + // package differs, then it means that some enums may have been recently + // registered upstream that we do not know about. + var protoPkg protoreflect.FullName + if i := strings.LastIndexByte(s, '.'); i >= 0 { + protoPkg = protoreflect.FullName(s[:i]) } - if _, ok := protoMapTypes[name]; ok { - log.Printf("proto: duplicate proto type registered: %s", name) - return + v, _ := numFilesCache.Load(protoPkg) + numFiles, _ := v.(int) + if protoregistry.GlobalFiles.NumFilesByPackage(protoPkg) == numFiles { + return nil // cache is up-to-date; was not found earlier } - t := reflect.TypeOf(x) - protoMapTypes[name] = t - // Avoid registering into revProtoTypes since map types are not unique. - // revProtoTypes[t] = name + // Update the enum cache for all enums declared in the given proto package. + numFiles = 0 + protoregistry.GlobalFiles.RangeFilesByPackage(protoPkg, func(fd protoreflect.FileDescriptor) bool { + walkEnums(fd, func(ed protoreflect.EnumDescriptor) { + name := protoimpl.X.LegacyEnumName(ed) + if _, ok := enumCache.Load(name); !ok { + m := make(enumsByName) + evs := ed.Values() + for i := evs.Len() - 1; i >= 0; i-- { + ev := evs.Get(i) + m[string(ev.Name())] = int32(ev.Number()) + } + enumCache.LoadOrStore(name, m) + } + }) + numFiles++ + return true + }) + numFilesCache.Store(protoPkg, numFiles) + + // Check cache again for enum map. + if v, ok := enumCache.Load(s); ok { + return v.(enumsByName) + } + return nil } -// MessageName returns the fully-qualified proto name for the given message type. -func MessageName(x Message) string { - if messageNameAlt != nil { - return messageNameAlt(x) // populated by hooks_enabled.go +// walkEnums recursively walks all enums declared in d. +func walkEnums(d interface { + Enums() protoreflect.EnumDescriptors + Messages() protoreflect.MessageDescriptors +}, f func(protoreflect.EnumDescriptor)) { + eds := d.Enums() + for i := eds.Len() - 1; i >= 0; i-- { + f(eds.Get(i)) } - type xname interface { - XXX_MessageName() string + mds := d.Messages() + for i := mds.Len() - 1; i >= 0; i-- { + walkEnums(mds.Get(i), f) } - if m, ok := x.(xname); ok { - return m.XXX_MessageName() +} + +// messageName is the full name of protobuf message. +type messageName = string + +var messageTypeCache sync.Map // map[messageName]reflect.Type + +// RegisterType is called from generated code to register the message Go type +// for a message of the given name. +// +// Deprecated: Use protoregistry.GlobalTypes.Register instead. +func RegisterType(m Message, s messageName) { + mt := protoimpl.X.LegacyMessageTypeOf(m, protoreflect.FullName(s)) + if err := protoregistry.GlobalTypes.RegisterMessage(mt); err != nil { + panic(err) } - return revProtoTypes[reflect.TypeOf(x)] + messageTypeCache.Store(s, reflect.TypeOf(m)) } -// MessageType returns the message type (pointer to struct) for a named message. -// The type is not guaranteed to implement proto.Message if the name refers to a -// map entry. -func MessageType(name string) reflect.Type { - if messageTypeAlt != nil { - return messageTypeAlt(name) // populated by hooks_enabled.go +// RegisterMapType is called from generated code to register the Go map type +// for a protobuf message representing a map entry. +// +// Deprecated: Do not use. +func RegisterMapType(m interface{}, s messageName) { + t := reflect.TypeOf(m) + if t.Kind() != reflect.Map { + panic(fmt.Sprintf("invalid map kind: %v", t)) } - if t, ok := protoTypedNils[name]; ok { - return reflect.TypeOf(t) + if _, ok := messageTypeCache.Load(s); ok { + panic(fmt.Errorf("proto: duplicate proto message registered: %s", s)) } - return protoMapTypes[name] + messageTypeCache.Store(s, t) } -// A registry of all linked proto files. -var protoFiles = make(map[string][]byte) // file name => fileDescriptor +// MessageType returns the message type for a named message. +// It returns nil if not found. +// +// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead. +func MessageType(s messageName) reflect.Type { + if v, ok := messageTypeCache.Load(s); ok { + return v.(reflect.Type) + } + + // Derive the message type from the v2 registry. + var t reflect.Type + if mt, _ := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(s)); mt != nil { + t = messageGoType(mt) + } + + // If we could not get a concrete type, it is possible that it is a + // pseudo-message for a map entry. + if t == nil { + d, _ := protoregistry.GlobalFiles.FindDescriptorByName(protoreflect.FullName(s)) + if md, _ := d.(protoreflect.MessageDescriptor); md != nil && md.IsMapEntry() { + kt := goTypeForField(md.Fields().ByNumber(1)) + vt := goTypeForField(md.Fields().ByNumber(2)) + t = reflect.MapOf(kt, vt) + } + } -// RegisterFile is called from generated code and maps from the -// full file name of a .proto file to its compressed FileDescriptorProto. -func RegisterFile(filename string, fileDescriptor []byte) { - if registerFileAlt != nil { - registerFileAlt(filename, fileDescriptor) // populated by hooks_enabled.go - return + // Locally cache the message type for the given name. + if t != nil { + v, _ := messageTypeCache.LoadOrStore(s, t) + return v.(reflect.Type) } - protoFiles[filename] = fileDescriptor + return nil } -// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. -func FileDescriptor(filename string) []byte { - if fileDescriptorAlt != nil { - return fileDescriptorAlt(filename) // populated by hooks_enabled.go +func goTypeForField(fd protoreflect.FieldDescriptor) reflect.Type { + switch k := fd.Kind(); k { + case protoreflect.EnumKind: + if et, _ := protoregistry.GlobalTypes.FindEnumByName(fd.Enum().FullName()); et != nil { + return enumGoType(et) + } + return reflect.TypeOf(protoreflect.EnumNumber(0)) + case protoreflect.MessageKind, protoreflect.GroupKind: + if mt, _ := protoregistry.GlobalTypes.FindMessageByName(fd.Message().FullName()); mt != nil { + return messageGoType(mt) + } + return reflect.TypeOf((*protoreflect.Message)(nil)).Elem() + default: + return reflect.TypeOf(fd.Default().Interface()) } - return protoFiles[filename] } -var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) +func enumGoType(et protoreflect.EnumType) reflect.Type { + return reflect.TypeOf(et.New(0)) +} -// RegisterExtension is called from the generated code. -func RegisterExtension(desc *ExtensionDesc) { - if registerExtensionAlt != nil { - registerExtensionAlt(desc) // populated by hooks_enabled.go - return - } - st := reflect.TypeOf(desc.ExtendedType).Elem() - m := extensionMaps[st] +func messageGoType(mt protoreflect.MessageType) reflect.Type { + return reflect.TypeOf(protoimpl.X.ProtoMessageV1Of(mt.New().Interface())) +} + +// MessageName returns the full protobuf name for the given message type. +// +// Deprecated: Use protoreflect.MessageDescriptor.FullName instead. +func MessageName(m Message) messageName { if m == nil { - m = make(map[int32]*ExtensionDesc) - extensionMaps[st] = m + return "" } - if _, ok := m[desc.Field]; ok { - panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) + if m, ok := m.(interface{ XXX_MessageName() messageName }); ok { + return m.XXX_MessageName() } - m[desc.Field] = desc + return messageName(protoimpl.X.MessageDescriptorOf(m).FullName()) } -// RegisteredExtensions returns a map of the registered extensions of a -// protocol buffer struct, indexed by the extension number. -// The argument pb should be a nil pointer to the struct type. -func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { - if registeredExtensionsAlt != nil { - return registeredExtensionsAlt(pb) // populated by hooks_enabled.go +// RegisterExtension is called from the generated code to register +// the extension descriptor. +// +// Deprecated: Use protoregistry.GlobalTypes.Register instead. +func RegisterExtension(d *ExtensionDesc) { + if err := protoregistry.GlobalTypes.RegisterExtension(d); err != nil { + panic(err) } - return extensionMaps[reflect.TypeOf(pb).Elem()] +} + +type extensionsByNumber = map[int32]*ExtensionDesc + +var extensionCache sync.Map // map[messageName]extensionsByNumber + +// RegisteredExtensions returns a map of the registered extensions for the +// provided protobuf message, indexed by the extension field number. +// +// Deprecated: Use protoregistry.GlobalTypes.RangeExtensionsByMessage instead. +func RegisteredExtensions(m Message) extensionsByNumber { + // Check whether the cache is stale. If the number of extensions for + // the given message differs, then it means that some extensions were + // recently registered upstream that we do not know about. + s := MessageName(m) + v, _ := extensionCache.Load(s) + xs, _ := v.(extensionsByNumber) + if protoregistry.GlobalTypes.NumExtensionsByMessage(protoreflect.FullName(s)) == len(xs) { + return xs // cache is up-to-date + } + + // Cache is stale, re-compute the extensions map. + xs = make(extensionsByNumber) + protoregistry.GlobalTypes.RangeExtensionsByMessage(protoreflect.FullName(s), func(xt protoreflect.ExtensionType) bool { + if xd, ok := xt.(*ExtensionDesc); ok { + xs[int32(xt.TypeDescriptor().Number())] = xd + } else { + // TODO: This implies that the protoreflect.ExtensionType is a + // custom type not generated by protoc-gen-go. We could try and + // convert the type to an ExtensionDesc. + } + return true + }) + extensionCache.Store(s, xs) + return xs } diff --git a/proto/registry_test.go b/proto/registry_test.go index ed3cd5583c..89c4f783c8 100644 --- a/proto/registry_test.go +++ b/proto/registry_test.go @@ -9,20 +9,29 @@ import ( "testing" "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/types/descriptorpb" + descpb "github.com/golang/protobuf/protoc-gen-go/descriptor" ) func TestRegistry(t *testing.T) { - if got := proto.FileDescriptor("google/protobuf/descriptor.proto"); len(got) == 0 { - t.Errorf(`FileDescriptor("google/protobuf/descriptor.proto") = empty, want non-empty`) + file := new(descpb.DescriptorProto).ProtoReflect().Descriptor().ParentFile() + path := file.Path() + pkg := file.Package() + if got := proto.FileDescriptor(path); len(got) == 0 { + t.Errorf("FileDescriptor(%q) = empty, want non-empty", path) } - if got := proto.EnumValueMap("google.protobuf.FieldDescriptorProto_Label"); len(got) == 0 { - t.Errorf(`EnumValueMap("google.protobuf.FieldDescriptorProto_Label") = empty, want non-empty`) + + name := protoreflect.FullName(pkg + ".FieldDescriptorProto_Label") + if got := proto.EnumValueMap(string(name)); len(got) == 0 { + t.Errorf("EnumValueMap(%q) = empty, want non-empty", name) } - wantType := reflect.TypeOf(new(descriptorpb.EnumDescriptorProto_EnumReservedRange)) - gotType := proto.MessageType("google.protobuf.EnumDescriptorProto.EnumReservedRange") + + msg := new(descpb.EnumDescriptorProto_EnumReservedRange) + name = msg.ProtoReflect().Descriptor().FullName() + wantType := reflect.TypeOf(msg) + gotType := proto.MessageType(string(name)) if gotType != wantType { - t.Errorf(`MessageType("google.protobuf.EnumDescriptorProto.EnumReservedRange") = %v, want %v`, gotType, wantType) + t.Errorf("MessageType(%q) = %v, want %v", name, gotType, wantType) } } diff --git a/proto/size2_test.go b/proto/size2_test.go deleted file mode 100644 index ec9ff7eeba..0000000000 --- a/proto/size2_test.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012 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 ( - "math" - "testing" -) - -// This is a separate file and package from size_test.go because that one uses -// generated messages and thus may not be in package proto without having a circular -// dependency, whereas this file tests unexported details of size.go. - -func TestVarintSize(t *testing.T) { - // Check the edge cases carefully. - testCases := []struct { - n uint64 - size int - }{ - {0, 1}, - {1, 1}, - {127, 1}, - {128, 2}, - {16383, 2}, - {16384, 3}, - {math.MaxInt64, 9}, - {math.MaxInt64 + 1, 10}, - } - for _, tc := range testCases { - size := SizeVarint(tc.n) - if size != tc.size { - t.Errorf("sizeVarint(%d) = %d, want %d", tc.n, size, tc.size) - } - } -} diff --git a/proto/size_test.go b/proto/size_test.go deleted file mode 100644 index fce40fa494..0000000000 --- a/proto/size_test.go +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2012 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_test - -import ( - "log" - "strings" - "testing" - - . "github.com/golang/protobuf/proto" - proto3pb "github.com/golang/protobuf/proto/proto3_proto" - pb "github.com/golang/protobuf/proto/test_proto" -) - -var messageWithExtension1 = &pb.MyMessage{Count: Int32(7)} - -// messageWithExtension2 is in equal_test.go. -var messageWithExtension3 = &pb.MyMessage{Count: Int32(8)} - -func init() { - if err := SetExtension(messageWithExtension1, pb.E_Ext_More, &pb.Ext{Data: String("Abbott")}); err != nil { - log.Panicf("SetExtension: %v", err) - } - if err := SetExtension(messageWithExtension3, pb.E_Ext_More, &pb.Ext{Data: String("Costello")}); err != nil { - log.Panicf("SetExtension: %v", err) - } - - // Force messageWithExtension3 to have the extension encoded. - Marshal(messageWithExtension3) - -} - -// non-pointer custom message -type nonptrMessage struct{} - -func (m nonptrMessage) ProtoMessage() {} -func (m nonptrMessage) Reset() {} -func (m nonptrMessage) String() string { return "" } - -func (m nonptrMessage) Marshal() ([]byte, error) { - return []byte{42}, nil -} - -// custom message embedding a proto.Message -type messageWithEmbedding struct { - *pb.OtherMessage -} - -func (m *messageWithEmbedding) ProtoMessage() {} -func (m *messageWithEmbedding) Reset() {} -func (m *messageWithEmbedding) String() string { return "" } - -func (m *messageWithEmbedding) Marshal() ([]byte, error) { - return []byte{42}, nil -} - -var SizeTests = []struct { - desc string - pb Message -}{ - {"empty", &pb.OtherMessage{}}, - // Basic types. - {"bool", &pb.Defaults{F_Bool: Bool(true)}}, - {"int32", &pb.Defaults{F_Int32: Int32(12)}}, - {"negative int32", &pb.Defaults{F_Int32: Int32(-1)}}, - {"small int64", &pb.Defaults{F_Int64: Int64(1)}}, - {"big int64", &pb.Defaults{F_Int64: Int64(1 << 20)}}, - {"negative int64", &pb.Defaults{F_Int64: Int64(-1)}}, - {"fixed32", &pb.Defaults{F_Fixed32: Uint32(71)}}, - {"fixed64", &pb.Defaults{F_Fixed64: Uint64(72)}}, - {"uint32", &pb.Defaults{F_Uint32: Uint32(123)}}, - {"uint64", &pb.Defaults{F_Uint64: Uint64(124)}}, - {"float", &pb.Defaults{F_Float: Float32(12.6)}}, - {"double", &pb.Defaults{F_Double: Float64(13.9)}}, - {"string", &pb.Defaults{F_String: String("niles")}}, - {"bytes", &pb.Defaults{F_Bytes: []byte("wowsa")}}, - {"bytes, empty", &pb.Defaults{F_Bytes: []byte{}}}, - {"sint32", &pb.Defaults{F_Sint32: Int32(65)}}, - {"sint64", &pb.Defaults{F_Sint64: Int64(67)}}, - {"enum", &pb.Defaults{F_Enum: pb.Defaults_BLUE.Enum()}}, - // Repeated. - {"empty repeated bool", &pb.MoreRepeated{Bools: []bool{}}}, - {"repeated bool", &pb.MoreRepeated{Bools: []bool{false, true, true, false}}}, - {"packed repeated bool", &pb.MoreRepeated{BoolsPacked: []bool{false, true, true, false, true, true, true}}}, - {"repeated int32", &pb.MoreRepeated{Ints: []int32{1, 12203, 1729, -1}}}, - {"repeated int32 packed", &pb.MoreRepeated{IntsPacked: []int32{1, 12203, 1729}}}, - {"repeated int64 packed", &pb.MoreRepeated{Int64SPacked: []int64{ - // Need enough large numbers to verify that the header is counting the number of bytes - // for the field, not the number of elements. - 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, - 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, - }}}, - {"repeated string", &pb.MoreRepeated{Strings: []string{"r", "ken", "gri"}}}, - {"repeated fixed", &pb.MoreRepeated{Fixeds: []uint32{1, 2, 3, 4}}}, - // Nested. - {"nested", &pb.OldMessage{Nested: &pb.OldMessage_Nested{Name: String("whatever")}}}, - {"group", &pb.GroupOld{G: &pb.GroupOld_G{X: Int32(12345)}}}, - // Other things. - {"unrecognized", &pb.MoreRepeated{XXX_unrecognized: []byte{13<<3 | 0, 4}}}, - {"extension (unencoded)", messageWithExtension1}, - {"extension (encoded)", messageWithExtension3}, - // proto3 message - {"proto3 empty", &proto3pb.Message{}}, - {"proto3 bool", &proto3pb.Message{TrueScotsman: true}}, - {"proto3 int64", &proto3pb.Message{ResultCount: 1}}, - {"proto3 uint32", &proto3pb.Message{HeightInCm: 123}}, - {"proto3 float", &proto3pb.Message{Score: 12.6}}, - {"proto3 string", &proto3pb.Message{Name: "Snezana"}}, - {"proto3 bytes", &proto3pb.Message{Data: []byte("wowsa")}}, - {"proto3 bytes, empty", &proto3pb.Message{Data: []byte{}}}, - {"proto3 enum", &proto3pb.Message{Hilarity: proto3pb.Message_PUNS}}, - {"proto3 map field with empty bytes", &proto3pb.MessageWithMap{ByteMapping: map[bool][]byte{false: []byte{}}}}, - - {"map field", &pb.MessageWithMap{NameMapping: map[int32]string{1: "Rob", 7: "Andrew"}}}, - {"map field with message", &pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{0x7001: &pb.FloatingPoint{F: Float64(2.0)}}}}, - {"map field with bytes", &pb.MessageWithMap{ByteMapping: map[bool][]byte{true: []byte("this time for sure")}}}, - {"map field with empty bytes", &pb.MessageWithMap{ByteMapping: map[bool][]byte{true: []byte{}}}}, - - {"map field with big entry", &pb.MessageWithMap{NameMapping: map[int32]string{8: strings.Repeat("x", 125)}}}, - {"map field with big key and val", &pb.MessageWithMap{StrToStr: map[string]string{strings.Repeat("x", 70): strings.Repeat("y", 70)}}}, - {"map field with big numeric key", &pb.MessageWithMap{NameMapping: map[int32]string{0xf00d: "om nom nom"}}}, - - {"oneof not set", &pb.Oneof{}}, - {"oneof bool", &pb.Oneof{Union: &pb.Oneof_F_Bool{true}}}, - {"oneof zero int32", &pb.Oneof{Union: &pb.Oneof_F_Int32{0}}}, - {"oneof big int32", &pb.Oneof{Union: &pb.Oneof_F_Int32{1 << 20}}}, - {"oneof int64", &pb.Oneof{Union: &pb.Oneof_F_Int64{42}}}, - {"oneof fixed32", &pb.Oneof{Union: &pb.Oneof_F_Fixed32{43}}}, - {"oneof fixed64", &pb.Oneof{Union: &pb.Oneof_F_Fixed64{44}}}, - {"oneof uint32", &pb.Oneof{Union: &pb.Oneof_F_Uint32{45}}}, - {"oneof uint64", &pb.Oneof{Union: &pb.Oneof_F_Uint64{46}}}, - {"oneof float", &pb.Oneof{Union: &pb.Oneof_F_Float{47.1}}}, - {"oneof double", &pb.Oneof{Union: &pb.Oneof_F_Double{48.9}}}, - {"oneof string", &pb.Oneof{Union: &pb.Oneof_F_String{"Rhythmic Fman"}}}, - {"oneof bytes", &pb.Oneof{Union: &pb.Oneof_F_Bytes{[]byte("let go")}}}, - {"oneof sint32", &pb.Oneof{Union: &pb.Oneof_F_Sint32{50}}}, - {"oneof sint64", &pb.Oneof{Union: &pb.Oneof_F_Sint64{51}}}, - {"oneof enum", &pb.Oneof{Union: &pb.Oneof_F_Enum{pb.MyMessage_BLUE}}}, - {"message for oneof", &pb.GoTestField{Label: String("k"), Type: String("v")}}, - {"oneof message", &pb.Oneof{Union: &pb.Oneof_F_Message{&pb.GoTestField{Label: String("k"), Type: String("v")}}}}, - {"oneof group", &pb.Oneof{Union: &pb.Oneof_FGroup{&pb.Oneof_F_Group{X: Int32(52)}}}}, - {"oneof largest tag", &pb.Oneof{Union: &pb.Oneof_F_Largest_Tag{1}}}, - {"multiple oneofs", &pb.Oneof{Union: &pb.Oneof_F_Int32{1}, Tormato: &pb.Oneof_Value{2}}}, - - {"non-pointer message", nonptrMessage{}}, - {"custom message with embedding", &messageWithEmbedding{&pb.OtherMessage{}}}, -} - -func TestSize(t *testing.T) { - for _, tc := range SizeTests { - size := Size(tc.pb) - b, err := Marshal(tc.pb) - if err != nil { - t.Errorf("%v: Marshal failed: %v", tc.desc, err) - continue - } - if size != len(b) { - t.Errorf("%v: Size(%v) = %d, want %d", tc.desc, tc.pb, size, len(b)) - t.Logf("%v: bytes: %#v", tc.desc, b) - } - } -} diff --git a/proto/table_marshal.go b/proto/table_marshal.go deleted file mode 100644 index 3c294158f4..0000000000 --- a/proto/table_marshal.go +++ /dev/null @@ -1,2779 +0,0 @@ -// Copyright 2016 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" - "math" - "reflect" - "sort" - "strconv" - "strings" - "sync" - "sync/atomic" - "unicode/utf8" - - "github.com/golang/protobuf/internal/wire" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// a sizer takes a pointer to a field and the size of its tag, computes the size of -// the encoded data. -type sizer func(pointer, int) int - -// a marshaler takes a byte slice, a pointer to a field, and its tag (in wire format), -// marshals the field to the end of the slice, returns the slice and error (if any). -type marshaler func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) - -// marshalInfo is the information used for marshaling a message. -type marshalInfo struct { - typ reflect.Type - fields []*marshalFieldInfo - unrecognized field // offset of XXX_unrecognized - extensions field // offset of XXX_InternalExtensions - v1extensions field // offset of XXX_extensions - sizecache field // offset of XXX_sizecache - initialized int32 // 0 -- only typ is set, 1 -- fully initialized - messageset bool // uses message set wire format - hasmarshaler bool // has custom marshaler - sync.RWMutex // protect extElems map, also for initialization - extElems map[int32]*marshalElemInfo // info of extension elements -} - -// marshalFieldInfo is the information used for marshaling a field of a message. -type marshalFieldInfo struct { - field field - wiretag uint64 // tag in wire format - tagsize int // size of tag in wire format - sizer sizer - marshaler marshaler - isPointer bool - required bool // field is required - name string // name of the field, for error reporting - oneofElems map[reflect.Type]*marshalElemInfo // info of oneof elements -} - -// marshalElemInfo is the information used for marshaling an extension or oneof element. -type marshalElemInfo struct { - wiretag uint64 // tag in wire format - tagsize int // size of tag in wire format - sizer sizer - marshaler marshaler - isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only) - deref bool // dereference the pointer before operating on it; implies isptr -} - -var ( - marshalInfoMap = map[reflect.Type]*marshalInfo{} - marshalInfoLock sync.Mutex -) - -// getMarshalInfo returns the information to marshal a given type of message. -// The info it returns may not necessarily initialized. -// t is the type of the message (NOT the pointer to it). -func getMarshalInfo(t reflect.Type) *marshalInfo { - marshalInfoLock.Lock() - u, ok := marshalInfoMap[t] - if !ok { - u = &marshalInfo{typ: t} - marshalInfoMap[t] = u - } - marshalInfoLock.Unlock() - return u -} - -// Size is the entry point from generated code, -// and should be ONLY called by generated code. -// It computes the size of encoded data of msg. -// a is a pointer to a place to store cached marshal info. -func (a *InternalMessageInfo) Size(msg Message) int { - u := getMessageMarshalInfo(msg, a) - ptr := toPointer(&msg) - if ptr.isNil() { - // We get here if msg is a typed nil ((*SomeMessage)(nil)), - // so it satisfies the interface, and msg == nil wouldn't - // catch it. We don't want crash in this case. - return 0 - } - return u.size(ptr) -} - -// Marshal is the entry point from generated code, -// and should be ONLY called by generated code. -// It marshals msg to the end of b. -// a is a pointer to a place to store cached marshal info. -func (a *InternalMessageInfo) Marshal(b []byte, msg Message, deterministic bool) ([]byte, error) { - u := getMessageMarshalInfo(msg, a) - ptr := toPointer(&msg) - if ptr.isNil() { - // We get here if msg is a typed nil ((*SomeMessage)(nil)), - // so it satisfies the interface, and msg == nil wouldn't - // catch it. We don't want crash in this case. - return b, ErrNil - } - return u.marshal(b, ptr, deterministic) -} - -func getMessageMarshalInfo(msg interface{}, a *InternalMessageInfo) *marshalInfo { - // u := a.marshal, but atomically. - // We use an atomic here to ensure memory consistency. - u := atomicLoadMarshalInfo(&a.marshal) - if u == nil { - // Get marshal information from type of message. - t := reflect.ValueOf(msg).Type() - if t.Kind() != reflect.Ptr { - panic(fmt.Sprintf("cannot handle non-pointer message type %v", t)) - } - u = getMarshalInfo(t.Elem()) - // Store it in the cache for later users. - // a.marshal = u, but atomically. - atomicStoreMarshalInfo(&a.marshal, u) - } - return u -} - -// size is the main function to compute the size of the encoded data of a message. -// ptr is the pointer to the message. -func (u *marshalInfo) size(ptr pointer) int { - if atomic.LoadInt32(&u.initialized) == 0 { - u.computeMarshalInfo() - } - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if u.hasmarshaler { - m := ptr.asPointerTo(u.typ).Interface().(Marshaler) - b, _ := m.Marshal() - return len(b) - } - - n := 0 - for _, f := range u.fields { - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // nil pointer always marshals to nothing - continue - } - n += f.sizer(ptr.offset(f.field), f.tagsize) - } - if u.extensions.IsValid() { - e := ptr.offset(u.extensions).toExtensions() - if u.messageset { - n += u.sizeMessageSet(e, *ptr.offset(u.unrecognized).toBytes()) - } else { - n += u.sizeExtensions(e) - } - } - if u.v1extensions.IsValid() { - m := *ptr.offset(u.v1extensions).toOldExtensions() - n += u.sizeV1Extensions(m) - } - if u.unrecognized.IsValid() && !u.messageset { - s := *ptr.offset(u.unrecognized).toBytes() - n += len(s) - } - // cache the result for use in marshal - if u.sizecache.IsValid() { - atomic.StoreInt32(ptr.offset(u.sizecache).toInt32(), int32(n)) - } - return n -} - -// cachedsize gets the size from cache. If there is no cache (i.e. message is not generated), -// fall back to compute the size. -func (u *marshalInfo) cachedsize(ptr pointer) int { - if u.sizecache.IsValid() { - return int(atomic.LoadInt32(ptr.offset(u.sizecache).toInt32())) - } - return u.size(ptr) -} - -// marshal is the main function to marshal a message. It takes a byte slice and appends -// the encoded data to the end of the slice, returns the slice and error (if any). -// ptr is the pointer to the message. -// If deterministic is true, map is marshaled in deterministic order. -func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte, error) { - if atomic.LoadInt32(&u.initialized) == 0 { - u.computeMarshalInfo() - } - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if u.hasmarshaler { - m := ptr.asPointerTo(u.typ).Interface().(Marshaler) - b1, err := m.Marshal() - b = append(b, b1...) - return b, err - } - - var err, errLater error - // The old marshaler encodes extensions at beginning. - if u.extensions.IsValid() { - e := ptr.offset(u.extensions).toExtensions() - if u.messageset { - b, err = u.appendMessageSet(b, e, *ptr.offset(u.unrecognized).toBytes(), deterministic) - } else { - b, err = u.appendExtensions(b, e, deterministic) - } - if err != nil { - return b, err - } - } - if u.v1extensions.IsValid() { - m := *ptr.offset(u.v1extensions).toOldExtensions() - b, err = u.appendV1Extensions(b, m, deterministic) - if err != nil { - return b, err - } - } - for _, f := range u.fields { - if f.required { - if ptr.offset(f.field).getPointer().isNil() { - // Required field is not set. - // We record the error but keep going, to give a complete marshaling. - if errLater == nil { - errLater = &requiredNotSetError{f.name} - } - continue - } - } - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // nil pointer always marshals to nothing - continue - } - b, err = f.marshaler(b, ptr.offset(f.field), f.wiretag, deterministic) - if err != nil { - if err1, ok := err.(*requiredNotSetError); ok { - // Required field in submessage is not set. - // We record the error but keep going, to give a complete marshaling. - if errLater == nil { - errLater = &requiredNotSetError{f.name + "." + err1.field} - } - continue - } - if err == errRepeatedHasNil { - err = errors.New("proto: repeated field " + f.name + " has nil element") - } - if err == errInvalidUTF8 { - if errLater == nil { - mz := reflect.Zero(reflect.PtrTo(u.typ)).Interface().(Message) - fullName := MessageName(mz) + "." + f.name - errLater = &invalidUTF8Error{fullName} - } - continue - } - return b, err - } - } - if u.unrecognized.IsValid() && !u.messageset { - s := *ptr.offset(u.unrecognized).toBytes() - b = append(b, s...) - } - return b, errLater -} - -// computeMarshalInfo initializes the marshal info. -func (u *marshalInfo) computeMarshalInfo() { - u.Lock() - defer u.Unlock() - if u.initialized != 0 { // non-atomic read is ok as it is protected by the lock - return - } - - t := u.typ - u.unrecognized = invalidField - u.extensions = invalidField - u.v1extensions = invalidField - u.sizecache = invalidField - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if reflect.PtrTo(t).Implements(marshalerType) { - u.hasmarshaler = true - atomic.StoreInt32(&u.initialized, 1) - return - } - - oneofImplementers := oneofWrappers(t) - u.messageset = isMessageSet(t) - expFunc := exporterFunc(t) - - n := t.NumField() - - // deal with XXX and unexported fields first. - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if !strings.HasPrefix(f.Name, "XXX_") && f.PkgPath == "" { - continue - } - switch f.Name { - case "XXX_sizecache": - u.sizecache = toField(&f, nil) - case "XXX_unrecognized": - u.unrecognized = toField(&f, nil) - case "XXX_InternalExtensions": - u.extensions = toField(&f, nil) - if f.Tag.Get("protobuf_messageset") == "1" { - u.messageset = true - } - case "XXX_extensions": - u.v1extensions = toField(&f, nil) - - case "sizeCache": - u.sizecache = toField(&f, expFunc) - case "unknownFields": - u.unrecognized = toField(&f, expFunc) - case "extensionFields": - u.extensions = toField(&f, expFunc) - } - n-- - } - - // normal fields - fields := make([]marshalFieldInfo, n) // batch allocation - u.fields = make([]*marshalFieldInfo, 0, n) - for i, j := 0, 0; i < t.NumField(); i++ { - f := t.Field(i) - - if strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { - continue - } - field := &fields[j] - j++ - field.name = f.Name - u.fields = append(u.fields, field) - if f.Tag.Get("protobuf_oneof") != "" { - field.computeOneofFieldInfo(&f, oneofImplementers) - continue - } - if f.Tag.Get("protobuf") == "" { - // field has no tag (not in generated message), ignore it - u.fields = u.fields[:len(u.fields)-1] - j-- - continue - } - field.computeMarshalFieldInfo(&f) - } - - // fields are marshaled in tag order on the wire. - sort.Sort(byTag(u.fields)) - - atomic.StoreInt32(&u.initialized, 1) -} - -// helper for sorting fields by tag -type byTag []*marshalFieldInfo - -func (a byTag) Len() int { return len(a) } -func (a byTag) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a byTag) Less(i, j int) bool { return a[i].wiretag < a[j].wiretag } - -// getExtElemInfo returns the information to marshal an extension element. -// The info it returns is initialized. -func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo { - // get from cache first - u.RLock() - e, ok := u.extElems[desc.Field] - u.RUnlock() - if ok { - return e - } - - t := reflect.TypeOf(desc.ExtensionType) // pointer or slice to basic type or struct - tags := strings.Split(desc.Tag, ",") - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - if t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct { - t = t.Elem() - } - sizer, marshaler := typeMarshaler(t, tags, false, false) - e = &marshalElemInfo{ - wiretag: uint64(tag)<<3 | wt, - tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizer, - marshaler: marshaler, - isptr: t.Kind() == reflect.Ptr, - } - - // update cache - u.Lock() - if u.extElems == nil { - u.extElems = make(map[int32]*marshalElemInfo) - } - u.extElems[desc.Field] = e - u.Unlock() - return e -} - -// computeMarshalFieldInfo fills up the information to marshal a field. -func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) { - // parse protobuf tag of the field. - // tag has format of "bytes,49,opt,name=foo,def=hello!" - tags := strings.Split(f.Tag.Get("protobuf"), ",") - if tags[0] == "" { - return - } - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - if tags[2] == "req" { - fi.required = true - } - fi.setTag(f, tag, wt) - fi.setMarshaler(f, tags) -} - -func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) { - fi.field = toField(f, nil) - fi.wiretag = math.MaxInt32 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. - fi.isPointer = true - fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f) - fi.oneofElems = make(map[reflect.Type]*marshalElemInfo) - - ityp := f.Type // interface type - for _, o := range oneofImplementers { - t := reflect.TypeOf(o) - if !t.Implements(ityp) { - continue - } - sf := t.Elem().Field(0) // oneof implementer is a struct with a single field - tags := strings.Split(sf.Tag.Get("protobuf"), ",") - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - sizer, marshaler := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value - fi.oneofElems[t.Elem()] = &marshalElemInfo{ - wiretag: uint64(tag)<<3 | wt, - tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizer, - marshaler: marshaler, - } - } -} - -// wiretype returns the wire encoding of the type. -func wiretype(encoding string) uint64 { - switch encoding { - case "fixed32": - return WireFixed32 - case "fixed64": - return WireFixed64 - case "varint", "zigzag32", "zigzag64": - return WireVarint - case "bytes": - return WireBytes - case "group": - return WireStartGroup - } - panic("unknown wire type " + encoding) -} - -// setTag fills up the tag (in wire format) and its size in the info of a field. -func (fi *marshalFieldInfo) setTag(f *reflect.StructField, tag int, wt uint64) { - fi.field = toField(f, nil) - fi.wiretag = uint64(tag)<<3 | wt - fi.tagsize = SizeVarint(uint64(tag) << 3) -} - -// setMarshaler fills up the sizer and marshaler in the info of a field. -func (fi *marshalFieldInfo) setMarshaler(f *reflect.StructField, tags []string) { - switch f.Type.Kind() { - case reflect.Map: - // map field - fi.isPointer = true - fi.sizer, fi.marshaler = makeMapMarshaler(f) - return - case reflect.Ptr, reflect.Slice: - fi.isPointer = true - } - fi.sizer, fi.marshaler = typeMarshaler(f.Type, tags, true, false) -} - -// typeMarshaler returns the sizer and marshaler of a given field. -// t is the type of the field. -// tags is the generated "protobuf" tag of the field. -// If nozero is true, zero value is not marshaled to the wire. -// If oneof is true, it is a oneof field. -func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, marshaler) { - encoding := tags[0] - - pointer := false - slice := false - if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { - slice = true - t = t.Elem() - } - if t.Kind() == reflect.Ptr { - pointer = true - t = t.Elem() - } - - packed := false - proto3 := false - validateUTF8 := true - for i := 2; i < len(tags); i++ { - if tags[i] == "packed" { - packed = true - } - if tags[i] == "proto3" { - proto3 = true - } - } - validateUTF8 = validateUTF8 && proto3 - - switch t.Kind() { - case reflect.Bool: - if pointer { - return sizeBoolPtr, appendBoolPtr - } - if slice { - if packed { - return sizeBoolPackedSlice, appendBoolPackedSlice - } - return sizeBoolSlice, appendBoolSlice - } - if nozero { - return sizeBoolValueNoZero, appendBoolValueNoZero - } - return sizeBoolValue, appendBoolValue - case reflect.Uint32: - switch encoding { - case "fixed32": - if pointer { - return sizeFixed32Ptr, appendFixed32Ptr - } - if slice { - if packed { - return sizeFixed32PackedSlice, appendFixed32PackedSlice - } - return sizeFixed32Slice, appendFixed32Slice - } - if nozero { - return sizeFixed32ValueNoZero, appendFixed32ValueNoZero - } - return sizeFixed32Value, appendFixed32Value - case "varint": - if pointer { - return sizeVarint32Ptr, appendVarint32Ptr - } - if slice { - if packed { - return sizeVarint32PackedSlice, appendVarint32PackedSlice - } - return sizeVarint32Slice, appendVarint32Slice - } - if nozero { - return sizeVarint32ValueNoZero, appendVarint32ValueNoZero - } - return sizeVarint32Value, appendVarint32Value - } - case reflect.Int32: - switch encoding { - case "fixed32": - if pointer { - return sizeFixedS32Ptr, appendFixedS32Ptr - } - if slice { - if packed { - return sizeFixedS32PackedSlice, appendFixedS32PackedSlice - } - return sizeFixedS32Slice, appendFixedS32Slice - } - if nozero { - return sizeFixedS32ValueNoZero, appendFixedS32ValueNoZero - } - return sizeFixedS32Value, appendFixedS32Value - case "varint": - if pointer { - return sizeVarintS32Ptr, appendVarintS32Ptr - } - if slice { - if packed { - return sizeVarintS32PackedSlice, appendVarintS32PackedSlice - } - return sizeVarintS32Slice, appendVarintS32Slice - } - if nozero { - return sizeVarintS32ValueNoZero, appendVarintS32ValueNoZero - } - return sizeVarintS32Value, appendVarintS32Value - case "zigzag32": - if pointer { - return sizeZigzag32Ptr, appendZigzag32Ptr - } - if slice { - if packed { - return sizeZigzag32PackedSlice, appendZigzag32PackedSlice - } - return sizeZigzag32Slice, appendZigzag32Slice - } - if nozero { - return sizeZigzag32ValueNoZero, appendZigzag32ValueNoZero - } - return sizeZigzag32Value, appendZigzag32Value - } - case reflect.Uint64: - switch encoding { - case "fixed64": - if pointer { - return sizeFixed64Ptr, appendFixed64Ptr - } - if slice { - if packed { - return sizeFixed64PackedSlice, appendFixed64PackedSlice - } - return sizeFixed64Slice, appendFixed64Slice - } - if nozero { - return sizeFixed64ValueNoZero, appendFixed64ValueNoZero - } - return sizeFixed64Value, appendFixed64Value - case "varint": - if pointer { - return sizeVarint64Ptr, appendVarint64Ptr - } - if slice { - if packed { - return sizeVarint64PackedSlice, appendVarint64PackedSlice - } - return sizeVarint64Slice, appendVarint64Slice - } - if nozero { - return sizeVarint64ValueNoZero, appendVarint64ValueNoZero - } - return sizeVarint64Value, appendVarint64Value - } - case reflect.Int64: - switch encoding { - case "fixed64": - if pointer { - return sizeFixedS64Ptr, appendFixedS64Ptr - } - if slice { - if packed { - return sizeFixedS64PackedSlice, appendFixedS64PackedSlice - } - return sizeFixedS64Slice, appendFixedS64Slice - } - if nozero { - return sizeFixedS64ValueNoZero, appendFixedS64ValueNoZero - } - return sizeFixedS64Value, appendFixedS64Value - case "varint": - if pointer { - return sizeVarintS64Ptr, appendVarintS64Ptr - } - if slice { - if packed { - return sizeVarintS64PackedSlice, appendVarintS64PackedSlice - } - return sizeVarintS64Slice, appendVarintS64Slice - } - if nozero { - return sizeVarintS64ValueNoZero, appendVarintS64ValueNoZero - } - return sizeVarintS64Value, appendVarintS64Value - case "zigzag64": - if pointer { - return sizeZigzag64Ptr, appendZigzag64Ptr - } - if slice { - if packed { - return sizeZigzag64PackedSlice, appendZigzag64PackedSlice - } - return sizeZigzag64Slice, appendZigzag64Slice - } - if nozero { - return sizeZigzag64ValueNoZero, appendZigzag64ValueNoZero - } - return sizeZigzag64Value, appendZigzag64Value - } - case reflect.Float32: - if pointer { - return sizeFloat32Ptr, appendFloat32Ptr - } - if slice { - if packed { - return sizeFloat32PackedSlice, appendFloat32PackedSlice - } - return sizeFloat32Slice, appendFloat32Slice - } - if nozero { - return sizeFloat32ValueNoZero, appendFloat32ValueNoZero - } - return sizeFloat32Value, appendFloat32Value - case reflect.Float64: - if pointer { - return sizeFloat64Ptr, appendFloat64Ptr - } - if slice { - if packed { - return sizeFloat64PackedSlice, appendFloat64PackedSlice - } - return sizeFloat64Slice, appendFloat64Slice - } - if nozero { - return sizeFloat64ValueNoZero, appendFloat64ValueNoZero - } - return sizeFloat64Value, appendFloat64Value - case reflect.String: - if validateUTF8 { - if pointer { - return sizeStringPtr, appendUTF8StringPtr - } - if slice { - return sizeStringSlice, appendUTF8StringSlice - } - if nozero { - return sizeStringValueNoZero, appendUTF8StringValueNoZero - } - return sizeStringValue, appendUTF8StringValue - } - if pointer { - return sizeStringPtr, appendStringPtr - } - if slice { - return sizeStringSlice, appendStringSlice - } - if nozero { - return sizeStringValueNoZero, appendStringValueNoZero - } - return sizeStringValue, appendStringValue - case reflect.Slice: - if slice { - return sizeBytesSlice, appendBytesSlice - } - if oneof { - // Oneof bytes field may also have "proto3" tag. - // We want to marshal it as a oneof field. Do this - // check before the proto3 check. - return sizeBytesOneof, appendBytesOneof - } - if proto3 { - return sizeBytes3, appendBytes3 - } - return sizeBytes, appendBytes - case reflect.Struct: - switch encoding { - case "group": - if slice { - return makeGroupSliceMarshaler(getMarshalInfo(t)) - } - return makeGroupMarshaler(getMarshalInfo(t)) - case "bytes": - if slice { - return makeMessageSliceMarshaler(getMarshalInfo(t)) - } - return makeMessageMarshaler(getMarshalInfo(t)) - } - } - panic(fmt.Sprintf("unknown or mismatched type: type: %v, wire type: %v", t, encoding)) -} - -// Below are functions to size/marshal a specific type of a field. -// They are stored in the field's info, and called by function pointers. -// They have type sizer or marshaler. - -func sizeFixed32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFixed32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFixed32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFixed32Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - return (4 + tagsize) * len(s) -} -func sizeFixed32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFixedS32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFixedS32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFixedS32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFixedS32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - return (4 + tagsize) * len(s) -} -func sizeFixedS32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFloat32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFloat32ValueNoZero(ptr pointer, tagsize int) int { - v := math.Float32bits(*ptr.toFloat32()) - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFloat32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toFloat32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFloat32Slice(ptr pointer, tagsize int) int { - s := *ptr.toFloat32Slice() - return (4 + tagsize) * len(s) -} -func sizeFloat32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toFloat32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFixed64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFixed64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFixed64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFixed64Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - return (8 + tagsize) * len(s) -} -func sizeFixed64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeFixedS64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFixedS64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFixedS64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFixedS64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - return (8 + tagsize) * len(s) -} -func sizeFixedS64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeFloat64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFloat64ValueNoZero(ptr pointer, tagsize int) int { - v := math.Float64bits(*ptr.toFloat64()) - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFloat64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toFloat64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFloat64Slice(ptr pointer, tagsize int) int { - s := *ptr.toFloat64Slice() - return (8 + tagsize) * len(s) -} -func sizeFloat64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toFloat64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeVarint32Value(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarint32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarint32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint32Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarint32Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarint32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarintS32Value(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarintS32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarintS32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarint64Value(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - return SizeVarint(v) + tagsize -} -func sizeVarint64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - if v == 0 { - return 0 - } - return SizeVarint(v) + tagsize -} -func sizeVarint64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint64Ptr() - if p == nil { - return 0 - } - return SizeVarint(*p) + tagsize -} -func sizeVarint64Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(v) + tagsize - } - return n -} -func sizeVarint64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(v) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarintS64Value(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarintS64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarintS64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeZigzag32Value(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - v := *p - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize - } - return n -} -func sizeZigzag32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeZigzag64Value(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - v := *p - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize - } - return n -} -func sizeZigzag64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeBoolValue(_ pointer, tagsize int) int { - return 1 + tagsize -} -func sizeBoolValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toBool() - if !v { - return 0 - } - return 1 + tagsize -} -func sizeBoolPtr(ptr pointer, tagsize int) int { - p := *ptr.toBoolPtr() - if p == nil { - return 0 - } - return 1 + tagsize -} -func sizeBoolSlice(ptr pointer, tagsize int) int { - s := *ptr.toBoolSlice() - return (1 + tagsize) * len(s) -} -func sizeBoolPackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toBoolSlice() - if len(s) == 0 { - return 0 - } - return len(s) + SizeVarint(uint64(len(s))) + tagsize -} -func sizeStringValue(ptr pointer, tagsize int) int { - v := *ptr.toString() - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toString() - if v == "" { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringPtr(ptr pointer, tagsize int) int { - p := *ptr.toStringPtr() - if p == nil { - return 0 - } - v := *p - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringSlice(ptr pointer, tagsize int) int { - s := *ptr.toStringSlice() - n := 0 - for _, v := range s { - n += len(v) + SizeVarint(uint64(len(v))) + tagsize - } - return n -} -func sizeBytes(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - if v == nil { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytes3(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - if len(v) == 0 { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytesOneof(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytesSlice(ptr pointer, tagsize int) int { - s := *ptr.toBytesSlice() - n := 0 - for _, v := range s { - n += len(v) + SizeVarint(uint64(len(v))) + tagsize - } - return n -} - -// appendFixed32 appends an encoded fixed32 to b. -func appendFixed32(b []byte, v uint32) []byte { - b = append(b, - byte(v), - byte(v>>8), - byte(v>>16), - byte(v>>24)) - return b -} - -// appendFixed64 appends an encoded fixed64 to b. -func appendFixed64(b []byte, v uint64) []byte { - b = append(b, - byte(v), - byte(v>>8), - byte(v>>16), - byte(v>>24), - byte(v>>32), - byte(v>>40), - byte(v>>48), - byte(v>>56)) - return b -} - -// appendVarint appends an encoded varint to b. -func appendVarint(b []byte, v uint64) []byte { - // TODO: make 1-byte (maybe 2-byte) case inline-able, once we - // have non-leaf inliner. - switch { - case v < 1<<7: - b = append(b, byte(v)) - case v < 1<<14: - b = append(b, - byte(v&0x7f|0x80), - byte(v>>7)) - case v < 1<<21: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte(v>>14)) - case v < 1<<28: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte(v>>21)) - case v < 1<<35: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte(v>>28)) - case v < 1<<42: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte(v>>35)) - case v < 1<<49: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte(v>>42)) - case v < 1<<56: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte(v>>49)) - case v < 1<<63: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte(v>>56)) - default: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte((v>>56)&0x7f|0x80), - 1) - } - return b -} - -func appendFixed32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFixed32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFixed32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, *p) - return b, nil -} -func appendFixed32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - } - return b, nil -} -func appendFixed32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, v) - } - return b, nil -} -func appendFixedS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - return b, nil -} -func appendFixedS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - return b, nil -} -func appendFixedS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(*p)) - return b, nil -} -func appendFixedS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - } - return b, nil -} -func appendFixedS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, uint32(v)) - } - return b, nil -} -func appendFloat32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float32bits(*ptr.toFloat32()) - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFloat32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float32bits(*ptr.toFloat32()) - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFloat32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toFloat32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, math.Float32bits(*p)) - return b, nil -} -func appendFloat32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, math.Float32bits(v)) - } - return b, nil -} -func appendFloat32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, math.Float32bits(v)) - } - return b, nil -} -func appendFixed64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFixed64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFixed64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, *p) - return b, nil -} -func appendFixed64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - } - return b, nil -} -func appendFixed64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, v) - } - return b, nil -} -func appendFixedS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - return b, nil -} -func appendFixedS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - return b, nil -} -func appendFixedS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(*p)) - return b, nil -} -func appendFixedS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - } - return b, nil -} -func appendFixedS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, uint64(v)) - } - return b, nil -} -func appendFloat64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float64bits(*ptr.toFloat64()) - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFloat64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float64bits(*ptr.toFloat64()) - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFloat64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toFloat64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, math.Float64bits(*p)) - return b, nil -} -func appendFloat64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, math.Float64bits(v)) - } - return b, nil -} -func appendFloat64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, math.Float64bits(v)) - } - return b, nil -} -func appendVarint32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarint32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarint32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarint32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarint32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarintS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarint64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - return b, nil -} -func appendVarint64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - return b, nil -} -func appendVarint64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, *p) - return b, nil -} -func appendVarint64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - } - return b, nil -} -func appendVarint64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(v) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, v) - } - return b, nil -} -func appendVarintS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarintS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendZigzag32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - v := *p - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - } - return b, nil -} -func appendZigzag32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - } - return b, nil -} -func appendZigzag64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - v := *p - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - } - return b, nil -} -func appendZigzag64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - } - return b, nil -} -func appendBoolValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBool() - b = appendVarint(b, wiretag) - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - return b, nil -} -func appendBoolValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBool() - if !v { - return b, nil - } - b = appendVarint(b, wiretag) - b = append(b, 1) - return b, nil -} - -func appendBoolPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toBoolPtr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - if *p { - b = append(b, 1) - } else { - b = append(b, 0) - } - return b, nil -} -func appendBoolSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBoolSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - } - return b, nil -} -func appendBoolPackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBoolSlice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(len(s))) - for _, v := range s { - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - } - return b, nil -} -func appendStringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toString() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toString() - if v == "" { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toStringPtr() - if p == nil { - return b, nil - } - v := *p - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toStringSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - return b, nil -} -func appendUTF8StringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - v := *ptr.toString() - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - v := *ptr.toString() - if v == "" { - return b, nil - } - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - p := *ptr.toStringPtr() - if p == nil { - return b, nil - } - v := *p - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - s := *ptr.toStringSlice() - for _, v := range s { - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendBytes(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - if v == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytes3(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - if len(v) == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytesOneof(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytesSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBytesSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - return b, nil -} - -// makeGroupMarshaler returns the sizer and marshaler for a group. -// u is the marshal info of the underlying message. -func makeGroupMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - p := ptr.getPointer() - if p.isNil() { - return 0 - } - return u.size(p) + 2*tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - p := ptr.getPointer() - if p.isNil() { - return b, nil - } - var err error - b = appendVarint(b, wiretag) // start group - b, err = u.marshal(b, p, deterministic) - b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group - return b, err - } -} - -// makeGroupSliceMarshaler returns the sizer and marshaler for a group slice. -// u is the marshal info of the underlying message. -func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getPointerSlice() - n := 0 - for _, v := range s { - if v.isNil() { - continue - } - n += u.size(v) + 2*tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getPointerSlice() - var err error - var nerr nonFatal - for _, v := range s { - if v.isNil() { - return b, errRepeatedHasNil - } - b = appendVarint(b, wiretag) // start group - b, err = u.marshal(b, v, deterministic) - b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group - if !nerr.Merge(err) { - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - return b, nerr.E - } -} - -// makeMessageMarshaler returns the sizer and marshaler for a message field. -// u is the marshal info of the message. -func makeMessageMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - p := ptr.getPointer() - if p.isNil() { - return 0 - } - siz := u.size(p) - return siz + SizeVarint(uint64(siz)) + tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - p := ptr.getPointer() - if p.isNil() { - return b, nil - } - b = appendVarint(b, wiretag) - siz := u.cachedsize(p) - b = appendVarint(b, uint64(siz)) - return u.marshal(b, p, deterministic) - } -} - -// makeMessageSliceMarshaler returns the sizer and marshaler for a message slice. -// u is the marshal info of the message. -func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getPointerSlice() - n := 0 - for _, v := range s { - if v.isNil() { - continue - } - siz := u.size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getPointerSlice() - var err error - var nerr nonFatal - for _, v := range s { - if v.isNil() { - return b, errRepeatedHasNil - } - b = appendVarint(b, wiretag) - siz := u.cachedsize(v) - b = appendVarint(b, uint64(siz)) - b, err = u.marshal(b, v, deterministic) - - if !nerr.Merge(err) { - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - return b, nerr.E - } -} - -// makeMapMarshaler returns the sizer and marshaler for a map field. -// f is the pointer to the reflect data structure of the field. -func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { - // figure out key and value type - t := f.Type - keyType := t.Key() - valType := t.Elem() - keyTags := strings.Split(f.Tag.Get("protobuf_key"), ",") - valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") - keySizer, keyMarshaler := typeMarshaler(keyType, keyTags, false, false) // don't omit zero value in map - valSizer, valMarshaler := typeMarshaler(valType, valTags, false, false) // don't omit zero value in map - keyWireTag := 1<<3 | wiretype(keyTags[0]) - valWireTag := 2<<3 | wiretype(valTags[0]) - - // We create an interface to get the addresses of the map key and value. - // If value is pointer-typed, the interface is a direct interface, the - // idata itself is the value. Otherwise, the idata is the pointer to the - // value. - // Key cannot be pointer-typed. - valIsPtr := valType.Kind() == reflect.Ptr - - // If value is a message with nested maps, calling - // valSizer in marshal may be quadratic. We should use - // cached version in marshal (but not in size). - // If value is not message type, we don't have size cache, - // but it cannot be nested either. Just use valSizer. - valCachedSizer := valSizer - if valIsPtr && valType.Elem().Kind() == reflect.Struct { - u := getMarshalInfo(valType.Elem()) - valCachedSizer = func(ptr pointer, tagsize int) int { - // Same as message sizer, but use cache. - p := ptr.getPointer() - if p.isNil() { - return 0 - } - siz := u.cachedsize(p) - return siz + SizeVarint(uint64(siz)) + tagsize - } - } - return func(ptr pointer, tagsize int) int { - m := ptr.asPointerTo(t).Elem() // the map - n := 0 - for _, k := range m.MapKeys() { - ki := k.Interface() - vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr, false) // pointer to value - siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, tag uint64, deterministic bool) ([]byte, error) { - m := ptr.asPointerTo(t).Elem() // the map - var err error - keys := m.MapKeys() - if len(keys) > 1 && deterministic { - sort.Sort(mapKeys(keys)) - } - - var nerr nonFatal - for _, k := range keys { - ki := k.Interface() - vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr, false) // pointer to value - b = appendVarint(b, tag) - siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) - b = appendVarint(b, uint64(siz)) - b, err = keyMarshaler(b, kaddr, keyWireTag, deterministic) - if !nerr.Merge(err) { - return b, err - } - b, err = valMarshaler(b, vaddr, valWireTag, deterministic) - if err != ErrNil && !nerr.Merge(err) { // allow nil value in map - return b, err - } - } - return b, nerr.E - } -} - -// makeOneOfMarshaler returns the sizer and marshaler for a oneof field. -// fi is the marshal info of the field. -// f is the pointer to the reflect data structure of the field. -func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, marshaler) { - // Oneof field is an interface. We need to get the actual data type on the fly. - t := f.Type - return func(ptr pointer, _ int) int { - p := ptr.getInterfacePointer() - if p.isNil() { - return 0 - } - v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct - telem := v.Type() - e := fi.oneofElems[telem] - return e.sizer(p, e.tagsize) - }, - func(b []byte, ptr pointer, _ uint64, deterministic bool) ([]byte, error) { - p := ptr.getInterfacePointer() - if p.isNil() { - return b, nil - } - v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct - telem := v.Type() - if telem.Field(0).Type.Kind() == reflect.Ptr && p.getPointer().isNil() { - return b, errOneofHasNil - } - e := fi.oneofElems[telem] - return e.marshaler(b, p, e.wiretag, deterministic) - } -} - -// sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field. -func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { - m := extensionFieldsOf(ext) - if m == nil { - return 0 - } - - n := 0 - m.Range(func(_ protoreflect.FieldNumber, e Extension) bool { - if !e.HasType() || !e.HasValue() { - return true // should never happen - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) - v := e.GetValue() - p := toAddrPointer(&v, ei.isptr, ei.deref) - n += ei.sizer(p, ei.tagsize) - return true - }) - return n -} - -// appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b. -func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m := extensionFieldsOf(ext) - if m == nil { - return b, nil - } - - var err error - var nerr nonFatal - - // Fast-path for common cases: zero or one extensions. - // Don't bother sorting the keys. - if m.Len() <= 1 { - m.Range(func(_ protoreflect.FieldNumber, e Extension) bool { - if !e.HasType() || !e.HasValue() { - return true // should never happen - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) - v := e.GetValue() - p := toAddrPointer(&v, ei.isptr, ei.deref) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return false - } - err = nerr.E - return true - }) - return b, err - } - - // Sort the keys to provide a deterministic encoding. - // Not sure this is required, but the old code does it. - keys := make([]int, 0, m.Len()) - m.Range(func(k protoreflect.FieldNumber, _ Extension) bool { - keys = append(keys, int(k)) - return true - }) - sort.Ints(keys) - - for _, k := range keys { - e := m.Get(protoreflect.FieldNumber(k)) - if !e.HasType() || !e.HasValue() { - continue // should never happen - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) - v := e.GetValue() - p := toAddrPointer(&v, ei.isptr, ei.deref) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// message set format is: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } - -// sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field -// in message set format (above). -func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions, unk []byte) int { - m := extensionFieldsOf(ext) - if m == nil { - return 0 - } - - n := 0 - m.Range(func(id protoreflect.FieldNumber, e Extension) bool { - n += 2 // start group, end group. tag = 1 (size=1) - n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) - - if !e.HasType() || !e.HasValue() { - return true // should never happen - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) - v := e.GetValue() - p := toAddrPointer(&v, ei.isptr, ei.deref) - n += ei.sizer(p, 1) // message, tag = 3 (size=1) - return true - }) - - // Extension is only in its encoded form. - for len(unk) > 0 { - id, _, fieldLen := wire.ConsumeField(unk) - if fieldLen < 0 { - break - } - - msgWithLen := skipVarint(unk[:fieldLen]) // skip old tag, but leave the length varint - siz := len(msgWithLen) - n += 2 // start group, end group. tag = 1 (size=1) - n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) - n += siz + 1 // message, tag = 3 (size=1) - - unk = unk[fieldLen:] - } - - return n -} - -// appendMessageSet marshals a XXX_InternalExtensions field in message set format (above) -// to the end of byte slice b. -func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, unk []byte, deterministic bool) ([]byte, error) { - m := extensionFieldsOf(ext) - if m == nil { - return b, nil - } - - var err error - var nerr nonFatal - - // Fast-path for common cases: zero or one extensions. - // Don't bother sorting the keys. - if m.Len() <= 1 { - m.Range(func(id protoreflect.FieldNumber, e Extension) bool { - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - - if !e.HasType() || !e.HasValue() { - return true // should never happen - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) - v := e.GetValue() - p := toAddrPointer(&v, ei.isptr, ei.deref) - b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) - if !nerr.Merge(err) { - return false - } - b = append(b, 1<<3|WireEndGroup) - err = nerr.E - return true - }) - - // Extension is only in its encoded form. - for len(unk) > 0 { - id, _, fieldLen := wire.ConsumeField(unk) - if fieldLen < 0 { - return b, wire.ParseError(fieldLen) - } - - msgWithLen := skipVarint(unk[:fieldLen]) // skip old tag, but leave the length varint - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - - unk = unk[fieldLen:] - } - - return b, err - } - - // Sort the keys to provide a deterministic encoding. - keys := make([]int, 0, m.Len()) - m.Range(func(k protoreflect.FieldNumber, _ Extension) bool { - keys = append(keys, int(k)) - return true - }) - sort.Ints(keys) - - for _, id := range keys { - e := m.Get(protoreflect.FieldNumber(id)) - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - - if !e.HasType() || !e.HasValue() { - continue // should never happen - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) - v := e.GetValue() - p := toAddrPointer(&v, ei.isptr, ei.deref) - b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) - b = append(b, 1<<3|WireEndGroup) - if !nerr.Merge(err) { - return b, err - } - } - - // Extension is only in its encoded form. - for len(unk) > 0 { - id, _, fieldLen := wire.ConsumeField(unk) - if fieldLen < 0 { - return b, wire.ParseError(fieldLen) - } - - msgWithLen := skipVarint(unk[:fieldLen]) // skip old tag, but leave the length varint - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - - unk = unk[fieldLen:] - } - - return b, nerr.E -} - -// sizeV1Extensions computes the size of encoded data for a V1-API extension field. -func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { - if m == nil { - return 0 - } - - n := 0 - for _, e := range m { - if !e.HasType() || !e.HasValue() { - continue // should never happen - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) - v := e.GetValue() - p := toAddrPointer(&v, ei.isptr, ei.deref) - n += ei.sizer(p, ei.tagsize) - } - return n -} - -// appendV1Extensions marshals a V1-API extension field to the end of byte slice b. -func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, deterministic bool) ([]byte, error) { - if m == nil { - return b, nil - } - - // Sort the keys to provide a deterministic encoding. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - var err error - var nerr nonFatal - for _, k := range keys { - e := m[int32(k)] - if !e.HasType() || !e.HasValue() { - continue // should never happen - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(protoimpl.X.ExtensionDescFromType(e.GetType())) - v := e.GetValue() - p := toAddrPointer(&v, ei.isptr, ei.deref) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// newMarshaler is the interface representing objects that can marshal themselves. -// -// 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 newMarshaler interface { - XXX_Size() int - XXX_Marshal(b []byte, deterministic bool) ([]byte, error) -} - -// Size returns the encoded size of a protocol buffer message. -// This is the main entry point. -func Size(pb Message) int { - if m, ok := pb.(newMarshaler); ok { - return m.XXX_Size() - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - b, _ := m.Marshal() - return len(b) - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return 0 - } - var info InternalMessageInfo - return info.Size(pb) -} - -// Marshal takes a protocol buffer message -// and encodes it into the wire format, returning the data. -// This is the main entry point. -func Marshal(pb Message) ([]byte, error) { - if m, ok := pb.(newMarshaler); ok { - siz := m.XXX_Size() - b := make([]byte, 0, siz) - return m.XXX_Marshal(b, false) - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - return m.Marshal() - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return nil, ErrNil - } - var info InternalMessageInfo - siz := info.Size(pb) - b := make([]byte, 0, siz) - return info.Marshal(b, pb, false) -} - -// Marshal takes a protocol buffer message -// and encodes it into the wire format, writing the result to the -// Buffer. -// This is an alternative entry point. It is not necessary to use -// a Buffer for most applications. -func (p *Buffer) Marshal(pb Message) error { - var err error - if m, ok := pb.(newMarshaler); ok { - siz := m.XXX_Size() - p.grow(siz) // make sure buf has enough capacity - p.buf, err = m.XXX_Marshal(p.buf, p.deterministic) - return err - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - b, err := m.Marshal() - p.buf = append(p.buf, b...) - return err - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return ErrNil - } - var info InternalMessageInfo - siz := info.Size(pb) - p.grow(siz) // make sure buf has enough capacity - p.buf, err = info.Marshal(p.buf, pb, p.deterministic) - return err -} - -// grow grows the buffer's capacity, if necessary, to guarantee space for -// another n bytes. After grow(n), at least n bytes can be written to the -// buffer without another allocation. -func (p *Buffer) grow(n int) { - need := len(p.buf) + n - if need <= cap(p.buf) { - return - } - newCap := len(p.buf) * 2 - if newCap < need { - newCap = need - } - p.buf = append(make([]byte, 0, newCap), p.buf...) -} diff --git a/proto/table_merge.go b/proto/table_merge.go deleted file mode 100644 index 04f9a90db4..0000000000 --- a/proto/table_merge.go +++ /dev/null @@ -1,630 +0,0 @@ -// Copyright 2016 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" -) - -// Merge merges the src message into dst. -// This assumes that dst and src of the same type and are non-nil. -func (a *InternalMessageInfo) Merge(dst, src Message) { - mi := atomicLoadMergeInfo(&a.merge) - if mi == nil { - mi = getMergeInfo(reflect.TypeOf(dst).Elem()) - atomicStoreMergeInfo(&a.merge, mi) - } - mi.merge(toPointer(&dst), toPointer(&src)) -} - -type mergeInfo struct { - typ reflect.Type - - initialized int32 // 0: only typ is valid, 1: everything is valid - lock sync.Mutex - - fields []mergeFieldInfo - unrecognized field // Offset of XXX_unrecognized -} - -type mergeFieldInfo struct { - field field // Offset of field, guaranteed to be valid - - // isPointer reports whether the value in the field is a pointer. - // This is true for the following situations: - // * Pointer to struct - // * Pointer to basic type (proto2 only) - // * Slice (first value in slice header is a pointer) - // * String (first value in string header is a pointer) - isPointer bool - - // basicWidth reports the width of the field assuming that it is directly - // embedded in the struct (as is the case for basic types in proto3). - // The possible values are: - // 0: invalid - // 1: bool - // 4: int32, uint32, float32 - // 8: int64, uint64, float64 - basicWidth int - - // Where dst and src are pointers to the types being merged. - merge func(dst, src pointer) -} - -var ( - mergeInfoMap = map[reflect.Type]*mergeInfo{} - mergeInfoLock sync.Mutex -) - -func getMergeInfo(t reflect.Type) *mergeInfo { - mergeInfoLock.Lock() - defer mergeInfoLock.Unlock() - mi := mergeInfoMap[t] - if mi == nil { - mi = &mergeInfo{typ: t} - mergeInfoMap[t] = mi - } - return mi -} - -// merge merges src into dst assuming they are both of type *mi.typ. -func (mi *mergeInfo) merge(dst, src pointer) { - if dst.isNil() { - panic("proto: nil destination") - } - if src.isNil() { - return // Nothing to do. - } - - if atomic.LoadInt32(&mi.initialized) == 0 { - mi.computeMergeInfo() - } - - for _, fi := range mi.fields { - sfp := src.offset(fi.field) - - // As an optimization, we can avoid the merge function call cost - // if we know for sure that the source will have no effect - // by checking if it is the zero value. - if unsafeAllowed { - if fi.isPointer && sfp.getPointer().isNil() { // Could be slice or string - continue - } - if fi.basicWidth > 0 { - switch { - case fi.basicWidth == 1 && !*sfp.toBool(): - continue - case fi.basicWidth == 4 && *sfp.toUint32() == 0: - continue - case fi.basicWidth == 8 && *sfp.toUint64() == 0: - continue - } - } - } - - dfp := dst.offset(fi.field) - fi.merge(dfp, sfp) - } - - // TODO: Make this faster? - out := dst.asPointerTo(mi.typ).Elem() - in := src.asPointerTo(mi.typ).Elem() - if emIn, err := extendable(in.Addr().Interface()); err == nil { - emOut, _ := extendable(out.Addr().Interface()) - if emIn != nil { - mergeExtension(emOut, emIn) - } - } - - if mi.unrecognized.IsValid() { - if b := *src.offset(mi.unrecognized).toBytes(); len(b) > 0 { - *dst.offset(mi.unrecognized).toBytes() = append([]byte(nil), b...) - } - } -} - -func (mi *mergeInfo) computeMergeInfo() { - mi.lock.Lock() - defer mi.lock.Unlock() - if mi.initialized != 0 { - return - } - t := mi.typ - n := t.NumField() - - props := GetProperties(t) - for i := 0; i < n; i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { - continue - } - - mfi := mergeFieldInfo{field: toField(&f, nil)} - tf := f.Type - - // As an optimization, we can avoid the merge function call cost - // if we know for sure that the source will have no effect - // by checking if it is the zero value. - if unsafeAllowed { - switch tf.Kind() { - case reflect.Ptr, reflect.Slice, reflect.String: - // As a special case, we assume slices and strings are pointers - // since we know that the first field in the SliceSlice or - // StringHeader is a data pointer. - mfi.isPointer = true - case reflect.Bool: - mfi.basicWidth = 1 - case reflect.Int32, reflect.Uint32, reflect.Float32: - mfi.basicWidth = 4 - case reflect.Int64, reflect.Uint64, reflect.Float64: - mfi.basicWidth = 8 - } - } - - // Unwrap tf to get at 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("both pointer and slice for basic type in " + tf.Name()) - } - - switch tf.Kind() { - case reflect.Int32: - switch { - case isSlice: // E.g., []int32 - mfi.merge = func(dst, src pointer) { - // NOTE: toInt32Slice is not defined (see pointer_reflect.go). - /* - sfsp := src.toInt32Slice() - if *sfsp != nil { - dfsp := dst.toInt32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []int64{} - } - } - */ - sfs := src.getInt32Slice() - if sfs != nil { - dfs := dst.getInt32Slice() - dfs = append(dfs, sfs...) - if dfs == nil { - dfs = []int32{} - } - dst.setInt32Slice(dfs) - } - } - case isPointer: // E.g., *int32 - mfi.merge = func(dst, src pointer) { - // NOTE: toInt32Ptr is not defined (see pointer_reflect.go). - /* - sfpp := src.toInt32Ptr() - if *sfpp != nil { - dfpp := dst.toInt32Ptr() - if *dfpp == nil { - *dfpp = Int32(**sfpp) - } else { - **dfpp = **sfpp - } - } - */ - sfp := src.getInt32Ptr() - if sfp != nil { - dfp := dst.getInt32Ptr() - if dfp == nil { - dst.setInt32Ptr(*sfp) - } else { - *dfp = *sfp - } - } - } - default: // E.g., int32 - mfi.merge = func(dst, src pointer) { - if v := *src.toInt32(); v != 0 { - *dst.toInt32() = v - } - } - } - case reflect.Int64: - switch { - case isSlice: // E.g., []int64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toInt64Slice() - if *sfsp != nil { - dfsp := dst.toInt64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []int64{} - } - } - } - case isPointer: // E.g., *int64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toInt64Ptr() - if *sfpp != nil { - dfpp := dst.toInt64Ptr() - if *dfpp == nil { - *dfpp = Int64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., int64 - mfi.merge = func(dst, src pointer) { - if v := *src.toInt64(); v != 0 { - *dst.toInt64() = v - } - } - } - case reflect.Uint32: - switch { - case isSlice: // E.g., []uint32 - mfi.merge = func(dst, src pointer) { - sfsp := src.toUint32Slice() - if *sfsp != nil { - dfsp := dst.toUint32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []uint32{} - } - } - } - case isPointer: // E.g., *uint32 - mfi.merge = func(dst, src pointer) { - sfpp := src.toUint32Ptr() - if *sfpp != nil { - dfpp := dst.toUint32Ptr() - if *dfpp == nil { - *dfpp = Uint32(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., uint32 - mfi.merge = func(dst, src pointer) { - if v := *src.toUint32(); v != 0 { - *dst.toUint32() = v - } - } - } - case reflect.Uint64: - switch { - case isSlice: // E.g., []uint64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toUint64Slice() - if *sfsp != nil { - dfsp := dst.toUint64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []uint64{} - } - } - } - case isPointer: // E.g., *uint64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toUint64Ptr() - if *sfpp != nil { - dfpp := dst.toUint64Ptr() - if *dfpp == nil { - *dfpp = Uint64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., uint64 - mfi.merge = func(dst, src pointer) { - if v := *src.toUint64(); v != 0 { - *dst.toUint64() = v - } - } - } - case reflect.Float32: - switch { - case isSlice: // E.g., []float32 - mfi.merge = func(dst, src pointer) { - sfsp := src.toFloat32Slice() - if *sfsp != nil { - dfsp := dst.toFloat32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []float32{} - } - } - } - case isPointer: // E.g., *float32 - mfi.merge = func(dst, src pointer) { - sfpp := src.toFloat32Ptr() - if *sfpp != nil { - dfpp := dst.toFloat32Ptr() - if *dfpp == nil { - *dfpp = Float32(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., float32 - mfi.merge = func(dst, src pointer) { - if v := *src.toFloat32(); v != 0 { - *dst.toFloat32() = v - } - } - } - case reflect.Float64: - switch { - case isSlice: // E.g., []float64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toFloat64Slice() - if *sfsp != nil { - dfsp := dst.toFloat64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []float64{} - } - } - } - case isPointer: // E.g., *float64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toFloat64Ptr() - if *sfpp != nil { - dfpp := dst.toFloat64Ptr() - if *dfpp == nil { - *dfpp = Float64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., float64 - mfi.merge = func(dst, src pointer) { - if v := *src.toFloat64(); v != 0 { - *dst.toFloat64() = v - } - } - } - case reflect.Bool: - switch { - case isSlice: // E.g., []bool - mfi.merge = func(dst, src pointer) { - sfsp := src.toBoolSlice() - if *sfsp != nil { - dfsp := dst.toBoolSlice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []bool{} - } - } - } - case isPointer: // E.g., *bool - mfi.merge = func(dst, src pointer) { - sfpp := src.toBoolPtr() - if *sfpp != nil { - dfpp := dst.toBoolPtr() - if *dfpp == nil { - *dfpp = Bool(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., bool - mfi.merge = func(dst, src pointer) { - if v := *src.toBool(); v { - *dst.toBool() = v - } - } - } - case reflect.String: - switch { - case isSlice: // E.g., []string - mfi.merge = func(dst, src pointer) { - sfsp := src.toStringSlice() - if *sfsp != nil { - dfsp := dst.toStringSlice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []string{} - } - } - } - case isPointer: // E.g., *string - mfi.merge = func(dst, src pointer) { - sfpp := src.toStringPtr() - if *sfpp != nil { - dfpp := dst.toStringPtr() - if *dfpp == nil { - *dfpp = String(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., string - mfi.merge = func(dst, src pointer) { - if v := *src.toString(); v != "" { - *dst.toString() = v - } - } - } - case reflect.Slice: - isProto3 := props.Prop[i].Proto3 - switch { - case isPointer: - panic("bad pointer in byte slice case in " + tf.Name()) - case tf.Elem().Kind() != reflect.Uint8: - panic("bad element kind in byte slice case in " + tf.Name()) - case isSlice: // E.g., [][]byte - mfi.merge = func(dst, src pointer) { - sbsp := src.toBytesSlice() - if *sbsp != nil { - dbsp := dst.toBytesSlice() - for _, sb := range *sbsp { - if sb == nil { - *dbsp = append(*dbsp, nil) - } else { - *dbsp = append(*dbsp, append([]byte{}, sb...)) - } - } - if *dbsp == nil { - *dbsp = [][]byte{} - } - } - } - default: // E.g., []byte - mfi.merge = func(dst, src pointer) { - sbp := src.toBytes() - if *sbp != nil { - dbp := dst.toBytes() - if !isProto3 || len(*sbp) > 0 { - *dbp = append([]byte{}, *sbp...) - } - } - } - } - case reflect.Struct: - switch { - case !isPointer: - panic(fmt.Sprintf("message field %s without pointer", tf)) - case isSlice: // E.g., []*pb.T - mi := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - sps := src.getPointerSlice() - if sps != nil { - dps := dst.getPointerSlice() - for _, sp := range sps { - var dp pointer - if !sp.isNil() { - dp = valToPointer(reflect.New(tf)) - mi.merge(dp, sp) - } - dps = append(dps, dp) - } - if dps == nil { - dps = []pointer{} - } - dst.setPointerSlice(dps) - } - } - default: // E.g., *pb.T - mi := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - sp := src.getPointer() - if !sp.isNil() { - dp := dst.getPointer() - if dp.isNil() { - dp = valToPointer(reflect.New(tf)) - dst.setPointer(dp) - } - mi.merge(dp, sp) - } - } - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic("bad pointer or slice in map case in " + tf.Name()) - default: // E.g., map[K]V - mfi.merge = func(dst, src pointer) { - sm := src.asPointerTo(tf).Elem() - if sm.Len() == 0 { - return - } - dm := dst.asPointerTo(tf).Elem() - if dm.IsNil() { - dm.Set(reflect.MakeMap(tf)) - } - - switch tf.Elem().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - val = reflect.ValueOf(Clone(val.Interface().(Message))) - dm.SetMapIndex(key, val) - } - case reflect.Slice: // E.g. Bytes type (e.g., []byte) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) - dm.SetMapIndex(key, val) - } - default: // Basic type (e.g., string) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - dm.SetMapIndex(key, val) - } - } - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic("bad pointer or slice in interface case in " + tf.Name()) - default: // E.g., interface{} - // TODO: Make this faster? - mfi.merge = func(dst, src pointer) { - su := src.asPointerTo(tf).Elem() - if !su.IsNil() { - du := dst.asPointerTo(tf).Elem() - typ := su.Elem().Type() - if du.IsNil() || du.Elem().Type() != typ { - du.Set(reflect.New(typ.Elem())) // Initialize interface if empty - } - sv := su.Elem().Elem().Field(0) - if sv.Kind() == reflect.Ptr && sv.IsNil() { - return - } - dv := du.Elem().Elem().Field(0) - if dv.Kind() == reflect.Ptr && dv.IsNil() { - dv.Set(reflect.New(sv.Type().Elem())) // Initialize proto message if empty - } - switch sv.Type().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - Merge(dv.Interface().(Message), sv.Interface().(Message)) - case reflect.Slice: // E.g. Bytes type (e.g., []byte) - dv.Set(reflect.ValueOf(append([]byte{}, sv.Bytes()...))) - default: // Basic type (e.g., string) - dv.Set(sv) - } - } - } - } - default: - panic(fmt.Sprintf("merger not found for type:%s", tf)) - } - mi.fields = append(mi.fields, mfi) - } - - expFunc := exporterFunc(t) - mi.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") - } - mi.unrecognized = toField(&f, nil) - } - if f, ok := t.FieldByName("unknownFields"); ok { - if f.Type != reflect.TypeOf([]byte{}) { - panic("expected unknownFields to be of type []byte") - } - mi.unrecognized = toField(&f, expFunc) - } - - atomic.StoreInt32(&mi.initialized, 1) -} diff --git a/proto/table_unmarshal.go b/proto/table_unmarshal.go deleted file mode 100644 index 0c17f2edd3..0000000000 --- a/proto/table_unmarshal.go +++ /dev/null @@ -1,2090 +0,0 @@ -// Copyright 2016 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" - "io" - "math" - "reflect" - "strconv" - "strings" - "sync" - "sync/atomic" - "unicode/utf8" - - "github.com/golang/protobuf/internal/wire" -) - -// Unmarshal is the entry point from the generated .pb.go files. -// This function is not intended to be used by non-generated code. -// This function is not subject to any compatibility guarantee. -// msg contains a pointer to a protocol buffer struct. -// b is the data to be unmarshaled into the protocol buffer. -// a is a pointer to a place to store cached unmarshal information. -func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error { - // Load the unmarshal information for this message type. - // The atomic load ensures memory consistency. - u := atomicLoadUnmarshalInfo(&a.unmarshal) - if u == nil { - // Slow path: find unmarshal info for msg, update a with it. - u = getUnmarshalInfo(reflect.TypeOf(msg).Elem()) - atomicStoreUnmarshalInfo(&a.unmarshal, u) - } - // Then do the unmarshaling. - err := u.unmarshal(toPointer(&msg), b) - return err -} - -type unmarshalInfo struct { - typ reflect.Type // type of the protobuf struct - - // 0 = only typ field is initialized - // 1 = completely initialized - initialized int32 - lock sync.Mutex // prevents double initialization - dense []unmarshalFieldInfo // fields indexed by tag # - sparse map[uint64]unmarshalFieldInfo // fields indexed by tag # - reqFields []string // names of required fields - reqMask uint64 // 1< 0 { - // Read tag and wire type. - // Special case 1 and 2 byte varints. - var x uint64 - if b[0] < 128 { - x = uint64(b[0]) - b = b[1:] - } else if len(b) >= 2 && b[1] < 128 { - x = uint64(b[0]&0x7f) + uint64(b[1])<<7 - b = b[2:] - } else { - var n int - x, n = decodeVarint(b) - if n == 0 { - return io.ErrUnexpectedEOF - } - b = b[n:] - } - tag := x >> 3 - wire := int(x) & 7 - - // Dispatch on the tag to one of the unmarshal* functions below. - var f unmarshalFieldInfo - if tag < uint64(len(u.dense)) { - f = u.dense[tag] - } else { - f = u.sparse[tag] - } - if fn := f.unmarshal; fn != nil { - var err error - b, err = fn(b, m.offset(f.field), wire) - if err == nil { - reqMask |= f.reqMask - continue - } - if r, ok := err.(*requiredNotSetError); ok { - // Remember this error, but keep parsing. We need to produce - // a full parse even if a required field is missing. - if errLater == nil { - errLater = r - } - reqMask |= f.reqMask - continue - } - if err != errInternalBadWireType { - if err == errInvalidUTF8 { - if errLater == nil { - mz := reflect.Zero(reflect.PtrTo(u.typ)).Interface().(Message) - fullName := MessageName(mz) + "." + f.name - errLater = &invalidUTF8Error{fullName} - } - continue - } - return err - } - // Fragments with bad wire type are treated as unknown fields. - } - - // Unknown tag. - if !u.unrecognized.IsValid() { - // Don't keep unrecognized data; just skip it. - var err error - b, err = skipField(b, wire) - if err != nil { - return err - } - continue - } - // Keep unrecognized data around. - // maybe in extensions, maybe in the unrecognized field. - z := m.offset(u.unrecognized).toBytes() - for _, r := range u.extensionRanges { - if uint64(r.Start) <= tag && tag <= uint64(r.End) { - hasExtensions = true - } - } - - // Use wire type to skip data. - var err error - b0 := b - b, err = skipField(b, wire) - if err != nil { - return err - } - *z = encodeVarint(*z, tag<<3|uint64(wire)) - *z = append(*z, b0[:len(b0)-len(b)]...) - } - - // If there were unknown extensions, eagerly unmarshal them. - if hasExtensions { - var nerr nonFatal - mi := m.asPointerTo(u.typ).Interface().(Message) - unrecognized := m.offset(u.unrecognized).toBytes() - if err := unmarshalExtensions(mi, unrecognized); !nerr.Merge(err) { - return err - } - } - - if reqMask != u.reqMask && errLater == nil { - // A required field of this message is missing. - for _, n := range u.reqFields { - if reqMask&1 == 0 { - errLater = &requiredNotSetError{n} - } - reqMask >>= 1 - } - } - return errLater -} - -func unmarshalExtensions(mi Message, unrecognized *[]byte) error { - extFields, _ := extendable(mi) - if extFields == nil { - return nil - } - - emap := RegisteredExtensions(mi) // map[int32]*ExtensionDesc - oldUnknownFields := *unrecognized - newUnknownFields := oldUnknownFields[:0] - - for len(oldUnknownFields) > 0 { - fieldNum, wireTyp, tagLen := wire.ConsumeTag(oldUnknownFields) - if tagLen < 0 { - return wire.ParseError(tagLen) - } - extDesc, ok := emap[int32(fieldNum)] - if !ok || extDesc.ExtensionType == nil { - valLen := wire.ConsumeFieldValue(fieldNum, wireTyp, oldUnknownFields[tagLen:]) - if valLen < 0 { - return wire.ParseError(valLen) - } - - newUnknownFields = append(newUnknownFields, oldUnknownFields[:tagLen+valLen]...) - oldUnknownFields = oldUnknownFields[tagLen+valLen:] - continue - } - oldUnknownFields = oldUnknownFields[tagLen:] - - if err := checkExtensionTypeAndRanges(mi, extDesc); err != nil { - return err - } - - // Create a new value or reuse an existing one. - fieldType := reflect.TypeOf(extDesc.ExtensionType) - fieldVal := reflect.New(fieldType).Elem() // E.g., *int32, *Message, []T - if extField := extFields.Get(fieldNum); extField.HasValue() { - fieldVal.Set(reflect.ValueOf(extensionAsLegacyType(extField.GetValue()))) - } - - // Unmarshal the value. - var err error - var nerr nonFatal - unmarshal := typeUnmarshaler(fieldType, extDesc.Tag) - if oldUnknownFields, err = unmarshal(oldUnknownFields, valToPointer(fieldVal.Addr()), int(wireTyp)); !nerr.Merge(err) { - return err - } - - // Store the value into the extension field. - var x Extension - x.SetType(extDesc) - x.SetEagerValue(extensionAsStorageType(fieldVal.Interface())) - extFields.Set(fieldNum, x) - } - - if len(newUnknownFields) == 0 { - newUnknownFields = nil // NOTE: code actually depends on this... - } - *unrecognized = newUnknownFields - return nil -} - -// computeUnmarshalInfo fills in u with information for use -// in unmarshaling protocol buffers of type u.typ. -func (u *unmarshalInfo) computeUnmarshalInfo() { - u.lock.Lock() - defer u.lock.Unlock() - if u.initialized != 0 { - return - } - t := u.typ - n := t.NumField() - - // Set up the "not found" value for the unrecognized byte buffer. - // This is the default for proto3. - u.unrecognized = invalidField - u.extensions = invalidField - u.oldExtensions = invalidField - - // List of the generated type and offset for each oneof field. - type oneofField struct { - ityp reflect.Type // interface type of oneof field - field field // offset in containing message - } - var oneofFields []oneofField - - oneofImplementers := oneofWrappers(t) - u.isMessageSet = isMessageSet(t) - expFunc := exporterFunc(t) - - for i := 0; i < n; i++ { - f := t.Field(i) - if f.Name == "XXX_unrecognized" { - // The byte slice used to hold unrecognized input is special. - if f.Type != reflect.TypeOf(([]byte)(nil)) { - panic("bad type for XXX_unrecognized field: " + f.Type.Name()) - } - u.unrecognized = toField(&f, nil) - continue - } - if f.Name == "XXX_InternalExtensions" { - // Ditto here. - if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) { - panic("bad type for XXX_InternalExtensions field: " + f.Type.Name()) - } - u.extensions = toField(&f, nil) - if f.Tag.Get("protobuf_messageset") == "1" { - u.isMessageSet = true - } - continue - } - if f.Name == "XXX_extensions" { - // An older form of the extensions field. - if f.Type != reflect.TypeOf((map[int32]Extension)(nil)) { - panic("bad type for XXX_extensions field: " + f.Type.Name()) - } - u.oldExtensions = toField(&f, nil) - continue - } - if f.Name == "unknownFields" { - if f.Type != reflect.TypeOf(([]byte)(nil)) { - panic("bad type for unknownFields field: " + f.Type.Name()) - } - u.unrecognized = toField(&f, expFunc) - continue - } - if f.Name == "extensionFields" { - if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) { - panic("bad type for extensionFields field: " + f.Type.Name()) - } - u.extensions = toField(&f, expFunc) - continue - } - - if strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { - continue - } - - oneof := f.Tag.Get("protobuf_oneof") - if oneof != "" { - oneofFields = append(oneofFields, oneofField{f.Type, toField(&f, nil)}) - // The rest of oneof processing happens below. - continue - } - - tags := f.Tag.Get("protobuf") - tagArray := strings.Split(tags, ",") - if len(tagArray) < 2 { - panic("protobuf tag not enough fields in " + t.Name() + "." + f.Name + ": " + tags) - } - tag, err := strconv.Atoi(tagArray[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tagArray[1]) - } - - name := "" - for _, tag := range tagArray[3:] { - if strings.HasPrefix(tag, "name=") { - name = tag[5:] - } - } - - // Extract unmarshaling function from the field (its type and tags). - unmarshal := fieldUnmarshaler(&f) - - // Required field? - var reqMask uint64 - if tagArray[2] == "req" { - bit := len(u.reqFields) - u.reqFields = append(u.reqFields, name) - reqMask = uint64(1) << uint(bit) - // TODO: if we have more than 64 required fields, we end up - // not verifying that all required fields are present. - // Fix this, perhaps using a count of required fields? - } - - // Store the info in the correct slot in the message. - u.setTag(tag, toField(&f, nil), unmarshal, reqMask, name) - } - - // Find any types associated with oneof fields. - for _, v := range oneofImplementers { - tptr := reflect.TypeOf(v) // *Msg_X - typ := tptr.Elem() // Msg_X - - f := typ.Field(0) // oneof implementers have one field - baseUnmarshal := fieldUnmarshaler(&f) - tags := strings.Split(f.Tag.Get("protobuf"), ",") - fieldNum, err := strconv.Atoi(tags[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tags[1]) - } - var name string - for _, tag := range tags { - if strings.HasPrefix(tag, "name=") { - name = strings.TrimPrefix(tag, "name=") - break - } - } - - // Find the oneof field that this struct implements. - // Might take O(n^2) to process all of the oneofs, but who cares. - for _, of := range oneofFields { - if tptr.Implements(of.ityp) { - // We have found the corresponding interface for this struct. - // That lets us know where this struct should be stored - // when we encounter it during unmarshaling. - unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) - u.setTag(fieldNum, of.field, unmarshal, 0, name) - } - } - - } - - // Get extension ranges, if any. - fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") - if fn.IsValid() { - if !u.extensions.IsValid() && !u.oldExtensions.IsValid() { - panic("a message with extensions, but no extensions field in " + t.Name()) - } - u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange) - } - - // Explicitly disallow tag 0. This will ensure we flag an error - // when decoding a buffer of all zeros. Without this code, we - // would decode and skip an all-zero buffer of even length. - // [0 0] is [tag=0/wiretype=varint varint-encoded-0]. - u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) { - return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w) - }, 0, "") - - // Set mask for required field check. - u.reqMask = uint64(1)<= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here? - for len(u.dense) <= tag { - u.dense = append(u.dense, unmarshalFieldInfo{}) - } - u.dense[tag] = i - return - } - if u.sparse == nil { - u.sparse = map[uint64]unmarshalFieldInfo{} - } - u.sparse[uint64(tag)] = i -} - -// fieldUnmarshaler returns an unmarshaler for the given field. -func fieldUnmarshaler(f *reflect.StructField) unmarshaler { - if f.Type.Kind() == reflect.Map { - return makeUnmarshalMap(f) - } - return typeUnmarshaler(f.Type, f.Tag.Get("protobuf")) -} - -// typeUnmarshaler returns an unmarshaler for the given field type / field tag pair. -func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { - tagArray := strings.Split(tags, ",") - encoding := tagArray[0] - name := "unknown" - proto3 := false - validateUTF8 := true - for _, tag := range tagArray[3:] { - if strings.HasPrefix(tag, "name=") { - name = tag[5:] - } - if tag == "proto3" { - proto3 = true - } - } - validateUTF8 = validateUTF8 && proto3 - - // Figure out packaging (pointer, slice, or both) - slice := false - pointer := false - if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { - slice = true - t = t.Elem() - } - if t.Kind() == reflect.Ptr { - pointer = true - t = t.Elem() - } - - // We'll never have both pointer and slice for basic types. - if pointer && slice && t.Kind() != reflect.Struct { - panic("both pointer and slice for basic type in " + t.Name()) - } - - switch t.Kind() { - case reflect.Bool: - if pointer { - return unmarshalBoolPtr - } - if slice { - return unmarshalBoolSlice - } - return unmarshalBoolValue - case reflect.Int32: - switch encoding { - case "fixed32": - if pointer { - return unmarshalFixedS32Ptr - } - if slice { - return unmarshalFixedS32Slice - } - return unmarshalFixedS32Value - case "varint": - // this could be int32 or enum - if pointer { - return unmarshalInt32Ptr - } - if slice { - return unmarshalInt32Slice - } - return unmarshalInt32Value - case "zigzag32": - if pointer { - return unmarshalSint32Ptr - } - if slice { - return unmarshalSint32Slice - } - return unmarshalSint32Value - } - case reflect.Int64: - switch encoding { - case "fixed64": - if pointer { - return unmarshalFixedS64Ptr - } - if slice { - return unmarshalFixedS64Slice - } - return unmarshalFixedS64Value - case "varint": - if pointer { - return unmarshalInt64Ptr - } - if slice { - return unmarshalInt64Slice - } - return unmarshalInt64Value - case "zigzag64": - if pointer { - return unmarshalSint64Ptr - } - if slice { - return unmarshalSint64Slice - } - return unmarshalSint64Value - } - case reflect.Uint32: - switch encoding { - case "fixed32": - if pointer { - return unmarshalFixed32Ptr - } - if slice { - return unmarshalFixed32Slice - } - return unmarshalFixed32Value - case "varint": - if pointer { - return unmarshalUint32Ptr - } - if slice { - return unmarshalUint32Slice - } - return unmarshalUint32Value - } - case reflect.Uint64: - switch encoding { - case "fixed64": - if pointer { - return unmarshalFixed64Ptr - } - if slice { - return unmarshalFixed64Slice - } - return unmarshalFixed64Value - case "varint": - if pointer { - return unmarshalUint64Ptr - } - if slice { - return unmarshalUint64Slice - } - return unmarshalUint64Value - } - case reflect.Float32: - if pointer { - return unmarshalFloat32Ptr - } - if slice { - return unmarshalFloat32Slice - } - return unmarshalFloat32Value - case reflect.Float64: - if pointer { - return unmarshalFloat64Ptr - } - if slice { - return unmarshalFloat64Slice - } - return unmarshalFloat64Value - case reflect.Map: - panic("map type in typeUnmarshaler in " + t.Name()) - case reflect.Slice: - if pointer { - panic("bad pointer in slice case in " + t.Name()) - } - if slice { - return unmarshalBytesSlice - } - return unmarshalBytesValue - case reflect.String: - if validateUTF8 { - if pointer { - return unmarshalUTF8StringPtr - } - if slice { - return unmarshalUTF8StringSlice - } - return unmarshalUTF8StringValue - } - if pointer { - return unmarshalStringPtr - } - if slice { - return unmarshalStringSlice - } - return unmarshalStringValue - case reflect.Struct: - // message or group field - if !pointer { - panic(fmt.Sprintf("message/group field %s:%s without pointer", t, encoding)) - } - switch encoding { - case "bytes": - if slice { - return makeUnmarshalMessageSlicePtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalMessagePtr(getUnmarshalInfo(t), name) - case "group": - if slice { - return makeUnmarshalGroupSlicePtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalGroupPtr(getUnmarshalInfo(t), name) - } - } - panic(fmt.Sprintf("unmarshaler not found type:%s encoding:%s", t, encoding)) -} - -// Below are all the unmarshalers for individual fields of various types. - -func unmarshalInt64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - *f.toInt64() = v - return b, nil -} - -func unmarshalInt64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - *f.toInt64Ptr() = &v - return b, nil -} - -func unmarshalInt64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - s := f.toInt64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - s := f.toInt64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalSint64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - *f.toInt64() = v - return b, nil -} - -func unmarshalSint64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - *f.toInt64Ptr() = &v - return b, nil -} - -func unmarshalSint64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - s := f.toInt64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - s := f.toInt64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalUint64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - *f.toUint64() = v - return b, nil -} - -func unmarshalUint64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - *f.toUint64Ptr() = &v - return b, nil -} - -func unmarshalUint64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - s := f.toUint64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - s := f.toUint64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalInt32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - *f.toInt32() = v - return b, nil -} - -func unmarshalInt32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.setInt32Ptr(v) - return b, nil -} - -func unmarshalInt32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.appendInt32Slice(v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.appendInt32Slice(v) - return b, nil -} - -func unmarshalSint32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - *f.toInt32() = v - return b, nil -} - -func unmarshalSint32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.setInt32Ptr(v) - return b, nil -} - -func unmarshalSint32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.appendInt32Slice(v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.appendInt32Slice(v) - return b, nil -} - -func unmarshalUint32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - *f.toUint32() = v - return b, nil -} - -func unmarshalUint32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - *f.toUint32Ptr() = &v - return b, nil -} - -func unmarshalUint32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - s := f.toUint32Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - s := f.toUint32Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalFixed64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - *f.toUint64() = v - return b[8:], nil -} - -func unmarshalFixed64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - *f.toUint64Ptr() = &v - return b[8:], nil -} - -func unmarshalFixed64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - s := f.toUint64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - s := f.toUint64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFixedS64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - *f.toInt64() = v - return b[8:], nil -} - -func unmarshalFixedS64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - *f.toInt64Ptr() = &v - return b[8:], nil -} - -func unmarshalFixedS64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - s := f.toInt64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - s := f.toInt64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFixed32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - *f.toUint32() = v - return b[4:], nil -} - -func unmarshalFixed32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - *f.toUint32Ptr() = &v - return b[4:], nil -} - -func unmarshalFixed32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - s := f.toUint32Slice() - *s = append(*s, v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - s := f.toUint32Slice() - *s = append(*s, v) - return b[4:], nil -} - -func unmarshalFixedS32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - *f.toInt32() = v - return b[4:], nil -} - -func unmarshalFixedS32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.setInt32Ptr(v) - return b[4:], nil -} - -func unmarshalFixedS32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.appendInt32Slice(v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.appendInt32Slice(v) - return b[4:], nil -} - -func unmarshalBoolValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - // Note: any length varint is allowed, even though any sane - // encoder will use one byte. - // See https://github.com/golang/protobuf/issues/76 - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - // TODO: check if x>1? Tests seem to indicate no. - v := x != 0 - *f.toBool() = v - return b[n:], nil -} - -func unmarshalBoolPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - *f.toBoolPtr() = &v - return b[n:], nil -} - -func unmarshalBoolSlice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - s := f.toBoolSlice() - *s = append(*s, v) - b = b[n:] - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - s := f.toBoolSlice() - *s = append(*s, v) - return b[n:], nil -} - -func unmarshalFloat64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - *f.toFloat64() = v - return b[8:], nil -} - -func unmarshalFloat64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - *f.toFloat64Ptr() = &v - return b[8:], nil -} - -func unmarshalFloat64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - s := f.toFloat64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - s := f.toFloat64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFloat32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - *f.toFloat32() = v - return b[4:], nil -} - -func unmarshalFloat32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - *f.toFloat32Ptr() = &v - return b[4:], nil -} - -func unmarshalFloat32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - s := f.toFloat32Slice() - *s = append(*s, v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - s := f.toFloat32Slice() - *s = append(*s, v) - return b[4:], nil -} - -func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toString() = v - return b[x:], nil -} - -func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toStringPtr() = &v - return b[x:], nil -} - -func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - s := f.toStringSlice() - *s = append(*s, v) - return b[x:], nil -} - -func unmarshalUTF8StringValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toString() = v - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -func unmarshalUTF8StringPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toStringPtr() = &v - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -func unmarshalUTF8StringSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - s := f.toStringSlice() - *s = append(*s, v) - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -var emptyBuf [0]byte - -func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // The use of append here is a trick which avoids the zeroing - // that would be required if we used a make/copy pair. - // We append to emptyBuf instead of nil because we want - // a non-nil result even when the length is 0. - v := append(emptyBuf[:], b[:x]...) - *f.toBytes() = v - return b[x:], nil -} - -func unmarshalBytesSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := append(emptyBuf[:], b[:x]...) - s := f.toBytesSlice() - *s = append(*s, v) - return b[x:], nil -} - -func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // First read the message field to see if something is there. - // The semantics of multiple submessages are weird. Instead of - // the last one winning (as it is for all other fields), multiple - // submessages are merged. - v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*requiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[x:], err - } -} - -func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*requiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendPointer(v) - return b[x:], err - } -} - -func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireStartGroup { - return b, errInternalBadWireType - } - x, y := findEndGroup(b) - if x < 0 { - return nil, io.ErrUnexpectedEOF - } - v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*requiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[y:], err - } -} - -func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireStartGroup { - return b, errInternalBadWireType - } - x, y := findEndGroup(b) - if x < 0 { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*requiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendPointer(v) - return b[y:], err - } -} - -func makeUnmarshalMap(f *reflect.StructField) unmarshaler { - t := f.Type - kt := t.Key() - vt := t.Elem() - unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key")) - unmarshalVal := typeUnmarshaler(vt, f.Tag.Get("protobuf_val")) - return func(b []byte, f pointer, w int) ([]byte, error) { - // The map entry is a submessage. Figure out how big it is. - if w != WireBytes { - return nil, fmt.Errorf("proto: bad wiretype for map field: got %d want %d", w, WireBytes) - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - r := b[x:] // unused data to return - b = b[:x] // data for map entry - - // Note: we could use #keys * #values ~= 200 functions - // to do map decoding without reflection. Probably not worth it. - // Maps will be somewhat slow. Oh well. - - // Read key and value from data. - var nerr nonFatal - k := reflect.New(kt) - v := reflect.New(vt) - for len(b) > 0 { - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - wire := int(x) & 7 - b = b[n:] - - var err error - switch x >> 3 { - case 1: - b, err = unmarshalKey(b, valToPointer(k), wire) - case 2: - b, err = unmarshalVal(b, valToPointer(v), wire) - default: - err = errInternalBadWireType // skip unknown tag - } - - if nerr.Merge(err) { - continue - } - if err != errInternalBadWireType { - return nil, err - } - - // Skip past unknown fields. - b, err = skipField(b, wire) - if err != nil { - return nil, err - } - } - - // Get map, allocate if needed. - m := f.asPointerTo(t).Elem() // an addressable map[K]T - if m.IsNil() { - m.Set(reflect.MakeMap(t)) - } - - // Insert into map. - m.SetMapIndex(k.Elem(), v.Elem()) - - return r, nerr.E - } -} - -// makeUnmarshalOneof makes an unmarshaler for oneof fields. -// for: -// message Msg { -// oneof F { -// int64 X = 1; -// float64 Y = 2; -// } -// } -// typ is the type of the concrete entry for a oneof case (e.g. Msg_X). -// ityp is the interface type of the oneof field (e.g. isMsg_F). -// unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64). -// Note that this function will be called once for each case in the oneof. -func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler { - sf := typ.Field(0) - field0 := toField(&sf, nil) - return func(b []byte, f pointer, w int) ([]byte, error) { - // Allocate holder for value. - v := reflect.New(typ) - - // Unmarshal data into holder. - // We unmarshal into the first field of the holder object. - var err error - var nerr nonFatal - b, err = unmarshal(b, valToPointer(v).offset(field0), w) - if !nerr.Merge(err) { - return nil, err - } - - // Write pointer to holder into target field. - f.asPointerTo(ityp).Elem().Set(v) - - return b, nerr.E - } -} - -// Error used by decode internally. -var errInternalBadWireType = errors.New("proto: internal error: bad wiretype") - -// skipField skips past a field of type wire and returns the remaining bytes. -func skipField(b []byte, wire int) ([]byte, error) { - switch wire { - case WireVarint: - _, k := decodeVarint(b) - if k == 0 { - return b, io.ErrUnexpectedEOF - } - b = b[k:] - case WireFixed32: - if len(b) < 4 { - return b, io.ErrUnexpectedEOF - } - b = b[4:] - case WireFixed64: - if len(b) < 8 { - return b, io.ErrUnexpectedEOF - } - b = b[8:] - case WireBytes: - m, k := decodeVarint(b) - if k == 0 || uint64(len(b)-k) < m { - return b, io.ErrUnexpectedEOF - } - b = b[uint64(k)+m:] - case WireStartGroup: - _, i := findEndGroup(b) - if i == -1 { - return b, io.ErrUnexpectedEOF - } - b = b[i:] - default: - return b, fmt.Errorf("proto: can't skip unknown wire type %d", wire) - } - return b, nil -} - -// findEndGroup finds the index of the next EndGroup tag. -// Groups may be nested, so the "next" EndGroup tag is the first -// unpaired EndGroup. -// findEndGroup returns the indexes of the start and end of the EndGroup tag. -// Returns (-1,-1) if it can't find one. -func findEndGroup(b []byte) (int, int) { - depth := 1 - i := 0 - for { - x, n := decodeVarint(b[i:]) - if n == 0 { - return -1, -1 - } - j := i - i += n - switch x & 7 { - case WireVarint: - _, k := decodeVarint(b[i:]) - if k == 0 { - return -1, -1 - } - i += k - case WireFixed32: - if len(b)-4 < i { - return -1, -1 - } - i += 4 - case WireFixed64: - if len(b)-8 < i { - return -1, -1 - } - i += 8 - case WireBytes: - m, k := decodeVarint(b[i:]) - if k == 0 { - return -1, -1 - } - i += k - if uint64(len(b)-i) < m { - return -1, -1 - } - i += int(m) - case WireStartGroup: - depth++ - case WireEndGroup: - depth-- - if depth == 0 { - return j, i - } - default: - return -1, -1 - } - } -} - -// encodeVarint appends a varint-encoded integer to b and returns the result. -func encodeVarint(b []byte, x uint64) []byte { - for x >= 1<<7 { - b = append(b, byte(x&0x7f|0x80)) - x >>= 7 - } - return append(b, byte(x)) -} - -// decodeVarint reads a varint-encoded integer from b. -// Returns the decoded integer and the number of bytes read. -// If there is an error, it returns 0,0. -func decodeVarint(b []byte) (uint64, int) { - var x, y uint64 - if len(b) == 0 { - goto bad - } - x = uint64(b[0]) - if x < 0x80 { - return x, 1 - } - x -= 0x80 - - if len(b) <= 1 { - goto bad - } - y = uint64(b[1]) - x += y << 7 - if y < 0x80 { - return x, 2 - } - x -= 0x80 << 7 - - if len(b) <= 2 { - goto bad - } - y = uint64(b[2]) - x += y << 14 - if y < 0x80 { - return x, 3 - } - x -= 0x80 << 14 - - if len(b) <= 3 { - goto bad - } - y = uint64(b[3]) - x += y << 21 - if y < 0x80 { - return x, 4 - } - x -= 0x80 << 21 - - if len(b) <= 4 { - goto bad - } - y = uint64(b[4]) - x += y << 28 - if y < 0x80 { - return x, 5 - } - x -= 0x80 << 28 - - if len(b) <= 5 { - goto bad - } - y = uint64(b[5]) - x += y << 35 - if y < 0x80 { - return x, 6 - } - x -= 0x80 << 35 - - if len(b) <= 6 { - goto bad - } - y = uint64(b[6]) - x += y << 42 - if y < 0x80 { - return x, 7 - } - x -= 0x80 << 42 - - if len(b) <= 7 { - goto bad - } - y = uint64(b[7]) - x += y << 49 - if y < 0x80 { - return x, 8 - } - x -= 0x80 << 49 - - if len(b) <= 8 { - goto bad - } - y = uint64(b[8]) - x += y << 56 - if y < 0x80 { - return x, 9 - } - x -= 0x80 << 56 - - if len(b) <= 9 { - goto bad - } - y = uint64(b[9]) - x += y << 63 - if y < 2 { - return x, 10 - } - -bad: - return 0, 0 -} diff --git a/proto/text.go b/proto/text.go deleted file mode 100644 index 40f7912b0c..0000000000 --- a/proto/text.go +++ /dev/null @@ -1,832 +0,0 @@ -// 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 - -// Functions for writing the text protocol buffer format. - -import ( - "bufio" - "bytes" - "encoding" - "errors" - "fmt" - "io" - "log" - "math" - "reflect" - "sort" - "strings" - - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" -) - -var ( - newline = []byte("\n") - spaces = []byte(" ") - endBraceNewline = []byte("}\n") - backslashN = []byte{'\\', 'n'} - backslashR = []byte{'\\', 'r'} - backslashT = []byte{'\\', 't'} - backslashDQ = []byte{'\\', '"'} - backslashBS = []byte{'\\', '\\'} - posInf = []byte("inf") - negInf = []byte("-inf") - nan = []byte("nan") -) - -type writer interface { - io.Writer - WriteByte(byte) error -} - -// textWriter is an io.Writer that tracks its indentation level. -type textWriter struct { - ind int - complete bool // if the current position is a complete line - compact bool // whether to write out as a one-liner - w writer -} - -func (w *textWriter) WriteString(s string) (n int, err error) { - if !strings.Contains(s, "\n") { - if !w.compact && w.complete { - w.writeIndent() - } - w.complete = false - return io.WriteString(w.w, s) - } - // WriteString is typically called without newlines, so this - // codepath and its copy are rare. We copy to avoid - // duplicating all of Write's logic here. - return w.Write([]byte(s)) -} - -func (w *textWriter) Write(p []byte) (n int, err error) { - newlines := bytes.Count(p, newline) - if newlines == 0 { - if !w.compact && w.complete { - w.writeIndent() - } - n, err = w.w.Write(p) - w.complete = false - return n, err - } - - frags := bytes.SplitN(p, newline, newlines+1) - if w.compact { - for i, frag := range frags { - if i > 0 { - if err := w.w.WriteByte(' '); err != nil { - return n, err - } - n++ - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - } - return n, nil - } - - for i, frag := range frags { - if w.complete { - w.writeIndent() - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - if i+1 < len(frags) { - if err := w.w.WriteByte('\n'); err != nil { - return n, err - } - n++ - } - } - w.complete = len(frags[len(frags)-1]) == 0 - return n, nil -} - -func (w *textWriter) WriteByte(c byte) error { - if w.compact && c == '\n' { - c = ' ' - } - if !w.compact && w.complete { - w.writeIndent() - } - err := w.w.WriteByte(c) - w.complete = c == '\n' - return err -} - -func (w *textWriter) indent() { w.ind++ } - -func (w *textWriter) unindent() { - if w.ind == 0 { - log.Print("proto: textWriter unindented too far") - return - } - w.ind-- -} - -func writeName(w *textWriter, props *Properties) error { - if _, err := w.WriteString(props.OrigName); err != nil { - return err - } - if props.Wire != "group" { - return w.WriteByte(':') - } - return nil -} - -func requiresQuotes(u string) bool { - // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. - for _, ch := range u { - switch { - case ch == '.' || ch == '/' || ch == '_': - continue - case '0' <= ch && ch <= '9': - continue - case 'A' <= ch && ch <= 'Z': - continue - case 'a' <= ch && ch <= 'z': - continue - default: - return true - } - } - return false -} - -// isAny reports whether sv is a google.protobuf.Any message -func isAny(sv reflect.Value) bool { - switch m := sv.Addr().Interface().(type) { - case interface{ XXX_WellKnownType() string }: - return m.XXX_WellKnownType() == "Any" - case protoV2.Message: - return m.ProtoReflect().Descriptor().FullName() == "google.protobuf.Any" - default: - return false - } -} - -// writeProto3Any writes an expanded google.protobuf.Any message. -// -// It returns (false, nil) if sv value can't be unmarshaled (e.g. because -// required messages are not linked in). -// -// It returns (true, error) when sv was written in expanded format or an error -// was encountered. -func (tm *textMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { - turl := sv.FieldByName("TypeUrl") - val := sv.FieldByName("Value") - if !turl.IsValid() || !val.IsValid() { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - b, ok := val.Interface().([]byte) - if !ok { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - parts := strings.Split(turl.String(), "/") - mt := MessageType(parts[len(parts)-1]) - if mt == nil { - return false, nil - } - m := reflect.New(mt.Elem()) - if err := Unmarshal(b, m.Interface().(Message)); err != nil { - return false, nil - } - w.Write([]byte("[")) - u := turl.String() - if requiresQuotes(u) { - writeString(w, u) - } else { - w.Write([]byte(u)) - } - if w.compact { - w.Write([]byte("]:<")) - } else { - w.Write([]byte("]: <\n")) - w.ind++ - } - if err := tm.writeStruct(w, m.Elem()); err != nil { - return true, err - } - if w.compact { - w.Write([]byte("> ")) - } else { - w.ind-- - w.Write([]byte(">\n")) - } - return true, nil -} - -func (tm *textMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { - if tm.ExpandAny && isAny(sv) { - if canExpand, err := tm.writeProto3Any(w, sv); canExpand { - return err - } - } - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < sv.NumField(); i++ { - fv := sv.Field(i) - props := sprops.Prop[i] - - f := st.Field(i) - if strings.HasPrefix(f.Name, "XXX_") || f.PkgPath != "" { - continue - } - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Field not filled in. This could be an optional field or - // a required field that wasn't filled in. Either way, there - // isn't anything we can show for it. - continue - } - if fv.Kind() == reflect.Slice && fv.IsNil() { - // Repeated field that is empty, or a bytes field that is unused. - continue - } - - if props.Repeated && fv.Kind() == reflect.Slice { - // Repeated field. - for j := 0; j < fv.Len(); j++ { - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - v := fv.Index(j) - if v.Kind() == reflect.Ptr && v.IsNil() { - // A nil message in a repeated field is not valid, - // but we can handle that more gracefully than panicking. - if _, err := w.Write([]byte("\n")); err != nil { - return err - } - continue - } - if err := tm.writeAny(w, v, props); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Map { - // Map fields are rendered as a repeated struct with key/value fields. - keys := fv.MapKeys() - sort.Sort(mapKeys(keys)) - for _, key := range keys { - val := fv.MapIndex(key) - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - // open struct - if err := w.WriteByte('<'); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - // key - if _, err := w.WriteString("key:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, key, props.MapKeyProp); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - // nil values aren't legal, but we can avoid panicking because of them. - if val.Kind() != reflect.Ptr || !val.IsNil() { - // value - if _, err := w.WriteString("value:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, val, props.MapValProp); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - // close struct - w.unindent() - if err := w.WriteByte('>'); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if props.Proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { - // empty bytes field - continue - } - if fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice { - // proto3 non-repeated scalar field; skip if zero value - if isProto3Zero(fv) { - continue - } - } - - if fv.Kind() == reflect.Interface { - // Check if it is a oneof. - if st.Field(i).Tag.Get("protobuf_oneof") != "" { - // fv is nil, or holds a pointer to generated struct. - // That generated struct has exactly one field, - // which has a protobuf struct tag. - if fv.IsNil() { - continue - } - inner := fv.Elem().Elem() // interface -> *T -> T - tag := inner.Type().Field(0).Tag.Get("protobuf") - props = new(Properties) // Overwrite the outer props var, but not its pointee. - props.Parse(tag) - // Write the value in the oneof, not the oneof itself. - fv = inner.Field(0) - - // Special case to cope with malformed messages gracefully: - // If the value in the oneof is a nil pointer, don't panic - // in writeAny. - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Use errors.New so writeAny won't render quotes. - msg := errors.New("/* nil */") - fv = reflect.ValueOf(&msg).Elem() - } - } - } - - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - - // Enums have a String method, so writeAny will work fine. - if err := tm.writeAny(w, fv, props); err != nil { - return err - } - - if err := w.WriteByte('\n'); err != nil { - return err - } - } - - if fv := unknownFieldsValue(sv); !fv.IsNil() { - if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { - return err - } - } - - // Extensions (the XXX_extensions field). - pv := sv.Addr() - if _, err := extendable(pv.Interface()); err == nil { - if err := tm.writeExtensions(w, pv); err != nil { - return err - } - } - - return nil -} - -// writeAny writes an arbitrary field. -func (tm *textMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { - v = reflect.Indirect(v) - - // Floats have special cases. - if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { - x := v.Float() - var b []byte - switch { - case math.IsInf(x, 1): - b = posInf - case math.IsInf(x, -1): - b = negInf - case math.IsNaN(x): - b = nan - } - if b != nil { - _, err := w.Write(b) - return err - } - // Other values are handled below. - } - - // We don't attempt to serialise every possible value type; only those - // that can occur in protocol buffers. - switch v.Kind() { - case reflect.Slice: - // Should only be a []byte; repeated fields are handled in writeStruct. - if err := writeString(w, string(v.Bytes())); err != nil { - return err - } - case reflect.String: - if err := writeString(w, v.String()); err != nil { - return err - } - case reflect.Struct: - // Required/optional group/message. - var bra, ket byte = '<', '>' - if props != nil && props.Wire == "group" { - bra, ket = '{', '}' - } - if err := w.WriteByte(bra); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - if v.CanAddr() { - // Calling v.Interface on a struct causes the reflect package to - // copy the entire struct. This is racy with the new Marshaler - // since we atomically update the XXX_sizecache. - // - // Thus, we retrieve a pointer to the struct if possible to avoid - // a race since v.Interface on the pointer doesn't copy the struct. - // - // If v is not addressable, then we are not worried about a race - // since it implies that the binary Marshaler cannot possibly be - // mutating this value. - v = v.Addr() - } - if etm, ok := v.Interface().(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = w.Write(text); err != nil { - return err - } - } else { - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - if err := tm.writeStruct(w, v); err != nil { - return err - } - } - w.unindent() - if err := w.WriteByte(ket); err != nil { - return err - } - default: - _, err := fmt.Fprint(w, v.Interface()) - return err - } - return nil -} - -// equivalent to C's isprint. -func isprint(c byte) bool { - return c >= 0x20 && c < 0x7f -} - -// writeString writes a string in the protocol buffer text format. -// It is similar to strconv.Quote except we don't use Go escape sequences, -// we treat the string as a byte sequence, and we use octal escapes. -// These differences are to maintain interoperability with the other -// languages' implementations of the text format. -func writeString(w *textWriter, s string) error { - // use WriteByte here to get any needed indent - if err := w.WriteByte('"'); err != nil { - return err - } - // Loop over the bytes, not the runes. - for i := 0; i < len(s); i++ { - var err error - // Divergence from C++: we don't escape apostrophes. - // There's no need to escape them, and the C++ parser - // copes with a naked apostrophe. - switch c := s[i]; c { - case '\n': - _, err = w.w.Write(backslashN) - case '\r': - _, err = w.w.Write(backslashR) - case '\t': - _, err = w.w.Write(backslashT) - case '"': - _, err = w.w.Write(backslashDQ) - case '\\': - _, err = w.w.Write(backslashBS) - default: - if isprint(c) { - err = w.w.WriteByte(c) - } else { - _, err = fmt.Fprintf(w.w, "\\%03o", c) - } - } - if err != nil { - return err - } - } - return w.WriteByte('"') -} - -func writeUnknownStruct(w *textWriter, data []byte) (err error) { - if !w.compact { - if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil { - return err - } - } - b := NewBuffer(data) - for b.index < len(b.buf) { - x, err := b.DecodeVarint() - if err != nil { - _, err := fmt.Fprintf(w, "/* %v */\n", err) - return err - } - wire, tag := x&7, x>>3 - if wire == WireEndGroup { - w.unindent() - if _, err := w.Write(endBraceNewline); err != nil { - return err - } - continue - } - if _, err := fmt.Fprint(w, tag); err != nil { - return err - } - if wire != WireStartGroup { - if err := w.WriteByte(':'); err != nil { - return err - } - } - if !w.compact || wire == WireStartGroup { - if err := w.WriteByte(' '); err != nil { - return err - } - } - switch wire { - case WireBytes: - buf, e := b.DecodeRawBytes(false) - if e == nil { - _, err = fmt.Fprintf(w, "%q", buf) - } else { - _, err = fmt.Fprintf(w, "/* %v */", e) - } - case WireFixed32: - x, err = b.DecodeFixed32() - err = writeUnknownInt(w, x, err) - case WireFixed64: - x, err = b.DecodeFixed64() - err = writeUnknownInt(w, x, err) - case WireStartGroup: - err = w.WriteByte('{') - w.indent() - case WireVarint: - x, err = b.DecodeVarint() - err = writeUnknownInt(w, x, err) - default: - _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire) - } - if err != nil { - return err - } - if err = w.WriteByte('\n'); err != nil { - return err - } - } - return nil -} - -func writeUnknownInt(w *textWriter, x uint64, err error) error { - if err == nil { - _, err = fmt.Fprint(w, x) - } else { - _, err = fmt.Fprintf(w, "/* %v */", err) - } - return err -} - -type fieldNumSlice []protoreflect.FieldNumber - -func (s fieldNumSlice) Len() int { return len(s) } -func (s fieldNumSlice) Less(i, j int) bool { return s[i] < s[j] } -func (s fieldNumSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -// writeExtensions writes all the extensions in pv. -// pv is assumed to be a pointer to a protocol message struct that is extendable. -func (tm *textMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { - emap := RegisteredExtensions(pv.Interface().(Message)) - ep, _ := extendable(pv.Interface()) - - // Order the extensions by ID. - // This isn't strictly necessary, but it will give us - // canonical output, which will also make testing easier. - if ep == nil { - return nil - } - ids := make([]protoreflect.FieldNumber, 0, ep.Len()) - ep.Range(func(id protoreflect.FieldNumber, _ Extension) bool { - ids = append(ids, id) - return true - }) - sort.Sort(fieldNumSlice(ids)) - - for _, extNum := range ids { - var desc *ExtensionDesc - if emap != nil { - desc = emap[int32(extNum)] - } - if desc == nil { - continue - } - - pb, err := GetExtension(pv.Interface().(Message), desc) - if err != nil { - return fmt.Errorf("failed getting extension: %v", err) - } - - name := desc.Name - if strings.HasSuffix(name, ".message_set_extension") && isMessageSet(pv.Type().Elem()) { - name = strings.TrimSuffix(name, ".message_set_extension") - } - - // Repeated extensions will appear as a slice. - if !isRepeatedExtension(desc) { - if err := tm.writeExtension(w, name, pb); err != nil { - return err - } - } else { - v := reflect.ValueOf(pb) - for i := 0; i < v.Len(); i++ { - if err := tm.writeExtension(w, name, v.Index(i).Interface()); err != nil { - return err - } - } - } - } - return nil -} - -func (tm *textMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { - if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - return nil -} - -func (w *textWriter) writeIndent() { - if !w.complete { - return - } - remain := w.ind * 2 - for remain > 0 { - n := remain - if n > len(spaces) { - n = len(spaces) - } - w.w.Write(spaces[:n]) - remain -= n - } - w.complete = false -} - -// textMarshaler is a configurable text format marshaler. -type textMarshaler struct { - Compact bool // use compact text format (one line). - ExpandAny bool // expand google.protobuf.Any messages of known types -} - -// Marshal writes a given protocol buffer in text format. -// The only errors returned are from w. -func (tm *textMarshaler) Marshal(w io.Writer, pb Message) error { - val := reflect.ValueOf(pb) - if pb == nil || val.IsNil() { - w.Write([]byte("")) - return nil - } - var bw *bufio.Writer - ww, ok := w.(writer) - if !ok { - bw = bufio.NewWriter(w) - ww = bw - } - aw := &textWriter{ - w: ww, - complete: true, - compact: tm.Compact, - } - - if etm, ok := pb.(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = aw.Write(text); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil - } - // Dereference the received pointer so we don't have outer < and >. - v := reflect.Indirect(val) - if err := tm.writeStruct(aw, v); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil -} - -// Text is the same as Marshal, but returns the string directly. -func (tm *textMarshaler) Text(pb Message) string { - var buf bytes.Buffer - tm.Marshal(&buf, pb) - return buf.String() -} - -var ( - defaultTextMarshaler = textMarshaler{} - compactTextMarshaler = textMarshaler{Compact: true} -) - -// TODO: consider removing some of the Marshal functions below. - -// MarshalText writes a given protocol buffer in text format. -// The only errors returned are from w. -func MarshalText(w io.Writer, pb Message) error { - if marshalTextAlt != nil { - return marshalTextAlt(w, pb) - } - return defaultTextMarshaler.Marshal(w, pb) -} - -// MarshalTextString is the same as MarshalText, but returns the string directly. -func MarshalTextString(pb Message) string { - if marshalTextStringAlt != nil { - return marshalTextStringAlt(pb) - } - return defaultTextMarshaler.Text(pb) -} - -// CompactText writes a given protocol buffer in compact text format (one line). -func CompactText(w io.Writer, pb Message) error { - if compactTextAlt != nil { - return compactTextAlt(w, pb) - } - return compactTextMarshaler.Marshal(w, pb) -} - -// CompactTextString is the same as CompactText, but returns the string directly. -func CompactTextString(pb Message) string { - if compactTextStringAlt != nil { - return compactTextStringAlt(pb) - } - return compactTextMarshaler.Text(pb) -} diff --git a/proto/text_decode.go b/proto/text_decode.go new file mode 100644 index 0000000000..a8ea634c6c --- /dev/null +++ b/proto/text_decode.go @@ -0,0 +1,799 @@ +// 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 + +import ( + "encoding" + "errors" + "fmt" + "reflect" + "strconv" + "strings" + "unicode/utf8" + + "google.golang.org/protobuf/encoding/prototext" + protoV2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/runtime/protoimpl" +) + +const wrapTextUnmarshalV2 = false + +// ParseError is returned by UnmarshalText. +type ParseError struct { + Message string + + // Deprecated: Do not use. + Line, Offset int +} + +func (e *ParseError) Error() string { + if wrapTextUnmarshalV2 { + return e.Message + } + if e.Line == 1 { + return fmt.Sprintf("line 1.%d: %v", e.Offset, e.Message) + } + return fmt.Sprintf("line %d: %v", e.Line, e.Message) +} + +// UnmarshalText parses a proto text formatted string into m. +func UnmarshalText(s string, m Message) error { + if u, ok := m.(encoding.TextUnmarshaler); ok { + return u.UnmarshalText([]byte(s)) + } + + m.Reset() + mi := protoimpl.X.ProtoMessageV2Of(m) + + if wrapTextUnmarshalV2 { + err := prototext.UnmarshalOptions{ + AllowPartial: true, + }.Unmarshal([]byte(s), mi) + if err != nil { + return &ParseError{Message: err.Error()} + } + return checkRequiredNotSet(mi) + } else { + if err := newTextParser(s).unmarshalMessage(mi.ProtoReflect(), ""); err != nil { + return err + } + return checkRequiredNotSet(mi) + } +} + +type textParser struct { + s string // remaining input + done bool // whether the parsing is finished (success or error) + backed bool // whether back() was called + offset, line int + cur token +} + +type token struct { + value string + err *ParseError + line int // line number + offset int // byte number from start of input, not start of line + unquoted string // the unquoted version of value, if it was a quoted string +} + +func newTextParser(s string) *textParser { + p := new(textParser) + p.s = s + p.line = 1 + p.cur.line = 1 + return p +} + +func (p *textParser) unmarshalMessage(m protoreflect.Message, terminator string) (err error) { + md := m.Descriptor() + fds := md.Fields() + + // A struct is a sequence of "name: value", terminated by one of + // '>' or '}', or the end of the input. A name may also be + // "[extension]" or "[type/url]". + // + // The whole struct can also be an expanded Any message, like: + // [type/url] < ... struct contents ... > + seen := make(map[protoreflect.FieldNumber]bool) + for { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == terminator { + break + } + if tok.value == "[" { + if err := p.unmarshalExtensionOrAny(m, seen); err != nil { + return err + } + continue + } + + // This is a normal, non-extension field. + name := protoreflect.Name(tok.value) + fd := fds.ByName(name) + switch { + case fd == nil: + gd := fds.ByName(protoreflect.Name(strings.ToLower(string(name)))) + if gd != nil && gd.Kind() == protoreflect.GroupKind && gd.Message().Name() == name { + fd = gd + } + case fd.Kind() == protoreflect.GroupKind && fd.Message().Name() != name: + fd = nil + case fd.IsWeak() && fd.Message().IsPlaceholder(): + fd = nil + } + if fd == nil { + typeName := string(md.FullName()) + if m, ok := m.Interface().(Message); ok { + t := reflect.TypeOf(m) + if t.Kind() == reflect.Ptr { + typeName = t.Elem().String() + } + } + return p.errorf("unknown field name %q in %v", name, typeName) + } + if od := fd.ContainingOneof(); od != nil && m.WhichOneof(od) != nil { + return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, od.Name()) + } + if fd.Cardinality() != protoreflect.Repeated && seen[fd.Number()] { + return p.errorf("non-repeated field %q was repeated", fd.Name()) + } + seen[fd.Number()] = true + + // Consume any colon. + if err := p.checkForColon(fd); err != nil { + return err + } + + // Parse into the field. + v := m.Get(fd) + if !m.Has(fd) && (fd.IsList() || fd.IsMap() || fd.Message() != nil) { + v = m.Mutable(fd) + } + if v, err = p.unmarshalValue(v, fd); err != nil { + return err + } + m.Set(fd, v) + + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + } + return nil +} + +func (p *textParser) unmarshalExtensionOrAny(m protoreflect.Message, seen map[protoreflect.FieldNumber]bool) error { + name, err := p.consumeExtensionOrAnyName() + if err != nil { + return err + } + + // If it contains a slash, it's an Any type URL. + if slashIdx := strings.LastIndex(name, "/"); slashIdx >= 0 { + tok := p.next() + if tok.err != nil { + return tok.err + } + // consume an optional colon + if tok.value == ":" { + tok = p.next() + if tok.err != nil { + return tok.err + } + } + + var terminator string + switch tok.value { + case "<": + terminator = ">" + case "{": + terminator = "}" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + + mt, err := protoregistry.GlobalTypes.FindMessageByURL(name) + if err != nil { + return p.errorf("unrecognized message %q in google.protobuf.Any", name[slashIdx+len("/"):]) + } + m2 := mt.New() + if err := p.unmarshalMessage(m2, terminator); err != nil { + return err + } + b, err := protoV2.Marshal(m2.Interface()) + if err != nil { + return p.errorf("failed to marshal message of type %q: %v", name[slashIdx+len("/"):], err) + } + + urlFD := m.Descriptor().Fields().ByName("type_url") + valFD := m.Descriptor().Fields().ByName("value") + if seen[urlFD.Number()] { + return p.errorf("Any message unpacked multiple times, or %q already set", urlFD.Name()) + } + if seen[valFD.Number()] { + return p.errorf("Any message unpacked multiple times, or %q already set", valFD.Name()) + } + m.Set(urlFD, protoreflect.ValueOfString(name)) + m.Set(valFD, protoreflect.ValueOfBytes(b)) + seen[urlFD.Number()] = true + seen[valFD.Number()] = true + return nil + } + + xname := protoreflect.FullName(name) + xt, _ := protoregistry.GlobalTypes.FindExtensionByName(xname) + if xt == nil && isMessageSet(m.Descriptor()) { + xt, _ = protoregistry.GlobalTypes.FindExtensionByName(xname.Append("message_set_extension")) + } + if xt == nil { + return p.errorf("unrecognized extension %q", name) + } + fd := xt.TypeDescriptor() + + if err := p.checkForColon(fd); err != nil { + return err + } + + v := m.Get(fd) + if !m.Has(fd) && (fd.IsList() || fd.IsMap() || fd.Message() != nil) { + v = m.Mutable(fd) + } + v, err = p.unmarshalValue(v, fd) + if err != nil { + return err + } + m.Set(fd, v) + return p.consumeOptionalSeparator() +} + +func (p *textParser) unmarshalValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { + tok := p.next() + if tok.err != nil { + return v, tok.err + } + if tok.value == "" { + return v, p.errorf("unexpected EOF") + } + + switch { + case fd.IsList(): + lv := v.List() + var err error + if tok.value == "[" { + // Repeated field with list notation, like [1,2,3]. + for { + vv := lv.NewElement() + vv, err = p.unmarshalSingularValue(vv, fd) + if err != nil { + return v, err + } + lv.Append(vv) + + tok := p.next() + if tok.err != nil { + return v, tok.err + } + if tok.value == "]" { + break + } + if tok.value != "," { + return v, p.errorf("Expected ']' or ',' found %q", tok.value) + } + } + return v, nil + } + + // One value of the repeated field. + p.back() + vv := lv.NewElement() + vv, err = p.unmarshalSingularValue(vv, fd) + if err != nil { + return v, err + } + lv.Append(vv) + return v, nil + case fd.IsMap(): + // The map entry should be this sequence of tokens: + // < key : KEY value : VALUE > + // However, implementations may omit key or value, and technically + // we should support them in any order. + var terminator string + switch tok.value { + case "<": + terminator = ">" + case "{": + terminator = "}" + default: + return v, p.errorf("expected '{' or '<', found %q", tok.value) + } + + keyFD := fd.MapKey() + valFD := fd.MapValue() + + mv := v.Map() + kv := keyFD.Default() + vv := mv.NewValue() + for { + tok := p.next() + if tok.err != nil { + return v, tok.err + } + if tok.value == terminator { + break + } + var err error + switch tok.value { + case "key": + if err := p.consumeToken(":"); err != nil { + return v, err + } + if kv, err = p.unmarshalSingularValue(kv, keyFD); err != nil { + return v, err + } + if err := p.consumeOptionalSeparator(); err != nil { + return v, err + } + case "value": + if err := p.checkForColon(valFD); err != nil { + return v, err + } + if vv, err = p.unmarshalSingularValue(vv, valFD); err != nil { + return v, err + } + if err := p.consumeOptionalSeparator(); err != nil { + return v, err + } + default: + p.back() + return v, p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) + } + } + mv.Set(kv.MapKey(), vv) + return v, nil + default: + p.back() + return p.unmarshalSingularValue(v, fd) + } +} + +func (p *textParser) unmarshalSingularValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { + tok := p.next() + if tok.err != nil { + return v, tok.err + } + if tok.value == "" { + return v, p.errorf("unexpected EOF") + } + + switch fd.Kind() { + case protoreflect.BoolKind: + switch tok.value { + case "true", "1", "t", "True": + return protoreflect.ValueOfBool(true), nil + case "false", "0", "f", "False": + return protoreflect.ValueOfBool(false), nil + } + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { + return protoreflect.ValueOfInt32(int32(x)), nil + } + + // The C++ parser accepts large positive hex numbers that uses + // two's complement arithmetic to represent negative numbers. + // This feature is here for backwards compatibility with C++. + if strings.HasPrefix(tok.value, "0x") { + if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { + return protoreflect.ValueOfInt32(int32(-(int64(^x) + 1))), nil + } + } + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { + return protoreflect.ValueOfInt64(int64(x)), nil + } + + // The C++ parser accepts large positive hex numbers that uses + // two's complement arithmetic to represent negative numbers. + // This feature is here for backwards compatibility with C++. + if strings.HasPrefix(tok.value, "0x") { + if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { + return protoreflect.ValueOfInt64(int64(-(int64(^x) + 1))), nil + } + } + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { + return protoreflect.ValueOfUint32(uint32(x)), nil + } + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { + return protoreflect.ValueOfUint64(uint64(x)), nil + } + case protoreflect.FloatKind: + // Ignore 'f' for compatibility with output generated by C++, + // but don't remove 'f' when the value is "-inf" or "inf". + v := tok.value + if strings.HasSuffix(v, "f") && v != "-inf" && v != "inf" { + v = v[:len(v)-len("f")] + } + if x, err := strconv.ParseFloat(v, 32); err == nil { + return protoreflect.ValueOfFloat32(float32(x)), nil + } + case protoreflect.DoubleKind: + // Ignore 'f' for compatibility with output generated by C++, + // but don't remove 'f' when the value is "-inf" or "inf". + v := tok.value + if strings.HasSuffix(v, "f") && v != "-inf" && v != "inf" { + v = v[:len(v)-len("f")] + } + if x, err := strconv.ParseFloat(v, 64); err == nil { + return protoreflect.ValueOfFloat64(float64(x)), nil + } + case protoreflect.StringKind: + if isQuote(tok.value[0]) { + return protoreflect.ValueOfString(tok.unquoted), nil + } + case protoreflect.BytesKind: + if isQuote(tok.value[0]) { + return protoreflect.ValueOfBytes([]byte(tok.unquoted)), nil + } + case protoreflect.EnumKind: + if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { + return protoreflect.ValueOfEnum(protoreflect.EnumNumber(x)), nil + } + vd := fd.Enum().Values().ByName(protoreflect.Name(tok.value)) + if vd != nil { + return protoreflect.ValueOfEnum(vd.Number()), nil + } + case protoreflect.MessageKind, protoreflect.GroupKind: + var terminator string + switch tok.value { + case "{": + terminator = "}" + case "<": + terminator = ">" + default: + return v, p.errorf("expected '{' or '<', found %q", tok.value) + } + err := p.unmarshalMessage(v.Message(), terminator) + return v, err + default: + panic(fmt.Sprintf("invalid kind %v", fd.Kind())) + } + return v, p.errorf("invalid %v: %v", fd.Kind(), tok.value) +} + +// Consume a ':' from the input stream (if the next token is a colon), +// returning an error if a colon is needed but not present. +func (p *textParser) checkForColon(fd protoreflect.FieldDescriptor) *ParseError { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != ":" { + if fd.Message() == nil { + return p.errorf("expected ':', found %q", tok.value) + } + p.back() + } + return nil +} + +// consumeExtensionOrAnyName consumes an extension name or an Any type URL and +// the following ']'. It returns the name or URL consumed. +func (p *textParser) consumeExtensionOrAnyName() (string, error) { + tok := p.next() + if tok.err != nil { + return "", tok.err + } + + // If extension name or type url is quoted, it's a single token. + if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { + name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) + if err != nil { + return "", err + } + return name, p.consumeToken("]") + } + + // Consume everything up to "]" + var parts []string + for tok.value != "]" { + parts = append(parts, tok.value) + tok = p.next() + if tok.err != nil { + return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) + } + if p.done && tok.value != "]" { + return "", p.errorf("unclosed type_url or extension name") + } + } + return strings.Join(parts, ""), nil +} + +// consumeOptionalSeparator consumes an optional semicolon or comma. +// It is used in unmarshalMessage to provide backward compatibility. +func (p *textParser) consumeOptionalSeparator() error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != ";" && tok.value != "," { + p.back() + } + return nil +} + +func (p *textParser) errorf(format string, a ...interface{}) *ParseError { + pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} + p.cur.err = pe + p.done = true + return pe +} + +func (p *textParser) skipWhitespace() { + i := 0 + for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { + if p.s[i] == '#' { + // comment; skip to end of line or input + for i < len(p.s) && p.s[i] != '\n' { + i++ + } + if i == len(p.s) { + break + } + } + if p.s[i] == '\n' { + p.line++ + } + i++ + } + p.offset += i + p.s = p.s[i:len(p.s)] + if len(p.s) == 0 { + p.done = true + } +} + +func (p *textParser) advance() { + // Skip whitespace + p.skipWhitespace() + if p.done { + return + } + + // Start of non-whitespace + p.cur.err = nil + p.cur.offset, p.cur.line = p.offset, p.line + p.cur.unquoted = "" + switch p.s[0] { + case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': + // Single symbol + p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] + case '"', '\'': + // Quoted string + i := 1 + for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { + if p.s[i] == '\\' && i+1 < len(p.s) { + // skip escaped char + i++ + } + i++ + } + if i >= len(p.s) || p.s[i] != p.s[0] { + p.errorf("unmatched quote") + return + } + unq, err := unquoteC(p.s[1:i], rune(p.s[0])) + if err != nil { + p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) + return + } + p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] + p.cur.unquoted = unq + default: + i := 0 + for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { + i++ + } + if i == 0 { + p.errorf("unexpected byte %#x", p.s[0]) + return + } + p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] + } + p.offset += len(p.cur.value) +} + +// Back off the parser by one token. Can only be done between calls to next(). +// It makes the next advance() a no-op. +func (p *textParser) back() { p.backed = true } + +// Advances the parser and returns the new current token. +func (p *textParser) next() *token { + if p.backed || p.done { + p.backed = false + return &p.cur + } + p.advance() + if p.done { + p.cur.value = "" + } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { + // Look for multiple quoted strings separated by whitespace, + // and concatenate them. + cat := p.cur + for { + p.skipWhitespace() + if p.done || !isQuote(p.s[0]) { + break + } + p.advance() + if p.cur.err != nil { + return &p.cur + } + cat.value += " " + p.cur.value + cat.unquoted += p.cur.unquoted + } + p.done = false // parser may have seen EOF, but we want to return cat + p.cur = cat + } + return &p.cur +} + +func (p *textParser) consumeToken(s string) error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != s { + p.back() + return p.errorf("expected %q, found %q", s, tok.value) + } + return nil +} + +var errBadUTF8 = errors.New("proto: bad UTF-8") + +func unquoteC(s string, quote rune) (string, error) { + // This is based on C++'s tokenizer.cc. + // Despite its name, this is *not* parsing C syntax. + // For instance, "\0" is an invalid quoted string. + + // Avoid allocation in trivial cases. + simple := true + for _, r := range s { + if r == '\\' || r == quote { + simple = false + break + } + } + if simple { + return s, nil + } + + buf := make([]byte, 0, 3*len(s)/2) + for len(s) > 0 { + r, n := utf8.DecodeRuneInString(s) + if r == utf8.RuneError && n == 1 { + return "", errBadUTF8 + } + s = s[n:] + if r != '\\' { + if r < utf8.RuneSelf { + buf = append(buf, byte(r)) + } else { + buf = append(buf, string(r)...) + } + continue + } + + ch, tail, err := unescape(s) + if err != nil { + return "", err + } + buf = append(buf, ch...) + s = tail + } + return string(buf), nil +} + +func unescape(s string) (ch string, tail string, err error) { + r, n := utf8.DecodeRuneInString(s) + if r == utf8.RuneError && n == 1 { + return "", "", errBadUTF8 + } + s = s[n:] + switch r { + case 'a': + return "\a", s, nil + case 'b': + return "\b", s, nil + case 'f': + return "\f", s, nil + case 'n': + return "\n", s, nil + case 'r': + return "\r", s, nil + case 't': + return "\t", s, nil + case 'v': + return "\v", s, nil + case '?': + return "?", s, nil // trigraph workaround + case '\'', '"', '\\': + return string(r), s, nil + case '0', '1', '2', '3', '4', '5', '6', '7': + if len(s) < 2 { + return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) + } + ss := string(r) + s[:2] + s = s[2:] + i, err := strconv.ParseUint(ss, 8, 8) + if err != nil { + return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) + } + return string([]byte{byte(i)}), s, nil + case 'x', 'X', 'u', 'U': + var n int + switch r { + case 'x', 'X': + n = 2 + case 'u': + n = 4 + case 'U': + n = 8 + } + if len(s) < n { + return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) + } + ss := s[:n] + s = s[n:] + i, err := strconv.ParseUint(ss, 16, 64) + if err != nil { + return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) + } + if r == 'x' || r == 'X' { + return string([]byte{byte(i)}), s, nil + } + if i > utf8.MaxRune { + return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) + } + return string(i), s, nil + } + return "", "", fmt.Errorf(`unknown escape \%c`, r) +} + +func isIdentOrNumberChar(c byte) bool { + switch { + case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': + return true + case '0' <= c && c <= '9': + return true + } + switch c { + case '-', '+', '.', '_': + return true + } + return false +} + +func isWhitespace(c byte) bool { + switch c { + case ' ', '\t', '\n', '\r': + return true + } + return false +} + +func isQuote(c byte) bool { + switch c { + case '"', '\'': + return true + } + return false +} diff --git a/proto/text_encode.go b/proto/text_encode.go new file mode 100644 index 0000000000..31f906d138 --- /dev/null +++ b/proto/text_encode.go @@ -0,0 +1,561 @@ +// 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 + +import ( + "bytes" + "encoding" + "fmt" + "io" + "math" + "sort" + "strings" + + "github.com/golang/protobuf/internal/wire" + "google.golang.org/protobuf/encoding/prototext" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/runtime/protoimpl" +) + +const wrapTextMarshalV2 = false + +// TextMarshaler is a configurable text format marshaler. +type TextMarshaler struct { + Compact bool // use compact text format (one line) + ExpandAny bool // expand google.protobuf.Any messages of known types +} + +// Marshal writes the proto text format of m to w. +func (tm *TextMarshaler) Marshal(w io.Writer, m Message) error { + b, err := tm.marshal(m) + if len(b) > 0 { + if _, err := w.Write(b); err != nil { + return err + } + } + return err +} + +// Text returns a proto text formatted string of m. +func (tm *TextMarshaler) Text(m Message) string { + b, _ := tm.marshal(m) + return string(b) +} + +func (tm *TextMarshaler) marshal(m Message) ([]byte, error) { + mr := protoimpl.X.MessageOf(m) + if mr == nil || !mr.IsValid() { + return []byte(""), nil + } + + if wrapTextMarshalV2 { + if m, ok := m.(encoding.TextMarshaler); ok { + return m.MarshalText() + } + + opts := prototext.MarshalOptions{ + AllowPartial: true, + EmitUnknown: true, + } + if !tm.Compact { + opts.Indent = " " + } + if !tm.ExpandAny { + opts.Resolver = (*protoregistry.Types)(nil) + } + return opts.Marshal(mr.Interface()) + } else { + w := &textWriter{ + compact: tm.Compact, + expandAny: tm.ExpandAny, + complete: true, + } + + if m, ok := m.(encoding.TextMarshaler); ok { + b, err := m.MarshalText() + if err != nil { + return nil, err + } + w.Write(b) + return w.buf, nil + } + + err := w.writeMessage(mr) + return w.buf, err + } +} + +var ( + defaultTextMarshaler = TextMarshaler{} + compactTextMarshaler = TextMarshaler{Compact: true} +) + +// MarshalText writes the proto text format of m to w. +func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } + +// MarshalTextString returns a proto text formatted string of m. +func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } + +// CompactText writes the compact proto text format of m to w. +func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } + +// CompactTextString returns a compact proto text formatted string of m. +func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } + +var ( + newline = []byte("\n") + endBraceNewline = []byte("}\n") + posInf = []byte("inf") + negInf = []byte("-inf") + nan = []byte("nan") +) + +// textWriter is an io.Writer that tracks its indentation level. +type textWriter struct { + compact bool // same as TextMarshaler.Compact + expandAny bool // same as TextMarshaler.ExpandAny + complete bool // whether the current position is a complete line + indent int // indentation level; never negative + buf []byte +} + +func (w *textWriter) Write(p []byte) (n int, _ error) { + newlines := bytes.Count(p, newline) + if newlines == 0 { + if !w.compact && w.complete { + w.writeIndent() + } + w.buf = append(w.buf, p...) + w.complete = false + return len(p), nil + } + + frags := bytes.SplitN(p, newline, newlines+1) + if w.compact { + for i, frag := range frags { + if i > 0 { + w.buf = append(w.buf, ' ') + n++ + } + w.buf = append(w.buf, frag...) + n += len(frag) + } + return n, nil + } + + for i, frag := range frags { + if w.complete { + w.writeIndent() + } + w.buf = append(w.buf, frag...) + n += len(frag) + if i+1 < len(frags) { + w.buf = append(w.buf, '\n') + n++ + } + } + w.complete = len(frags[len(frags)-1]) == 0 + return n, nil +} + +func (w *textWriter) WriteByte(c byte) error { + if w.compact && c == '\n' { + c = ' ' + } + if !w.compact && w.complete { + w.writeIndent() + } + w.buf = append(w.buf, c) + w.complete = c == '\n' + return nil +} + +func (w *textWriter) writeName(fd protoreflect.FieldDescriptor) { + if !w.compact && w.complete { + w.writeIndent() + } + w.complete = false + + if fd.Kind() != protoreflect.GroupKind { + w.buf = append(w.buf, fd.Name()...) + w.WriteByte(':') + } else { + // Use message type name for group field name. + w.buf = append(w.buf, fd.Message().Name()...) + } + + if !w.compact { + w.WriteByte(' ') + } +} + +func requiresQuotes(u string) bool { + // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. + for _, ch := range u { + switch { + case ch == '.' || ch == '/' || ch == '_': + continue + case '0' <= ch && ch <= '9': + continue + case 'A' <= ch && ch <= 'Z': + continue + case 'a' <= ch && ch <= 'z': + continue + default: + return true + } + } + return false +} + +// writeProto3Any writes an expanded google.protobuf.Any message. +// +// It returns (false, nil) if sv value can't be unmarshaled (e.g. because +// required messages are not linked in). +// +// It returns (true, error) when sv was written in expanded format or an error +// was encountered. +func (w *textWriter) writeProto3Any(m protoreflect.Message) (bool, error) { + md := m.Descriptor() + fdURL := md.Fields().ByName("type_url") + fdVal := md.Fields().ByName("value") + + url := m.Get(fdURL).String() + mt, err := protoregistry.GlobalTypes.FindMessageByURL(url) + if err != nil { + return false, nil + } + + b := m.Get(fdVal).Bytes() + m2 := mt.New() + if err := proto.Unmarshal(b, m2.Interface()); err != nil { + return false, nil + } + w.Write([]byte("[")) + if requiresQuotes(url) { + w.writeQuotedString(url) + } else { + w.Write([]byte(url)) + } + if w.compact { + w.Write([]byte("]:<")) + } else { + w.Write([]byte("]: <\n")) + w.indent++ + } + if err := w.writeMessage(m2); err != nil { + return true, err + } + if w.compact { + w.Write([]byte("> ")) + } else { + w.indent-- + w.Write([]byte(">\n")) + } + return true, nil +} + +func (w *textWriter) writeMessage(m protoreflect.Message) error { + md := m.Descriptor() + if w.expandAny && md.FullName() == "google.protobuf.Any" { + if canExpand, err := w.writeProto3Any(m); canExpand { + return err + } + } + + fds := md.Fields() + for i := 0; i < fds.Len(); { + fd := fds.Get(i) + if od := fd.ContainingOneof(); od != nil { + fd = m.WhichOneof(od) + i += od.Fields().Len() + } else { + i++ + } + if fd == nil || !m.Has(fd) { + continue + } + + switch { + case fd.IsList(): + lv := m.Get(fd).List() + for j := 0; j < lv.Len(); j++ { + w.writeName(fd) + v := lv.Get(j) + if err := w.writeSingularValue(v, fd); err != nil { + return err + } + w.WriteByte('\n') + } + case fd.IsMap(): + kfd := fd.MapKey() + vfd := fd.MapValue() + mv := m.Get(fd).Map() + + type entry struct{ key, val protoreflect.Value } + var entries []entry + mv.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool { + entries = append(entries, entry{k.Value(), v}) + return true + }) + sort.Slice(entries, func(i, j int) bool { + switch kfd.Kind() { + case protoreflect.BoolKind: + return !entries[i].key.Bool() && entries[j].key.Bool() + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + return entries[i].key.Int() < entries[j].key.Int() + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + return entries[i].key.Uint() < entries[j].key.Uint() + case protoreflect.StringKind: + return entries[i].key.String() < entries[j].key.String() + default: + panic("invalid kind") + } + }) + for _, entry := range entries { + w.writeName(fd) + w.WriteByte('<') + if !w.compact { + w.WriteByte('\n') + } + w.indent++ + w.writeName(kfd) + if err := w.writeSingularValue(entry.key, kfd); err != nil { + return err + } + w.WriteByte('\n') + w.writeName(vfd) + if err := w.writeSingularValue(entry.val, vfd); err != nil { + return err + } + w.WriteByte('\n') + w.indent-- + w.WriteByte('>') + w.WriteByte('\n') + } + default: + w.writeName(fd) + if err := w.writeSingularValue(m.Get(fd), fd); err != nil { + return err + } + w.WriteByte('\n') + } + } + + if b := m.GetUnknown(); len(b) > 0 { + w.writeUnknownFields(b) + } + return w.writeExtensions(m) +} + +func (w *textWriter) writeSingularValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) error { + switch fd.Kind() { + case protoreflect.FloatKind, protoreflect.DoubleKind: + switch vf := v.Float(); { + case math.IsInf(vf, +1): + w.Write(posInf) + case math.IsInf(vf, -1): + w.Write(negInf) + case math.IsNaN(vf): + w.Write(nan) + default: + fmt.Fprint(w, v.Interface()) + } + case protoreflect.StringKind: + // NOTE: This does not validate UTF-8 for historical reasons. + w.writeQuotedString(string(v.String())) + case protoreflect.BytesKind: + w.writeQuotedString(string(v.Bytes())) + case protoreflect.MessageKind, protoreflect.GroupKind: + var bra, ket byte = '<', '>' + if fd.Kind() == protoreflect.GroupKind { + bra, ket = '{', '}' + } + w.WriteByte(bra) + if !w.compact { + w.WriteByte('\n') + } + w.indent++ + m := v.Message() + if m2, ok := m.Interface().(encoding.TextMarshaler); ok { + b, err := m2.MarshalText() + if err != nil { + return err + } + w.Write(b) + } else { + w.writeMessage(m) + } + w.indent-- + w.WriteByte(ket) + case protoreflect.EnumKind: + if ev := fd.Enum().Values().ByNumber(v.Enum()); ev != nil { + fmt.Fprint(w, ev.Name()) + } else { + fmt.Fprint(w, v.Enum()) + } + default: + fmt.Fprint(w, v.Interface()) + } + return nil +} + +// writeQuotedString writes a quoted string in the protocol buffer text format. +func (w *textWriter) writeQuotedString(s string) { + w.WriteByte('"') + for i := 0; i < len(s); i++ { + switch c := s[i]; c { + case '\n': + w.buf = append(w.buf, `\n`...) + case '\r': + w.buf = append(w.buf, `\r`...) + case '\t': + w.buf = append(w.buf, `\t`...) + case '"': + w.buf = append(w.buf, `\"`...) + case '\\': + w.buf = append(w.buf, `\\`...) + default: + if isPrint := c >= 0x20 && c < 0x7f; isPrint { + w.buf = append(w.buf, c) + } else { + w.buf = append(w.buf, fmt.Sprintf(`\%03o`, c)...) + } + } + } + w.WriteByte('"') +} + +func (w *textWriter) writeUnknownFields(b []byte) { + if !w.compact { + fmt.Fprintf(w, "/* %d unknown bytes */\n", len(b)) + } + + for len(b) > 0 { + num, wtyp, n := wire.ConsumeTag(b) + if n < 0 { + return + } + b = b[n:] + + if wtyp == wire.EndGroupType { + w.indent-- + w.Write(endBraceNewline) + continue + } + fmt.Fprint(w, num) + if wtyp != wire.StartGroupType { + w.WriteByte(':') + } + if !w.compact || wtyp == wire.StartGroupType { + w.WriteByte(' ') + } + switch wtyp { + case wire.VarintType: + v, n := wire.ConsumeVarint(b) + if n < 0 { + return + } + b = b[n:] + fmt.Fprint(w, v) + case wire.Fixed32Type: + v, n := wire.ConsumeFixed32(b) + if n < 0 { + return + } + b = b[n:] + fmt.Fprint(w, v) + case wire.Fixed64Type: + v, n := wire.ConsumeFixed64(b) + if n < 0 { + return + } + b = b[n:] + fmt.Fprint(w, v) + case wire.BytesType: + v, n := wire.ConsumeBytes(b) + if n < 0 { + return + } + b = b[n:] + fmt.Fprintf(w, "%q", v) + case wire.StartGroupType: + w.WriteByte('{') + w.indent++ + default: + fmt.Fprintf(w, "/* unknown wire type %d */", wtyp) + } + w.WriteByte('\n') + } +} + +// writeExtensions writes all the extensions in m. +func (w *textWriter) writeExtensions(m protoreflect.Message) error { + md := m.Descriptor() + if md.ExtensionRanges().Len() == 0 { + return nil + } + + type ext struct { + desc protoreflect.FieldDescriptor + val protoreflect.Value + } + var exts []ext + m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { + if fd.IsExtension() { + exts = append(exts, ext{fd, v}) + } + return true + }) + sort.Slice(exts, func(i, j int) bool { + return exts[i].desc.Number() < exts[j].desc.Number() + }) + + for _, ext := range exts { + // For message set, use the name of the message as the extension name. + name := string(ext.desc.FullName()) + if isMessageSet(ext.desc.ContainingMessage()) { + name = strings.TrimSuffix(name, ".message_set_extension") + } + + if !ext.desc.IsList() { + if err := w.writeSingularExtension(name, ext.val, ext.desc); err != nil { + return err + } + } else { + lv := ext.val.List() + for i := 0; i < lv.Len(); i++ { + if err := w.writeSingularExtension(name, lv.Get(i), ext.desc); err != nil { + return err + } + } + } + } + return nil +} + +func (w *textWriter) writeSingularExtension(name string, v protoreflect.Value, fd protoreflect.FieldDescriptor) error { + fmt.Fprintf(w, "[%s]:", name) + if !w.compact { + w.WriteByte(' ') + } + if err := w.writeSingularValue(v, fd); err != nil { + return err + } + w.WriteByte('\n') + return nil +} + +func (w *textWriter) writeIndent() { + if !w.complete { + return + } + for i := 0; i < w.indent*2; i++ { + w.buf = append(w.buf, ' ') + } + w.complete = false +} diff --git a/proto/text_parser.go b/proto/text_parser.go deleted file mode 100644 index 8fb9463a4b..0000000000 --- a/proto/text_parser.go +++ /dev/null @@ -1,894 +0,0 @@ -// 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 - -// Functions for parsing the Text protocol buffer format. -// TODO: message sets. - -import ( - "encoding" - "errors" - "fmt" - "reflect" - "strconv" - "strings" - "sync" - "unicode/utf8" -) - -// Error string emitted when deserializing Any and fields are already set -const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set" - -type ParseError struct { - Message string - Line int // 1-based line number - Offset int // 0-based byte offset from start of input -} - -func (p *ParseError) Error() string { - if p.Line == 1 { - // show offset only for first line - return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message) - } - return fmt.Sprintf("line %d: %v", p.Line, p.Message) -} - -type token struct { - value string - err *ParseError - line int // line number - offset int // byte number from start of input, not start of line - unquoted string // the unquoted version of value, if it was a quoted string -} - -func (t *token) String() string { - if t.err == nil { - return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset) - } - return fmt.Sprintf("parse error: %v", t.err) -} - -type textParser struct { - s string // remaining input - done bool // whether the parsing is finished (success or error) - backed bool // whether back() was called - offset, line int - cur token -} - -func newTextParser(s string) *textParser { - p := new(textParser) - p.s = s - p.line = 1 - p.cur.line = 1 - return p -} - -func (p *textParser) errorf(format string, a ...interface{}) *ParseError { - pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} - p.cur.err = pe - p.done = true - return pe -} - -// Numbers and identifiers are matched by [-+._A-Za-z0-9] -func isIdentOrNumberChar(c byte) bool { - switch { - case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': - return true - case '0' <= c && c <= '9': - return true - } - switch c { - case '-', '+', '.', '_': - return true - } - return false -} - -func isWhitespace(c byte) bool { - switch c { - case ' ', '\t', '\n', '\r': - return true - } - return false -} - -func isQuote(c byte) bool { - switch c { - case '"', '\'': - return true - } - return false -} - -func (p *textParser) skipWhitespace() { - i := 0 - for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { - if p.s[i] == '#' { - // comment; skip to end of line or input - for i < len(p.s) && p.s[i] != '\n' { - i++ - } - if i == len(p.s) { - break - } - } - if p.s[i] == '\n' { - p.line++ - } - i++ - } - p.offset += i - p.s = p.s[i:len(p.s)] - if len(p.s) == 0 { - p.done = true - } -} - -func (p *textParser) advance() { - // Skip whitespace - p.skipWhitespace() - if p.done { - return - } - - // Start of non-whitespace - p.cur.err = nil - p.cur.offset, p.cur.line = p.offset, p.line - p.cur.unquoted = "" - switch p.s[0] { - case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': - // Single symbol - p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] - case '"', '\'': - // Quoted string - i := 1 - for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { - if p.s[i] == '\\' && i+1 < len(p.s) { - // skip escaped char - i++ - } - i++ - } - if i >= len(p.s) || p.s[i] != p.s[0] { - p.errorf("unmatched quote") - return - } - unq, err := unquoteC(p.s[1:i], rune(p.s[0])) - if err != nil { - p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) - return - } - p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] - p.cur.unquoted = unq - default: - i := 0 - for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { - i++ - } - if i == 0 { - p.errorf("unexpected byte %#x", p.s[0]) - return - } - p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] - } - p.offset += len(p.cur.value) -} - -var ( - errBadUTF8 = errors.New("proto: bad UTF-8") -) - -func unquoteC(s string, quote rune) (string, error) { - // This is based on C++'s tokenizer.cc. - // Despite its name, this is *not* parsing C syntax. - // For instance, "\0" is an invalid quoted string. - - // Avoid allocation in trivial cases. - simple := true - for _, r := range s { - if r == '\\' || r == quote { - simple = false - break - } - } - if simple { - return s, nil - } - - buf := make([]byte, 0, 3*len(s)/2) - for len(s) > 0 { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", errBadUTF8 - } - s = s[n:] - if r != '\\' { - if r < utf8.RuneSelf { - buf = append(buf, byte(r)) - } else { - buf = append(buf, string(r)...) - } - continue - } - - ch, tail, err := unescape(s) - if err != nil { - return "", err - } - buf = append(buf, ch...) - s = tail - } - return string(buf), nil -} - -func unescape(s string) (ch string, tail string, err error) { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", "", errBadUTF8 - } - s = s[n:] - switch r { - case 'a': - return "\a", s, nil - case 'b': - return "\b", s, nil - case 'f': - return "\f", s, nil - case 'n': - return "\n", s, nil - case 'r': - return "\r", s, nil - case 't': - return "\t", s, nil - case 'v': - return "\v", s, nil - case '?': - return "?", s, nil // trigraph workaround - case '\'', '"', '\\': - return string(r), s, nil - case '0', '1', '2', '3', '4', '5', '6', '7': - if len(s) < 2 { - return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) - } - ss := string(r) + s[:2] - s = s[2:] - i, err := strconv.ParseUint(ss, 8, 8) - if err != nil { - return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) - } - return string([]byte{byte(i)}), s, nil - case 'x', 'X', 'u', 'U': - var n int - switch r { - case 'x', 'X': - n = 2 - case 'u': - n = 4 - case 'U': - n = 8 - } - if len(s) < n { - return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) - } - ss := s[:n] - s = s[n:] - i, err := strconv.ParseUint(ss, 16, 64) - if err != nil { - return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) - } - if r == 'x' || r == 'X' { - return string([]byte{byte(i)}), s, nil - } - if i > utf8.MaxRune { - return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) - } - return string(i), s, nil - } - return "", "", fmt.Errorf(`unknown escape \%c`, r) -} - -// Back off the parser by one token. Can only be done between calls to next(). -// It makes the next advance() a no-op. -func (p *textParser) back() { p.backed = true } - -// Advances the parser and returns the new current token. -func (p *textParser) next() *token { - if p.backed || p.done { - p.backed = false - return &p.cur - } - p.advance() - if p.done { - p.cur.value = "" - } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { - // Look for multiple quoted strings separated by whitespace, - // and concatenate them. - cat := p.cur - for { - p.skipWhitespace() - if p.done || !isQuote(p.s[0]) { - break - } - p.advance() - if p.cur.err != nil { - return &p.cur - } - cat.value += " " + p.cur.value - cat.unquoted += p.cur.unquoted - } - p.done = false // parser may have seen EOF, but we want to return cat - p.cur = cat - } - return &p.cur -} - -func (p *textParser) consumeToken(s string) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != s { - p.back() - return p.errorf("expected %q, found %q", s, tok.value) - } - return nil -} - -// Return a requiredNotSetError indicating which required field was not set. -func (p *textParser) missingRequiredFieldError(sv reflect.Value) *requiredNotSetError { - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < st.NumField(); i++ { - if !isNil(sv.Field(i)) { - continue - } - - props := sprops.Prop[i] - if props.Required { - return &requiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} - } - } - return &requiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen -} - -// Returns the index in the struct for the named field, as well as the parsed tag properties. -func structFieldByName(sprops *textStructProperties, name string) (int, *Properties, bool) { - i, ok := sprops.decoderOrigNames[name] - if ok { - return i, sprops.Prop[i], true - } - return -1, nil, false -} - -// Consume a ':' from the input stream (if the next token is a colon), -// returning an error if a colon is needed but not present. -func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ":" { - // Colon is optional when the field is a group or message. - needColon := true - switch props.Wire { - case "group": - needColon = false - case "bytes": - // A "bytes" field is either a message, a string, or a repeated field; - // those three become *T, *string and []T respectively, so we can check for - // this field being a pointer to a non-string. - if typ.Kind() == reflect.Ptr { - // *T or *string - if typ.Elem().Kind() == reflect.String { - break - } - } else if typ.Kind() == reflect.Slice { - // []T or []*T - if typ.Elem().Kind() != reflect.Ptr { - break - } - } else if typ.Kind() == reflect.String { - // The proto3 exception is for a string field, - // which requires a colon. - break - } - needColon = false - } - if needColon { - return p.errorf("expected ':', found %q", tok.value) - } - p.back() - } - return nil -} - -var textPropertiesCache sync.Map // map[reflect.Type]*textStructProperties - -type textStructProperties struct { - *StructProperties - reqCount int - decoderOrigNames map[string]int -} - -func getTextProperties(t reflect.Type) *textStructProperties { - if p, ok := textPropertiesCache.Load(t); ok { - return p.(*textStructProperties) - } - - prop := &textStructProperties{StructProperties: GetProperties(t)} - reqCount := 0 - prop.decoderOrigNames = make(map[string]int) - for i, p := range prop.Prop { - if strings.HasPrefix(p.Name, "XXX_") { - // Internal fields should not appear in tags/origNames maps. - // They are handled specially when encoding and decoding. - continue - } - if p.Required { - reqCount++ - } - prop.decoderOrigNames[p.OrigName] = i - } - prop.reqCount = reqCount - - textPropertiesCache.Store(t, prop) - return prop -} - -func (p *textParser) readStruct(sv reflect.Value, terminator string) error { - st := sv.Type() - sprops := getTextProperties(st) - reqCount := sprops.reqCount - var reqFieldErr error - fieldSet := make(map[string]bool) - // A struct is a sequence of "name: value", terminated by one of - // '>' or '}', or the end of the input. A name may also be - // "[extension]" or "[type/url]". - // - // The whole struct can also be an expanded Any message, like: - // [type/url] < ... struct contents ... > - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - if tok.value == "[" { - // Looks like an extension or an Any. - // - // TODO: Check whether we need to handle - // namespace rooted names (e.g. ".something.Foo"). - extName, err := p.consumeExtName() - if err != nil { - return err - } - - if s := strings.LastIndex(extName, "/"); s >= 0 { - // If it contains a slash, it's an Any type URL. - messageName := extName[s+1:] - mt := MessageType(messageName) - if mt == nil { - return p.errorf("unrecognized message %q in google.protobuf.Any", messageName) - } - tok = p.next() - if tok.err != nil { - return tok.err - } - // consume an optional colon - if tok.value == ":" { - tok = p.next() - if tok.err != nil { - return tok.err - } - } - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - v := reflect.New(mt.Elem()) - if pe := p.readStruct(v.Elem(), terminator); pe != nil { - return pe - } - b, err := Marshal(v.Interface().(Message)) - if err != nil { - return p.errorf("failed to marshal message of type %q: %v", messageName, err) - } - if fieldSet["type_url"] { - return p.errorf(anyRepeatedlyUnpacked, "type_url") - } - if fieldSet["value"] { - return p.errorf(anyRepeatedlyUnpacked, "value") - } - sv.FieldByName("TypeUrl").SetString(extName) - sv.FieldByName("Value").SetBytes(b) - fieldSet["type_url"] = true - fieldSet["value"] = true - continue - } - - var desc *ExtensionDesc - // This could be faster, but it's functional. - // TODO: Do something smarter than a linear scan. - for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) { - if d.Name == extName { - desc = d - break - } - if strings.TrimSuffix(d.Name, ".message_set_extension") == extName && isMessageSet(st) { - desc = d - break - } - } - if desc == nil { - return p.errorf("unrecognized extension %q", extName) - } - - props := &Properties{} - props.Parse(desc.Tag) - - typ := reflect.TypeOf(desc.ExtensionType) - if err := p.checkForColon(props, typ); err != nil { - return err - } - - rep := isRepeatedExtension(desc) - - // Read the extension structure, and set it in - // the value we're constructing. - var ext reflect.Value - if !rep { - ext = reflect.New(typ).Elem() - } else { - ext = reflect.New(typ.Elem()).Elem() - } - if err := p.readAny(ext, props); err != nil { - if _, ok := err.(*requiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - ep := sv.Addr().Interface().(Message) - if !rep { - SetExtension(ep, desc, ext.Interface()) - } else { - old, err := GetExtension(ep, desc) - var sl reflect.Value - if err == nil { - sl = reflect.ValueOf(old) // existing slice - } else { - sl = reflect.MakeSlice(typ, 0, 1) - } - sl = reflect.Append(sl, ext) - SetExtension(ep, desc, sl.Interface()) - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - continue - } - - // This is a normal, non-extension field. - name := tok.value - var dst reflect.Value - fi, props, ok := structFieldByName(sprops, name) - if ok { - dst = sv.Field(fi) - } else if oop, ok := sprops.OneofTypes[name]; ok { - // It is a oneof. - props = oop.Prop - nv := reflect.New(oop.Type.Elem()) - dst = nv.Elem().Field(0) - field := sv.Field(oop.Field) - if !field.IsNil() { - return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name) - } - field.Set(nv) - } - if !dst.IsValid() { - return p.errorf("unknown field name %q in %v", name, st) - } - - if dst.Kind() == reflect.Map { - // Consume any colon. - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Construct the map if it doesn't already exist. - if dst.IsNil() { - dst.Set(reflect.MakeMap(dst.Type())) - } - key := reflect.New(dst.Type().Key()).Elem() - val := reflect.New(dst.Type().Elem()).Elem() - - // The map entry should be this sequence of tokens: - // < key : KEY value : VALUE > - // However, implementations may omit key or value, and technically - // we should support them in any order. See b/28924776 for a time - // this went wrong. - - tok := p.next() - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - switch tok.value { - case "key": - if err := p.consumeToken(":"); err != nil { - return err - } - if err := p.readAny(key, props.MapKeyProp); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - case "value": - if err := p.checkForColon(props.MapValProp, dst.Type().Elem()); err != nil { - return err - } - if err := p.readAny(val, props.MapValProp); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - default: - p.back() - return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) - } - } - - dst.SetMapIndex(key, val) - continue - } - - // Check that it's not already set if it's not a repeated field. - if !props.Repeated && fieldSet[name] { - return p.errorf("non-repeated field %q was repeated", name) - } - - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Parse into the field. - fieldSet[name] = true - if err := p.readAny(dst, props); err != nil { - if _, ok := err.(*requiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - if props.Required { - reqCount-- - } - - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - - } - - if reqCount > 0 { - return p.missingRequiredFieldError(sv) - } - return reqFieldErr -} - -// consumeExtName consumes extension name or expanded Any type URL and the -// following ']'. It returns the name or URL consumed. -func (p *textParser) consumeExtName() (string, error) { - tok := p.next() - if tok.err != nil { - return "", tok.err - } - - // If extension name or type url is quoted, it's a single token. - if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { - name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) - if err != nil { - return "", err - } - return name, p.consumeToken("]") - } - - // Consume everything up to "]" - var parts []string - for tok.value != "]" { - parts = append(parts, tok.value) - tok = p.next() - if tok.err != nil { - return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) - } - if p.done && tok.value != "]" { - return "", p.errorf("unclosed type_url or extension name") - } - } - return strings.Join(parts, ""), nil -} - -// consumeOptionalSeparator consumes an optional semicolon or comma. -// It is used in readStruct to provide backward compatibility. -func (p *textParser) consumeOptionalSeparator() error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ";" && tok.value != "," { - p.back() - } - return nil -} - -func (p *textParser) readAny(v reflect.Value, props *Properties) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == "" { - return p.errorf("unexpected EOF") - } - - switch fv := v; fv.Kind() { - case reflect.Slice: - at := v.Type() - if at.Elem().Kind() == reflect.Uint8 { - // Special case for []byte - if tok.value[0] != '"' && tok.value[0] != '\'' { - // Deliberately written out here, as the error after - // this switch statement would write "invalid []byte: ...", - // which is not as user-friendly. - return p.errorf("invalid string: %v", tok.value) - } - bytes := []byte(tok.unquoted) - fv.Set(reflect.ValueOf(bytes)) - return nil - } - // Repeated field. - if tok.value == "[" { - // Repeated field with list notation, like [1,2,3]. - for { - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - err := p.readAny(fv.Index(fv.Len()-1), props) - if err != nil { - return err - } - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == "]" { - break - } - if tok.value != "," { - return p.errorf("Expected ']' or ',' found %q", tok.value) - } - } - return nil - } - // One value of the repeated field. - p.back() - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - return p.readAny(fv.Index(fv.Len()-1), props) - case reflect.Bool: - // true/1/t/True or false/f/0/False. - switch tok.value { - case "true", "1", "t", "True": - fv.SetBool(true) - return nil - case "false", "0", "f", "False": - fv.SetBool(false) - return nil - } - case reflect.Float32, reflect.Float64: - v := tok.value - // Ignore 'f' for compatibility with output generated by C++, but don't - // remove 'f' when the value is "-inf" or "inf". - if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" { - v = v[:len(v)-1] - } - if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil { - fv.SetFloat(f) - return nil - } - case reflect.Int32: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - fv.SetInt(x) - return nil - } - - if len(props.Enum) == 0 { - break - } - m := EnumValueMap(props.Enum) - if m == nil { - break - } - x, ok := m[tok.value] - if !ok { - break - } - fv.SetInt(int64(x)) - return nil - case reflect.Int64: - if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { - fv.SetInt(x) - return nil - } - - case reflect.Ptr: - // A basic field (indirected through pointer), or a repeated message/group - p.back() - fv.Set(reflect.New(fv.Type().Elem())) - return p.readAny(fv.Elem(), props) - case reflect.String: - if tok.value[0] == '"' || tok.value[0] == '\'' { - fv.SetString(tok.unquoted) - return nil - } - case reflect.Struct: - var terminator string - switch tok.value { - case "{": - terminator = "}" - case "<": - terminator = ">" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - // TODO: Handle nested messages which implement encoding.TextUnmarshaler. - return p.readStruct(fv, terminator) - case reflect.Uint32: - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - fv.SetUint(uint64(x)) - return nil - } - case reflect.Uint64: - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - fv.SetUint(x) - return nil - } - } - return p.errorf("invalid %v: %v", v.Type(), tok.value) -} - -// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb -// before starting to unmarshal, so any existing data in pb is always removed. -// If a required field is not set and no other error occurs, -// UnmarshalText returns *requiredNotSetError. -func UnmarshalText(s string, pb Message) error { - if unmarshalTextAlt != nil { - return unmarshalTextAlt(s, pb) // populated by hooks_enabled.go - } - if um, ok := pb.(encoding.TextUnmarshaler); ok { - return um.UnmarshalText([]byte(s)) - } - pb.Reset() - v := reflect.ValueOf(pb) - return newTextParser(s).readStruct(v.Elem(), "") -} diff --git a/proto/wire.go b/proto/wire.go new file mode 100644 index 0000000000..53196ab276 --- /dev/null +++ b/proto/wire.go @@ -0,0 +1,72 @@ +// 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 ( + protoV2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/runtime/protoimpl" +) + +// Size returns the size in bytes of the wire-format encoding of m. +func Size(m Message) int { + if m == nil { + return 0 + } + mi := protoimpl.X.ProtoMessageV2Of(m) + return protoV2.Size(mi) +} + +// Marshal returns the wire-format encoding of m. +func Marshal(m Message) ([]byte, error) { + b, err := marshalAppend(nil, m, false) + if b == nil { + b = zeroBytes + } + return b, err +} + +var zeroBytes = make([]byte, 0, 0) + +func marshalAppend(buf []byte, m Message, deterministic bool) ([]byte, error) { + if m == nil { + return nil, ErrNil + } + mi := protoimpl.X.ProtoMessageV2Of(m) + nbuf, err := protoV2.MarshalOptions{ + Deterministic: deterministic, + AllowPartial: true, + }.MarshalAppend(buf, mi) + if err != nil { + return buf, err + } + if len(buf) == len(nbuf) { + if !mi.ProtoReflect().IsValid() { + return buf, ErrNil + } + } + return nbuf, checkRequiredNotSet(mi) +} + +// Unmarshal parses a wire-format message in b and places the decoded results in m. +// +// Unmarshal resets m before starting to unmarshal, so any existing data in m is always +// removed. Use UnmarshalMerge to preserve and append to existing data. +func Unmarshal(b []byte, m Message) error { + m.Reset() + return UnmarshalMerge(b, m) +} + +// UnmarshalMerge parses a wire-format message in b and places the decoded results in m. +func UnmarshalMerge(b []byte, m Message) error { + mi := protoimpl.X.ProtoMessageV2Of(m) + err := protoV2.UnmarshalOptions{ + AllowPartial: true, + Merge: true, + }.Unmarshal(b, mi) + if err != nil { + return err + } + return checkRequiredNotSet(mi) +} diff --git a/proto/decode_test.go b/proto/wire_decode_test.go similarity index 93% rename from proto/decode_test.go rename to proto/wire_decode_test.go index 50a49d1b58..24aff75766 100644 --- a/proto/decode_test.go +++ b/proto/wire_decode_test.go @@ -9,17 +9,18 @@ import ( "testing" "github.com/golang/protobuf/proto" - tpb "github.com/golang/protobuf/proto/proto3_proto" + + pb3 "github.com/golang/protobuf/internal/testprotos/proto3_proto" ) -var msgBlackhole = new(tpb.Message) +var msgBlackhole = new(pb3.Message) // BenchmarkVarint32ArraySmall shows the performance on an array of small int32 fields (1 and // 2 bytes long). func BenchmarkVarint32ArraySmall(b *testing.B) { for i := uint(1); i <= 10; i++ { dist := genInt32Dist([7]int{0, 3, 1}, 1< (%q, %q, %t), want (%q, %q, %t)", tc.in, - impPath, pkg, ok, tc.impPath, tc.pkg, tc.ok) - } - } -} - -func TestPackageNames(t *testing.T) { - g := New() - g.packageNames = make(map[GoImportPath]GoPackageName) - g.usedPackageNames = make(map[GoPackageName]bool) - for _, test := range []struct { - importPath GoImportPath - want GoPackageName - }{ - {"github.com/golang/foo", "foo"}, - {"github.com/golang/second/package/named/foo", "foo1"}, - {"github.com/golang/third/package/named/foo", "foo2"}, - {"github.com/golang/conflicts/with/predeclared/ident/string", "string1"}, - } { - if got := g.GoPackageName(test.importPath); got != test.want { - t.Errorf("GoPackageName(%v) = %v, want %v", test.importPath, got, test.want) - } - } -} - -func TestUnescape(t *testing.T) { - tests := []struct { - in string - out string - }{ - // successful cases, including all kinds of escapes - {"", ""}, - {"foo bar baz frob nitz", "foo bar baz frob nitz"}, - {`\000\001\002\003\004\005\006\007`, string([]byte{0, 1, 2, 3, 4, 5, 6, 7})}, - {`\a\b\f\n\r\t\v\\\?\'\"`, string([]byte{'\a', '\b', '\f', '\n', '\r', '\t', '\v', '\\', '?', '\'', '"'})}, - {`\x10\x20\x30\x40\x50\x60\x70\x80`, string([]byte{16, 32, 48, 64, 80, 96, 112, 128})}, - // variable length octal escapes - {`\0\018\222\377\3\04\005\6\07`, string([]byte{0, 1, '8', 0222, 255, 3, 4, 5, 6, 7})}, - // malformed escape sequences left as is - {"foo \\g bar", "foo \\g bar"}, - {"foo \\xg0 bar", "foo \\xg0 bar"}, - {"\\", "\\"}, - {"\\x", "\\x"}, - {"\\xf", "\\xf"}, - {"\\777", "\\777"}, // overflows byte - } - for _, tc := range tests { - s := unescape(tc.in) - if s != tc.out { - t.Errorf("doUnescape(%q) = %q; should have been %q", tc.in, s, tc.out) - } - } -} diff --git a/ptypes/any.go b/ptypes/any.go index 3a847dfeef..055379eec3 100644 --- a/ptypes/any.go +++ b/ptypes/any.go @@ -4,111 +4,157 @@ package ptypes -// This file implements functions to marshal proto.Message to/from -// google.protobuf.Any message. - import ( "fmt" - "reflect" "strings" "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/any" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/runtime/protoimpl" + + anypb "github.com/golang/protobuf/ptypes/any" ) -const googleApis = "type.googleapis.com/" +const urlPrefix = "type.googleapis.com/" -// AnyMessageName returns the name of the message contained in a google.protobuf.Any message. -// -// Note that regular type assertions should be done using the Is -// function. AnyMessageName is provided for less common use cases like filtering a -// sequence of Any messages based on a set of allowed message type names. -func AnyMessageName(any *any.Any) (string, error) { +// AnyMessageName returns the message name contained in an anypb.Any message. +// Most type assertions should use the Is function instead. +func AnyMessageName(any *anypb.Any) (string, error) { + name, err := anyMessageName(any) + return string(name), err +} +func anyMessageName(any *anypb.Any) (protoreflect.FullName, error) { if any == nil { return "", fmt.Errorf("message is nil") } - slash := strings.LastIndex(any.TypeUrl, "/") - if slash < 0 { + name := protoreflect.FullName(any.TypeUrl) + if i := strings.LastIndex(any.TypeUrl, "/"); i >= 0 { + name = name[i+len("/"):] + } + if !name.IsValid() { return "", fmt.Errorf("message type url %q is invalid", any.TypeUrl) } - return any.TypeUrl[slash+1:], nil + return name, nil } -// MarshalAny takes the protocol buffer and encodes it into google.protobuf.Any. -func MarshalAny(pb proto.Message) (*any.Any, error) { - value, err := proto.Marshal(pb) +// MarshalAny marshals the given message m into an anypb.Any message. +func MarshalAny(m proto.Message) (*anypb.Any, error) { + if dm, ok := m.(*DynamicAny); ok { + m = dm.Message + } + b, err := proto.Marshal(m) if err != nil { return nil, err } - return &any.Any{TypeUrl: googleApis + proto.MessageName(pb), Value: value}, nil + return &anypb.Any{TypeUrl: urlPrefix + proto.MessageName(m), Value: b}, nil } -// DynamicAny is a value that can be passed to UnmarshalAny to automatically -// allocate a proto.Message for the type specified in a google.protobuf.Any -// message. The allocated message is stored in the embedded proto.Message. -// -// Example: -// -// var x ptypes.DynamicAny -// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } -// fmt.Printf("unmarshaled message: %v", x.Message) -type DynamicAny struct { - proto.Message -} - -// Empty returns a new proto.Message of the type specified in a -// google.protobuf.Any message. It returns an error if corresponding message -// type isn't linked in. -func Empty(any *any.Any) (proto.Message, error) { - aname, err := AnyMessageName(any) +// Empty returns a new message of the type specified in an anypb.Any message. +// It returns protoregistry.NotFound if the corresponding message type could not +// be resolved in the global registry. +func Empty(any *anypb.Any) (proto.Message, error) { + name, err := anyMessageName(any) if err != nil { return nil, err } - - t := proto.MessageType(aname) - if t == nil { - return nil, fmt.Errorf("any: message type %q isn't linked in", aname) + mt, err := protoregistry.GlobalTypes.FindMessageByName(name) + if err != nil { + return nil, err } - return reflect.New(t.Elem()).Interface().(proto.Message), nil + return protoimpl.X.ProtoMessageV1Of(mt.New().Interface()), nil } -// UnmarshalAny parses the protocol buffer representation in a google.protobuf.Any -// message and places the decoded result in pb. It returns an error if type of -// contents of Any message does not match type of pb message. +// UnmarshalAny unmarshals the encoded value contained in the anypb.Any message +// into the provided message m. It returns an error if the target message +// does not match the type in the Any message or if an unmarshal error occurs. // -// pb can be a proto.Message, or a *DynamicAny. -func UnmarshalAny(any *any.Any, pb proto.Message) error { - if d, ok := pb.(*DynamicAny); ok { - if d.Message == nil { +// The target message m may be a *DynamicAny message. If the underlying message +// type could not be resolved, then this returns protoregistry.NotFound. +func UnmarshalAny(any *anypb.Any, m proto.Message) error { + if dm, ok := m.(*DynamicAny); ok { + if dm.Message == nil { var err error - d.Message, err = Empty(any) + dm.Message, err = Empty(any) if err != nil { return err } } - return UnmarshalAny(any, d.Message) + m = dm.Message } - aname, err := AnyMessageName(any) + anyName, err := AnyMessageName(any) if err != nil { return err } - - mname := proto.MessageName(pb) - if aname != mname { - return fmt.Errorf("mismatched message type: got %q want %q", aname, mname) + msgName := proto.MessageName(m) + if anyName != msgName { + return fmt.Errorf("mismatched message type: got %q want %q", anyName, msgName) } - return proto.Unmarshal(any.Value, pb) + return proto.Unmarshal(any.Value, m) } -// Is returns true if any value contains a given message type. -func Is(any *any.Any, pb proto.Message) bool { - // The following is equivalent to AnyMessageName(any) == proto.MessageName(pb), - // but it avoids scanning TypeUrl for the slash. - if any == nil { +// Is reports whether the Any message contains a message of the specified type. +func Is(any *anypb.Any, m proto.Message) bool { + if any == nil || m == nil { return false } - name := proto.MessageName(pb) - prefix := len(any.TypeUrl) - len(name) - return prefix >= 1 && any.TypeUrl[prefix-1] == '/' && any.TypeUrl[prefix:] == name + name := proto.MessageName(m) + if !strings.HasSuffix(any.TypeUrl, name) { + return false + } + return len(any.TypeUrl) == len(name) || any.TypeUrl[len(any.TypeUrl)-len(name)-1] == '/' +} + +// DynamicAny is a value that can be passed to UnmarshalAny to automatically +// allocate a proto.Message for the type specified in an anypb.Any message. +// The allocated message is stored in the embedded proto.Message. +// +// Example: +// var x ptypes.DynamicAny +// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } +// fmt.Printf("unmarshaled message: %v", x.Message) +type DynamicAny struct{ proto.Message } + +func (m DynamicAny) String() string { + if m.Message == nil { + return "" + } + return m.Message.String() +} +func (m DynamicAny) Reset() { + if m.Message == nil { + return + } + m.Message.Reset() +} +func (m DynamicAny) ProtoMessage() { + return +} +func (m DynamicAny) ProtoReflect() protoreflect.Message { + if m.Message == nil { + return nil + } + return dynamicAny{protoimpl.X.MessageOf(m.Message)} +} + +type dynamicAny struct{ protoreflect.Message } + +func (m dynamicAny) Type() protoreflect.MessageType { + return dynamicAnyType{m.Message.Type()} +} +func (m dynamicAny) New() protoreflect.Message { + return dynamicAnyType{m.Message.Type()}.New() +} +func (m dynamicAny) Interface() protoreflect.ProtoMessage { + return DynamicAny{protoimpl.X.ProtoMessageV1Of(m.Message.Interface())} +} + +type dynamicAnyType struct{ protoreflect.MessageType } + +func (t dynamicAnyType) New() protoreflect.Message { + return dynamicAny{t.MessageType.New()} +} +func (t dynamicAnyType) Zero() protoreflect.Message { + return dynamicAny{t.MessageType.Zero()} } diff --git a/ptypes/any_test.go b/ptypes/any_test.go index a7ea3c0087..c865e1ca5d 100644 --- a/ptypes/any_test.go +++ b/ptypes/any_test.go @@ -5,22 +5,24 @@ package ptypes import ( + "reflect" "testing" "github.com/golang/protobuf/proto" - pb "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/golang/protobuf/ptypes/any" + + descriptorpb "github.com/golang/protobuf/protoc-gen-go/descriptor" + anypb "github.com/golang/protobuf/ptypes/any" ) func TestMarshalUnmarshal(t *testing.T) { - orig := &any.Any{Value: []byte("test")} + orig := &anypb.Any{Value: []byte("test")} packed, err := MarshalAny(orig) if err != nil { t.Errorf("MarshalAny(%+v): got: _, %v exp: _, nil", orig, err) } - unpacked := &any.Any{} + unpacked := &anypb.Any{} err = UnmarshalAny(packed, unpacked) if err != nil || !proto.Equal(unpacked, orig) { t.Errorf("got: %v, %+v; want nil, %+v", err, unpacked, orig) @@ -28,48 +30,48 @@ func TestMarshalUnmarshal(t *testing.T) { } func TestIs(t *testing.T) { - a, err := MarshalAny(&pb.FileDescriptorProto{}) + a, err := MarshalAny(&descriptorpb.FileDescriptorProto{}) if err != nil { t.Fatal(err) } - if Is(a, &pb.DescriptorProto{}) { + if Is(a, &descriptorpb.DescriptorProto{}) { // No spurious match for message names of different length. t.Error("FileDescriptorProto is not a DescriptorProto, but Is says it is") } - if Is(a, &pb.EnumDescriptorProto{}) { + if Is(a, &descriptorpb.EnumDescriptorProto{}) { // No spurious match for message names of equal length. t.Error("FileDescriptorProto is not an EnumDescriptorProto, but Is says it is") } - if !Is(a, &pb.FileDescriptorProto{}) { + if !Is(a, &descriptorpb.FileDescriptorProto{}) { t.Error("FileDescriptorProto is indeed a FileDescriptorProto, but Is says it is not") } } func TestIsDifferentUrlPrefixes(t *testing.T) { - m := &pb.FileDescriptorProto{} - a := &any.Any{TypeUrl: "foo/bar/" + proto.MessageName(m)} + m := &descriptorpb.FileDescriptorProto{} + a := &anypb.Any{TypeUrl: "foo/bar/" + proto.MessageName(m)} if !Is(a, m) { t.Errorf("message with type url %q didn't satisfy Is for type %q", a.TypeUrl, proto.MessageName(m)) } } func TestIsCornerCases(t *testing.T) { - m := &pb.FileDescriptorProto{} + m := &descriptorpb.FileDescriptorProto{} if Is(nil, m) { t.Errorf("message with nil type url incorrectly claimed to be %q", proto.MessageName(m)) } - noPrefix := &any.Any{TypeUrl: proto.MessageName(m)} - if Is(noPrefix, m) { - t.Errorf("message with type url %q incorrectly claimed to be %q", noPrefix.TypeUrl, proto.MessageName(m)) + noPrefix := &anypb.Any{TypeUrl: proto.MessageName(m)} + if !Is(noPrefix, m) { + t.Errorf("message with type url %q didn't satisfy Is for type %q", noPrefix.TypeUrl, proto.MessageName(m)) } - shortPrefix := &any.Any{TypeUrl: "/" + proto.MessageName(m)} + shortPrefix := &anypb.Any{TypeUrl: "/" + proto.MessageName(m)} if !Is(shortPrefix, m) { t.Errorf("message with type url %q didn't satisfy Is for type %q", shortPrefix.TypeUrl, proto.MessageName(m)) } } func TestUnmarshalDynamic(t *testing.T) { - want := &pb.FileDescriptorProto{Name: proto.String("foo")} + want := &descriptorpb.FileDescriptorProto{Name: proto.String("foo")} a, err := MarshalAny(want) if err != nil { t.Fatal(err) @@ -84,7 +86,7 @@ func TestUnmarshalDynamic(t *testing.T) { } func TestEmpty(t *testing.T) { - want := &pb.FileDescriptorProto{} + want := &descriptorpb.FileDescriptorProto{} a, err := MarshalAny(want) if err != nil { t.Fatal(err) @@ -99,7 +101,7 @@ func TestEmpty(t *testing.T) { // that's a valid type_url for a message which shouldn't be linked into this // test binary. We want an error. - a.TypeUrl = "type.googleapis.com/google.protobuf.compiler.Version" + a.TypeUrl = "type.googleapis.com/google.protobuf.FieldMask" if _, err := Empty(a); err == nil { t.Errorf("got no error for an attempt to create a message of type %q, which shouldn't be linked in", a.TypeUrl) } @@ -110,14 +112,17 @@ func TestEmptyCornerCases(t *testing.T) { if err == nil { t.Error("expected Empty for nil to fail") } - want := &pb.FileDescriptorProto{} - noPrefix := &any.Any{TypeUrl: proto.MessageName(want)} - _, err = Empty(noPrefix) - if err == nil { - t.Errorf("expected Empty for any type %q to fail", noPrefix.TypeUrl) + want := &descriptorpb.FileDescriptorProto{} + noPrefix := &anypb.Any{TypeUrl: proto.MessageName(want)} + got, err := Empty(noPrefix) + if err != nil { + t.Errorf("Empty for any type %q failed: %s", noPrefix.TypeUrl, err) + } + if !proto.Equal(got, want) { + t.Errorf("Empty for any type %q differs, got %q, want %q", noPrefix.TypeUrl, got, want) } - shortPrefix := &any.Any{TypeUrl: "/" + proto.MessageName(want)} - got, err := Empty(shortPrefix) + shortPrefix := &anypb.Any{TypeUrl: "/" + proto.MessageName(want)} + got, err = Empty(shortPrefix) if err != nil { t.Errorf("Empty for any type %q failed: %s", shortPrefix.TypeUrl, err) } @@ -125,3 +130,37 @@ func TestEmptyCornerCases(t *testing.T) { t.Errorf("Empty for any type %q differs, got %q, want %q", shortPrefix.TypeUrl, got, want) } } + +func TestAnyReflect(t *testing.T) { + want := &descriptorpb.FileDescriptorProto{Name: proto.String("foo")} + a, err := MarshalAny(want) + if err != nil { + t.Fatal(err) + } + var got DynamicAny + if err := UnmarshalAny(a, &got); err != nil { + t.Fatal(err) + } + wantName := want.ProtoReflect().Descriptor().FullName() + gotName := got.ProtoReflect().Descriptor().FullName() + if gotName != wantName { + t.Errorf("name mismatch: got %v, want %v", gotName, wantName) + } + wantType := reflect.TypeOf(got) + gotType := reflect.TypeOf(got.ProtoReflect().Interface()) + if gotType != wantType { + t.Errorf("ProtoReflect().Interface() round-trip type mismatch: got %v, want %v", gotType, wantType) + } + gotType = reflect.TypeOf(got.ProtoReflect().New().Interface()) + if gotType != wantType { + t.Errorf("ProtoReflect().New().Interface() type mismatch: got %v, want %v", gotType, wantType) + } + gotType = reflect.TypeOf(got.ProtoReflect().Type().New().Interface()) + if gotType != wantType { + t.Errorf("ProtoReflect().Type().New().Interface() type mismatch: got %v, want %v", gotType, wantType) + } + gotType = reflect.TypeOf(got.ProtoReflect().Type().Zero().Interface()) + if gotType != wantType { + t.Errorf("ProtoReflect().Type().Zero().Interface() type mismatch: got %v, want %v", gotType, wantType) + } +} diff --git a/ptypes/doc.go b/ptypes/doc.go index b15f8c5394..fb9edd5c62 100644 --- a/ptypes/doc.go +++ b/ptypes/doc.go @@ -2,5 +2,5 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package ptypes contains code for interacting with well-known types. +// Package ptypes provides functionality for interacting with well-known types. package ptypes diff --git a/ptypes/duration.go b/ptypes/duration.go index 71798a9e87..6110ae8a41 100644 --- a/ptypes/duration.go +++ b/ptypes/duration.go @@ -4,72 +4,69 @@ package ptypes -// This file implements conversions between google.protobuf.Duration -// and time.Duration. - import ( "errors" "fmt" "time" - durpb "github.com/golang/protobuf/ptypes/duration" + durationpb "github.com/golang/protobuf/ptypes/duration" ) +// Range of google.protobuf.Duration as specified in duration.proto. +// This is about 10,000 years in seconds. const ( - // Range of a durpb.Duration in seconds, as specified in - // google/protobuf/duration.proto. This is about 10,000 years in seconds. maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) minSeconds = -maxSeconds ) -// validateDuration determines whether the durpb.Duration is valid according to the -// definition in google/protobuf/duration.proto. A valid durpb.Duration -// may still be too large to fit into a time.Duration (the range of durpb.Duration -// is about 10,000 years, and the range of time.Duration is about 290). -func validateDuration(d *durpb.Duration) error { - if d == nil { - return errors.New("duration: nil Duration") - } - if d.Seconds < minSeconds || d.Seconds > maxSeconds { - return fmt.Errorf("duration: %v: seconds out of range", d) - } - if d.Nanos <= -1e9 || d.Nanos >= 1e9 { - return fmt.Errorf("duration: %v: nanos out of range", d) - } - // Seconds and Nanos must have the same sign, unless d.Nanos is zero. - if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) { - return fmt.Errorf("duration: %v: seconds and nanos have different signs", d) - } - return nil -} - -// Duration converts a durpb.Duration to a time.Duration. Duration -// returns an error if the durpb.Duration is invalid or is too large to be -// represented in a time.Duration. -func Duration(p *durpb.Duration) (time.Duration, error) { - if err := validateDuration(p); err != nil { +// Duration converts a durationpb.Duration to a time.Duration. +// Duration returns an error if dur is invalid or overflows a time.Duration. +func Duration(dur *durationpb.Duration) (time.Duration, error) { + if err := validateDuration(dur); err != nil { return 0, err } - d := time.Duration(p.Seconds) * time.Second - if int64(d/time.Second) != p.Seconds { - return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p) + d := time.Duration(dur.Seconds) * time.Second + if int64(d/time.Second) != dur.Seconds { + return 0, fmt.Errorf("duration: %v is out of range for time.Duration", dur) } - if p.Nanos != 0 { - d += time.Duration(p.Nanos) * time.Nanosecond - if (d < 0) != (p.Nanos < 0) { - return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p) + if dur.Nanos != 0 { + d += time.Duration(dur.Nanos) * time.Nanosecond + if (d < 0) != (dur.Nanos < 0) { + return 0, fmt.Errorf("duration: %v is out of range for time.Duration", dur) } } return d, nil } -// DurationProto converts a time.Duration to a durpb.Duration. -func DurationProto(d time.Duration) *durpb.Duration { +// DurationProto converts a time.Duration to a durationpb.Duration. +func DurationProto(d time.Duration) *durationpb.Duration { nanos := d.Nanoseconds() secs := nanos / 1e9 nanos -= secs * 1e9 - return &durpb.Duration{ - Seconds: secs, + return &durationpb.Duration{ + Seconds: int64(secs), Nanos: int32(nanos), } } + +// validateDuration determines whether the durationpb.Duration is valid +// according to the definition in google/protobuf/duration.proto. +// A valid durpb.Duration may still be too large to fit into a time.Duration +// Note that the range of durationpb.Duration is about 10,000 years, +// while the range of time.Duration is about 290 years. +func validateDuration(dur *durationpb.Duration) error { + if dur == nil { + return errors.New("duration: nil Duration") + } + if dur.Seconds < minSeconds || dur.Seconds > maxSeconds { + return fmt.Errorf("duration: %v: seconds out of range", dur) + } + if dur.Nanos <= -1e9 || dur.Nanos >= 1e9 { + return fmt.Errorf("duration: %v: nanos out of range", dur) + } + // Seconds and Nanos must have the same sign, unless d.Nanos is zero. + if (dur.Seconds < 0 && dur.Nanos > 0) || (dur.Seconds > 0 && dur.Nanos < 0) { + return fmt.Errorf("duration: %v: seconds and nanos have different signs", dur) + } + return nil +} diff --git a/ptypes/duration_test.go b/ptypes/duration_test.go index 0328e3f209..b11827c2c6 100644 --- a/ptypes/duration_test.go +++ b/ptypes/duration_test.go @@ -10,6 +10,7 @@ import ( "time" "github.com/golang/protobuf/proto" + durpb "github.com/golang/protobuf/ptypes/duration" ) diff --git a/ptypes/timestamp.go b/ptypes/timestamp.go index 2ad3246ace..026d0d4915 100644 --- a/ptypes/timestamp.go +++ b/ptypes/timestamp.go @@ -4,16 +4,15 @@ package ptypes -// This file implements operations on google.protobuf.Timestamp. - import ( "errors" "fmt" "time" - tspb "github.com/golang/protobuf/ptypes/timestamp" + timestamppb "github.com/golang/protobuf/ptypes/timestamp" ) +// Range of google.protobuf.Duration as specified in timestamp.proto. const ( // Seconds field of the earliest valid Timestamp. // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). @@ -23,44 +22,18 @@ const ( maxValidSeconds = 253402300800 ) -// validateTimestamp determines whether a Timestamp is valid. -// A valid timestamp represents a time in the range -// [0001-01-01, 10000-01-01) and has a Nanos field -// in the range [0, 1e9). -// -// If the Timestamp is valid, validateTimestamp returns nil. -// Otherwise, it returns an error that describes -// the problem. -// -// Every valid Timestamp can be represented by a time.Time, but the converse is not true. -func validateTimestamp(ts *tspb.Timestamp) error { - if ts == nil { - return errors.New("timestamp: nil Timestamp") - } - if ts.Seconds < minValidSeconds { - return fmt.Errorf("timestamp: %v before 0001-01-01", ts) - } - if ts.Seconds >= maxValidSeconds { - return fmt.Errorf("timestamp: %v after 10000-01-01", ts) - } - if ts.Nanos < 0 || ts.Nanos >= 1e9 { - return fmt.Errorf("timestamp: %v: nanos not in range [0, 1e9)", ts) - } - return nil -} - -// Timestamp converts a google.protobuf.Timestamp proto to a time.Time. +// Timestamp converts a timestamppb.Timestamp to a time.Time. // It returns an error if the argument is invalid. // -// Unlike most Go functions, if Timestamp returns an error, the first return value -// is not the zero time.Time. Instead, it is the value obtained from the +// Unlike most Go functions, if Timestamp returns an error, the first return +// value is not the zero time.Time. Instead, it is the value obtained from the // time.Unix function when passed the contents of the Timestamp, in the UTC // locale. This may or may not be a meaningful time; many invalid Timestamps // do map to valid time.Times. // // A nil Timestamp returns an error. The first return value in that case is // undefined. -func Timestamp(ts *tspb.Timestamp) (time.Time, error) { +func Timestamp(ts *timestamppb.Timestamp) (time.Time, error) { // Don't return the zero value on error, because corresponds to a valid // timestamp. Instead return whatever time.Unix gives us. var t time.Time @@ -73,7 +46,7 @@ func Timestamp(ts *tspb.Timestamp) (time.Time, error) { } // TimestampNow returns a google.protobuf.Timestamp for the current time. -func TimestampNow() *tspb.Timestamp { +func TimestampNow() *timestamppb.Timestamp { ts, err := TimestampProto(time.Now()) if err != nil { panic("ptypes: time.Now() out of Timestamp range") @@ -83,8 +56,8 @@ func TimestampNow() *tspb.Timestamp { // TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. // It returns an error if the resulting Timestamp is invalid. -func TimestampProto(t time.Time) (*tspb.Timestamp, error) { - ts := &tspb.Timestamp{ +func TimestampProto(t time.Time) (*timestamppb.Timestamp, error) { + ts := ×tamppb.Timestamp{ Seconds: t.Unix(), Nanos: int32(t.Nanosecond()), } @@ -94,12 +67,37 @@ func TimestampProto(t time.Time) (*tspb.Timestamp, error) { return ts, nil } -// TimestampString returns the RFC 3339 string for valid Timestamps. For invalid -// Timestamps, it returns an error message in parentheses. -func TimestampString(ts *tspb.Timestamp) string { +// TimestampString returns the RFC 3339 string for valid Timestamps. +// For invalid Timestamps, it returns an error message in parentheses. +func TimestampString(ts *timestamppb.Timestamp) string { t, err := Timestamp(ts) if err != nil { return fmt.Sprintf("(%v)", err) } return t.Format(time.RFC3339Nano) } + +// validateTimestamp determines whether a Timestamp is valid. +// A valid timestamp represents a time in the range [0001-01-01, 10000-01-01) +// and has a Nanos field in the range [0, 1e9). +// +// If the Timestamp is valid, validateTimestamp returns nil. +// Otherwise, it returns an error that describes the problem. +// +// Every valid Timestamp can be represented by a time.Time, +// but the converse is not true. +func validateTimestamp(ts *timestamppb.Timestamp) error { + if ts == nil { + return errors.New("timestamp: nil Timestamp") + } + if ts.Seconds < minValidSeconds { + return fmt.Errorf("timestamp: %v before 0001-01-01", ts) + } + if ts.Seconds >= maxValidSeconds { + return fmt.Errorf("timestamp: %v after 10000-01-01", ts) + } + if ts.Nanos < 0 || ts.Nanos >= 1e9 { + return fmt.Errorf("timestamp: %v: nanos not in range [0, 1e9)", ts) + } + return nil +} diff --git a/ptypes/timestamp_test.go b/ptypes/timestamp_test.go index 96811180d6..07efdfd826 100644 --- a/ptypes/timestamp_test.go +++ b/ptypes/timestamp_test.go @@ -10,6 +10,7 @@ import ( "time" "github.com/golang/protobuf/proto" + tspb "github.com/golang/protobuf/ptypes/timestamp" ) @@ -97,7 +98,6 @@ func TestTimestampString(t *testing.T) { // Not much testing needed because presumably time.Format is // well-tested. {&tspb.Timestamp{Seconds: 0, Nanos: 0}, "1970-01-01T00:00:00Z"}, - {&tspb.Timestamp{Seconds: minValidSeconds - 1, Nanos: 0}, "(timestamp: seconds:-62135596801 before 0001-01-01)"}, } { got := TimestampString(test.ts) if got != test.want { diff --git a/test.bash b/test.bash index 8145020860..c213adebdf 100755 --- a/test.bash +++ b/test.bash @@ -10,18 +10,14 @@ PASS="\x1b[32mPASS" FAIL="\x1b[31mFAIL" RESET="\x1b[0m" -echo -e "${BOLD}go test -tags protolegacy ./...${RESET}" -RET_TEST0=$(go test -tags protolegacy ./... | egrep -v "^(ok|[?])\s+") +echo -e "${BOLD}go test ./...${RESET}" +RET_TEST0=$(go test ./... | egrep -v "^(ok|[?])\s+") if [[ ! -z "$RET_TEST0" ]]; then echo "$RET_TEST0"; echo; fi -echo -e "${BOLD}go test -tags use_golang_protobuf_v1 ./...${RESET}" -RET_TEST1=$(go test -tags use_golang_protobuf_v1 ./... | egrep -v "^(ok|[?])\s+") +echo -e "${BOLD}go test -tags purego ./...${RESET}" +RET_TEST1=$(go test -tags purego ./... | egrep -v "^(ok|[?])\s+") if [[ ! -z "$RET_TEST1" ]]; then echo "$RET_TEST1"; echo; fi -echo -e "${BOLD}go test -tags "use_golang_protobuf_v1 purego" ./...${RESET}" -RET_TEST2=$(go test -tags "use_golang_protobuf_v1 purego" ./... | egrep -v "^(ok|[?])\s+") -if [[ ! -z "$RET_TEST2" ]]; then echo "$RET_TEST2"; echo; fi - echo -e "${BOLD}go generate${RESET}" RET_GEN=$(go run ./internal/cmd/generate-alias 2>&1) if [[ ! -z "$RET_GEN" ]]; then echo "$RET_GEN"; echo; fi @@ -38,7 +34,7 @@ echo -e "${BOLD}git ls-files${RESET}" RET_FILES=$(git ls-files --others --exclude-standard 2>&1) if [[ ! -z "$RET_FILES" ]]; then echo "$RET_FILES"; echo; fi -if [[ ! -z "$RET_TEST0" ]] || [[ ! -z "$RET_TEST1" ]] || [[ ! -z "$RET_TEST2" ]] || [[ ! -z "$RET_GEN" ]] || [ ! -z "$RET_FMT" ] || [[ ! -z "$RET_DIFF" ]] || [[ ! -z "$RET_FILES" ]]; then +if [[ ! -z "$RET_TEST0" ]] || [[ ! -z "$RET_TEST1" ]] || [[ ! -z "$RET_GEN" ]] || [ ! -z "$RET_FMT" ] || [[ ! -z "$RET_DIFF" ]] || [[ ! -z "$RET_FILES" ]]; then echo -e "${FAIL}${RESET}"; exit 1 else echo -e "${PASS}${RESET}"; exit 0 From f5a698d60c203675919c762fb7fdec4e7d5bd138 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 10 Feb 2020 13:17:28 -0800 Subject: [PATCH 093/133] proto: add ProtoPackageIsVersion4 Change-Id: I73a3da6d46e82c4c996ad9360e5b602efbbbcc83 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/218938 Reviewed-by: Damien Neil --- proto/deprecated.go | 7 ------- proto/proto.go | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/proto/deprecated.go b/proto/deprecated.go index b49c629730..a205482a32 100644 --- a/proto/deprecated.go +++ b/proto/deprecated.go @@ -11,13 +11,6 @@ import ( "strconv" ) -// Deprecated: Do not use. -const ( - ProtoPackageIsVersion1 = true - ProtoPackageIsVersion2 = true - ProtoPackageIsVersion3 = true -) - var ( // Deprecated: No longer returned. ErrNil = errors.New("proto: Marshal called with nil") diff --git a/proto/proto.go b/proto/proto.go index 65851ca5c4..a642816fc3 100644 --- a/proto/proto.go +++ b/proto/proto.go @@ -19,6 +19,13 @@ import ( "google.golang.org/protobuf/runtime/protoimpl" ) +const ( + ProtoPackageIsVersion1 = true + ProtoPackageIsVersion2 = true + ProtoPackageIsVersion3 = true + ProtoPackageIsVersion4 = true +) + // Message is a protocol buffer message. type Message = protoiface.MessageV1 From 0fd14f96108ad68d2571a78c2d8ef5287ee57c43 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 11 Feb 2020 14:07:23 -0800 Subject: [PATCH 094/133] proto: add MessageV1, MessageV2, and MessageReflect The MessageV1 and MessageV2 functions convert to/from the v1 and v2 message interfaces. The MessageReflect function provides a reflective view over message. These functions do not have an "Of" suffix to be consistent with the existing MessageName and MessageType functions. Furthermore, we drop the "Of" suffix from functions in the descriptor package to be consistent. This is a safe change since none of those functions have seen a stable release. We move the descriptor.GeneratedXXX types to the proto package for documentation purposes. Fixes #956 Change-Id: I566b74367798e2e3399db9902b58ffeb673199ca Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/219137 Reviewed-by: Damien Neil --- descriptor/descriptor.go | 40 ++++++++++++++--------------- descriptor/descriptor_test.go | 12 ++++----- proto/proto.go | 48 +++++++++++++++++++++++++++++++---- 3 files changed, 69 insertions(+), 31 deletions(-) diff --git a/descriptor/descriptor.go b/descriptor/descriptor.go index 3543da5e0c..53390ea1e6 100644 --- a/descriptor/descriptor.go +++ b/descriptor/descriptor.go @@ -25,7 +25,10 @@ import ( ) // Message is proto.Message with a method to return its descriptor. -// Not every message is guaranteed to implement this interface. +// +// Deprecated: The Descriptor method may not be generated by future +// versions of protoc-gen-go, meaning that this interface may not +// be implemented by many concrete message types. type Message interface { proto.Message Descriptor() ([]byte, []int) @@ -34,18 +37,15 @@ type Message interface { // ForMessage returns the file descriptor proto containing // the message and the message descriptor proto for the message itself. // The returned proto messages must not be mutated. +// +// Deprecated: Not all concrete message types satisfy the Message interface. +// Use MessageDescriptorProto instead. If possible, the calling code should +// be rewritten to use protobuf reflection instead. +// See package "google.golang.org/protobuf/reflect/protoreflect" for details. func ForMessage(m Message) (*descriptorpb.FileDescriptorProto, *descriptorpb.DescriptorProto) { - return MessageDescriptorProtoOf(m) + return MessageDescriptorProto(m) } -// GeneratedEnum is any enum type generated by protoc-gen-go -// which is a named int32 kind. -type GeneratedEnum interface{} - -// GeneratedMessage is any message type generated by protoc-gen-go -// which is a pointer to a named struct kind. -type GeneratedMessage interface{} - type rawDesc struct { fileDesc []byte indexes []int @@ -99,10 +99,10 @@ func deriveRawDescriptor(d protoreflect.Descriptor) ([]byte, []int) { return file, idxs } -// EnumRawDescriptorOf returns the GZIP'd raw file descriptor containing the +// EnumRawDescriptor returns the GZIP'd raw file descriptor containing the // enum and the index path to reach the enum declaration. // The returned slices must not be mutated. -func EnumRawDescriptorOf(e GeneratedEnum) ([]byte, []int) { +func EnumRawDescriptor(e proto.GeneratedEnum) ([]byte, []int) { if ev, ok := e.(interface{ EnumDescriptor() ([]byte, []int) }); ok { return ev.EnumDescriptor() } @@ -110,10 +110,10 @@ func EnumRawDescriptorOf(e GeneratedEnum) ([]byte, []int) { return deriveRawDescriptor(ed.Descriptor()) } -// MessageRawDescriptorOf returns the GZIP'd raw file descriptor containing +// MessageRawDescriptor returns the GZIP'd raw file descriptor containing // the message and the index path to reach the message declaration. // The returned slices must not be mutated. -func MessageRawDescriptorOf(m GeneratedMessage) ([]byte, []int) { +func MessageRawDescriptor(m proto.GeneratedMessage) ([]byte, []int) { if mv, ok := m.(interface{ Descriptor() ([]byte, []int) }); ok { return mv.Descriptor() } @@ -148,11 +148,11 @@ func deriveFileDescriptor(rawDesc []byte) *descriptorpb.FileDescriptorProto { return fd } -// EnumDescriptorProtoOf returns the file descriptor proto containing +// EnumDescriptorProto returns the file descriptor proto containing // the enum and the enum descriptor proto for the enum itself. // The returned proto messages must not be mutated. -func EnumDescriptorProtoOf(e GeneratedEnum) (*descriptorpb.FileDescriptorProto, *descriptorpb.EnumDescriptorProto) { - rawDesc, idxs := EnumRawDescriptorOf(e) +func EnumDescriptorProto(e proto.GeneratedEnum) (*descriptorpb.FileDescriptorProto, *descriptorpb.EnumDescriptorProto) { + rawDesc, idxs := EnumRawDescriptor(e) if rawDesc == nil || idxs == nil { return nil, nil } @@ -168,11 +168,11 @@ func EnumDescriptorProtoOf(e GeneratedEnum) (*descriptorpb.FileDescriptorProto, return fd, ed } -// MessageDescriptorProtoOf returns the file descriptor proto containing +// MessageDescriptorProto returns the file descriptor proto containing // the message and the message descriptor proto for the message itself. // The returned proto messages must not be mutated. -func MessageDescriptorProtoOf(m GeneratedMessage) (*descriptorpb.FileDescriptorProto, *descriptorpb.DescriptorProto) { - rawDesc, idxs := MessageRawDescriptorOf(m) +func MessageDescriptorProto(m proto.GeneratedMessage) (*descriptorpb.FileDescriptorProto, *descriptorpb.DescriptorProto) { + rawDesc, idxs := MessageRawDescriptor(m) if rawDesc == nil || idxs == nil { return nil, nil } diff --git a/descriptor/descriptor_test.go b/descriptor/descriptor_test.go index c11680c80d..28083979ca 100644 --- a/descriptor/descriptor_test.go +++ b/descriptor/descriptor_test.go @@ -13,7 +13,7 @@ import ( descpb "github.com/golang/protobuf/protoc-gen-go/descriptor" ) -func TestEnumDescriptorOf(t *testing.T) { +func TestEnumDescriptor(t *testing.T) { tests := []struct { enum protoreflect.Enum idxs []int @@ -37,19 +37,19 @@ func TestEnumDescriptorOf(t *testing.T) { for _, tt := range tests { e := struct{ protoreflect.Enum }{tt.enum} // v2-only enum - _, idxs := EnumRawDescriptorOf(e) + _, idxs := EnumRawDescriptor(e) if diff := cmp.Diff(tt.idxs, idxs); diff != "" { t.Errorf("path index mismatch (-want +got):\n%v", diff) } - _, ed := EnumDescriptorProtoOf(e) + _, ed := EnumDescriptorProto(e) if ed.GetName() != tt.name { t.Errorf("mismatching enum name: got %v, want %v", ed.GetName(), tt.name) } } } -func TestMessageDescriptorOf(t *testing.T) { +func TestMessageDescriptor(t *testing.T) { tests := []struct { message protoreflect.ProtoMessage idxs []int @@ -72,12 +72,12 @@ func TestMessageDescriptorOf(t *testing.T) { for _, tt := range tests { m := struct{ protoreflect.ProtoMessage }{tt.message} // v2-only message - _, idxs := MessageRawDescriptorOf(m) + _, idxs := MessageRawDescriptor(m) if diff := cmp.Diff(tt.idxs, idxs); diff != "" { t.Errorf("path index mismatch (-want +got):\n%v", diff) } - _, md := MessageDescriptorProtoOf(m) + _, md := MessageDescriptorProto(m) if md.GetName() != tt.name { t.Errorf("mismatching message name: got %v, want %v", md.GetName(), tt.name) } diff --git a/proto/proto.go b/proto/proto.go index a642816fc3..5ce96ece0c 100644 --- a/proto/proto.go +++ b/proto/proto.go @@ -13,7 +13,7 @@ package proto import ( - "google.golang.org/protobuf/proto" + protoV2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/runtime/protoiface" "google.golang.org/protobuf/runtime/protoimpl" @@ -26,9 +26,47 @@ const ( ProtoPackageIsVersion4 = true ) +// GeneratedEnum is any enum type generated by protoc-gen-go +// which is a named int32 kind. +// This type exists for documentation purposes. +type GeneratedEnum interface{} + +// GeneratedMessage is any message type generated by protoc-gen-go +// which is a pointer to a named struct kind. +// This type exists for documentation purposes. +type GeneratedMessage interface{} + // Message is a protocol buffer message. +// +// This is the v1 version of the message interface and is marginally better +// than an empty interface as it lacks any method to programatically interact +// with the contents of the message. +// +// A v2 message is declared in "google.golang.org/protobuf/proto".Message and +// exposes protobuf reflection as a first-class feature of the interface. +// +// To convert a v1 message to a v2 message, use the MessageV2 function. +// To convert a v2 message to a v1 message, use the MessageV1 function. type Message = protoiface.MessageV1 +// MessageV1 converts either a v1 or v2 message to a v1 message. +// It returns nil if m is nil. +func MessageV1(m GeneratedMessage) protoiface.MessageV1 { + return protoimpl.X.ProtoMessageV1Of(m) +} + +// MessageV2 converts either a v1 or v2 message to a v2 message. +// It returns nil if m is nil. +func MessageV2(m GeneratedMessage) protoV2.Message { + return protoimpl.X.ProtoMessageV2Of(m) +} + +// MessageReflect returns a reflective view for a message. +// It returns nil if m is nil. +func MessageReflect(m Message) protoreflect.Message { + return protoimpl.X.MessageOf(m) +} + // Marshaler is implemented by messages that can marshal themselves. // This interface is used by the following functions: Size, Marshal, // Buffer.Marshal, and Buffer.EncodeMessage. @@ -80,8 +118,8 @@ func (e *RequiredNotSetError) RequiredNotSet() bool { return true } -func checkRequiredNotSet(m proto.Message) error { - if err := proto.IsInitialized(m); err != nil { +func checkRequiredNotSet(m protoV2.Message) error { + if err := protoV2.IsInitialized(m); err != nil { return &RequiredNotSetError{err: err} } return nil @@ -113,7 +151,7 @@ func Merge(dst, src Message) { m.Merge(src) return } - proto.Merge( + protoV2.Merge( protoimpl.X.ProtoMessageV2Of(dst), protoimpl.X.ProtoMessageV2Of(src), ) @@ -135,7 +173,7 @@ func Merge(dst, src Message) { // Maps are equal if they have the same set of keys, where the pair of values // for each key is also equal. func Equal(x, y Message) bool { - return proto.Equal( + return protoV2.Equal( protoimpl.X.ProtoMessageV2Of(x), protoimpl.X.ProtoMessageV2Of(y), ) From cea45d6ceb8761b4bed31f8826a76722c053b3ad Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Thu, 20 Feb 2020 17:08:18 -0800 Subject: [PATCH 095/133] protoc-gen-go: move gengogrpc into v1 repo The eventual home of this is the gRPC repo, but extract it from the APIv2 repo for now. Change-Id: I0d88659945e17887da117ab6511e478598e70f02 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220354 Reviewed-by: Joe Tsai --- internal/gengogrpc/grpc.go | 398 ++++++++++++ protoc-gen-go/golden_test.go | 367 +++++++++++ protoc-gen-go/main.go | 2 +- protoc-gen-go/testdata/grpc/go.mod | 11 + protoc-gen-go/testdata/grpc/go.sum | 50 ++ protoc-gen-go/testdata/grpc/grpc.pb.go | 613 +++++++++++++++++++ protoc-gen-go/testdata/grpc/grpc.proto | 34 + protoc-gen-go/testdata/grpc/grpc_empty.pb.go | 127 ++++ protoc-gen-go/testdata/grpc/grpc_empty.proto | 11 + regenerate.bash | 3 +- 10 files changed, 1614 insertions(+), 2 deletions(-) create mode 100644 internal/gengogrpc/grpc.go create mode 100644 protoc-gen-go/golden_test.go create mode 100644 protoc-gen-go/testdata/grpc/go.mod create mode 100644 protoc-gen-go/testdata/grpc/go.sum create mode 100644 protoc-gen-go/testdata/grpc/grpc.pb.go create mode 100644 protoc-gen-go/testdata/grpc/grpc.proto create mode 100644 protoc-gen-go/testdata/grpc/grpc_empty.pb.go create mode 100644 protoc-gen-go/testdata/grpc/grpc_empty.proto diff --git a/internal/gengogrpc/grpc.go b/internal/gengogrpc/grpc.go new file mode 100644 index 0000000000..fd2f51d890 --- /dev/null +++ b/internal/gengogrpc/grpc.go @@ -0,0 +1,398 @@ +// 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 gengogrpc contains the gRPC code generator. +package gengogrpc + +import ( + "fmt" + "strconv" + "strings" + + "google.golang.org/protobuf/compiler/protogen" + + "google.golang.org/protobuf/types/descriptorpb" +) + +const ( + contextPackage = protogen.GoImportPath("context") + grpcPackage = protogen.GoImportPath("google.golang.org/grpc") + codesPackage = protogen.GoImportPath("google.golang.org/grpc/codes") + statusPackage = protogen.GoImportPath("google.golang.org/grpc/status") +) + +// GenerateFile generates a _grpc.pb.go file containing gRPC service definitions. +func GenerateFile(gen *protogen.Plugin, file *protogen.File) *protogen.GeneratedFile { + if len(file.Services) == 0 { + return nil + } + filename := file.GeneratedFilenamePrefix + "_grpc.pb.go" + g := gen.NewGeneratedFile(filename, file.GoImportPath) + g.P("// Code generated by protoc-gen-go-grpc. DO NOT EDIT.") + g.P() + g.P("package ", file.GoPackageName) + g.P() + GenerateFileContent(gen, file, g) + return g +} + +// GenerateFileContent generates the gRPC service definitions, excluding the package statement. +func GenerateFileContent(gen *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile) { + if len(file.Services) == 0 { + return + } + + // TODO: Remove this. We don't need to include these references any more. + g.P("// Reference imports to suppress errors if they are not otherwise used.") + g.P("var _ ", contextPackage.Ident("Context")) + g.P("var _ ", grpcPackage.Ident("ClientConnInterface")) + g.P() + + g.P("// This is a compile-time assertion to ensure that this generated file") + g.P("// is compatible with the grpc package it is being compiled against.") + g.P("const _ = ", grpcPackage.Ident("SupportPackageIsVersion6")) + g.P() + for _, service := range file.Services { + genService(gen, file, g, service) + } +} + +func genService(gen *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile, service *protogen.Service) { + clientName := service.GoName + "Client" + + g.P("// ", clientName, " is the client API for ", service.GoName, " service.") + g.P("//") + g.P("// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.") + + // Client interface. + if service.Desc.Options().(*descriptorpb.ServiceOptions).GetDeprecated() { + g.P("//") + g.P(deprecationComment) + } + g.Annotate(clientName, service.Location) + g.P("type ", clientName, " interface {") + for _, method := range service.Methods { + g.Annotate(clientName+"."+method.GoName, method.Location) + if method.Desc.Options().(*descriptorpb.MethodOptions).GetDeprecated() { + g.P(deprecationComment) + } + g.P(method.Comments.Leading, + clientSignature(g, method)) + } + g.P("}") + g.P() + + // Client structure. + g.P("type ", unexport(clientName), " struct {") + g.P("cc ", grpcPackage.Ident("ClientConnInterface")) + g.P("}") + g.P() + + // NewClient factory. + if service.Desc.Options().(*descriptorpb.ServiceOptions).GetDeprecated() { + g.P(deprecationComment) + } + g.P("func New", clientName, " (cc ", grpcPackage.Ident("ClientConnInterface"), ") ", clientName, " {") + g.P("return &", unexport(clientName), "{cc}") + g.P("}") + g.P() + + var methodIndex, streamIndex int + // Client method implementations. + for _, method := range service.Methods { + if !method.Desc.IsStreamingServer() && !method.Desc.IsStreamingClient() { + // Unary RPC method + genClientMethod(gen, file, g, method, methodIndex) + methodIndex++ + } else { + // Streaming RPC method + genClientMethod(gen, file, g, method, streamIndex) + streamIndex++ + } + } + + // Server interface. + serverType := service.GoName + "Server" + g.P("// ", serverType, " is the server API for ", service.GoName, " service.") + if service.Desc.Options().(*descriptorpb.ServiceOptions).GetDeprecated() { + g.P("//") + g.P(deprecationComment) + } + g.Annotate(serverType, service.Location) + g.P("type ", serverType, " interface {") + for _, method := range service.Methods { + g.Annotate(serverType+"."+method.GoName, method.Location) + if method.Desc.Options().(*descriptorpb.MethodOptions).GetDeprecated() { + g.P(deprecationComment) + } + g.P(method.Comments.Leading, + serverSignature(g, method)) + } + g.P("}") + g.P() + + // Server Unimplemented struct for forward compatibility. + g.P("// Unimplemented", serverType, " can be embedded to have forward compatible implementations.") + g.P("type Unimplemented", serverType, " struct {") + g.P("}") + g.P() + for _, method := range service.Methods { + nilArg := "" + if !method.Desc.IsStreamingClient() && !method.Desc.IsStreamingServer() { + nilArg = "nil," + } + g.P("func (*Unimplemented", serverType, ") ", serverSignature(g, method), "{") + g.P("return ", nilArg, statusPackage.Ident("Errorf"), "(", codesPackage.Ident("Unimplemented"), `, "method `, method.GoName, ` not implemented")`) + g.P("}") + } + g.P() + + // Server registration. + if service.Desc.Options().(*descriptorpb.ServiceOptions).GetDeprecated() { + g.P(deprecationComment) + } + serviceDescVar := "_" + service.GoName + "_serviceDesc" + g.P("func Register", service.GoName, "Server(s *", grpcPackage.Ident("Server"), ", srv ", serverType, ") {") + g.P("s.RegisterService(&", serviceDescVar, `, srv)`) + g.P("}") + g.P() + + // Server handler implementations. + var handlerNames []string + for _, method := range service.Methods { + hname := genServerMethod(gen, file, g, method) + handlerNames = append(handlerNames, hname) + } + + // Service descriptor. + g.P("var ", serviceDescVar, " = ", grpcPackage.Ident("ServiceDesc"), " {") + g.P("ServiceName: ", strconv.Quote(string(service.Desc.FullName())), ",") + g.P("HandlerType: (*", serverType, ")(nil),") + g.P("Methods: []", grpcPackage.Ident("MethodDesc"), "{") + for i, method := range service.Methods { + if method.Desc.IsStreamingClient() || method.Desc.IsStreamingServer() { + continue + } + g.P("{") + g.P("MethodName: ", strconv.Quote(string(method.Desc.Name())), ",") + g.P("Handler: ", handlerNames[i], ",") + g.P("},") + } + g.P("},") + g.P("Streams: []", grpcPackage.Ident("StreamDesc"), "{") + for i, method := range service.Methods { + if !method.Desc.IsStreamingClient() && !method.Desc.IsStreamingServer() { + continue + } + g.P("{") + g.P("StreamName: ", strconv.Quote(string(method.Desc.Name())), ",") + g.P("Handler: ", handlerNames[i], ",") + if method.Desc.IsStreamingServer() { + g.P("ServerStreams: true,") + } + if method.Desc.IsStreamingClient() { + g.P("ClientStreams: true,") + } + g.P("},") + } + g.P("},") + g.P("Metadata: \"", file.Desc.Path(), "\",") + g.P("}") + g.P() +} + +func clientSignature(g *protogen.GeneratedFile, method *protogen.Method) string { + s := method.GoName + "(ctx " + g.QualifiedGoIdent(contextPackage.Ident("Context")) + if !method.Desc.IsStreamingClient() { + s += ", in *" + g.QualifiedGoIdent(method.Input.GoIdent) + } + s += ", opts ..." + g.QualifiedGoIdent(grpcPackage.Ident("CallOption")) + ") (" + if !method.Desc.IsStreamingClient() && !method.Desc.IsStreamingServer() { + s += "*" + g.QualifiedGoIdent(method.Output.GoIdent) + } else { + s += method.Parent.GoName + "_" + method.GoName + "Client" + } + s += ", error)" + return s +} + +func genClientMethod(gen *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile, method *protogen.Method, index int) { + service := method.Parent + sname := fmt.Sprintf("/%s/%s", service.Desc.FullName(), method.Desc.Name()) + + if method.Desc.Options().(*descriptorpb.MethodOptions).GetDeprecated() { + g.P(deprecationComment) + } + g.P("func (c *", unexport(service.GoName), "Client) ", clientSignature(g, method), "{") + if !method.Desc.IsStreamingServer() && !method.Desc.IsStreamingClient() { + g.P("out := new(", method.Output.GoIdent, ")") + g.P(`err := c.cc.Invoke(ctx, "`, sname, `", in, out, opts...)`) + g.P("if err != nil { return nil, err }") + g.P("return out, nil") + g.P("}") + g.P() + return + } + streamType := unexport(service.GoName) + method.GoName + "Client" + serviceDescVar := "_" + service.GoName + "_serviceDesc" + g.P("stream, err := c.cc.NewStream(ctx, &", serviceDescVar, ".Streams[", index, `], "`, sname, `", opts...)`) + g.P("if err != nil { return nil, err }") + g.P("x := &", streamType, "{stream}") + if !method.Desc.IsStreamingClient() { + g.P("if err := x.ClientStream.SendMsg(in); err != nil { return nil, err }") + g.P("if err := x.ClientStream.CloseSend(); err != nil { return nil, err }") + } + g.P("return x, nil") + g.P("}") + g.P() + + genSend := method.Desc.IsStreamingClient() + genRecv := method.Desc.IsStreamingServer() + genCloseAndRecv := !method.Desc.IsStreamingServer() + + // Stream auxiliary types and methods. + g.P("type ", service.GoName, "_", method.GoName, "Client interface {") + if genSend { + g.P("Send(*", method.Input.GoIdent, ") error") + } + if genRecv { + g.P("Recv() (*", method.Output.GoIdent, ", error)") + } + if genCloseAndRecv { + g.P("CloseAndRecv() (*", method.Output.GoIdent, ", error)") + } + g.P(grpcPackage.Ident("ClientStream")) + g.P("}") + g.P() + + g.P("type ", streamType, " struct {") + g.P(grpcPackage.Ident("ClientStream")) + g.P("}") + g.P() + + if genSend { + g.P("func (x *", streamType, ") Send(m *", method.Input.GoIdent, ") error {") + g.P("return x.ClientStream.SendMsg(m)") + g.P("}") + g.P() + } + if genRecv { + g.P("func (x *", streamType, ") Recv() (*", method.Output.GoIdent, ", error) {") + g.P("m := new(", method.Output.GoIdent, ")") + g.P("if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }") + g.P("return m, nil") + g.P("}") + g.P() + } + if genCloseAndRecv { + g.P("func (x *", streamType, ") CloseAndRecv() (*", method.Output.GoIdent, ", error) {") + g.P("if err := x.ClientStream.CloseSend(); err != nil { return nil, err }") + g.P("m := new(", method.Output.GoIdent, ")") + g.P("if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }") + g.P("return m, nil") + g.P("}") + g.P() + } +} + +func serverSignature(g *protogen.GeneratedFile, method *protogen.Method) string { + var reqArgs []string + ret := "error" + if !method.Desc.IsStreamingClient() && !method.Desc.IsStreamingServer() { + reqArgs = append(reqArgs, g.QualifiedGoIdent(contextPackage.Ident("Context"))) + ret = "(*" + g.QualifiedGoIdent(method.Output.GoIdent) + ", error)" + } + if !method.Desc.IsStreamingClient() { + reqArgs = append(reqArgs, "*"+g.QualifiedGoIdent(method.Input.GoIdent)) + } + if method.Desc.IsStreamingClient() || method.Desc.IsStreamingServer() { + reqArgs = append(reqArgs, method.Parent.GoName+"_"+method.GoName+"Server") + } + return method.GoName + "(" + strings.Join(reqArgs, ", ") + ") " + ret +} + +func genServerMethod(gen *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile, method *protogen.Method) string { + service := method.Parent + hname := fmt.Sprintf("_%s_%s_Handler", service.GoName, method.GoName) + + if !method.Desc.IsStreamingClient() && !method.Desc.IsStreamingServer() { + g.P("func ", hname, "(srv interface{}, ctx ", contextPackage.Ident("Context"), ", dec func(interface{}) error, interceptor ", grpcPackage.Ident("UnaryServerInterceptor"), ") (interface{}, error) {") + g.P("in := new(", method.Input.GoIdent, ")") + g.P("if err := dec(in); err != nil { return nil, err }") + g.P("if interceptor == nil { return srv.(", service.GoName, "Server).", method.GoName, "(ctx, in) }") + g.P("info := &", grpcPackage.Ident("UnaryServerInfo"), "{") + g.P("Server: srv,") + g.P("FullMethod: ", strconv.Quote(fmt.Sprintf("/%s/%s", service.Desc.FullName(), method.GoName)), ",") + g.P("}") + g.P("handler := func(ctx ", contextPackage.Ident("Context"), ", req interface{}) (interface{}, error) {") + g.P("return srv.(", service.GoName, "Server).", method.GoName, "(ctx, req.(*", method.Input.GoIdent, "))") + g.P("}") + g.P("return interceptor(ctx, in, info, handler)") + g.P("}") + g.P() + return hname + } + streamType := unexport(service.GoName) + method.GoName + "Server" + g.P("func ", hname, "(srv interface{}, stream ", grpcPackage.Ident("ServerStream"), ") error {") + if !method.Desc.IsStreamingClient() { + g.P("m := new(", method.Input.GoIdent, ")") + g.P("if err := stream.RecvMsg(m); err != nil { return err }") + g.P("return srv.(", service.GoName, "Server).", method.GoName, "(m, &", streamType, "{stream})") + } else { + g.P("return srv.(", service.GoName, "Server).", method.GoName, "(&", streamType, "{stream})") + } + g.P("}") + g.P() + + genSend := method.Desc.IsStreamingServer() + genSendAndClose := !method.Desc.IsStreamingServer() + genRecv := method.Desc.IsStreamingClient() + + // Stream auxiliary types and methods. + g.P("type ", service.GoName, "_", method.GoName, "Server interface {") + if genSend { + g.P("Send(*", method.Output.GoIdent, ") error") + } + if genSendAndClose { + g.P("SendAndClose(*", method.Output.GoIdent, ") error") + } + if genRecv { + g.P("Recv() (*", method.Input.GoIdent, ", error)") + } + g.P(grpcPackage.Ident("ServerStream")) + g.P("}") + g.P() + + g.P("type ", streamType, " struct {") + g.P(grpcPackage.Ident("ServerStream")) + g.P("}") + g.P() + + if genSend { + g.P("func (x *", streamType, ") Send(m *", method.Output.GoIdent, ") error {") + g.P("return x.ServerStream.SendMsg(m)") + g.P("}") + g.P() + } + if genSendAndClose { + g.P("func (x *", streamType, ") SendAndClose(m *", method.Output.GoIdent, ") error {") + g.P("return x.ServerStream.SendMsg(m)") + g.P("}") + g.P() + } + if genRecv { + g.P("func (x *", streamType, ") Recv() (*", method.Input.GoIdent, ", error) {") + g.P("m := new(", method.Input.GoIdent, ")") + g.P("if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err }") + g.P("return m, nil") + g.P("}") + g.P() + } + + return hname +} + +const deprecationComment = "// Deprecated: Do not use." + +func unexport(s string) string { return strings.ToLower(s[:1]) + s[1:] } diff --git a/protoc-gen-go/golden_test.go b/protoc-gen-go/golden_test.go new file mode 100644 index 0000000000..fd23ae3e77 --- /dev/null +++ b/protoc-gen-go/golden_test.go @@ -0,0 +1,367 @@ +// Copyright 2020 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 main + +import ( + "bytes" + "flag" + "go/build" + "go/parser" + "go/token" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "regexp" + "runtime" + "strings" + "testing" +) + +// Set --regenerate to regenerate the golden files. +var regenerate = flag.Bool("regenerate", false, "regenerate golden files") + +// When the environment variable RUN_AS_PROTOC_GEN_GO is set, we skip running +// tests and instead act as protoc-gen-go. This allows the test binary to +// pass itself to protoc. +func init() { + if os.Getenv("RUN_AS_PROTOC_GEN_GO") != "" { + main() + os.Exit(0) + } +} + +func TestGolden(t *testing.T) { + workdir, err := ioutil.TempDir("", "proto-test") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(workdir) + + // Find all the proto files we need to compile. We assume that each directory + // contains the files for a single package. + supportTypeAliases := hasReleaseTag("go1.9") + packages := map[string][]string{} + err = filepath.Walk("testdata", func(path string, info os.FileInfo, err error) error { + if filepath.Base(path) == "import_public" && !supportTypeAliases { + // Public imports require type alias support. + return filepath.SkipDir + } + if !strings.HasSuffix(path, ".proto") { + return nil + } + dir := filepath.Dir(path) + packages[dir] = append(packages[dir], path) + return nil + }) + if err != nil { + t.Fatal(err) + } + + // Compile each package, using this binary as protoc-gen-go. + for _, sources := range packages { + args := []string{"-Itestdata", "--go_out=plugins=grpc,paths=source_relative:" + workdir} + args = append(args, sources...) + protoc(t, args) + } + + // Compare each generated file to the golden version. + filepath.Walk(workdir, func(genPath string, info os.FileInfo, _ error) error { + if info.IsDir() { + return nil + } + + // For each generated file, figure out the path to the corresponding + // golden file in the testdata directory. + relPath, err := filepath.Rel(workdir, genPath) + if err != nil { + t.Errorf("filepath.Rel(%q, %q): %v", workdir, genPath, err) + return nil + } + if filepath.SplitList(relPath)[0] == ".." { + t.Errorf("generated file %q is not relative to %q", genPath, workdir) + } + goldenPath := filepath.Join("testdata", relPath) + + got, err := ioutil.ReadFile(genPath) + if err != nil { + t.Error(err) + return nil + } + if *regenerate { + // If --regenerate set, just rewrite the golden files. + err := ioutil.WriteFile(goldenPath, got, 0666) + if err != nil { + t.Error(err) + } + return nil + } + + want, err := ioutil.ReadFile(goldenPath) + if err != nil { + t.Error(err) + return nil + } + + want = fdescRE.ReplaceAll(want, nil) + got = fdescRE.ReplaceAll(got, nil) + if bytes.Equal(got, want) { + return nil + } + + cmd := exec.Command("diff", "-u", goldenPath, genPath) + out, _ := cmd.CombinedOutput() + t.Errorf("golden file differs: %v\n%v", relPath, string(out)) + return nil + }) +} + +var fdescRE = regexp.MustCompile(`(?ms)^var fileDescriptor.*}`) + +// Source files used by TestParameters. +const ( + aProto = ` +syntax = "proto3"; +package test.alpha; +option go_package = "package/alpha"; +import "beta/b.proto"; +message M { test.beta.M field = 1; }` + + bProto = ` +syntax = "proto3"; +package test.beta; +// no go_package option +message M {}` +) + +func TestParameters(t *testing.T) { + for _, test := range []struct { + parameters string + wantFiles map[string]bool + wantImportsA map[string]bool + wantPackageA string + wantPackageB string + }{{ + parameters: "", + wantFiles: map[string]bool{ + "package/alpha/a.pb.go": true, + "beta/b.pb.go": true, + }, + wantPackageA: "alpha", + wantPackageB: "test_beta", + wantImportsA: map[string]bool{ + "google.golang.org/protobuf/runtime/protoimpl": true, + "beta": true, + }, + }, { + parameters: "import_prefix=prefix", + wantFiles: map[string]bool{ + "package/alpha/a.pb.go": true, + "beta/b.pb.go": true, + }, + wantPackageA: "alpha", + wantPackageB: "test_beta", + wantImportsA: map[string]bool{ + // This really doesn't seem like useful behavior. + "prefixgoogle.golang.org/protobuf/runtime/protoimpl": true, + "prefixbeta": true, + }, + }, { + // import_path only affects the 'package' line. + parameters: "import_path=import/path/of/pkg", + wantPackageA: "alpha", + wantPackageB: "pkg", + wantFiles: map[string]bool{ + "package/alpha/a.pb.go": true, + "beta/b.pb.go": true, + }, + }, { + parameters: "Mbeta/b.proto=package/gamma", + wantFiles: map[string]bool{ + "package/alpha/a.pb.go": true, + "beta/b.pb.go": true, + }, + wantPackageA: "alpha", + wantPackageB: "test_beta", + wantImportsA: map[string]bool{ + "google.golang.org/protobuf/runtime/protoimpl": true, + // Rewritten by the M parameter. + "package/gamma": true, + }, + }, { + parameters: "import_prefix=prefix,Mbeta/b.proto=package/gamma", + wantFiles: map[string]bool{ + "package/alpha/a.pb.go": true, + "beta/b.pb.go": true, + }, + wantPackageA: "alpha", + wantPackageB: "test_beta", + wantImportsA: map[string]bool{ + // import_prefix applies after M. + "prefixpackage/gamma": true, + }, + }, { + parameters: "paths=source_relative", + wantFiles: map[string]bool{ + "alpha/a.pb.go": true, + "beta/b.pb.go": true, + }, + wantPackageA: "alpha", + wantPackageB: "test_beta", + }, { + parameters: "paths=source_relative,import_prefix=prefix", + wantFiles: map[string]bool{ + // import_prefix doesn't affect filenames. + "alpha/a.pb.go": true, + "beta/b.pb.go": true, + }, + wantPackageA: "alpha", + wantPackageB: "test_beta", + }} { + name := test.parameters + if name == "" { + name = "defaults" + } + // TODO: Switch to t.Run when we no longer support Go 1.6. + t.Logf("TEST: %v", name) + workdir, err := ioutil.TempDir("", "proto-test") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(workdir) + + for _, dir := range []string{"alpha", "beta", "out"} { + if err := os.MkdirAll(filepath.Join(workdir, dir), 0777); err != nil { + t.Fatal(err) + } + } + + if err := ioutil.WriteFile(filepath.Join(workdir, "alpha", "a.proto"), []byte(aProto), 0666); err != nil { + t.Fatal(err) + } + + if err := ioutil.WriteFile(filepath.Join(workdir, "beta", "b.proto"), []byte(bProto), 0666); err != nil { + t.Fatal(err) + } + + protoc(t, []string{ + "-I" + workdir, + "--go_out=" + test.parameters + ":" + filepath.Join(workdir, "out"), + filepath.Join(workdir, "alpha", "a.proto"), + }) + protoc(t, []string{ + "-I" + workdir, + "--go_out=" + test.parameters + ":" + filepath.Join(workdir, "out"), + filepath.Join(workdir, "beta", "b.proto"), + }) + + contents := make(map[string]string) + gotFiles := make(map[string]bool) + outdir := filepath.Join(workdir, "out") + filepath.Walk(outdir, func(p string, info os.FileInfo, _ error) error { + if info.IsDir() { + return nil + } + base := filepath.Base(p) + if base == "a.pb.go" || base == "b.pb.go" { + b, err := ioutil.ReadFile(p) + if err != nil { + t.Fatal(err) + } + contents[base] = string(b) + } + relPath, _ := filepath.Rel(outdir, p) + gotFiles[relPath] = true + return nil + }) + for got := range gotFiles { + if runtime.GOOS == "windows" { + got = filepath.ToSlash(got) + } + if !test.wantFiles[got] { + t.Errorf("unexpected output file: %v", got) + } + } + for want := range test.wantFiles { + if runtime.GOOS == "windows" { + want = filepath.FromSlash(want) + } + if !gotFiles[want] { + t.Errorf("missing output file: %v", want) + } + } + gotPackageA, gotImports, err := parseFile(contents["a.pb.go"]) + if err != nil { + t.Fatal(err) + } + gotPackageB, _, err := parseFile(contents["b.pb.go"]) + if err != nil { + t.Fatal(err) + } + if got, want := gotPackageA, test.wantPackageA; want != got { + t.Errorf("output file a.pb.go is package %q, want %q", got, want) + } + if got, want := gotPackageB, test.wantPackageB; want != got { + t.Errorf("output file b.pb.go is package %q, want %q", got, want) + } + missingImport := false + WantImport: + for want := range test.wantImportsA { + for _, imp := range gotImports { + if `"`+want+`"` == imp { + continue WantImport + } + } + t.Errorf("output file a.pb.go does not contain expected import %q", want) + missingImport = true + } + if missingImport { + t.Error("got imports:") + for _, imp := range gotImports { + t.Errorf(" %v", imp) + } + } + } +} + +// parseFile returns a file's package name and a list of all packages it imports. +func parseFile(source string) (packageName string, imports []string, err error) { + fset := token.NewFileSet() + f, err := parser.ParseFile(fset, "", source, parser.ImportsOnly) + if err != nil { + return "", nil, err + } + for _, imp := range f.Imports { + imports = append(imports, imp.Path.Value) + } + return f.Name.Name, imports, nil +} + +func protoc(t *testing.T, args []string) { + cmd := exec.Command("protoc", "--plugin=protoc-gen-go="+os.Args[0]) + cmd.Args = append(cmd.Args, args...) + // We set the RUN_AS_PROTOC_GEN_GO environment variable to indicate that + // the subprocess should act as a proto compiler rather than a test. + cmd.Env = append(os.Environ(), "RUN_AS_PROTOC_GEN_GO=1") + out, err := cmd.CombinedOutput() + if len(out) > 0 || err != nil { + t.Log("RUNNING: ", strings.Join(cmd.Args, " ")) + } + if len(out) > 0 { + t.Log(string(out)) + } + if err != nil { + t.Fatalf("protoc: %v", err) + } +} + +func hasReleaseTag(want string) bool { + for _, tag := range build.Default.ReleaseTags { + if tag == want { + return true + } + } + return false +} diff --git a/protoc-gen-go/main.go b/protoc-gen-go/main.go index 1f32d3f0f5..b06a713fd3 100644 --- a/protoc-gen-go/main.go +++ b/protoc-gen-go/main.go @@ -24,7 +24,7 @@ import ( "fmt" "strings" - gengogrpc "google.golang.org/protobuf/cmd/protoc-gen-go-grpc/internal_gengogrpc" + "github.com/golang/protobuf/internal/gengogrpc" gengo "google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo" "google.golang.org/protobuf/compiler/protogen" ) diff --git a/protoc-gen-go/testdata/grpc/go.mod b/protoc-gen-go/testdata/grpc/go.mod new file mode 100644 index 0000000000..48313a83ec --- /dev/null +++ b/protoc-gen-go/testdata/grpc/go.mod @@ -0,0 +1,11 @@ +module github.com/golang/protobuf/protoc-gen-go/testdata/grpc + +go 1.9 + +require ( + github.com/golang/protobuf v1.3.2 + google.golang.org/grpc v1.27.0-pre.0.20200124224931-7afcfdd66b12 + google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd +) + +replace github.com/golang/protobuf => ../../.. diff --git a/protoc-gen-go/testdata/grpc/go.sum b/protoc-gen-go/testdata/grpc/go.sum new file mode 100644 index 0000000000..74ddacf902 --- /dev/null +++ b/protoc-gen-go/testdata/grpc/go.sum @@ -0,0 +1,50 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= +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/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.27.0-pre.0.20200124224931-7afcfdd66b12 h1:Xr+lKA5ySDBoca3aMs7eOexQcsEkNin70xNPcILZITc= +google.golang.org/grpc v1.27.0-pre.0.20200124224931-7afcfdd66b12/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd h1:zSMqFwpTkfj+1nNFgmgu4B+Qv5Kpf4jpd11lCmHKuwQ= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/protoc-gen-go/testdata/grpc/grpc.pb.go b/protoc-gen-go/testdata/grpc/grpc.pb.go new file mode 100644 index 0000000000..4ff2c20875 --- /dev/null +++ b/protoc-gen-go/testdata/grpc/grpc.pb.go @@ -0,0 +1,613 @@ +// Copyright 2020 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.19.0-devel +// protoc v3.11.3 +// source: grpc/grpc.proto + +package testing + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) +) + +type SimpleRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SimpleRequest) Reset() { + *x = SimpleRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_grpc_grpc_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SimpleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SimpleRequest) ProtoMessage() {} + +func (x *SimpleRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_grpc_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SimpleRequest.ProtoReflect.Descriptor instead. +func (*SimpleRequest) Descriptor() ([]byte, []int) { + return file_grpc_grpc_proto_rawDescGZIP(), []int{0} +} + +type SimpleResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SimpleResponse) Reset() { + *x = SimpleResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_grpc_grpc_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SimpleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SimpleResponse) ProtoMessage() {} + +func (x *SimpleResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_grpc_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SimpleResponse.ProtoReflect.Descriptor instead. +func (*SimpleResponse) Descriptor() ([]byte, []int) { + return file_grpc_grpc_proto_rawDescGZIP(), []int{1} +} + +type StreamMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *StreamMsg) Reset() { + *x = StreamMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_grpc_grpc_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StreamMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamMsg) ProtoMessage() {} + +func (x *StreamMsg) ProtoReflect() protoreflect.Message { + mi := &file_grpc_grpc_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamMsg.ProtoReflect.Descriptor instead. +func (*StreamMsg) Descriptor() ([]byte, []int) { + return file_grpc_grpc_proto_rawDescGZIP(), []int{2} +} + +type StreamMsg2 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *StreamMsg2) Reset() { + *x = StreamMsg2{} + if protoimpl.UnsafeEnabled { + mi := &file_grpc_grpc_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StreamMsg2) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamMsg2) ProtoMessage() {} + +func (x *StreamMsg2) ProtoReflect() protoreflect.Message { + mi := &file_grpc_grpc_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamMsg2.ProtoReflect.Descriptor instead. +func (*StreamMsg2) Descriptor() ([]byte, []int) { + return file_grpc_grpc_proto_rawDescGZIP(), []int{3} +} + +var File_grpc_grpc_proto protoreflect.FileDescriptor + +var file_grpc_grpc_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0c, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x22, + 0x0f, 0x0a, 0x0d, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x0b, 0x0a, 0x09, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x22, + 0x0c, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x32, 0x32, 0x98, 0x02, + 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x43, + 0x61, 0x6c, 0x6c, 0x12, 0x1b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1c, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, + 0x0a, 0x0a, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1b, 0x2e, 0x67, + 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x6d, 0x70, + 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, + 0x73, 0x67, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x08, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x12, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x1a, 0x1c, 0x2e, 0x67, 0x72, 0x70, 0x63, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x3d, 0x0a, 0x04, 0x42, 0x69, 0x64, + 0x69, 0x12, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, + 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x1a, 0x18, 0x2e, 0x67, 0x72, 0x70, + 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x4d, 0x73, 0x67, 0x32, 0x28, 0x01, 0x30, 0x01, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, + 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x3b, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_grpc_grpc_proto_rawDescOnce sync.Once + file_grpc_grpc_proto_rawDescData = file_grpc_grpc_proto_rawDesc +) + +func file_grpc_grpc_proto_rawDescGZIP() []byte { + file_grpc_grpc_proto_rawDescOnce.Do(func() { + file_grpc_grpc_proto_rawDescData = protoimpl.X.CompressGZIP(file_grpc_grpc_proto_rawDescData) + }) + return file_grpc_grpc_proto_rawDescData +} + +var file_grpc_grpc_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_grpc_grpc_proto_goTypes = []interface{}{ + (*SimpleRequest)(nil), // 0: grpc.testing.SimpleRequest + (*SimpleResponse)(nil), // 1: grpc.testing.SimpleResponse + (*StreamMsg)(nil), // 2: grpc.testing.StreamMsg + (*StreamMsg2)(nil), // 3: grpc.testing.StreamMsg2 +} +var file_grpc_grpc_proto_depIdxs = []int32{ + 0, // 0: grpc.testing.Test.UnaryCall:input_type -> grpc.testing.SimpleRequest + 0, // 1: grpc.testing.Test.Downstream:input_type -> grpc.testing.SimpleRequest + 2, // 2: grpc.testing.Test.Upstream:input_type -> grpc.testing.StreamMsg + 2, // 3: grpc.testing.Test.Bidi:input_type -> grpc.testing.StreamMsg + 1, // 4: grpc.testing.Test.UnaryCall:output_type -> grpc.testing.SimpleResponse + 2, // 5: grpc.testing.Test.Downstream:output_type -> grpc.testing.StreamMsg + 1, // 6: grpc.testing.Test.Upstream:output_type -> grpc.testing.SimpleResponse + 3, // 7: grpc.testing.Test.Bidi:output_type -> grpc.testing.StreamMsg2 + 4, // [4:8] is the sub-list for method output_type + 0, // [0:4] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_grpc_grpc_proto_init() } +func file_grpc_grpc_proto_init() { + if File_grpc_grpc_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_grpc_grpc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SimpleRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_grpc_grpc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SimpleResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_grpc_grpc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_grpc_grpc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamMsg2); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_grpc_grpc_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_grpc_grpc_proto_goTypes, + DependencyIndexes: file_grpc_grpc_proto_depIdxs, + MessageInfos: file_grpc_grpc_proto_msgTypes, + }.Build() + File_grpc_grpc_proto = out.File + file_grpc_grpc_proto_rawDesc = nil + file_grpc_grpc_proto_goTypes = nil + file_grpc_grpc_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// TestClient is the client API for Test service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type TestClient interface { + UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) + // This RPC streams from the server only. + Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) + // This RPC streams from the client. + Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) + // This one streams in both directions. + Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) +} + +type testClient struct { + cc grpc.ClientConnInterface +} + +func NewTestClient(cc grpc.ClientConnInterface) TestClient { + return &testClient{cc} +} + +func (c *testClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { + out := new(SimpleResponse) + err := c.cc.Invoke(ctx, "/grpc.testing.Test/UnaryCall", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *testClient) Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) { + stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[0], "/grpc.testing.Test/Downstream", opts...) + if err != nil { + return nil, err + } + x := &testDownstreamClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Test_DownstreamClient interface { + Recv() (*StreamMsg, error) + grpc.ClientStream +} + +type testDownstreamClient struct { + grpc.ClientStream +} + +func (x *testDownstreamClient) Recv() (*StreamMsg, error) { + m := new(StreamMsg) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *testClient) Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) { + stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[1], "/grpc.testing.Test/Upstream", opts...) + if err != nil { + return nil, err + } + x := &testUpstreamClient{stream} + return x, nil +} + +type Test_UpstreamClient interface { + Send(*StreamMsg) error + CloseAndRecv() (*SimpleResponse, error) + grpc.ClientStream +} + +type testUpstreamClient struct { + grpc.ClientStream +} + +func (x *testUpstreamClient) Send(m *StreamMsg) error { + return x.ClientStream.SendMsg(m) +} + +func (x *testUpstreamClient) CloseAndRecv() (*SimpleResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(SimpleResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *testClient) Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) { + stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[2], "/grpc.testing.Test/Bidi", opts...) + if err != nil { + return nil, err + } + x := &testBidiClient{stream} + return x, nil +} + +type Test_BidiClient interface { + Send(*StreamMsg) error + Recv() (*StreamMsg2, error) + grpc.ClientStream +} + +type testBidiClient struct { + grpc.ClientStream +} + +func (x *testBidiClient) Send(m *StreamMsg) error { + return x.ClientStream.SendMsg(m) +} + +func (x *testBidiClient) Recv() (*StreamMsg2, error) { + m := new(StreamMsg2) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// TestServer is the server API for Test service. +type TestServer interface { + UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) + // This RPC streams from the server only. + Downstream(*SimpleRequest, Test_DownstreamServer) error + // This RPC streams from the client. + Upstream(Test_UpstreamServer) error + // This one streams in both directions. + Bidi(Test_BidiServer) error +} + +// UnimplementedTestServer can be embedded to have forward compatible implementations. +type UnimplementedTestServer struct { +} + +func (*UnimplementedTestServer) UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented") +} +func (*UnimplementedTestServer) Downstream(*SimpleRequest, Test_DownstreamServer) error { + return status.Errorf(codes.Unimplemented, "method Downstream not implemented") +} +func (*UnimplementedTestServer) Upstream(Test_UpstreamServer) error { + return status.Errorf(codes.Unimplemented, "method Upstream not implemented") +} +func (*UnimplementedTestServer) Bidi(Test_BidiServer) error { + return status.Errorf(codes.Unimplemented, "method Bidi not implemented") +} + +func RegisterTestServer(s *grpc.Server, srv TestServer) { + s.RegisterService(&_Test_serviceDesc, srv) +} + +func _Test_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SimpleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TestServer).UnaryCall(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.testing.Test/UnaryCall", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TestServer).UnaryCall(ctx, req.(*SimpleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Test_Downstream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SimpleRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(TestServer).Downstream(m, &testDownstreamServer{stream}) +} + +type Test_DownstreamServer interface { + Send(*StreamMsg) error + grpc.ServerStream +} + +type testDownstreamServer struct { + grpc.ServerStream +} + +func (x *testDownstreamServer) Send(m *StreamMsg) error { + return x.ServerStream.SendMsg(m) +} + +func _Test_Upstream_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(TestServer).Upstream(&testUpstreamServer{stream}) +} + +type Test_UpstreamServer interface { + SendAndClose(*SimpleResponse) error + Recv() (*StreamMsg, error) + grpc.ServerStream +} + +type testUpstreamServer struct { + grpc.ServerStream +} + +func (x *testUpstreamServer) SendAndClose(m *SimpleResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *testUpstreamServer) Recv() (*StreamMsg, error) { + m := new(StreamMsg) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Test_Bidi_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(TestServer).Bidi(&testBidiServer{stream}) +} + +type Test_BidiServer interface { + Send(*StreamMsg2) error + Recv() (*StreamMsg, error) + grpc.ServerStream +} + +type testBidiServer struct { + grpc.ServerStream +} + +func (x *testBidiServer) Send(m *StreamMsg2) error { + return x.ServerStream.SendMsg(m) +} + +func (x *testBidiServer) Recv() (*StreamMsg, error) { + m := new(StreamMsg) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _Test_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.testing.Test", + HandlerType: (*TestServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UnaryCall", + Handler: _Test_UnaryCall_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Downstream", + Handler: _Test_Downstream_Handler, + ServerStreams: true, + }, + { + StreamName: "Upstream", + Handler: _Test_Upstream_Handler, + ClientStreams: true, + }, + { + StreamName: "Bidi", + Handler: _Test_Bidi_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "grpc/grpc.proto", +} diff --git a/protoc-gen-go/testdata/grpc/grpc.proto b/protoc-gen-go/testdata/grpc/grpc.proto new file mode 100644 index 0000000000..ea94c7d200 --- /dev/null +++ b/protoc-gen-go/testdata/grpc/grpc.proto @@ -0,0 +1,34 @@ +// Copyright 2020 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. + +syntax = "proto3"; + +package grpc.testing; + +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/grpc;testing"; + +message SimpleRequest { +} + +message SimpleResponse { +} + +message StreamMsg { +} + +message StreamMsg2 { +} + +service Test { + rpc UnaryCall(SimpleRequest) returns (SimpleResponse); + + // This RPC streams from the server only. + rpc Downstream(SimpleRequest) returns (stream StreamMsg); + + // This RPC streams from the client. + rpc Upstream(stream StreamMsg) returns (SimpleResponse); + + // This one streams in both directions. + rpc Bidi(stream StreamMsg) returns (stream StreamMsg2); +} diff --git a/protoc-gen-go/testdata/grpc/grpc_empty.pb.go b/protoc-gen-go/testdata/grpc/grpc_empty.pb.go new file mode 100644 index 0000000000..8f0a7ed2cc --- /dev/null +++ b/protoc-gen-go/testdata/grpc/grpc_empty.pb.go @@ -0,0 +1,127 @@ +// Copyright 2020 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.19.0-devel +// protoc v3.11.3 +// source: grpc/grpc_empty.proto + +package testing + +import ( + context "context" + grpc "google.golang.org/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) +) + +var File_grpc_grpc_empty_proto protoreflect.FileDescriptor + +var file_grpc_grpc_empty_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x65, 0x6d, 0x70, 0x74, + 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x0e, 0x0a, 0x0c, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, + 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, + 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_grpc_grpc_empty_proto_rawDescOnce sync.Once + file_grpc_grpc_empty_proto_rawDescData = file_grpc_grpc_empty_proto_rawDesc +) + +func file_grpc_grpc_empty_proto_rawDescGZIP() []byte { + file_grpc_grpc_empty_proto_rawDescOnce.Do(func() { + file_grpc_grpc_empty_proto_rawDescData = protoimpl.X.CompressGZIP(file_grpc_grpc_empty_proto_rawDescData) + }) + return file_grpc_grpc_empty_proto_rawDescData +} + +var file_grpc_grpc_empty_proto_goTypes = []interface{}{} +var file_grpc_grpc_empty_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_grpc_grpc_empty_proto_init() } +func file_grpc_grpc_empty_proto_init() { + if File_grpc_grpc_empty_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_grpc_grpc_empty_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_grpc_grpc_empty_proto_goTypes, + DependencyIndexes: file_grpc_grpc_empty_proto_depIdxs, + }.Build() + File_grpc_grpc_empty_proto = out.File + file_grpc_grpc_empty_proto_rawDesc = nil + file_grpc_grpc_empty_proto_goTypes = nil + file_grpc_grpc_empty_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// EmptyServiceClient is the client API for EmptyService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type EmptyServiceClient interface { +} + +type emptyServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewEmptyServiceClient(cc grpc.ClientConnInterface) EmptyServiceClient { + return &emptyServiceClient{cc} +} + +// EmptyServiceServer is the server API for EmptyService service. +type EmptyServiceServer interface { +} + +// UnimplementedEmptyServiceServer can be embedded to have forward compatible implementations. +type UnimplementedEmptyServiceServer struct { +} + +func RegisterEmptyServiceServer(s *grpc.Server, srv EmptyServiceServer) { + s.RegisterService(&_EmptyService_serviceDesc, srv) +} + +var _EmptyService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.testing.EmptyService", + HandlerType: (*EmptyServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: "grpc/grpc_empty.proto", +} diff --git a/protoc-gen-go/testdata/grpc/grpc_empty.proto b/protoc-gen-go/testdata/grpc/grpc_empty.proto new file mode 100644 index 0000000000..aa679d399f --- /dev/null +++ b/protoc-gen-go/testdata/grpc/grpc_empty.proto @@ -0,0 +1,11 @@ +// Copyright 2020 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. + +syntax = "proto3"; + +package grpc.testing; + +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/grpc;testing"; + +service EmptyService {} diff --git a/regenerate.bash b/regenerate.bash index e3e3966dce..f6c35c5afd 100755 --- a/regenerate.bash +++ b/regenerate.bash @@ -4,5 +4,6 @@ # license that can be found in the LICENSE file. cd "$(git rev-parse --show-toplevel)" +set -e go run ./internal/cmd/generate-alias -execute -exit $? +go test ./protoc-gen-go -regenerate From 476703481131d8222928f3372d4b24e4d85b77a9 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Fri, 21 Feb 2020 09:58:31 -0800 Subject: [PATCH 096/133] protoc-gen-go: drop golden test Doesn't work in CI, since we don't have protoc available. Only tests the gRPC generator, which is moving to the gRPC repo soon anyway. Just drop it. Change-Id: Ie0c5ddf1cc1ab4268838f3ea18ca2410cfe6d698 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220497 Reviewed-by: Joe Tsai --- protoc-gen-go/golden_test.go | 367 ----------- protoc-gen-go/testdata/grpc/go.mod | 11 - protoc-gen-go/testdata/grpc/go.sum | 50 -- protoc-gen-go/testdata/grpc/grpc.pb.go | 613 ------------------- protoc-gen-go/testdata/grpc/grpc.proto | 34 - protoc-gen-go/testdata/grpc/grpc_empty.pb.go | 127 ---- protoc-gen-go/testdata/grpc/grpc_empty.proto | 11 - 7 files changed, 1213 deletions(-) delete mode 100644 protoc-gen-go/golden_test.go delete mode 100644 protoc-gen-go/testdata/grpc/go.mod delete mode 100644 protoc-gen-go/testdata/grpc/go.sum delete mode 100644 protoc-gen-go/testdata/grpc/grpc.pb.go delete mode 100644 protoc-gen-go/testdata/grpc/grpc.proto delete mode 100644 protoc-gen-go/testdata/grpc/grpc_empty.pb.go delete mode 100644 protoc-gen-go/testdata/grpc/grpc_empty.proto diff --git a/protoc-gen-go/golden_test.go b/protoc-gen-go/golden_test.go deleted file mode 100644 index fd23ae3e77..0000000000 --- a/protoc-gen-go/golden_test.go +++ /dev/null @@ -1,367 +0,0 @@ -// Copyright 2020 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 main - -import ( - "bytes" - "flag" - "go/build" - "go/parser" - "go/token" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "regexp" - "runtime" - "strings" - "testing" -) - -// Set --regenerate to regenerate the golden files. -var regenerate = flag.Bool("regenerate", false, "regenerate golden files") - -// When the environment variable RUN_AS_PROTOC_GEN_GO is set, we skip running -// tests and instead act as protoc-gen-go. This allows the test binary to -// pass itself to protoc. -func init() { - if os.Getenv("RUN_AS_PROTOC_GEN_GO") != "" { - main() - os.Exit(0) - } -} - -func TestGolden(t *testing.T) { - workdir, err := ioutil.TempDir("", "proto-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(workdir) - - // Find all the proto files we need to compile. We assume that each directory - // contains the files for a single package. - supportTypeAliases := hasReleaseTag("go1.9") - packages := map[string][]string{} - err = filepath.Walk("testdata", func(path string, info os.FileInfo, err error) error { - if filepath.Base(path) == "import_public" && !supportTypeAliases { - // Public imports require type alias support. - return filepath.SkipDir - } - if !strings.HasSuffix(path, ".proto") { - return nil - } - dir := filepath.Dir(path) - packages[dir] = append(packages[dir], path) - return nil - }) - if err != nil { - t.Fatal(err) - } - - // Compile each package, using this binary as protoc-gen-go. - for _, sources := range packages { - args := []string{"-Itestdata", "--go_out=plugins=grpc,paths=source_relative:" + workdir} - args = append(args, sources...) - protoc(t, args) - } - - // Compare each generated file to the golden version. - filepath.Walk(workdir, func(genPath string, info os.FileInfo, _ error) error { - if info.IsDir() { - return nil - } - - // For each generated file, figure out the path to the corresponding - // golden file in the testdata directory. - relPath, err := filepath.Rel(workdir, genPath) - if err != nil { - t.Errorf("filepath.Rel(%q, %q): %v", workdir, genPath, err) - return nil - } - if filepath.SplitList(relPath)[0] == ".." { - t.Errorf("generated file %q is not relative to %q", genPath, workdir) - } - goldenPath := filepath.Join("testdata", relPath) - - got, err := ioutil.ReadFile(genPath) - if err != nil { - t.Error(err) - return nil - } - if *regenerate { - // If --regenerate set, just rewrite the golden files. - err := ioutil.WriteFile(goldenPath, got, 0666) - if err != nil { - t.Error(err) - } - return nil - } - - want, err := ioutil.ReadFile(goldenPath) - if err != nil { - t.Error(err) - return nil - } - - want = fdescRE.ReplaceAll(want, nil) - got = fdescRE.ReplaceAll(got, nil) - if bytes.Equal(got, want) { - return nil - } - - cmd := exec.Command("diff", "-u", goldenPath, genPath) - out, _ := cmd.CombinedOutput() - t.Errorf("golden file differs: %v\n%v", relPath, string(out)) - return nil - }) -} - -var fdescRE = regexp.MustCompile(`(?ms)^var fileDescriptor.*}`) - -// Source files used by TestParameters. -const ( - aProto = ` -syntax = "proto3"; -package test.alpha; -option go_package = "package/alpha"; -import "beta/b.proto"; -message M { test.beta.M field = 1; }` - - bProto = ` -syntax = "proto3"; -package test.beta; -// no go_package option -message M {}` -) - -func TestParameters(t *testing.T) { - for _, test := range []struct { - parameters string - wantFiles map[string]bool - wantImportsA map[string]bool - wantPackageA string - wantPackageB string - }{{ - parameters: "", - wantFiles: map[string]bool{ - "package/alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - wantPackageA: "alpha", - wantPackageB: "test_beta", - wantImportsA: map[string]bool{ - "google.golang.org/protobuf/runtime/protoimpl": true, - "beta": true, - }, - }, { - parameters: "import_prefix=prefix", - wantFiles: map[string]bool{ - "package/alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - wantPackageA: "alpha", - wantPackageB: "test_beta", - wantImportsA: map[string]bool{ - // This really doesn't seem like useful behavior. - "prefixgoogle.golang.org/protobuf/runtime/protoimpl": true, - "prefixbeta": true, - }, - }, { - // import_path only affects the 'package' line. - parameters: "import_path=import/path/of/pkg", - wantPackageA: "alpha", - wantPackageB: "pkg", - wantFiles: map[string]bool{ - "package/alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - }, { - parameters: "Mbeta/b.proto=package/gamma", - wantFiles: map[string]bool{ - "package/alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - wantPackageA: "alpha", - wantPackageB: "test_beta", - wantImportsA: map[string]bool{ - "google.golang.org/protobuf/runtime/protoimpl": true, - // Rewritten by the M parameter. - "package/gamma": true, - }, - }, { - parameters: "import_prefix=prefix,Mbeta/b.proto=package/gamma", - wantFiles: map[string]bool{ - "package/alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - wantPackageA: "alpha", - wantPackageB: "test_beta", - wantImportsA: map[string]bool{ - // import_prefix applies after M. - "prefixpackage/gamma": true, - }, - }, { - parameters: "paths=source_relative", - wantFiles: map[string]bool{ - "alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - wantPackageA: "alpha", - wantPackageB: "test_beta", - }, { - parameters: "paths=source_relative,import_prefix=prefix", - wantFiles: map[string]bool{ - // import_prefix doesn't affect filenames. - "alpha/a.pb.go": true, - "beta/b.pb.go": true, - }, - wantPackageA: "alpha", - wantPackageB: "test_beta", - }} { - name := test.parameters - if name == "" { - name = "defaults" - } - // TODO: Switch to t.Run when we no longer support Go 1.6. - t.Logf("TEST: %v", name) - workdir, err := ioutil.TempDir("", "proto-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(workdir) - - for _, dir := range []string{"alpha", "beta", "out"} { - if err := os.MkdirAll(filepath.Join(workdir, dir), 0777); err != nil { - t.Fatal(err) - } - } - - if err := ioutil.WriteFile(filepath.Join(workdir, "alpha", "a.proto"), []byte(aProto), 0666); err != nil { - t.Fatal(err) - } - - if err := ioutil.WriteFile(filepath.Join(workdir, "beta", "b.proto"), []byte(bProto), 0666); err != nil { - t.Fatal(err) - } - - protoc(t, []string{ - "-I" + workdir, - "--go_out=" + test.parameters + ":" + filepath.Join(workdir, "out"), - filepath.Join(workdir, "alpha", "a.proto"), - }) - protoc(t, []string{ - "-I" + workdir, - "--go_out=" + test.parameters + ":" + filepath.Join(workdir, "out"), - filepath.Join(workdir, "beta", "b.proto"), - }) - - contents := make(map[string]string) - gotFiles := make(map[string]bool) - outdir := filepath.Join(workdir, "out") - filepath.Walk(outdir, func(p string, info os.FileInfo, _ error) error { - if info.IsDir() { - return nil - } - base := filepath.Base(p) - if base == "a.pb.go" || base == "b.pb.go" { - b, err := ioutil.ReadFile(p) - if err != nil { - t.Fatal(err) - } - contents[base] = string(b) - } - relPath, _ := filepath.Rel(outdir, p) - gotFiles[relPath] = true - return nil - }) - for got := range gotFiles { - if runtime.GOOS == "windows" { - got = filepath.ToSlash(got) - } - if !test.wantFiles[got] { - t.Errorf("unexpected output file: %v", got) - } - } - for want := range test.wantFiles { - if runtime.GOOS == "windows" { - want = filepath.FromSlash(want) - } - if !gotFiles[want] { - t.Errorf("missing output file: %v", want) - } - } - gotPackageA, gotImports, err := parseFile(contents["a.pb.go"]) - if err != nil { - t.Fatal(err) - } - gotPackageB, _, err := parseFile(contents["b.pb.go"]) - if err != nil { - t.Fatal(err) - } - if got, want := gotPackageA, test.wantPackageA; want != got { - t.Errorf("output file a.pb.go is package %q, want %q", got, want) - } - if got, want := gotPackageB, test.wantPackageB; want != got { - t.Errorf("output file b.pb.go is package %q, want %q", got, want) - } - missingImport := false - WantImport: - for want := range test.wantImportsA { - for _, imp := range gotImports { - if `"`+want+`"` == imp { - continue WantImport - } - } - t.Errorf("output file a.pb.go does not contain expected import %q", want) - missingImport = true - } - if missingImport { - t.Error("got imports:") - for _, imp := range gotImports { - t.Errorf(" %v", imp) - } - } - } -} - -// parseFile returns a file's package name and a list of all packages it imports. -func parseFile(source string) (packageName string, imports []string, err error) { - fset := token.NewFileSet() - f, err := parser.ParseFile(fset, "", source, parser.ImportsOnly) - if err != nil { - return "", nil, err - } - for _, imp := range f.Imports { - imports = append(imports, imp.Path.Value) - } - return f.Name.Name, imports, nil -} - -func protoc(t *testing.T, args []string) { - cmd := exec.Command("protoc", "--plugin=protoc-gen-go="+os.Args[0]) - cmd.Args = append(cmd.Args, args...) - // We set the RUN_AS_PROTOC_GEN_GO environment variable to indicate that - // the subprocess should act as a proto compiler rather than a test. - cmd.Env = append(os.Environ(), "RUN_AS_PROTOC_GEN_GO=1") - out, err := cmd.CombinedOutput() - if len(out) > 0 || err != nil { - t.Log("RUNNING: ", strings.Join(cmd.Args, " ")) - } - if len(out) > 0 { - t.Log(string(out)) - } - if err != nil { - t.Fatalf("protoc: %v", err) - } -} - -func hasReleaseTag(want string) bool { - for _, tag := range build.Default.ReleaseTags { - if tag == want { - return true - } - } - return false -} diff --git a/protoc-gen-go/testdata/grpc/go.mod b/protoc-gen-go/testdata/grpc/go.mod deleted file mode 100644 index 48313a83ec..0000000000 --- a/protoc-gen-go/testdata/grpc/go.mod +++ /dev/null @@ -1,11 +0,0 @@ -module github.com/golang/protobuf/protoc-gen-go/testdata/grpc - -go 1.9 - -require ( - github.com/golang/protobuf v1.3.2 - google.golang.org/grpc v1.27.0-pre.0.20200124224931-7afcfdd66b12 - google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd -) - -replace github.com/golang/protobuf => ../../.. diff --git a/protoc-gen-go/testdata/grpc/go.sum b/protoc-gen-go/testdata/grpc/go.sum deleted file mode 100644 index 74ddacf902..0000000000 --- a/protoc-gen-go/testdata/grpc/go.sum +++ /dev/null @@ -1,50 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= -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/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.0-pre.0.20200124224931-7afcfdd66b12 h1:Xr+lKA5ySDBoca3aMs7eOexQcsEkNin70xNPcILZITc= -google.golang.org/grpc v1.27.0-pre.0.20200124224931-7afcfdd66b12/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd h1:zSMqFwpTkfj+1nNFgmgu4B+Qv5Kpf4jpd11lCmHKuwQ= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/protoc-gen-go/testdata/grpc/grpc.pb.go b/protoc-gen-go/testdata/grpc/grpc.pb.go deleted file mode 100644 index 4ff2c20875..0000000000 --- a/protoc-gen-go/testdata/grpc/grpc.pb.go +++ /dev/null @@ -1,613 +0,0 @@ -// Copyright 2020 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. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.19.0-devel -// protoc v3.11.3 -// source: grpc/grpc.proto - -package testing - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) -) - -type SimpleRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *SimpleRequest) Reset() { - *x = SimpleRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_grpc_grpc_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SimpleRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SimpleRequest) ProtoMessage() {} - -func (x *SimpleRequest) ProtoReflect() protoreflect.Message { - mi := &file_grpc_grpc_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SimpleRequest.ProtoReflect.Descriptor instead. -func (*SimpleRequest) Descriptor() ([]byte, []int) { - return file_grpc_grpc_proto_rawDescGZIP(), []int{0} -} - -type SimpleResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *SimpleResponse) Reset() { - *x = SimpleResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_grpc_grpc_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SimpleResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SimpleResponse) ProtoMessage() {} - -func (x *SimpleResponse) ProtoReflect() protoreflect.Message { - mi := &file_grpc_grpc_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SimpleResponse.ProtoReflect.Descriptor instead. -func (*SimpleResponse) Descriptor() ([]byte, []int) { - return file_grpc_grpc_proto_rawDescGZIP(), []int{1} -} - -type StreamMsg struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *StreamMsg) Reset() { - *x = StreamMsg{} - if protoimpl.UnsafeEnabled { - mi := &file_grpc_grpc_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StreamMsg) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StreamMsg) ProtoMessage() {} - -func (x *StreamMsg) ProtoReflect() protoreflect.Message { - mi := &file_grpc_grpc_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StreamMsg.ProtoReflect.Descriptor instead. -func (*StreamMsg) Descriptor() ([]byte, []int) { - return file_grpc_grpc_proto_rawDescGZIP(), []int{2} -} - -type StreamMsg2 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *StreamMsg2) Reset() { - *x = StreamMsg2{} - if protoimpl.UnsafeEnabled { - mi := &file_grpc_grpc_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StreamMsg2) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StreamMsg2) ProtoMessage() {} - -func (x *StreamMsg2) ProtoReflect() protoreflect.Message { - mi := &file_grpc_grpc_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StreamMsg2.ProtoReflect.Descriptor instead. -func (*StreamMsg2) Descriptor() ([]byte, []int) { - return file_grpc_grpc_proto_rawDescGZIP(), []int{3} -} - -var File_grpc_grpc_proto protoreflect.FileDescriptor - -var file_grpc_grpc_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x0c, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x22, - 0x0f, 0x0a, 0x0d, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x0b, 0x0a, 0x09, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x22, - 0x0c, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x32, 0x32, 0x98, 0x02, - 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x43, - 0x61, 0x6c, 0x6c, 0x12, 0x1b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, - 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1c, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, - 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, - 0x0a, 0x0a, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1b, 0x2e, 0x67, - 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x6d, 0x70, - 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, - 0x73, 0x67, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x08, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x12, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x1a, 0x1c, 0x2e, 0x67, 0x72, 0x70, 0x63, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x3d, 0x0a, 0x04, 0x42, 0x69, 0x64, - 0x69, 0x12, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, - 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x73, 0x67, 0x1a, 0x18, 0x2e, 0x67, 0x72, 0x70, - 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x4d, 0x73, 0x67, 0x32, 0x28, 0x01, 0x30, 0x01, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, - 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x3b, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_grpc_grpc_proto_rawDescOnce sync.Once - file_grpc_grpc_proto_rawDescData = file_grpc_grpc_proto_rawDesc -) - -func file_grpc_grpc_proto_rawDescGZIP() []byte { - file_grpc_grpc_proto_rawDescOnce.Do(func() { - file_grpc_grpc_proto_rawDescData = protoimpl.X.CompressGZIP(file_grpc_grpc_proto_rawDescData) - }) - return file_grpc_grpc_proto_rawDescData -} - -var file_grpc_grpc_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_grpc_grpc_proto_goTypes = []interface{}{ - (*SimpleRequest)(nil), // 0: grpc.testing.SimpleRequest - (*SimpleResponse)(nil), // 1: grpc.testing.SimpleResponse - (*StreamMsg)(nil), // 2: grpc.testing.StreamMsg - (*StreamMsg2)(nil), // 3: grpc.testing.StreamMsg2 -} -var file_grpc_grpc_proto_depIdxs = []int32{ - 0, // 0: grpc.testing.Test.UnaryCall:input_type -> grpc.testing.SimpleRequest - 0, // 1: grpc.testing.Test.Downstream:input_type -> grpc.testing.SimpleRequest - 2, // 2: grpc.testing.Test.Upstream:input_type -> grpc.testing.StreamMsg - 2, // 3: grpc.testing.Test.Bidi:input_type -> grpc.testing.StreamMsg - 1, // 4: grpc.testing.Test.UnaryCall:output_type -> grpc.testing.SimpleResponse - 2, // 5: grpc.testing.Test.Downstream:output_type -> grpc.testing.StreamMsg - 1, // 6: grpc.testing.Test.Upstream:output_type -> grpc.testing.SimpleResponse - 3, // 7: grpc.testing.Test.Bidi:output_type -> grpc.testing.StreamMsg2 - 4, // [4:8] is the sub-list for method output_type - 0, // [0:4] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_grpc_grpc_proto_init() } -func file_grpc_grpc_proto_init() { - if File_grpc_grpc_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_grpc_grpc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SimpleRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_grpc_grpc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SimpleResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_grpc_grpc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StreamMsg); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_grpc_grpc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StreamMsg2); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_grpc_grpc_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_grpc_grpc_proto_goTypes, - DependencyIndexes: file_grpc_grpc_proto_depIdxs, - MessageInfos: file_grpc_grpc_proto_msgTypes, - }.Build() - File_grpc_grpc_proto = out.File - file_grpc_grpc_proto_rawDesc = nil - file_grpc_grpc_proto_goTypes = nil - file_grpc_grpc_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// TestClient is the client API for Test service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type TestClient interface { - UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) - // This RPC streams from the server only. - Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) - // This RPC streams from the client. - Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) - // This one streams in both directions. - Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) -} - -type testClient struct { - cc grpc.ClientConnInterface -} - -func NewTestClient(cc grpc.ClientConnInterface) TestClient { - return &testClient{cc} -} - -func (c *testClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { - out := new(SimpleResponse) - err := c.cc.Invoke(ctx, "/grpc.testing.Test/UnaryCall", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *testClient) Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[0], "/grpc.testing.Test/Downstream", opts...) - if err != nil { - return nil, err - } - x := &testDownstreamClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Test_DownstreamClient interface { - Recv() (*StreamMsg, error) - grpc.ClientStream -} - -type testDownstreamClient struct { - grpc.ClientStream -} - -func (x *testDownstreamClient) Recv() (*StreamMsg, error) { - m := new(StreamMsg) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *testClient) Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[1], "/grpc.testing.Test/Upstream", opts...) - if err != nil { - return nil, err - } - x := &testUpstreamClient{stream} - return x, nil -} - -type Test_UpstreamClient interface { - Send(*StreamMsg) error - CloseAndRecv() (*SimpleResponse, error) - grpc.ClientStream -} - -type testUpstreamClient struct { - grpc.ClientStream -} - -func (x *testUpstreamClient) Send(m *StreamMsg) error { - return x.ClientStream.SendMsg(m) -} - -func (x *testUpstreamClient) CloseAndRecv() (*SimpleResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(SimpleResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *testClient) Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) { - stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[2], "/grpc.testing.Test/Bidi", opts...) - if err != nil { - return nil, err - } - x := &testBidiClient{stream} - return x, nil -} - -type Test_BidiClient interface { - Send(*StreamMsg) error - Recv() (*StreamMsg2, error) - grpc.ClientStream -} - -type testBidiClient struct { - grpc.ClientStream -} - -func (x *testBidiClient) Send(m *StreamMsg) error { - return x.ClientStream.SendMsg(m) -} - -func (x *testBidiClient) Recv() (*StreamMsg2, error) { - m := new(StreamMsg2) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// TestServer is the server API for Test service. -type TestServer interface { - UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) - // This RPC streams from the server only. - Downstream(*SimpleRequest, Test_DownstreamServer) error - // This RPC streams from the client. - Upstream(Test_UpstreamServer) error - // This one streams in both directions. - Bidi(Test_BidiServer) error -} - -// UnimplementedTestServer can be embedded to have forward compatible implementations. -type UnimplementedTestServer struct { -} - -func (*UnimplementedTestServer) UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented") -} -func (*UnimplementedTestServer) Downstream(*SimpleRequest, Test_DownstreamServer) error { - return status.Errorf(codes.Unimplemented, "method Downstream not implemented") -} -func (*UnimplementedTestServer) Upstream(Test_UpstreamServer) error { - return status.Errorf(codes.Unimplemented, "method Upstream not implemented") -} -func (*UnimplementedTestServer) Bidi(Test_BidiServer) error { - return status.Errorf(codes.Unimplemented, "method Bidi not implemented") -} - -func RegisterTestServer(s *grpc.Server, srv TestServer) { - s.RegisterService(&_Test_serviceDesc, srv) -} - -func _Test_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SimpleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TestServer).UnaryCall(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/grpc.testing.Test/UnaryCall", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TestServer).UnaryCall(ctx, req.(*SimpleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Test_Downstream_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(SimpleRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(TestServer).Downstream(m, &testDownstreamServer{stream}) -} - -type Test_DownstreamServer interface { - Send(*StreamMsg) error - grpc.ServerStream -} - -type testDownstreamServer struct { - grpc.ServerStream -} - -func (x *testDownstreamServer) Send(m *StreamMsg) error { - return x.ServerStream.SendMsg(m) -} - -func _Test_Upstream_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TestServer).Upstream(&testUpstreamServer{stream}) -} - -type Test_UpstreamServer interface { - SendAndClose(*SimpleResponse) error - Recv() (*StreamMsg, error) - grpc.ServerStream -} - -type testUpstreamServer struct { - grpc.ServerStream -} - -func (x *testUpstreamServer) SendAndClose(m *SimpleResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *testUpstreamServer) Recv() (*StreamMsg, error) { - m := new(StreamMsg) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Test_Bidi_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TestServer).Bidi(&testBidiServer{stream}) -} - -type Test_BidiServer interface { - Send(*StreamMsg2) error - Recv() (*StreamMsg, error) - grpc.ServerStream -} - -type testBidiServer struct { - grpc.ServerStream -} - -func (x *testBidiServer) Send(m *StreamMsg2) error { - return x.ServerStream.SendMsg(m) -} - -func (x *testBidiServer) Recv() (*StreamMsg, error) { - m := new(StreamMsg) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -var _Test_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.testing.Test", - HandlerType: (*TestServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "UnaryCall", - Handler: _Test_UnaryCall_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Downstream", - Handler: _Test_Downstream_Handler, - ServerStreams: true, - }, - { - StreamName: "Upstream", - Handler: _Test_Upstream_Handler, - ClientStreams: true, - }, - { - StreamName: "Bidi", - Handler: _Test_Bidi_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "grpc/grpc.proto", -} diff --git a/protoc-gen-go/testdata/grpc/grpc.proto b/protoc-gen-go/testdata/grpc/grpc.proto deleted file mode 100644 index ea94c7d200..0000000000 --- a/protoc-gen-go/testdata/grpc/grpc.proto +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2020 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. - -syntax = "proto3"; - -package grpc.testing; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/grpc;testing"; - -message SimpleRequest { -} - -message SimpleResponse { -} - -message StreamMsg { -} - -message StreamMsg2 { -} - -service Test { - rpc UnaryCall(SimpleRequest) returns (SimpleResponse); - - // This RPC streams from the server only. - rpc Downstream(SimpleRequest) returns (stream StreamMsg); - - // This RPC streams from the client. - rpc Upstream(stream StreamMsg) returns (SimpleResponse); - - // This one streams in both directions. - rpc Bidi(stream StreamMsg) returns (stream StreamMsg2); -} diff --git a/protoc-gen-go/testdata/grpc/grpc_empty.pb.go b/protoc-gen-go/testdata/grpc/grpc_empty.pb.go deleted file mode 100644 index 8f0a7ed2cc..0000000000 --- a/protoc-gen-go/testdata/grpc/grpc_empty.pb.go +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2020 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. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.19.0-devel -// protoc v3.11.3 -// source: grpc/grpc_empty.proto - -package testing - -import ( - context "context" - grpc "google.golang.org/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(19 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 19) -) - -var File_grpc_grpc_empty_proto protoreflect.FileDescriptor - -var file_grpc_grpc_empty_proto_rawDesc = []byte{ - 0x0a, 0x15, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x65, 0x6d, 0x70, 0x74, - 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x0e, 0x0a, 0x0c, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, - 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, - 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_grpc_grpc_empty_proto_rawDescOnce sync.Once - file_grpc_grpc_empty_proto_rawDescData = file_grpc_grpc_empty_proto_rawDesc -) - -func file_grpc_grpc_empty_proto_rawDescGZIP() []byte { - file_grpc_grpc_empty_proto_rawDescOnce.Do(func() { - file_grpc_grpc_empty_proto_rawDescData = protoimpl.X.CompressGZIP(file_grpc_grpc_empty_proto_rawDescData) - }) - return file_grpc_grpc_empty_proto_rawDescData -} - -var file_grpc_grpc_empty_proto_goTypes = []interface{}{} -var file_grpc_grpc_empty_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_grpc_grpc_empty_proto_init() } -func file_grpc_grpc_empty_proto_init() { - if File_grpc_grpc_empty_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_grpc_grpc_empty_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_grpc_grpc_empty_proto_goTypes, - DependencyIndexes: file_grpc_grpc_empty_proto_depIdxs, - }.Build() - File_grpc_grpc_empty_proto = out.File - file_grpc_grpc_empty_proto_rawDesc = nil - file_grpc_grpc_empty_proto_goTypes = nil - file_grpc_grpc_empty_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// EmptyServiceClient is the client API for EmptyService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type EmptyServiceClient interface { -} - -type emptyServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewEmptyServiceClient(cc grpc.ClientConnInterface) EmptyServiceClient { - return &emptyServiceClient{cc} -} - -// EmptyServiceServer is the server API for EmptyService service. -type EmptyServiceServer interface { -} - -// UnimplementedEmptyServiceServer can be embedded to have forward compatible implementations. -type UnimplementedEmptyServiceServer struct { -} - -func RegisterEmptyServiceServer(s *grpc.Server, srv EmptyServiceServer) { - s.RegisterService(&_EmptyService_serviceDesc, srv) -} - -var _EmptyService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.testing.EmptyService", - HandlerType: (*EmptyServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "grpc/grpc_empty.proto", -} diff --git a/protoc-gen-go/testdata/grpc/grpc_empty.proto b/protoc-gen-go/testdata/grpc/grpc_empty.proto deleted file mode 100644 index aa679d399f..0000000000 --- a/protoc-gen-go/testdata/grpc/grpc_empty.proto +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2020 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. - -syntax = "proto3"; - -package grpc.testing; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/grpc;testing"; - -service EmptyService {} From c45dae45a675831edc15541f0aa7338cf8532063 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 21 Feb 2020 15:09:15 -0800 Subject: [PATCH 097/133] proto: use UnmarshalState The UnmarshalState method provides information about whether the message was initialized or not. Checking that bit saves performance needing to verify again. Generated files change because of newer versions of dependencies. Change-Id: I1c1e99b7e28da5959d083ea8652b5fdc8e6c3124 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220500 Reviewed-by: Damien Neil --- go.mod | 4 ++-- go.sum | 9 +++++++-- proto/wire.go | 10 ++++++++-- protoc-gen-go/descriptor/descriptor.pb.go | 13 ------------- protoc-gen-go/plugin/plugin.pb.go | 13 ------------- ptypes/any/any.pb.go | 13 ------------- ptypes/duration/duration.pb.go | 13 ------------- ptypes/empty/empty.pb.go | 13 ------------- ptypes/struct/struct.pb.go | 13 ------------- ptypes/timestamp/timestamp.pb.go | 13 ------------- ptypes/wrappers/wrappers.pb.go | 13 ------------- 11 files changed, 17 insertions(+), 110 deletions(-) diff --git a/go.mod b/go.mod index 269f7ab321..4872926902 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/golang/protobuf go 1.9 require ( - github.com/google/go-cmp v0.3.1 - google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd + github.com/google/go-cmp v0.4.0 + google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64 ) diff --git a/go.sum b/go.sum index 6cbf9e757d..e5a2e4eb89 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,10 @@ +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd h1:zSMqFwpTkfj+1nNFgmgu4B+Qv5Kpf4jpd11lCmHKuwQ= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64 h1:BhpvsYSxWvxATQJYrD9UKX1U3jo+Bxq195IzJGtyh40= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/proto/wire.go b/proto/wire.go index 53196ab276..5e8b7ac0d5 100644 --- a/proto/wire.go +++ b/proto/wire.go @@ -6,6 +6,7 @@ package proto import ( protoV2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/runtime/protoiface" "google.golang.org/protobuf/runtime/protoimpl" ) @@ -61,12 +62,17 @@ func Unmarshal(b []byte, m Message) error { // UnmarshalMerge parses a wire-format message in b and places the decoded results in m. func UnmarshalMerge(b []byte, m Message) error { mi := protoimpl.X.ProtoMessageV2Of(m) - err := protoV2.UnmarshalOptions{ + out, err := protoV2.UnmarshalOptions{ AllowPartial: true, Merge: true, - }.Unmarshal(b, mi) + }.UnmarshalState(mi, protoiface.UnmarshalInput{ + Buf: b, + }) if err != nil { return err } + if out.Flags&protoiface.UnmarshalInitialized > 0 { + return nil + } return checkRequiredNotSet(mi) } diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index a6d156aff9..63dc057851 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -8,7 +8,6 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" reflect "reflect" - sync "sync" ) // Symbols defined in public import of google/protobuf/descriptor.proto. @@ -167,18 +166,6 @@ var file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_ra 0x6f, 0x74, 0x6f, 0x32, } -var ( - file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescOnce sync.Once - file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescData = file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc -) - -func file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescGZIP() []byte { - file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescOnce.Do(func() { - file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescData) - }) - return file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDescData -} - var file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index df86663a18..2704536806 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -8,7 +8,6 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" pluginpb "google.golang.org/protobuf/types/pluginpb" reflect "reflect" - sync "sync" ) // Symbols defined in public import of google/protobuf/compiler/plugin.proto. @@ -34,18 +33,6 @@ var file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc = 0x67, 0x6f, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, } -var ( - file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescOnce sync.Once - file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescData = file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc -) - -func file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescGZIP() []byte { - file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescOnce.Do(func() { - file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescData) - }) - return file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDescData -} - var file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index a12e7d5f43..0ef27d33de 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go @@ -8,7 +8,6 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" reflect "reflect" - sync "sync" ) // Symbols defined in public import of google/protobuf/any.proto. @@ -29,18 +28,6 @@ var file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = []byte{ 0x74, 0x6f, 0x33, } -var ( - file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescOnce sync.Once - file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescData = file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc -) - -func file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescGZIP() []byte { - file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescOnce.Do(func() { - file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescData) - }) - return file_github_com_golang_protobuf_ptypes_any_any_proto_rawDescData -} - var file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index 6bb3b2ab57..d0079ee3ef 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go @@ -8,7 +8,6 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" durationpb "google.golang.org/protobuf/types/known/durationpb" reflect "reflect" - sync "sync" ) // Symbols defined in public import of google/protobuf/duration.proto. @@ -30,18 +29,6 @@ var file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = []b 0x6f, 0x6e, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var ( - file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescOnce sync.Once - file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescData = file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc -) - -func file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescGZIP() []byte { - file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescOnce.Do(func() { - file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescData) - }) - return file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDescData -} - var file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type diff --git a/ptypes/empty/empty.pb.go b/ptypes/empty/empty.pb.go index 5cab9ad9e1..16686a6552 100644 --- a/ptypes/empty/empty.pb.go +++ b/ptypes/empty/empty.pb.go @@ -8,7 +8,6 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" reflect "reflect" - sync "sync" ) // Symbols defined in public import of google/protobuf/empty.proto. @@ -29,18 +28,6 @@ var file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc = []byte{ 0x70, 0x74, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var ( - file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescOnce sync.Once - file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescData = file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc -) - -func file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescGZIP() []byte { - file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescOnce.Do(func() { - file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescData) - }) - return file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDescData -} - var file_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index 66298b55af..8d82abe213 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go @@ -8,7 +8,6 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" structpb "google.golang.org/protobuf/types/known/structpb" reflect "reflect" - sync "sync" ) // Symbols defined in public import of google/protobuf/struct.proto. @@ -45,18 +44,6 @@ var file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc = []byte{ 0x6f, 0x74, 0x6f, 0x33, } -var ( - file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescOnce sync.Once - file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescData = file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc -) - -func file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescGZIP() []byte { - file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescOnce.Do(func() { - file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescData) - }) - return file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDescData -} - var file_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type diff --git a/ptypes/timestamp/timestamp.pb.go b/ptypes/timestamp/timestamp.pb.go index 5c10e7eaf9..a76f807600 100644 --- a/ptypes/timestamp/timestamp.pb.go +++ b/ptypes/timestamp/timestamp.pb.go @@ -8,7 +8,6 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" - sync "sync" ) // Symbols defined in public import of google/protobuf/timestamp.proto. @@ -31,18 +30,6 @@ var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = [ 0x33, } -var ( - file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescOnce sync.Once - file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescData = file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc -) - -func file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescGZIP() []byte { - file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescOnce.Do(func() { - file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescData) - }) - return file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDescData -} - var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type diff --git a/ptypes/wrappers/wrappers.pb.go b/ptypes/wrappers/wrappers.pb.go index c0cbd2fcf8..cc40f27ad3 100644 --- a/ptypes/wrappers/wrappers.pb.go +++ b/ptypes/wrappers/wrappers.pb.go @@ -8,7 +8,6 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" reflect "reflect" - sync "sync" ) // Symbols defined in public import of google/protobuf/wrappers.proto. @@ -38,18 +37,6 @@ var file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc = []b 0x72, 0x73, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var ( - file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescOnce sync.Once - file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescData = file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc -) - -func file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescGZIP() []byte { - file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescOnce.Do(func() { - file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescData) - }) - return file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDescData -} - var file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = []interface{}{} var file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type From 67d41d38c208bd06ec485beb10570afa8c804134 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 20 Feb 2020 12:08:12 -0800 Subject: [PATCH 098/133] proto: use CheckInitialized instead of IsInitialized Change-Id: Idc03fc0c7afd81a69fcd6120c9472c9bc68ead4d Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220346 Reviewed-by: Damien Neil --- proto/proto.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/proto.go b/proto/proto.go index 5ce96ece0c..02c620ed5f 100644 --- a/proto/proto.go +++ b/proto/proto.go @@ -119,7 +119,7 @@ func (e *RequiredNotSetError) RequiredNotSet() bool { } func checkRequiredNotSet(m protoV2.Message) error { - if err := protoV2.IsInitialized(m); err != nil { + if err := protoV2.CheckInitialized(m); err != nil { return &RequiredNotSetError{err: err} } return nil From 1a45e6b3bbe8726ef12295776093e21a0602923e Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 24 Feb 2020 14:30:53 -0800 Subject: [PATCH 099/133] all: add CONTRIBUTING.md Change-Id: I3fcf268e35159e89beacf1ec63dfc256477a6382 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220678 Reviewed-by: Damien Neil --- CONTRIBUTING.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..55e070108e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,30 @@ +# Contributing to Go Protocol Buffers + +Go protocol buffers is an open source project and accepts contributions. + +This project is the first major revision of Go protobufs, +while the next major revision of this project is located at +[protocolbuffers/protobuf-go](https://github.com/protocolbuffers/protobuf-go). +Most new development effort is focused on the latter project, +and changes to this project is primarily reserved for bug fixes. + + +## Contributor License Agreement + +Contributions to this project must be accompanied by a Contributor License +Agreement. You (or your employer) retain the copyright to your contribution, +this simply gives us permission to use and redistribute your contributions as +part of the project. Head over to to see +your current agreements on file or to sign a new one. + +You generally only need to submit a CLA once, so if you've already submitted one +(even if it was for a different project), you probably don't need to do it +again. + + +## Code reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult +[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more +information on using pull requests. From a9f25769554578b7a397f0f7592b3c66f613bfad Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 20 Feb 2020 15:05:41 -0800 Subject: [PATCH 100/133] proto: add text tests These tests were removed during an era when we thought that the v1 text implementation would just wrap the v2 implementation. That didn't happen since too much code depended on the exact behavior of the v1 implementation (exact output, bugs, error strings, etc). Add the tests back in. This is a cleaned up version of the tests from v1.3.3. Change-Id: I0419af2092c4ed5703636366844ea61e910c5908 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220351 Reviewed-by: Damien Neil --- proto/text_test.go | 1366 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1366 insertions(+) create mode 100644 proto/text_test.go diff --git a/proto/text_test.go b/proto/text_test.go new file mode 100644 index 0000000000..343f93af5f --- /dev/null +++ b/proto/text_test.go @@ -0,0 +1,1366 @@ +// Copyright 2016 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_test + +import ( + "bytes" + "errors" + "math" + "strings" + "sync" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/google/go-cmp/cmp" + + pb2 "github.com/golang/protobuf/internal/testprotos/proto2_proto" + pb3 "github.com/golang/protobuf/internal/testprotos/proto3_proto" + anypb "github.com/golang/protobuf/ptypes/any" +) + +var ( + expandedMarshaler = proto.TextMarshaler{ExpandAny: true} + expandedCompactMarshaler = proto.TextMarshaler{Compact: true, ExpandAny: true} +) + +// anyEqual reports whether two messages which may be google.protobuf.Any or may +// contain google.protobuf.Any fields are equal. We can't use proto.Equal for +// comparison, because semantically equivalent messages may be marshaled to +// binary in different tag order. Instead, trust that TextMarshaler with +// ExpandAny option works and compare the text marshaling results. +func anyEqual(got, want proto.Message) bool { + // if messages are proto.Equal, no need to marshal. + if proto.Equal(got, want) { + return true + } + g := expandedMarshaler.Text(got) + w := expandedMarshaler.Text(want) + return g == w +} + +type golden struct { + m proto.Message + t, c string +} + +var goldenMessages = makeGolden() + +func makeGolden() []golden { + nested := &pb3.Nested{Bunny: "Monty"} + nb, err := proto.Marshal(nested) + if err != nil { + panic(err) + } + m1 := &pb3.Message{ + Name: "David", + ResultCount: 47, + Anything: &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(nested), Value: nb}, + } + m2 := &pb3.Message{ + Name: "David", + ResultCount: 47, + Anything: &anypb.Any{TypeUrl: "http://[::1]/type.googleapis.com/" + proto.MessageName(nested), Value: nb}, + } + m3 := &pb3.Message{ + Name: "David", + ResultCount: 47, + Anything: &anypb.Any{TypeUrl: `type.googleapis.com/"/` + proto.MessageName(nested), Value: nb}, + } + m4 := &pb3.Message{ + Name: "David", + ResultCount: 47, + Anything: &anypb.Any{TypeUrl: "type.googleapis.com/a/path/" + proto.MessageName(nested), Value: nb}, + } + m5 := &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(nested), Value: nb} + + any1 := &pb2.MyMessage{Count: proto.Int32(47), Name: proto.String("David")} + proto.SetExtension(any1, pb2.E_Ext_More, &pb2.Ext{Data: proto.String("foo")}) + proto.SetExtension(any1, pb2.E_Ext_Text, proto.String("bar")) + any1b, err := proto.Marshal(any1) + if err != nil { + panic(err) + } + any2 := &pb2.MyMessage{Count: proto.Int32(42), Bikeshed: pb2.MyMessage_GREEN.Enum(), RepBytes: [][]byte{[]byte("roboto")}} + proto.SetExtension(any2, pb2.E_Ext_More, &pb2.Ext{Data: proto.String("baz")}) + any2b, err := proto.Marshal(any2) + if err != nil { + panic(err) + } + m6 := &pb3.Message{ + Name: "David", + ResultCount: 47, + Anything: &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any1), Value: any1b}, + ManyThings: []*anypb.Any{ + &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any2), Value: any2b}, + &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any1), Value: any1b}, + }, + } + + const ( + m1Golden = ` +name: "David" +result_count: 47 +anything: < + [type.googleapis.com/proto3_test.Nested]: < + bunny: "Monty" + > +> +` + m2Golden = ` +name: "David" +result_count: 47 +anything: < + ["http://[::1]/type.googleapis.com/proto3_test.Nested"]: < + bunny: "Monty" + > +> +` + m3Golden = ` +name: "David" +result_count: 47 +anything: < + ["type.googleapis.com/\"/proto3_test.Nested"]: < + bunny: "Monty" + > +> +` + m4Golden = ` +name: "David" +result_count: 47 +anything: < + [type.googleapis.com/a/path/proto3_test.Nested]: < + bunny: "Monty" + > +> +` + m5Golden = ` +[type.googleapis.com/proto3_test.Nested]: < + bunny: "Monty" +> +` + m6Golden = ` +name: "David" +result_count: 47 +anything: < + [type.googleapis.com/proto2_test.MyMessage]: < + count: 47 + name: "David" + [proto2_test.Ext.more]: < + data: "foo" + > + [proto2_test.Ext.text]: "bar" + > +> +many_things: < + [type.googleapis.com/proto2_test.MyMessage]: < + count: 42 + bikeshed: GREEN + rep_bytes: "roboto" + [proto2_test.Ext.more]: < + data: "baz" + > + > +> +many_things: < + [type.googleapis.com/proto2_test.MyMessage]: < + count: 47 + name: "David" + [proto2_test.Ext.more]: < + data: "foo" + > + [proto2_test.Ext.text]: "bar" + > +> +` + ) + return []golden{ + {m1, strings.TrimSpace(m1Golden) + "\n", strings.TrimSpace(compact(m1Golden)) + " "}, + {m2, strings.TrimSpace(m2Golden) + "\n", strings.TrimSpace(compact(m2Golden)) + " "}, + {m3, strings.TrimSpace(m3Golden) + "\n", strings.TrimSpace(compact(m3Golden)) + " "}, + {m4, strings.TrimSpace(m4Golden) + "\n", strings.TrimSpace(compact(m4Golden)) + " "}, + {m5, strings.TrimSpace(m5Golden) + "\n", strings.TrimSpace(compact(m5Golden)) + " "}, + {m6, strings.TrimSpace(m6Golden) + "\n", strings.TrimSpace(compact(m6Golden)) + " "}, + } +} + +func TestMarshalGolden(t *testing.T) { + for _, tt := range goldenMessages { + t.Run("", func(t *testing.T) { + if got, want := expandedMarshaler.Text(tt.m), tt.t; got != want { + t.Errorf("message %v: got:\n%s\nwant:\n%s", tt.m, got, want) + } + if got, want := expandedCompactMarshaler.Text(tt.m), tt.c; got != want { + t.Errorf("message %v: got:\n`%s`\nwant:\n`%s`", tt.m, got, want) + } + }) + } +} + +func TestUnmarshalGolden(t *testing.T) { + for _, tt := range goldenMessages { + t.Run("", func(t *testing.T) { + want := tt.m + got := proto.Clone(tt.m) + got.Reset() + if err := proto.UnmarshalText(tt.t, got); err != nil { + t.Errorf("failed to unmarshal\n%s\nerror: %v", tt.t, err) + } + if !anyEqual(got, want) { + t.Errorf("message:\n%s\ngot:\n%s\nwant:\n%s", tt.t, got, want) + } + got.Reset() + if err := proto.UnmarshalText(tt.c, got); err != nil { + t.Errorf("failed to unmarshal\n%s\nerror: %v", tt.c, err) + } + if !anyEqual(got, want) { + t.Errorf("message:\n%s\ngot:\n%s\nwant:\n%s", tt.c, got, want) + } + }) + } +} + +func TestMarshalUnknownAny(t *testing.T) { + m := &pb3.Message{ + Anything: &anypb.Any{ + TypeUrl: "foo", + Value: []byte("bar"), + }, + } + want := `anything: < + type_url: "foo" + value: "bar" +> +` + got := expandedMarshaler.Text(m) + if got != want { + t.Errorf("got:\n%s\nwant:\n%s", got, want) + } +} + +func TestAmbiguousAny(t *testing.T) { + pb := &anypb.Any{} + err := proto.UnmarshalText(` + type_url: "ttt/proto3_test.Nested" + value: "\n\x05Monty" + `, pb) + if err != nil { + t.Errorf("unexpected proto.UnmarshalText error: %v", err) + } +} + +func TestUnmarshalOverwriteAny(t *testing.T) { + pb := &anypb.Any{} + err := proto.UnmarshalText(` + [type.googleapis.com/a/path/proto3_test.Nested]: < + bunny: "Monty" + > + [type.googleapis.com/a/path/proto3_test.Nested]: < + bunny: "Rabbit of Caerbannog" + > + `, pb) + want := `line 7: Any message unpacked multiple times, or "type_url" already set` + if err.Error() != want { + t.Errorf("incorrect error:\ngot: %v\nwant: %v", err.Error(), want) + } +} + +func TestUnmarshalAnyMixAndMatch(t *testing.T) { + pb := &anypb.Any{} + err := proto.UnmarshalText(` + value: "\n\x05Monty" + [type.googleapis.com/a/path/proto3_test.Nested]: < + bunny: "Rabbit of Caerbannog" + > + `, pb) + want := `line 5: Any message unpacked multiple times, or "value" already set` + if err.Error() != want { + t.Errorf("incorrect error:\ngot: %v\nwant: %v", err.Error(), want) + } +} + +// textMessage implements the methods that allow it to marshal and unmarshal +// itself as text. +type textMessage struct { +} + +func (*textMessage) MarshalText() ([]byte, error) { + return []byte("custom"), nil +} + +func (*textMessage) UnmarshalText(bytes []byte) error { + if string(bytes) != "custom" { + return errors.New("expected 'custom'") + } + return nil +} + +func (*textMessage) Reset() {} +func (*textMessage) String() string { return "" } +func (*textMessage) ProtoMessage() {} + +func newTestMessage() *pb2.MyMessage { + msg := &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String("Dave"), + Quote: proto.String(`"I didn't want to go."`), + Pet: []string{"bunny", "kitty", "horsey"}, + Inner: &pb2.InnerMessage{ + Host: proto.String("footrest.syd"), + Port: proto.Int32(7001), + Connected: proto.Bool(true), + }, + Others: []*pb2.OtherMessage{ + { + Key: proto.Int64(0xdeadbeef), + Value: []byte{1, 65, 7, 12}, + }, + { + Weight: proto.Float32(6.022), + Inner: &pb2.InnerMessage{ + Host: proto.String("lesha.mtv"), + Port: proto.Int32(8002), + }, + }, + }, + Bikeshed: pb2.MyMessage_BLUE.Enum(), + Somegroup: &pb2.MyMessage_SomeGroup{ + GroupField: proto.Int32(8), + }, + // One normally wouldn't do this. + // This is an undeclared tag 13, as a varint (wire type 0) with value 4. + XXX_unrecognized: []byte{13<<3 | 0, 4}, + } + ext := &pb2.Ext{ + Data: proto.String("Big gobs for big rats"), + } + if err := proto.SetExtension(msg, pb2.E_Ext_More, ext); err != nil { + panic(err) + } + greetings := []string{"adg", "easy", "cow"} + if err := proto.SetExtension(msg, pb2.E_Greeting, greetings); err != nil { + panic(err) + } + + // Add an unknown extension. We marshal a pb2.Ext, and fake the ID. + b, err := proto.Marshal(&pb2.Ext{Data: proto.String("3G skiing")}) + if err != nil { + panic(err) + } + b = append(proto.EncodeVarint(201<<3|proto.WireBytes), b...) + proto.SetRawExtension(msg, 201, b) + + // Extensions can be plain fields, too, so let's test that. + b = append(proto.EncodeVarint(202<<3|proto.WireVarint), 19) + proto.SetRawExtension(msg, 202, b) + + return msg +} + +const text = `count: 42 +name: "Dave" +quote: "\"I didn't want to go.\"" +pet: "bunny" +pet: "kitty" +pet: "horsey" +inner: < + host: "footrest.syd" + port: 7001 + connected: true +> +others: < + key: 3735928559 + value: "\001A\007\014" +> +others: < + weight: 6.022 + inner: < + host: "lesha.mtv" + port: 8002 + > +> +bikeshed: BLUE +SomeGroup { + group_field: 8 +} +/* 18 unknown bytes */ +13: 4 +201: "\t3G skiing" +202: 19 +[proto2_test.Ext.more]: < + data: "Big gobs for big rats" +> +[proto2_test.greeting]: "adg" +[proto2_test.greeting]: "easy" +[proto2_test.greeting]: "cow" +` + +func TestMarshalText(t *testing.T) { + buf := new(bytes.Buffer) + if err := proto.MarshalText(buf, newTestMessage()); err != nil { + t.Fatalf("proto.MarshalText: %v", err) + } + got := buf.String() + if diff := cmp.Diff(text, got); got != text { + t.Errorf("diff (-want +got):\n%v\n\ngot:\n%v\n\nwant:\n%v", diff, got, text) + } +} + +func TestMarshalTextCustomMessage(t *testing.T) { + buf := new(bytes.Buffer) + if err := proto.MarshalText(buf, &textMessage{}); err != nil { + t.Fatalf("proto.MarshalText: %v", err) + } + got := buf.String() + if got != "custom" { + t.Errorf("got:\n%v\n\nwant:\n%v", got, "custom") + } +} +func TestMarshalTextNil(t *testing.T) { + want := "" + tests := []proto.Message{nil, (*pb2.MyMessage)(nil)} + for i, test := range tests { + buf := new(bytes.Buffer) + if err := proto.MarshalText(buf, test); err != nil { + t.Fatal(err) + } + if got := buf.String(); got != want { + t.Errorf("%d: got %q want %q", i, got, want) + } + } +} + +func TestMarshalTextUnknownEnum(t *testing.T) { + // The Color enum only specifies values 0-2. + m := &pb2.MyMessage{Bikeshed: pb2.MyMessage_Color(3).Enum()} + got := m.String() + const want = `bikeshed:3 ` + if got != want { + t.Errorf("\n got %q\nwant %q", got, want) + } +} + +func TestTextOneof(t *testing.T) { + tests := []struct { + m proto.Message + want string + }{ + // zero message + {&pb2.Communique{}, ``}, + // scalar field + {&pb2.Communique{Union: &pb2.Communique_Number{4}}, `number:4`}, + // message field + {&pb2.Communique{Union: &pb2.Communique_Msg{ + &pb2.Strings{StringField: proto.String("why hello!")}, + }}, `msg:`}, + // bad oneof (should not panic) + {&pb2.Communique{Union: &pb2.Communique_Msg{nil}}, `msg:<>`}, + } + for _, test := range tests { + got := strings.TrimSpace(test.m.String()) + if got != test.want { + t.Errorf("got:\n%s\n\nwant:\n%s", got, test.want) + } + } +} + +func compact(src string) string { + // s/[ \n]+/ /g; s/ $//; + dst := make([]byte, len(src)) + space, comment := false, false + j := 0 + for i := 0; i < len(src); i++ { + if strings.HasPrefix(src[i:], "/*") { + comment = true + i++ + continue + } + if comment && strings.HasPrefix(src[i:], "*/") { + comment = false + i++ + continue + } + if comment { + continue + } + c := src[i] + if c == ' ' || c == '\n' { + space = true + continue + } + if j > 0 && (dst[j-1] == ':' || dst[j-1] == '<' || dst[j-1] == '{') { + space = false + } + if c == '{' { + space = false + } + if space { + dst[j] = ' ' + j++ + space = false + } + dst[j] = c + j++ + } + if space { + dst[j] = ' ' + j++ + } + return string(dst[0:j]) +} + +func TestCompactText(t *testing.T) { + got := proto.CompactTextString(newTestMessage()) + if got != compact(text) { + t.Errorf("got:\n%v\n\nwant:\n%v", got, compact(text)) + } +} + +func TestStringEscaping(t *testing.T) { + testCases := []struct { + in *pb2.Strings + out string + }{ + { + // Test data from C++ test (TextFormatTest.StringEscape). + // Single divergence: we don't escape apostrophes. + &pb2.Strings{StringField: proto.String("\"A string with ' characters \n and \r newlines and \t tabs and \001 slashes \\ and multiple spaces")}, + "string_field: \"\\\"A string with ' characters \\n and \\r newlines and \\t tabs and \\001 slashes \\\\ and multiple spaces\"\n", + }, + { + // Test data from the same C++ test. + &pb2.Strings{StringField: proto.String("\350\260\267\346\255\214")}, + "string_field: \"\\350\\260\\267\\346\\255\\214\"\n", + }, + { + // Some UTF-8. + &pb2.Strings{StringField: proto.String("\x00\x01\xff\x81")}, + `string_field: "\000\001\377\201"` + "\n", + }, + } + + for _, tc := range testCases { + t.Run("", func(t *testing.T) { + var buf bytes.Buffer + if err := proto.MarshalText(&buf, tc.in); err != nil { + t.Fatalf("proto.MarsalText error: %v", err) + } + got := buf.String() + if got != tc.out { + t.Fatalf("want:\n%s\n\nwant:\n%s", got, tc.out) + } + + // Check round-trip. + pb := new(pb2.Strings) + if err := proto.UnmarshalText(got, pb); err != nil { + t.Fatalf("proto.UnmarshalText error: %v", err) + } + if !proto.Equal(pb, tc.in) { + t.Fatalf("proto.Equal mismatch:\ngot:\n%v\n\nwant:\n%v", pb, tc.in) + } + }) + } +} + +// A limitedWriter accepts some output before it fails. +// This is a proxy for something like a nearly-full or imminently-failing disk, +// or a network connection that is about to die. +type limitedWriter struct { + b bytes.Buffer + limit int +} + +var outOfSpace = errors.New("proto: insufficient space") + +func (w *limitedWriter) Write(p []byte) (n int, err error) { + var avail = w.limit - w.b.Len() + if avail <= 0 { + return 0, outOfSpace + } + if len(p) <= avail { + return w.b.Write(p) + } + n, _ = w.b.Write(p[:avail]) + return n, outOfSpace +} + +func TestMarshalTextFailing(t *testing.T) { + // Try lots of different sizes to exercise more error code-paths. + for lim := 0; lim < len(text); lim++ { + buf := new(limitedWriter) + buf.limit = lim + err := proto.MarshalText(buf, newTestMessage()) + // We expect a certain error, but also some partial results in the buffer. + if err != outOfSpace { + t.Errorf("error mismatch: got %v, want %v", err, outOfSpace) + } + got := buf.b.String() + want := text[:buf.limit] + if got != want { + t.Errorf("text mismatch:\n\ngot:\n%v\n\nwant:\n%v", got, want) + } + } +} + +func TestFloats(t *testing.T) { + tests := []struct { + f float64 + want string + }{ + {0, "0"}, + {4.7, "4.7"}, + {math.Inf(1), "inf"}, + {math.Inf(-1), "-inf"}, + {math.NaN(), "nan"}, + } + for _, test := range tests { + msg := &pb2.FloatingPoint{F: &test.f} + got := strings.TrimSpace(msg.String()) + want := `f:` + test.want + if got != want { + t.Errorf("f=%f: got %q, want %q", test.f, got, want) + } + } +} + +func TestRepeatedNilText(t *testing.T) { + m := &pb2.MessageList{ + Message: []*pb2.MessageList_Message{ + nil, + &pb2.MessageList_Message{ + Name: proto.String("Horse"), + }, + nil, + }, + } + want := `Message { +} +Message { + name: "Horse" +} +Message { +} +` + if got := proto.MarshalTextString(m); got != want { + t.Errorf("got:\n%s\n\nwant:\n%s", got, want) + } +} + +func TestProto3Text(t *testing.T) { + tests := []struct { + m proto.Message + want string + }{ + // zero message + {&pb3.Message{}, ``}, + // zero message except for an empty byte slice + {&pb3.Message{Data: []byte{}}, ``}, + // trivial case + {&pb3.Message{Name: "Rob", HeightInCm: 175}, `name:"Rob" height_in_cm:175`}, + // empty map + {&pb2.MessageWithMap{}, ``}, + // non-empty map; map format is the same as a repeated struct, + // and they are sorted by key (numerically for numeric keys). + { + &pb2.MessageWithMap{NameMapping: map[int32]string{ + -1: "Negatory", + 7: "Lucky", + 1234: "Feist", + 6345789: "Otis", + }}, + `name_mapping: ` + + `name_mapping: ` + + `name_mapping: ` + + `name_mapping:`, + }, + // map with nil value; not well-defined, but we shouldn't crash + { + &pb2.MessageWithMap{MsgMapping: map[int64]*pb2.FloatingPoint{7: nil}}, + `msg_mapping: >`, + }, + } + for _, test := range tests { + got := strings.TrimSpace(test.m.String()) + if got != test.want { + t.Errorf("got:\n%s\n\nwant:\n%s", got, test.want) + } + } +} + +func TestRacyMarshal(t *testing.T) { + // This test should be run with the race detector. + + any := &pb2.MyMessage{Count: proto.Int32(47), Name: proto.String("David")} + proto.SetExtension(any, pb2.E_Ext_Text, proto.String("bar")) + b, err := proto.Marshal(any) + if err != nil { + panic(err) + } + m := &pb3.Message{ + Name: "David", + ResultCount: 47, + Anything: &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any), Value: b}, + } + + wantText := proto.MarshalTextString(m) + wantBytes, err := proto.Marshal(m) + if err != nil { + t.Fatalf("proto.Marshal error: %v", err) + } + + var wg sync.WaitGroup + defer wg.Wait() + wg.Add(20) + for i := 0; i < 10; i++ { + go func() { + defer wg.Done() + got := proto.MarshalTextString(m) + if got != wantText { + t.Errorf("proto.MarshalTextString = %q, want %q", got, wantText) + } + }() + go func() { + defer wg.Done() + got, err := proto.Marshal(m) + if !bytes.Equal(got, wantBytes) || err != nil { + t.Errorf("proto.Marshal = (%x, %v), want (%x, nil)", got, err, wantBytes) + } + }() + } +} + +type UnmarshalTextTest struct { + in string + err string // if "", no error expected + out *pb2.MyMessage +} + +func buildExtStructTest(text string) UnmarshalTextTest { + msg := &pb2.MyMessage{ + Count: proto.Int32(42), + } + proto.SetExtension(msg, pb2.E_Ext_More, &pb2.Ext{ + Data: proto.String("Hello, world!"), + }) + return UnmarshalTextTest{in: text, out: msg} +} + +func buildExtDataTest(text string) UnmarshalTextTest { + msg := &pb2.MyMessage{ + Count: proto.Int32(42), + } + proto.SetExtension(msg, pb2.E_Ext_Text, proto.String("Hello, world!")) + proto.SetExtension(msg, pb2.E_Ext_Number, proto.Int32(1729)) + return UnmarshalTextTest{in: text, out: msg} +} + +func buildExtRepStringTest(text string) UnmarshalTextTest { + msg := &pb2.MyMessage{ + Count: proto.Int32(42), + } + if err := proto.SetExtension(msg, pb2.E_Greeting, []string{"bula", "hola"}); err != nil { + panic(err) + } + return UnmarshalTextTest{in: text, out: msg} +} + +var unmarshalTextTests = []UnmarshalTextTest{ + // Basic + { + in: " count:42\n name:\"Dave\" ", + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String("Dave"), + }, + }, + + // Empty quoted string + { + in: `count:42 name:""`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String(""), + }, + }, + + // Quoted string concatenation with double quotes + { + in: `count:42 name: "My name is "` + "\n" + `"elsewhere"`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String("My name is elsewhere"), + }, + }, + + // Quoted string concatenation with single quotes + { + in: "count:42 name: 'My name is '\n'elsewhere'", + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String("My name is elsewhere"), + }, + }, + + // Quoted string concatenations with mixed quotes + { + in: "count:42 name: 'My name is '\n\"elsewhere\"", + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String("My name is elsewhere"), + }, + }, + { + in: "count:42 name: \"My name is \"\n'elsewhere'", + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String("My name is elsewhere"), + }, + }, + + // Quoted string with escaped apostrophe + { + in: `count:42 name: "HOLIDAY - New Year\'s Day"`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String("HOLIDAY - New Year's Day"), + }, + }, + + // Quoted string with single quote + { + in: `count:42 name: 'Roger "The Ramster" Ramjet'`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String(`Roger "The Ramster" Ramjet`), + }, + }, + + // Quoted string with all the accepted special characters from the C++ test + { + in: `count:42 name: ` + "\"\\\"A string with \\' characters \\n and \\r newlines and \\t tabs and \\001 slashes \\\\ and multiple spaces\"", + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String("\"A string with ' characters \n and \r newlines and \t tabs and \001 slashes \\ and multiple spaces"), + }, + }, + + // Quoted string with quoted backslash + { + in: `count:42 name: "\\'xyz"`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String(`\'xyz`), + }, + }, + + // Quoted string with UTF-8 bytes. + { + in: "count:42 name: '\303\277\302\201\x00\xAB\xCD\xEF'", + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String("\303\277\302\201\x00\xAB\xCD\xEF"), + }, + }, + + // Quoted string with unicode escapes. + { + in: `count: 42 name: "\u0047\U00000047\uffff\U0010ffff"`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String("GG\uffff\U0010ffff"), + }, + }, + + // Bad quoted string + { + in: `inner: < host: "\0" >` + "\n", + err: `line 1.15: invalid quoted string "\0": \0 requires 2 following digits`, + }, + + // Bad \u escape + { + in: `count: 42 name: "\u000"`, + err: `line 1.16: invalid quoted string "\u000": \u requires 4 following digits`, + }, + + // Bad \U escape + { + in: `count: 42 name: "\U0000000"`, + err: `line 1.16: invalid quoted string "\U0000000": \U requires 8 following digits`, + }, + + // Bad \U escape + { + in: `count: 42 name: "\xxx"`, + err: `line 1.16: invalid quoted string "\xxx": \xxx contains non-hexadecimal digits`, + }, + + // Number too large for int64 + { + in: "count: 1 others { key: 123456789012345678901 }", + err: "line 1.23: invalid int64: 123456789012345678901", + }, + + // Number too large for int32 + { + in: "count: 1234567890123", + err: "line 1.7: invalid int32: 1234567890123", + }, + + // Number in hexadecimal + { + in: "count: 0x2beef", + out: &pb2.MyMessage{ + Count: proto.Int32(0x2beef), + }, + }, + + // Number in octal + { + in: "count: 024601", + out: &pb2.MyMessage{ + Count: proto.Int32(024601), + }, + }, + + // Floating point number with "f" suffix + { + in: "count: 4 others:< weight: 17.0f >", + out: &pb2.MyMessage{ + Count: proto.Int32(4), + Others: []*pb2.OtherMessage{ + { + Weight: proto.Float32(17), + }, + }, + }, + }, + + // Floating point positive infinity + { + in: "count: 4 bigfloat: inf", + out: &pb2.MyMessage{ + Count: proto.Int32(4), + Bigfloat: proto.Float64(math.Inf(1)), + }, + }, + + // Floating point negative infinity + { + in: "count: 4 bigfloat: -inf", + out: &pb2.MyMessage{ + Count: proto.Int32(4), + Bigfloat: proto.Float64(math.Inf(-1)), + }, + }, + + // Number too large for float32 + { + in: "others:< weight: 12345678901234567890123456789012345678901234567890 >", + err: "line 1.17: invalid float: 12345678901234567890123456789012345678901234567890", + }, + + // Number posing as a quoted string + { + in: `inner: < host: 12 >` + "\n", + err: `line 1.15: invalid string: 12`, + }, + + // Quoted string posing as int32 + { + in: `count: "12"`, + err: `line 1.7: invalid int32: "12"`, + }, + + // Quoted string posing a float32 + { + in: `others:< weight: "17.4" >`, + err: `line 1.17: invalid float: "17.4"`, + }, + + // unclosed bracket doesn't cause infinite loop + { + in: `[`, + err: `line 1.0: unclosed type_url or extension name`, + }, + + // Enum + { + in: `count:42 bikeshed: BLUE`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Bikeshed: pb2.MyMessage_BLUE.Enum(), + }, + }, + + // Repeated field + { + in: `count:42 pet: "horsey" pet:"bunny"`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Pet: []string{"horsey", "bunny"}, + }, + }, + + // Repeated field with list notation + { + in: `count:42 pet: ["horsey", "bunny"]`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Pet: []string{"horsey", "bunny"}, + }, + }, + + // Repeated message with/without colon and <>/{} + { + in: `count:42 others:{} others{} others:<> others:{}`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Others: []*pb2.OtherMessage{ + {}, + {}, + {}, + {}, + }, + }, + }, + + // Missing colon for inner message + { + in: `count:42 inner < host: "cauchy.syd" >`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Inner: &pb2.InnerMessage{ + Host: proto.String("cauchy.syd"), + }, + }, + }, + + // Missing colon for string field + { + in: `name "Dave"`, + err: `line 1.5: expected ':', found "\"Dave\""`, + }, + + // Missing colon for int32 field + { + in: `count 42`, + err: `line 1.6: expected ':', found "42"`, + }, + + // Missing required field + { + in: `name: "Pawel"`, + err: `required field proto2_test.MyMessage.count not set`, + out: &pb2.MyMessage{ + Name: proto.String("Pawel"), + }, + }, + + // Missing required field in a required submessage + { + in: `count: 42 we_must_go_deeper < leo_finally_won_an_oscar <> >`, + err: `required field proto2_test.InnerMessage.host not set`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + WeMustGoDeeper: &pb2.RequiredInnerMessage{LeoFinallyWonAnOscar: &pb2.InnerMessage{}}, + }, + }, + + // Repeated non-repeated field + { + in: `name: "Rob" name: "Russ"`, + err: `line 1.12: non-repeated field "name" was repeated`, + }, + + // Group + { + in: `count: 17 SomeGroup { group_field: 12 }`, + out: &pb2.MyMessage{ + Count: proto.Int32(17), + Somegroup: &pb2.MyMessage_SomeGroup{ + GroupField: proto.Int32(12), + }, + }, + }, + + // Semicolon between fields + { + in: `count:3;name:"Calvin"`, + out: &pb2.MyMessage{ + Count: proto.Int32(3), + Name: proto.String("Calvin"), + }, + }, + // Comma between fields + { + in: `count:4,name:"Ezekiel"`, + out: &pb2.MyMessage{ + Count: proto.Int32(4), + Name: proto.String("Ezekiel"), + }, + }, + + // Boolean false + { + in: `count:42 inner { host: "example.com" connected: false }`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Inner: &pb2.InnerMessage{ + Host: proto.String("example.com"), + Connected: proto.Bool(false), + }, + }, + }, + // Boolean true + { + in: `count:42 inner { host: "example.com" connected: true }`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Inner: &pb2.InnerMessage{ + Host: proto.String("example.com"), + Connected: proto.Bool(true), + }, + }, + }, + // Boolean 0 + { + in: `count:42 inner { host: "example.com" connected: 0 }`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Inner: &pb2.InnerMessage{ + Host: proto.String("example.com"), + Connected: proto.Bool(false), + }, + }, + }, + // Boolean 1 + { + in: `count:42 inner { host: "example.com" connected: 1 }`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Inner: &pb2.InnerMessage{ + Host: proto.String("example.com"), + Connected: proto.Bool(true), + }, + }, + }, + // Boolean f + { + in: `count:42 inner { host: "example.com" connected: f }`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Inner: &pb2.InnerMessage{ + Host: proto.String("example.com"), + Connected: proto.Bool(false), + }, + }, + }, + // Boolean t + { + in: `count:42 inner { host: "example.com" connected: t }`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Inner: &pb2.InnerMessage{ + Host: proto.String("example.com"), + Connected: proto.Bool(true), + }, + }, + }, + // Boolean False + { + in: `count:42 inner { host: "example.com" connected: False }`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Inner: &pb2.InnerMessage{ + Host: proto.String("example.com"), + Connected: proto.Bool(false), + }, + }, + }, + // Boolean True + { + in: `count:42 inner { host: "example.com" connected: True }`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Inner: &pb2.InnerMessage{ + Host: proto.String("example.com"), + Connected: proto.Bool(true), + }, + }, + }, + + // Extension + buildExtStructTest(`count: 42 [proto2_test.Ext.more]:`), + buildExtStructTest(`count: 42 [proto2_test.Ext.more] {data:"Hello, world!"}`), + buildExtDataTest(`count: 42 [proto2_test.Ext.text]:"Hello, world!" [proto2_test.Ext.number]:1729`), + buildExtRepStringTest(`count: 42 [proto2_test.greeting]:"bula" [proto2_test.greeting]:"hola"`), + + // Big all-in-one + { + in: "count:42 # Meaning\n" + + `name:"Dave" ` + + `quote:"\"I didn't want to go.\"" ` + + `pet:"bunny" ` + + `pet:"kitty" ` + + `pet:"horsey" ` + + `inner:<` + + ` host:"footrest.syd" ` + + ` port:7001 ` + + ` connected:true ` + + `> ` + + `others:<` + + ` key:3735928559 ` + + ` value:"\x01A\a\f" ` + + `> ` + + `others:<` + + " weight:58.9 # Atomic weight of Co\n" + + ` inner:<` + + ` host:"lesha.mtv" ` + + ` port:8002 ` + + ` >` + + `>`, + out: &pb2.MyMessage{ + Count: proto.Int32(42), + Name: proto.String("Dave"), + Quote: proto.String(`"I didn't want to go."`), + Pet: []string{"bunny", "kitty", "horsey"}, + Inner: &pb2.InnerMessage{ + Host: proto.String("footrest.syd"), + Port: proto.Int32(7001), + Connected: proto.Bool(true), + }, + Others: []*pb2.OtherMessage{ + { + Key: proto.Int64(3735928559), + Value: []byte{0x1, 'A', '\a', '\f'}, + }, + { + Weight: proto.Float32(58.9), + Inner: &pb2.InnerMessage{ + Host: proto.String("lesha.mtv"), + Port: proto.Int32(8002), + }, + }, + }, + }, + }, +} + +func TestUnmarshalText(t *testing.T) { + for _, test := range unmarshalTextTests { + t.Run("", func(t *testing.T) { + pb := new(pb2.MyMessage) + err := proto.UnmarshalText(test.in, pb) + if test.err == "" { + // We don't expect failure. + if err != nil { + t.Errorf("proto.UnmarshalText error: %v", err) + } else if !proto.Equal(pb, test.out) { + t.Errorf("proto.Equal mismatch:\ngot: %v\nwant: %v", pb, test.out) + } + } else { + // We do expect failure. + if err == nil { + t.Errorf("proto.UnmarshalText: got nil error, want %v", test.err) + } else if !strings.Contains(err.Error(), test.err) { + t.Errorf("proto.UnmarshalText error mismatch:\ngot: %v\nwant: %v", err.Error(), test.err) + } else if _, ok := err.(*proto.RequiredNotSetError); ok && test.out != nil && !proto.Equal(pb, test.out) { + t.Errorf("proto.Equal mismatch:\ngot %v\nwant: %v", pb, test.out) + } + } + }) + } +} + +func TestUnmarshalTextCustomMessage(t *testing.T) { + msg := &textMessage{} + if err := proto.UnmarshalText("custom", msg); err != nil { + t.Errorf("proto.UnmarshalText error: %v", err) + } + if err := proto.UnmarshalText("not custom", msg); err == nil { + t.Errorf("proto.UnmarshalText: got nil error, want non-nil") + } +} + +// Regression test; this caused a panic. +func TestRepeatedEnum(t *testing.T) { + pb := new(pb2.RepeatedEnum) + if err := proto.UnmarshalText("color: RED", pb); err != nil { + t.Fatal(err) + } + exp := &pb2.RepeatedEnum{ + Color: []pb2.RepeatedEnum_Color{pb2.RepeatedEnum_RED}, + } + if !proto.Equal(pb, exp) { + t.Errorf("proto.Equal mismatch:\ngot: %v\nwant %v", pb, exp) + } +} + +func TestProto3TextParsing(t *testing.T) { + m := new(pb3.Message) + const in = `name: "Wallace" true_scotsman: true` + want := &pb3.Message{ + Name: "Wallace", + TrueScotsman: true, + } + if err := proto.UnmarshalText(in, m); err != nil { + t.Fatal(err) + } + if !proto.Equal(m, want) { + t.Errorf("proto.Equal mismatch:\ngot: %v\nwant %v", m, want) + } +} + +func TestMapParsing(t *testing.T) { + m := new(pb2.MessageWithMap) + const in = `name_mapping: name_mapping:` + + `msg_mapping:,>` + // separating commas are okay + `msg_mapping>` + // no colon after "value" + `msg_mapping:>` + // omitted key + `byte_mapping:` + + `byte_mapping:<>` // omitted key and value + want := &pb2.MessageWithMap{ + NameMapping: map[int32]string{ + 1: "Beatles", + 1234: "Feist", + }, + MsgMapping: map[int64]*pb2.FloatingPoint{ + -4: {F: proto.Float64(2.0)}, + -2: {F: proto.Float64(4.0)}, + 0: {F: proto.Float64(5.0)}, + }, + ByteMapping: map[bool][]byte{ + false: nil, + true: []byte("so be it"), + }, + } + if err := proto.UnmarshalText(in, m); err != nil { + t.Fatal(err) + } + if !proto.Equal(m, want) { + t.Errorf("proto.Equal mismatch:\ngot: %v\nwant %v", m, want) + } +} + +func TestOneofParsing(t *testing.T) { + const in = `name:"Shrek"` + m := new(pb2.Communique) + want := &pb2.Communique{Union: &pb2.Communique_Name{"Shrek"}} + if err := proto.UnmarshalText(in, m); err != nil { + t.Fatal(err) + } + if !proto.Equal(m, want) { + t.Errorf("\n got %v\nwant %v", m, want) + } + + const inOverwrite = `name:"Shrek" number:42` + m = new(pb2.Communique) + testErr := "line 1.13: field 'number' would overwrite already parsed oneof 'union'" + if err := proto.UnmarshalText(inOverwrite, m); err == nil { + t.Errorf("proto.UnmarshalText: got nil error, want %v", testErr) + } else if err.Error() != testErr { + t.Errorf("error mismatch:\ngot: %v\nwant: %v", err.Error(), testErr) + } +} From d8aac26686d2a6af7ec0d19d35ef1f20437208eb Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 20 Feb 2020 15:20:42 -0800 Subject: [PATCH 101/133] proto, jsonpb: fix handling of extensions Check whether the parsed extension type actually matches the target message type. Change-Id: Ib21226b0bc217e33ebf56a1961ebc20732b5c64e Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220438 Reviewed-by: Damien Neil --- jsonpb/decode.go | 3 +++ jsonpb/json_test.go | 2 ++ proto/text_decode.go | 3 +++ proto/text_test.go | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/jsonpb/decode.go b/jsonpb/decode.go index 22c8eca744..dd18be8463 100644 --- a/jsonpb/decode.go +++ b/jsonpb/decode.go @@ -361,6 +361,9 @@ func (u *Unmarshaler) unmarshalMessage(m protoreflect.Message, in []byte) error } delete(jsonObject, name) fd := xt.TypeDescriptor() + if fd.ContainingMessage().FullName() != m.Descriptor().FullName() { + return fmt.Errorf("extension field %q does not extend message %q", xname, m.Descriptor().FullName()) + } // Unmarshal the field value. if raw == nil || (string(raw) == "null" && !isSingularWellKnownValue(fd)) { diff --git a/jsonpb/json_test.go b/jsonpb/json_test.go index 027a2289ee..15eed25873 100644 --- a/jsonpb/json_test.go +++ b/jsonpb/json_test.go @@ -910,6 +910,8 @@ var unmarshalingShouldError = []struct { {"StringValue containing invalid character", `{"str": "\U00004E16\U0000754C"}`, &pb2.KnownTypes{}}, {"StructValue containing invalid character", `{"str": "\U00004E16\U0000754C"}`, &stpb.Struct{}}, {"repeated proto3 enum with non array input", `{"rFunny":"PUNS"}`, &pb3.Message{RFunny: []pb3.Message_Humour{}}}, + {"unknown extension field", `{"[ext_unknown]": "value"}`, &pb2.Real{}}, + {"extension field for wrong message", `{"[jsonpb_test.name]": "value"}`, &pb2.Complex{}}, } func TestUnmarshalingBadInput(t *testing.T) { diff --git a/proto/text_decode.go b/proto/text_decode.go index a8ea634c6c..6216513db5 100644 --- a/proto/text_decode.go +++ b/proto/text_decode.go @@ -236,6 +236,9 @@ func (p *textParser) unmarshalExtensionOrAny(m protoreflect.Message, seen map[pr return p.errorf("unrecognized extension %q", name) } fd := xt.TypeDescriptor() + if fd.ContainingMessage().FullName() != m.Descriptor().FullName() { + return p.errorf("extension field %q does not extend message %q", name, m.Descriptor().FullName()) + } if err := p.checkForColon(fd); err != nil { return err diff --git a/proto/text_test.go b/proto/text_test.go index 343f93af5f..3f6edc5a6f 100644 --- a/proto/text_test.go +++ b/proto/text_test.go @@ -1196,6 +1196,10 @@ var unmarshalTextTests = []UnmarshalTextTest{ buildExtStructTest(`count: 42 [proto2_test.Ext.more] {data:"Hello, world!"}`), buildExtDataTest(`count: 42 [proto2_test.Ext.text]:"Hello, world!" [proto2_test.Ext.number]:1729`), buildExtRepStringTest(`count: 42 [proto2_test.greeting]:"bula" [proto2_test.greeting]:"hola"`), + { + in: `[proto2_test.complex]:<>`, + err: `line 1.20: extension field "proto2_test.complex" does not extend message "proto2_test.MyMessage"`, + }, // Big all-in-one { From ad065b88f3ffff9a94ff16d0ed5c9710472ea4c0 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 21 Feb 2020 18:41:30 -0800 Subject: [PATCH 102/133] ptypes: UnmarshalAny with non-pointer DynamicMessage Unfortunately, both DynamicMessage and *DynamicMessage implement the proto.Message interface. Check for both. Change-Id: I4d645fe5019f44b3ba349f731d1cbdcea481dffe Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220505 Reviewed-by: Damien Neil --- ptypes/any.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ptypes/any.go b/ptypes/any.go index 055379eec3..9e0f110852 100644 --- a/ptypes/any.go +++ b/ptypes/any.go @@ -40,7 +40,13 @@ func anyMessageName(any *anypb.Any) (protoreflect.FullName, error) { // MarshalAny marshals the given message m into an anypb.Any message. func MarshalAny(m proto.Message) (*anypb.Any, error) { - if dm, ok := m.(*DynamicAny); ok { + switch dm := m.(type) { + case DynamicAny: + m = dm.Message + case *DynamicAny: + if dm == nil { + return nil, proto.ErrNil + } m = dm.Message } b, err := proto.Marshal(m) From 97960cd98aee74e5ceaec3963ee918556634be06 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 24 Feb 2020 19:54:57 -0800 Subject: [PATCH 103/133] jsonpb: use CheckInitialized Change-Id: Id2ba5826577960f283a90a766435353e6399c060 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220687 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 +++- jsonpb/decode.go | 2 +- jsonpb/encode.go | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 4872926902..3e995cfcea 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.9 require ( github.com/google/go-cmp v0.4.0 - google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64 + google.golang.org/protobuf v0.0.0-20200224223749-2dabbe471100 ) diff --git a/go.sum b/go.sum index e5a2e4eb89..4578aaf15d 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,5 @@ 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/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 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= @@ -6,5 +7,6 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64 h1:BhpvsYSxWvxATQJYrD9UKX1U3jo+Bxq195IzJGtyh40= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200224223749-2dabbe471100 h1:i1uRQ2Eod1FWX6jGO/l8K0oMIwtCWeEmeDtLy5YABYc= +google.golang.org/protobuf v0.0.0-20200224223749-2dabbe471100/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/jsonpb/decode.go b/jsonpb/decode.go index dd18be8463..492b8c1c44 100644 --- a/jsonpb/decode.go +++ b/jsonpb/decode.go @@ -128,7 +128,7 @@ func (u *Unmarshaler) UnmarshalNext(d *json.Decoder, m proto.Message) error { if err := u.unmarshalMessage(mr, raw); err != nil { return err } - return protoV2.IsInitialized(mr.Interface()) + return protoV2.CheckInitialized(mr.Interface()) } } diff --git a/jsonpb/encode.go b/jsonpb/encode.go index 72b48ea296..3cb4a68efc 100644 --- a/jsonpb/encode.go +++ b/jsonpb/encode.go @@ -109,7 +109,7 @@ func (jm *Marshaler) marshal(m proto.Message) ([]byte, error) { } else { // Check for unpopulated required fields first. m2 := protoimpl.X.MessageOf(m) - if err := protoV2.IsInitialized(m2.Interface()); err != nil { + if err := protoV2.CheckInitialized(m2.Interface()); err != nil { return nil, err } From b1b17f0eadee185d441c79cb7a753e0c6c7c8aa5 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 14 Feb 2020 17:32:46 -0800 Subject: [PATCH 104/133] all: cleanup protoimpl calls Use MessageV1, MessageV2, and MessageReflect directly. Change-Id: Ifb44e2cc2dcb52a44894b52d2e932558e275aecd Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/219558 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 ++-- jsonpb/decode.go | 9 ++++----- jsonpb/encode.go | 9 ++++----- proto/buffer.go | 2 +- proto/defaults.go | 3 +-- proto/discard.go | 3 +-- proto/extensions.go | 16 ++++++++-------- proto/proto.go | 24 +++--------------------- proto/registry.go | 2 +- proto/text_decode.go | 3 +-- proto/text_encode.go | 3 +-- proto/wire.go | 7 +++---- ptypes/any.go | 7 +++---- 14 files changed, 34 insertions(+), 60 deletions(-) diff --git a/go.mod b/go.mod index 3e995cfcea..55179c0c26 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.9 require ( github.com/google/go-cmp v0.4.0 - google.golang.org/protobuf v0.0.0-20200224223749-2dabbe471100 + google.golang.org/protobuf v0.0.0-20200225203307-f6cf4925a90e ) diff --git a/go.sum b/go.sum index 4578aaf15d..243c0224b0 100644 --- a/go.sum +++ b/go.sum @@ -8,5 +8,5 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IV golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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-20200224223749-2dabbe471100 h1:i1uRQ2Eod1FWX6jGO/l8K0oMIwtCWeEmeDtLy5YABYc= -google.golang.org/protobuf v0.0.0-20200224223749-2dabbe471100/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v0.0.0-20200225203307-f6cf4925a90e h1:wrJFqPhiw6ByHbcNMcv/+6kk7HQLewtkSxANqkwtQ/0= +google.golang.org/protobuf v0.0.0-20200225203307-f6cf4925a90e/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/jsonpb/decode.go b/jsonpb/decode.go index 492b8c1c44..6faa5fe5de 100644 --- a/jsonpb/decode.go +++ b/jsonpb/decode.go @@ -20,7 +20,6 @@ import ( protoV2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoimpl" ) const wrapJSONUnmarshalV2 = false @@ -87,7 +86,7 @@ func (u *Unmarshaler) UnmarshalNext(d *json.Decoder, m proto.Message) error { return jsu.UnmarshalJSONPB(u, raw) } - mr := protoimpl.X.MessageOf(m) + mr := proto.MessageReflect(m) // NOTE: For historical reasons, a top-level null is treated as a noop. // This is incorrect, but kept for compatibility. @@ -109,7 +108,7 @@ func (u *Unmarshaler) UnmarshalNext(d *json.Decoder, m proto.Message) error { mr = mr.New() // Use a defer to copy all unmarshaled fields into the original message. - dst := protoimpl.X.MessageOf(m) + dst := proto.MessageReflect(m) defer mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { dst.Set(fd, v) return true @@ -140,7 +139,7 @@ func (u *Unmarshaler) unmarshalMessage(m protoreflect.Message, in []byte) error return nil } - if jsu, ok := protoimpl.X.ProtoMessageV1Of(m.Interface()).(JSONPBUnmarshaler); ok { + if jsu, ok := proto.MessageV1(m.Interface()).(JSONPBUnmarshaler); ok { return jsu.UnmarshalJSONPB(u, in) } @@ -167,7 +166,7 @@ func (u *Unmarshaler) unmarshalMessage(m protoreflect.Message, in []byte) error if err != nil { return err } - m2 = protoimpl.X.MessageOf(mi) + m2 = proto.MessageReflect(mi) } else { mt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL) if err != nil { diff --git a/jsonpb/encode.go b/jsonpb/encode.go index 3cb4a68efc..c5b80bc8fd 100644 --- a/jsonpb/encode.go +++ b/jsonpb/encode.go @@ -21,7 +21,6 @@ import ( protoV2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoimpl" ) const wrapJSONMarshalV2 = false @@ -105,10 +104,10 @@ func (jm *Marshaler) marshal(m proto.Message) ([]byte, error) { if jm.AnyResolver != nil { opts.Resolver = anyResolver{jm.AnyResolver} } - return opts.Marshal(protoimpl.X.MessageOf(m).Interface()) + return opts.Marshal(proto.MessageReflect(m).Interface()) } else { // Check for unpopulated required fields first. - m2 := protoimpl.X.MessageOf(m) + m2 := proto.MessageReflect(m) if err := protoV2.CheckInitialized(m2.Interface()); err != nil { return nil, err } @@ -129,7 +128,7 @@ func (w *jsonWriter) write(s string) { } func (w *jsonWriter) marshalMessage(m protoreflect.Message, indent, typeURL string) error { - if jsm, ok := protoimpl.X.ProtoMessageV1Of(m.Interface()).(JSONPBMarshaler); ok { + if jsm, ok := proto.MessageV1(m.Interface()).(JSONPBMarshaler); ok { b, err := jsm.MarshalJSONPB(w.Marshaler) if err != nil { return err @@ -321,7 +320,7 @@ func (w *jsonWriter) marshalAny(m protoreflect.Message, indent string) error { if err != nil { return err } - m2 = protoimpl.X.MessageOf(mi) + m2 = proto.MessageReflect(mi) } else { mt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL) if err != nil { diff --git a/proto/buffer.go b/proto/buffer.go index e61a675773..9aae5bccca 100644 --- a/proto/buffer.go +++ b/proto/buffer.go @@ -130,7 +130,7 @@ 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 := protoimpl.X.MessageOf(new(unknownFields)) + 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) diff --git a/proto/defaults.go b/proto/defaults.go index 1c3a27efbf..d399bf069c 100644 --- a/proto/defaults.go +++ b/proto/defaults.go @@ -6,7 +6,6 @@ package proto import ( "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoimpl" ) // SetDefaults sets unpopulated scalar fields to their default values. @@ -14,7 +13,7 @@ import ( // SetDefaults is recursively called upon any populated message fields. func SetDefaults(m Message) { if m != nil { - setDefaults(protoimpl.X.MessageOf(m)) + setDefaults(MessageReflect(m)) } } diff --git a/proto/discard.go b/proto/discard.go index 7c82e0241f..2187e877fa 100644 --- a/proto/discard.go +++ b/proto/discard.go @@ -6,7 +6,6 @@ package proto import ( "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoimpl" ) // DiscardUnknown recursively discards all unknown fields from this message @@ -19,7 +18,7 @@ import ( // explicitly clear the unknown fields after unmarshaling. func DiscardUnknown(m Message) { if m != nil { - discardUnknown(protoimpl.X.MessageOf(m)) + discardUnknown(MessageReflect(m)) } } diff --git a/proto/extensions.go b/proto/extensions.go index 53abf45c0d..d78d25830c 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -43,7 +43,7 @@ var errNotExtendable = errors.New("proto: not an extendable proto.Message") // 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 := protoimpl.X.MessageOf(m) + mr := MessageReflect(m) if mr == nil || !mr.IsValid() { return false } @@ -71,7 +71,7 @@ func HasExtension(m Message, xt *ExtensionDesc) (has bool) { // 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 := protoimpl.X.MessageOf(m) + mr := MessageReflect(m) if mr == nil || !mr.IsValid() { return } @@ -94,7 +94,7 @@ func ClearExtension(m Message, xt *ExtensionDesc) { // ClearAllExtensions clears all extensions from m. // This includes populated fields and unknown fields in the extension range. func ClearAllExtensions(m Message) { - mr := protoimpl.X.MessageOf(m) + mr := MessageReflect(m) if mr == nil || !mr.IsValid() { return } @@ -118,7 +118,7 @@ func ClearAllExtensions(m Message) { // 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 := protoimpl.X.MessageOf(m) + mr := MessageReflect(m) if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { return nil, errNotExtendable } @@ -200,7 +200,7 @@ func (r extensionResolver) FindExtensionByNumber(message protoreflect.FullName, // corresponding with the provided list of extension descriptors, xts. // If an extension is missing in m, the corresponding value is nil. func GetExtensions(m Message, xts []*ExtensionDesc) ([]interface{}, error) { - mr := protoimpl.X.MessageOf(m) + mr := MessageReflect(m) if mr == nil || !mr.IsValid() { return nil, errNotExtendable } @@ -221,7 +221,7 @@ func GetExtensions(m Message, xts []*ExtensionDesc) ([]interface{}, error) { // SetExtension sets an extension field in m to the provided value. func SetExtension(m Message, xt *ExtensionDesc, v interface{}) error { - mr := protoimpl.X.MessageOf(m) + mr := MessageReflect(m) if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { return errNotExtendable } @@ -252,7 +252,7 @@ func SetExtension(m Message, xt *ExtensionDesc, v interface{}) error { // // Deprecated: Use Message.ProtoReflect.SetUnknown instead. func SetRawExtension(m Message, fnum int32, b []byte) { - mr := protoimpl.X.MessageOf(m) + mr := MessageReflect(m) if mr == nil || !mr.IsValid() { return } @@ -277,7 +277,7 @@ func SetRawExtension(m Message, fnum int32, b []byte) { // the ExtensionDesc.Field field is populated. // The order of the extension descriptors is undefined. func ExtensionDescs(m Message) ([]*ExtensionDesc, error) { - mr := protoimpl.X.MessageOf(m) + mr := MessageReflect(m) if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { return nil, errNotExtendable } diff --git a/proto/proto.go b/proto/proto.go index 02c620ed5f..5aee89c323 100644 --- a/proto/proto.go +++ b/proto/proto.go @@ -127,14 +127,7 @@ func checkRequiredNotSet(m protoV2.Message) error { // Clone returns a deep copy of src. func Clone(src Message) Message { - srcMsg := protoimpl.X.MessageOf(src) - if srcMsg == nil || !srcMsg.IsValid() { - return src - } - - dst := protoimpl.X.ProtoMessageV1Of(srcMsg.New().Interface()) - Merge(dst, src) - return dst + return MessageV1(protoV2.Clone(MessageV2(src))) } // Merge merges src into dst, which must be messages of the same type. @@ -146,15 +139,7 @@ func Clone(src Message) Message { // the corresponding map field in dst, possibly replacing existing entries. // The unknown fields of src are appended to the unknown fields of dst. func Merge(dst, src Message) { - // TODO: Drop this type assertion if the aberrant wrapper in v2 calls this. - if m, ok := dst.(Merger); ok { - m.Merge(src) - return - } - protoV2.Merge( - protoimpl.X.ProtoMessageV2Of(dst), - protoimpl.X.ProtoMessageV2Of(src), - ) + protoV2.Merge(MessageV2(dst), MessageV2(src)) } // Equal reports whether two messages are equal. @@ -173,10 +158,7 @@ func Merge(dst, src Message) { // Maps are equal if they have the same set of keys, where the pair of values // for each key is also equal. func Equal(x, y Message) bool { - return protoV2.Equal( - protoimpl.X.ProtoMessageV2Of(x), - protoimpl.X.ProtoMessageV2Of(y), - ) + return protoV2.Equal(MessageV2(x), MessageV2(y)) } func isMessageSet(md protoreflect.MessageDescriptor) bool { diff --git a/proto/registry.go b/proto/registry.go index 8c927ae3c6..abab110a06 100644 --- a/proto/registry.go +++ b/proto/registry.go @@ -261,7 +261,7 @@ func enumGoType(et protoreflect.EnumType) reflect.Type { } func messageGoType(mt protoreflect.MessageType) reflect.Type { - return reflect.TypeOf(protoimpl.X.ProtoMessageV1Of(mt.New().Interface())) + return reflect.TypeOf(MessageV1(mt.Zero().Interface())) } // MessageName returns the full protobuf name for the given message type. diff --git a/proto/text_decode.go b/proto/text_decode.go index 6216513db5..4a59310098 100644 --- a/proto/text_decode.go +++ b/proto/text_decode.go @@ -17,7 +17,6 @@ import ( protoV2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoimpl" ) const wrapTextUnmarshalV2 = false @@ -47,7 +46,7 @@ func UnmarshalText(s string, m Message) error { } m.Reset() - mi := protoimpl.X.ProtoMessageV2Of(m) + mi := MessageV2(m) if wrapTextUnmarshalV2 { err := prototext.UnmarshalOptions{ diff --git a/proto/text_encode.go b/proto/text_encode.go index 31f906d138..e2a0ad30ca 100644 --- a/proto/text_encode.go +++ b/proto/text_encode.go @@ -18,7 +18,6 @@ import ( "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoimpl" ) const wrapTextMarshalV2 = false @@ -47,7 +46,7 @@ func (tm *TextMarshaler) Text(m Message) string { } func (tm *TextMarshaler) marshal(m Message) ([]byte, error) { - mr := protoimpl.X.MessageOf(m) + mr := MessageReflect(m) if mr == nil || !mr.IsValid() { return []byte(""), nil } diff --git a/proto/wire.go b/proto/wire.go index 5e8b7ac0d5..57abb57997 100644 --- a/proto/wire.go +++ b/proto/wire.go @@ -7,7 +7,6 @@ package proto import ( protoV2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/runtime/protoiface" - "google.golang.org/protobuf/runtime/protoimpl" ) // Size returns the size in bytes of the wire-format encoding of m. @@ -15,7 +14,7 @@ func Size(m Message) int { if m == nil { return 0 } - mi := protoimpl.X.ProtoMessageV2Of(m) + mi := MessageV2(m) return protoV2.Size(mi) } @@ -34,7 +33,7 @@ func marshalAppend(buf []byte, m Message, deterministic bool) ([]byte, error) { if m == nil { return nil, ErrNil } - mi := protoimpl.X.ProtoMessageV2Of(m) + mi := MessageV2(m) nbuf, err := protoV2.MarshalOptions{ Deterministic: deterministic, AllowPartial: true, @@ -61,7 +60,7 @@ func Unmarshal(b []byte, m Message) error { // UnmarshalMerge parses a wire-format message in b and places the decoded results in m. func UnmarshalMerge(b []byte, m Message) error { - mi := protoimpl.X.ProtoMessageV2Of(m) + mi := MessageV2(m) out, err := protoV2.UnmarshalOptions{ AllowPartial: true, Merge: true, diff --git a/ptypes/any.go b/ptypes/any.go index 9e0f110852..e729dcff13 100644 --- a/ptypes/any.go +++ b/ptypes/any.go @@ -11,7 +11,6 @@ import ( "github.com/golang/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoimpl" anypb "github.com/golang/protobuf/ptypes/any" ) @@ -68,7 +67,7 @@ func Empty(any *anypb.Any) (proto.Message, error) { if err != nil { return nil, err } - return protoimpl.X.ProtoMessageV1Of(mt.New().Interface()), nil + return proto.MessageV1(mt.New().Interface()), nil } // UnmarshalAny unmarshals the encoded value contained in the anypb.Any message @@ -141,7 +140,7 @@ func (m DynamicAny) ProtoReflect() protoreflect.Message { if m.Message == nil { return nil } - return dynamicAny{protoimpl.X.MessageOf(m.Message)} + return dynamicAny{proto.MessageReflect(m.Message)} } type dynamicAny struct{ protoreflect.Message } @@ -153,7 +152,7 @@ func (m dynamicAny) New() protoreflect.Message { return dynamicAnyType{m.Message.Type()}.New() } func (m dynamicAny) Interface() protoreflect.ProtoMessage { - return DynamicAny{protoimpl.X.ProtoMessageV1Of(m.Message.Interface())} + return DynamicAny{proto.MessageV1(m.Message.Interface())} } type dynamicAnyType struct{ protoreflect.MessageType } From c343881f725a78fca52c6b0e4ed57a87ef020185 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 26 Feb 2020 11:26:04 -0800 Subject: [PATCH 105/133] CONTRIBUTING.md: swap revision with version The use of "revision" makes no sense for the first version since it wasn't "revised" from anything. Nothing existed prior. Change-Id: Ie82a03a3786e0ce7261a89032d2d3ebb12dcf4c0 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/221025 Reviewed-by: Damien Neil --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 55e070108e..83971cbbfe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ Go protocol buffers is an open source project and accepts contributions. -This project is the first major revision of Go protobufs, +This project is the first major version of Go protobufs, while the next major revision of this project is located at [protocolbuffers/protobuf-go](https://github.com/protocolbuffers/protobuf-go). Most new development effort is focused on the latter project, From d935ec2d8651dd42483870c22889d3eb4fa3e35f Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 24 Feb 2020 14:46:24 -0800 Subject: [PATCH 106/133] all: update README.md Change-Id: I60d9ccf1685e2e30327b5a4daf3c65b540c51e88 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220679 Reviewed-by: Damien Neil --- README.md | 389 ++++++++++++++++-------------------------------------- 1 file changed, 113 insertions(+), 276 deletions(-) diff --git a/README.md b/README.md index 09e07728e2..4f4302c062 100644 --- a/README.md +++ b/README.md @@ -1,281 +1,118 @@ -# Go support for Protocol Buffers - Google's data interchange format +# Go support for Protocol Buffers +[![GoDev](https://img.shields.io/static/v1?label=godev&message=reference&color=00add8)](https://pkg.go.dev/mod/github.com/golang/protobuf) [![Build Status](https://travis-ci.org/golang/protobuf.svg?branch=master)](https://travis-ci.org/golang/protobuf) -[![GoDoc](https://godoc.org/github.com/golang/protobuf?status.svg)](https://godoc.org/github.com/golang/protobuf) -Google's data interchange format. -Copyright 2010 The Go Authors. -https://github.com/golang/protobuf - -This package and the code it generates requires at least Go 1.9. - -This software implements Go bindings for protocol buffers. For -information about protocol buffers themselves, see - https://developers.google.com/protocol-buffers/ - -## Installation ## - -To use this software, you must: -- Install the standard C++ implementation of protocol buffers from - https://developers.google.com/protocol-buffers/ -- Of course, install the Go compiler and tools from - https://golang.org/ - See - https://golang.org/doc/install - for details or, if you are using gccgo, follow the instructions at - https://golang.org/doc/install/gccgo -- Grab the code from the repository and install the proto package. - The simplest way is to run `go get -u github.com/golang/protobuf/protoc-gen-go`. - The compiler plugin, protoc-gen-go, will be installed in $GOBIN, - defaulting to $GOPATH/bin. It must be in your $PATH for the protocol - compiler, protoc, to find it. - -This software has two parts: a 'protocol compiler plugin' that -generates Go source files that, once compiled, can access and manage -protocol buffers; and a library that implements run-time support for -encoding (marshaling), decoding (unmarshaling), and accessing protocol -buffers. - -There is support for gRPC in Go using protocol buffers. -See the note at the bottom of this file for details. - -There are no insertion points in the plugin. - - -## Using protocol buffers with Go ## - -Once the software is installed, there are two steps to using it. -First you must compile the protocol buffer definitions and then import -them, with the support library, into your program. - -To compile the protocol buffer definition, run protoc with the --go_out -parameter set to the directory you want to output the Go code to. - - protoc --go_out=. *.proto - -The generated files will be suffixed .pb.go. See the Test code below -for an example using such a file. - -## Packages and input paths ## - -The protocol buffer language has a concept of "packages" which does not -correspond well to the Go notion of packages. In generated Go code, -each source `.proto` file is associated with a single Go package. The -name and import path for this package is specified with the `go_package` -proto option: - - option go_package = "github.com/golang/protobuf/ptypes/any"; - -The protocol buffer compiler will attempt to derive a package name and -import path if a `go_package` option is not present, but it is -best to always specify one explicitly. - -There is a one-to-one relationship between source `.proto` files and -generated `.pb.go` files, but any number of `.pb.go` files may be -contained in the same Go package. - -The output name of a generated file is produced by replacing the -`.proto` suffix with `.pb.go` (e.g., `foo.proto` produces `foo.pb.go`). -However, the output directory is selected in one of two ways. Let -us say we have `inputs/x.proto` with a `go_package` option of -`github.com/golang/protobuf/p`. The corresponding output file may -be: - -- Relative to the import path: - -```shell - protoc --go_out=. inputs/x.proto - # writes ./github.com/golang/protobuf/p/x.pb.go -``` - - (This can work well with `--go_out=$GOPATH`.) - -- Relative to the input file: - -```shell -protoc --go_out=paths=source_relative:. inputs/x.proto -# generate ./inputs/x.pb.go -``` - -## Generated code ## - -The package comment for the proto library contains text describing -the interface provided in Go for protocol buffers. Here is an edited -version. - -The proto package converts data structures to and from the -wire format of protocol buffers. It works in concert with the -Go source code generated for .proto files by the protocol compiler. - -A summary of the properties of the protocol buffer interface -for a protocol buffer variable v: - - - Names are turned from camel_case to CamelCase for export. - - There are no methods on v to set fields; just treat - them as structure fields. - - There are getters that return a field's value if set, - and return the field's default value if unset. - The getters work even if the receiver is a nil message. - - The zero value for a struct is its correct initialization state. - All desired fields must be set before marshaling. - - A Reset() method will restore a protobuf struct to its zero state. - - Non-repeated fields are pointers to the values; nil means unset. - That is, optional or required field int32 f becomes F *int32. - - Repeated fields are slices. - - Helper functions are available to aid the setting of fields. - Helpers for getting values are superseded by the - GetFoo methods and their use is deprecated. - msg.Foo = proto.String("hello") // set field - - Constants are defined to hold the default values of all fields that - have them. They have the form Default_StructName_FieldName. - Because the getter methods handle defaulted values, - direct use of these constants should be rare. - - Enums are given type names and maps from names to values. - Enum values are prefixed with the enum's type name. Enum types have - a String method, and a Enum method to assist in message construction. - - Nested groups and enums have type names prefixed with the name of - the surrounding message type. - - Extensions are given descriptor names that start with E_, - followed by an underscore-delimited list of the nested messages - that contain it (if any) followed by the CamelCased name of the - extension field itself. HasExtension, ClearExtension, GetExtension - and SetExtension are functions for manipulating extensions. - - Oneof field sets are given a single field in their message, - with distinguished wrapper types for each possible field value. - - Marshal and Unmarshal are functions to encode and decode the wire format. - -When the .proto file specifies `syntax="proto3"`, there are some differences: - - - Non-repeated fields of non-message type are values instead of pointers. - - Enum types do not get an Enum method. - -Consider file test.proto, containing - -```proto - syntax = "proto2"; - package example; - - enum FOO { X = 17; }; - - message Test { - required string label = 1; - optional int32 type = 2 [default=77]; - repeated int64 reps = 3; - } -``` - -To create and play with a Test object from the example package, - -```go - package main - - import ( - "log" - - "github.com/golang/protobuf/proto" - "path/to/example" - ) - - func main() { - test := &example.Test{ - Label: proto.String("hello"), - Type: proto.Int32(17), - Reps: []int64{1, 2, 3}, - } - data, err := proto.Marshal(test) - if err != nil { - log.Fatal("marshaling error: ", err) - } - newTest := &example.Test{} - err = proto.Unmarshal(data, newTest) - if err != nil { - log.Fatal("unmarshaling error: ", err) - } - // Now test and newTest contain the same data. - if test.GetLabel() != newTest.GetLabel() { - log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel()) - } - // etc. - } -``` - -## Parameters ## - -To pass extra parameters to the plugin, use a comma-separated -parameter list separated from the output directory by a colon: - - protoc --go_out=plugins=grpc,import_path=mypackage:. *.proto - -- `paths=(import | source_relative)` - specifies how the paths of - generated files are structured. See the "Packages and imports paths" - section above. The default is `import`. -- `plugins=plugin1+plugin2` - specifies the list of sub-plugins to - load. The only plugin in this repo is `grpc`. -- `Mfoo/bar.proto=quux/shme` - declares that foo/bar.proto is - associated with Go package quux/shme. This is subject to the - import_prefix parameter. - -The following parameters are deprecated and should not be used: - -- `import_prefix=xxx` - a prefix that is added onto the beginning of - all imports. -- `import_path=foo/bar` - used as the package if no input files - declare `go_package`. If it contains slashes, everything up to the - rightmost slash is ignored. - -## gRPC Support ## - -If a proto file specifies RPC services, protoc-gen-go can be instructed to -generate code compatible with gRPC (http://www.grpc.io/). To do this, pass -the `plugins` parameter to protoc-gen-go; the usual way is to insert it into -the --go_out argument to protoc: - - protoc --go_out=plugins=grpc:. *.proto - -## Compatibility ## - -The library and the generated code are expected to be stable over time. -However, we reserve the right to make breaking changes without notice for the -following reasons: - -- Security. A security issue in the specification or implementation may come to - light whose resolution requires breaking compatibility. We reserve the right - to address such security issues. -- Unspecified behavior. There are some aspects of the Protocol Buffers - specification that are undefined. Programs that depend on such unspecified - behavior may break in future releases. -- Specification errors or changes. If it becomes necessary to address an - inconsistency, incompleteness, or change in the Protocol Buffers - specification, resolving the issue could affect the meaning or legality of - existing programs. We reserve the right to address such issues, including - updating the implementations. -- Bugs. If the library has a bug that violates the specification, a program - that depends on the buggy behavior may break if the bug is fixed. We reserve - the right to fix such bugs. -- Adding methods or fields to generated structs. These may conflict with field - names that already exist in a schema, causing applications to break. When the - code generator encounters a field in the schema that would collide with a - generated field or method name, the code generator will append an underscore - to the generated field or method name. -- Adding, removing, or changing methods or fields in generated structs that - start with `XXX`. These parts of the generated code are exported out of - necessity, but should not be considered part of the public API. -- Adding, removing, or changing unexported symbols in generated code. +This module +([`github.com/golang/protobuf`](https://pkg.go.dev/mod/github.com/golang/protobuf)) +contains Go bindings for protocol buffers. + +It has been superseded by the +[`google.golang.org/protobuf`](https://pkg.go.dev/mod/google.golang.org/protobuf) +module, which contains an updated and simplified API, +support for protobuf reflection, and many other improvements. +We recommend that new code use the `google.golang.org/protobuf` module. + +Versions v1.4 and later of `github.com/golang/protobuf` are implemented +in terms of `google.golang.org/protobuf`. +Programs which use both modules should use at least version v1.4 of this one. + +See +[release note documentation](https://github.com/golang/protobuf/releases) +for more information about individual releases of this project. + +See +[documentation for the next major revision](https://pkg.go.dev/mod/google.golang.org/protobuf) +for more information about the purpose, usage, and history of this project. + +## Package index + +Summary of the packages provided by this module: + +* [`proto`](https://pkg.go.dev/github.com/golang/protobuf/proto): Package + `proto` provides functions operating on protobuf messages such as cloning, + merging, and checking equality, as well as binary serialization and text + serialization. +* [`jsonpb`](https://pkg.go.dev/github.com/golang/protobuf/jsonpb): Package + `jsonpb` serializes protobuf messages as JSON. +* [`ptypes`](https://pkg.go.dev/github.com/golang/protobuf/ptypes): Package + `ptypes` provides helper functionality for protobuf well-known types. +* [`ptypes/any`](https://pkg.go.dev/github.com/golang/protobuf/ptypes/any): + Package `any` is the generated package for `google/protobuf/any.proto`. +* [`ptypes/empty`](https://pkg.go.dev/github.com/golang/protobuf/ptypes/empty): + Package `empty` is the generated package for `google/protobuf/empty.proto`. +* [`ptypes/timestamp`](https://pkg.go.dev/github.com/golang/protobuf/ptypes/timestamp): + Package `timestamp` is the generated package for + `google/protobuf/timestamp.proto`. +* [`ptypes/duration`](https://pkg.go.dev/github.com/golang/protobuf/ptypes/duration): + Package `duration` is the generated package for + `google/protobuf/duration.proto`. +* [`ptypes/wrappers`](https://pkg.go.dev/github.com/golang/protobuf/ptypes/wrappers): + Package `wrappers` is the generated package for + `google/protobuf/wrappers.proto`. +* [`ptypes/struct`](https://pkg.go.dev/github.com/golang/protobuf/ptypes/struct): + Package `struct` is the generated package for + `google/protobuf/struct.proto`. +* [`protoc-gen-go/descriptor`](https://pkg.go.dev/github.com/golang/protobuf/protoc-gen-go/descriptor): + Package `descriptor` is the generated package for + `google/protobuf/descriptor.proto`. +* [`protoc-gen-go/plugin`](https://pkg.go.dev/github.com/golang/protobuf/protoc-gen-go/plugin): + Package `plugin` is the generated package for + `google/protobuf/compiler/plugin.proto`. +* [`protoc-gen-go`](https://pkg.go.dev/github.com/golang/protobuf/protoc-gen-go): + The `protoc-gen-go` binary is a protoc plugin to generate a Go protocol + buffer package. + +## Reporting issues + +The issue tracker for this project +[is located here](https://github.com/golang/protobuf/issues). + +Please report any issues with a sufficient description of the bug or feature +request. Bug reports should ideally be accompanied by a minimal reproduction of +the issue. Irreproducible bugs are difficult to diagnose and fix (and likely to +be closed after some period of time). Bug reports must specify the version of +the +[Go protocol buffer module](https://github.com/protocolbuffers/protobuf-go/releases) +and also the version of the +[protocol buffer toolchain](https://github.com/protocolbuffers/protobuf/releases) +being used. + +## Contributing + +This project is open-source and accepts contributions. See the +[contribution guide](https://github.com/golang/protobuf/blob/master/CONTRIBUTING.md) +for more information. + +## Compatibility + +This module and the generated code are expected to be stable over time. However, +we reserve the right to make breaking changes without notice for the following +reasons: + +* **Security:** A security issue in the specification or implementation may + come to light whose resolution requires breaking compatibility. We reserve + the right to address such issues. +* **Unspecified behavior:** There are some aspects of the protocol buffer + specification that are undefined. Programs that depend on unspecified + behavior may break in future releases. +* **Specification changes:** It may become necessary to address an + inconsistency, incompleteness, or change in the protocol buffer + specification, which may affect the behavior of existing programs. We + reserve the right to address such changes. +* **Bugs:** If a package has a bug that violates correctness, a program + depending on the buggy behavior may break if the bug is fixed. We reserve + the right to fix such bugs. +* **Generated additions**: We reserve the right to add new declarations to + generated Go packages of `.proto` files. This includes declared constants, + variables, functions, types, fields in structs, and methods on types. This + may break attempts at injecting additional code on top of what is generated + by `protoc-gen-go`. Such practice is not supported by this project. +* **Internal changes**: We reserve the right to add, modify, and remove + internal code, which includes all unexported declarations, the + [`generator`](https://pkg.go.dev/github.com/golang/protobuf/protoc-gen-go/generator) + package, and all packages under + [`internal`](https://pkg.go.dev/github.com/golang/protobuf/internal). Any breaking changes outside of these will be announced 6 months in advance to -protobuf@googlegroups.com. - -You should, whenever possible, use generated code created by the `protoc-gen-go` -tool built at the same commit as the `proto` package. The `proto` package -declares package-level constants in the form `ProtoPackageIsVersionX`. -Application code and generated code may depend on one of these constants to -ensure that compilation will fail if the available version of the proto library -is too old. Whenever we make a change to the generated code that requires newer -library support, in the same commit we will increment the version number of the -generated code and declare a new package-level constant whose name incorporates -the latest version number. Removing a compatibility constant is considered a -breaking change and would be subject to the announcement policy stated above. - -The `protoc-gen-go/generator` package exposes a plugin interface, -which is used by the gRPC code generation. This interface is not -supported and is subject to incompatible changes without notice. +[protobuf@googlegroups.com](https://groups.google.com/forum/#!forum/protobuf). From a3619c1acae2c674b494328ff4dd53c8ba0590dc Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 28 Feb 2020 15:09:43 -0800 Subject: [PATCH 107/133] all: use new protogen options API Change-Id: Ib7ef4f9e8a6b7ada1f0cba4ae706be9fb8f7a10c Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/221559 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 4 ++-- internal/cmd/generate-alias/main.go | 2 +- protoc-gen-go/main.go | 5 ++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 55179c0c26..e1eed6300c 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.9 require ( github.com/google/go-cmp v0.4.0 - google.golang.org/protobuf v0.0.0-20200225203307-f6cf4925a90e + google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60 ) diff --git a/go.sum b/go.sum index 243c0224b0..39d32d0b45 100644 --- a/go.sum +++ b/go.sum @@ -8,5 +8,5 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IV golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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-20200225203307-f6cf4925a90e h1:wrJFqPhiw6ByHbcNMcv/+6kk7HQLewtkSxANqkwtQ/0= -google.golang.org/protobuf v0.0.0-20200225203307-f6cf4925a90e/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60 h1:qkfzMNEf79BNs1//mQGZjYHIXAOv+AOdvPnMsU6R+1I= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/internal/cmd/generate-alias/main.go b/internal/cmd/generate-alias/main.go index 5c64f1929f..dc25e1a041 100644 --- a/internal/cmd/generate-alias/main.go +++ b/internal/cmd/generate-alias/main.go @@ -82,7 +82,7 @@ func main() { } // Use the internal logic of protoc-gen-go to generate the files. - gen, err := protogen.New(&req, nil) + gen, err := protogen.Options{}.New(&req) check(err) for _, file := range gen.Files { if file.Generate { diff --git a/protoc-gen-go/main.go b/protoc-gen-go/main.go index b06a713fd3..7515a18b00 100644 --- a/protoc-gen-go/main.go +++ b/protoc-gen-go/main.go @@ -45,11 +45,10 @@ func main() { } return importPath } - opts := &protogen.Options{ + protogen.Options{ ParamFunc: flags.Set, ImportRewriteFunc: importRewriteFunc, - } - protogen.Run(opts, func(gen *protogen.Plugin) error { + }.Run(func(gen *protogen.Plugin) error { grpc := false for _, plugin := range strings.Split(*plugins, ",") { switch plugin { From 3f90b7282e85d414c90d9b74f8a15dcd89ea8421 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Mon, 2 Mar 2020 11:41:01 -0800 Subject: [PATCH 108/133] all: use google.golang.org/protobuf v1.20.0 Change-Id: Ib6c3a09e41548008897bacd54aa8fc6939ea8350 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/221786 Reviewed-by: Herbie Ong --- go.mod | 2 +- go.sum | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index e1eed6300c..9fa6937e40 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.9 require ( github.com/google/go-cmp v0.4.0 - google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60 + google.golang.org/protobuf v1.20.0 ) diff --git a/go.sum b/go.sum index 39d32d0b45..dab7d0bd2f 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,6 @@ 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/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 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= @@ -10,3 +11,5 @@ google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLY google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60 h1:qkfzMNEf79BNs1//mQGZjYHIXAOv+AOdvPnMsU6R+1I= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.0 h1:SsQNHvKpk2VTiWoQ5Pqkt3Go/c2ly77C+v2Lggu5Qek= +google.golang.org/protobuf v1.20.0/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= From 7bd8073ff04aed15560d5a400a4d9bccda3dc2e0 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 9 Mar 2020 12:10:45 -0700 Subject: [PATCH 109/133] proto: use fixed UnmarshalState API Change-Id: I08abfaed1bafd0d650988883be31faefbd312331 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/222679 Reviewed-by: Damien Neil --- go.mod | 2 +- go.sum | 5 ++--- proto/wire.go | 5 +++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 9fa6937e40..9fb4ade071 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.9 require ( github.com/google/go-cmp v0.4.0 - google.golang.org/protobuf v1.20.0 + google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967 ) diff --git a/go.sum b/go.sum index dab7d0bd2f..3d19e0b2be 100644 --- a/go.sum +++ b/go.sum @@ -9,7 +9,6 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IV golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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 h1:qkfzMNEf79BNs1//mQGZjYHIXAOv+AOdvPnMsU6R+1I= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.0 h1:SsQNHvKpk2VTiWoQ5Pqkt3Go/c2ly77C+v2Lggu5Qek= -google.golang.org/protobuf v1.20.0/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967 h1:DwkfSP6tZMxKX50J0dBSqEgJvJdFYP1Gvzbjtvkmrug= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= diff --git a/proto/wire.go b/proto/wire.go index 57abb57997..d7c28da5a7 100644 --- a/proto/wire.go +++ b/proto/wire.go @@ -64,8 +64,9 @@ func UnmarshalMerge(b []byte, m Message) error { out, err := protoV2.UnmarshalOptions{ AllowPartial: true, Merge: true, - }.UnmarshalState(mi, protoiface.UnmarshalInput{ - Buf: b, + }.UnmarshalState(protoiface.UnmarshalInput{ + Buf: b, + Message: mi.ProtoReflect(), }) if err != nil { return err From b860323f09d003f27661946a05cca5329f3c7950 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 13 Mar 2020 16:19:45 -0700 Subject: [PATCH 110/133] proto: inline the implementation of protoimpl.X.ExtensionDescFromType (#1056) --- proto/extensions.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proto/extensions.go b/proto/extensions.go index d78d25830c..65e1295154 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -286,8 +286,10 @@ func ExtensionDescs(m Message) ([]*ExtensionDesc, error) { extDescs := make(map[protoreflect.FieldNumber]*ExtensionDesc) mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { if fd.IsExtension() { - xts := fd.(protoreflect.ExtensionTypeDescriptor) - extDescs[fd.Number()] = protoimpl.X.ExtensionDescFromType(xts.Type()) + xt := fd.(protoreflect.ExtensionTypeDescriptor) + if xd, ok := xt.Type().(*ExtensionDesc); ok { + extDescs[fd.Number()] = xd + } } return true }) From 7592abeb9628aea3061d7173129b27084ef087b2 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 20 Mar 2020 14:41:29 -0700 Subject: [PATCH 111/133] internal/cmd/generate-alias: fix for lacking go_package options (#1061) In https://golang.org/cl/219598, we removed patching the well-known types with an explicit go_package option and instead relied on M flags. The lack of updated go_package options broke generate-alias since it appears as if the import public is trying to alias Go identifiers within the same Go package (thus generating nothing). We fix generate-alias by replicating the same approach here, where we construct the M flag mapping and pass it to protoc-gen-go. --- go.mod | 2 +- go.sum | 4 ++- internal/cmd/generate-alias/main.go | 52 ++++++++++++++++++----------- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/go.mod b/go.mod index 9fb4ade071..2ce329e06e 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.9 require ( github.com/google/go-cmp v0.4.0 - google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967 + google.golang.org/protobuf v1.20.2-0.20200320194150-9d397869d892 ) diff --git a/go.sum b/go.sum index 3d19e0b2be..b4226a0a1e 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,7 @@ 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/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 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= @@ -10,5 +11,6 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T 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 h1:DwkfSP6tZMxKX50J0dBSqEgJvJdFYP1Gvzbjtvkmrug= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.20.2-0.20200320194150-9d397869d892 h1:LQPEPzH8usKk01hUU5qdXb17Tgjr/BLZhHy1h90Vd7U= +google.golang.org/protobuf v1.20.2-0.20200320194150-9d397869d892/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= diff --git a/internal/cmd/generate-alias/main.go b/internal/cmd/generate-alias/main.go index dc25e1a041..6c16e6dc63 100644 --- a/internal/cmd/generate-alias/main.go +++ b/internal/cmd/generate-alias/main.go @@ -38,48 +38,60 @@ func main() { // Set of generated proto packages to forward to v2. files := []struct { - goPkg string - pbDesc protoreflect.FileDescriptor + oldGoPkg string + newGoPkg string + pbDesc protoreflect.FileDescriptor }{{ - goPkg: "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor", - pbDesc: descriptorpb.File_google_protobuf_descriptor_proto, + oldGoPkg: "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor", + newGoPkg: "google.golang.org/protobuf/types/descriptorpb", + pbDesc: descriptorpb.File_google_protobuf_descriptor_proto, }, { - goPkg: "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go", - pbDesc: pluginpb.File_google_protobuf_compiler_plugin_proto, + oldGoPkg: "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go", + newGoPkg: "google.golang.org/protobuf/types/pluginpb", + pbDesc: pluginpb.File_google_protobuf_compiler_plugin_proto, }, { - goPkg: "github.com/golang/protobuf/ptypes/any;any", - pbDesc: anypb.File_google_protobuf_any_proto, + oldGoPkg: "github.com/golang/protobuf/ptypes/any;any", + newGoPkg: "google.golang.org/protobuf/types/known/anypb", + pbDesc: anypb.File_google_protobuf_any_proto, }, { - goPkg: "github.com/golang/protobuf/ptypes/duration;duration", - pbDesc: durationpb.File_google_protobuf_duration_proto, + oldGoPkg: "github.com/golang/protobuf/ptypes/duration;duration", + newGoPkg: "google.golang.org/protobuf/types/known/durationpb", + pbDesc: durationpb.File_google_protobuf_duration_proto, }, { - goPkg: "github.com/golang/protobuf/ptypes/timestamp;timestamp", - pbDesc: timestamppb.File_google_protobuf_timestamp_proto, + oldGoPkg: "github.com/golang/protobuf/ptypes/timestamp;timestamp", + newGoPkg: "google.golang.org/protobuf/types/known/timestamppb", + pbDesc: timestamppb.File_google_protobuf_timestamp_proto, }, { - goPkg: "github.com/golang/protobuf/ptypes/wrappers;wrappers", - pbDesc: wrapperspb.File_google_protobuf_wrappers_proto, + oldGoPkg: "github.com/golang/protobuf/ptypes/wrappers;wrappers", + newGoPkg: "google.golang.org/protobuf/types/known/wrapperspb", + pbDesc: wrapperspb.File_google_protobuf_wrappers_proto, }, { - goPkg: "github.com/golang/protobuf/ptypes/struct;structpb", - pbDesc: structpb.File_google_protobuf_struct_proto, + oldGoPkg: "github.com/golang/protobuf/ptypes/struct;structpb", + newGoPkg: "google.golang.org/protobuf/types/known/structpb", + pbDesc: structpb.File_google_protobuf_struct_proto, }, { - goPkg: "github.com/golang/protobuf/ptypes/empty;empty", - pbDesc: emptypb.File_google_protobuf_empty_proto, + oldGoPkg: "github.com/golang/protobuf/ptypes/empty;empty", + newGoPkg: "google.golang.org/protobuf/types/known/emptypb", + pbDesc: emptypb.File_google_protobuf_empty_proto, }} // For each package, construct a proto file that public imports the package. var req pluginpb.CodeGeneratorRequest + var flags []string for _, file := range files { - pkgPath := file.goPkg[:strings.IndexByte(file.goPkg, ';')] + pkgPath := file.oldGoPkg[:strings.IndexByte(file.oldGoPkg, ';')] fd := &descriptorpb.FileDescriptorProto{ Name: proto.String(pkgPath + "/" + path.Base(pkgPath) + ".proto"), Syntax: proto.String(file.pbDesc.Syntax().String()), Dependency: []string{file.pbDesc.Path()}, PublicDependency: []int32{0}, - Options: &descriptorpb.FileOptions{GoPackage: proto.String(file.goPkg)}, + Options: &descriptorpb.FileOptions{GoPackage: proto.String(file.oldGoPkg)}, } req.ProtoFile = append(req.ProtoFile, protodesc.ToFileDescriptorProto(file.pbDesc), fd) req.FileToGenerate = append(req.FileToGenerate, fd.GetName()) + flags = append(flags, "M"+file.pbDesc.Path()+"="+file.newGoPkg) } + req.Parameter = proto.String(strings.Join(flags, ",")) // Use the internal logic of protoc-gen-go to generate the files. gen, err := protogen.Options{}.New(&req) From c8ad4533e5ee80006c446ab1180954b56bc1f06c Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 20 Mar 2020 14:52:42 -0700 Subject: [PATCH 112/133] all: use google.golang.org/encoding/protowire (#1062) Use the exported protowire package instead of an internal fork. --- internal/wire/wire.go | 526 ------------------------------------------ proto/buffer.go | 66 +++--- proto/extensions.go | 12 +- proto/text_encode.go | 28 +-- 4 files changed, 53 insertions(+), 579 deletions(-) delete mode 100644 internal/wire/wire.go diff --git a/internal/wire/wire.go b/internal/wire/wire.go deleted file mode 100644 index ee993de8e5..0000000000 --- a/internal/wire/wire.go +++ /dev/null @@ -1,526 +0,0 @@ -// 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 wire parses and formats the protobuf wire encoding. -// -// See https://developers.google.com/protocol-buffers/docs/encoding. -package wire - -import ( - "errors" - "io" - "math" - "math/bits" - - "google.golang.org/protobuf/reflect/protoreflect" -) - -// Number represents the field number. -type Number = protoreflect.FieldNumber - -const ( - MinValidNumber Number = 1 - FirstReservedNumber Number = 19000 - LastReservedNumber Number = 19999 - MaxValidNumber Number = 1<<29 - 1 -) - -// Type represents the wire type. -type Type int8 - -const ( - VarintType Type = 0 - Fixed32Type Type = 5 - Fixed64Type Type = 1 - BytesType Type = 2 - StartGroupType Type = 3 - EndGroupType Type = 4 -) - -const ( - _ = -iota - errCodeTruncated - errCodeFieldNumber - errCodeOverflow - errCodeReserved - errCodeEndGroup -) - -var ( - errFieldNumber = errors.New("invalid field number") - errOverflow = errors.New("variable length integer overflow") - errReserved = errors.New("cannot parse reserved wire type") - errEndGroup = errors.New("mismatching end group marker") - errParse = errors.New("parse error") -) - -// ParseError converts an error code into an error value. -// This returns nil if n is a non-negative number. -func ParseError(n int) error { - if n >= 0 { - return nil - } - switch n { - case errCodeTruncated: - return io.ErrUnexpectedEOF - case errCodeFieldNumber: - return errFieldNumber - case errCodeOverflow: - return errOverflow - case errCodeReserved: - return errReserved - case errCodeEndGroup: - return errEndGroup - default: - return errParse - } -} - -// ConsumeField parses an entire field record (both tag and value) and returns -// the field number, the wire type, and the total length. -// This returns a negative length upon an error (see ParseError). -// -// The total length includes the tag header and the end group marker (if the -// field is a group). -func ConsumeField(b []byte) (Number, Type, int) { - num, typ, n := ConsumeTag(b) - if n < 0 { - return 0, 0, n // forward error code - } - m := ConsumeFieldValue(num, typ, b[n:]) - if m < 0 { - return 0, 0, m // forward error code - } - return num, typ, n + m -} - -// ConsumeFieldValue parses a field value and returns its length. -// This assumes that the field Number and wire Type have already been parsed. -// This returns a negative length upon an error (see ParseError). -// -// When parsing a group, the length includes the end group marker and -// the end group is verified to match the starting field number. -func ConsumeFieldValue(num Number, typ Type, b []byte) (n int) { - switch typ { - case VarintType: - _, n = ConsumeVarint(b) - return n - case Fixed32Type: - _, n = ConsumeFixed32(b) - return n - case Fixed64Type: - _, n = ConsumeFixed64(b) - return n - case BytesType: - _, n = ConsumeBytes(b) - return n - case StartGroupType: - n0 := len(b) - for { - num2, typ2, n := ConsumeTag(b) - if n < 0 { - return n // forward error code - } - b = b[n:] - if typ2 == EndGroupType { - if num != num2 { - return errCodeEndGroup - } - return n0 - len(b) - } - - n = ConsumeFieldValue(num2, typ2, b) - if n < 0 { - return n // forward error code - } - b = b[n:] - } - case EndGroupType: - return errCodeEndGroup - default: - return errCodeReserved - } -} - -// AppendTag encodes num and typ as a varint-encoded tag and appends it to b. -func AppendTag(b []byte, num Number, typ Type) []byte { - return AppendVarint(b, EncodeTag(num, typ)) -} - -// ConsumeTag parses b as a varint-encoded tag, reporting its length. -// This returns a negative length upon an error (see ParseError). -func ConsumeTag(b []byte) (Number, Type, int) { - v, n := ConsumeVarint(b) - if n < 0 { - return 0, 0, n // forward error code - } - num, typ := DecodeTag(v) - if num < MinValidNumber { - return 0, 0, errCodeFieldNumber - } - return num, typ, n -} - -func SizeTag(num Number) int { - return SizeVarint(EncodeTag(num, 0)) // wire type has no effect on size -} - -// AppendVarint appends v to b as a varint-encoded uint64. -func AppendVarint(b []byte, v uint64) []byte { - switch { - case v < 1<<7: - b = append(b, byte(v)) - case v < 1<<14: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte(v>>7)) - case v < 1<<21: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte(v>>14)) - case v < 1<<28: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte(v>>21)) - case v < 1<<35: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte(v>>28)) - case v < 1<<42: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte(v>>35)) - case v < 1<<49: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte(v>>42)) - case v < 1<<56: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte(v>>49)) - case v < 1<<63: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte(v>>56)) - default: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte((v>>56)&0x7f|0x80), - 1) - } - return b -} - -// ConsumeVarint parses b as a varint-encoded uint64, reporting its length. -// This returns a negative length upon an error (see ParseError). -func ConsumeVarint(b []byte) (v uint64, n int) { - var y uint64 - if len(b) <= 0 { - return 0, errCodeTruncated - } - v = uint64(b[0]) - if v < 0x80 { - return v, 1 - } - v -= 0x80 - - if len(b) <= 1 { - return 0, errCodeTruncated - } - y = uint64(b[1]) - v += y << 7 - if y < 0x80 { - return v, 2 - } - v -= 0x80 << 7 - - if len(b) <= 2 { - return 0, errCodeTruncated - } - y = uint64(b[2]) - v += y << 14 - if y < 0x80 { - return v, 3 - } - v -= 0x80 << 14 - - if len(b) <= 3 { - return 0, errCodeTruncated - } - y = uint64(b[3]) - v += y << 21 - if y < 0x80 { - return v, 4 - } - v -= 0x80 << 21 - - if len(b) <= 4 { - return 0, errCodeTruncated - } - y = uint64(b[4]) - v += y << 28 - if y < 0x80 { - return v, 5 - } - v -= 0x80 << 28 - - if len(b) <= 5 { - return 0, errCodeTruncated - } - y = uint64(b[5]) - v += y << 35 - if y < 0x80 { - return v, 6 - } - v -= 0x80 << 35 - - if len(b) <= 6 { - return 0, errCodeTruncated - } - y = uint64(b[6]) - v += y << 42 - if y < 0x80 { - return v, 7 - } - v -= 0x80 << 42 - - if len(b) <= 7 { - return 0, errCodeTruncated - } - y = uint64(b[7]) - v += y << 49 - if y < 0x80 { - return v, 8 - } - v -= 0x80 << 49 - - if len(b) <= 8 { - return 0, errCodeTruncated - } - y = uint64(b[8]) - v += y << 56 - if y < 0x80 { - return v, 9 - } - v -= 0x80 << 56 - - if len(b) <= 9 { - return 0, errCodeTruncated - } - y = uint64(b[9]) - v += y << 63 - if y < 2 { - return v, 10 - } - return 0, errCodeOverflow -} - -// SizeVarint returns the encoded size of a varint. -// The size is guaranteed to be within 1 and 10, inclusive. -func SizeVarint(v uint64) int { - return 1 + (bits.Len64(v)-1)/7 -} - -// AppendFixed32 appends v to b as a little-endian uint32. -func AppendFixed32(b []byte, v uint32) []byte { - return append(b, - byte(v>>0), - byte(v>>8), - byte(v>>16), - byte(v>>24)) -} - -// ConsumeFixed32 parses b as a little-endian uint32, reporting its length. -// This returns a negative length upon an error (see ParseError). -func ConsumeFixed32(b []byte) (v uint32, n int) { - if len(b) < 4 { - return 0, errCodeTruncated - } - v = uint32(b[0])<<0 | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - return v, 4 -} - -// SizeFixed32 returns the encoded size of a fixed32; which is always 4. -func SizeFixed32() int { - return 4 -} - -// AppendFixed64 appends v to b as a little-endian uint64. -func AppendFixed64(b []byte, v uint64) []byte { - return append(b, - byte(v>>0), - byte(v>>8), - byte(v>>16), - byte(v>>24), - byte(v>>32), - byte(v>>40), - byte(v>>48), - byte(v>>56)) -} - -// ConsumeFixed64 parses b as a little-endian uint64, reporting its length. -// This returns a negative length upon an error (see ParseError). -func ConsumeFixed64(b []byte) (v uint64, n int) { - if len(b) < 8 { - return 0, errCodeTruncated - } - v = uint64(b[0])<<0 | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - return v, 8 -} - -// SizeFixed64 returns the encoded size of a fixed64; which is always 8. -func SizeFixed64() int { - return 8 -} - -// AppendBytes appends v to b as a length-prefixed bytes value. -func AppendBytes(b []byte, v []byte) []byte { - return append(AppendVarint(b, uint64(len(v))), v...) -} - -// ConsumeBytes parses b as a length-prefixed bytes value, reporting its length. -// This returns a negative length upon an error (see ParseError). -func ConsumeBytes(b []byte) (v []byte, n int) { - m, n := ConsumeVarint(b) - if n < 0 { - return nil, n // forward error code - } - if m > uint64(len(b[n:])) { - return nil, errCodeTruncated - } - return b[n:][:m], n + int(m) -} - -// SizeBytes returns the encoded size of a length-prefixed bytes value, -// given only the length. -func SizeBytes(n int) int { - return SizeVarint(uint64(n)) + n -} - -// AppendString appends v to b as a length-prefixed bytes value. -func AppendString(b []byte, v string) []byte { - return append(AppendVarint(b, uint64(len(v))), v...) -} - -// ConsumeString parses b as a length-prefixed bytes value, reporting its length. -// This returns a negative length upon an error (see ParseError). -func ConsumeString(b []byte) (v string, n int) { - bb, n := ConsumeBytes(b) - return string(bb), n -} - -// AppendGroup appends v to b as group value, with a trailing end group marker. -// The value v must not contain the end marker. -func AppendGroup(b []byte, num Number, v []byte) []byte { - return AppendVarint(append(b, v...), EncodeTag(num, EndGroupType)) -} - -// ConsumeGroup parses b as a group value until the trailing end group marker, -// and verifies that the end marker matches the provided num. The value v -// does not contain the end marker, while the length does contain the end marker. -// This returns a negative length upon an error (see ParseError). -func ConsumeGroup(num Number, b []byte) (v []byte, n int) { - n = ConsumeFieldValue(num, StartGroupType, b) - if n < 0 { - return nil, n // forward error code - } - b = b[:n] - - // Truncate off end group marker, but need to handle denormalized varints. - // Assuming end marker is never 0 (which is always the case since - // EndGroupType is non-zero), we can truncate all trailing bytes where the - // lower 7 bits are all zero (implying that the varint is denormalized). - for len(b) > 0 && b[len(b)-1]&0x7f == 0 { - b = b[:len(b)-1] - } - b = b[:len(b)-SizeTag(num)] - return b, n -} - -// SizeGroup returns the encoded size of a group, given only the length. -func SizeGroup(num Number, n int) int { - return n + SizeTag(num) -} - -// DecodeTag decodes the field Number and wire Type from its unified form. -// The Number is -1 if the decoded field number overflows int32. -// Other than overflow, this does not check for field number validity. -func DecodeTag(x uint64) (Number, Type) { - // NOTE: MessageSet allows for larger field numbers than normal. - if x>>3 > uint64(math.MaxInt32) { - return -1, 0 - } - return Number(x >> 3), Type(x & 7) -} - -// EncodeTag encodes the field Number and wire Type into its unified form. -func EncodeTag(num Number, typ Type) uint64 { - return uint64(num)<<3 | uint64(typ&7) -} - -// DecodeZigZag decodes a zig-zag-encoded uint64 as an int64. -// Input: {…, 5, 3, 1, 0, 2, 4, 6, …} -// Output: {…, -3, -2, -1, 0, +1, +2, +3, …} -func DecodeZigZag(x uint64) int64 { - return int64(x>>1) ^ int64(x)<<63>>63 -} - -// EncodeZigZag encodes an int64 as a zig-zag-encoded uint64. -// Input: {…, -3, -2, -1, 0, +1, +2, +3, …} -// Output: {…, 5, 3, 1, 0, 2, 4, 6, …} -func EncodeZigZag(x int64) uint64 { - return uint64(x<<1) ^ uint64(x>>63) -} - -// DecodeBool decodes a uint64 as a bool. -// Input: { 0, 1, 2, …} -// Output: {false, true, true, …} -func DecodeBool(x uint64) bool { - return x != 0 -} - -// EncodeBool encodes a bool as a uint64. -// Input: {false, true} -// Output: { 0, 1} -func EncodeBool(x bool) uint64 { - if x { - return 1 - } - return 0 -} diff --git a/proto/buffer.go b/proto/buffer.go index 9aae5bccca..62df7e3b8b 100644 --- a/proto/buffer.go +++ b/proto/buffer.go @@ -8,8 +8,8 @@ import ( "errors" "fmt" - "github.com/golang/protobuf/internal/wire" "google.golang.org/protobuf/encoding/prototext" + "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/runtime/protoimpl" ) @@ -24,20 +24,20 @@ const ( // EncodeVarint returns the varint encoded bytes of v. func EncodeVarint(v uint64) []byte { - return wire.AppendVarint(nil, v) + 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 wire.SizeVarint(v) + 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 := wire.ConsumeVarint(b) + v, n := protowire.ConsumeVarint(b) if n < 0 { return 0, 0 } @@ -138,7 +138,7 @@ func (*Buffer) DebugPrint(s string, b []byte) { // EncodeVarint appends an unsigned varint encoding to the buffer. func (b *Buffer) EncodeVarint(v uint64) error { - b.buf = wire.AppendVarint(b.buf, v) + b.buf = protowire.AppendVarint(b.buf, v) return nil } @@ -154,42 +154,42 @@ func (b *Buffer) EncodeZigzag64(v uint64) error { // EncodeFixed32 appends a 32-bit little-endian integer to the buffer. func (b *Buffer) EncodeFixed32(v uint64) error { - b.buf = wire.AppendFixed32(b.buf, uint32(v)) + 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 = wire.AppendFixed64(b.buf, uint64(v)) + 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 = wire.AppendBytes(b.buf, v) + 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 = wire.AppendString(b.buf, v) + 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 = wire.AppendVarint(b.buf, uint64(Size(m))) + 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 := wire.ConsumeVarint(b.buf[b.idx:]) + v, n := protowire.ConsumeVarint(b.buf[b.idx:]) if n < 0 { - return 0, wire.ParseError(n) + return 0, protowire.ParseError(n) } b.idx += n return uint64(v), nil @@ -215,9 +215,9 @@ func (b *Buffer) DecodeZigzag64() (uint64, error) { // DecodeFixed32 consumes a 32-bit little-endian integer from the buffer. func (b *Buffer) DecodeFixed32() (uint64, error) { - v, n := wire.ConsumeFixed32(b.buf[b.idx:]) + v, n := protowire.ConsumeFixed32(b.buf[b.idx:]) if n < 0 { - return 0, wire.ParseError(n) + return 0, protowire.ParseError(n) } b.idx += n return uint64(v), nil @@ -225,9 +225,9 @@ func (b *Buffer) DecodeFixed32() (uint64, error) { // DecodeFixed64 consumes a 64-bit little-endian integer from the buffer. func (b *Buffer) DecodeFixed64() (uint64, error) { - v, n := wire.ConsumeFixed64(b.buf[b.idx:]) + v, n := protowire.ConsumeFixed64(b.buf[b.idx:]) if n < 0 { - return 0, wire.ParseError(n) + return 0, protowire.ParseError(n) } b.idx += n return uint64(v), nil @@ -237,9 +237,9 @@ func (b *Buffer) DecodeFixed64() (uint64, error) { // 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 := wire.ConsumeBytes(b.buf[b.idx:]) + v, n := protowire.ConsumeBytes(b.buf[b.idx:]) if n < 0 { - return nil, wire.ParseError(n) + return nil, protowire.ParseError(n) } b.idx += n if alloc { @@ -251,9 +251,9 @@ func (b *Buffer) DecodeRawBytes(alloc bool) ([]byte, error) { // 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 := wire.ConsumeString(b.buf[b.idx:]) + v, n := protowire.ConsumeString(b.buf[b.idx:]) if n < 0 { - return "", wire.ParseError(n) + return "", protowire.ParseError(n) } b.idx += n return v, nil @@ -289,31 +289,31 @@ func consumeGroup(b []byte) ([]byte, int, error) { b0 := b depth := 1 // assume this follows a start group marker for { - _, wtyp, tagLen := wire.ConsumeTag(b) + _, wtyp, tagLen := protowire.ConsumeTag(b) if tagLen < 0 { - return nil, 0, wire.ParseError(tagLen) + return nil, 0, protowire.ParseError(tagLen) } b = b[tagLen:] var valLen int switch wtyp { - case wire.VarintType: - _, valLen = wire.ConsumeVarint(b) - case wire.Fixed32Type: - _, valLen = wire.ConsumeFixed32(b) - case wire.Fixed64Type: - _, valLen = wire.ConsumeFixed64(b) - case wire.BytesType: - _, valLen = wire.ConsumeBytes(b) - case wire.StartGroupType: + 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 wire.EndGroupType: + case protowire.EndGroupType: depth-- default: return nil, 0, errors.New("proto: cannot parse reserved wire type") } if valLen < 0 { - return nil, 0, wire.ParseError(valLen) + return nil, 0, protowire.ParseError(valLen) } b = b[valLen:] diff --git a/proto/extensions.go b/proto/extensions.go index 65e1295154..5ed131c57d 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -9,7 +9,7 @@ import ( "fmt" "reflect" - "github.com/golang/protobuf/internal/wire" + "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" @@ -61,7 +61,7 @@ func HasExtension(m Message, xt *ExtensionDesc) (has bool) { // Check whether any unknown field matches the field number. for b := mr.GetUnknown(); !has && len(b) > 0; { - num, _, n := wire.ConsumeField(b) + num, _, n := protowire.ConsumeField(b) has = int32(num) == xt.Field b = b[n:] } @@ -126,7 +126,7 @@ func GetExtension(m Message, xt *ExtensionDesc) (interface{}, error) { // Retrieve the unknown fields for this extension field. var bo protoreflect.RawFields for bi := mr.GetUnknown(); len(bi) > 0; { - num, _, n := wire.ConsumeField(bi) + num, _, n := protowire.ConsumeField(bi) if int32(num) == xt.Field { bo = append(bo, bi[:n]...) } @@ -259,7 +259,7 @@ func SetRawExtension(m Message, fnum int32, b []byte) { // Verify that the raw field is valid. for b0 := b; len(b0) > 0; { - num, _, n := wire.ConsumeField(b0) + num, _, n := protowire.ConsumeField(b0) if int32(num) != fnum { panic(fmt.Sprintf("mismatching field number: got %d, want %d", num, fnum)) } @@ -297,7 +297,7 @@ func ExtensionDescs(m Message) ([]*ExtensionDesc, error) { // Collect a set of unknown extension descriptors. extRanges := mr.Descriptor().ExtensionRanges() for b := mr.GetUnknown(); len(b) > 0; { - num, _, n := wire.ConsumeField(b) + num, _, n := protowire.ConsumeField(b) if extRanges.Has(num) && extDescs[num] == nil { extDescs[num] = nil } @@ -338,7 +338,7 @@ func clearUnknown(m protoreflect.Message, remover interface { }) { var bo protoreflect.RawFields for bi := m.GetUnknown(); len(bi) > 0; { - num, _, n := wire.ConsumeField(bi) + num, _, n := protowire.ConsumeField(bi) if !remover.Has(num) { bo = append(bo, bi[:n]...) } diff --git a/proto/text_encode.go b/proto/text_encode.go index e2a0ad30ca..7ac02e68f6 100644 --- a/proto/text_encode.go +++ b/proto/text_encode.go @@ -13,8 +13,8 @@ import ( "sort" "strings" - "github.com/golang/protobuf/internal/wire" "google.golang.org/protobuf/encoding/prototext" + "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" @@ -435,54 +435,54 @@ func (w *textWriter) writeUnknownFields(b []byte) { } for len(b) > 0 { - num, wtyp, n := wire.ConsumeTag(b) + num, wtyp, n := protowire.ConsumeTag(b) if n < 0 { return } b = b[n:] - if wtyp == wire.EndGroupType { + if wtyp == protowire.EndGroupType { w.indent-- w.Write(endBraceNewline) continue } fmt.Fprint(w, num) - if wtyp != wire.StartGroupType { + if wtyp != protowire.StartGroupType { w.WriteByte(':') } - if !w.compact || wtyp == wire.StartGroupType { + if !w.compact || wtyp == protowire.StartGroupType { w.WriteByte(' ') } switch wtyp { - case wire.VarintType: - v, n := wire.ConsumeVarint(b) + case protowire.VarintType: + v, n := protowire.ConsumeVarint(b) if n < 0 { return } b = b[n:] fmt.Fprint(w, v) - case wire.Fixed32Type: - v, n := wire.ConsumeFixed32(b) + case protowire.Fixed32Type: + v, n := protowire.ConsumeFixed32(b) if n < 0 { return } b = b[n:] fmt.Fprint(w, v) - case wire.Fixed64Type: - v, n := wire.ConsumeFixed64(b) + case protowire.Fixed64Type: + v, n := protowire.ConsumeFixed64(b) if n < 0 { return } b = b[n:] fmt.Fprint(w, v) - case wire.BytesType: - v, n := wire.ConsumeBytes(b) + case protowire.BytesType: + v, n := protowire.ConsumeBytes(b) if n < 0 { return } b = b[n:] fmt.Fprintf(w, "%q", v) - case wire.StartGroupType: + case protowire.StartGroupType: w.WriteByte('{') w.indent++ default: From 3a3cefd0f2bd86460816e3312135813db1ea21e1 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 20 Mar 2020 15:00:05 -0700 Subject: [PATCH 113/133] all: use google.golang.org/protobuf/testing/protopack for tests (#1063) Use protopack for tests instead of hard-coded binary data. --- jsonpb/json_test.go | 52 +- proto/discard_test.go | 5 +- proto/proto_test.go | 1347 +++++++++++++++++++------------------ proto/wire_decode_test.go | 227 ------- proto/wire_encode_test.go | 57 -- proto/wire_size_test.go | 177 ----- 6 files changed, 736 insertions(+), 1129 deletions(-) delete mode 100644 proto/wire_decode_test.go delete mode 100644 proto/wire_encode_test.go delete mode 100644 proto/wire_size_test.go diff --git a/jsonpb/json_test.go b/jsonpb/json_test.go index 15eed25873..485b29279e 100644 --- a/jsonpb/json_test.go +++ b/jsonpb/json_test.go @@ -550,10 +550,10 @@ func TestMarshalJSONPBMarshaler(t *testing.T) { msg := dynamicMessage{RawJson: rawJson} str, err := new(Marshaler).MarshalToString(&msg) if err != nil { - t.Errorf("an unexpected error occurred when marshalling JSONPBMarshaler: %v", err) + t.Errorf("an unexpected error while marshaling JSONPBMarshaler: %v", err) } if str != rawJson { - t.Errorf("marshalling JSON produced incorrect output: got %s, wanted %s", str, rawJson) + t.Errorf("marshaling JSON produced incorrect output: got %s, wanted %s", str, rawJson) } } @@ -561,17 +561,17 @@ func TestMarshalAnyJSONPBMarshaler(t *testing.T) { msg := dynamicMessage{RawJson: `{ "foo": "bar", "baz": [0, 1, 2, 3] }`} a, err := ptypes.MarshalAny(&msg) if err != nil { - t.Errorf("an unexpected error occurred when marshalling to Any: %v", err) + t.Errorf("an unexpected error while marshaling to Any: %v", err) } str, err := new(Marshaler).MarshalToString(a) if err != nil { - t.Errorf("an unexpected error occurred when marshalling Any to JSON: %v", err) + t.Errorf("an unexpected error while marshaling Any to JSON: %v", err) } // after custom marshaling, it's round-tripped through JSON decoding/encoding already, // so the keys are sorted, whitespace is compacted, and "@type" key has been added - expected := `{"@type":"type.googleapis.com/` + dynamicMessageName + `","baz":[0,1,2,3],"foo":"bar"}` - if str != expected { - t.Errorf("marshalling JSON produced incorrect output: got %s, wanted %s", str, expected) + want := `{"@type":"type.googleapis.com/` + dynamicMessageName + `","baz":[0,1,2,3],"foo":"bar"}` + if str != want { + t.Errorf("marshaling JSON produced incorrect output: got %s, wanted %s", str, want) } } @@ -580,11 +580,11 @@ func TestMarshalWithCustomValidation(t *testing.T) { js, err := new(Marshaler).MarshalToString(&msg) if err != nil { - t.Errorf("an unexpected error occurred when marshalling to json: %v", err) + t.Errorf("an unexpected error while marshaling to json: %v", err) } err = Unmarshal(strings.NewReader(js), &msg) if err != nil { - t.Errorf("an unexpected error occurred when unmarshalling from json: %v", err) + t.Errorf("an unexpected error while unmarshaling from json: %v", err) } } @@ -668,7 +668,7 @@ func TestMarshalUnsetRequiredFields(t *testing.T) { for _, tc := range tests { if _, err := tc.marshaler.MarshalToString(tc.pb); err == nil { - t.Errorf("%s: expecting error in marshaling with unset required fields %+v", tc.desc, tc.pb) + t.Errorf("%s: expected error while marshaling with unset required fields %+v", tc.desc, tc.pb) } } } @@ -822,12 +822,12 @@ var unmarshalingTests = []struct { func TestUnmarshaling(t *testing.T) { for _, tt := range unmarshalingTests { - // Make a new instance of the type of our expected object. + // Make a new instance of the type of our wanted object. p := reflect.New(reflect.TypeOf(tt.pb).Elem()).Interface().(proto.Message) err := tt.unmarshaler.Unmarshal(strings.NewReader(tt.json), p) if err != nil { - t.Errorf("unmarshalling %s: %v", tt.desc, err) + t.Errorf("unmarshaling %s: %v", tt.desc, err) continue } @@ -872,7 +872,7 @@ func TestUnmarshalNext(t *testing.T) { dec := json.NewDecoder(&b) for _, tt := range tests { - // Make a new instance of the type of our expected object. + // Make a new instance of the type of our wanted object. p := reflect.New(reflect.TypeOf(tt.pb).Elem()).Interface().(proto.Message) err := tt.unmarshaler.UnmarshalNext(dec, p) @@ -892,7 +892,7 @@ func TestUnmarshalNext(t *testing.T) { p := &pb2.Simple{} err := new(Unmarshaler).UnmarshalNext(dec, p) if err != io.EOF { - t.Errorf("eof: got %v, expected io.EOF", err) + t.Errorf("eof: got %v, want io.EOF", err) } } @@ -918,7 +918,7 @@ func TestUnmarshalingBadInput(t *testing.T) { for _, tt := range unmarshalingShouldError { err := UnmarshalString(tt.in, tt.pb) if err == nil { - t.Errorf("an error was expected when parsing %q instead of an object", tt.desc) + t.Errorf("expected error while parsing %q", tt.desc) } } } @@ -943,7 +943,7 @@ func TestAnyWithCustomResolver(t *testing.T) { } msgBytes, err := proto.Marshal(msg) if err != nil { - t.Errorf("an unexpected error occurred when marshaling message: %v", err) + t.Errorf("an unexpected error while marshaling message: %v", err) } // make an Any with a type URL that won't resolve w/out custom resolver any := &anypb.Any{ @@ -954,7 +954,7 @@ func TestAnyWithCustomResolver(t *testing.T) { m := Marshaler{AnyResolver: resolver} js, err := m.MarshalToString(any) if err != nil { - t.Errorf("an unexpected error occurred when marshaling any to JSON: %v", err) + t.Errorf("an unexpected error while marshaling any to JSON: %v", err) } if len(resolvedTypeUrls) != 1 { t.Errorf("custom resolver was not invoked during marshaling") @@ -963,14 +963,14 @@ func TestAnyWithCustomResolver(t *testing.T) { } wanted := `{"@type":"https://foobar.com/some.random.MessageKind","oBool":true,"oInt64":"1020304","oString":"foobar","oBytes":"AQIDBA=="}` if js != wanted { - t.Errorf("marshalling JSON produced incorrect output: got %s, wanted %s", js, wanted) + t.Errorf("marshaling JSON produced incorrect output: got %s, wanted %s", js, wanted) } u := Unmarshaler{AnyResolver: resolver} roundTrip := &anypb.Any{} err = u.Unmarshal(bytes.NewReader([]byte(js)), roundTrip) if err != nil { - t.Errorf("an unexpected error occurred when unmarshaling any from JSON: %v", err) + t.Errorf("an unexpected error while unmarshaling any from JSON: %v", err) } if len(resolvedTypeUrls) != 2 { t.Errorf("custom resolver was not invoked during marshaling") @@ -978,7 +978,7 @@ func TestAnyWithCustomResolver(t *testing.T) { t.Errorf("custom resolver was invoked with wrong URL: got %q, wanted %q", resolvedTypeUrls[1], "https://foobar.com/some.random.MessageKind") } if !proto.Equal(any, roundTrip) { - t.Errorf("message contents not set correctly after unmarshalling JSON: got %s, wanted %s", roundTrip, any) + t.Errorf("message contents not set correctly after unmarshaling JSON: got %s, wanted %s", roundTrip, any) } } @@ -986,10 +986,10 @@ func TestUnmarshalJSONPBUnmarshaler(t *testing.T) { rawJson := `{ "foo": "bar", "baz": [0, 1, 2, 3] }` var msg dynamicMessage if err := Unmarshal(strings.NewReader(rawJson), &msg); err != nil { - t.Errorf("an unexpected error occurred when parsing into JSONPBUnmarshaler: %v", err) + t.Errorf("an unexpected error while parsing into JSONPBUnmarshaler: %v", err) } if msg.RawJson != rawJson { - t.Errorf("message contents not set correctly after unmarshalling JSON: got %s, wanted %s", msg.RawJson, rawJson) + t.Errorf("message contents not set correctly after unmarshaling JSON: got %s, wanted %s", msg.RawJson, rawJson) } } @@ -1010,20 +1010,20 @@ func TestUnmarshalAnyJSONPBUnmarshaler(t *testing.T) { rawJson := `{ "@type": "blah.com/` + dynamicMessageName + `", "foo": "bar", "baz": [0, 1, 2, 3] }` var got anypb.Any if err := Unmarshal(strings.NewReader(rawJson), &got); err != nil { - t.Errorf("an unexpected error occurred when parsing into JSONPBUnmarshaler: %v", err) + t.Errorf("an unexpected error while parsing into JSONPBUnmarshaler: %v", err) } dm := &dynamicMessage{RawJson: `{"baz":[0,1,2,3],"foo":"bar"}`} var want anypb.Any if b, err := proto.Marshal(dm); err != nil { - t.Errorf("an unexpected error occurred when marshaling message: %v", err) + t.Errorf("an unexpected error while marshaling message: %v", err) } else { want.TypeUrl = "blah.com/" + dynamicMessageName want.Value = b } if !proto.Equal(&got, &want) { - t.Errorf("message contents not set correctly after unmarshalling JSON: got %v, wanted %v", &got, &want) + t.Errorf("message contents not set correctly after unmarshaling JSON: got %v, wanted %v", &got, &want) } } @@ -1247,7 +1247,7 @@ func TestUnmarshalUnsetRequiredFields(t *testing.T) { for _, tc := range tests { if err := UnmarshalString(tc.json, tc.pb); err == nil { - t.Errorf("%s: expecting error in unmarshaling with unset required fields %s", tc.desc, tc.json) + t.Errorf("%s: expected error while unmarshaling with unset required fields %s", tc.desc, tc.json) } } } diff --git a/proto/discard_test.go b/proto/discard_test.go index bd1cd1d203..f850d9dec4 100644 --- a/proto/discard_test.go +++ b/proto/discard_test.go @@ -8,12 +8,15 @@ import ( "testing" "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/testing/protopack" pb2 "github.com/golang/protobuf/internal/testprotos/proto2_proto" pb3 "github.com/golang/protobuf/internal/testprotos/proto3_proto" ) -const rawFields = "\x2d\xc3\xd2\xe1\xf0" +var rawFields = protopack.Message{ + protopack.Tag{5, protopack.Fixed32Type}, protopack.Uint32(4041331395), +}.Marshal() func TestDiscardUnknown(t *testing.T) { tests := []struct { diff --git a/proto/proto_test.go b/proto/proto_test.go index be702c6f37..61c8f8a022 100644 --- a/proto/proto_test.go +++ b/proto/proto_test.go @@ -9,6 +9,7 @@ import ( "encoding/json" "errors" "fmt" + "log" "math" "math/rand" "reflect" @@ -19,34 +20,13 @@ import ( "time" "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/testing/protopack" pb2 "github.com/golang/protobuf/internal/testprotos/proto2_proto" pb3 "github.com/golang/protobuf/internal/testprotos/proto3_proto" tspb "github.com/golang/protobuf/ptypes/timestamp" ) -var globalO *proto.Buffer - -func old() *proto.Buffer { - if globalO == nil { - globalO = proto.NewBuffer(nil) - } - globalO.Reset() - return globalO -} - -func equalbytes(b1, b2 []byte, t *testing.T) { - if len(b1) != len(b2) { - t.Errorf("wrong lengths: 2*%d != %d", len(b1), len(b2)) - return - } - for i := 0; i < len(b1); i++ { - if b1[i] != b2[i] { - t.Errorf("bad byte[%d]:%x %x: %s %s", i, b1[i], b2[i], b1, b2) - } - } -} - func initGoTestField() *pb2.GoTestField { f := new(pb2.GoTestField) f.Label = proto.String("label") @@ -117,67 +97,31 @@ func initGoTest(setdefaults bool) *pb2.GoTest { return pb } -func hex(c uint8) uint8 { - if '0' <= c && c <= '9' { - return c - '0' - } - if 'a' <= c && c <= 'f' { - return 10 + c - 'a' - } - if 'A' <= c && c <= 'F' { - return 10 + c - 'A' - } - return 0 -} - -func equal(b []byte, s string, t *testing.T) bool { - if 2*len(b) != len(s) { - // fail(fmt.Sprintf("wrong lengths: 2*%d != %d", len(b), len(s)), b, s, t) - fmt.Printf("wrong lengths: 2*%d != %d\n", len(b), len(s)) - return false - } - for i, j := 0, 0; i < len(b); i, j = i+1, j+2 { - x := hex(s[j])*16 + hex(s[j+1]) - if b[i] != x { - // fail(fmt.Sprintf("bad byte[%d]:%x %x", i, b[i], x), b, s, t) - fmt.Printf("bad byte[%d]:%x %x", i, b[i], x) - return false - } - } - return true -} - -func overify(t *testing.T, pb *pb2.GoTest, expected string) { - o := old() - err := o.Marshal(pb) +func overify(t *testing.T, pb *pb2.GoTest, want []byte) { + bb := new(proto.Buffer) + err := bb.Marshal(pb) + got := bb.Bytes() if err != nil { - fmt.Printf("overify marshal-1 err = %v", err) - o.DebugPrint("", o.Bytes()) - t.Fatalf("expected = %s", expected) + t.Logf("overify marshal-1 err = %v", err) } - if !equal(o.Bytes(), expected, t) { - o.DebugPrint("overify neq 1", o.Bytes()) - t.Fatalf("expected = %s", expected) + if !bytes.Equal(got, want) { + t.Fatalf("got %q\nwant %q", got, want) } // Now test Unmarshal by recreating the original buffer. pbd := new(pb2.GoTest) - err = o.Unmarshal(pbd) + err = bb.Unmarshal(pbd) if err != nil { t.Fatalf("overify unmarshal err = %v", err) - o.DebugPrint("", o.Bytes()) - t.Fatalf("string = %s", expected) } - o.Reset() - err = o.Marshal(pbd) + bb.Reset() + err = bb.Marshal(pbd) + got = bb.Bytes() if err != nil { - t.Errorf("overify marshal-2 err = %v", err) - o.DebugPrint("", o.Bytes()) - t.Fatalf("string = %s", expected) + t.Fatalf("overify marshal-2 err = %v", err) } - if !equal(o.Bytes(), expected, t) { - o.DebugPrint("overify neq 2", o.Bytes()) - t.Fatalf("string = %s", expected) + if !bytes.Equal(got, want) { + t.Fatalf("got %q\nwant %q", got, want) } } @@ -193,7 +137,7 @@ func isRequiredNotSetError(err error) bool { // Simple tests for numeric encode/decode primitives (varint, etc.) func TestNumericPrimitives(t *testing.T) { for i := uint64(0); i < 1e6; i += 111 { - o := old() + o := new(proto.Buffer) if o.EncodeVarint(i) != nil { t.Error("EncodeVarint") break @@ -206,7 +150,7 @@ func TestNumericPrimitives(t *testing.T) { t.Fatal("varint decode fail:", i, x) } - o = old() + o.Reset() if o.EncodeFixed32(i) != nil { t.Fatal("encFixed32") } @@ -218,7 +162,7 @@ func TestNumericPrimitives(t *testing.T) { t.Fatal("fixed32 decode fail:", i, x) } - o = old() + o.Reset() if o.EncodeFixed64(i*1234567) != nil { t.Error("encFixed64") break @@ -233,7 +177,7 @@ func TestNumericPrimitives(t *testing.T) { break } - o = old() + o.Reset() i32 := int32(i - 12345) if o.EncodeZigzag32(uint64(i32)) != nil { t.Fatal("EncodeZigzag32") @@ -246,7 +190,7 @@ func TestNumericPrimitives(t *testing.T) { t.Fatal("zigzag32 decode fail:", i32, x) } - o = old() + o.Reset() i64 := int64(i - 12345) if o.EncodeZigzag64(uint64(i64)) != nil { t.Fatal("EncodeZigzag64") @@ -377,37 +321,39 @@ func TestBufferMarshalAllocs(t *testing.T) { // Simple tests for bytes func TestBytesPrimitives(t *testing.T) { - o := old() - bytes := []byte{'n', 'o', 'w', ' ', 'i', 's', ' ', 't', 'h', 'e', ' ', 't', 'i', 'm', 'e'} - if o.EncodeRawBytes(bytes) != nil { - t.Error("EncodeRawBytes") + bb := new(proto.Buffer) + want := []byte("now is the time") + if err := bb.EncodeRawBytes(want); err != nil { + t.Errorf("EncodeRawBytes error: %v", err) } - decb, e := o.DecodeRawBytes(false) - if e != nil { - t.Error("DecodeRawBytes") + got, err := bb.DecodeRawBytes(false) + if err != nil { + t.Errorf("DecodeRawBytes error: %v", err) + } + if !bytes.Equal(got, want) { + t.Errorf("got %q\nwant %q", got, want) } - equalbytes(bytes, decb, t) } // Simple tests for strings func TestStringPrimitives(t *testing.T) { - o := old() - s := "now is the time" - if o.EncodeStringBytes(s) != nil { - t.Error("enc_string") + bb := new(proto.Buffer) + want := "now is the time" + if err := bb.EncodeStringBytes(want); err != nil { + t.Errorf("EncodeStringBytes error: %v", err) } - decs, e := o.DecodeStringBytes() - if e != nil { - t.Error("dec_string") + got, err := bb.DecodeStringBytes() + if err != nil { + t.Errorf("DecodeStringBytes error: %v", err) } - if s != decs { - t.Error("string encode/decode fail:", s, decs) + if got != want { + t.Errorf("got %q\nwant %q", got, want) } } // Do we catch the "required bit not set" case? func TestRequiredBit(t *testing.T) { - o := old() + o := new(proto.Buffer) pb := new(pb2.GoTest) err := o.Marshal(pb) if err == nil { @@ -422,43 +368,32 @@ func TestRequiredBit(t *testing.T) { // different initialization property, but it once caught a compiler bug so // it lives. func checkInitialized(pb *pb2.GoTest, t *testing.T) { - if pb.F_BoolDefaulted != nil { + switch { + case pb.F_BoolDefaulted != nil: t.Error("New or Reset did not set boolean:", *pb.F_BoolDefaulted) - } - if pb.F_Int32Defaulted != nil { + case pb.F_Int32Defaulted != nil: t.Error("New or Reset did not set int32:", *pb.F_Int32Defaulted) - } - if pb.F_Int64Defaulted != nil { + case pb.F_Int64Defaulted != nil: t.Error("New or Reset did not set int64:", *pb.F_Int64Defaulted) - } - if pb.F_Fixed32Defaulted != nil { + case pb.F_Fixed32Defaulted != nil: t.Error("New or Reset did not set fixed32:", *pb.F_Fixed32Defaulted) - } - if pb.F_Fixed64Defaulted != nil { + case pb.F_Fixed64Defaulted != nil: t.Error("New or Reset did not set fixed64:", *pb.F_Fixed64Defaulted) - } - if pb.F_Uint32Defaulted != nil { + case pb.F_Uint32Defaulted != nil: t.Error("New or Reset did not set uint32:", *pb.F_Uint32Defaulted) - } - if pb.F_Uint64Defaulted != nil { + case pb.F_Uint64Defaulted != nil: t.Error("New or Reset did not set uint64:", *pb.F_Uint64Defaulted) - } - if pb.F_FloatDefaulted != nil { + case pb.F_FloatDefaulted != nil: t.Error("New or Reset did not set float:", *pb.F_FloatDefaulted) - } - if pb.F_DoubleDefaulted != nil { + case pb.F_DoubleDefaulted != nil: t.Error("New or Reset did not set double:", *pb.F_DoubleDefaulted) - } - if pb.F_StringDefaulted != nil { + case pb.F_StringDefaulted != nil: t.Error("New or Reset did not set string:", *pb.F_StringDefaulted) - } - if pb.F_BytesDefaulted != nil { + case pb.F_BytesDefaulted != nil: t.Error("New or Reset did not set bytes:", string(pb.F_BytesDefaulted)) - } - if pb.F_Sint32Defaulted != nil { + case pb.F_Sint32Defaulted != nil: t.Error("New or Reset did not set int32:", *pb.F_Sint32Defaulted) - } - if pb.F_Sint64Defaulted != nil { + case pb.F_Sint64Defaulted != nil: t.Error("New or Reset did not set int64:", *pb.F_Sint64Defaulted) } } @@ -488,68 +423,81 @@ func TestReset(t *testing.T) { func TestEncodeDecode1(t *testing.T) { pb := initGoTest(false) overify(t, pb, - "0807"+ // field 1, encoding 0, value 7 - "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField) - "5001"+ // field 10, encoding 0, value 1 - "5803"+ // field 11, encoding 0, value 3 - "6006"+ // field 12, encoding 0, value 6 - "6d20000000"+ // field 13, encoding 5, value 0x20 - "714000000000000000"+ // field 14, encoding 1, value 0x40 - "78a019"+ // field 15, encoding 0, value 0xca0 = 3232 - "8001c032"+ // field 16, encoding 0, value 0x1940 = 6464 - "8d0100004a45"+ // field 17, encoding 5, value 3232.0 - "9101000000000040b940"+ // field 18, encoding 1, value 6464.0 - "9a0106"+"737472696e67"+ // field 19, encoding 2, string "string" - "b304"+ // field 70, encoding 3, start group - "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required" - "b404"+ // field 70, encoding 4, end group - "aa0605"+"6279746573"+ // field 101, encoding 2, string "bytes" - "b0063f"+ // field 102, encoding 0, 0x3f zigzag32 - "b8067f"+ // field 103, encoding 0, 0x7f zigzag64 - "c506e0ffffff"+ // field 104, encoding 5, -32 fixed32 - "c906c0ffffffffffffff") // field 105, encoding 1, -64 fixed64 + protopack.Message{ + protopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7), + protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.String("label"), + protopack.Tag{2, protopack.BytesType}, protopack.String("type"), + }), + protopack.Tag{10, protopack.VarintType}, protopack.Bool(true), + protopack.Tag{11, protopack.VarintType}, protopack.Varint(3), + protopack.Tag{12, protopack.VarintType}, protopack.Varint(6), + protopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32), + protopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64), + protopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232), + protopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464), + protopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232), + protopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464), + protopack.Tag{19, protopack.BytesType}, protopack.String("string"), + protopack.Tag{70, protopack.StartGroupType}, + protopack.Message{ + protopack.Tag{71, protopack.BytesType}, protopack.String("required"), + }, + protopack.Tag{70, protopack.EndGroupType}, + protopack.Tag{101, protopack.BytesType}, protopack.Bytes("bytes"), + protopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32), + protopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64), + protopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32), + protopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64), + }.Marshal()) } // All required fields set, defaults provided. func TestEncodeDecode2(t *testing.T) { pb := initGoTest(true) overify(t, pb, - "0807"+ // field 1, encoding 0, value 7 - "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField) - "5001"+ // field 10, encoding 0, value 1 - "5803"+ // field 11, encoding 0, value 3 - "6006"+ // field 12, encoding 0, value 6 - "6d20000000"+ // field 13, encoding 5, value 32 - "714000000000000000"+ // field 14, encoding 1, value 64 - "78a019"+ // field 15, encoding 0, value 3232 - "8001c032"+ // field 16, encoding 0, value 6464 - "8d0100004a45"+ // field 17, encoding 5, value 3232.0 - "9101000000000040b940"+ // field 18, encoding 1, value 6464.0 - "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string" - "c00201"+ // field 40, encoding 0, value 1 - "c80220"+ // field 41, encoding 0, value 32 - "d00240"+ // field 42, encoding 0, value 64 - "dd0240010000"+ // field 43, encoding 5, value 320 - "e1028002000000000000"+ // field 44, encoding 1, value 640 - "e8028019"+ // field 45, encoding 0, value 3200 - "f0028032"+ // field 46, encoding 0, value 6400 - "fd02e0659948"+ // field 47, encoding 5, value 314159.0 - "81030000000050971041"+ // field 48, encoding 1, value 271828.0 - "8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n" - "b304"+ // start group field 70 level 1 - "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required" - "b404"+ // end group field 70 level 1 - "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes" - "b0063f"+ // field 102, encoding 0, 0x3f zigzag32 - "b8067f"+ // field 103, encoding 0, 0x7f zigzag64 - "c506e0ffffff"+ // field 104, encoding 5, -32 fixed32 - "c906c0ffffffffffffff"+ // field 105, encoding 1, -64 fixed64 - "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose" - "90193f"+ // field 402, encoding 0, value 63 - "98197f"+ // field 403, encoding 0, value 127 - "a519e0ffffff"+ // field 404, encoding 5, -32 fixed32 - "a919c0ffffffffffffff") // field 405, encoding 1, -64 fixed64 - + protopack.Message{ + protopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7), + protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.String("label"), + protopack.Tag{2, protopack.BytesType}, protopack.String("type"), + }), + protopack.Tag{10, protopack.VarintType}, protopack.Bool(true), + protopack.Tag{11, protopack.VarintType}, protopack.Varint(3), + protopack.Tag{12, protopack.VarintType}, protopack.Varint(6), + protopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32), + protopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64), + protopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232), + protopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464), + protopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232), + protopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464), + protopack.Tag{19, protopack.BytesType}, protopack.String("string"), + protopack.Tag{40, protopack.VarintType}, protopack.Bool(true), + protopack.Tag{41, protopack.VarintType}, protopack.Varint(32), + protopack.Tag{42, protopack.VarintType}, protopack.Varint(64), + protopack.Tag{43, protopack.Fixed32Type}, protopack.Uint32(320), + protopack.Tag{44, protopack.Fixed64Type}, protopack.Uint64(640), + protopack.Tag{45, protopack.VarintType}, protopack.Uvarint(3200), + protopack.Tag{46, protopack.VarintType}, protopack.Uvarint(6400), + protopack.Tag{47, protopack.Fixed32Type}, protopack.Float32(314159), + protopack.Tag{48, protopack.Fixed64Type}, protopack.Float64(271828), + protopack.Tag{49, protopack.BytesType}, protopack.String("hello, \"world!\"\n"), + protopack.Tag{70, protopack.StartGroupType}, + protopack.Message{ + protopack.Tag{71, protopack.BytesType}, protopack.String("required"), + }, + protopack.Tag{70, protopack.EndGroupType}, + protopack.Tag{101, protopack.BytesType}, protopack.Bytes("bytes"), + protopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32), + protopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64), + protopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32), + protopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64), + protopack.Tag{401, protopack.BytesType}, protopack.Bytes("Bignose"), + protopack.Tag{402, protopack.VarintType}, protopack.Svarint(-32), + protopack.Tag{403, protopack.VarintType}, protopack.Svarint(-64), + protopack.Tag{404, protopack.Fixed32Type}, protopack.Int32(-32), + protopack.Tag{405, protopack.Fixed64Type}, protopack.Int64(-64), + }.Marshal()) } // All default fields set to their default value by hand @@ -572,42 +520,48 @@ func TestEncodeDecode3(t *testing.T) { pb.F_Sfixed64Defaulted = proto.Int64(-64) overify(t, pb, - "0807"+ // field 1, encoding 0, value 7 - "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField) - "5001"+ // field 10, encoding 0, value 1 - "5803"+ // field 11, encoding 0, value 3 - "6006"+ // field 12, encoding 0, value 6 - "6d20000000"+ // field 13, encoding 5, value 32 - "714000000000000000"+ // field 14, encoding 1, value 64 - "78a019"+ // field 15, encoding 0, value 3232 - "8001c032"+ // field 16, encoding 0, value 6464 - "8d0100004a45"+ // field 17, encoding 5, value 3232.0 - "9101000000000040b940"+ // field 18, encoding 1, value 6464.0 - "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string" - "c00201"+ // field 40, encoding 0, value 1 - "c80220"+ // field 41, encoding 0, value 32 - "d00240"+ // field 42, encoding 0, value 64 - "dd0240010000"+ // field 43, encoding 5, value 320 - "e1028002000000000000"+ // field 44, encoding 1, value 640 - "e8028019"+ // field 45, encoding 0, value 3200 - "f0028032"+ // field 46, encoding 0, value 6400 - "fd02e0659948"+ // field 47, encoding 5, value 314159.0 - "81030000000050971041"+ // field 48, encoding 1, value 271828.0 - "8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n" - "b304"+ // start group field 70 level 1 - "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required" - "b404"+ // end group field 70 level 1 - "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes" - "b0063f"+ // field 102, encoding 0, 0x3f zigzag32 - "b8067f"+ // field 103, encoding 0, 0x7f zigzag64 - "c506e0ffffff"+ // field 104, encoding 5, -32 fixed32 - "c906c0ffffffffffffff"+ // field 105, encoding 1, -64 fixed64 - "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose" - "90193f"+ // field 402, encoding 0, value 63 - "98197f"+ // field 403, encoding 0, value 127 - "a519e0ffffff"+ // field 404, encoding 5, -32 fixed32 - "a919c0ffffffffffffff") // field 405, encoding 1, -64 fixed64 - + protopack.Message{ + protopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7), + protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.String("label"), + protopack.Tag{2, protopack.BytesType}, protopack.String("type"), + }), + protopack.Tag{10, protopack.VarintType}, protopack.Bool(true), + protopack.Tag{11, protopack.VarintType}, protopack.Varint(3), + protopack.Tag{12, protopack.VarintType}, protopack.Varint(6), + protopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32), + protopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64), + protopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232), + protopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464), + protopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232), + protopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464), + protopack.Tag{19, protopack.BytesType}, protopack.String("string"), + protopack.Tag{40, protopack.VarintType}, protopack.Bool(true), + protopack.Tag{41, protopack.VarintType}, protopack.Varint(32), + protopack.Tag{42, protopack.VarintType}, protopack.Varint(64), + protopack.Tag{43, protopack.Fixed32Type}, protopack.Uint32(320), + protopack.Tag{44, protopack.Fixed64Type}, protopack.Uint64(640), + protopack.Tag{45, protopack.VarintType}, protopack.Uvarint(3200), + protopack.Tag{46, protopack.VarintType}, protopack.Uvarint(6400), + protopack.Tag{47, protopack.Fixed32Type}, protopack.Float32(314159), + protopack.Tag{48, protopack.Fixed64Type}, protopack.Float64(271828), + protopack.Tag{49, protopack.BytesType}, protopack.String("hello, \"world!\"\n"), + protopack.Tag{70, protopack.StartGroupType}, + protopack.Message{ + protopack.Tag{71, protopack.BytesType}, protopack.String("required"), + }, + protopack.Tag{70, protopack.EndGroupType}, + protopack.Tag{101, protopack.BytesType}, protopack.Bytes("bytes"), + protopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32), + protopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64), + protopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32), + protopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64), + protopack.Tag{401, protopack.BytesType}, protopack.Bytes("Bignose"), + protopack.Tag{402, protopack.VarintType}, protopack.Svarint(-32), + protopack.Tag{403, protopack.VarintType}, protopack.Svarint(-64), + protopack.Tag{404, protopack.Fixed32Type}, protopack.Int32(-32), + protopack.Tag{405, protopack.Fixed64Type}, protopack.Int64(-64), + }.Marshal()) } // All required fields set, defaults provided, all non-defaulted optional fields have values. @@ -634,63 +588,74 @@ func TestEncodeDecode4(t *testing.T) { pb.Optionalgroup = initGoTest_OptionalGroup() overify(t, pb, - "0807"+ // field 1, encoding 0, value 7 - "1205"+"68656c6c6f"+ // field 2, encoding 2, string "hello" - "1807"+ // field 3, encoding 0, value 7 - "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField) - "320d"+"0a056c6162656c120474797065"+ // field 6, encoding 2 (GoTestField) - "5001"+ // field 10, encoding 0, value 1 - "5803"+ // field 11, encoding 0, value 3 - "6006"+ // field 12, encoding 0, value 6 - "6d20000000"+ // field 13, encoding 5, value 32 - "714000000000000000"+ // field 14, encoding 1, value 64 - "78a019"+ // field 15, encoding 0, value 3232 - "8001c032"+ // field 16, encoding 0, value 6464 - "8d0100004a45"+ // field 17, encoding 5, value 3232.0 - "9101000000000040b940"+ // field 18, encoding 1, value 6464.0 - "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string" - "f00101"+ // field 30, encoding 0, value 1 - "f80120"+ // field 31, encoding 0, value 32 - "800240"+ // field 32, encoding 0, value 64 - "8d02a00c0000"+ // field 33, encoding 5, value 3232 - "91024019000000000000"+ // field 34, encoding 1, value 6464 - "9802a0dd13"+ // field 35, encoding 0, value 323232 - "a002c0ba27"+ // field 36, encoding 0, value 646464 - "ad0200000042"+ // field 37, encoding 5, value 32.0 - "b1020000000000005040"+ // field 38, encoding 1, value 64.0 - "ba0205"+"68656c6c6f"+ // field 39, encoding 2, string "hello" - "c00201"+ // field 40, encoding 0, value 1 - "c80220"+ // field 41, encoding 0, value 32 - "d00240"+ // field 42, encoding 0, value 64 - "dd0240010000"+ // field 43, encoding 5, value 320 - "e1028002000000000000"+ // field 44, encoding 1, value 640 - "e8028019"+ // field 45, encoding 0, value 3200 - "f0028032"+ // field 46, encoding 0, value 6400 - "fd02e0659948"+ // field 47, encoding 5, value 314159.0 - "81030000000050971041"+ // field 48, encoding 1, value 271828.0 - "8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n" - "b304"+ // start group field 70 level 1 - "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required" - "b404"+ // end group field 70 level 1 - "d305"+ // start group field 90 level 1 - "da0508"+"6f7074696f6e616c"+ // field 91, encoding 2, string "optional" - "d405"+ // end group field 90 level 1 - "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes" - "b0063f"+ // field 102, encoding 0, 0x3f zigzag32 - "b8067f"+ // field 103, encoding 0, 0x7f zigzag64 - "c506e0ffffff"+ // field 104, encoding 5, -32 fixed32 - "c906c0ffffffffffffff"+ // field 105, encoding 1, -64 fixed64 - "ea1207"+"4269676e6f7365"+ // field 301, encoding 2, string "Bignose" - "f0123f"+ // field 302, encoding 0, value 63 - "f8127f"+ // field 303, encoding 0, value 127 - "8513e0ffffff"+ // field 304, encoding 5, -32 fixed32 - "8913c0ffffffffffffff"+ // field 305, encoding 1, -64 fixed64 - "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose" - "90193f"+ // field 402, encoding 0, value 63 - "98197f"+ // field 403, encoding 0, value 127 - "a519e0ffffff"+ // field 404, encoding 5, -32 fixed32 - "a919c0ffffffffffffff") // field 405, encoding 1, -64 fixed64 - + protopack.Message{ + protopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7), + protopack.Tag{2, protopack.BytesType}, protopack.String("hello"), + protopack.Tag{3, protopack.VarintType}, protopack.Varint(7), + protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.String("label"), + protopack.Tag{2, protopack.BytesType}, protopack.String("type"), + }), + protopack.Tag{6, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.String("label"), + protopack.Tag{2, protopack.BytesType}, protopack.String("type"), + }), + protopack.Tag{10, protopack.VarintType}, protopack.Bool(true), + protopack.Tag{11, protopack.VarintType}, protopack.Varint(3), + protopack.Tag{12, protopack.VarintType}, protopack.Varint(6), + protopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32), + protopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64), + protopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232), + protopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464), + protopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232), + protopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464), + protopack.Tag{19, protopack.BytesType}, protopack.String("string"), + protopack.Tag{30, protopack.VarintType}, protopack.Bool(true), + protopack.Tag{31, protopack.VarintType}, protopack.Varint(32), + protopack.Tag{32, protopack.VarintType}, protopack.Varint(64), + protopack.Tag{33, protopack.Fixed32Type}, protopack.Uint32(3232), + protopack.Tag{34, protopack.Fixed64Type}, protopack.Uint64(6464), + protopack.Tag{35, protopack.VarintType}, protopack.Uvarint(323232), + protopack.Tag{36, protopack.VarintType}, protopack.Uvarint(646464), + protopack.Tag{37, protopack.Fixed32Type}, protopack.Float32(32), + protopack.Tag{38, protopack.Fixed64Type}, protopack.Float64(64), + protopack.Tag{39, protopack.BytesType}, protopack.String("hello"), + protopack.Tag{40, protopack.VarintType}, protopack.Bool(true), + protopack.Tag{41, protopack.VarintType}, protopack.Varint(32), + protopack.Tag{42, protopack.VarintType}, protopack.Varint(64), + protopack.Tag{43, protopack.Fixed32Type}, protopack.Uint32(320), + protopack.Tag{44, protopack.Fixed64Type}, protopack.Uint64(640), + protopack.Tag{45, protopack.VarintType}, protopack.Uvarint(3200), + protopack.Tag{46, protopack.VarintType}, protopack.Uvarint(6400), + protopack.Tag{47, protopack.Fixed32Type}, protopack.Float32(314159), + protopack.Tag{48, protopack.Fixed64Type}, protopack.Float64(271828), + protopack.Tag{49, protopack.BytesType}, protopack.String("hello, \"world!\"\n"), + protopack.Tag{70, protopack.StartGroupType}, + protopack.Message{ + protopack.Tag{71, protopack.BytesType}, protopack.String("required"), + }, + protopack.Tag{70, protopack.EndGroupType}, + protopack.Tag{90, protopack.StartGroupType}, + protopack.Message{ + protopack.Tag{91, protopack.BytesType}, protopack.String("optional"), + }, + protopack.Tag{90, protopack.EndGroupType}, + protopack.Tag{101, protopack.BytesType}, protopack.Bytes("bytes"), + protopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32), + protopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64), + protopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32), + protopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64), + protopack.Tag{301, protopack.BytesType}, protopack.Bytes("Bignose"), + protopack.Tag{302, protopack.VarintType}, protopack.Svarint(-32), + protopack.Tag{303, protopack.VarintType}, protopack.Svarint(-64), + protopack.Tag{304, protopack.Fixed32Type}, protopack.Int32(-32), + protopack.Tag{305, protopack.Fixed64Type}, protopack.Int64(-64), + protopack.Tag{401, protopack.BytesType}, protopack.Bytes("Bignose"), + protopack.Tag{402, protopack.VarintType}, protopack.Svarint(-32), + protopack.Tag{403, protopack.VarintType}, protopack.Svarint(-64), + protopack.Tag{404, protopack.Fixed32Type}, protopack.Int32(-32), + protopack.Tag{405, protopack.Fixed64Type}, protopack.Int64(-64), + }.Marshal()) } // All required fields set, defaults provided, all repeated fields given two values. @@ -715,80 +680,96 @@ func TestEncodeDecode5(t *testing.T) { pb.Repeatedgroup = []*pb2.GoTest_RepeatedGroup{initGoTest_RepeatedGroup(), initGoTest_RepeatedGroup()} overify(t, pb, - "0807"+ // field 1, encoding 0, value 7 - "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField) - "2a0d"+"0a056c6162656c120474797065"+ // field 5, encoding 2 (GoTestField) - "2a0d"+"0a056c6162656c120474797065"+ // field 5, encoding 2 (GoTestField) - "5001"+ // field 10, encoding 0, value 1 - "5803"+ // field 11, encoding 0, value 3 - "6006"+ // field 12, encoding 0, value 6 - "6d20000000"+ // field 13, encoding 5, value 32 - "714000000000000000"+ // field 14, encoding 1, value 64 - "78a019"+ // field 15, encoding 0, value 3232 - "8001c032"+ // field 16, encoding 0, value 6464 - "8d0100004a45"+ // field 17, encoding 5, value 3232.0 - "9101000000000040b940"+ // field 18, encoding 1, value 6464.0 - "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string" - "a00100"+ // field 20, encoding 0, value 0 - "a00101"+ // field 20, encoding 0, value 1 - "a80120"+ // field 21, encoding 0, value 32 - "a80121"+ // field 21, encoding 0, value 33 - "b00140"+ // field 22, encoding 0, value 64 - "b00141"+ // field 22, encoding 0, value 65 - "bd01a00c0000"+ // field 23, encoding 5, value 3232 - "bd01050d0000"+ // field 23, encoding 5, value 3333 - "c1014019000000000000"+ // field 24, encoding 1, value 6464 - "c101a519000000000000"+ // field 24, encoding 1, value 6565 - "c801a0dd13"+ // field 25, encoding 0, value 323232 - "c80195ac14"+ // field 25, encoding 0, value 333333 - "d001c0ba27"+ // field 26, encoding 0, value 646464 - "d001b58928"+ // field 26, encoding 0, value 656565 - "dd0100000042"+ // field 27, encoding 5, value 32.0 - "dd0100000442"+ // field 27, encoding 5, value 33.0 - "e1010000000000005040"+ // field 28, encoding 1, value 64.0 - "e1010000000000405040"+ // field 28, encoding 1, value 65.0 - "ea0105"+"68656c6c6f"+ // field 29, encoding 2, string "hello" - "ea0106"+"7361696c6f72"+ // field 29, encoding 2, string "sailor" - "c00201"+ // field 40, encoding 0, value 1 - "c80220"+ // field 41, encoding 0, value 32 - "d00240"+ // field 42, encoding 0, value 64 - "dd0240010000"+ // field 43, encoding 5, value 320 - "e1028002000000000000"+ // field 44, encoding 1, value 640 - "e8028019"+ // field 45, encoding 0, value 3200 - "f0028032"+ // field 46, encoding 0, value 6400 - "fd02e0659948"+ // field 47, encoding 5, value 314159.0 - "81030000000050971041"+ // field 48, encoding 1, value 271828.0 - "8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n" - "b304"+ // start group field 70 level 1 - "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required" - "b404"+ // end group field 70 level 1 - "8305"+ // start group field 80 level 1 - "8a0508"+"7265706561746564"+ // field 81, encoding 2, string "repeated" - "8405"+ // end group field 80 level 1 - "8305"+ // start group field 80 level 1 - "8a0508"+"7265706561746564"+ // field 81, encoding 2, string "repeated" - "8405"+ // end group field 80 level 1 - "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes" - "b0063f"+ // field 102, encoding 0, 0x3f zigzag32 - "b8067f"+ // field 103, encoding 0, 0x7f zigzag64 - "c506e0ffffff"+ // field 104, encoding 5, -32 fixed32 - "c906c0ffffffffffffff"+ // field 105, encoding 1, -64 fixed64 - "ca0c03"+"626967"+ // field 201, encoding 2, string "big" - "ca0c04"+"6e6f7365"+ // field 201, encoding 2, string "nose" - "d00c40"+ // field 202, encoding 0, value 32 - "d00c3f"+ // field 202, encoding 0, value -32 - "d80c8001"+ // field 203, encoding 0, value 64 - "d80c7f"+ // field 203, encoding 0, value -64 - "e50c20000000"+ // field 204, encoding 5, 32 fixed32 - "e50ce0ffffff"+ // field 204, encoding 5, -32 fixed32 - "e90c4000000000000000"+ // field 205, encoding 1, 64 fixed64 - "e90cc0ffffffffffffff"+ // field 205, encoding 1, -64 fixed64 - "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose" - "90193f"+ // field 402, encoding 0, value 63 - "98197f"+ // field 403, encoding 0, value 127 - "a519e0ffffff"+ // field 404, encoding 5, -32 fixed32 - "a919c0ffffffffffffff") // field 405, encoding 1, -64 fixed64 - + protopack.Message{ + protopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7), + protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.String("label"), + protopack.Tag{2, protopack.BytesType}, protopack.String("type"), + }), + protopack.Tag{5, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.String("label"), + protopack.Tag{2, protopack.BytesType}, protopack.String("type"), + }), + protopack.Tag{5, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.String("label"), + protopack.Tag{2, protopack.BytesType}, protopack.String("type"), + }), + protopack.Tag{10, protopack.VarintType}, protopack.Bool(true), + protopack.Tag{11, protopack.VarintType}, protopack.Varint(3), + protopack.Tag{12, protopack.VarintType}, protopack.Varint(6), + protopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32), + protopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64), + protopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232), + protopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464), + protopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232), + protopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464), + protopack.Tag{19, protopack.BytesType}, protopack.String("string"), + protopack.Tag{20, protopack.VarintType}, protopack.Bool(false), + protopack.Tag{20, protopack.VarintType}, protopack.Bool(true), + protopack.Tag{21, protopack.VarintType}, protopack.Varint(32), + protopack.Tag{21, protopack.VarintType}, protopack.Varint(33), + protopack.Tag{22, protopack.VarintType}, protopack.Varint(64), + protopack.Tag{22, protopack.VarintType}, protopack.Varint(65), + protopack.Tag{23, protopack.Fixed32Type}, protopack.Uint32(3232), + protopack.Tag{23, protopack.Fixed32Type}, protopack.Uint32(3333), + protopack.Tag{24, protopack.Fixed64Type}, protopack.Uint64(6464), + protopack.Tag{24, protopack.Fixed64Type}, protopack.Uint64(6565), + protopack.Tag{25, protopack.VarintType}, protopack.Uvarint(323232), + protopack.Tag{25, protopack.VarintType}, protopack.Uvarint(333333), + protopack.Tag{26, protopack.VarintType}, protopack.Uvarint(646464), + protopack.Tag{26, protopack.VarintType}, protopack.Uvarint(656565), + protopack.Tag{27, protopack.Fixed32Type}, protopack.Float32(32), + protopack.Tag{27, protopack.Fixed32Type}, protopack.Float32(33), + protopack.Tag{28, protopack.Fixed64Type}, protopack.Float64(64), + protopack.Tag{28, protopack.Fixed64Type}, protopack.Float64(65), + protopack.Tag{29, protopack.BytesType}, protopack.String("hello"), + protopack.Tag{29, protopack.BytesType}, protopack.String("sailor"), + protopack.Tag{40, protopack.VarintType}, protopack.Bool(true), + protopack.Tag{41, protopack.VarintType}, protopack.Varint(32), + protopack.Tag{42, protopack.VarintType}, protopack.Varint(64), + protopack.Tag{43, protopack.Fixed32Type}, protopack.Uint32(320), + protopack.Tag{44, protopack.Fixed64Type}, protopack.Uint64(640), + protopack.Tag{45, protopack.VarintType}, protopack.Uvarint(3200), + protopack.Tag{46, protopack.VarintType}, protopack.Uvarint(6400), + protopack.Tag{47, protopack.Fixed32Type}, protopack.Float32(314159), + protopack.Tag{48, protopack.Fixed64Type}, protopack.Float64(271828), + protopack.Tag{49, protopack.BytesType}, protopack.String("hello, \"world!\"\n"), + protopack.Tag{70, protopack.StartGroupType}, + protopack.Message{ + protopack.Tag{71, protopack.BytesType}, protopack.String("required"), + }, + protopack.Tag{70, protopack.EndGroupType}, + protopack.Tag{80, protopack.StartGroupType}, + protopack.Message{ + protopack.Tag{81, protopack.BytesType}, protopack.String("repeated"), + }, + protopack.Tag{80, protopack.EndGroupType}, + protopack.Tag{80, protopack.StartGroupType}, + protopack.Message{ + protopack.Tag{81, protopack.BytesType}, protopack.String("repeated"), + }, + protopack.Tag{80, protopack.EndGroupType}, + protopack.Tag{101, protopack.BytesType}, protopack.Bytes("bytes"), + protopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32), + protopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64), + protopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32), + protopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64), + protopack.Tag{201, protopack.BytesType}, protopack.Bytes("big"), + protopack.Tag{201, protopack.BytesType}, protopack.Bytes("nose"), + protopack.Tag{202, protopack.VarintType}, protopack.Svarint(32), + protopack.Tag{202, protopack.VarintType}, protopack.Svarint(-32), + protopack.Tag{203, protopack.VarintType}, protopack.Svarint(64), + protopack.Tag{203, protopack.VarintType}, protopack.Svarint(-64), + protopack.Tag{204, protopack.Fixed32Type}, protopack.Int32(32), + protopack.Tag{204, protopack.Fixed32Type}, protopack.Int32(-32), + protopack.Tag{205, protopack.Fixed64Type}, protopack.Int64(64), + protopack.Tag{205, protopack.Fixed64Type}, protopack.Int64(-64), + protopack.Tag{401, protopack.BytesType}, protopack.Bytes("Bignose"), + protopack.Tag{402, protopack.VarintType}, protopack.Svarint(-32), + protopack.Tag{403, protopack.VarintType}, protopack.Svarint(-64), + protopack.Tag{404, protopack.Fixed32Type}, protopack.Int32(-32), + protopack.Tag{405, protopack.Fixed64Type}, protopack.Int64(-64), + }.Marshal()) } // All required fields set, all packed repeated fields given two values. @@ -809,50 +790,46 @@ func TestEncodeDecode6(t *testing.T) { pb.F_Sfixed64RepeatedPacked = []int64{64, -64} overify(t, pb, - "0807"+ // field 1, encoding 0, value 7 - "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField) - "5001"+ // field 10, encoding 0, value 1 - "5803"+ // field 11, encoding 0, value 3 - "6006"+ // field 12, encoding 0, value 6 - "6d20000000"+ // field 13, encoding 5, value 32 - "714000000000000000"+ // field 14, encoding 1, value 64 - "78a019"+ // field 15, encoding 0, value 3232 - "8001c032"+ // field 16, encoding 0, value 6464 - "8d0100004a45"+ // field 17, encoding 5, value 3232.0 - "9101000000000040b940"+ // field 18, encoding 1, value 6464.0 - "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string" - "9203020001"+ // field 50, encoding 2, 2 bytes, value 0, value 1 - "9a03022021"+ // field 51, encoding 2, 2 bytes, value 32, value 33 - "a203024041"+ // field 52, encoding 2, 2 bytes, value 64, value 65 - "aa0308"+ // field 53, encoding 2, 8 bytes - "a00c0000050d0000"+ // value 3232, value 3333 - "b20310"+ // field 54, encoding 2, 16 bytes - "4019000000000000a519000000000000"+ // value 6464, value 6565 - "ba0306"+ // field 55, encoding 2, 6 bytes - "a0dd1395ac14"+ // value 323232, value 333333 - "c20306"+ // field 56, encoding 2, 6 bytes - "c0ba27b58928"+ // value 646464, value 656565 - "ca0308"+ // field 57, encoding 2, 8 bytes - "0000004200000442"+ // value 32.0, value 33.0 - "d20310"+ // field 58, encoding 2, 16 bytes - "00000000000050400000000000405040"+ // value 64.0, value 65.0 - "b304"+ // start group field 70 level 1 - "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required" - "b404"+ // end group field 70 level 1 - "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes" - "b0063f"+ // field 102, encoding 0, 0x3f zigzag32 - "b8067f"+ // field 103, encoding 0, 0x7f zigzag64 - "c506e0ffffff"+ // field 104, encoding 5, -32 fixed32 - "c906c0ffffffffffffff"+ // field 105, encoding 1, -64 fixed64 - "b21f02"+ // field 502, encoding 2, 2 bytes - "403f"+ // value 32, value -32 - "ba1f03"+ // field 503, encoding 2, 3 bytes - "80017f"+ // value 64, value -64 - "c21f08"+ // field 504, encoding 2, 8 bytes - "20000000e0ffffff"+ // value 32, value -32 - "ca1f10"+ // field 505, encoding 2, 16 bytes - "4000000000000000c0ffffffffffffff") // value 64, value -64 - + protopack.Message{ + protopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7), + protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.String("label"), + protopack.Tag{2, protopack.BytesType}, protopack.String("type"), + }), + protopack.Tag{10, protopack.VarintType}, protopack.Bool(true), + protopack.Tag{11, protopack.VarintType}, protopack.Varint(3), + protopack.Tag{12, protopack.VarintType}, protopack.Varint(6), + protopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32), + protopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64), + protopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232), + protopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464), + protopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232), + protopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464), + protopack.Tag{19, protopack.BytesType}, protopack.String("string"), + protopack.Tag{50, protopack.BytesType}, protopack.LengthPrefix{protopack.Bool(false), protopack.Bool(true)}, + protopack.Tag{51, protopack.BytesType}, protopack.LengthPrefix{protopack.Varint(32), protopack.Varint(33)}, + protopack.Tag{52, protopack.BytesType}, protopack.LengthPrefix{protopack.Varint(64), protopack.Varint(65)}, + protopack.Tag{53, protopack.BytesType}, protopack.LengthPrefix{protopack.Uint32(3232), protopack.Uint32(3333)}, + protopack.Tag{54, protopack.BytesType}, protopack.LengthPrefix{protopack.Uint64(6464), protopack.Uint64(6565)}, + protopack.Tag{55, protopack.BytesType}, protopack.LengthPrefix{protopack.Uvarint(323232), protopack.Uvarint(333333)}, + protopack.Tag{56, protopack.BytesType}, protopack.LengthPrefix{protopack.Uvarint(646464), protopack.Uvarint(656565)}, + protopack.Tag{57, protopack.BytesType}, protopack.LengthPrefix{protopack.Float32(32), protopack.Float32(33)}, + protopack.Tag{58, protopack.BytesType}, protopack.LengthPrefix{protopack.Float64(64), protopack.Float64(65)}, + protopack.Tag{70, protopack.StartGroupType}, + protopack.Message{ + protopack.Tag{71, protopack.BytesType}, protopack.String("required"), + }, + protopack.Tag{70, protopack.EndGroupType}, + protopack.Tag{101, protopack.BytesType}, protopack.Bytes("bytes"), + protopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32), + protopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64), + protopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32), + protopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64), + protopack.Tag{502, protopack.BytesType}, protopack.LengthPrefix{protopack.Svarint(32), protopack.Svarint(-32)}, + protopack.Tag{503, protopack.BytesType}, protopack.LengthPrefix{protopack.Svarint(64), protopack.Svarint(-64)}, + protopack.Tag{504, protopack.BytesType}, protopack.LengthPrefix{protopack.Int32(32), protopack.Int32(-32)}, + protopack.Tag{505, protopack.BytesType}, protopack.LengthPrefix{protopack.Int64(64), protopack.Int64(-64)}, + }.Marshal()) } // Test that we can encode empty bytes fields. @@ -910,7 +887,7 @@ func TestEncodeDecodeBytes2(t *testing.T) { // All required fields set, defaults provided, all repeated fields given two values. func TestSkippingUnrecognizedFields(t *testing.T) { - o := old() + o := new(proto.Buffer) pb := initGoTestField() // Marshal it normally. @@ -940,22 +917,18 @@ func TestSkippingUnrecognizedFields(t *testing.T) { o.SetBuf(pbd.XXX_unrecognized) o.Unmarshal(skipd) - if *skipd.SkipInt32 != *skip.SkipInt32 { + switch { + case *skipd.SkipInt32 != *skip.SkipInt32: t.Error("skip int32", skipd.SkipInt32) - } - if *skipd.SkipFixed32 != *skip.SkipFixed32 { + case *skipd.SkipFixed32 != *skip.SkipFixed32: t.Error("skip fixed32", skipd.SkipFixed32) - } - if *skipd.SkipFixed64 != *skip.SkipFixed64 { + case *skipd.SkipFixed64 != *skip.SkipFixed64: t.Error("skip fixed64", skipd.SkipFixed64) - } - if *skipd.SkipString != *skip.SkipString { + case *skipd.SkipString != *skip.SkipString: t.Error("skip string", *skipd.SkipString) - } - if *skipd.Skipgroup.GroupInt32 != *skip.Skipgroup.GroupInt32 { + case *skipd.Skipgroup.GroupInt32 != *skip.Skipgroup.GroupInt32: t.Error("skip group int32", skipd.Skipgroup.GroupInt32) - } - if *skipd.Skipgroup.GroupString != *skip.Skipgroup.GroupString { + case *skipd.Skipgroup.GroupString != *skip.Skipgroup.GroupString: t.Error("skip group string", *skipd.Skipgroup.GroupString) } } @@ -1096,64 +1069,77 @@ func TestBigRepeated(t *testing.T) { // Check the checkable values for i := uint64(0); i < N; i++ { - if pbd.Repeatedgroup[i] == nil { + switch { + case pbd.Repeatedgroup[i] == nil: t.Error("pbd.Repeatedgroup bad") - } - if x := uint64(pbd.F_Sint64Repeated[i]); x != i { - t.Error("pbd.F_Sint64Repeated bad", x, i) - } - if x := uint64(pbd.F_Sint32Repeated[i]); x != i { - t.Error("pbd.F_Sint32Repeated bad", x, i) - } - s := fmt.Sprint(i) - equalbytes(pbd.F_BytesRepeated[i], []byte(s), t) - if pbd.F_StringRepeated[i] != s { + case uint64(pbd.F_Sint64Repeated[i]) != i: + t.Error("pbd.F_Sint64Repeated bad", uint64(pbd.F_Sint64Repeated[i]), i) + case uint64(pbd.F_Sint32Repeated[i]) != i: + t.Error("pbd.F_Sint32Repeated bad", uint64(pbd.F_Sint32Repeated[i]), i) + case !bytes.Equal(pbd.F_BytesRepeated[i], []byte(fmt.Sprint(i))): + t.Error("pbd.F_BytesRepeated bad", pbd.F_BytesRepeated[i], i) + case pbd.F_StringRepeated[i] != string(fmt.Sprint(i)): t.Error("pbd.F_Sint32Repeated bad", pbd.F_StringRepeated[i], i) - } - if x := uint64(pbd.F_DoubleRepeated[i]); x != i { - t.Error("pbd.F_DoubleRepeated bad", x, i) - } - if x := uint64(pbd.F_FloatRepeated[i]); x != i { - t.Error("pbd.F_FloatRepeated bad", x, i) - } - if x := pbd.F_Uint64Repeated[i]; x != i { - t.Error("pbd.F_Uint64Repeated bad", x, i) - } - if x := uint64(pbd.F_Uint32Repeated[i]); x != i { - t.Error("pbd.F_Uint32Repeated bad", x, i) - } - if x := pbd.F_Fixed64Repeated[i]; x != i { - t.Error("pbd.F_Fixed64Repeated bad", x, i) - } - if x := uint64(pbd.F_Fixed32Repeated[i]); x != i { - t.Error("pbd.F_Fixed32Repeated bad", x, i) - } - if x := uint64(pbd.F_Int64Repeated[i]); x != i { - t.Error("pbd.F_Int64Repeated bad", x, i) - } - if x := uint64(pbd.F_Int32Repeated[i]); x != i { - t.Error("pbd.F_Int32Repeated bad", x, i) - } - if x := pbd.F_BoolRepeated[i]; x != (i%2 == 0) { - t.Error("pbd.F_BoolRepeated bad", x, i) - } - if pbd.RepeatedField[i] == nil { + case uint64(pbd.F_DoubleRepeated[i]) != i: + t.Error("pbd.F_DoubleRepeated bad", uint64(pbd.F_DoubleRepeated[i]), i) + case uint64(pbd.F_FloatRepeated[i]) != i: + t.Error("pbd.F_FloatRepeated bad", uint64(pbd.F_FloatRepeated[i]), i) + case pbd.F_Uint64Repeated[i] != i: + t.Error("pbd.F_Uint64Repeated bad", pbd.F_Uint64Repeated[i], i) + case uint64(pbd.F_Uint32Repeated[i]) != i: + t.Error("pbd.F_Uint32Repeated bad", uint64(pbd.F_Uint32Repeated[i]), i) + case pbd.F_Fixed64Repeated[i] != i: + t.Error("pbd.F_Fixed64Repeated bad", pbd.F_Fixed64Repeated[i], i) + case uint64(pbd.F_Fixed32Repeated[i]) != i: + t.Error("pbd.F_Fixed32Repeated bad", uint64(pbd.F_Fixed32Repeated[i]), i) + case uint64(pbd.F_Int64Repeated[i]) != i: + t.Error("pbd.F_Int64Repeated bad", uint64(pbd.F_Int64Repeated[i]), i) + case uint64(pbd.F_Int32Repeated[i]) != i: + t.Error("pbd.F_Int32Repeated bad", uint64(pbd.F_Int32Repeated[i]), i) + case pbd.F_BoolRepeated[i] != (i%2 == 0): + t.Error("pbd.F_BoolRepeated bad", pbd.F_BoolRepeated[i], i) + case pbd.RepeatedField[i] == nil: t.Error("pbd.RepeatedField bad") } } } func TestBadWireTypeUnknown(t *testing.T) { - var b []byte - fmt.Sscanf("0a01780d00000000080b101612036161611521000000202c220362626225370000002203636363214200000000000000584d5a036464645900000000000056405d63000000", "%x", &b) + b := protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.Bytes("x"), + protopack.Tag{1, protopack.Fixed32Type}, protopack.Uint32(0), + protopack.Tag{1, protopack.VarintType}, protopack.Varint(11), + protopack.Tag{2, protopack.VarintType}, protopack.Uvarint(22), + protopack.Tag{2, protopack.BytesType}, protopack.String("aaa"), + protopack.Tag{2, protopack.Fixed32Type}, protopack.Uint32(33), + protopack.Tag{4, protopack.VarintType}, protopack.Uvarint(44), + protopack.Tag{4, protopack.BytesType}, protopack.String("bbb"), + protopack.Tag{4, protopack.Fixed32Type}, protopack.Uint32(55), + protopack.Tag{4, protopack.BytesType}, protopack.String("ccc"), + protopack.Tag{4, protopack.Fixed64Type}, protopack.Uint64(66), + protopack.Tag{11, protopack.VarintType}, protopack.Uvarint(77), + protopack.Tag{11, protopack.BytesType}, protopack.Bytes("ddd"), + protopack.Tag{11, protopack.Fixed64Type}, protopack.Float64(88), + protopack.Tag{11, protopack.Fixed32Type}, protopack.Uint32(99), + }.Marshal() m := new(pb2.MyMessage) if err := proto.Unmarshal(b, m); err != nil { t.Errorf("unexpected Unmarshal error: %v", err) } - var unknown []byte - fmt.Sscanf("0a01780d0000000010161521000000202c2537000000214200000000000000584d5a036464645d63000000", "%x", &unknown) + unknown := protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.Bytes("x"), + protopack.Tag{1, protopack.Fixed32Type}, protopack.Uint32(0), + protopack.Tag{2, protopack.VarintType}, protopack.Uvarint(22), + protopack.Tag{2, protopack.Fixed32Type}, protopack.Uint32(33), + protopack.Tag{4, protopack.VarintType}, protopack.Uvarint(44), + protopack.Tag{4, protopack.Fixed32Type}, protopack.Uint32(55), + protopack.Tag{4, protopack.Fixed64Type}, protopack.Uint64(66), + protopack.Tag{11, protopack.VarintType}, protopack.Uvarint(77), + protopack.Tag{11, protopack.BytesType}, protopack.Bytes("ddd"), + protopack.Tag{11, protopack.Fixed32Type}, protopack.Uint32(99), + }.Marshal() if !bytes.Equal(m.XXX_unrecognized, unknown) { t.Errorf("unknown bytes mismatch:\ngot %x\nwant %x", m.XXX_unrecognized, unknown) } @@ -1206,7 +1192,7 @@ func TestProto1RepeatedGroup(t *testing.T) { }, } - o := old() + o := new(proto.Buffer) err := o.Marshal(pb) if err == nil { t.Fatalf("expected error when marshaling repeted nil MessageList.Message") @@ -1222,7 +1208,7 @@ func TestProto1RepeatedGroup(t *testing.T) { func TestEnum(t *testing.T) { pb := new(pb2.GoEnum) pb.Foo = pb2.FOO_FOO1.Enum() - o := old() + o := new(proto.Buffer) if err := o.Marshal(pb); err != nil { t.Fatal("error encoding enum:", err) } @@ -1338,11 +1324,11 @@ func TestNilMarshaler(t *testing.T) { func TestAllSetDefaults(t *testing.T) { // Exercise SetDefaults with all scalar field types. - m := &pb2.Defaults{ + got := &pb2.Defaults{ // NaN != NaN, so override that here. F_Nan: proto.Float32(1.7), } - expected := &pb2.Defaults{ + want := &pb2.Defaults{ F_Bool: proto.Bool(true), F_Int32: proto.Int32(32), F_Int64: proto.Int64(64), @@ -1362,9 +1348,9 @@ func TestAllSetDefaults(t *testing.T) { F_Nan: proto.Float32(1.7), StrZero: proto.String(""), } - proto.SetDefaults(m) - if !proto.Equal(m, expected) { - t.Errorf("SetDefaults failed\n got %v\nwant %v", m, expected) + proto.SetDefaults(got) + if !proto.Equal(got, want) { + t.Errorf("SetDefaults failed\n got %v\nwant %v", got, want) } } @@ -1380,48 +1366,48 @@ func TestSetDefaultsWithSetField(t *testing.T) { } func TestSetDefaultsWithSubMessage(t *testing.T) { - m := &pb2.OtherMessage{ + got := &pb2.OtherMessage{ Key: proto.Int64(123), Inner: &pb2.InnerMessage{ Host: proto.String("gopher"), }, } - expected := &pb2.OtherMessage{ + want := &pb2.OtherMessage{ Key: proto.Int64(123), Inner: &pb2.InnerMessage{ Host: proto.String("gopher"), Port: proto.Int32(4000), }, } - proto.SetDefaults(m) - if !proto.Equal(m, expected) { - t.Errorf("\n got %v\nwant %v", m, expected) + proto.SetDefaults(got) + if !proto.Equal(got, want) { + t.Errorf("\n got %v\nwant %v", got, want) } } func TestSetDefaultsWithRepeatedSubMessage(t *testing.T) { - m := &pb2.MyMessage{ + got := &pb2.MyMessage{ RepInner: []*pb2.InnerMessage{{}}, } - expected := &pb2.MyMessage{ + want := &pb2.MyMessage{ RepInner: []*pb2.InnerMessage{{ Port: proto.Int32(4000), }}, } - proto.SetDefaults(m) - if !proto.Equal(m, expected) { - t.Errorf("\n got %v\nwant %v", m, expected) + proto.SetDefaults(got) + if !proto.Equal(got, want) { + t.Errorf("\n got %v\nwant %v", got, want) } } func TestSetDefaultWithRepeatedNonMessage(t *testing.T) { - m := &pb2.MyMessage{ + got := &pb2.MyMessage{ Pet: []string{"turtle", "wombat"}, } - expected := proto.Clone(m) - proto.SetDefaults(m) - if !proto.Equal(m, expected) { - t.Errorf("\n got %v\nwant %v", m, expected) + want := proto.Clone(got) + proto.SetDefaults(got) + if !proto.Equal(got, want) { + t.Errorf("\n got %v\nwant %v", got, want) } } @@ -1451,15 +1437,15 @@ func TestJSON(t *testing.T) { }, Bikeshed: pb2.MyMessage_GREEN.Enum(), } - const expected = `{"count":4,"pet":["bunny","kitty"],"inner":{"host":"cauchy"},"bikeshed":1}` + const want = `{"count":4,"pet":["bunny","kitty"],"inner":{"host":"cauchy"},"bikeshed":1}` b, err := json.Marshal(m) if err != nil { t.Fatalf("json.Marshal failed: %v", err) } s := string(b) - if s != expected { - t.Errorf("got %s\nwant %s", s, expected) + if s != want { + t.Errorf("got %s\nwant %s", s, want) } received := new(pb2.MyMessage) @@ -1470,7 +1456,7 @@ func TestJSON(t *testing.T) { t.Fatalf("got %s, want %s", received, m) } - // Test unmarshalling of JSON with symbolic enum name. + // Test unmarshaling of JSON with symbolic enum name. const old = `{"count":4,"pet":["bunny","kitty"],"inner":{"host":"cauchy"},"bikeshed":"GREEN"}` received.Reset() if err := json.Unmarshal([]byte(old), received); err != nil { @@ -1491,19 +1477,29 @@ func TestBadWireType(t *testing.T) { func TestBytesWithInvalidLength(t *testing.T) { // If a byte sequence has an invalid (negative) length, Unmarshal should not panic. - b := []byte{2<<3 | proto.WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0} + b := protopack.Message{ + protopack.Tag{2, protopack.BytesType}, protopack.Denormalized{+1, protopack.Uvarint(34359738367)}, + }.Marshal() proto.Unmarshal(b, new(pb2.MyMessage)) } func TestLengthOverflow(t *testing.T) { // Overflowing a length should not panic. - b := []byte{2<<3 | proto.WireBytes, 1, 1, 3<<3 | proto.WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x01} + b := protopack.Message{ + protopack.Tag{2, protopack.BytesType}, protopack.String("\x01"), + protopack.Tag{3, protopack.BytesType}, protopack.Uvarint(9223372036854775807), + protopack.Raw("\x01"), + }.Marshal() proto.Unmarshal(b, new(pb2.MyMessage)) } func TestVarintOverflow(t *testing.T) { // Overflowing a 64-bit length should not be allowed. - b := []byte{1<<3 | proto.WireVarint, 0x01, 3<<3 | proto.WireBytes, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01} + b := protopack.Message{ + protopack.Tag{1, protopack.VarintType}, protopack.Varint(1), + protopack.Tag{3, protopack.BytesType}, + protopack.Raw("\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x01"), + }.Marshal() if err := proto.Unmarshal(b, new(pb2.MyMessage)); err == nil { t.Fatalf("Overflowed uint64 length without error") } @@ -1511,7 +1507,13 @@ func TestVarintOverflow(t *testing.T) { func TestBytesWithInvalidLengthInGroup(t *testing.T) { // Overflowing a 64-bit length should not be allowed. - b := []byte{0xbb, 0x30, 0xb2, 0x30, 0xb0, 0xb2, 0x83, 0xf1, 0xb0, 0xb2, 0xef, 0xbf, 0xbd, 0x01} + b := protopack.Message{ + protopack.Tag{775, protopack.StartGroupType}, + protopack.Message{ + protopack.Tag{774, protopack.BytesType}, protopack.Uvarint(13654841034505509168), + protopack.Raw(""), + }, + }.Marshal() if err := proto.Unmarshal(b, new(pb2.MyMessage)); err == nil { t.Fatalf("Overflowed uint64 length without error") } @@ -1720,54 +1722,54 @@ func TestRequiredNotSetError(t *testing.T) { pb.F_Int32Required = nil pb.F_Int64Required = nil - expected := "0807" + // field 1, encoding 0, value 7 - "2206" + "120474797065" + // field 4, encoding 2 (GoTestField) - "5001" + // field 10, encoding 0, value 1 - "6d20000000" + // field 13, encoding 5, value 0x20 - "714000000000000000" + // field 14, encoding 1, value 0x40 - "78a019" + // field 15, encoding 0, value 0xca0 = 3232 - "8001c032" + // field 16, encoding 0, value 0x1940 = 6464 - "8d0100004a45" + // field 17, encoding 5, value 3232.0 - "9101000000000040b940" + // field 18, encoding 1, value 6464.0 - "9a0106" + "737472696e67" + // field 19, encoding 2, string "string" - "b304" + // field 70, encoding 3, start group - "ba0408" + "7265717569726564" + // field 71, encoding 2, string "required" - "b404" + // field 70, encoding 4, end group - "aa0605" + "6279746573" + // field 101, encoding 2, string "bytes" - "b0063f" + // field 102, encoding 0, 0x3f zigzag32 - "b8067f" + // field 103, encoding 0, 0x7f zigzag64 - "c506e0ffffff" + // field 104, encoding 5, -32 fixed32 - "c906c0ffffffffffffff" // field 105, encoding 1, -64 fixed64 - - o := old() - bytes, err := proto.Marshal(pb) + want := protopack.Message{ + protopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7), + protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{2, protopack.BytesType}, protopack.String("type"), + }), + protopack.Tag{10, protopack.VarintType}, protopack.Bool(true), + protopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32), + protopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64), + protopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232), + protopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464), + protopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232), + protopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464), + protopack.Tag{19, protopack.BytesType}, protopack.String("string"), + protopack.Tag{70, protopack.StartGroupType}, + protopack.Message{ + protopack.Tag{71, protopack.BytesType}, protopack.String("required"), + }, + protopack.Tag{70, protopack.EndGroupType}, + protopack.Tag{101, protopack.BytesType}, protopack.Bytes("bytes"), + protopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32), + protopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64), + protopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32), + protopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64), + }.Marshal() + + got, err := proto.Marshal(pb) if !isRequiredNotSetError(err) { - fmt.Printf("marshal-1 err = %v, want *RequiredNotSetError", err) - o.DebugPrint("", bytes) - t.Fatalf("expected = %s", expected) + t.Logf("marshal-1 err = %v, want *RequiredNotSetError", err) + t.Fatalf("got %q\nwant %q", got, want) } - if !equal(bytes, expected, t) { - o.DebugPrint("neq 1", bytes) - t.Fatalf("expected = %s", expected) + if !bytes.Equal(got, want) { + t.Fatalf("got %q\nwant %q", got, want) } // Now test Unmarshal by recreating the original buffer. pbd := new(pb2.GoTest) - err = proto.Unmarshal(bytes, pbd) + err = proto.Unmarshal(got, pbd) if !isRequiredNotSetError(err) { - t.Fatalf("unmarshal err = %v, want *RequiredNotSetError", err) - o.DebugPrint("", bytes) - t.Fatalf("string = %s", expected) + t.Errorf("unmarshal err = %v, want *RequiredNotSetError", err) + t.Fatalf("got %q\nwant %q", got, want) } - bytes, err = proto.Marshal(pbd) + got, err = proto.Marshal(pbd) if !isRequiredNotSetError(err) { t.Errorf("marshal-2 err = %v, want *RequiredNotSetError", err) - o.DebugPrint("", bytes) - t.Fatalf("string = %s", expected) + t.Fatalf("got %q\nwant %q", got, want) } - if !equal(bytes, expected, t) { - o.DebugPrint("neq 2", bytes) - t.Fatalf("string = %s", expected) + if !bytes.Equal(got, want) { + t.Fatalf("got %q\nwant %q", got, want) } } @@ -1970,11 +1972,11 @@ func TestDecodeMapFieldMissingKey(t *testing.T) { } func TestDecodeMapFieldMissingValue(t *testing.T) { - b := []byte{ - 0x0A, 0x02, // message, tag 1 (name_mapping), of length 2 bytes - 0x08, 0x01, // varint key, value 1 - // no value - } + b := protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.VarintType}, protopack.Uvarint(1), + }), + }.Marshal() got := &pb2.MessageWithMap{} err := proto.Unmarshal(b, got) if err != nil { @@ -2045,10 +2047,9 @@ func TestOneofNilBytes(t *testing.T) { if err != nil { t.Fatalf("Marshal failed: %v", err) } - want := []byte{ - 7<<3 | 2, // tag 7, wire type 2 - 0, // size - } + want := protopack.Message{ + protopack.Tag{7, protopack.BytesType}, protopack.Bytes(""), + }.Marshal() if !bytes.Equal(b, want) { t.Errorf("Wrong result of Marshal: got %x, want %x", b, want) } @@ -2056,12 +2057,9 @@ func TestOneofNilBytes(t *testing.T) { func TestInefficientPackedBool(t *testing.T) { // https://github.com/golang/protobuf/issues/76 - inp := []byte{ - 0x12, 0x02, // 0x12 = 2<<3|2; 2 bytes - // Usually a bool should take a single byte, - // but it is permitted to be any varint. - 0xb9, 0x30, - } + inp := protopack.Message{ + protopack.Tag{2, protopack.BytesType}, protopack.Bytes("\xb90"), + }.Marshal() if err := proto.Unmarshal(inp, new(pb2.MoreRepeated)); err != nil { t.Error(err) } @@ -2212,8 +2210,6 @@ func TestUnknownV2(t *testing.T) { } } -// Benchmarks - func testMsg() *pb2.GoTest { pb := initGoTest(true) const N = 1000 // Internally the library starts much smaller. @@ -2261,102 +2257,6 @@ func benchmarkSize(b *testing.B, pb proto.Message) { }) } -func newOf(pb proto.Message) proto.Message { - in := reflect.ValueOf(pb) - if in.IsNil() { - return pb - } - return reflect.New(in.Type().Elem()).Interface().(proto.Message) -} - -func benchmarkUnmarshal(b *testing.B, pb proto.Message, unmarshal func([]byte, proto.Message) error) { - d, _ := proto.Marshal(pb) - b.SetBytes(int64(len(d))) - pbd := newOf(pb) - - b.ResetTimer() - for i := 0; i < b.N; i++ { - unmarshal(d, pbd) - } -} - -func benchmarkBufferUnmarshal(b *testing.B, pb proto.Message) { - p := proto.NewBuffer(nil) - benchmarkUnmarshal(b, pb, func(d []byte, pb0 proto.Message) error { - p.SetBuf(d) - return p.Unmarshal(pb0) - }) -} - -// Benchmark{Marshal,BufferMarshal,Size,Unmarshal,BufferUnmarshal}{,Bytes} - -func BenchmarkMarshal(b *testing.B) { - benchmarkMarshal(b, testMsg(), proto.Marshal) -} - -func BenchmarkBufferMarshal(b *testing.B) { - benchmarkBufferMarshal(b, testMsg()) -} - -func BenchmarkSize(b *testing.B) { - benchmarkSize(b, testMsg()) -} - -func BenchmarkUnmarshal(b *testing.B) { - benchmarkUnmarshal(b, testMsg(), proto.Unmarshal) -} - -func BenchmarkBufferUnmarshal(b *testing.B) { - benchmarkBufferUnmarshal(b, testMsg()) -} - -func BenchmarkMarshalBytes(b *testing.B) { - benchmarkMarshal(b, bytesMsg(), proto.Marshal) -} - -func BenchmarkBufferMarshalBytes(b *testing.B) { - benchmarkBufferMarshal(b, bytesMsg()) -} - -func BenchmarkSizeBytes(b *testing.B) { - benchmarkSize(b, bytesMsg()) -} - -func BenchmarkUnmarshalBytes(b *testing.B) { - benchmarkUnmarshal(b, bytesMsg(), proto.Unmarshal) -} - -func BenchmarkBufferUnmarshalBytes(b *testing.B) { - benchmarkBufferUnmarshal(b, bytesMsg()) -} - -func BenchmarkUnmarshalUnrecognizedFields(b *testing.B) { - b.StopTimer() - pb := initGoTestField() - skip := &pb2.GoSkipTest{ - SkipInt32: proto.Int32(32), - SkipFixed32: proto.Uint32(3232), - SkipFixed64: proto.Uint64(6464), - SkipString: proto.String("skipper"), - Skipgroup: &pb2.GoSkipTest_SkipGroup{ - GroupInt32: proto.Int32(75), - GroupString: proto.String("wxyz"), - }, - } - - pbd := new(pb2.GoTestField) - p := proto.NewBuffer(nil) - p.Marshal(pb) - p.Marshal(skip) - p2 := proto.NewBuffer(nil) - - b.StartTimer() - for i := 0; i < b.N; i++ { - p2.SetBuf(p.Bytes()) - p2.Unmarshal(pbd) - } -} - func TestProto3ZeroValues(t *testing.T) { tests := []struct { desc string @@ -2468,8 +2368,36 @@ func TestUnknownFieldPreservation(t *testing.T) { } func TestMap(t *testing.T) { - var b []byte - fmt.Sscanf("a2010c0a044b657931120456616c31a201130a044b657932120556616c3261120456616c32a201240a044b6579330d05000000120556616c33621a0556616c3361120456616c331505000000a20100a201260a044b657934130a07536f6d6555524c1209536f6d655469746c651a08536e69707065743114", "%x", &b) + b := protopack.Message{ + protopack.Tag{20, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.String("Key1"), + protopack.Tag{2, protopack.BytesType}, protopack.String("Val1"), + }), + protopack.Tag{20, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.String("Key2"), + protopack.Tag{2, protopack.BytesType}, protopack.String("Val2a"), + protopack.Tag{2, protopack.BytesType}, protopack.String("Val2"), + }), + protopack.Tag{20, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.String("Key3"), + protopack.Tag{1, protopack.Fixed32Type}, protopack.Uint32(5), + protopack.Tag{2, protopack.BytesType}, protopack.String("Val3b"), + protopack.Tag{3, protopack.BytesType}, protopack.Bytes("Val3a"), + protopack.Tag{2, protopack.BytesType}, protopack.String("Val3"), + protopack.Tag{2, protopack.Fixed32Type}, protopack.Uint32(5), + }), + protopack.Tag{20, protopack.BytesType}, protopack.LengthPrefix{}, + protopack.Tag{20, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.String("Key4"), + protopack.Tag{2, protopack.StartGroupType}, + protopack.Message{ + protopack.Tag{1, protopack.BytesType}, protopack.Bytes("SomeURL"), + protopack.Tag{2, protopack.BytesType}, protopack.Bytes("SomeTitle"), + protopack.Tag{3, protopack.BytesType}, protopack.Bytes("Snippet1"), + }, + protopack.Tag{2, protopack.EndGroupType}, + }), + }.Marshal() var m pb3.Message if err := proto.Unmarshal(b, &m); err != nil { @@ -2504,25 +2432,162 @@ func marshalled() []byte { return b } -func BenchmarkConcurrentMapUnmarshal(b *testing.B) { - in := marshalled() - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - var out pb3.IntMaps - if err := proto.Unmarshal(in, &out); err != nil { - b.Errorf("Can't unmarshal ppb.IntMaps: %v", err) +var messageWithExtension1 = &pb2.MyMessage{Count: proto.Int32(7)} + +// messageWithExtension2 is in equal_test.go. +var messageWithExtension3 = &pb2.MyMessage{Count: proto.Int32(8)} + +func init() { + if err := proto.SetExtension(messageWithExtension1, pb2.E_Ext_More, &pb2.Ext{Data: proto.String("Abbott")}); err != nil { + log.Panicf("proto.SetExtension: %v", err) + } + if err := proto.SetExtension(messageWithExtension3, pb2.E_Ext_More, &pb2.Ext{Data: proto.String("Costello")}); err != nil { + log.Panicf("proto.SetExtension: %v", err) + } + + // Force messageWithExtension3 to have the extension encoded. + proto.Marshal(messageWithExtension3) + +} + +// non-pointer custom message +type nonptrMessage struct{} + +func (m nonptrMessage) ProtoMessage() {} +func (m nonptrMessage) Reset() {} +func (m nonptrMessage) String() string { return "" } + +func (m nonptrMessage) Marshal() ([]byte, error) { + return []byte{42}, nil +} + +var SizeTests = []struct { + desc string + pb proto.Message +}{ + {"empty", &pb2.OtherMessage{}}, + // Basic types. + {"bool", &pb2.Defaults{F_Bool: proto.Bool(true)}}, + {"int32", &pb2.Defaults{F_Int32: proto.Int32(12)}}, + {"negative int32", &pb2.Defaults{F_Int32: proto.Int32(-1)}}, + {"small int64", &pb2.Defaults{F_Int64: proto.Int64(1)}}, + {"big int64", &pb2.Defaults{F_Int64: proto.Int64(1 << 20)}}, + {"negative int64", &pb2.Defaults{F_Int64: proto.Int64(-1)}}, + {"fixed32", &pb2.Defaults{F_Fixed32: proto.Uint32(71)}}, + {"fixed64", &pb2.Defaults{F_Fixed64: proto.Uint64(72)}}, + {"uint32", &pb2.Defaults{F_Uint32: proto.Uint32(123)}}, + {"uint64", &pb2.Defaults{F_Uint64: proto.Uint64(124)}}, + {"float", &pb2.Defaults{F_Float: proto.Float32(12.6)}}, + {"double", &pb2.Defaults{F_Double: proto.Float64(13.9)}}, + {"string", &pb2.Defaults{F_String: proto.String("niles")}}, + {"bytes", &pb2.Defaults{F_Bytes: []byte("wowsa")}}, + {"bytes, empty", &pb2.Defaults{F_Bytes: []byte{}}}, + {"sint32", &pb2.Defaults{F_Sint32: proto.Int32(65)}}, + {"sint64", &pb2.Defaults{F_Sint64: proto.Int64(67)}}, + {"enum", &pb2.Defaults{F_Enum: pb2.Defaults_BLUE.Enum()}}, + // Repeated. + {"empty repeated bool", &pb2.MoreRepeated{Bools: []bool{}}}, + {"repeated bool", &pb2.MoreRepeated{Bools: []bool{false, true, true, false}}}, + {"packed repeated bool", &pb2.MoreRepeated{BoolsPacked: []bool{false, true, true, false, true, true, true}}}, + {"repeated int32", &pb2.MoreRepeated{Ints: []int32{1, 12203, 1729, -1}}}, + {"repeated int32 packed", &pb2.MoreRepeated{IntsPacked: []int32{1, 12203, 1729}}}, + {"repeated int64 packed", &pb2.MoreRepeated{Int64SPacked: []int64{ + // Need enough large numbers to verify that the header is counting the number of bytes + // for the field, not the number of elements. + 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, + 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, + }}}, + {"repeated string", &pb2.MoreRepeated{Strings: []string{"r", "ken", "gri"}}}, + {"repeated fixed", &pb2.MoreRepeated{Fixeds: []uint32{1, 2, 3, 4}}}, + // Nested. + {"nested", &pb2.OldMessage{Nested: &pb2.OldMessage_Nested{Name: proto.String("whatever")}}}, + {"group", &pb2.GroupOld{G: &pb2.GroupOld_G{X: proto.Int32(12345)}}}, + // Other things. + {"unrecognized", &pb2.MoreRepeated{XXX_unrecognized: []byte{13<<3 | 0, 4}}}, + {"extension (unencoded)", messageWithExtension1}, + {"extension (encoded)", messageWithExtension3}, + // proto3 message + {"proto3 empty", &pb3.Message{}}, + {"proto3 bool", &pb3.Message{TrueScotsman: true}}, + {"proto3 int64", &pb3.Message{ResultCount: 1}}, + {"proto3 uint32", &pb3.Message{HeightInCm: 123}}, + {"proto3 float", &pb3.Message{Score: 12.6}}, + {"proto3 string", &pb3.Message{Name: "Snezana"}}, + {"proto3 bytes", &pb3.Message{Data: []byte("wowsa")}}, + {"proto3 bytes, empty", &pb3.Message{Data: []byte{}}}, + {"proto3 enum", &pb3.Message{Hilarity: pb3.Message_PUNS}}, + {"proto3 map field with empty bytes", &pb3.MessageWithMap{ByteMapping: map[bool][]byte{false: []byte{}}}}, + + {"map field", &pb2.MessageWithMap{NameMapping: map[int32]string{1: "Rob", 7: "Andrew"}}}, + {"map field with message", &pb2.MessageWithMap{MsgMapping: map[int64]*pb2.FloatingPoint{0x7001: &pb2.FloatingPoint{F: proto.Float64(2.0)}}}}, + {"map field with bytes", &pb2.MessageWithMap{ByteMapping: map[bool][]byte{true: []byte("this time for sure")}}}, + {"map field with empty bytes", &pb2.MessageWithMap{ByteMapping: map[bool][]byte{true: []byte{}}}}, + + {"map field with big entry", &pb2.MessageWithMap{NameMapping: map[int32]string{8: strings.Repeat("x", 125)}}}, + {"map field with big key and val", &pb2.MessageWithMap{StrToStr: map[string]string{strings.Repeat("x", 70): strings.Repeat("y", 70)}}}, + {"map field with big numeric key", &pb2.MessageWithMap{NameMapping: map[int32]string{0xf00d: "om nom nom"}}}, + + {"oneof not set", &pb2.Oneof{}}, + {"oneof bool", &pb2.Oneof{Union: &pb2.Oneof_F_Bool{true}}}, + {"oneof zero int32", &pb2.Oneof{Union: &pb2.Oneof_F_Int32{0}}}, + {"oneof big int32", &pb2.Oneof{Union: &pb2.Oneof_F_Int32{1 << 20}}}, + {"oneof int64", &pb2.Oneof{Union: &pb2.Oneof_F_Int64{42}}}, + {"oneof fixed32", &pb2.Oneof{Union: &pb2.Oneof_F_Fixed32{43}}}, + {"oneof fixed64", &pb2.Oneof{Union: &pb2.Oneof_F_Fixed64{44}}}, + {"oneof uint32", &pb2.Oneof{Union: &pb2.Oneof_F_Uint32{45}}}, + {"oneof uint64", &pb2.Oneof{Union: &pb2.Oneof_F_Uint64{46}}}, + {"oneof float", &pb2.Oneof{Union: &pb2.Oneof_F_Float{47.1}}}, + {"oneof double", &pb2.Oneof{Union: &pb2.Oneof_F_Double{48.9}}}, + {"oneof string", &pb2.Oneof{Union: &pb2.Oneof_F_String{"Rhythmic Fman"}}}, + {"oneof bytes", &pb2.Oneof{Union: &pb2.Oneof_F_Bytes{[]byte("let go")}}}, + {"oneof sint32", &pb2.Oneof{Union: &pb2.Oneof_F_Sint32{50}}}, + {"oneof sint64", &pb2.Oneof{Union: &pb2.Oneof_F_Sint64{51}}}, + {"oneof enum", &pb2.Oneof{Union: &pb2.Oneof_F_Enum{pb2.MyMessage_BLUE}}}, + {"message for oneof", &pb2.GoTestField{Label: proto.String("k"), Type: proto.String("v")}}, + {"oneof message", &pb2.Oneof{Union: &pb2.Oneof_F_Message{&pb2.GoTestField{Label: proto.String("k"), Type: proto.String("v")}}}}, + {"oneof group", &pb2.Oneof{Union: &pb2.Oneof_FGroup{&pb2.Oneof_F_Group{X: proto.Int32(52)}}}}, + {"oneof largest tag", &pb2.Oneof{Union: &pb2.Oneof_F_Largest_Tag{1}}}, + {"multiple oneofs", &pb2.Oneof{Union: &pb2.Oneof_F_Int32{1}, Tormato: &pb2.Oneof_Value{2}}}, + + {"non-pointer message", nonptrMessage{}}, +} + +func TestSize(t *testing.T) { + for _, tc := range SizeTests { + t.Run(tc.desc, func(t *testing.T) { + size := proto.Size(tc.pb) + b, err := proto.Marshal(tc.pb) + if err != nil { + t.Errorf("%v: Marshal failed: %v", tc.desc, err) + return } - } - }) + if size != len(b) { + t.Errorf("%v: Size(%v) = %d, want %d", tc.desc, tc.pb, size, len(b)) + t.Logf("%v: bytes: %#v", tc.desc, b) + } + }) + } } -func BenchmarkSequentialMapUnmarshal(b *testing.B) { - in := marshalled() - b.ResetTimer() - for i := 0; i < b.N; i++ { - var out pb3.IntMaps - if err := proto.Unmarshal(in, &out); err != nil { - b.Errorf("Can't unmarshal ppb.IntMaps: %v", err) +func TestVarintSize(t *testing.T) { + // Check the edge cases carefully. + testCases := []struct { + n uint64 + size int + }{ + {0, 1}, + {1, 1}, + {127, 1}, + {128, 2}, + {16383, 2}, + {16384, 3}, + {math.MaxInt64, 9}, + {math.MaxInt64 + 1, 10}, + } + for _, tc := range testCases { + size := proto.SizeVarint(tc.n) + if size != tc.size { + t.Errorf("sizeVarint(%d) = %d, want %d", tc.n, size, tc.size) } } } diff --git a/proto/wire_decode_test.go b/proto/wire_decode_test.go deleted file mode 100644 index 24aff75766..0000000000 --- a/proto/wire_decode_test.go +++ /dev/null @@ -1,227 +0,0 @@ -// 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_test - -import ( - "fmt" - "testing" - - "github.com/golang/protobuf/proto" - - pb3 "github.com/golang/protobuf/internal/testprotos/proto3_proto" -) - -var msgBlackhole = new(pb3.Message) - -// BenchmarkVarint32ArraySmall shows the performance on an array of small int32 fields (1 and -// 2 bytes long). -func BenchmarkVarint32ArraySmall(b *testing.B) { - for i := uint(1); i <= 10; i++ { - dist := genInt32Dist([7]int{0, 3, 1}, 1< Date: Mon, 13 Apr 2020 12:43:07 -0700 Subject: [PATCH 114/133] all: upgrade to google.golang.org/protobuf@v1.21.0 (#1081) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2ce329e06e..f17daa8577 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.9 require ( github.com/google/go-cmp v0.4.0 - google.golang.org/protobuf v1.20.2-0.20200320194150-9d397869d892 + google.golang.org/protobuf v1.21.0 ) diff --git a/go.sum b/go.sum index b4226a0a1e..2c4d6c7494 100644 --- a/go.sum +++ b/go.sum @@ -12,5 +12,5 @@ google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLY 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.20.2-0.20200320194150-9d397869d892 h1:LQPEPzH8usKk01hUU5qdXb17Tgjr/BLZhHy1h90Vd7U= -google.golang.org/protobuf v1.20.2-0.20200320194150-9d397869d892/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zimw= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= From fa093f59480c0adaaabf88a72a0b0e48b95aec25 Mon Sep 17 00:00:00 2001 From: Marcel Lanz Date: Sun, 19 Apr 2020 22:26:30 +0200 Subject: [PATCH 115/133] proto: fix stale deprecation documentation on registry functions (#1093) The documentation unfortunately refers to old declarations that were changed during the development of the `google.golang.org/protobuf` module. --- proto/registry.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/proto/registry.go b/proto/registry.go index abab110a06..1e7ff64205 100644 --- a/proto/registry.go +++ b/proto/registry.go @@ -29,7 +29,7 @@ var fileCache sync.Map // map[filePath]fileDescGZIP // RegisterFile is called from generated code to register the compressed // FileDescriptorProto with the file path for a proto source file. // -// Deprecated: Use protoregistry.GlobalFiles.Register instead. +// Deprecated: Use protoregistry.GlobalFiles.RegisterFile instead. func RegisterFile(s filePath, d fileDescGZIP) { // Decompress the descriptor. zr, err := gzip.NewReader(bytes.NewReader(d)) @@ -53,7 +53,7 @@ func RegisterFile(s filePath, d fileDescGZIP) { // FileDescriptor returns the compressed FileDescriptorProto given the file path // for a proto source file. It returns nil if not found. // -// Deprecated: Use protoregistry.GlobalFiles.RangeFilesByPath instead. +// Deprecated: Use protoregistry.GlobalFiles.FindFileByPath instead. func FileDescriptor(s filePath) fileDescGZIP { if v, ok := fileCache.Load(s); ok { return v.(fileDescGZIP) @@ -98,7 +98,7 @@ var numFilesCache sync.Map // map[protoreflect.FullName]int // RegisterEnum is called from the generated code to register the mapping of // enum value names to enum numbers for the enum identified by s. // -// Deprecated: Use protoregistry.GlobalTypes.Register instead. +// Deprecated: Use protoregistry.GlobalTypes.RegisterEnum instead. func RegisterEnum(s enumName, _ enumsByNumber, m enumsByName) { if _, ok := enumCache.Load(s); ok { panic("proto: duplicate enum registered: " + s) @@ -181,7 +181,7 @@ var messageTypeCache sync.Map // map[messageName]reflect.Type // RegisterType is called from generated code to register the message Go type // for a message of the given name. // -// Deprecated: Use protoregistry.GlobalTypes.Register instead. +// Deprecated: Use protoregistry.GlobalTypes.RegisterMessage instead. func RegisterType(m Message, s messageName) { mt := protoimpl.X.LegacyMessageTypeOf(m, protoreflect.FullName(s)) if err := protoregistry.GlobalTypes.RegisterMessage(mt); err != nil { @@ -280,7 +280,7 @@ func MessageName(m Message) messageName { // RegisterExtension is called from the generated code to register // the extension descriptor. // -// Deprecated: Use protoregistry.GlobalTypes.Register instead. +// Deprecated: Use protoregistry.GlobalTypes.RegisterExtension instead. func RegisterExtension(d *ExtensionDesc) { if err := protoregistry.GlobalTypes.RegisterExtension(d); err != nil { panic(err) From 8d9af285403e1acdb3b235d3dcca77099325f417 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 4 May 2020 12:07:49 -0700 Subject: [PATCH 116/133] protoc-gen-go/grpc: make grpc identical to v1.3.5 (#1113) Even through the grpc package is excluded from our compatibility agreement, the v1.4.0 release accidentally reverted the package to an older revision. Update this code to be identical to the v1.3.5 release (barring non-semantic documentation changes). Fixes #1111 --- protoc-gen-go/grpc/grpc.go | 79 +++++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 5 deletions(-) diff --git a/protoc-gen-go/grpc/grpc.go b/protoc-gen-go/grpc/grpc.go index 88e20d7af9..40cba163b5 100644 --- a/protoc-gen-go/grpc/grpc.go +++ b/protoc-gen-go/grpc/grpc.go @@ -1,4 +1,4 @@ -// Copyright 2015 The Go Authors. All rights reserved. +// Copyright 2015 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. @@ -23,13 +23,15 @@ import ( // It is incremented whenever an incompatibility between the generated code and // the grpc package is introduced; the generated code references // a constant, grpc.SupportPackageIsVersionN (where N is generatedCodeVersion). -const generatedCodeVersion = 4 +const generatedCodeVersion = 6 // Paths for packages used by code generated in this file, // relative to the import_prefix of the generator.Generator. const ( contextPkgPath = "context" grpcPkgPath = "google.golang.org/grpc" + codePkgPath = "google.golang.org/grpc/codes" + statusPkgPath = "google.golang.org/grpc/status" ) func init() { @@ -86,7 +88,7 @@ func (g *grpc) Generate(file *generator.FileDescriptor) { g.P("// Reference imports to suppress errors if they are not otherwise used.") g.P("var _ ", contextPkg, ".Context") - g.P("var _ ", grpcPkg, ".ClientConn") + g.P("var _ ", grpcPkg, ".ClientConnInterface") g.P() // Assert version compatibility. @@ -140,6 +142,10 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi g.P("type ", servName, "Client interface {") for i, method := range service.Method { g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service. + if method.GetOptions().GetDeprecated() { + g.P("//") + g.P(deprecationComment) + } g.P(g.generateClientSignature(servName, method)) } g.P("}") @@ -147,7 +153,7 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi // Client structure. g.P("type ", unexport(servName), "Client struct {") - g.P("cc *", grpcPkg, ".ClientConn") + g.P("cc ", grpcPkg, ".ClientConnInterface") g.P("}") g.P() @@ -155,7 +161,7 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi if deprecated { g.P(deprecationComment) } - g.P("func New", servName, "Client (cc *", grpcPkg, ".ClientConn) ", servName, "Client {") + g.P("func New", servName, "Client (cc ", grpcPkg, ".ClientConnInterface) ", servName, "Client {") g.P("return &", unexport(servName), "Client{cc}") g.P("}") g.P() @@ -187,11 +193,21 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi g.P("type ", serverType, " interface {") for i, method := range service.Method { g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service. + if method.GetOptions().GetDeprecated() { + g.P("//") + g.P(deprecationComment) + } g.P(g.generateServerSignature(servName, method)) } g.P("}") g.P() + // Server Unimplemented struct for forward compatibility. + if deprecated { + g.P(deprecationComment) + } + g.generateUnimplementedServer(servName, service) + // Server registration. if deprecated { g.P(deprecationComment) @@ -245,6 +261,35 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi g.P() } +// generateUnimplementedServer creates the unimplemented server struct +func (g *grpc) generateUnimplementedServer(servName string, service *pb.ServiceDescriptorProto) { + serverType := servName + "Server" + g.P("// Unimplemented", serverType, " can be embedded to have forward compatible implementations.") + g.P("type Unimplemented", serverType, " struct {") + g.P("}") + g.P() + // UnimplementedServer's concrete methods + for _, method := range service.Method { + g.generateServerMethodConcrete(servName, method) + } + g.P() +} + +// generateServerMethodConcrete returns unimplemented methods which ensure forward compatibility +func (g *grpc) generateServerMethodConcrete(servName string, method *pb.MethodDescriptorProto) { + header := g.generateServerSignatureWithParamNames(servName, method) + g.P("func (*Unimplemented", servName, "Server) ", header, " {") + var nilArg string + if !method.GetServerStreaming() && !method.GetClientStreaming() { + nilArg = "nil, " + } + methName := generator.CamelCase(method.GetName()) + statusPkg := string(g.gen.AddImport(statusPkgPath)) + codePkg := string(g.gen.AddImport(codePkgPath)) + g.P("return ", nilArg, statusPkg, `.Errorf(`, codePkg, `.Unimplemented, "method `, methName, ` not implemented")`) + g.P("}") +} + // generateClientSignature returns the client-side signature for a method. func (g *grpc) generateClientSignature(servName string, method *pb.MethodDescriptorProto) string { origMethName := method.GetName() @@ -344,6 +389,30 @@ func (g *grpc) generateClientMethod(servName, fullServName, serviceDescVar strin } } +// generateServerSignatureWithParamNames returns the server-side signature for a method with parameter names. +func (g *grpc) generateServerSignatureWithParamNames(servName string, method *pb.MethodDescriptorProto) string { + origMethName := method.GetName() + methName := generator.CamelCase(origMethName) + if reservedClientName[methName] { + methName += "_" + } + + var reqArgs []string + ret := "error" + if !method.GetServerStreaming() && !method.GetClientStreaming() { + reqArgs = append(reqArgs, "ctx "+contextPkg+".Context") + ret = "(*" + g.typeName(method.GetOutputType()) + ", error)" + } + if !method.GetClientStreaming() { + reqArgs = append(reqArgs, "req *"+g.typeName(method.GetInputType())) + } + if method.GetServerStreaming() || method.GetClientStreaming() { + reqArgs = append(reqArgs, "srv "+servName+"_"+generator.CamelCase(origMethName)+"Server") + } + + return methName + "(" + strings.Join(reqArgs, ", ") + ") " + ret +} + // generateServerSignature returns the server-side signature for a method. func (g *grpc) generateServerSignature(servName string, method *pb.MethodDescriptorProto) string { origMethName := method.GetName() From b5de78c91d0d09482d65f0a96927631cd343d7bb Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 4 May 2020 12:14:45 -0700 Subject: [PATCH 117/133] all: minor documentation adjustments (#1112) --- README.md | 8 ++++++-- descriptor/descriptor.go | 14 +++++++------- jsonpb/decode.go | 4 ++-- jsonpb/encode.go | 8 ++++---- jsonpb/json.go | 8 ++++---- proto/buffer.go | 14 +++++++------- proto/extensions.go | 4 ++-- proto/text_encode.go | 8 ++++---- protoc-gen-go/generator/generator.go | 3 ++- 9 files changed, 38 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 4f4302c062..2e4233f200 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,11 @@ We recommend that new code use the `google.golang.org/protobuf` module. Versions v1.4 and later of `github.com/golang/protobuf` are implemented in terms of `google.golang.org/protobuf`. -Programs which use both modules should use at least version v1.4 of this one. +Programs which use both modules must use at least version v1.4 of this one. + +See the +[developer guide for protocol buffers in Go](https://developers.google.com/protocol-buffers/docs/gotutorial) +for a general guide for how to get started using protobufs in Go. See [release note documentation](https://github.com/golang/protobuf/releases) @@ -51,7 +55,7 @@ Summary of the packages provided by this module: Package `wrappers` is the generated package for `google/protobuf/wrappers.proto`. * [`ptypes/struct`](https://pkg.go.dev/github.com/golang/protobuf/ptypes/struct): - Package `struct` is the generated package for + Package `structpb` is the generated package for `google/protobuf/struct.proto`. * [`protoc-gen-go/descriptor`](https://pkg.go.dev/github.com/golang/protobuf/protoc-gen-go/descriptor): Package `descriptor` is the generated package for diff --git a/descriptor/descriptor.go b/descriptor/descriptor.go index 53390ea1e6..c3c4a2b87e 100644 --- a/descriptor/descriptor.go +++ b/descriptor/descriptor.go @@ -5,8 +5,8 @@ // Package descriptor provides functions for obtaining the protocol buffer // descriptors of generated Go types. // -// Deprecated: Use the "google.golang.org/protobuf/reflect/protoreflect" -// package instead to obtain an EnumDescriptor or MessageDescriptor in order to +// Deprecated: See the "google.golang.org/protobuf/reflect/protoreflect" package +// for how to obtain an EnumDescriptor or MessageDescriptor in order to // programatically interact with the protobuf type system. package descriptor @@ -99,8 +99,8 @@ func deriveRawDescriptor(d protoreflect.Descriptor) ([]byte, []int) { return file, idxs } -// EnumRawDescriptor returns the GZIP'd raw file descriptor containing the -// enum and the index path to reach the enum declaration. +// EnumRawDescriptor returns the GZIP'd raw file descriptor representing +// the enum and the index path to reach the enum declaration. // The returned slices must not be mutated. func EnumRawDescriptor(e proto.GeneratedEnum) ([]byte, []int) { if ev, ok := e.(interface{ EnumDescriptor() ([]byte, []int) }); ok { @@ -110,7 +110,7 @@ func EnumRawDescriptor(e proto.GeneratedEnum) ([]byte, []int) { return deriveRawDescriptor(ed.Descriptor()) } -// MessageRawDescriptor returns the GZIP'd raw file descriptor containing +// MessageRawDescriptor returns the GZIP'd raw file descriptor representing // the message and the index path to reach the message declaration. // The returned slices must not be mutated. func MessageRawDescriptor(m proto.GeneratedMessage) ([]byte, []int) { @@ -148,7 +148,7 @@ func deriveFileDescriptor(rawDesc []byte) *descriptorpb.FileDescriptorProto { return fd } -// EnumDescriptorProto returns the file descriptor proto containing +// EnumDescriptorProto returns the file descriptor proto representing // the enum and the enum descriptor proto for the enum itself. // The returned proto messages must not be mutated. func EnumDescriptorProto(e proto.GeneratedEnum) (*descriptorpb.FileDescriptorProto, *descriptorpb.EnumDescriptorProto) { @@ -168,7 +168,7 @@ func EnumDescriptorProto(e proto.GeneratedEnum) (*descriptorpb.FileDescriptorPro return fd, ed } -// MessageDescriptorProto returns the file descriptor proto containing +// MessageDescriptorProto returns the file descriptor proto representing // the message and the message descriptor proto for the message itself. // The returned proto messages must not be mutated. func MessageDescriptorProto(m proto.GeneratedMessage) (*descriptorpb.FileDescriptorProto, *descriptorpb.DescriptorProto) { diff --git a/jsonpb/decode.go b/jsonpb/decode.go index 6faa5fe5de..857383025b 100644 --- a/jsonpb/decode.go +++ b/jsonpb/decode.go @@ -24,7 +24,7 @@ import ( const wrapJSONUnmarshalV2 = false -// UnmarshalNext unmarshals the next object in a JSON object stream into m. +// UnmarshalNext unmarshals the next JSON object from d into m. func UnmarshalNext(d *json.Decoder, m proto.Message) error { return new(Unmarshaler).UnmarshalNext(d, m) } @@ -68,7 +68,7 @@ func (u *Unmarshaler) Unmarshal(r io.Reader, m proto.Message) error { return u.UnmarshalNext(json.NewDecoder(r), m) } -// UnmarshalNext unmarshals the next object in a JSON object stream into m. +// UnmarshalNext unmarshals the next JSON object from d into m. func (u *Unmarshaler) UnmarshalNext(d *json.Decoder, m proto.Message) error { if m == nil { return errors.New("invalid nil message") diff --git a/jsonpb/encode.go b/jsonpb/encode.go index c5b80bc8fd..7633019f72 100644 --- a/jsonpb/encode.go +++ b/jsonpb/encode.go @@ -35,11 +35,11 @@ type Marshaler struct { // as opposed to string values. EnumsAsInts bool - // EmitDefaults specifies Whether to render fields with zero values. + // EmitDefaults specifies whether to render fields with zero values. EmitDefaults bool // Indent controls whether the output is compact or not. - // If empty, the output is compact JSON. If non-empty, every JSON object + // If empty, the output is compact JSON. Otherwise, every JSON object // entry and JSON array value will be on its own line. // Each line will be preceded by repeated copies of Indent, where the // number of copies is the current indentation depth. @@ -62,7 +62,7 @@ type JSONPBMarshaler interface { MarshalJSONPB(*Marshaler) ([]byte, error) } -// Marshal marshals a protocol buffer into JSON. +// Marshal serializes a protobuf message as JSON into w. func (jm *Marshaler) Marshal(w io.Writer, m proto.Message) error { b, err := jm.marshal(m) if len(b) > 0 { @@ -73,7 +73,7 @@ func (jm *Marshaler) Marshal(w io.Writer, m proto.Message) error { return err } -// MarshalToString converts a protocol buffer object to JSON string. +// MarshalToString serializes a protobuf message as JSON in string form. func (jm *Marshaler) MarshalToString(m proto.Message) (string, error) { b, err := jm.marshal(m) if err != nil { diff --git a/jsonpb/json.go b/jsonpb/json.go index 6b744104b3..480e2448de 100644 --- a/jsonpb/json.go +++ b/jsonpb/json.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package jsonpb provides marshaling and unmarshaling between a protocol buffer -// message and JSON. It follows the specification at +// Package jsonpb provides functionality to marshal and unmarshal between a +// protocol buffer message and JSON. It follows the specification at // https://developers.google.com/protocol-buffers/docs/proto3#json. // // Do not rely on the default behavior of the standard encoding/json package @@ -20,8 +20,8 @@ import ( "google.golang.org/protobuf/runtime/protoimpl" ) -// AnyResolver takes a type URL, present in an Any message, and resolves it into -// an instance of the associated message. +// AnyResolver takes a type URL, present in an Any message, +// and resolves it into an instance of the associated message. type AnyResolver interface { Resolve(typeURL string) (proto.Message, error) } diff --git a/proto/buffer.go b/proto/buffer.go index 62df7e3b8b..e810e6fea1 100644 --- a/proto/buffer.go +++ b/proto/buffer.go @@ -33,8 +33,8 @@ 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. +// 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) @@ -112,9 +112,9 @@ func (b *Buffer) Marshal(m Message) error { 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. +// Unmarshal parses the wire-format message in the buffer and +// places the decoded results in m. +// It does not reset m before unmarshaling. func (b *Buffer) Unmarshal(m Message) error { err := UnmarshalMerge(b.Unread(), m) b.idx = len(b.buf) @@ -260,7 +260,7 @@ func (b *Buffer) DecodeStringBytes() (string, error) { } // DecodeMessage consumes a length-prefixed message from the buffer. -// It does not reset m. +// It does not reset m before unmarshaling. func (b *Buffer) DecodeMessage(m Message) error { v, err := b.DecodeRawBytes(false) if err != nil { @@ -272,7 +272,7 @@ func (b *Buffer) DecodeMessage(m Message) error { // 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. +// It does not reset m before unmarshaling. func (b *Buffer) DecodeGroup(m Message) error { v, n, err := consumeGroup(b.buf[b.idx:]) if err != nil { diff --git a/proto/extensions.go b/proto/extensions.go index 5ed131c57d..42fc120c97 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -68,7 +68,7 @@ func HasExtension(m Message, xt *ExtensionDesc) (has bool) { return has } -// ClearExtension removes the the exntesion field from m +// ClearExtension removes the extension field from m // either as an explicitly populated field or as an unknown field. func ClearExtension(m Message, xt *ExtensionDesc) { mr := MessageReflect(m) @@ -108,7 +108,7 @@ func ClearAllExtensions(m Message) { clearUnknown(mr, mr.Descriptor().ExtensionRanges()) } -// GetExtension retrieves a proto2 extended field from pb. +// GetExtension retrieves a proto2 extended field from m. // // If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), // then GetExtension parses the encoded field and returns a Go value of the specified type. diff --git a/proto/text_encode.go b/proto/text_encode.go index 7ac02e68f6..a31134eeb3 100644 --- a/proto/text_encode.go +++ b/proto/text_encode.go @@ -94,16 +94,16 @@ var ( ) // MarshalText writes the proto text format of m to w. -func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } +func MarshalText(w io.Writer, m Message) error { return defaultTextMarshaler.Marshal(w, m) } // MarshalTextString returns a proto text formatted string of m. -func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } +func MarshalTextString(m Message) string { return defaultTextMarshaler.Text(m) } // CompactText writes the compact proto text format of m to w. -func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } +func CompactText(w io.Writer, m Message) error { return compactTextMarshaler.Marshal(w, m) } // CompactTextString returns a compact proto text formatted string of m. -func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } +func CompactTextString(m Message) string { return compactTextMarshaler.Text(m) } var ( newline = []byte("\n") diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 791f5113ec..12ff35b94f 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -7,7 +7,8 @@ // This package is excluded from the Go protocol buffer compatibility guarantee // and may be deleted at some point in the future. // -// Deprecated: Do not use. +// Deprecated: Use the "google.golang.org/protobuf/compiler/protogen" package +// instead to write protoc plugins in Go. package generator import ( From 6c66de79d66478d166c7ea05f5d2ccaf016fbd6b Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 4 May 2020 12:38:55 -0700 Subject: [PATCH 118/133] all: upgrade to google.golang.org/protobuf@v1.22.0 (#1114) --- go.mod | 2 +- go.sum | 4 +++- protoc-gen-go/main.go | 1 + protoc-gen-go/plugin/plugin.pb.go | 8 ++++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index f17daa8577..9c4c32154b 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.9 require ( github.com/google/go-cmp v0.4.0 - google.golang.org/protobuf v1.21.0 + google.golang.org/protobuf v1.22.0 ) diff --git a/go.sum b/go.sum index 2c4d6c7494..447f2aea29 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,7 @@ github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi 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/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 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 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= @@ -12,5 +13,6 @@ google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLY 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= +google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= diff --git a/protoc-gen-go/main.go b/protoc-gen-go/main.go index 7515a18b00..d45b719d1c 100644 --- a/protoc-gen-go/main.go +++ b/protoc-gen-go/main.go @@ -68,6 +68,7 @@ func main() { gengogrpc.GenerateFileContent(gen, f, g) } } + gen.SupportedFeatures = gengo.SupportedFeatures return nil }) } diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index 2704536806..b7b4a2f945 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -12,6 +12,14 @@ import ( // Symbols defined in public import of google/protobuf/compiler/plugin.proto. +type CodeGeneratorResponse_Feature = pluginpb.CodeGeneratorResponse_Feature + +const CodeGeneratorResponse_FEATURE_NONE = pluginpb.CodeGeneratorResponse_FEATURE_NONE +const CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL = pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL + +var CodeGeneratorResponse_Feature_name = pluginpb.CodeGeneratorResponse_Feature_name +var CodeGeneratorResponse_Feature_value = pluginpb.CodeGeneratorResponse_Feature_value + type Version = pluginpb.Version type CodeGeneratorRequest = pluginpb.CodeGeneratorRequest type CodeGeneratorResponse = pluginpb.CodeGeneratorResponse From 00998c7dd9d789e353c9518d13864b75cd23c55d Mon Sep 17 00:00:00 2001 From: Isaac Schwabacher <59542438+ijschwabacher@users.noreply.github.com> Date: Mon, 11 May 2020 19:05:48 -0400 Subject: [PATCH 119/133] jsonpb: fix a confusing error message (#1125) The in argument is a []byte. Using the %v print flag prints this list of integers instead of as a string representation of the enum value. Use %q instead. --- jsonpb/decode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonpb/decode.go b/jsonpb/decode.go index 857383025b..7c6c5a5244 100644 --- a/jsonpb/decode.go +++ b/jsonpb/decode.go @@ -474,7 +474,7 @@ func (u *Unmarshaler) unmarshalSingularValue(v protoreflect.Value, in []byte, fd if hasPrefixAndSuffix('"', in, '"') { vd := fd.Enum().Values().ByName(protoreflect.Name(trimQuote(in))) if vd == nil { - return v, fmt.Errorf("unknown value %v for enum %s", in, fd.Enum().FullName()) + return v, fmt.Errorf("unknown value %q for enum %s", in, fd.Enum().FullName()) } return protoreflect.ValueOfEnum(vd.Number()), nil } From 07c14f10892137835ca0e5ab9f9048467ccc8356 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 14 May 2020 12:59:40 -0700 Subject: [PATCH 120/133] proto: make InternalMessageInfo functional (#1129) The InternalMessageInfo type only exists to implement the XXX methods on generated messages where those methods were only ever intended to be called by this module itself. Since v1.4.0, this module no longer relies on the XXX methods, so the InternalMessageInfo and its implementation is supposed to be dead code. Unfortunately, there are external usages that violate our compatibility agreement and either directly call the XXX methods or indirectly call it because some library type-asserts to the existence of these methods. This change adds minimal support for InternalMessageInfo by just calling out directly to the v2 implementation. --- proto/deprecated.go | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/proto/deprecated.go b/proto/deprecated.go index a205482a32..e8db57e097 100644 --- a/proto/deprecated.go +++ b/proto/deprecated.go @@ -9,6 +9,8 @@ import ( "errors" "fmt" "strconv" + + protoV2 "google.golang.org/protobuf/proto" ) var ( @@ -82,11 +84,30 @@ func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, return val, nil } -// Deprecated: Do not use. +// Deprecated: Do not use; this type existed for intenal-use only. 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") } +// Deprecated: Do not use; this method existed for intenal-use only. +func (*InternalMessageInfo) DiscardUnknown(m Message) { + DiscardUnknown(m) +} + +// Deprecated: Do not use; this method existed for intenal-use only. +func (*InternalMessageInfo) Marshal(b []byte, m Message, deterministic bool) ([]byte, error) { + return protoV2.MarshalOptions{Deterministic: deterministic}.MarshalAppend(b, MessageV2(m)) +} + +// Deprecated: Do not use; this method existed for intenal-use only. +func (*InternalMessageInfo) Merge(dst, src Message) { + protoV2.Merge(MessageV2(dst), MessageV2(src)) +} + +// Deprecated: Do not use; this method existed for intenal-use only. +func (*InternalMessageInfo) Size(m Message) int { + return protoV2.Size(MessageV2(m)) +} + +// Deprecated: Do not use; this method existed for intenal-use only. +func (*InternalMessageInfo) Unmarshal(m Message, b []byte) error { + return protoV2.UnmarshalOptions{Merge: true}.Unmarshal(b, MessageV2(m)) +} From d04d7b157bb510b1e0c10132224b616ac0e26b17 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 14 May 2020 13:44:37 -0700 Subject: [PATCH 121/133] all: upgrade to google.golang.org/protobuf@v1.23.0 (#1131) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 9c4c32154b..67adeed862 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.9 require ( github.com/google/go-cmp v0.4.0 - google.golang.org/protobuf v1.22.0 + google.golang.org/protobuf v1.23.0 ) diff --git a/go.sum b/go.sum index 447f2aea29..92baf2631b 100644 --- a/go.sum +++ b/go.sum @@ -14,5 +14,5 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ 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/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= From 3860b2764ff25e103fbe1db40f22248fe7a6dc20 Mon Sep 17 00:00:00 2001 From: Christian Persson Date: Thu, 24 Sep 2020 23:05:11 +0200 Subject: [PATCH 122/133] proto: convert integer to rune before converting to string (#1210) Go 1.15 introduced a new `go vet` warning (https://golang.org/doc/go1.15#vet) for conversions of the form `string(x)` where `x` is an integer type other than `rune` or `byte`. This warning is enabled by default when running `go test`. As a consequence, running `go test github.com/golang/protobuf/proto` results in a build failure prior to this commit. --- proto/text_decode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/text_decode.go b/proto/text_decode.go index 4a59310098..47eb3e4450 100644 --- a/proto/text_decode.go +++ b/proto/text_decode.go @@ -765,7 +765,7 @@ func unescape(s string) (ch string, tail string, err error) { if i > utf8.MaxRune { return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) } - return string(i), s, nil + return string(rune(i)), s, nil } return "", "", fmt.Errorf(`unknown escape \%c`, r) } From 91c84e0db17890c2bb64280a6d660e73e4237fd1 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 24 Sep 2020 17:55:37 -0700 Subject: [PATCH 123/133] travis.yml: update tested versions of Go (#1211) While this module is deprecated, it is still important to ensure that it continues to work with higher versions of Go. Update travis.yml to test up to Go1.15. --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 720ef9da4a..0b5166678a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,10 @@ matrix: - go: 1.11.x script: go test -tags protolegacy -v ./... - go: 1.12.x + script: go test -tags protolegacy -v ./... + - go: 1.13.x + script: go test -tags protolegacy -v ./... + - go: 1.14.x + script: go test -tags protolegacy -v ./... + - go: 1.15.x script: ./test.bash From 4846b58453b3708320bdb524f25cc5a1d9cda4d4 Mon Sep 17 00:00:00 2001 From: Herbie Ong Date: Wed, 14 Oct 2020 23:18:29 -0700 Subject: [PATCH 124/133] jsonpb: Fix marshaling of Duration (#1221) Negative nanosecond should not have negative sign after decimal point. Add check for max and min seconds. Fixes #1219. --- jsonpb/encode.go | 11 ++++++++--- jsonpb/json_test.go | 35 ++++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/jsonpb/encode.go b/jsonpb/encode.go index 7633019f72..685c80a62b 100644 --- a/jsonpb/encode.go +++ b/jsonpb/encode.go @@ -166,20 +166,25 @@ func (w *jsonWriter) marshalMessage(m protoreflect.Message, indent, typeURL stri fd := fds.ByNumber(1) return w.marshalValue(fd, m.Get(fd), indent) case "Duration": + const maxSecondsInDuration = 315576000000 // "Generated output always contains 0, 3, 6, or 9 fractional digits, // depending on required precision." s := m.Get(fds.ByNumber(1)).Int() ns := m.Get(fds.ByNumber(2)).Int() + if s < -maxSecondsInDuration || s > maxSecondsInDuration { + return fmt.Errorf("seconds out of range %v", s) + } if ns <= -secondInNanos || ns >= secondInNanos { return fmt.Errorf("ns out of range (%v, %v)", -secondInNanos, secondInNanos) } if (s > 0 && ns < 0) || (s < 0 && ns > 0) { return errors.New("signs of seconds and nanos do not match") } - if s < 0 { - ns = -ns + var sign string + if s < 0 || ns < 0 { + sign, s, ns = "-", -1*s, -1*ns } - x := fmt.Sprintf("%d.%09d", s, ns) + x := fmt.Sprintf("%s%d.%09d", sign, s, ns) x = strings.TrimSuffix(x, "000") x = strings.TrimSuffix(x, "000") x = strings.TrimSuffix(x, ".000") diff --git a/jsonpb/json_test.go b/jsonpb/json_test.go index 485b29279e..0ef23f2d30 100644 --- a/jsonpb/json_test.go +++ b/jsonpb/json_test.go @@ -448,10 +448,17 @@ var marshalingTests = []struct { {"Any with message and indent", marshalerAllOptions, anySimple, anySimplePrettyJSON}, {"Any with WKT", marshaler, anyWellKnown, anyWellKnownJSON}, {"Any with WKT and indent", marshalerAllOptions, anyWellKnown, anyWellKnownPrettyJSON}, - {"Duration", marshaler, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}, `{"dur":"3s"}`}, - {"Duration", marshaler, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 3, Nanos: 1e6}}, `{"dur":"3.001s"}`}, - {"Duration beyond float64 precision", marshaler, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 100000000, Nanos: 1}}, `{"dur":"100000000.000000001s"}`}, - {"negative Duration", marshaler, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: -123, Nanos: -456}}, `{"dur":"-123.000000456s"}`}, + {"Duration empty", marshaler, &durpb.Duration{}, `"0s"`}, + {"Duration with secs", marshaler, &durpb.Duration{Seconds: 3}, `"3s"`}, + {"Duration with -secs", marshaler, &durpb.Duration{Seconds: -3}, `"-3s"`}, + {"Duration with nanos", marshaler, &durpb.Duration{Nanos: 1e6}, `"0.001s"`}, + {"Duration with -nanos", marshaler, &durpb.Duration{Nanos: -1e6}, `"-0.001s"`}, + {"Duration with large secs", marshaler, &durpb.Duration{Seconds: 1e10, Nanos: 1}, `"10000000000.000000001s"`}, + {"Duration with 6-digit nanos", marshaler, &durpb.Duration{Nanos: 1e4}, `"0.000010s"`}, + {"Duration with 3-digit nanos", marshaler, &durpb.Duration{Nanos: 1e6}, `"0.001s"`}, + {"Duration with -secs -nanos", marshaler, &durpb.Duration{Seconds: -123, Nanos: -450}, `"-123.000000450s"`}, + {"Duration max value", marshaler, &durpb.Duration{Seconds: 315576000000, Nanos: 999999999}, `"315576000000.999999999s"`}, + {"Duration min value", marshaler, &durpb.Duration{Seconds: -315576000000, Nanos: -999999999}, `"-315576000000.999999999s"`}, {"Struct", marshaler, &pb2.KnownTypes{St: &stpb.Struct{ Fields: map[string]*stpb.Value{ "one": {Kind: &stpb.Value_StringValue{"loneliest number"}}, @@ -524,15 +531,17 @@ func TestMarshalIllegalTime(t *testing.T) { pb proto.Message fail bool }{ - {&pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 1, Nanos: 0}}, false}, - {&pb2.KnownTypes{Dur: &durpb.Duration{Seconds: -1, Nanos: 0}}, false}, - {&pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 1, Nanos: -1}}, true}, - {&pb2.KnownTypes{Dur: &durpb.Duration{Seconds: -1, Nanos: 1}}, true}, - {&pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 1, Nanos: 1000000000}}, true}, - {&pb2.KnownTypes{Dur: &durpb.Duration{Seconds: -1, Nanos: -1000000000}}, true}, - {&pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 1, Nanos: 1}}, false}, - {&pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 1, Nanos: -1}}, true}, - {&pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 1, Nanos: 1000000000}}, true}, + {&durpb.Duration{Seconds: 1, Nanos: 0}, false}, + {&durpb.Duration{Seconds: -1, Nanos: 0}, false}, + {&durpb.Duration{Seconds: 1, Nanos: -1}, true}, + {&durpb.Duration{Seconds: -1, Nanos: 1}, true}, + {&durpb.Duration{Seconds: 315576000001}, true}, + {&durpb.Duration{Seconds: -315576000001}, true}, + {&durpb.Duration{Seconds: 1, Nanos: 1000000000}, true}, + {&durpb.Duration{Seconds: -1, Nanos: -1000000000}, true}, + {&tspb.Timestamp{Seconds: 1, Nanos: 1}, false}, + {&tspb.Timestamp{Seconds: 1, Nanos: -1}, true}, + {&tspb.Timestamp{Seconds: 1, Nanos: 1000000000}, true}, } for _, tt := range tests { _, err := marshaler.MarshalToString(tt.pb) From eccd77d6ffe33de3bca6050a06c4e8294783de69 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 2 Mar 2021 17:35:02 -0800 Subject: [PATCH 125/133] ptypes: deprecate the package (#1217) Deprecate the ptypes package since all the equivalent functionality is now directly generated with the well-known types themselves. --- go.mod | 4 ++-- go.sum | 52 ++++++++++++++++++++++++++++++++++++++++++--- ptypes/any.go | 14 ++++++++++++ ptypes/doc.go | 4 ++++ ptypes/duration.go | 4 ++++ ptypes/timestamp.go | 9 ++++++++ 6 files changed, 82 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 67adeed862..b2f5b93f43 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/golang/protobuf go 1.9 require ( - github.com/google/go-cmp v0.4.0 - google.golang.org/protobuf v1.23.0 + github.com/google/go-cmp v0.5.0 + google.golang.org/protobuf v1.25.0 ) diff --git a/go.sum b/go.sum index 92baf2631b..ebefa3ad9d 100644 --- a/go.sum +++ b/go.sum @@ -1,18 +1,64 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 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/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +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 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 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/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/ptypes/any.go b/ptypes/any.go index e729dcff13..85f9f57365 100644 --- a/ptypes/any.go +++ b/ptypes/any.go @@ -19,6 +19,8 @@ const urlPrefix = "type.googleapis.com/" // AnyMessageName returns the message name contained in an anypb.Any message. // Most type assertions should use the Is function instead. +// +// Deprecated: Call the any.MessageName method instead. func AnyMessageName(any *anypb.Any) (string, error) { name, err := anyMessageName(any) return string(name), err @@ -38,6 +40,8 @@ func anyMessageName(any *anypb.Any) (protoreflect.FullName, error) { } // MarshalAny marshals the given message m into an anypb.Any message. +// +// Deprecated: Call the anypb.New function instead. func MarshalAny(m proto.Message) (*anypb.Any, error) { switch dm := m.(type) { case DynamicAny: @@ -58,6 +62,9 @@ func MarshalAny(m proto.Message) (*anypb.Any, error) { // Empty returns a new message of the type specified in an anypb.Any message. // It returns protoregistry.NotFound if the corresponding message type could not // be resolved in the global registry. +// +// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead +// to resolve the message name and create a new instance of it. func Empty(any *anypb.Any) (proto.Message, error) { name, err := anyMessageName(any) if err != nil { @@ -76,6 +83,8 @@ func Empty(any *anypb.Any) (proto.Message, error) { // // The target message m may be a *DynamicAny message. If the underlying message // type could not be resolved, then this returns protoregistry.NotFound. +// +// Deprecated: Call the any.UnmarshalTo method instead. func UnmarshalAny(any *anypb.Any, m proto.Message) error { if dm, ok := m.(*DynamicAny); ok { if dm.Message == nil { @@ -100,6 +109,8 @@ func UnmarshalAny(any *anypb.Any, m proto.Message) error { } // Is reports whether the Any message contains a message of the specified type. +// +// Deprecated: Call the any.MessageIs method instead. func Is(any *anypb.Any, m proto.Message) bool { if any == nil || m == nil { return false @@ -119,6 +130,9 @@ func Is(any *anypb.Any, m proto.Message) bool { // var x ptypes.DynamicAny // if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } // fmt.Printf("unmarshaled message: %v", x.Message) +// +// Deprecated: Use the any.UnmarshalNew method instead to unmarshal +// the any message contents into a new instance of the underlying message. type DynamicAny struct{ proto.Message } func (m DynamicAny) String() string { diff --git a/ptypes/doc.go b/ptypes/doc.go index fb9edd5c62..d3c33259d2 100644 --- a/ptypes/doc.go +++ b/ptypes/doc.go @@ -3,4 +3,8 @@ // license that can be found in the LICENSE file. // Package ptypes provides functionality for interacting with well-known types. +// +// Deprecated: Well-known types have specialized functionality directly +// injected into the generated packages for each message type. +// See the deprecation notice for each function for the suggested alternative. package ptypes diff --git a/ptypes/duration.go b/ptypes/duration.go index 6110ae8a41..b2b55dd851 100644 --- a/ptypes/duration.go +++ b/ptypes/duration.go @@ -21,6 +21,8 @@ const ( // Duration converts a durationpb.Duration to a time.Duration. // Duration returns an error if dur is invalid or overflows a time.Duration. +// +// Deprecated: Call the dur.AsDuration and dur.CheckValid methods instead. func Duration(dur *durationpb.Duration) (time.Duration, error) { if err := validateDuration(dur); err != nil { return 0, err @@ -39,6 +41,8 @@ func Duration(dur *durationpb.Duration) (time.Duration, error) { } // DurationProto converts a time.Duration to a durationpb.Duration. +// +// Deprecated: Call the durationpb.New function instead. func DurationProto(d time.Duration) *durationpb.Duration { nanos := d.Nanoseconds() secs := nanos / 1e9 diff --git a/ptypes/timestamp.go b/ptypes/timestamp.go index 026d0d4915..8368a3f70d 100644 --- a/ptypes/timestamp.go +++ b/ptypes/timestamp.go @@ -33,6 +33,8 @@ const ( // // A nil Timestamp returns an error. The first return value in that case is // undefined. +// +// Deprecated: Call the ts.AsTime and ts.CheckValid methods instead. func Timestamp(ts *timestamppb.Timestamp) (time.Time, error) { // Don't return the zero value on error, because corresponds to a valid // timestamp. Instead return whatever time.Unix gives us. @@ -46,6 +48,8 @@ func Timestamp(ts *timestamppb.Timestamp) (time.Time, error) { } // TimestampNow returns a google.protobuf.Timestamp for the current time. +// +// Deprecated: Call the timestamppb.Now function instead. func TimestampNow() *timestamppb.Timestamp { ts, err := TimestampProto(time.Now()) if err != nil { @@ -56,6 +60,8 @@ func TimestampNow() *timestamppb.Timestamp { // TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. // It returns an error if the resulting Timestamp is invalid. +// +// Deprecated: Call the timestamppb.New function instead. func TimestampProto(t time.Time) (*timestamppb.Timestamp, error) { ts := ×tamppb.Timestamp{ Seconds: t.Unix(), @@ -69,6 +75,9 @@ func TimestampProto(t time.Time) (*timestamppb.Timestamp, error) { // TimestampString returns the RFC 3339 string for valid Timestamps. // For invalid Timestamps, it returns an error message in parentheses. +// +// Deprecated: Call the ts.AsTime method instead, +// followed by a call to the Format method on the time.Time value. func TimestampString(ts *timestamppb.Timestamp) string { t, err := Timestamp(ts) if err != nil { From acacf8158c9a307051c92dc233966e8324facd45 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 2 Mar 2021 17:38:46 -0800 Subject: [PATCH 126/133] all: rely on protodesc.ToFileDescriptorProto (#1214) Use protodesc.ToFileDescriptorProto to retrieve the raw descriptors for legacy support instead of the undocumented ProtoLegacyRawDesc method that we expect v2 to provide. This change will cause the legacy proto package to incur a dependency on the descriptorpb package. --- descriptor/descriptor.go | 11 +++-------- proto/registry.go | 10 ++-------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/descriptor/descriptor.go b/descriptor/descriptor.go index c3c4a2b87e..ffde8a6508 100644 --- a/descriptor/descriptor.go +++ b/descriptor/descriptor.go @@ -79,14 +79,9 @@ func deriveRawDescriptor(d protoreflect.Descriptor) ([]byte, []int) { } // Obtain the raw file descriptor. - var raw []byte - switch fd := d.(type) { - case interface{ ProtoLegacyRawDesc() []byte }: - raw = fd.ProtoLegacyRawDesc() - case protoreflect.FileDescriptor: - raw, _ = proto.Marshal(protodesc.ToFileDescriptorProto(fd)) - } - file := protoimpl.X.CompressGZIP(raw) + fd := d.(protoreflect.FileDescriptor) + b, _ := proto.Marshal(protodesc.ToFileDescriptorProto(fd)) + file := protoimpl.X.CompressGZIP(b) // Reverse the indexes, since we populated it in reverse. for i, j := 0, len(idxs)-1; i < j; i, j = i+1, j-1 { diff --git a/proto/registry.go b/proto/registry.go index 1e7ff64205..066b4323b4 100644 --- a/proto/registry.go +++ b/proto/registry.go @@ -13,6 +13,7 @@ import ( "strings" "sync" + "google.golang.org/protobuf/reflect/protodesc" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" "google.golang.org/protobuf/runtime/protoimpl" @@ -62,14 +63,7 @@ func FileDescriptor(s filePath) fileDescGZIP { // Find the descriptor in the v2 registry. var b []byte if fd, _ := protoregistry.GlobalFiles.FindFileByPath(s); fd != nil { - if fd, ok := fd.(interface{ ProtoLegacyRawDesc() []byte }); ok { - b = fd.ProtoLegacyRawDesc() - } else { - // TODO: Use protodesc.ToFileDescriptorProto to construct - // a descriptorpb.FileDescriptorProto and marshal it. - // However, doing so causes the proto package to have a dependency - // on descriptorpb, leading to cyclic dependency issues. - } + b, _ = Marshal(protodesc.ToFileDescriptorProto(fd)) } // Locally cache the raw descriptor form for the file. From 78b1f09b4310f9ee5c9a07dca51bf007b82c83ea Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 3 Mar 2021 09:36:43 -0800 Subject: [PATCH 127/133] Switch from Travis-CI to GitHub actions (#1286) Travis-CI is dead. GitHub actions is the new hotness. The minimally supported version is Go1.11 to make use of modules. --- .github/workflows/test.yml | 22 ++++++++++++++++++++++ .travis.yml | 22 ---------------------- 2 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..bd97bd412a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,22 @@ +on: [push, pull_request] +name: Test +jobs: + test: + strategy: + matrix: + go-version: [1.11.x, 1.12.x, 1.13.x, 1.14.x, 1.15.x, 1.16.x] + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: TestLatest + if: matrix.go-version == '1.16.x' + run: ./test.bash + - name: TestAll + if: matrix.go-version != '1.16.x' + run: go test ./... diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0b5166678a..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: go -before_install: - - mkdir /tmp/go1.12 - - curl -L -s https://dl.google.com/go/go1.12.linux-amd64.tar.gz | tar -zxf - -C /tmp/go1.12 --strip-components 1 - - unset GOROOT - - (GO111MODULE=on /tmp/go1.12/bin/go mod vendor) -matrix: - include: - - go: 1.9.x - script: go test -tags protolegacy -v ./... - - go: 1.10.x - script: go test -tags protolegacy -v ./... - - go: 1.11.x - script: go test -tags protolegacy -v ./... - - go: 1.12.x - script: go test -tags protolegacy -v ./... - - go: 1.13.x - script: go test -tags protolegacy -v ./... - - go: 1.14.x - script: go test -tags protolegacy -v ./... - - go: 1.15.x - script: ./test.bash From f746d3b8ecd31eac7c04a954f3905d46b09f8114 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 17 Mar 2021 17:15:31 -0700 Subject: [PATCH 128/133] all: depend on google.golang.org/protobuf@v1.26.0-rc.1 (#1292) --- go.mod | 4 ++-- go.sum | 66 ++++------------------------------------------------------ 2 files changed, 6 insertions(+), 64 deletions(-) diff --git a/go.mod b/go.mod index b2f5b93f43..9fe32f4cfa 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/golang/protobuf go 1.9 require ( - github.com/google/go-cmp v0.5.0 - google.golang.org/protobuf v1.25.0 + github.com/google/go-cmp v0.5.5 + google.golang.org/protobuf v1.26.0-rc.1 ) diff --git a/go.sum b/go.sum index ebefa3ad9d..33fa51a541 100644 --- a/go.sum +++ b/go.sum @@ -1,64 +1,6 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -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/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -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/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -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/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +google.golang.org/protobuf v1.26.0-rc.1 h1:7QnIQpGRHE5RnLKnESfDoxm2dTapTZua5a0kS0A+VXQ= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= From a36a1a1c346d5cb6951b9440755adb530334f910 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 17 Mar 2021 18:16:33 -0700 Subject: [PATCH 129/133] all: depend on google.golang.org/protobuf@v1.26.0 (#1293) --- go.mod | 2 +- go.sum | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 9fe32f4cfa..3bee65aa36 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.9 require ( github.com/google/go-cmp v0.5.5 - google.golang.org/protobuf v1.26.0-rc.1 + google.golang.org/protobuf v1.26.0 ) diff --git a/go.sum b/go.sum index 33fa51a541..20a6257f1b 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,8 @@ +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1 h1:7QnIQpGRHE5RnLKnESfDoxm2dTapTZua5a0kS0A+VXQ= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= From af940030a2b77f37337632168f18403433e21e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Dry=C5=9B?= Date: Wed, 24 Mar 2021 19:44:03 +0100 Subject: [PATCH 130/133] jsonpb: restore previous behavior for handling nulls and JSONPBUnmarshaler (#1300) When a JSON null is encountered for a field which implements JSONPBUnmarshaler, jsonpb will now call the unmarshal method, instead of just skipping the field. --- jsonpb/decode.go | 26 ++++++++++++++++++-------- jsonpb/json_test.go | 2 +- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/jsonpb/decode.go b/jsonpb/decode.go index 7c6c5a5244..60e82caa9a 100644 --- a/jsonpb/decode.go +++ b/jsonpb/decode.go @@ -135,14 +135,14 @@ func (u *Unmarshaler) unmarshalMessage(m protoreflect.Message, in []byte) error md := m.Descriptor() fds := md.Fields() - if string(in) == "null" && md.FullName() != "google.protobuf.Value" { - return nil - } - if jsu, ok := proto.MessageV1(m.Interface()).(JSONPBUnmarshaler); ok { return jsu.UnmarshalJSONPB(u, in) } + if string(in) == "null" && md.FullName() != "google.protobuf.Value" { + return nil + } + switch wellKnownType(md.FullName()) { case "Any": var jsonObject map[string]json.RawMessage @@ -332,11 +332,12 @@ func (u *Unmarshaler) unmarshalMessage(m protoreflect.Message, in []byte) error raw = v } + field := m.NewField(fd) // Unmarshal the field value. - if raw == nil || (string(raw) == "null" && !isSingularWellKnownValue(fd)) { + if raw == nil || (string(raw) == "null" && !isSingularWellKnownValue(fd) && !isSingularJSONPBUnmarshaler(field, fd)) { continue } - v, err := u.unmarshalValue(m.NewField(fd), raw, fd) + v, err := u.unmarshalValue(field, raw, fd) if err != nil { return err } @@ -364,11 +365,12 @@ func (u *Unmarshaler) unmarshalMessage(m protoreflect.Message, in []byte) error return fmt.Errorf("extension field %q does not extend message %q", xname, m.Descriptor().FullName()) } + field := m.NewField(fd) // Unmarshal the field value. - if raw == nil || (string(raw) == "null" && !isSingularWellKnownValue(fd)) { + if raw == nil || (string(raw) == "null" && !isSingularWellKnownValue(fd) && !isSingularJSONPBUnmarshaler(field, fd)) { continue } - v, err := u.unmarshalValue(m.NewField(fd), raw, fd) + v, err := u.unmarshalValue(field, raw, fd) if err != nil { return err } @@ -390,6 +392,14 @@ func isSingularWellKnownValue(fd protoreflect.FieldDescriptor) bool { return false } +func isSingularJSONPBUnmarshaler(v protoreflect.Value, fd protoreflect.FieldDescriptor) bool { + if fd.Message() != nil && fd.Cardinality() != protoreflect.Repeated { + _, ok := proto.MessageV1(v.Interface()).(JSONPBUnmarshaler) + return ok + } + return false +} + func (u *Unmarshaler) unmarshalValue(v protoreflect.Value, in []byte, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { switch { case fd.IsList(): diff --git a/jsonpb/json_test.go b/jsonpb/json_test.go index 0ef23f2d30..a98ad169f2 100644 --- a/jsonpb/json_test.go +++ b/jsonpb/json_test.go @@ -1009,7 +1009,7 @@ func TestUnmarshalNullWithJSONPBUnmarshaler(t *testing.T) { t.Errorf("unmarshal error: %v", err) } - want := ptrFieldMessage{} + want := ptrFieldMessage{StringField: &stringField{IsSet: true, StringValue: "null"}} if !proto.Equal(&ptrFieldMsg, &want) { t.Errorf("unmarshal result StringField: got %v, want %v", ptrFieldMsg, want) } From ae97035608a719c7a1c1c41bed0ae0744bdb0c6f Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 29 Mar 2021 11:20:59 -0700 Subject: [PATCH 131/133] all: deprecate the module (#1306) Use the new deprecation feature to mark this module as deprecated. See https://golang.org/issue/40357. Considerations: * google.golang.org/protobuf/cmd/protoc-gen-go@v1.25.0 and below used to generate a hard dependency on github.com/golang/protobuf, which would be frustrating since it would force an explicit dependency on a deprecated module. However, that is no longer the case in v1.26.0. * google.golang.org/protobuf and github.com/golang/protobuf have a cyclic dependency on each other. However, this should not be a problem since proposal 40357 only marks direct dependencies in the go.mod file, rather than all transitive dependencies in the go.sum file. --- go.mod | 1 + 1 file changed, 1 insertion(+) diff --git a/go.mod b/go.mod index 3bee65aa36..6cac17b113 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,4 @@ +// Deprecated: Use the "google.golang.org/protobuf" module instead. module github.com/golang/protobuf go 1.9 From 37828f962262b5a0f3d9560c429a14d96c711a21 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Wed, 15 Sep 2021 16:28:59 -0700 Subject: [PATCH 132/133] jsonpb: accept 'null' as a valid representation of NullValue in unmarshal The canonical JSON representation for NullValue is JSON "null". Fixes github.com/golang/protobuf#1361. --- internal/testprotos/jsonpb_proto/test2.pb.go | 209 ++++++++++--------- internal/testprotos/jsonpb_proto/test2.proto | 1 + jsonpb/decode.go | 8 +- jsonpb/json_test.go | 2 + 4 files changed, 123 insertions(+), 97 deletions(-) diff --git a/internal/testprotos/jsonpb_proto/test2.pb.go b/internal/testprotos/jsonpb_proto/test2.pb.go index a27dc0c256..1dc0f8a03b 100644 --- a/internal/testprotos/jsonpb_proto/test2.pb.go +++ b/internal/testprotos/jsonpb_proto/test2.pb.go @@ -586,6 +586,7 @@ type MsgWithOneof struct { // *MsgWithOneof_Country // *MsgWithOneof_HomeAddress // *MsgWithOneof_MsgWithRequired + // *MsgWithOneof_NullValue Union isMsgWithOneof_Union `protobuf_oneof:"union"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -641,6 +642,10 @@ type MsgWithOneof_MsgWithRequired struct { MsgWithRequired *MsgWithRequired `protobuf:"bytes,5,opt,name=msg_with_required,json=msgWithRequired,oneof"` } +type MsgWithOneof_NullValue struct { + NullValue structpb.NullValue `protobuf:"varint,6,opt,name=null_value,json=nullValue,enum=google.protobuf.NullValue,oneof"` +} + func (*MsgWithOneof_Title) isMsgWithOneof_Union() {} func (*MsgWithOneof_Salary) isMsgWithOneof_Union() {} @@ -651,6 +656,8 @@ func (*MsgWithOneof_HomeAddress) isMsgWithOneof_Union() {} func (*MsgWithOneof_MsgWithRequired) isMsgWithOneof_Union() {} +func (*MsgWithOneof_NullValue) isMsgWithOneof_Union() {} + func (m *MsgWithOneof) GetUnion() isMsgWithOneof_Union { if m != nil { return m.Union @@ -693,6 +700,13 @@ func (m *MsgWithOneof) GetMsgWithRequired() *MsgWithRequired { return nil } +func (m *MsgWithOneof) GetNullValue() structpb.NullValue { + if x, ok := m.GetUnion().(*MsgWithOneof_NullValue); ok { + return x.NullValue + } + return structpb.NullValue_NULL_VALUE +} + // XXX_OneofWrappers is for the internal use of the proto package. func (*MsgWithOneof) XXX_OneofWrappers() []interface{} { return []interface{}{ @@ -701,6 +715,7 @@ func (*MsgWithOneof) XXX_OneofWrappers() []interface{} { (*MsgWithOneof_Country)(nil), (*MsgWithOneof_HomeAddress)(nil), (*MsgWithOneof_MsgWithRequired)(nil), + (*MsgWithOneof_NullValue)(nil), } } @@ -1177,100 +1192,102 @@ func init() { func init() { proto.RegisterFile("jsonpb_proto/test2.proto", fileDescriptor_50cab1d8463dea41) } var fileDescriptor_50cab1d8463dea41 = []byte{ - // 1510 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0xdd, 0x6e, 0xdb, 0x46, - 0x16, 0x36, 0x49, 0x51, 0x12, 0x8f, 0x6c, 0xc7, 0x1e, 0x3b, 0x09, 0xed, 0x0d, 0xb2, 0x84, 0xb2, - 0xd9, 0xd5, 0x26, 0x58, 0x79, 0x43, 0x0b, 0x42, 0x91, 0x36, 0x40, 0xe3, 0xd8, 0x6e, 0xd2, 0x24, - 0x4e, 0x41, 0x27, 0x0d, 0xda, 0x1b, 0x81, 0x32, 0x29, 0x99, 0x2d, 0xc9, 0x51, 0x67, 0x46, 0x4e, - 0x84, 0xb6, 0x80, 0xfb, 0x0a, 0x7d, 0x85, 0x02, 0xbd, 0xed, 0x5d, 0x2f, 0xfa, 0x1c, 0x45, 0x9f, - 0xa7, 0x98, 0x33, 0x43, 0xfd, 0x59, 0x36, 0x72, 0x65, 0xcd, 0x7c, 0x3f, 0x33, 0x9c, 0xf3, 0xf1, - 0x0c, 0x0d, 0xee, 0x37, 0x9c, 0xe6, 0x83, 0x6e, 0x67, 0xc0, 0xa8, 0xa0, 0x3b, 0x22, 0xe6, 0xc2, - 0x6f, 0xe2, 0x6f, 0x52, 0xd3, 0x88, 0x9c, 0xdb, 0xde, 0xea, 0x53, 0xda, 0x4f, 0xe3, 0x1d, 0x84, - 0xba, 0xc3, 0xde, 0x4e, 0x98, 0x8f, 0x14, 0x6f, 0xfb, 0xf6, 0x3c, 0x14, 0x0d, 0x59, 0x28, 0x12, - 0x9a, 0x6b, 0xfc, 0xd6, 0x3c, 0xce, 0x05, 0x1b, 0x9e, 0x08, 0x8d, 0xfe, 0x73, 0x1e, 0x15, 0x49, - 0x16, 0x73, 0x11, 0x66, 0x83, 0xcb, 0xec, 0xdf, 0xb1, 0x70, 0x30, 0x88, 0x19, 0x57, 0x78, 0xfd, - 0xb7, 0x12, 0x94, 0x8f, 0x93, 0x6c, 0x90, 0xc6, 0xe4, 0x3a, 0x94, 0x69, 0xa7, 0x4b, 0x69, 0xea, - 0x1a, 0x9e, 0xd1, 0xa8, 0x06, 0x36, 0xdd, 0xa3, 0x34, 0x25, 0x37, 0xa1, 0x42, 0x3b, 0x49, 0x2e, - 0x76, 0x7d, 0xd7, 0xf4, 0x8c, 0x86, 0x1d, 0x94, 0xe9, 0x33, 0x39, 0x22, 0xb7, 0xa1, 0xa6, 0x81, - 0x0e, 0x17, 0xcc, 0xb5, 0x10, 0x74, 0x14, 0x78, 0x2c, 0xd8, 0x58, 0xd8, 0x6e, 0xb9, 0x25, 0xcf, - 0x68, 0x58, 0x4a, 0xd8, 0x6e, 0x8d, 0x85, 0xed, 0x16, 0x0a, 0x6d, 0x04, 0x1d, 0x05, 0x4a, 0xe1, - 0x16, 0x54, 0x69, 0x67, 0xa8, 0x96, 0x2c, 0x7b, 0x46, 0x63, 0x25, 0xa8, 0xd0, 0x37, 0x38, 0x24, - 0x1e, 0x2c, 0x17, 0x10, 0x6a, 0x2b, 0x08, 0x83, 0x86, 0x67, 0xc4, 0xed, 0x96, 0x5b, 0xf5, 0x8c, - 0x46, 0x49, 0x8b, 0xdb, 0xad, 0x89, 0x58, 0x2f, 0xec, 0x20, 0x0c, 0x1a, 0x1e, 0x8b, 0xb9, 0x5a, - 0x19, 0x3c, 0xa3, 0xb1, 0x1e, 0x54, 0xe8, 0xf1, 0xd4, 0xca, 0x7c, 0xb2, 0x72, 0x0d, 0x61, 0xd0, - 0xf0, 0x8c, 0xb8, 0xdd, 0x72, 0x97, 0x3d, 0xa3, 0x41, 0xb4, 0xb8, 0x58, 0x99, 0x4f, 0x56, 0x5e, - 0x41, 0x18, 0x34, 0x3c, 0x3e, 0xac, 0x5e, 0x4a, 0x43, 0xe1, 0xae, 0x7a, 0x46, 0xc3, 0x0c, 0xca, - 0xf4, 0x50, 0x8e, 0xd4, 0x61, 0x21, 0x80, 0xca, 0x6b, 0x08, 0x3a, 0x0a, 0x1c, 0xaf, 0x1a, 0xd1, - 0x61, 0x37, 0x8d, 0xdd, 0x35, 0xcf, 0x68, 0x18, 0x41, 0x85, 0xee, 0xe3, 0x50, 0xad, 0xaa, 0x20, - 0xd4, 0xae, 0x23, 0x0c, 0x1a, 0x9e, 0x6c, 0x59, 0xb0, 0x24, 0xef, 0xbb, 0xc4, 0x33, 0x1a, 0x8e, - 0xdc, 0x32, 0x0e, 0xd5, 0x86, 0xba, 0x23, 0x11, 0x73, 0x77, 0xc3, 0x33, 0x1a, 0xcb, 0x41, 0x99, - 0xee, 0xc9, 0x51, 0xfd, 0x67, 0x03, 0xe0, 0x88, 0xe6, 0x87, 0x49, 0x9e, 0x88, 0x98, 0x93, 0x0d, - 0xb0, 0x7b, 0x9d, 0x3c, 0xcc, 0x31, 0x34, 0x66, 0x50, 0xea, 0x1d, 0x85, 0xb9, 0x8c, 0x52, 0xaf, - 0x33, 0x48, 0xf2, 0x1e, 0x46, 0xc6, 0x0c, 0xec, 0xde, 0x17, 0x49, 0xde, 0x53, 0xd3, 0xb9, 0x9c, - 0xb6, 0xf4, 0xf4, 0x91, 0x9c, 0xde, 0x00, 0x3b, 0x42, 0x8b, 0x12, 0x6e, 0xb0, 0x14, 0x69, 0x8b, - 0x48, 0x59, 0xd8, 0x38, 0x6b, 0x47, 0x85, 0x45, 0xa4, 0x2c, 0xca, 0x7a, 0x5a, 0x5a, 0xd4, 0x7f, - 0x35, 0xa1, 0x12, 0xc4, 0x83, 0x38, 0x14, 0x5c, 0x52, 0x58, 0x91, 0x63, 0x4b, 0xe6, 0x98, 0x15, - 0x39, 0x66, 0xe3, 0x1c, 0x5b, 0x32, 0xc7, 0x4c, 0xe5, 0xb8, 0x00, 0xda, 0x2d, 0xd7, 0xf2, 0x2c, - 0x99, 0x53, 0xa6, 0x72, 0xba, 0x05, 0x55, 0x56, 0xe4, 0xb0, 0xe4, 0x59, 0x32, 0x87, 0x4c, 0xe7, - 0x70, 0x0c, 0xb5, 0x5b, 0xae, 0xed, 0x59, 0x32, 0x65, 0x4c, 0xa7, 0x0c, 0x21, 0x5e, 0xa4, 0xd7, - 0x92, 0x19, 0x62, 0xc7, 0x53, 0x2a, 0x9d, 0x90, 0x8a, 0x67, 0xc9, 0x84, 0x30, 0x9d, 0x10, 0xdc, - 0x84, 0xaa, 0x7f, 0xd5, 0xb3, 0x64, 0xfd, 0x99, 0xaa, 0x3f, 0x6a, 0x74, 0x7d, 0x1d, 0xcf, 0x92, - 0xf5, 0x65, 0xba, 0xbe, 0xca, 0x4e, 0x55, 0x0f, 0x3c, 0x4b, 0x56, 0x8f, 0x4d, 0xaa, 0xc7, 0x74, - 0xf5, 0x6a, 0x9e, 0x25, 0xab, 0xc7, 0x54, 0xf5, 0xfe, 0x34, 0xa1, 0xfc, 0x36, 0x89, 0xfa, 0xb1, - 0x20, 0x3b, 0x60, 0x9f, 0xd0, 0x94, 0x32, 0xac, 0xdc, 0xaa, 0xbf, 0xd5, 0x9c, 0xea, 0x58, 0x4d, - 0xc5, 0x69, 0x3e, 0x91, 0x84, 0x40, 0xf1, 0x88, 0x2f, 0x4d, 0x95, 0x44, 0x9e, 0xe0, 0x95, 0x92, - 0x32, 0xc3, 0xbf, 0xe4, 0x3e, 0x94, 0x39, 0xb6, 0x17, 0x7c, 0x9f, 0x6a, 0xfe, 0xc6, 0x8c, 0x44, - 0x75, 0x9e, 0x40, 0x53, 0x48, 0x53, 0x9d, 0x0f, 0xd2, 0xe5, 0xb6, 0x2f, 0xa1, 0xcb, 0x43, 0xd3, - 0xfc, 0x0a, 0x53, 0x45, 0x77, 0x37, 0xd1, 0x7d, 0x73, 0x86, 0xae, 0x03, 0x11, 0x14, 0x24, 0xf2, - 0x00, 0x1c, 0xd6, 0x29, 0x14, 0xd7, 0x71, 0x81, 0xc5, 0x8a, 0x2a, 0xd3, 0xbf, 0xea, 0x77, 0xc1, - 0x56, 0x0f, 0x52, 0x01, 0x2b, 0x38, 0xd8, 0x5f, 0x5b, 0x22, 0x0e, 0xd8, 0x9f, 0x05, 0x07, 0x07, - 0x47, 0x6b, 0x06, 0xa9, 0x42, 0x69, 0xef, 0xc5, 0x9b, 0x83, 0x35, 0xb3, 0xfe, 0x8b, 0x09, 0xa5, - 0x97, 0xe1, 0x80, 0x93, 0x4f, 0xa1, 0x96, 0x4d, 0xf5, 0x36, 0x03, 0x17, 0xf1, 0x66, 0x16, 0x91, - 0xbc, 0xe6, 0xcb, 0xa2, 0xdb, 0x1d, 0xe4, 0x82, 0x8d, 0x02, 0x27, 0x1b, 0x77, 0xbf, 0x43, 0x58, - 0xc9, 0x30, 0xbe, 0xc5, 0x49, 0x98, 0xe8, 0x51, 0x5f, 0xe0, 0x21, 0x73, 0xad, 0x8e, 0x42, 0xb9, - 0xd4, 0xb2, 0xc9, 0xcc, 0xf6, 0x27, 0xb0, 0x3a, 0xbb, 0x08, 0x59, 0x03, 0xeb, 0xdb, 0x78, 0x84, - 0xe5, 0xb6, 0x02, 0xf9, 0x93, 0x6c, 0x82, 0x7d, 0x16, 0xa6, 0xc3, 0x18, 0x5f, 0x53, 0x27, 0x50, - 0x83, 0x87, 0xe6, 0x47, 0xc6, 0xf6, 0x31, 0xac, 0xcd, 0xdb, 0x4f, 0xeb, 0xab, 0x4a, 0xff, 0xdf, - 0x69, 0xfd, 0x25, 0xd5, 0x9a, 0x98, 0xd6, 0xff, 0x32, 0x60, 0xf9, 0x25, 0xef, 0xbf, 0x4d, 0xc4, - 0xe9, 0xab, 0x3c, 0xa6, 0x3d, 0x72, 0x03, 0x6c, 0x91, 0x88, 0x34, 0x46, 0x4f, 0xe7, 0xe9, 0x52, - 0xa0, 0x86, 0xc4, 0x85, 0x32, 0x0f, 0xd3, 0x90, 0x8d, 0xd0, 0xd8, 0x7a, 0xba, 0x14, 0xe8, 0x31, - 0xd9, 0x86, 0xca, 0x13, 0x3a, 0x94, 0xdb, 0xc1, 0x1e, 0x22, 0x35, 0xc5, 0x04, 0xb9, 0x03, 0xcb, - 0xa7, 0x34, 0x8b, 0x3b, 0x61, 0x14, 0xb1, 0x98, 0x73, 0x6c, 0x27, 0x92, 0x50, 0x93, 0xb3, 0x8f, - 0xd5, 0x24, 0xf9, 0x1c, 0xd6, 0x33, 0xde, 0xef, 0xbc, 0x4b, 0xc4, 0x69, 0x87, 0xc5, 0xdf, 0x0d, - 0x13, 0x16, 0x47, 0xd8, 0x62, 0x6a, 0xfe, 0xad, 0xd9, 0x23, 0x56, 0x1b, 0x0d, 0x34, 0xe7, 0xe9, - 0x52, 0x70, 0x2d, 0x9b, 0x9d, 0xda, 0xab, 0x80, 0x3d, 0xcc, 0x13, 0x9a, 0xd7, 0xff, 0x0d, 0xa5, - 0x20, 0x0e, 0xd3, 0xc9, 0x79, 0x1a, 0xaa, 0x39, 0xe1, 0xe0, 0x5e, 0xb5, 0x1a, 0xad, 0x9d, 0x9f, - 0x9f, 0x9f, 0x9b, 0xf5, 0x9f, 0x0c, 0xb9, 0x7d, 0x79, 0x2c, 0xef, 0xc9, 0x2d, 0x70, 0x92, 0x2c, - 0xec, 0x27, 0xb9, 0x7c, 0x4c, 0xc5, 0x9f, 0x4c, 0x4c, 0x34, 0xfe, 0x11, 0xac, 0xb2, 0x38, 0x4c, - 0x3b, 0xf1, 0x7b, 0x11, 0xe7, 0x3c, 0xa1, 0x39, 0x59, 0x9f, 0xcb, 0x6c, 0x98, 0xba, 0xdf, 0x2f, - 0x88, 0xbf, 0x5e, 0x28, 0x58, 0x91, 0xf2, 0x83, 0x42, 0x5d, 0xff, 0xc3, 0x06, 0x78, 0x9e, 0xd3, - 0x77, 0xf9, 0xeb, 0xd1, 0x20, 0xe6, 0xe4, 0x5f, 0x60, 0x86, 0x39, 0xde, 0x39, 0x52, 0xaf, 0xbe, - 0x16, 0x9a, 0xc5, 0xd7, 0x42, 0xf3, 0x71, 0x3e, 0x0a, 0xcc, 0x30, 0x27, 0xf7, 0xc1, 0x8a, 0x86, - 0xaa, 0x53, 0xd4, 0xfc, 0xad, 0x0b, 0xb4, 0x7d, 0xfd, 0xcd, 0x12, 0x48, 0x16, 0xf9, 0x0f, 0x98, - 0x5c, 0xe0, 0x15, 0x58, 0xf3, 0x6f, 0x5e, 0xe0, 0x1e, 0xe3, 0xf7, 0x4b, 0x60, 0x72, 0x41, 0xee, - 0x81, 0x29, 0xb8, 0xce, 0xce, 0xf6, 0x05, 0xe2, 0xeb, 0xe2, 0x53, 0x26, 0x30, 0x05, 0x97, 0xdc, - 0xf4, 0x0c, 0xaf, 0xbf, 0x45, 0xdc, 0x17, 0x09, 0x17, 0x5f, 0xca, 0xc3, 0x0e, 0xcc, 0xf4, 0x8c, - 0x34, 0xc0, 0x3a, 0x0b, 0x53, 0xbc, 0x0e, 0x6b, 0xfe, 0x8d, 0x0b, 0x64, 0x45, 0x94, 0x14, 0xd2, - 0x04, 0x2b, 0xea, 0xa6, 0x18, 0x25, 0x59, 0xff, 0x0b, 0xcf, 0x85, 0x8d, 0x56, 0xf3, 0xa3, 0x6e, - 0x4a, 0xfe, 0x07, 0x56, 0x2f, 0x15, 0x98, 0xac, 0x9a, 0xff, 0x8f, 0x0b, 0x7c, 0x6c, 0xd9, 0x9a, - 0xde, 0x4b, 0x85, 0xa4, 0x27, 0x78, 0x43, 0x2c, 0xa6, 0xe3, 0xeb, 0xa9, 0xe9, 0x49, 0xbb, 0x25, - 0x77, 0x33, 0x6c, 0xb7, 0xf0, 0x66, 0x5b, 0xb4, 0x9b, 0x37, 0xd3, 0xfc, 0x61, 0xbb, 0x85, 0xf6, - 0xbb, 0x3e, 0x7e, 0x04, 0x5d, 0x62, 0xbf, 0xeb, 0x17, 0xf6, 0xbb, 0x3e, 0xda, 0xef, 0xfa, 0xf8, - 0x55, 0x74, 0x99, 0xfd, 0x98, 0x3f, 0x44, 0x7e, 0x09, 0xaf, 0x51, 0xe7, 0x92, 0x43, 0x97, 0xfd, - 0x41, 0xd1, 0x91, 0x27, 0xfd, 0x65, 0xcf, 0x83, 0x4b, 0xfc, 0xd5, 0xd5, 0xa4, 0xfd, 0xb9, 0x60, - 0xe4, 0x01, 0xd8, 0xc5, 0x15, 0xb5, 0xf8, 0x01, 0xf0, 0xca, 0x52, 0x02, 0xc5, 0xac, 0xdf, 0x81, - 0x6b, 0x73, 0xef, 0xa5, 0xec, 0x4a, 0xaa, 0xd3, 0x9a, 0x0d, 0x07, 0x7d, 0xeb, 0xbf, 0x9b, 0x70, - 0x53, 0xb3, 0x9e, 0xe5, 0x51, 0xc2, 0xe2, 0x13, 0x31, 0x66, 0xff, 0x1f, 0x4a, 0x7c, 0xd8, 0xcd, - 0x74, 0x92, 0xaf, 0x7c, 0xe3, 0x03, 0x64, 0x92, 0x57, 0xe0, 0x64, 0xe1, 0xa0, 0xd3, 0x4b, 0xe2, - 0x34, 0xd2, 0xbd, 0xd8, 0x5f, 0x24, 0x9b, 0x5f, 0x4a, 0xf6, 0xe8, 0x43, 0x29, 0x52, 0xbd, 0xb9, - 0x9a, 0xe9, 0x21, 0x79, 0x04, 0x35, 0x9e, 0x26, 0x27, 0xb1, 0xb6, 0xb4, 0xd0, 0xf2, 0xea, 0x9d, - 0x00, 0x0a, 0x50, 0xbe, 0xfd, 0x15, 0xac, 0xcc, 0x38, 0x4f, 0xb7, 0x65, 0x47, 0xb5, 0x65, 0x7f, - 0xb6, 0x2d, 0x5f, 0xed, 0x3d, 0xd5, 0x9f, 0xef, 0xc1, 0xe6, 0x1c, 0x8a, 0x15, 0x20, 0x04, 0x4a, - 0xdd, 0x91, 0xe0, 0x78, 0xc6, 0xcb, 0x01, 0xfe, 0xae, 0xef, 0x03, 0x99, 0xe3, 0xbe, 0x7d, 0xfe, - 0xba, 0x88, 0x80, 0x24, 0x7e, 0x48, 0x04, 0x1e, 0xde, 0x85, 0x52, 0x1e, 0x66, 0xf1, 0xa2, 0x96, - 0xf6, 0x03, 0x3e, 0x0f, 0xc2, 0x0f, 0x9f, 0x40, 0x29, 0x7e, 0x2f, 0xb2, 0x45, 0xb4, 0x1f, 0x3f, - 0xa4, 0x90, 0x52, 0xbc, 0xf7, 0xe8, 0xeb, 0x8f, 0xfb, 0x89, 0x38, 0x1d, 0x76, 0x9b, 0x27, 0x34, - 0xdb, 0xe9, 0xd3, 0x34, 0xcc, 0xfb, 0x93, 0xff, 0x8b, 0x92, 0x5c, 0xc4, 0x2c, 0x0f, 0x53, 0xfc, - 0x27, 0x0e, 0x67, 0xf9, 0xce, 0xf4, 0x3f, 0x77, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xba, 0x6b, - 0x0b, 0xa0, 0xeb, 0x0d, 0x00, 0x00, + // 1537 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0xdd, 0x6e, 0xdb, 0xc8, + 0x15, 0x36, 0x49, 0x51, 0x12, 0x8f, 0xec, 0xc4, 0x99, 0x64, 0x37, 0xb4, 0x1b, 0x6c, 0x09, 0x6d, + 0xb7, 0x55, 0xb3, 0xa8, 0xdc, 0xa5, 0x05, 0xa1, 0xc8, 0x76, 0x81, 0xae, 0x13, 0xa7, 0xd9, 0xee, + 0xc6, 0x5b, 0x8c, 0x93, 0x06, 0xed, 0x8d, 0x40, 0x99, 0x94, 0xc2, 0x96, 0x9c, 0x51, 0x67, 0x86, + 0x4e, 0x84, 0xb6, 0x80, 0xfb, 0x0a, 0xed, 0x23, 0x14, 0xe8, 0x6d, 0xef, 0x7a, 0xd1, 0xe7, 0xe8, + 0x03, 0x2d, 0xe6, 0xcc, 0x50, 0x7f, 0x96, 0x8d, 0xbd, 0xb2, 0x66, 0xbe, 0x9f, 0x19, 0xce, 0xf9, + 0x78, 0x86, 0x86, 0xf0, 0x8f, 0x92, 0xb3, 0xd9, 0x78, 0x34, 0x13, 0x5c, 0xf1, 0x23, 0x95, 0x49, + 0x15, 0xf7, 0xf1, 0x37, 0xe9, 0x58, 0x44, 0xcf, 0x1d, 0x1e, 0x4c, 0x39, 0x9f, 0x16, 0xd9, 0x11, + 0x42, 0xe3, 0x6a, 0x72, 0x94, 0xb0, 0xb9, 0xe1, 0x1d, 0x7e, 0xb4, 0x09, 0xa5, 0x95, 0x48, 0x54, + 0xce, 0x99, 0xc5, 0x1f, 0x6d, 0xe2, 0x52, 0x89, 0xea, 0x42, 0x59, 0xf4, 0x87, 0x9b, 0xa8, 0xca, + 0xcb, 0x4c, 0xaa, 0xa4, 0x9c, 0xdd, 0x64, 0xff, 0x4e, 0x24, 0xb3, 0x59, 0x26, 0xa4, 0xc1, 0xbb, + 0xff, 0x69, 0x40, 0xf3, 0x3c, 0x2f, 0x67, 0x45, 0x46, 0x3e, 0x80, 0x26, 0x1f, 0x8d, 0x39, 0x2f, + 0x42, 0x27, 0x72, 0x7a, 0x6d, 0xea, 0xf3, 0x13, 0xce, 0x0b, 0xf2, 0x10, 0x5a, 0x7c, 0x94, 0x33, + 0x75, 0x1c, 0x87, 0x6e, 0xe4, 0xf4, 0x7c, 0xda, 0xe4, 0x5f, 0xe9, 0x11, 0xf9, 0x08, 0x3a, 0x16, + 0x18, 0x49, 0x25, 0x42, 0x0f, 0xc1, 0xc0, 0x80, 0xe7, 0x4a, 0x2c, 0x84, 0xc3, 0x41, 0xd8, 0x88, + 0x9c, 0x9e, 0x67, 0x84, 0xc3, 0xc1, 0x42, 0x38, 0x1c, 0xa0, 0xd0, 0x47, 0x30, 0x30, 0xa0, 0x16, + 0x1e, 0x40, 0x9b, 0x8f, 0x2a, 0xb3, 0x64, 0x33, 0x72, 0x7a, 0x7b, 0xb4, 0xc5, 0x5f, 0xe3, 0x90, + 0x44, 0xb0, 0x5b, 0x43, 0xa8, 0x6d, 0x21, 0x0c, 0x16, 0x5e, 0x13, 0x0f, 0x07, 0x61, 0x3b, 0x72, + 0x7a, 0x0d, 0x2b, 0x1e, 0x0e, 0x96, 0x62, 0xbb, 0x70, 0x80, 0x30, 0x58, 0x78, 0x21, 0x96, 0x66, + 0x65, 0x88, 0x9c, 0xde, 0x3d, 0xda, 0xe2, 0xe7, 0x2b, 0x2b, 0xcb, 0xe5, 0xca, 0x1d, 0x84, 0xc1, + 0xc2, 0x6b, 0xe2, 0xe1, 0x20, 0xdc, 0x8d, 0x9c, 0x1e, 0xb1, 0xe2, 0x7a, 0x65, 0xb9, 0x5c, 0x79, + 0x0f, 0x61, 0xb0, 0xf0, 0xe2, 0xb0, 0x26, 0x05, 0x4f, 0x54, 0x78, 0x27, 0x72, 0x7a, 0x2e, 0x6d, + 0xf2, 0xe7, 0x7a, 0x64, 0x0e, 0x0b, 0x01, 0x54, 0xde, 0x45, 0x30, 0x30, 0xe0, 0x62, 0xd5, 0x94, + 0x57, 0xe3, 0x22, 0x0b, 0xf7, 0x23, 0xa7, 0xe7, 0xd0, 0x16, 0x7f, 0x86, 0x43, 0xb3, 0xaa, 0x81, + 0x50, 0x7b, 0x0f, 0x61, 0xb0, 0xf0, 0x72, 0xcb, 0x4a, 0xe4, 0x6c, 0x1a, 0x92, 0xc8, 0xe9, 0x05, + 0x7a, 0xcb, 0x38, 0x34, 0x1b, 0x1a, 0xcf, 0x55, 0x26, 0xc3, 0xfb, 0x91, 0xd3, 0xdb, 0xa5, 0x4d, + 0x7e, 0xa2, 0x47, 0xdd, 0x7f, 0x38, 0x00, 0x67, 0x9c, 0x3d, 0xcf, 0x59, 0xae, 0x32, 0x49, 0xee, + 0x83, 0x3f, 0x19, 0xb1, 0x84, 0x61, 0x68, 0x5c, 0xda, 0x98, 0x9c, 0x25, 0x4c, 0x47, 0x69, 0x32, + 0x9a, 0xe5, 0x6c, 0x82, 0x91, 0x71, 0xa9, 0x3f, 0xf9, 0x6d, 0xce, 0x26, 0x66, 0x9a, 0xe9, 0x69, + 0xcf, 0x4e, 0x9f, 0xe9, 0xe9, 0xfb, 0xe0, 0xa7, 0x68, 0xd1, 0xc0, 0x0d, 0x36, 0x52, 0x6b, 0x91, + 0x1a, 0x0b, 0x1f, 0x67, 0xfd, 0xb4, 0xb6, 0x48, 0x8d, 0x45, 0xd3, 0x4e, 0x6b, 0x8b, 0xee, 0xbf, + 0x5d, 0x68, 0xd1, 0x6c, 0x96, 0x25, 0x4a, 0x6a, 0x8a, 0xa8, 0x73, 0xec, 0xe9, 0x1c, 0x8b, 0x3a, + 0xc7, 0x62, 0x91, 0x63, 0x4f, 0xe7, 0x58, 0x98, 0x1c, 0xd7, 0xc0, 0x70, 0x10, 0x7a, 0x91, 0xa7, + 0x73, 0x2a, 0x4c, 0x4e, 0x0f, 0xa0, 0x2d, 0xea, 0x1c, 0x36, 0x22, 0x4f, 0xe7, 0x50, 0xd8, 0x1c, + 0x2e, 0xa0, 0xe1, 0x20, 0xf4, 0x23, 0x4f, 0xa7, 0x4c, 0xd8, 0x94, 0x21, 0x24, 0xeb, 0xf4, 0x7a, + 0x3a, 0x43, 0xe2, 0x7c, 0x45, 0x65, 0x13, 0xd2, 0x8a, 0x3c, 0x9d, 0x10, 0x61, 0x13, 0x82, 0x9b, + 0x30, 0xf5, 0x6f, 0x47, 0x9e, 0xae, 0xbf, 0x30, 0xf5, 0x47, 0x8d, 0xad, 0x6f, 0x10, 0x79, 0xba, + 0xbe, 0xc2, 0xd6, 0xd7, 0xd8, 0x99, 0xea, 0x41, 0xe4, 0xe9, 0xea, 0x89, 0x65, 0xf5, 0x84, 0xad, + 0x5e, 0x27, 0xf2, 0x74, 0xf5, 0x84, 0xa9, 0xde, 0xff, 0x5d, 0x68, 0xbe, 0xc9, 0xd3, 0x69, 0xa6, + 0xc8, 0x11, 0xf8, 0x17, 0xbc, 0xe0, 0x02, 0x2b, 0x77, 0x27, 0x3e, 0xe8, 0xaf, 0x74, 0xac, 0xbe, + 0xe1, 0xf4, 0x9f, 0x6a, 0x02, 0x35, 0x3c, 0x12, 0x6b, 0x53, 0x23, 0xd1, 0x27, 0x78, 0xab, 0xa4, + 0x29, 0xf0, 0x2f, 0xf9, 0x14, 0x9a, 0x12, 0xdb, 0x0b, 0xbe, 0x4f, 0x9d, 0xf8, 0xfe, 0x9a, 0xc4, + 0x74, 0x1e, 0x6a, 0x29, 0xa4, 0x6f, 0xce, 0x07, 0xe9, 0x7a, 0xdb, 0x37, 0xd0, 0xf5, 0xa1, 0x59, + 0x7e, 0x4b, 0x98, 0xa2, 0x87, 0x0f, 0xd0, 0xfd, 0xc1, 0x1a, 0xdd, 0x06, 0x82, 0xd6, 0x24, 0xf2, + 0x19, 0x04, 0x62, 0x54, 0x2b, 0x3e, 0xc0, 0x05, 0xb6, 0x2b, 0xda, 0xc2, 0xfe, 0xea, 0x7e, 0x02, + 0xbe, 0x79, 0x90, 0x16, 0x78, 0xf4, 0xf4, 0xd9, 0xfe, 0x0e, 0x09, 0xc0, 0xff, 0x35, 0x3d, 0x3d, + 0x3d, 0xdb, 0x77, 0x48, 0x1b, 0x1a, 0x27, 0xdf, 0xbc, 0x3e, 0xdd, 0x77, 0xbb, 0xff, 0x72, 0xa1, + 0xf1, 0x32, 0x99, 0x49, 0xf2, 0x2b, 0xe8, 0x94, 0x2b, 0xbd, 0xcd, 0xc1, 0x45, 0xa2, 0xb5, 0x45, + 0x34, 0xaf, 0xff, 0xb2, 0xee, 0x76, 0xa7, 0x4c, 0x89, 0x39, 0x0d, 0xca, 0x45, 0xf7, 0x7b, 0x0e, + 0x7b, 0x25, 0xc6, 0xb7, 0x3e, 0x09, 0x17, 0x3d, 0xba, 0x5b, 0x3c, 0x74, 0xae, 0xcd, 0x51, 0x18, + 0x97, 0x4e, 0xb9, 0x9c, 0x39, 0xfc, 0x25, 0xdc, 0x59, 0x5f, 0x84, 0xec, 0x83, 0xf7, 0xa7, 0x6c, + 0x8e, 0xe5, 0xf6, 0xa8, 0xfe, 0x49, 0x1e, 0x80, 0x7f, 0x99, 0x14, 0x55, 0x86, 0xaf, 0x69, 0x40, + 0xcd, 0xe0, 0x89, 0xfb, 0x0b, 0xe7, 0xf0, 0x1c, 0xf6, 0x37, 0xed, 0x57, 0xf5, 0x6d, 0xa3, 0xff, + 0xe9, 0xaa, 0xfe, 0x86, 0x6a, 0x2d, 0x4d, 0xbb, 0xff, 0x74, 0x61, 0xf7, 0xa5, 0x9c, 0xbe, 0xc9, + 0xd5, 0xdb, 0x6f, 0x59, 0xc6, 0x27, 0xe4, 0x43, 0xf0, 0x55, 0xae, 0x8a, 0x0c, 0x3d, 0x83, 0x17, + 0x3b, 0xd4, 0x0c, 0x49, 0x08, 0x4d, 0x99, 0x14, 0x89, 0x98, 0xa3, 0xb1, 0xf7, 0x62, 0x87, 0xda, + 0x31, 0x39, 0x84, 0xd6, 0x53, 0x5e, 0xe9, 0xed, 0x60, 0x0f, 0xd1, 0x9a, 0x7a, 0x82, 0x7c, 0x0c, + 0xbb, 0x6f, 0x79, 0x99, 0x8d, 0x92, 0x34, 0x15, 0x99, 0x94, 0xd8, 0x4e, 0x34, 0xa1, 0xa3, 0x67, + 0xbf, 0x34, 0x93, 0xe4, 0x37, 0x70, 0xaf, 0x94, 0xd3, 0xd1, 0xbb, 0x5c, 0xbd, 0x1d, 0x89, 0xec, + 0xcf, 0x55, 0x2e, 0xb2, 0x14, 0x5b, 0x4c, 0x27, 0x7e, 0xb4, 0x7e, 0xc4, 0x66, 0xa3, 0xd4, 0x72, + 0x5e, 0xec, 0xd0, 0xbb, 0xe5, 0xfa, 0x14, 0xf9, 0x1c, 0x80, 0x55, 0x45, 0x31, 0x32, 0x67, 0xd0, + 0xc4, 0xd7, 0xe8, 0xb0, 0x6f, 0x6e, 0xdc, 0x7e, 0x7d, 0xe3, 0xf6, 0xcf, 0xaa, 0xa2, 0xf8, 0x9d, + 0x66, 0xbc, 0xd8, 0xa1, 0x01, 0xab, 0x07, 0x27, 0x2d, 0xf0, 0x2b, 0x96, 0x73, 0xd6, 0xfd, 0x31, + 0x34, 0x68, 0x96, 0x14, 0xcb, 0x62, 0x38, 0xa6, 0xb3, 0xe1, 0xe0, 0x71, 0xbb, 0x9d, 0xee, 0x5f, + 0x5d, 0x5d, 0x5d, 0xb9, 0xdd, 0xbf, 0x3b, 0xfa, 0xd9, 0xf5, 0x99, 0xbe, 0x27, 0x8f, 0x20, 0xc8, + 0xcb, 0x64, 0x9a, 0x33, 0x7d, 0x46, 0x86, 0xbf, 0x9c, 0x58, 0x6a, 0xe2, 0x33, 0xb8, 0x23, 0xb2, + 0xa4, 0x18, 0x65, 0xef, 0x55, 0xc6, 0x64, 0xce, 0x19, 0xb9, 0xb7, 0x11, 0xf8, 0xa4, 0x08, 0xff, + 0xb2, 0xe5, 0xdd, 0xb1, 0x0b, 0xd1, 0x3d, 0x2d, 0x3f, 0xad, 0xd5, 0xdd, 0xff, 0xf9, 0x00, 0x5f, + 0x33, 0xfe, 0x8e, 0xbd, 0x9a, 0xcf, 0x32, 0x49, 0x7e, 0x04, 0x6e, 0xc2, 0xf0, 0xc2, 0xd2, 0xfa, + 0xcd, 0x07, 0xff, 0x92, 0xcd, 0xa9, 0x9b, 0x30, 0xf2, 0x29, 0x78, 0x69, 0x65, 0xda, 0x4c, 0x27, + 0x3e, 0xb8, 0x46, 0x7b, 0x66, 0x3f, 0x78, 0xa8, 0x66, 0x91, 0x9f, 0x80, 0x2b, 0x15, 0xde, 0x9f, + 0x9d, 0xf8, 0xe1, 0x35, 0xee, 0x39, 0x7e, 0xfc, 0x50, 0x57, 0x2a, 0xf2, 0x18, 0x5c, 0x25, 0x6d, + 0xf0, 0xae, 0x1f, 0xfa, 0xab, 0xfa, 0x3b, 0x88, 0xba, 0x4a, 0x6a, 0x6e, 0x71, 0x89, 0x77, 0xe7, + 0x36, 0xee, 0x37, 0xb9, 0x54, 0x58, 0x13, 0xea, 0x16, 0x97, 0xa4, 0x07, 0xde, 0x65, 0x52, 0xe0, + 0x5d, 0xda, 0x89, 0x3f, 0xbc, 0x46, 0x36, 0x44, 0x4d, 0x21, 0x7d, 0xf0, 0xd2, 0x71, 0x81, 0x39, + 0xd4, 0xe1, 0xb9, 0xf6, 0x5c, 0xd8, 0xa5, 0x2d, 0x3f, 0x1d, 0x17, 0xe4, 0x67, 0xe0, 0x4d, 0x0a, + 0x85, 0xb1, 0xec, 0xc4, 0x3f, 0xb8, 0xc6, 0xc7, 0x7e, 0x6f, 0xe9, 0x93, 0x42, 0x69, 0x7a, 0x8e, + 0xd7, 0xcb, 0x76, 0x3a, 0xbe, 0xdb, 0x96, 0x9e, 0x0f, 0x07, 0x7a, 0x37, 0xd5, 0x70, 0x80, 0x29, + 0xdc, 0xb6, 0x9b, 0xd7, 0xab, 0xfc, 0x6a, 0x38, 0x40, 0xfb, 0xe3, 0x18, 0xbf, 0xa0, 0x6e, 0xb0, + 0x3f, 0x8e, 0x6b, 0xfb, 0xe3, 0x18, 0xed, 0x8f, 0x63, 0xfc, 0xa4, 0xba, 0xc9, 0x7e, 0xc1, 0xaf, + 0x90, 0xdf, 0xc0, 0x3b, 0x38, 0xb8, 0xe1, 0xd0, 0x75, 0x73, 0x31, 0x74, 0xe4, 0x69, 0x7f, 0xdd, + 0x30, 0xe1, 0x06, 0x7f, 0x73, 0xaf, 0x59, 0x7f, 0xa9, 0x04, 0xf9, 0x0c, 0xfc, 0xfa, 0x7e, 0xdb, + 0xfe, 0x00, 0x78, 0xdf, 0x19, 0x81, 0x61, 0x76, 0x3f, 0x86, 0xbb, 0x1b, 0x2f, 0xb5, 0x6e, 0x69, + 0xa6, 0x4d, 0xbb, 0xbd, 0x00, 0x7d, 0xbb, 0xff, 0x75, 0xe1, 0xa1, 0x65, 0x7d, 0xc5, 0xd2, 0x5c, + 0x64, 0x17, 0x6a, 0xc1, 0xfe, 0x39, 0x34, 0x64, 0x35, 0x2e, 0x6d, 0x92, 0x6f, 0x6d, 0x17, 0x14, + 0x99, 0xe4, 0x5b, 0x08, 0xca, 0x64, 0x36, 0x9a, 0xe4, 0x59, 0x91, 0xda, 0x46, 0x1e, 0x6f, 0x93, + 0x6d, 0x2e, 0xa5, 0x1b, 0xfc, 0x73, 0x2d, 0x32, 0x8d, 0xbd, 0x5d, 0xda, 0x21, 0xf9, 0x02, 0x3a, + 0xb2, 0xc8, 0x2f, 0x32, 0x6b, 0xe9, 0xa1, 0xe5, 0xed, 0x3b, 0x01, 0x14, 0xa0, 0xfc, 0xf0, 0xf7, + 0xb0, 0xb7, 0xe6, 0xbc, 0xda, 0xd3, 0x03, 0xd3, 0xd3, 0xe3, 0xf5, 0x9e, 0x7e, 0xbb, 0xf7, 0x4a, + 0x73, 0x7f, 0x0c, 0x0f, 0x36, 0x50, 0xac, 0x00, 0x21, 0xd0, 0x18, 0xcf, 0x95, 0xc4, 0x33, 0xde, + 0xa5, 0xf8, 0xbb, 0xfb, 0x0c, 0xc8, 0x06, 0xf7, 0xcd, 0xd7, 0xaf, 0xea, 0x08, 0x68, 0xe2, 0xf7, + 0x89, 0xc0, 0x93, 0x4f, 0xa0, 0xc1, 0x92, 0x32, 0xdb, 0xd6, 0xd2, 0xfe, 0x8a, 0xcf, 0x83, 0xf0, + 0x93, 0xa7, 0xd0, 0xc8, 0xde, 0xab, 0x72, 0x1b, 0xed, 0x6f, 0xdf, 0xa7, 0x90, 0x5a, 0x7c, 0xf2, + 0xc5, 0x1f, 0x3e, 0x9f, 0xe6, 0xea, 0x6d, 0x35, 0xee, 0x5f, 0xf0, 0xf2, 0x68, 0xca, 0x8b, 0x84, + 0x4d, 0x97, 0xff, 0x54, 0xe5, 0x4c, 0x65, 0x82, 0x25, 0x05, 0xfe, 0x07, 0x88, 0xb3, 0xf2, 0x68, + 0xf5, 0x3f, 0xc3, 0xef, 0x02, 0x00, 0x00, 0xff, 0xff, 0x5b, 0xac, 0xa6, 0xa5, 0x28, 0x0e, 0x00, + 0x00, } diff --git a/internal/testprotos/jsonpb_proto/test2.proto b/internal/testprotos/jsonpb_proto/test2.proto index d34dc33d6b..f41c0ec486 100644 --- a/internal/testprotos/jsonpb_proto/test2.proto +++ b/internal/testprotos/jsonpb_proto/test2.proto @@ -91,6 +91,7 @@ message MsgWithOneof { string Country = 3; string home_address = 4; MsgWithRequired msg_with_required = 5; + google.protobuf.NullValue null_value = 6; } } diff --git a/jsonpb/decode.go b/jsonpb/decode.go index 60e82caa9a..6c16c255ff 100644 --- a/jsonpb/decode.go +++ b/jsonpb/decode.go @@ -386,8 +386,14 @@ func (u *Unmarshaler) unmarshalMessage(m protoreflect.Message, in []byte) error } func isSingularWellKnownValue(fd protoreflect.FieldDescriptor) bool { + if fd.Cardinality() == protoreflect.Repeated { + return false + } if md := fd.Message(); md != nil { - return md.FullName() == "google.protobuf.Value" && fd.Cardinality() != protoreflect.Repeated + return md.FullName() == "google.protobuf.Value" + } + if ed := fd.Enum(); ed != nil { + return ed.FullName() == "google.protobuf.NullValue" } return false } diff --git a/jsonpb/json_test.go b/jsonpb/json_test.go index a98ad169f2..39427734ec 100644 --- a/jsonpb/json_test.go +++ b/jsonpb/json_test.go @@ -441,6 +441,7 @@ var marshalingTests = []struct { `{"mBoolSimple":{"true":{"oInt32":1}}}`}, {"oneof, not set", marshaler, &pb2.MsgWithOneof{}, `{}`}, {"oneof, set", marshaler, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_Title{"Grand Poobah"}}, `{"title":"Grand Poobah"}`}, + {"oneof NullValue", marshaler, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_NullValue{stpb.NullValue_NULL_VALUE}}, `{"nullValue":null}`}, {"force orig_name", Marshaler{OrigName: true}, &pb2.Simple{OInt32: proto.Int32(4)}, `{"o_int32":4}`}, {"proto2 extension", marshaler, realNumber, realNumberJSON}, @@ -738,6 +739,7 @@ var unmarshalingTests = []struct { {"oneof orig_name", Unmarshaler{}, `{"Country":"Australia"}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_Country{"Australia"}}}, {"oneof spec name2", Unmarshaler{}, `{"homeAddress":"Australia"}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_HomeAddress{"Australia"}}}, {"oneof orig_name2", Unmarshaler{}, `{"home_address":"Australia"}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_HomeAddress{"Australia"}}}, + {"oneof NullValue", Unmarshaler{}, `{"nullValue":null}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_NullValue{stpb.NullValue_NULL_VALUE}}}, {"orig_name input", Unmarshaler{}, `{"o_bool":true}`, &pb2.Simple{OBool: proto.Bool(true)}}, {"camelName input", Unmarshaler{}, `{"oBool":true}`, &pb2.Simple{OBool: proto.Bool(true)}}, From b7697bb698b1c56643249ef6179c7cae1478881d Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Tue, 5 Mar 2024 13:48:06 -0800 Subject: [PATCH 133/133] all: update descriptor.proto to latest version A recent change to the upstream descriptor.proto, appearing in google.golang.org/protobuf@v1.33.0, removed the long-deprecated FileOptions.php_generic_services field. This backwards-incompatible change results in an incompatibility between the github.com/golang/protobuf and google.golang.org/protobuf modules. Bump the google.golang.org/protobuf version in go.mod, regenerate descriptors. Increase the minimum Go version requirement to go1.17 (the minimum supported by v1.33.0). Run gofmt to update formatting to go1.22 standards. For #1596 --- .github/workflows/test.yml | 6 +- go.mod | 4 +- go.sum | 2 + jsonpb/decode.go | 1 + jsonpb/encode.go | 1 + protoc-gen-go/descriptor/descriptor.pb.go | 128 +++++++++++++++++++++- protoc-gen-go/generator/generator.go | 2 + protoc-gen-go/main.go | 4 + protoc-gen-go/plugin/plugin.pb.go | 1 + ptypes/any.go | 7 +- 10 files changed, 146 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bd97bd412a..5951041d1b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ jobs: test: strategy: matrix: - go-version: [1.11.x, 1.12.x, 1.13.x, 1.14.x, 1.15.x, 1.16.x] + go-version: [1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x] os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: @@ -15,8 +15,8 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - name: TestLatest - if: matrix.go-version == '1.16.x' + if: matrix.go-version == '1.21.x' run: ./test.bash - name: TestAll - if: matrix.go-version != '1.16.x' + if: matrix.go-version != '1.21.x' run: go test ./... diff --git a/go.mod b/go.mod index 6cac17b113..6462e889c0 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ // Deprecated: Use the "google.golang.org/protobuf" module instead. module github.com/golang/protobuf -go 1.9 +go 1.17 require ( github.com/google/go-cmp v0.5.5 - google.golang.org/protobuf v1.26.0 + google.golang.org/protobuf v1.33.0 ) diff --git a/go.sum b/go.sum index 20a6257f1b..f1679f1244 100644 --- a/go.sum +++ b/go.sum @@ -6,3 +6,5 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= diff --git a/jsonpb/decode.go b/jsonpb/decode.go index 6c16c255ff..c6f66f1039 100644 --- a/jsonpb/decode.go +++ b/jsonpb/decode.go @@ -56,6 +56,7 @@ type Unmarshaler struct { // implement JSONPBMarshaler so that the custom format can be produced. // // The JSON unmarshaling must follow the JSON to proto specification: +// // https://developers.google.com/protocol-buffers/docs/proto3#json // // Deprecated: Custom types should implement protobuf reflection instead. diff --git a/jsonpb/encode.go b/jsonpb/encode.go index 685c80a62b..e9438a93f3 100644 --- a/jsonpb/encode.go +++ b/jsonpb/encode.go @@ -55,6 +55,7 @@ type Marshaler struct { // implement JSONPBUnmarshaler so that the custom format can be parsed. // // The JSON marshaling must follow the proto to JSON specification: +// // https://developers.google.com/protocol-buffers/docs/proto3#json // // Deprecated: Custom types should implement protobuf reflection instead. diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go index 63dc057851..a5a138613a 100644 --- a/protoc-gen-go/descriptor/descriptor.pb.go +++ b/protoc-gen-go/descriptor/descriptor.pb.go @@ -12,6 +12,31 @@ import ( // Symbols defined in public import of google/protobuf/descriptor.proto. +type Edition = descriptorpb.Edition + +const Edition_EDITION_UNKNOWN = descriptorpb.Edition_EDITION_UNKNOWN +const Edition_EDITION_PROTO2 = descriptorpb.Edition_EDITION_PROTO2 +const Edition_EDITION_PROTO3 = descriptorpb.Edition_EDITION_PROTO3 +const Edition_EDITION_2023 = descriptorpb.Edition_EDITION_2023 +const Edition_EDITION_2024 = descriptorpb.Edition_EDITION_2024 +const Edition_EDITION_1_TEST_ONLY = descriptorpb.Edition_EDITION_1_TEST_ONLY +const Edition_EDITION_2_TEST_ONLY = descriptorpb.Edition_EDITION_2_TEST_ONLY +const Edition_EDITION_99997_TEST_ONLY = descriptorpb.Edition_EDITION_99997_TEST_ONLY +const Edition_EDITION_99998_TEST_ONLY = descriptorpb.Edition_EDITION_99998_TEST_ONLY +const Edition_EDITION_99999_TEST_ONLY = descriptorpb.Edition_EDITION_99999_TEST_ONLY +const Edition_EDITION_MAX = descriptorpb.Edition_EDITION_MAX + +var Edition_name = descriptorpb.Edition_name +var Edition_value = descriptorpb.Edition_value + +type ExtensionRangeOptions_VerificationState = descriptorpb.ExtensionRangeOptions_VerificationState + +const ExtensionRangeOptions_DECLARATION = descriptorpb.ExtensionRangeOptions_DECLARATION +const ExtensionRangeOptions_UNVERIFIED = descriptorpb.ExtensionRangeOptions_UNVERIFIED + +var ExtensionRangeOptions_VerificationState_name = descriptorpb.ExtensionRangeOptions_VerificationState_name +var ExtensionRangeOptions_VerificationState_value = descriptorpb.ExtensionRangeOptions_VerificationState_value + type FieldDescriptorProto_Type = descriptorpb.FieldDescriptorProto_Type const FieldDescriptorProto_TYPE_DOUBLE = descriptorpb.FieldDescriptorProto_TYPE_DOUBLE @@ -39,8 +64,8 @@ var FieldDescriptorProto_Type_value = descriptorpb.FieldDescriptorProto_Type_val type FieldDescriptorProto_Label = descriptorpb.FieldDescriptorProto_Label const FieldDescriptorProto_LABEL_OPTIONAL = descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL -const FieldDescriptorProto_LABEL_REQUIRED = descriptorpb.FieldDescriptorProto_LABEL_REQUIRED const FieldDescriptorProto_LABEL_REPEATED = descriptorpb.FieldDescriptorProto_LABEL_REPEATED +const FieldDescriptorProto_LABEL_REQUIRED = descriptorpb.FieldDescriptorProto_LABEL_REQUIRED var FieldDescriptorProto_Label_name = descriptorpb.FieldDescriptorProto_Label_name var FieldDescriptorProto_Label_value = descriptorpb.FieldDescriptorProto_Label_value @@ -72,6 +97,31 @@ const FieldOptions_JS_NUMBER = descriptorpb.FieldOptions_JS_NUMBER var FieldOptions_JSType_name = descriptorpb.FieldOptions_JSType_name var FieldOptions_JSType_value = descriptorpb.FieldOptions_JSType_value +type FieldOptions_OptionRetention = descriptorpb.FieldOptions_OptionRetention + +const FieldOptions_RETENTION_UNKNOWN = descriptorpb.FieldOptions_RETENTION_UNKNOWN +const FieldOptions_RETENTION_RUNTIME = descriptorpb.FieldOptions_RETENTION_RUNTIME +const FieldOptions_RETENTION_SOURCE = descriptorpb.FieldOptions_RETENTION_SOURCE + +var FieldOptions_OptionRetention_name = descriptorpb.FieldOptions_OptionRetention_name +var FieldOptions_OptionRetention_value = descriptorpb.FieldOptions_OptionRetention_value + +type FieldOptions_OptionTargetType = descriptorpb.FieldOptions_OptionTargetType + +const FieldOptions_TARGET_TYPE_UNKNOWN = descriptorpb.FieldOptions_TARGET_TYPE_UNKNOWN +const FieldOptions_TARGET_TYPE_FILE = descriptorpb.FieldOptions_TARGET_TYPE_FILE +const FieldOptions_TARGET_TYPE_EXTENSION_RANGE = descriptorpb.FieldOptions_TARGET_TYPE_EXTENSION_RANGE +const FieldOptions_TARGET_TYPE_MESSAGE = descriptorpb.FieldOptions_TARGET_TYPE_MESSAGE +const FieldOptions_TARGET_TYPE_FIELD = descriptorpb.FieldOptions_TARGET_TYPE_FIELD +const FieldOptions_TARGET_TYPE_ONEOF = descriptorpb.FieldOptions_TARGET_TYPE_ONEOF +const FieldOptions_TARGET_TYPE_ENUM = descriptorpb.FieldOptions_TARGET_TYPE_ENUM +const FieldOptions_TARGET_TYPE_ENUM_ENTRY = descriptorpb.FieldOptions_TARGET_TYPE_ENUM_ENTRY +const FieldOptions_TARGET_TYPE_SERVICE = descriptorpb.FieldOptions_TARGET_TYPE_SERVICE +const FieldOptions_TARGET_TYPE_METHOD = descriptorpb.FieldOptions_TARGET_TYPE_METHOD + +var FieldOptions_OptionTargetType_name = descriptorpb.FieldOptions_OptionTargetType_name +var FieldOptions_OptionTargetType_value = descriptorpb.FieldOptions_OptionTargetType_value + type MethodOptions_IdempotencyLevel = descriptorpb.MethodOptions_IdempotencyLevel const MethodOptions_IDEMPOTENCY_UNKNOWN = descriptorpb.MethodOptions_IDEMPOTENCY_UNKNOWN @@ -81,10 +131,77 @@ const MethodOptions_IDEMPOTENT = descriptorpb.MethodOptions_IDEMPOTENT var MethodOptions_IdempotencyLevel_name = descriptorpb.MethodOptions_IdempotencyLevel_name var MethodOptions_IdempotencyLevel_value = descriptorpb.MethodOptions_IdempotencyLevel_value +type FeatureSet_FieldPresence = descriptorpb.FeatureSet_FieldPresence + +const FeatureSet_FIELD_PRESENCE_UNKNOWN = descriptorpb.FeatureSet_FIELD_PRESENCE_UNKNOWN +const FeatureSet_EXPLICIT = descriptorpb.FeatureSet_EXPLICIT +const FeatureSet_IMPLICIT = descriptorpb.FeatureSet_IMPLICIT +const FeatureSet_LEGACY_REQUIRED = descriptorpb.FeatureSet_LEGACY_REQUIRED + +var FeatureSet_FieldPresence_name = descriptorpb.FeatureSet_FieldPresence_name +var FeatureSet_FieldPresence_value = descriptorpb.FeatureSet_FieldPresence_value + +type FeatureSet_EnumType = descriptorpb.FeatureSet_EnumType + +const FeatureSet_ENUM_TYPE_UNKNOWN = descriptorpb.FeatureSet_ENUM_TYPE_UNKNOWN +const FeatureSet_OPEN = descriptorpb.FeatureSet_OPEN +const FeatureSet_CLOSED = descriptorpb.FeatureSet_CLOSED + +var FeatureSet_EnumType_name = descriptorpb.FeatureSet_EnumType_name +var FeatureSet_EnumType_value = descriptorpb.FeatureSet_EnumType_value + +type FeatureSet_RepeatedFieldEncoding = descriptorpb.FeatureSet_RepeatedFieldEncoding + +const FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = descriptorpb.FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN +const FeatureSet_PACKED = descriptorpb.FeatureSet_PACKED +const FeatureSet_EXPANDED = descriptorpb.FeatureSet_EXPANDED + +var FeatureSet_RepeatedFieldEncoding_name = descriptorpb.FeatureSet_RepeatedFieldEncoding_name +var FeatureSet_RepeatedFieldEncoding_value = descriptorpb.FeatureSet_RepeatedFieldEncoding_value + +type FeatureSet_Utf8Validation = descriptorpb.FeatureSet_Utf8Validation + +const FeatureSet_UTF8_VALIDATION_UNKNOWN = descriptorpb.FeatureSet_UTF8_VALIDATION_UNKNOWN +const FeatureSet_VERIFY = descriptorpb.FeatureSet_VERIFY +const FeatureSet_NONE = descriptorpb.FeatureSet_NONE + +var FeatureSet_Utf8Validation_name = descriptorpb.FeatureSet_Utf8Validation_name +var FeatureSet_Utf8Validation_value = descriptorpb.FeatureSet_Utf8Validation_value + +type FeatureSet_MessageEncoding = descriptorpb.FeatureSet_MessageEncoding + +const FeatureSet_MESSAGE_ENCODING_UNKNOWN = descriptorpb.FeatureSet_MESSAGE_ENCODING_UNKNOWN +const FeatureSet_LENGTH_PREFIXED = descriptorpb.FeatureSet_LENGTH_PREFIXED +const FeatureSet_DELIMITED = descriptorpb.FeatureSet_DELIMITED + +var FeatureSet_MessageEncoding_name = descriptorpb.FeatureSet_MessageEncoding_name +var FeatureSet_MessageEncoding_value = descriptorpb.FeatureSet_MessageEncoding_value + +type FeatureSet_JsonFormat = descriptorpb.FeatureSet_JsonFormat + +const FeatureSet_JSON_FORMAT_UNKNOWN = descriptorpb.FeatureSet_JSON_FORMAT_UNKNOWN +const FeatureSet_ALLOW = descriptorpb.FeatureSet_ALLOW +const FeatureSet_LEGACY_BEST_EFFORT = descriptorpb.FeatureSet_LEGACY_BEST_EFFORT + +var FeatureSet_JsonFormat_name = descriptorpb.FeatureSet_JsonFormat_name +var FeatureSet_JsonFormat_value = descriptorpb.FeatureSet_JsonFormat_value + +type GeneratedCodeInfo_Annotation_Semantic = descriptorpb.GeneratedCodeInfo_Annotation_Semantic + +const GeneratedCodeInfo_Annotation_NONE = descriptorpb.GeneratedCodeInfo_Annotation_NONE +const GeneratedCodeInfo_Annotation_SET = descriptorpb.GeneratedCodeInfo_Annotation_SET +const GeneratedCodeInfo_Annotation_ALIAS = descriptorpb.GeneratedCodeInfo_Annotation_ALIAS + +var GeneratedCodeInfo_Annotation_Semantic_name = descriptorpb.GeneratedCodeInfo_Annotation_Semantic_name +var GeneratedCodeInfo_Annotation_Semantic_value = descriptorpb.GeneratedCodeInfo_Annotation_Semantic_value + type FileDescriptorSet = descriptorpb.FileDescriptorSet type FileDescriptorProto = descriptorpb.FileDescriptorProto type DescriptorProto = descriptorpb.DescriptorProto type ExtensionRangeOptions = descriptorpb.ExtensionRangeOptions + +const Default_ExtensionRangeOptions_Verification = descriptorpb.Default_ExtensionRangeOptions_Verification + type FieldDescriptorProto = descriptorpb.FieldDescriptorProto type OneofDescriptorProto = descriptorpb.OneofDescriptorProto type EnumDescriptorProto = descriptorpb.EnumDescriptorProto @@ -103,7 +220,6 @@ const Default_FileOptions_OptimizeFor = descriptorpb.Default_FileOptions_Optimiz const Default_FileOptions_CcGenericServices = descriptorpb.Default_FileOptions_CcGenericServices const Default_FileOptions_JavaGenericServices = descriptorpb.Default_FileOptions_JavaGenericServices const Default_FileOptions_PyGenericServices = descriptorpb.Default_FileOptions_PyGenericServices -const Default_FileOptions_PhpGenericServices = descriptorpb.Default_FileOptions_PhpGenericServices const Default_FileOptions_Deprecated = descriptorpb.Default_FileOptions_Deprecated const Default_FileOptions_CcEnableArenas = descriptorpb.Default_FileOptions_CcEnableArenas @@ -118,8 +234,10 @@ type FieldOptions = descriptorpb.FieldOptions const Default_FieldOptions_Ctype = descriptorpb.Default_FieldOptions_Ctype const Default_FieldOptions_Jstype = descriptorpb.Default_FieldOptions_Jstype const Default_FieldOptions_Lazy = descriptorpb.Default_FieldOptions_Lazy +const Default_FieldOptions_UnverifiedLazy = descriptorpb.Default_FieldOptions_UnverifiedLazy const Default_FieldOptions_Deprecated = descriptorpb.Default_FieldOptions_Deprecated const Default_FieldOptions_Weak = descriptorpb.Default_FieldOptions_Weak +const Default_FieldOptions_DebugRedact = descriptorpb.Default_FieldOptions_DebugRedact type OneofOptions = descriptorpb.OneofOptions type EnumOptions = descriptorpb.EnumOptions @@ -129,6 +247,7 @@ const Default_EnumOptions_Deprecated = descriptorpb.Default_EnumOptions_Deprecat type EnumValueOptions = descriptorpb.EnumValueOptions const Default_EnumValueOptions_Deprecated = descriptorpb.Default_EnumValueOptions_Deprecated +const Default_EnumValueOptions_DebugRedact = descriptorpb.Default_EnumValueOptions_DebugRedact type ServiceOptions = descriptorpb.ServiceOptions @@ -140,12 +259,17 @@ const Default_MethodOptions_Deprecated = descriptorpb.Default_MethodOptions_Depr const Default_MethodOptions_IdempotencyLevel = descriptorpb.Default_MethodOptions_IdempotencyLevel type UninterpretedOption = descriptorpb.UninterpretedOption +type FeatureSet = descriptorpb.FeatureSet +type FeatureSetDefaults = descriptorpb.FeatureSetDefaults type SourceCodeInfo = descriptorpb.SourceCodeInfo type GeneratedCodeInfo = descriptorpb.GeneratedCodeInfo type DescriptorProto_ExtensionRange = descriptorpb.DescriptorProto_ExtensionRange type DescriptorProto_ReservedRange = descriptorpb.DescriptorProto_ReservedRange +type ExtensionRangeOptions_Declaration = descriptorpb.ExtensionRangeOptions_Declaration type EnumDescriptorProto_EnumReservedRange = descriptorpb.EnumDescriptorProto_EnumReservedRange +type FieldOptions_EditionDefault = descriptorpb.FieldOptions_EditionDefault type UninterpretedOption_NamePart = descriptorpb.UninterpretedOption_NamePart +type FeatureSetDefaults_FeatureSetEditionDefault = descriptorpb.FeatureSetDefaults_FeatureSetEditionDefault type SourceCodeInfo_Location = descriptorpb.SourceCodeInfo_Location type GeneratedCodeInfo_Annotation = descriptorpb.GeneratedCodeInfo_Annotation diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go index 12ff35b94f..53b0251e92 100644 --- a/protoc-gen-go/generator/generator.go +++ b/protoc-gen-go/generator/generator.go @@ -1434,6 +1434,7 @@ func (g *Generator) generateEnum(enum *EnumDescriptor) { // The tag is a string like "varint,2,opt,name=fieldname,def=7" that // identifies details of the field for the protocol buffer marshaling and unmarshaling // code. The fields are: +// // wire encoding // protocol tag number // opt,req,rep for optional, required, or repeated @@ -1442,6 +1443,7 @@ func (g *Generator) generateEnum(enum *EnumDescriptor) { // enum= the name of the enum type if it is an enum-typed field. // proto3 if this field is in a proto3 message // def= string representation of the default value, if any. +// // The default value must be in a representation that can be used at run-time // to generate the default value. Thus bools become 0 and 1, for instance. func (g *Generator) goTag(message *Descriptor, field *descriptor.FieldDescriptorProto, wiretype string) string { diff --git a/protoc-gen-go/main.go b/protoc-gen-go/main.go index d45b719d1c..11b67d9f78 100644 --- a/protoc-gen-go/main.go +++ b/protoc-gen-go/main.go @@ -5,17 +5,21 @@ // protoc-gen-go is a plugin for the Google protocol buffer compiler to generate // Go code. Install it by building this program and making it accessible within // your PATH with the name: +// // protoc-gen-go // // The 'go' suffix becomes part of the argument for the protocol compiler, // such that it can be invoked as: +// // protoc --go_out=paths=source_relative:. path/to/file.proto // // This generates Go bindings for the protocol buffer defined by file.proto. // With that input, the output will be written to: +// // path/to/file.pb.go // // See the README and documentation for protocol buffers to learn more: +// // https://developers.google.com/protocol-buffers/ package main diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go index b7b4a2f945..04561b858c 100644 --- a/protoc-gen-go/plugin/plugin.pb.go +++ b/protoc-gen-go/plugin/plugin.pb.go @@ -16,6 +16,7 @@ type CodeGeneratorResponse_Feature = pluginpb.CodeGeneratorResponse_Feature const CodeGeneratorResponse_FEATURE_NONE = pluginpb.CodeGeneratorResponse_FEATURE_NONE const CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL = pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL +const CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS = pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS var CodeGeneratorResponse_Feature_name = pluginpb.CodeGeneratorResponse_Feature_name var CodeGeneratorResponse_Feature_value = pluginpb.CodeGeneratorResponse_Feature_value diff --git a/ptypes/any.go b/ptypes/any.go index 85f9f57365..fdff3fdb4c 100644 --- a/ptypes/any.go +++ b/ptypes/any.go @@ -127,9 +127,10 @@ func Is(any *anypb.Any, m proto.Message) bool { // The allocated message is stored in the embedded proto.Message. // // Example: -// var x ptypes.DynamicAny -// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } -// fmt.Printf("unmarshaled message: %v", x.Message) +// +// var x ptypes.DynamicAny +// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } +// fmt.Printf("unmarshaled message: %v", x.Message) // // Deprecated: Use the any.UnmarshalNew method instead to unmarshal // the any message contents into a new instance of the underlying message.