[
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\n\n---\n\n**What version of protobuf and what language are you using?**\nVersion: (e.g., `v1.1.0`, `89a0c16f`, etc)\n\n**What did you do?**\nIf possible, provide a recipe for reproducing the error.\nA complete runnable program is good with `.proto` and `.go` source code.\n\n**What did you expect to see?**\n\n**What did you see instead?**\n\nMake sure you include information that can help us debug (full error message, exception listing, stack trace, logs).\n\n**Anything else we should know about your project / environment?**\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\n\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is.\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/question.md",
    "content": "---\nname: Question\nabout: Questions and troubleshooting\n\n---\n\n\n"
  },
  {
    "path": ".github/workflows/test.yml",
    "content": "on: [push, pull_request]\nname: Test\njobs:\n  test:\n    strategy:\n      matrix:\n        go-version: [1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x]\n        os: [ubuntu-latest, macos-latest]\n    runs-on: ${{ matrix.os }}\n    steps:\n    - name: Install Go\n      uses: actions/setup-go@v2\n      with:\n        go-version: ${{ matrix.go-version }}\n    - name: Checkout code\n      uses: actions/checkout@v2\n    - name: TestLatest\n      if: matrix.go-version == '1.21.x'\n      run: ./test.bash\n    - name: TestAll\n      if: matrix.go-version != '1.21.x'\n      run: go test ./...\n"
  },
  {
    "path": ".gitignore",
    "content": ".cache\nvendor\ncmd/protoc-gen-go/protoc-gen-go\n"
  },
  {
    "path": "AUTHORS",
    "content": "# This source code refers to The Go Authors for copyright purposes.\n# The master list of authors is in the main Go distribution,\n# visible at http://tip.golang.org/AUTHORS.\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to Go Protocol Buffers\n\nGo protocol buffers is an open source project and accepts contributions.\n\nThis project is the first major version of Go protobufs,\nwhile the next major revision of this project is located at\n[protocolbuffers/protobuf-go](https://github.com/protocolbuffers/protobuf-go).\nMost new development effort is focused on the latter project,\nand changes to this project is primarily reserved for bug fixes.\n\n\n## Contributor License Agreement\n\nContributions to this project must be accompanied by a Contributor License\nAgreement. You (or your employer) retain the copyright to your contribution,\nthis simply gives us permission to use and redistribute your contributions as\npart of the project. Head over to <https://cla.developers.google.com/> to see\nyour current agreements on file or to sign a new one.\n\nYou generally only need to submit a CLA once, so if you've already submitted one\n(even if it was for a different project), you probably don't need to do it\nagain.\n\n\n## Code reviews\n\nAll submissions, including submissions by project members, require review. We\nuse GitHub pull requests for this purpose. Consult\n[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more\ninformation on using pull requests.\n"
  },
  {
    "path": "CONTRIBUTORS",
    "content": "# This source code was written by the Go contributors.\n# The master list of contributors is in the main Go distribution,\n# visible at http://tip.golang.org/CONTRIBUTORS.\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright 2010 The Go Authors.  All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n    * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n    * Neither the name of Google Inc. nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n"
  },
  {
    "path": "README.md",
    "content": "# Go support for Protocol Buffers\n\n[![GoDev](https://img.shields.io/static/v1?label=godev&message=reference&color=00add8)](https://pkg.go.dev/mod/github.com/golang/protobuf)\n[![Build Status](https://travis-ci.org/golang/protobuf.svg?branch=master)](https://travis-ci.org/golang/protobuf)\n\nThis module\n([`github.com/golang/protobuf`](https://pkg.go.dev/mod/github.com/golang/protobuf))\ncontains Go bindings for protocol buffers.\n\nIt has been superseded by the\n[`google.golang.org/protobuf`](https://pkg.go.dev/mod/google.golang.org/protobuf)\nmodule, which contains an updated and simplified API,\nsupport for protobuf reflection, and many other improvements.\nWe recommend that new code use the `google.golang.org/protobuf` module.\n\nVersions v1.4 and later of `github.com/golang/protobuf` are implemented\nin terms of `google.golang.org/protobuf`.\nPrograms which use both modules must use at least version v1.4 of this one.\n\nSee the\n[developer guide for protocol buffers in Go](https://developers.google.com/protocol-buffers/docs/gotutorial)\nfor a general guide for how to get started using protobufs in Go.\n\nSee\n[release note documentation](https://github.com/golang/protobuf/releases)\nfor more information about individual releases of this project.\n\nSee\n[documentation for the next major revision](https://pkg.go.dev/mod/google.golang.org/protobuf)\nfor more information about the purpose, usage, and history of this project.\n\n## Package index\n\nSummary of the packages provided by this module:\n\n*   [`proto`](https://pkg.go.dev/github.com/golang/protobuf/proto): Package\n    `proto` provides functions operating on protobuf messages such as cloning,\n    merging, and checking equality, as well as binary serialization and text\n    serialization.\n*   [`jsonpb`](https://pkg.go.dev/github.com/golang/protobuf/jsonpb): Package\n    `jsonpb` serializes protobuf messages as JSON.\n*   [`ptypes`](https://pkg.go.dev/github.com/golang/protobuf/ptypes): Package\n    `ptypes` provides helper functionality for protobuf well-known types.\n*   [`ptypes/any`](https://pkg.go.dev/github.com/golang/protobuf/ptypes/any):\n    Package `any` is the generated package for `google/protobuf/any.proto`.\n*   [`ptypes/empty`](https://pkg.go.dev/github.com/golang/protobuf/ptypes/empty):\n    Package `empty` is the generated package for `google/protobuf/empty.proto`.\n*   [`ptypes/timestamp`](https://pkg.go.dev/github.com/golang/protobuf/ptypes/timestamp):\n    Package `timestamp` is the generated package for\n    `google/protobuf/timestamp.proto`.\n*   [`ptypes/duration`](https://pkg.go.dev/github.com/golang/protobuf/ptypes/duration):\n    Package `duration` is the generated package for\n    `google/protobuf/duration.proto`.\n*   [`ptypes/wrappers`](https://pkg.go.dev/github.com/golang/protobuf/ptypes/wrappers):\n    Package `wrappers` is the generated package for\n    `google/protobuf/wrappers.proto`.\n*   [`ptypes/struct`](https://pkg.go.dev/github.com/golang/protobuf/ptypes/struct):\n    Package `structpb` is the generated package for\n    `google/protobuf/struct.proto`.\n*   [`protoc-gen-go/descriptor`](https://pkg.go.dev/github.com/golang/protobuf/protoc-gen-go/descriptor):\n    Package `descriptor` is the generated package for\n    `google/protobuf/descriptor.proto`.\n*   [`protoc-gen-go/plugin`](https://pkg.go.dev/github.com/golang/protobuf/protoc-gen-go/plugin):\n    Package `plugin` is the generated package for\n    `google/protobuf/compiler/plugin.proto`.\n*   [`protoc-gen-go`](https://pkg.go.dev/github.com/golang/protobuf/protoc-gen-go):\n    The `protoc-gen-go` binary is a protoc plugin to generate a Go protocol\n    buffer package.\n\n## Reporting issues\n\nThe issue tracker for this project\n[is located here](https://github.com/golang/protobuf/issues).\n\nPlease report any issues with a sufficient description of the bug or feature\nrequest. Bug reports should ideally be accompanied by a minimal reproduction of\nthe issue. Irreproducible bugs are difficult to diagnose and fix (and likely to\nbe closed after some period of time). Bug reports must specify the version of\nthe\n[Go protocol buffer module](https://github.com/protocolbuffers/protobuf-go/releases)\nand also the version of the\n[protocol buffer toolchain](https://github.com/protocolbuffers/protobuf/releases)\nbeing used.\n\n## Contributing\n\nThis project is open-source and accepts contributions. See the\n[contribution guide](https://github.com/golang/protobuf/blob/master/CONTRIBUTING.md)\nfor more information.\n\n## Compatibility\n\nThis module and the generated code are expected to be stable over time. However,\nwe reserve the right to make breaking changes without notice for the following\nreasons:\n\n*   **Security:** A security issue in the specification or implementation may\n    come to light whose resolution requires breaking compatibility. We reserve\n    the right to address such issues.\n*   **Unspecified behavior:** There are some aspects of the protocol buffer\n    specification that are undefined. Programs that depend on unspecified\n    behavior may break in future releases.\n*   **Specification changes:** It may become necessary to address an\n    inconsistency, incompleteness, or change in the protocol buffer\n    specification, which may affect the behavior of existing programs. We\n    reserve the right to address such changes.\n*   **Bugs:** If a package has a bug that violates correctness, a program\n    depending on the buggy behavior may break if the bug is fixed. We reserve\n    the right to fix such bugs.\n*   **Generated additions**: We reserve the right to add new declarations to\n    generated Go packages of `.proto` files. This includes declared constants,\n    variables, functions, types, fields in structs, and methods on types. This\n    may break attempts at injecting additional code on top of what is generated\n    by `protoc-gen-go`. Such practice is not supported by this project.\n*   **Internal changes**: We reserve the right to add, modify, and remove\n    internal code, which includes all unexported declarations, the\n    [`generator`](https://pkg.go.dev/github.com/golang/protobuf/protoc-gen-go/generator)\n    package, and all packages under\n    [`internal`](https://pkg.go.dev/github.com/golang/protobuf/internal).\n\nAny breaking changes outside of these will be announced 6 months in advance to\n[protobuf@googlegroups.com](https://groups.google.com/forum/#!forum/protobuf).\n"
  },
  {
    "path": "descriptor/descriptor.go",
    "content": "// Copyright 2016 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package descriptor provides functions for obtaining the protocol buffer\n// descriptors of generated Go types.\n//\n// Deprecated: See the \"google.golang.org/protobuf/reflect/protoreflect\" package\n// for how to obtain an EnumDescriptor or MessageDescriptor in order to\n// programatically interact with the protobuf type system.\npackage descriptor\n\nimport (\n\t\"bytes\"\n\t\"compress/gzip\"\n\t\"io/ioutil\"\n\t\"sync\"\n\n\t\"github.com/golang/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protodesc\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoimpl\"\n\n\tdescriptorpb \"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n)\n\n// Message is proto.Message with a method to return its descriptor.\n//\n// Deprecated: The Descriptor method may not be generated by future\n// versions of protoc-gen-go, meaning that this interface may not\n// be implemented by many concrete message types.\ntype Message interface {\n\tproto.Message\n\tDescriptor() ([]byte, []int)\n}\n\n// ForMessage returns the file descriptor proto containing\n// the message and the message descriptor proto for the message itself.\n// The returned proto messages must not be mutated.\n//\n// Deprecated: Not all concrete message types satisfy the Message interface.\n// Use MessageDescriptorProto instead. If possible, the calling code should\n// be rewritten to use protobuf reflection instead.\n// See package \"google.golang.org/protobuf/reflect/protoreflect\" for details.\nfunc ForMessage(m Message) (*descriptorpb.FileDescriptorProto, *descriptorpb.DescriptorProto) {\n\treturn MessageDescriptorProto(m)\n}\n\ntype rawDesc struct {\n\tfileDesc []byte\n\tindexes  []int\n}\n\nvar rawDescCache sync.Map // map[protoreflect.Descriptor]*rawDesc\n\nfunc deriveRawDescriptor(d protoreflect.Descriptor) ([]byte, []int) {\n\t// Fast-path: check whether raw descriptors are already cached.\n\torigDesc := d\n\tif v, ok := rawDescCache.Load(origDesc); ok {\n\t\treturn v.(*rawDesc).fileDesc, v.(*rawDesc).indexes\n\t}\n\n\t// Slow-path: derive the raw descriptor from the v2 descriptor.\n\n\t// Start with the leaf (a given enum or message declaration) and\n\t// ascend upwards until we hit the parent file descriptor.\n\tvar idxs []int\n\tfor {\n\t\tidxs = append(idxs, d.Index())\n\t\td = d.Parent()\n\t\tif d == nil {\n\t\t\t// TODO: We could construct a FileDescriptor stub for standalone\n\t\t\t// descriptors to satisfy the API.\n\t\t\treturn nil, nil\n\t\t}\n\t\tif _, ok := d.(protoreflect.FileDescriptor); ok {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Obtain the raw file descriptor.\n\tfd := d.(protoreflect.FileDescriptor)\n\tb, _ := proto.Marshal(protodesc.ToFileDescriptorProto(fd))\n\tfile := protoimpl.X.CompressGZIP(b)\n\n\t// Reverse the indexes, since we populated it in reverse.\n\tfor i, j := 0, len(idxs)-1; i < j; i, j = i+1, j-1 {\n\t\tidxs[i], idxs[j] = idxs[j], idxs[i]\n\t}\n\n\tif v, ok := rawDescCache.LoadOrStore(origDesc, &rawDesc{file, idxs}); ok {\n\t\treturn v.(*rawDesc).fileDesc, v.(*rawDesc).indexes\n\t}\n\treturn file, idxs\n}\n\n// EnumRawDescriptor returns the GZIP'd raw file descriptor representing\n// the enum and the index path to reach the enum declaration.\n// The returned slices must not be mutated.\nfunc EnumRawDescriptor(e proto.GeneratedEnum) ([]byte, []int) {\n\tif ev, ok := e.(interface{ EnumDescriptor() ([]byte, []int) }); ok {\n\t\treturn ev.EnumDescriptor()\n\t}\n\ted := protoimpl.X.EnumTypeOf(e)\n\treturn deriveRawDescriptor(ed.Descriptor())\n}\n\n// MessageRawDescriptor returns the GZIP'd raw file descriptor representing\n// the message and the index path to reach the message declaration.\n// The returned slices must not be mutated.\nfunc MessageRawDescriptor(m proto.GeneratedMessage) ([]byte, []int) {\n\tif mv, ok := m.(interface{ Descriptor() ([]byte, []int) }); ok {\n\t\treturn mv.Descriptor()\n\t}\n\tmd := protoimpl.X.MessageTypeOf(m)\n\treturn deriveRawDescriptor(md.Descriptor())\n}\n\nvar fileDescCache sync.Map // map[*byte]*descriptorpb.FileDescriptorProto\n\nfunc deriveFileDescriptor(rawDesc []byte) *descriptorpb.FileDescriptorProto {\n\t// Fast-path: check whether descriptor protos are already cached.\n\tif v, ok := fileDescCache.Load(&rawDesc[0]); ok {\n\t\treturn v.(*descriptorpb.FileDescriptorProto)\n\t}\n\n\t// Slow-path: derive the descriptor proto from the GZIP'd message.\n\tzr, err := gzip.NewReader(bytes.NewReader(rawDesc))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tb, err := ioutil.ReadAll(zr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfd := new(descriptorpb.FileDescriptorProto)\n\tif err := proto.Unmarshal(b, fd); err != nil {\n\t\tpanic(err)\n\t}\n\tif v, ok := fileDescCache.LoadOrStore(&rawDesc[0], fd); ok {\n\t\treturn v.(*descriptorpb.FileDescriptorProto)\n\t}\n\treturn fd\n}\n\n// EnumDescriptorProto returns the file descriptor proto representing\n// the enum and the enum descriptor proto for the enum itself.\n// The returned proto messages must not be mutated.\nfunc EnumDescriptorProto(e proto.GeneratedEnum) (*descriptorpb.FileDescriptorProto, *descriptorpb.EnumDescriptorProto) {\n\trawDesc, idxs := EnumRawDescriptor(e)\n\tif rawDesc == nil || idxs == nil {\n\t\treturn nil, nil\n\t}\n\tfd := deriveFileDescriptor(rawDesc)\n\tif len(idxs) == 1 {\n\t\treturn fd, fd.EnumType[idxs[0]]\n\t}\n\tmd := fd.MessageType[idxs[0]]\n\tfor _, i := range idxs[1 : len(idxs)-1] {\n\t\tmd = md.NestedType[i]\n\t}\n\ted := md.EnumType[idxs[len(idxs)-1]]\n\treturn fd, ed\n}\n\n// MessageDescriptorProto returns the file descriptor proto representing\n// the message and the message descriptor proto for the message itself.\n// The returned proto messages must not be mutated.\nfunc MessageDescriptorProto(m proto.GeneratedMessage) (*descriptorpb.FileDescriptorProto, *descriptorpb.DescriptorProto) {\n\trawDesc, idxs := MessageRawDescriptor(m)\n\tif rawDesc == nil || idxs == nil {\n\t\treturn nil, nil\n\t}\n\tfd := deriveFileDescriptor(rawDesc)\n\tmd := fd.MessageType[idxs[0]]\n\tfor _, i := range idxs[1:] {\n\t\tmd = md.NestedType[i]\n\t}\n\treturn fd, md\n}\n"
  },
  {
    "path": "descriptor/descriptor_test.go",
    "content": "// Copyright 2020 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage descriptor\n\nimport (\n\t\"testing\"\n\n\t\"github.com/google/go-cmp/cmp\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\n\tdescpb \"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n)\n\nfunc TestEnumDescriptor(t *testing.T) {\n\ttests := []struct {\n\t\tenum protoreflect.Enum\n\t\tidxs []int\n\t\tname string\n\t}{{\n\t\tenum: descpb.FieldDescriptorProto_Type(0),\n\t\tidxs: []int{\n\t\t\tnew(descpb.FieldDescriptorProto).ProtoReflect().Descriptor().Index(),\n\t\t\tnew(descpb.FieldDescriptorProto_Type).Descriptor().Index(),\n\t\t},\n\t\tname: \"Type\",\n\t}, {\n\t\tenum: descpb.FieldOptions_CType(0),\n\t\tidxs: []int{\n\t\t\tnew(descpb.FieldOptions).ProtoReflect().Descriptor().Index(),\n\t\t\tnew(descpb.FieldOptions_CType).Descriptor().Index(),\n\t\t},\n\t\tname: \"CType\",\n\t}}\n\n\tfor _, tt := range tests {\n\t\te := struct{ protoreflect.Enum }{tt.enum} // v2-only enum\n\n\t\t_, idxs := EnumRawDescriptor(e)\n\t\tif diff := cmp.Diff(tt.idxs, idxs); diff != \"\" {\n\t\t\tt.Errorf(\"path index mismatch (-want +got):\\n%v\", diff)\n\t\t}\n\n\t\t_, ed := EnumDescriptorProto(e)\n\t\tif ed.GetName() != tt.name {\n\t\t\tt.Errorf(\"mismatching enum name: got %v, want %v\", ed.GetName(), tt.name)\n\t\t}\n\t}\n}\n\nfunc TestMessageDescriptor(t *testing.T) {\n\ttests := []struct {\n\t\tmessage protoreflect.ProtoMessage\n\t\tidxs    []int\n\t\tname    string\n\t}{{\n\t\tmessage: (*descpb.SourceCodeInfo_Location)(nil),\n\t\tidxs: []int{\n\t\t\tnew(descpb.SourceCodeInfo).ProtoReflect().Descriptor().Index(),\n\t\t\tnew(descpb.SourceCodeInfo_Location).ProtoReflect().Descriptor().Index(),\n\t\t},\n\t\tname: \"Location\",\n\t}, {\n\t\tmessage: (*descpb.FileDescriptorProto)(nil),\n\t\tidxs: []int{\n\t\t\tnew(descpb.FileDescriptorProto).ProtoReflect().Descriptor().Index(),\n\t\t},\n\t\tname: \"FileDescriptorProto\",\n\t}}\n\n\tfor _, tt := range tests {\n\t\tm := struct{ protoreflect.ProtoMessage }{tt.message} // v2-only message\n\n\t\t_, idxs := MessageRawDescriptor(m)\n\t\tif diff := cmp.Diff(tt.idxs, idxs); diff != \"\" {\n\t\t\tt.Errorf(\"path index mismatch (-want +got):\\n%v\", diff)\n\t\t}\n\n\t\t_, md := MessageDescriptorProto(m)\n\t\tif md.GetName() != tt.name {\n\t\t\tt.Errorf(\"mismatching message name: got %v, want %v\", md.GetName(), tt.name)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "go.mod",
    "content": "// Deprecated: Use the \"google.golang.org/protobuf\" module instead.\nmodule github.com/golang/protobuf\n\ngo 1.17\n\nrequire (\n\tgithub.com/google/go-cmp v0.5.5\n\tgoogle.golang.org/protobuf v1.33.0\n)\n"
  },
  {
    "path": "go.sum",
    "content": "github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=\ngithub.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=\ngithub.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngolang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=\ngolang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngoogle.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=\ngoogle.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=\ngoogle.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=\ngoogle.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=\ngoogle.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=\n"
  },
  {
    "path": "internal/cmd/generate-alias/main.go",
    "content": "// Copyright 2019 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n//go:generate go run . -execute\n\npackage main\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"os/exec\"\n\t\"path\"\n\t\"path/filepath\"\n\t\"strings\"\n\n\t\"github.com/golang/protobuf/proto\"\n\tgengo \"google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo\"\n\t\"google.golang.org/protobuf/compiler/protogen\"\n\t\"google.golang.org/protobuf/reflect/protodesc\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\n\t\"google.golang.org/protobuf/types/descriptorpb\"\n\t\"google.golang.org/protobuf/types/known/anypb\"\n\t\"google.golang.org/protobuf/types/known/durationpb\"\n\t\"google.golang.org/protobuf/types/known/emptypb\"\n\t\"google.golang.org/protobuf/types/known/structpb\"\n\t\"google.golang.org/protobuf/types/known/timestamppb\"\n\t\"google.golang.org/protobuf/types/known/wrapperspb\"\n\t\"google.golang.org/protobuf/types/pluginpb\"\n)\n\nfunc main() {\n\trun := flag.Bool(\"execute\", false, \"Write generated files to destination.\")\n\tflag.Parse()\n\n\t// Set of generated proto packages to forward to v2.\n\tfiles := []struct {\n\t\toldGoPkg string\n\t\tnewGoPkg string\n\t\tpbDesc   protoreflect.FileDescriptor\n\t}{{\n\t\toldGoPkg: \"github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor\",\n\t\tnewGoPkg: \"google.golang.org/protobuf/types/descriptorpb\",\n\t\tpbDesc:   descriptorpb.File_google_protobuf_descriptor_proto,\n\t}, {\n\t\toldGoPkg: \"github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go\",\n\t\tnewGoPkg: \"google.golang.org/protobuf/types/pluginpb\",\n\t\tpbDesc:   pluginpb.File_google_protobuf_compiler_plugin_proto,\n\t}, {\n\t\toldGoPkg: \"github.com/golang/protobuf/ptypes/any;any\",\n\t\tnewGoPkg: \"google.golang.org/protobuf/types/known/anypb\",\n\t\tpbDesc:   anypb.File_google_protobuf_any_proto,\n\t}, {\n\t\toldGoPkg: \"github.com/golang/protobuf/ptypes/duration;duration\",\n\t\tnewGoPkg: \"google.golang.org/protobuf/types/known/durationpb\",\n\t\tpbDesc:   durationpb.File_google_protobuf_duration_proto,\n\t}, {\n\t\toldGoPkg: \"github.com/golang/protobuf/ptypes/timestamp;timestamp\",\n\t\tnewGoPkg: \"google.golang.org/protobuf/types/known/timestamppb\",\n\t\tpbDesc:   timestamppb.File_google_protobuf_timestamp_proto,\n\t}, {\n\t\toldGoPkg: \"github.com/golang/protobuf/ptypes/wrappers;wrappers\",\n\t\tnewGoPkg: \"google.golang.org/protobuf/types/known/wrapperspb\",\n\t\tpbDesc:   wrapperspb.File_google_protobuf_wrappers_proto,\n\t}, {\n\t\toldGoPkg: \"github.com/golang/protobuf/ptypes/struct;structpb\",\n\t\tnewGoPkg: \"google.golang.org/protobuf/types/known/structpb\",\n\t\tpbDesc:   structpb.File_google_protobuf_struct_proto,\n\t}, {\n\t\toldGoPkg: \"github.com/golang/protobuf/ptypes/empty;empty\",\n\t\tnewGoPkg: \"google.golang.org/protobuf/types/known/emptypb\",\n\t\tpbDesc:   emptypb.File_google_protobuf_empty_proto,\n\t}}\n\n\t// For each package, construct a proto file that public imports the package.\n\tvar req pluginpb.CodeGeneratorRequest\n\tvar flags []string\n\tfor _, file := range files {\n\t\tpkgPath := file.oldGoPkg[:strings.IndexByte(file.oldGoPkg, ';')]\n\t\tfd := &descriptorpb.FileDescriptorProto{\n\t\t\tName:             proto.String(pkgPath + \"/\" + path.Base(pkgPath) + \".proto\"),\n\t\t\tSyntax:           proto.String(file.pbDesc.Syntax().String()),\n\t\t\tDependency:       []string{file.pbDesc.Path()},\n\t\t\tPublicDependency: []int32{0},\n\t\t\tOptions:          &descriptorpb.FileOptions{GoPackage: proto.String(file.oldGoPkg)},\n\t\t}\n\t\treq.ProtoFile = append(req.ProtoFile, protodesc.ToFileDescriptorProto(file.pbDesc), fd)\n\t\treq.FileToGenerate = append(req.FileToGenerate, fd.GetName())\n\t\tflags = append(flags, \"M\"+file.pbDesc.Path()+\"=\"+file.newGoPkg)\n\t}\n\treq.Parameter = proto.String(strings.Join(flags, \",\"))\n\n\t// Use the internal logic of protoc-gen-go to generate the files.\n\tgen, err := protogen.Options{}.New(&req)\n\tcheck(err)\n\tfor _, file := range gen.Files {\n\t\tif file.Generate {\n\t\t\tgengo.GenerateVersionMarkers = false\n\t\t\tgengo.GenerateFile(gen, file)\n\t\t}\n\t}\n\n\t// Write the generated files.\n\tresp := gen.Response()\n\tif resp.Error != nil {\n\t\tpanic(\"gengo error: \" + resp.GetError())\n\t}\n\tfor _, file := range resp.File {\n\t\trelPath, err := filepath.Rel(filepath.FromSlash(\"github.com/golang/protobuf\"), file.GetName())\n\t\tcheck(err)\n\n\t\tcheck(ioutil.WriteFile(relPath+\".bak\", []byte(file.GetContent()), 0664))\n\t\tif *run {\n\t\t\tfmt.Println(\"#\", relPath)\n\t\t\tcheck(os.Rename(relPath+\".bak\", relPath))\n\t\t} else {\n\t\t\tcmd := exec.Command(\"diff\", relPath, relPath+\".bak\", \"-N\", \"-u\")\n\t\t\tcmd.Stdout = os.Stdout\n\t\t\tcmd.Run()\n\t\t\tos.Remove(relPath + \".bak\") // best-effort delete\n\t\t}\n\t}\n}\n\nfunc check(err error) {\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n"
  },
  {
    "path": "internal/gengogrpc/grpc.go",
    "content": "// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package gengogrpc contains the gRPC code generator.\npackage gengogrpc\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"google.golang.org/protobuf/compiler/protogen\"\n\n\t\"google.golang.org/protobuf/types/descriptorpb\"\n)\n\nconst (\n\tcontextPackage = protogen.GoImportPath(\"context\")\n\tgrpcPackage    = protogen.GoImportPath(\"google.golang.org/grpc\")\n\tcodesPackage   = protogen.GoImportPath(\"google.golang.org/grpc/codes\")\n\tstatusPackage  = protogen.GoImportPath(\"google.golang.org/grpc/status\")\n)\n\n// GenerateFile generates a _grpc.pb.go file containing gRPC service definitions.\nfunc GenerateFile(gen *protogen.Plugin, file *protogen.File) *protogen.GeneratedFile {\n\tif len(file.Services) == 0 {\n\t\treturn nil\n\t}\n\tfilename := file.GeneratedFilenamePrefix + \"_grpc.pb.go\"\n\tg := gen.NewGeneratedFile(filename, file.GoImportPath)\n\tg.P(\"// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\")\n\tg.P()\n\tg.P(\"package \", file.GoPackageName)\n\tg.P()\n\tGenerateFileContent(gen, file, g)\n\treturn g\n}\n\n// GenerateFileContent generates the gRPC service definitions, excluding the package statement.\nfunc GenerateFileContent(gen *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile) {\n\tif len(file.Services) == 0 {\n\t\treturn\n\t}\n\n\t// TODO: Remove this. We don't need to include these references any more.\n\tg.P(\"// Reference imports to suppress errors if they are not otherwise used.\")\n\tg.P(\"var _ \", contextPackage.Ident(\"Context\"))\n\tg.P(\"var _ \", grpcPackage.Ident(\"ClientConnInterface\"))\n\tg.P()\n\n\tg.P(\"// This is a compile-time assertion to ensure that this generated file\")\n\tg.P(\"// is compatible with the grpc package it is being compiled against.\")\n\tg.P(\"const _ = \", grpcPackage.Ident(\"SupportPackageIsVersion6\"))\n\tg.P()\n\tfor _, service := range file.Services {\n\t\tgenService(gen, file, g, service)\n\t}\n}\n\nfunc genService(gen *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile, service *protogen.Service) {\n\tclientName := service.GoName + \"Client\"\n\n\tg.P(\"// \", clientName, \" is the client API for \", service.GoName, \" service.\")\n\tg.P(\"//\")\n\tg.P(\"// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.\")\n\n\t// Client interface.\n\tif service.Desc.Options().(*descriptorpb.ServiceOptions).GetDeprecated() {\n\t\tg.P(\"//\")\n\t\tg.P(deprecationComment)\n\t}\n\tg.Annotate(clientName, service.Location)\n\tg.P(\"type \", clientName, \" interface {\")\n\tfor _, method := range service.Methods {\n\t\tg.Annotate(clientName+\".\"+method.GoName, method.Location)\n\t\tif method.Desc.Options().(*descriptorpb.MethodOptions).GetDeprecated() {\n\t\t\tg.P(deprecationComment)\n\t\t}\n\t\tg.P(method.Comments.Leading,\n\t\t\tclientSignature(g, method))\n\t}\n\tg.P(\"}\")\n\tg.P()\n\n\t// Client structure.\n\tg.P(\"type \", unexport(clientName), \" struct {\")\n\tg.P(\"cc \", grpcPackage.Ident(\"ClientConnInterface\"))\n\tg.P(\"}\")\n\tg.P()\n\n\t// NewClient factory.\n\tif service.Desc.Options().(*descriptorpb.ServiceOptions).GetDeprecated() {\n\t\tg.P(deprecationComment)\n\t}\n\tg.P(\"func New\", clientName, \" (cc \", grpcPackage.Ident(\"ClientConnInterface\"), \") \", clientName, \" {\")\n\tg.P(\"return &\", unexport(clientName), \"{cc}\")\n\tg.P(\"}\")\n\tg.P()\n\n\tvar methodIndex, streamIndex int\n\t// Client method implementations.\n\tfor _, method := range service.Methods {\n\t\tif !method.Desc.IsStreamingServer() && !method.Desc.IsStreamingClient() {\n\t\t\t// Unary RPC method\n\t\t\tgenClientMethod(gen, file, g, method, methodIndex)\n\t\t\tmethodIndex++\n\t\t} else {\n\t\t\t// Streaming RPC method\n\t\t\tgenClientMethod(gen, file, g, method, streamIndex)\n\t\t\tstreamIndex++\n\t\t}\n\t}\n\n\t// Server interface.\n\tserverType := service.GoName + \"Server\"\n\tg.P(\"// \", serverType, \" is the server API for \", service.GoName, \" service.\")\n\tif service.Desc.Options().(*descriptorpb.ServiceOptions).GetDeprecated() {\n\t\tg.P(\"//\")\n\t\tg.P(deprecationComment)\n\t}\n\tg.Annotate(serverType, service.Location)\n\tg.P(\"type \", serverType, \" interface {\")\n\tfor _, method := range service.Methods {\n\t\tg.Annotate(serverType+\".\"+method.GoName, method.Location)\n\t\tif method.Desc.Options().(*descriptorpb.MethodOptions).GetDeprecated() {\n\t\t\tg.P(deprecationComment)\n\t\t}\n\t\tg.P(method.Comments.Leading,\n\t\t\tserverSignature(g, method))\n\t}\n\tg.P(\"}\")\n\tg.P()\n\n\t// Server Unimplemented struct for forward compatibility.\n\tg.P(\"// Unimplemented\", serverType, \" can be embedded to have forward compatible implementations.\")\n\tg.P(\"type Unimplemented\", serverType, \" struct {\")\n\tg.P(\"}\")\n\tg.P()\n\tfor _, method := range service.Methods {\n\t\tnilArg := \"\"\n\t\tif !method.Desc.IsStreamingClient() && !method.Desc.IsStreamingServer() {\n\t\t\tnilArg = \"nil,\"\n\t\t}\n\t\tg.P(\"func (*Unimplemented\", serverType, \") \", serverSignature(g, method), \"{\")\n\t\tg.P(\"return \", nilArg, statusPackage.Ident(\"Errorf\"), \"(\", codesPackage.Ident(\"Unimplemented\"), `, \"method `, method.GoName, ` not implemented\")`)\n\t\tg.P(\"}\")\n\t}\n\tg.P()\n\n\t// Server registration.\n\tif service.Desc.Options().(*descriptorpb.ServiceOptions).GetDeprecated() {\n\t\tg.P(deprecationComment)\n\t}\n\tserviceDescVar := \"_\" + service.GoName + \"_serviceDesc\"\n\tg.P(\"func Register\", service.GoName, \"Server(s *\", grpcPackage.Ident(\"Server\"), \", srv \", serverType, \") {\")\n\tg.P(\"s.RegisterService(&\", serviceDescVar, `, srv)`)\n\tg.P(\"}\")\n\tg.P()\n\n\t// Server handler implementations.\n\tvar handlerNames []string\n\tfor _, method := range service.Methods {\n\t\thname := genServerMethod(gen, file, g, method)\n\t\thandlerNames = append(handlerNames, hname)\n\t}\n\n\t// Service descriptor.\n\tg.P(\"var \", serviceDescVar, \" = \", grpcPackage.Ident(\"ServiceDesc\"), \" {\")\n\tg.P(\"ServiceName: \", strconv.Quote(string(service.Desc.FullName())), \",\")\n\tg.P(\"HandlerType: (*\", serverType, \")(nil),\")\n\tg.P(\"Methods: []\", grpcPackage.Ident(\"MethodDesc\"), \"{\")\n\tfor i, method := range service.Methods {\n\t\tif method.Desc.IsStreamingClient() || method.Desc.IsStreamingServer() {\n\t\t\tcontinue\n\t\t}\n\t\tg.P(\"{\")\n\t\tg.P(\"MethodName: \", strconv.Quote(string(method.Desc.Name())), \",\")\n\t\tg.P(\"Handler: \", handlerNames[i], \",\")\n\t\tg.P(\"},\")\n\t}\n\tg.P(\"},\")\n\tg.P(\"Streams: []\", grpcPackage.Ident(\"StreamDesc\"), \"{\")\n\tfor i, method := range service.Methods {\n\t\tif !method.Desc.IsStreamingClient() && !method.Desc.IsStreamingServer() {\n\t\t\tcontinue\n\t\t}\n\t\tg.P(\"{\")\n\t\tg.P(\"StreamName: \", strconv.Quote(string(method.Desc.Name())), \",\")\n\t\tg.P(\"Handler: \", handlerNames[i], \",\")\n\t\tif method.Desc.IsStreamingServer() {\n\t\t\tg.P(\"ServerStreams: true,\")\n\t\t}\n\t\tif method.Desc.IsStreamingClient() {\n\t\t\tg.P(\"ClientStreams: true,\")\n\t\t}\n\t\tg.P(\"},\")\n\t}\n\tg.P(\"},\")\n\tg.P(\"Metadata: \\\"\", file.Desc.Path(), \"\\\",\")\n\tg.P(\"}\")\n\tg.P()\n}\n\nfunc clientSignature(g *protogen.GeneratedFile, method *protogen.Method) string {\n\ts := method.GoName + \"(ctx \" + g.QualifiedGoIdent(contextPackage.Ident(\"Context\"))\n\tif !method.Desc.IsStreamingClient() {\n\t\ts += \", in *\" + g.QualifiedGoIdent(method.Input.GoIdent)\n\t}\n\ts += \", opts ...\" + g.QualifiedGoIdent(grpcPackage.Ident(\"CallOption\")) + \") (\"\n\tif !method.Desc.IsStreamingClient() && !method.Desc.IsStreamingServer() {\n\t\ts += \"*\" + g.QualifiedGoIdent(method.Output.GoIdent)\n\t} else {\n\t\ts += method.Parent.GoName + \"_\" + method.GoName + \"Client\"\n\t}\n\ts += \", error)\"\n\treturn s\n}\n\nfunc genClientMethod(gen *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile, method *protogen.Method, index int) {\n\tservice := method.Parent\n\tsname := fmt.Sprintf(\"/%s/%s\", service.Desc.FullName(), method.Desc.Name())\n\n\tif method.Desc.Options().(*descriptorpb.MethodOptions).GetDeprecated() {\n\t\tg.P(deprecationComment)\n\t}\n\tg.P(\"func (c *\", unexport(service.GoName), \"Client) \", clientSignature(g, method), \"{\")\n\tif !method.Desc.IsStreamingServer() && !method.Desc.IsStreamingClient() {\n\t\tg.P(\"out := new(\", method.Output.GoIdent, \")\")\n\t\tg.P(`err := c.cc.Invoke(ctx, \"`, sname, `\", in, out, opts...)`)\n\t\tg.P(\"if err != nil { return nil, err }\")\n\t\tg.P(\"return out, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t\treturn\n\t}\n\tstreamType := unexport(service.GoName) + method.GoName + \"Client\"\n\tserviceDescVar := \"_\" + service.GoName + \"_serviceDesc\"\n\tg.P(\"stream, err := c.cc.NewStream(ctx, &\", serviceDescVar, \".Streams[\", index, `], \"`, sname, `\", opts...)`)\n\tg.P(\"if err != nil { return nil, err }\")\n\tg.P(\"x := &\", streamType, \"{stream}\")\n\tif !method.Desc.IsStreamingClient() {\n\t\tg.P(\"if err := x.ClientStream.SendMsg(in); err != nil { return nil, err }\")\n\t\tg.P(\"if err := x.ClientStream.CloseSend(); err != nil { return nil, err }\")\n\t}\n\tg.P(\"return x, nil\")\n\tg.P(\"}\")\n\tg.P()\n\n\tgenSend := method.Desc.IsStreamingClient()\n\tgenRecv := method.Desc.IsStreamingServer()\n\tgenCloseAndRecv := !method.Desc.IsStreamingServer()\n\n\t// Stream auxiliary types and methods.\n\tg.P(\"type \", service.GoName, \"_\", method.GoName, \"Client interface {\")\n\tif genSend {\n\t\tg.P(\"Send(*\", method.Input.GoIdent, \") error\")\n\t}\n\tif genRecv {\n\t\tg.P(\"Recv() (*\", method.Output.GoIdent, \", error)\")\n\t}\n\tif genCloseAndRecv {\n\t\tg.P(\"CloseAndRecv() (*\", method.Output.GoIdent, \", error)\")\n\t}\n\tg.P(grpcPackage.Ident(\"ClientStream\"))\n\tg.P(\"}\")\n\tg.P()\n\n\tg.P(\"type \", streamType, \" struct {\")\n\tg.P(grpcPackage.Ident(\"ClientStream\"))\n\tg.P(\"}\")\n\tg.P()\n\n\tif genSend {\n\t\tg.P(\"func (x *\", streamType, \") Send(m *\", method.Input.GoIdent, \") error {\")\n\t\tg.P(\"return x.ClientStream.SendMsg(m)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\tif genRecv {\n\t\tg.P(\"func (x *\", streamType, \") Recv() (*\", method.Output.GoIdent, \", error) {\")\n\t\tg.P(\"m := new(\", method.Output.GoIdent, \")\")\n\t\tg.P(\"if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }\")\n\t\tg.P(\"return m, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\tif genCloseAndRecv {\n\t\tg.P(\"func (x *\", streamType, \") CloseAndRecv() (*\", method.Output.GoIdent, \", error) {\")\n\t\tg.P(\"if err := x.ClientStream.CloseSend(); err != nil { return nil, err }\")\n\t\tg.P(\"m := new(\", method.Output.GoIdent, \")\")\n\t\tg.P(\"if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }\")\n\t\tg.P(\"return m, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n}\n\nfunc serverSignature(g *protogen.GeneratedFile, method *protogen.Method) string {\n\tvar reqArgs []string\n\tret := \"error\"\n\tif !method.Desc.IsStreamingClient() && !method.Desc.IsStreamingServer() {\n\t\treqArgs = append(reqArgs, g.QualifiedGoIdent(contextPackage.Ident(\"Context\")))\n\t\tret = \"(*\" + g.QualifiedGoIdent(method.Output.GoIdent) + \", error)\"\n\t}\n\tif !method.Desc.IsStreamingClient() {\n\t\treqArgs = append(reqArgs, \"*\"+g.QualifiedGoIdent(method.Input.GoIdent))\n\t}\n\tif method.Desc.IsStreamingClient() || method.Desc.IsStreamingServer() {\n\t\treqArgs = append(reqArgs, method.Parent.GoName+\"_\"+method.GoName+\"Server\")\n\t}\n\treturn method.GoName + \"(\" + strings.Join(reqArgs, \", \") + \") \" + ret\n}\n\nfunc genServerMethod(gen *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile, method *protogen.Method) string {\n\tservice := method.Parent\n\thname := fmt.Sprintf(\"_%s_%s_Handler\", service.GoName, method.GoName)\n\n\tif !method.Desc.IsStreamingClient() && !method.Desc.IsStreamingServer() {\n\t\tg.P(\"func \", hname, \"(srv interface{}, ctx \", contextPackage.Ident(\"Context\"), \", dec func(interface{}) error, interceptor \", grpcPackage.Ident(\"UnaryServerInterceptor\"), \") (interface{}, error) {\")\n\t\tg.P(\"in := new(\", method.Input.GoIdent, \")\")\n\t\tg.P(\"if err := dec(in); err != nil { return nil, err }\")\n\t\tg.P(\"if interceptor == nil { return srv.(\", service.GoName, \"Server).\", method.GoName, \"(ctx, in) }\")\n\t\tg.P(\"info := &\", grpcPackage.Ident(\"UnaryServerInfo\"), \"{\")\n\t\tg.P(\"Server: srv,\")\n\t\tg.P(\"FullMethod: \", strconv.Quote(fmt.Sprintf(\"/%s/%s\", service.Desc.FullName(), method.GoName)), \",\")\n\t\tg.P(\"}\")\n\t\tg.P(\"handler := func(ctx \", contextPackage.Ident(\"Context\"), \", req interface{}) (interface{}, error) {\")\n\t\tg.P(\"return srv.(\", service.GoName, \"Server).\", method.GoName, \"(ctx, req.(*\", method.Input.GoIdent, \"))\")\n\t\tg.P(\"}\")\n\t\tg.P(\"return interceptor(ctx, in, info, handler)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t\treturn hname\n\t}\n\tstreamType := unexport(service.GoName) + method.GoName + \"Server\"\n\tg.P(\"func \", hname, \"(srv interface{}, stream \", grpcPackage.Ident(\"ServerStream\"), \") error {\")\n\tif !method.Desc.IsStreamingClient() {\n\t\tg.P(\"m := new(\", method.Input.GoIdent, \")\")\n\t\tg.P(\"if err := stream.RecvMsg(m); err != nil { return err }\")\n\t\tg.P(\"return srv.(\", service.GoName, \"Server).\", method.GoName, \"(m, &\", streamType, \"{stream})\")\n\t} else {\n\t\tg.P(\"return srv.(\", service.GoName, \"Server).\", method.GoName, \"(&\", streamType, \"{stream})\")\n\t}\n\tg.P(\"}\")\n\tg.P()\n\n\tgenSend := method.Desc.IsStreamingServer()\n\tgenSendAndClose := !method.Desc.IsStreamingServer()\n\tgenRecv := method.Desc.IsStreamingClient()\n\n\t// Stream auxiliary types and methods.\n\tg.P(\"type \", service.GoName, \"_\", method.GoName, \"Server interface {\")\n\tif genSend {\n\t\tg.P(\"Send(*\", method.Output.GoIdent, \") error\")\n\t}\n\tif genSendAndClose {\n\t\tg.P(\"SendAndClose(*\", method.Output.GoIdent, \") error\")\n\t}\n\tif genRecv {\n\t\tg.P(\"Recv() (*\", method.Input.GoIdent, \", error)\")\n\t}\n\tg.P(grpcPackage.Ident(\"ServerStream\"))\n\tg.P(\"}\")\n\tg.P()\n\n\tg.P(\"type \", streamType, \" struct {\")\n\tg.P(grpcPackage.Ident(\"ServerStream\"))\n\tg.P(\"}\")\n\tg.P()\n\n\tif genSend {\n\t\tg.P(\"func (x *\", streamType, \") Send(m *\", method.Output.GoIdent, \") error {\")\n\t\tg.P(\"return x.ServerStream.SendMsg(m)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\tif genSendAndClose {\n\t\tg.P(\"func (x *\", streamType, \") SendAndClose(m *\", method.Output.GoIdent, \") error {\")\n\t\tg.P(\"return x.ServerStream.SendMsg(m)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\tif genRecv {\n\t\tg.P(\"func (x *\", streamType, \") Recv() (*\", method.Input.GoIdent, \", error) {\")\n\t\tg.P(\"m := new(\", method.Input.GoIdent, \")\")\n\t\tg.P(\"if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err }\")\n\t\tg.P(\"return m, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\n\treturn hname\n}\n\nconst deprecationComment = \"// Deprecated: Do not use.\"\n\nfunc unexport(s string) string { return strings.ToLower(s[:1]) + s[1:] }\n"
  },
  {
    "path": "internal/testprotos/jsonpb_proto/test2.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: jsonpb_proto/test2.proto\n\npackage jsonpb_proto\n\nimport (\n\tfmt \"fmt\"\n\tproto \"github.com/golang/protobuf/proto\"\n\tanypb \"google.golang.org/protobuf/types/known/anypb\"\n\tdurationpb \"google.golang.org/protobuf/types/known/durationpb\"\n\tstructpb \"google.golang.org/protobuf/types/known/structpb\"\n\ttimestamppb \"google.golang.org/protobuf/types/known/timestamppb\"\n\twrapperspb \"google.golang.org/protobuf/types/known/wrapperspb\"\n\tmath \"math\"\n)\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package\n\ntype Widget_Color int32\n\nconst (\n\tWidget_RED   Widget_Color = 0\n\tWidget_GREEN Widget_Color = 1\n\tWidget_BLUE  Widget_Color = 2\n)\n\nvar Widget_Color_name = map[int32]string{\n\t0: \"RED\",\n\t1: \"GREEN\",\n\t2: \"BLUE\",\n}\n\nvar Widget_Color_value = map[string]int32{\n\t\"RED\":   0,\n\t\"GREEN\": 1,\n\t\"BLUE\":  2,\n}\n\nfunc (x Widget_Color) Enum() *Widget_Color {\n\tp := new(Widget_Color)\n\t*p = x\n\treturn p\n}\n\nfunc (x Widget_Color) String() string {\n\treturn proto.EnumName(Widget_Color_name, int32(x))\n}\n\nfunc (x *Widget_Color) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(Widget_Color_value, data, \"Widget_Color\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Widget_Color(value)\n\treturn nil\n}\n\nfunc (Widget_Color) EnumDescriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{3, 0}\n}\n\n// Test message for holding primitive types.\ntype Simple struct {\n\tOBool                *bool    `protobuf:\"varint,1,opt,name=o_bool,json=oBool\" json:\"o_bool,omitempty\"`\n\tOInt32               *int32   `protobuf:\"varint,2,opt,name=o_int32,json=oInt32\" json:\"o_int32,omitempty\"`\n\tOInt32Str            *int32   `protobuf:\"varint,3,opt,name=o_int32_str,json=oInt32Str\" json:\"o_int32_str,omitempty\"`\n\tOInt64               *int64   `protobuf:\"varint,4,opt,name=o_int64,json=oInt64\" json:\"o_int64,omitempty\"`\n\tOInt64Str            *int64   `protobuf:\"varint,5,opt,name=o_int64_str,json=oInt64Str\" json:\"o_int64_str,omitempty\"`\n\tOUint32              *uint32  `protobuf:\"varint,6,opt,name=o_uint32,json=oUint32\" json:\"o_uint32,omitempty\"`\n\tOUint32Str           *uint32  `protobuf:\"varint,7,opt,name=o_uint32_str,json=oUint32Str\" json:\"o_uint32_str,omitempty\"`\n\tOUint64              *uint64  `protobuf:\"varint,8,opt,name=o_uint64,json=oUint64\" json:\"o_uint64,omitempty\"`\n\tOUint64Str           *uint64  `protobuf:\"varint,9,opt,name=o_uint64_str,json=oUint64Str\" json:\"o_uint64_str,omitempty\"`\n\tOSint32              *int32   `protobuf:\"zigzag32,10,opt,name=o_sint32,json=oSint32\" json:\"o_sint32,omitempty\"`\n\tOSint32Str           *int32   `protobuf:\"zigzag32,11,opt,name=o_sint32_str,json=oSint32Str\" json:\"o_sint32_str,omitempty\"`\n\tOSint64              *int64   `protobuf:\"zigzag64,12,opt,name=o_sint64,json=oSint64\" json:\"o_sint64,omitempty\"`\n\tOSint64Str           *int64   `protobuf:\"zigzag64,13,opt,name=o_sint64_str,json=oSint64Str\" json:\"o_sint64_str,omitempty\"`\n\tOFloat               *float32 `protobuf:\"fixed32,14,opt,name=o_float,json=oFloat\" json:\"o_float,omitempty\"`\n\tOFloatStr            *float32 `protobuf:\"fixed32,15,opt,name=o_float_str,json=oFloatStr\" json:\"o_float_str,omitempty\"`\n\tODouble              *float64 `protobuf:\"fixed64,16,opt,name=o_double,json=oDouble\" json:\"o_double,omitempty\"`\n\tODoubleStr           *float64 `protobuf:\"fixed64,17,opt,name=o_double_str,json=oDoubleStr\" json:\"o_double_str,omitempty\"`\n\tOString              *string  `protobuf:\"bytes,18,opt,name=o_string,json=oString\" json:\"o_string,omitempty\"`\n\tOBytes               []byte   `protobuf:\"bytes,19,opt,name=o_bytes,json=oBytes\" json:\"o_bytes,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *Simple) Reset()         { *m = Simple{} }\nfunc (m *Simple) String() string { return proto.CompactTextString(m) }\nfunc (*Simple) ProtoMessage()    {}\nfunc (*Simple) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{0}\n}\n\nfunc (m *Simple) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Simple.Unmarshal(m, b)\n}\nfunc (m *Simple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Simple.Marshal(b, m, deterministic)\n}\nfunc (m *Simple) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Simple.Merge(m, src)\n}\nfunc (m *Simple) XXX_Size() int {\n\treturn xxx_messageInfo_Simple.Size(m)\n}\nfunc (m *Simple) XXX_DiscardUnknown() {\n\txxx_messageInfo_Simple.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Simple proto.InternalMessageInfo\n\nfunc (m *Simple) GetOBool() bool {\n\tif m != nil && m.OBool != nil {\n\t\treturn *m.OBool\n\t}\n\treturn false\n}\n\nfunc (m *Simple) GetOInt32() int32 {\n\tif m != nil && m.OInt32 != nil {\n\t\treturn *m.OInt32\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOInt32Str() int32 {\n\tif m != nil && m.OInt32Str != nil {\n\t\treturn *m.OInt32Str\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOInt64() int64 {\n\tif m != nil && m.OInt64 != nil {\n\t\treturn *m.OInt64\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOInt64Str() int64 {\n\tif m != nil && m.OInt64Str != nil {\n\t\treturn *m.OInt64Str\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOUint32() uint32 {\n\tif m != nil && m.OUint32 != nil {\n\t\treturn *m.OUint32\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOUint32Str() uint32 {\n\tif m != nil && m.OUint32Str != nil {\n\t\treturn *m.OUint32Str\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOUint64() uint64 {\n\tif m != nil && m.OUint64 != nil {\n\t\treturn *m.OUint64\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOUint64Str() uint64 {\n\tif m != nil && m.OUint64Str != nil {\n\t\treturn *m.OUint64Str\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOSint32() int32 {\n\tif m != nil && m.OSint32 != nil {\n\t\treturn *m.OSint32\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOSint32Str() int32 {\n\tif m != nil && m.OSint32Str != nil {\n\t\treturn *m.OSint32Str\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOSint64() int64 {\n\tif m != nil && m.OSint64 != nil {\n\t\treturn *m.OSint64\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOSint64Str() int64 {\n\tif m != nil && m.OSint64Str != nil {\n\t\treturn *m.OSint64Str\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOFloat() float32 {\n\tif m != nil && m.OFloat != nil {\n\t\treturn *m.OFloat\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOFloatStr() float32 {\n\tif m != nil && m.OFloatStr != nil {\n\t\treturn *m.OFloatStr\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetODouble() float64 {\n\tif m != nil && m.ODouble != nil {\n\t\treturn *m.ODouble\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetODoubleStr() float64 {\n\tif m != nil && m.ODoubleStr != nil {\n\t\treturn *m.ODoubleStr\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOString() string {\n\tif m != nil && m.OString != nil {\n\t\treturn *m.OString\n\t}\n\treturn \"\"\n}\n\nfunc (m *Simple) GetOBytes() []byte {\n\tif m != nil {\n\t\treturn m.OBytes\n\t}\n\treturn nil\n}\n\n// Test message for holding special non-finites primitives.\ntype NonFinites struct {\n\tFNan                 *float32 `protobuf:\"fixed32,1,opt,name=f_nan,json=fNan\" json:\"f_nan,omitempty\"`\n\tFPinf                *float32 `protobuf:\"fixed32,2,opt,name=f_pinf,json=fPinf\" json:\"f_pinf,omitempty\"`\n\tFNinf                *float32 `protobuf:\"fixed32,3,opt,name=f_ninf,json=fNinf\" json:\"f_ninf,omitempty\"`\n\tDNan                 *float64 `protobuf:\"fixed64,4,opt,name=d_nan,json=dNan\" json:\"d_nan,omitempty\"`\n\tDPinf                *float64 `protobuf:\"fixed64,5,opt,name=d_pinf,json=dPinf\" json:\"d_pinf,omitempty\"`\n\tDNinf                *float64 `protobuf:\"fixed64,6,opt,name=d_ninf,json=dNinf\" json:\"d_ninf,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *NonFinites) Reset()         { *m = NonFinites{} }\nfunc (m *NonFinites) String() string { return proto.CompactTextString(m) }\nfunc (*NonFinites) ProtoMessage()    {}\nfunc (*NonFinites) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{1}\n}\n\nfunc (m *NonFinites) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_NonFinites.Unmarshal(m, b)\n}\nfunc (m *NonFinites) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_NonFinites.Marshal(b, m, deterministic)\n}\nfunc (m *NonFinites) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_NonFinites.Merge(m, src)\n}\nfunc (m *NonFinites) XXX_Size() int {\n\treturn xxx_messageInfo_NonFinites.Size(m)\n}\nfunc (m *NonFinites) XXX_DiscardUnknown() {\n\txxx_messageInfo_NonFinites.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_NonFinites proto.InternalMessageInfo\n\nfunc (m *NonFinites) GetFNan() float32 {\n\tif m != nil && m.FNan != nil {\n\t\treturn *m.FNan\n\t}\n\treturn 0\n}\n\nfunc (m *NonFinites) GetFPinf() float32 {\n\tif m != nil && m.FPinf != nil {\n\t\treturn *m.FPinf\n\t}\n\treturn 0\n}\n\nfunc (m *NonFinites) GetFNinf() float32 {\n\tif m != nil && m.FNinf != nil {\n\t\treturn *m.FNinf\n\t}\n\treturn 0\n}\n\nfunc (m *NonFinites) GetDNan() float64 {\n\tif m != nil && m.DNan != nil {\n\t\treturn *m.DNan\n\t}\n\treturn 0\n}\n\nfunc (m *NonFinites) GetDPinf() float64 {\n\tif m != nil && m.DPinf != nil {\n\t\treturn *m.DPinf\n\t}\n\treturn 0\n}\n\nfunc (m *NonFinites) GetDNinf() float64 {\n\tif m != nil && m.DNinf != nil {\n\t\treturn *m.DNinf\n\t}\n\treturn 0\n}\n\n// Test message for holding repeated primitives.\ntype Repeats struct {\n\tRBool                []bool    `protobuf:\"varint,1,rep,name=r_bool,json=rBool\" json:\"r_bool,omitempty\"`\n\tRInt32               []int32   `protobuf:\"varint,2,rep,name=r_int32,json=rInt32\" json:\"r_int32,omitempty\"`\n\tRInt64               []int64   `protobuf:\"varint,3,rep,name=r_int64,json=rInt64\" json:\"r_int64,omitempty\"`\n\tRUint32              []uint32  `protobuf:\"varint,4,rep,name=r_uint32,json=rUint32\" json:\"r_uint32,omitempty\"`\n\tRUint64              []uint64  `protobuf:\"varint,5,rep,name=r_uint64,json=rUint64\" json:\"r_uint64,omitempty\"`\n\tRSint32              []int32   `protobuf:\"zigzag32,6,rep,name=r_sint32,json=rSint32\" json:\"r_sint32,omitempty\"`\n\tRSint64              []int64   `protobuf:\"zigzag64,7,rep,name=r_sint64,json=rSint64\" json:\"r_sint64,omitempty\"`\n\tRFloat               []float32 `protobuf:\"fixed32,8,rep,name=r_float,json=rFloat\" json:\"r_float,omitempty\"`\n\tRDouble              []float64 `protobuf:\"fixed64,9,rep,name=r_double,json=rDouble\" json:\"r_double,omitempty\"`\n\tRString              []string  `protobuf:\"bytes,10,rep,name=r_string,json=rString\" json:\"r_string,omitempty\"`\n\tRBytes               [][]byte  `protobuf:\"bytes,11,rep,name=r_bytes,json=rBytes\" json:\"r_bytes,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}  `json:\"-\"`\n\tXXX_unrecognized     []byte    `json:\"-\"`\n\tXXX_sizecache        int32     `json:\"-\"`\n}\n\nfunc (m *Repeats) Reset()         { *m = Repeats{} }\nfunc (m *Repeats) String() string { return proto.CompactTextString(m) }\nfunc (*Repeats) ProtoMessage()    {}\nfunc (*Repeats) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{2}\n}\n\nfunc (m *Repeats) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Repeats.Unmarshal(m, b)\n}\nfunc (m *Repeats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Repeats.Marshal(b, m, deterministic)\n}\nfunc (m *Repeats) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Repeats.Merge(m, src)\n}\nfunc (m *Repeats) XXX_Size() int {\n\treturn xxx_messageInfo_Repeats.Size(m)\n}\nfunc (m *Repeats) XXX_DiscardUnknown() {\n\txxx_messageInfo_Repeats.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Repeats proto.InternalMessageInfo\n\nfunc (m *Repeats) GetRBool() []bool {\n\tif m != nil {\n\t\treturn m.RBool\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRInt32() []int32 {\n\tif m != nil {\n\t\treturn m.RInt32\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRInt64() []int64 {\n\tif m != nil {\n\t\treturn m.RInt64\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRUint32() []uint32 {\n\tif m != nil {\n\t\treturn m.RUint32\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRUint64() []uint64 {\n\tif m != nil {\n\t\treturn m.RUint64\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRSint32() []int32 {\n\tif m != nil {\n\t\treturn m.RSint32\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRSint64() []int64 {\n\tif m != nil {\n\t\treturn m.RSint64\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRFloat() []float32 {\n\tif m != nil {\n\t\treturn m.RFloat\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRDouble() []float64 {\n\tif m != nil {\n\t\treturn m.RDouble\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRString() []string {\n\tif m != nil {\n\t\treturn m.RString\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRBytes() [][]byte {\n\tif m != nil {\n\t\treturn m.RBytes\n\t}\n\treturn nil\n}\n\n// Test message for holding enums and nested messages.\ntype Widget struct {\n\tColor                *Widget_Color  `protobuf:\"varint,1,opt,name=color,enum=jsonpb_test.Widget_Color\" json:\"color,omitempty\"`\n\tRColor               []Widget_Color `protobuf:\"varint,2,rep,name=r_color,json=rColor,enum=jsonpb_test.Widget_Color\" json:\"r_color,omitempty\"`\n\tSimple               *Simple        `protobuf:\"bytes,10,opt,name=simple\" json:\"simple,omitempty\"`\n\tRSimple              []*Simple      `protobuf:\"bytes,11,rep,name=r_simple,json=rSimple\" json:\"r_simple,omitempty\"`\n\tRepeats              *Repeats       `protobuf:\"bytes,20,opt,name=repeats\" json:\"repeats,omitempty\"`\n\tRRepeats             []*Repeats     `protobuf:\"bytes,21,rep,name=r_repeats,json=rRepeats\" json:\"r_repeats,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}       `json:\"-\"`\n\tXXX_unrecognized     []byte         `json:\"-\"`\n\tXXX_sizecache        int32          `json:\"-\"`\n}\n\nfunc (m *Widget) Reset()         { *m = Widget{} }\nfunc (m *Widget) String() string { return proto.CompactTextString(m) }\nfunc (*Widget) ProtoMessage()    {}\nfunc (*Widget) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{3}\n}\n\nfunc (m *Widget) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Widget.Unmarshal(m, b)\n}\nfunc (m *Widget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Widget.Marshal(b, m, deterministic)\n}\nfunc (m *Widget) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Widget.Merge(m, src)\n}\nfunc (m *Widget) XXX_Size() int {\n\treturn xxx_messageInfo_Widget.Size(m)\n}\nfunc (m *Widget) XXX_DiscardUnknown() {\n\txxx_messageInfo_Widget.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Widget proto.InternalMessageInfo\n\nfunc (m *Widget) GetColor() Widget_Color {\n\tif m != nil && m.Color != nil {\n\t\treturn *m.Color\n\t}\n\treturn Widget_RED\n}\n\nfunc (m *Widget) GetRColor() []Widget_Color {\n\tif m != nil {\n\t\treturn m.RColor\n\t}\n\treturn nil\n}\n\nfunc (m *Widget) GetSimple() *Simple {\n\tif m != nil {\n\t\treturn m.Simple\n\t}\n\treturn nil\n}\n\nfunc (m *Widget) GetRSimple() []*Simple {\n\tif m != nil {\n\t\treturn m.RSimple\n\t}\n\treturn nil\n}\n\nfunc (m *Widget) GetRepeats() *Repeats {\n\tif m != nil {\n\t\treturn m.Repeats\n\t}\n\treturn nil\n}\n\nfunc (m *Widget) GetRRepeats() []*Repeats {\n\tif m != nil {\n\t\treturn m.RRepeats\n\t}\n\treturn nil\n}\n\ntype Maps struct {\n\tMInt64Str            map[int64]string `protobuf:\"bytes,1,rep,name=m_int64_str,json=mInt64Str\" json:\"m_int64_str,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tMBoolSimple          map[bool]*Simple `protobuf:\"bytes,2,rep,name=m_bool_simple,json=mBoolSimple\" json:\"m_bool_simple,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tXXX_NoUnkeyedLiteral struct{}         `json:\"-\"`\n\tXXX_unrecognized     []byte           `json:\"-\"`\n\tXXX_sizecache        int32            `json:\"-\"`\n}\n\nfunc (m *Maps) Reset()         { *m = Maps{} }\nfunc (m *Maps) String() string { return proto.CompactTextString(m) }\nfunc (*Maps) ProtoMessage()    {}\nfunc (*Maps) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{4}\n}\n\nfunc (m *Maps) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Maps.Unmarshal(m, b)\n}\nfunc (m *Maps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Maps.Marshal(b, m, deterministic)\n}\nfunc (m *Maps) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Maps.Merge(m, src)\n}\nfunc (m *Maps) XXX_Size() int {\n\treturn xxx_messageInfo_Maps.Size(m)\n}\nfunc (m *Maps) XXX_DiscardUnknown() {\n\txxx_messageInfo_Maps.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Maps proto.InternalMessageInfo\n\nfunc (m *Maps) GetMInt64Str() map[int64]string {\n\tif m != nil {\n\t\treturn m.MInt64Str\n\t}\n\treturn nil\n}\n\nfunc (m *Maps) GetMBoolSimple() map[bool]*Simple {\n\tif m != nil {\n\t\treturn m.MBoolSimple\n\t}\n\treturn nil\n}\n\ntype MsgWithOneof struct {\n\t// Types that are valid to be assigned to Union:\n\t//\t*MsgWithOneof_Title\n\t//\t*MsgWithOneof_Salary\n\t//\t*MsgWithOneof_Country\n\t//\t*MsgWithOneof_HomeAddress\n\t//\t*MsgWithOneof_MsgWithRequired\n\t//\t*MsgWithOneof_NullValue\n\tUnion                isMsgWithOneof_Union `protobuf_oneof:\"union\"`\n\tXXX_NoUnkeyedLiteral struct{}             `json:\"-\"`\n\tXXX_unrecognized     []byte               `json:\"-\"`\n\tXXX_sizecache        int32                `json:\"-\"`\n}\n\nfunc (m *MsgWithOneof) Reset()         { *m = MsgWithOneof{} }\nfunc (m *MsgWithOneof) String() string { return proto.CompactTextString(m) }\nfunc (*MsgWithOneof) ProtoMessage()    {}\nfunc (*MsgWithOneof) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{5}\n}\n\nfunc (m *MsgWithOneof) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_MsgWithOneof.Unmarshal(m, b)\n}\nfunc (m *MsgWithOneof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_MsgWithOneof.Marshal(b, m, deterministic)\n}\nfunc (m *MsgWithOneof) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_MsgWithOneof.Merge(m, src)\n}\nfunc (m *MsgWithOneof) XXX_Size() int {\n\treturn xxx_messageInfo_MsgWithOneof.Size(m)\n}\nfunc (m *MsgWithOneof) XXX_DiscardUnknown() {\n\txxx_messageInfo_MsgWithOneof.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_MsgWithOneof proto.InternalMessageInfo\n\ntype isMsgWithOneof_Union interface {\n\tisMsgWithOneof_Union()\n}\n\ntype MsgWithOneof_Title struct {\n\tTitle string `protobuf:\"bytes,1,opt,name=title,oneof\"`\n}\n\ntype MsgWithOneof_Salary struct {\n\tSalary int64 `protobuf:\"varint,2,opt,name=salary,oneof\"`\n}\n\ntype MsgWithOneof_Country struct {\n\tCountry string `protobuf:\"bytes,3,opt,name=Country,oneof\"`\n}\n\ntype MsgWithOneof_HomeAddress struct {\n\tHomeAddress string `protobuf:\"bytes,4,opt,name=home_address,json=homeAddress,oneof\"`\n}\n\ntype MsgWithOneof_MsgWithRequired struct {\n\tMsgWithRequired *MsgWithRequired `protobuf:\"bytes,5,opt,name=msg_with_required,json=msgWithRequired,oneof\"`\n}\n\ntype MsgWithOneof_NullValue struct {\n\tNullValue structpb.NullValue `protobuf:\"varint,6,opt,name=null_value,json=nullValue,enum=google.protobuf.NullValue,oneof\"`\n}\n\nfunc (*MsgWithOneof_Title) isMsgWithOneof_Union() {}\n\nfunc (*MsgWithOneof_Salary) isMsgWithOneof_Union() {}\n\nfunc (*MsgWithOneof_Country) isMsgWithOneof_Union() {}\n\nfunc (*MsgWithOneof_HomeAddress) isMsgWithOneof_Union() {}\n\nfunc (*MsgWithOneof_MsgWithRequired) isMsgWithOneof_Union() {}\n\nfunc (*MsgWithOneof_NullValue) isMsgWithOneof_Union() {}\n\nfunc (m *MsgWithOneof) GetUnion() isMsgWithOneof_Union {\n\tif m != nil {\n\t\treturn m.Union\n\t}\n\treturn nil\n}\n\nfunc (m *MsgWithOneof) GetTitle() string {\n\tif x, ok := m.GetUnion().(*MsgWithOneof_Title); ok {\n\t\treturn x.Title\n\t}\n\treturn \"\"\n}\n\nfunc (m *MsgWithOneof) GetSalary() int64 {\n\tif x, ok := m.GetUnion().(*MsgWithOneof_Salary); ok {\n\t\treturn x.Salary\n\t}\n\treturn 0\n}\n\nfunc (m *MsgWithOneof) GetCountry() string {\n\tif x, ok := m.GetUnion().(*MsgWithOneof_Country); ok {\n\t\treturn x.Country\n\t}\n\treturn \"\"\n}\n\nfunc (m *MsgWithOneof) GetHomeAddress() string {\n\tif x, ok := m.GetUnion().(*MsgWithOneof_HomeAddress); ok {\n\t\treturn x.HomeAddress\n\t}\n\treturn \"\"\n}\n\nfunc (m *MsgWithOneof) GetMsgWithRequired() *MsgWithRequired {\n\tif x, ok := m.GetUnion().(*MsgWithOneof_MsgWithRequired); ok {\n\t\treturn x.MsgWithRequired\n\t}\n\treturn nil\n}\n\nfunc (m *MsgWithOneof) GetNullValue() structpb.NullValue {\n\tif x, ok := m.GetUnion().(*MsgWithOneof_NullValue); ok {\n\t\treturn x.NullValue\n\t}\n\treturn structpb.NullValue_NULL_VALUE\n}\n\n// XXX_OneofWrappers is for the internal use of the proto package.\nfunc (*MsgWithOneof) XXX_OneofWrappers() []interface{} {\n\treturn []interface{}{\n\t\t(*MsgWithOneof_Title)(nil),\n\t\t(*MsgWithOneof_Salary)(nil),\n\t\t(*MsgWithOneof_Country)(nil),\n\t\t(*MsgWithOneof_HomeAddress)(nil),\n\t\t(*MsgWithOneof_MsgWithRequired)(nil),\n\t\t(*MsgWithOneof_NullValue)(nil),\n\t}\n}\n\ntype Real struct {\n\tValue                        *float64 `protobuf:\"fixed64,1,opt,name=value\" json:\"value,omitempty\"`\n\tXXX_NoUnkeyedLiteral         struct{} `json:\"-\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n\tXXX_sizecache                int32  `json:\"-\"`\n}\n\nfunc (m *Real) Reset()         { *m = Real{} }\nfunc (m *Real) String() string { return proto.CompactTextString(m) }\nfunc (*Real) ProtoMessage()    {}\nfunc (*Real) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{6}\n}\n\nvar extRange_Real = []proto.ExtensionRange{\n\t{Start: 100, End: 536870911},\n}\n\nfunc (*Real) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_Real\n}\n\nfunc (m *Real) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Real.Unmarshal(m, b)\n}\nfunc (m *Real) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Real.Marshal(b, m, deterministic)\n}\nfunc (m *Real) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Real.Merge(m, src)\n}\nfunc (m *Real) XXX_Size() int {\n\treturn xxx_messageInfo_Real.Size(m)\n}\nfunc (m *Real) XXX_DiscardUnknown() {\n\txxx_messageInfo_Real.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Real proto.InternalMessageInfo\n\nfunc (m *Real) GetValue() float64 {\n\tif m != nil && m.Value != nil {\n\t\treturn *m.Value\n\t}\n\treturn 0\n}\n\ntype Complex struct {\n\tImaginary                    *float64 `protobuf:\"fixed64,1,opt,name=imaginary\" json:\"imaginary,omitempty\"`\n\tXXX_NoUnkeyedLiteral         struct{} `json:\"-\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n\tXXX_sizecache                int32  `json:\"-\"`\n}\n\nfunc (m *Complex) Reset()         { *m = Complex{} }\nfunc (m *Complex) String() string { return proto.CompactTextString(m) }\nfunc (*Complex) ProtoMessage()    {}\nfunc (*Complex) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{7}\n}\n\nvar extRange_Complex = []proto.ExtensionRange{\n\t{Start: 100, End: 536870911},\n}\n\nfunc (*Complex) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_Complex\n}\n\nfunc (m *Complex) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Complex.Unmarshal(m, b)\n}\nfunc (m *Complex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Complex.Marshal(b, m, deterministic)\n}\nfunc (m *Complex) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Complex.Merge(m, src)\n}\nfunc (m *Complex) XXX_Size() int {\n\treturn xxx_messageInfo_Complex.Size(m)\n}\nfunc (m *Complex) XXX_DiscardUnknown() {\n\txxx_messageInfo_Complex.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Complex proto.InternalMessageInfo\n\nfunc (m *Complex) GetImaginary() float64 {\n\tif m != nil && m.Imaginary != nil {\n\t\treturn *m.Imaginary\n\t}\n\treturn 0\n}\n\nvar E_Complex_RealExtension = &proto.ExtensionDesc{\n\tExtendedType:  (*Real)(nil),\n\tExtensionType: (*Complex)(nil),\n\tField:         123,\n\tName:          \"jsonpb_test.Complex.real_extension\",\n\tTag:           \"bytes,123,opt,name=real_extension\",\n\tFilename:      \"jsonpb_proto/test2.proto\",\n}\n\ntype KnownTypes struct {\n\tAn                   *anypb.Any              `protobuf:\"bytes,14,opt,name=an\" json:\"an,omitempty\"`\n\tDur                  *durationpb.Duration    `protobuf:\"bytes,1,opt,name=dur\" json:\"dur,omitempty\"`\n\tSt                   *structpb.Struct        `protobuf:\"bytes,12,opt,name=st\" json:\"st,omitempty\"`\n\tTs                   *timestamppb.Timestamp  `protobuf:\"bytes,2,opt,name=ts\" json:\"ts,omitempty\"`\n\tLv                   *structpb.ListValue     `protobuf:\"bytes,15,opt,name=lv\" json:\"lv,omitempty\"`\n\tVal                  *structpb.Value         `protobuf:\"bytes,16,opt,name=val\" json:\"val,omitempty\"`\n\tDbl                  *wrapperspb.DoubleValue `protobuf:\"bytes,3,opt,name=dbl\" json:\"dbl,omitempty\"`\n\tFlt                  *wrapperspb.FloatValue  `protobuf:\"bytes,4,opt,name=flt\" json:\"flt,omitempty\"`\n\tI64                  *wrapperspb.Int64Value  `protobuf:\"bytes,5,opt,name=i64\" json:\"i64,omitempty\"`\n\tU64                  *wrapperspb.UInt64Value `protobuf:\"bytes,6,opt,name=u64\" json:\"u64,omitempty\"`\n\tI32                  *wrapperspb.Int32Value  `protobuf:\"bytes,7,opt,name=i32\" json:\"i32,omitempty\"`\n\tU32                  *wrapperspb.UInt32Value `protobuf:\"bytes,8,opt,name=u32\" json:\"u32,omitempty\"`\n\tBool                 *wrapperspb.BoolValue   `protobuf:\"bytes,9,opt,name=bool\" json:\"bool,omitempty\"`\n\tStr                  *wrapperspb.StringValue `protobuf:\"bytes,10,opt,name=str\" json:\"str,omitempty\"`\n\tBytes                *wrapperspb.BytesValue  `protobuf:\"bytes,11,opt,name=bytes\" json:\"bytes,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}                `json:\"-\"`\n\tXXX_unrecognized     []byte                  `json:\"-\"`\n\tXXX_sizecache        int32                   `json:\"-\"`\n}\n\nfunc (m *KnownTypes) Reset()         { *m = KnownTypes{} }\nfunc (m *KnownTypes) String() string { return proto.CompactTextString(m) }\nfunc (*KnownTypes) ProtoMessage()    {}\nfunc (*KnownTypes) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{8}\n}\n\nfunc (m *KnownTypes) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_KnownTypes.Unmarshal(m, b)\n}\nfunc (m *KnownTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_KnownTypes.Marshal(b, m, deterministic)\n}\nfunc (m *KnownTypes) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_KnownTypes.Merge(m, src)\n}\nfunc (m *KnownTypes) XXX_Size() int {\n\treturn xxx_messageInfo_KnownTypes.Size(m)\n}\nfunc (m *KnownTypes) XXX_DiscardUnknown() {\n\txxx_messageInfo_KnownTypes.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_KnownTypes proto.InternalMessageInfo\n\nfunc (m *KnownTypes) GetAn() *anypb.Any {\n\tif m != nil {\n\t\treturn m.An\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetDur() *durationpb.Duration {\n\tif m != nil {\n\t\treturn m.Dur\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetSt() *structpb.Struct {\n\tif m != nil {\n\t\treturn m.St\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetTs() *timestamppb.Timestamp {\n\tif m != nil {\n\t\treturn m.Ts\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetLv() *structpb.ListValue {\n\tif m != nil {\n\t\treturn m.Lv\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetVal() *structpb.Value {\n\tif m != nil {\n\t\treturn m.Val\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetDbl() *wrapperspb.DoubleValue {\n\tif m != nil {\n\t\treturn m.Dbl\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetFlt() *wrapperspb.FloatValue {\n\tif m != nil {\n\t\treturn m.Flt\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetI64() *wrapperspb.Int64Value {\n\tif m != nil {\n\t\treturn m.I64\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetU64() *wrapperspb.UInt64Value {\n\tif m != nil {\n\t\treturn m.U64\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetI32() *wrapperspb.Int32Value {\n\tif m != nil {\n\t\treturn m.I32\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetU32() *wrapperspb.UInt32Value {\n\tif m != nil {\n\t\treturn m.U32\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetBool() *wrapperspb.BoolValue {\n\tif m != nil {\n\t\treturn m.Bool\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetStr() *wrapperspb.StringValue {\n\tif m != nil {\n\t\treturn m.Str\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetBytes() *wrapperspb.BytesValue {\n\tif m != nil {\n\t\treturn m.Bytes\n\t}\n\treturn nil\n}\n\n// Test messages for marshaling/unmarshaling required fields.\ntype MsgWithRequired struct {\n\tStr                  *string  `protobuf:\"bytes,1,req,name=str\" json:\"str,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *MsgWithRequired) Reset()         { *m = MsgWithRequired{} }\nfunc (m *MsgWithRequired) String() string { return proto.CompactTextString(m) }\nfunc (*MsgWithRequired) ProtoMessage()    {}\nfunc (*MsgWithRequired) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{9}\n}\n\nfunc (m *MsgWithRequired) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_MsgWithRequired.Unmarshal(m, b)\n}\nfunc (m *MsgWithRequired) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_MsgWithRequired.Marshal(b, m, deterministic)\n}\nfunc (m *MsgWithRequired) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_MsgWithRequired.Merge(m, src)\n}\nfunc (m *MsgWithRequired) XXX_Size() int {\n\treturn xxx_messageInfo_MsgWithRequired.Size(m)\n}\nfunc (m *MsgWithRequired) XXX_DiscardUnknown() {\n\txxx_messageInfo_MsgWithRequired.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_MsgWithRequired proto.InternalMessageInfo\n\nfunc (m *MsgWithRequired) GetStr() string {\n\tif m != nil && m.Str != nil {\n\t\treturn *m.Str\n\t}\n\treturn \"\"\n}\n\ntype MsgWithIndirectRequired struct {\n\tSubm                 *MsgWithRequired            `protobuf:\"bytes,1,opt,name=subm\" json:\"subm,omitempty\"`\n\tMapField             map[string]*MsgWithRequired `protobuf:\"bytes,2,rep,name=map_field,json=mapField\" json:\"map_field,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tSliceField           []*MsgWithRequired          `protobuf:\"bytes,3,rep,name=slice_field,json=sliceField\" json:\"slice_field,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}                    `json:\"-\"`\n\tXXX_unrecognized     []byte                      `json:\"-\"`\n\tXXX_sizecache        int32                       `json:\"-\"`\n}\n\nfunc (m *MsgWithIndirectRequired) Reset()         { *m = MsgWithIndirectRequired{} }\nfunc (m *MsgWithIndirectRequired) String() string { return proto.CompactTextString(m) }\nfunc (*MsgWithIndirectRequired) ProtoMessage()    {}\nfunc (*MsgWithIndirectRequired) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{10}\n}\n\nfunc (m *MsgWithIndirectRequired) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_MsgWithIndirectRequired.Unmarshal(m, b)\n}\nfunc (m *MsgWithIndirectRequired) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_MsgWithIndirectRequired.Marshal(b, m, deterministic)\n}\nfunc (m *MsgWithIndirectRequired) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_MsgWithIndirectRequired.Merge(m, src)\n}\nfunc (m *MsgWithIndirectRequired) XXX_Size() int {\n\treturn xxx_messageInfo_MsgWithIndirectRequired.Size(m)\n}\nfunc (m *MsgWithIndirectRequired) XXX_DiscardUnknown() {\n\txxx_messageInfo_MsgWithIndirectRequired.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_MsgWithIndirectRequired proto.InternalMessageInfo\n\nfunc (m *MsgWithIndirectRequired) GetSubm() *MsgWithRequired {\n\tif m != nil {\n\t\treturn m.Subm\n\t}\n\treturn nil\n}\n\nfunc (m *MsgWithIndirectRequired) GetMapField() map[string]*MsgWithRequired {\n\tif m != nil {\n\t\treturn m.MapField\n\t}\n\treturn nil\n}\n\nfunc (m *MsgWithIndirectRequired) GetSliceField() []*MsgWithRequired {\n\tif m != nil {\n\t\treturn m.SliceField\n\t}\n\treturn nil\n}\n\ntype MsgWithRequiredBytes struct {\n\tByts                 []byte   `protobuf:\"bytes,1,req,name=byts\" json:\"byts,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *MsgWithRequiredBytes) Reset()         { *m = MsgWithRequiredBytes{} }\nfunc (m *MsgWithRequiredBytes) String() string { return proto.CompactTextString(m) }\nfunc (*MsgWithRequiredBytes) ProtoMessage()    {}\nfunc (*MsgWithRequiredBytes) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{11}\n}\n\nfunc (m *MsgWithRequiredBytes) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_MsgWithRequiredBytes.Unmarshal(m, b)\n}\nfunc (m *MsgWithRequiredBytes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_MsgWithRequiredBytes.Marshal(b, m, deterministic)\n}\nfunc (m *MsgWithRequiredBytes) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_MsgWithRequiredBytes.Merge(m, src)\n}\nfunc (m *MsgWithRequiredBytes) XXX_Size() int {\n\treturn xxx_messageInfo_MsgWithRequiredBytes.Size(m)\n}\nfunc (m *MsgWithRequiredBytes) XXX_DiscardUnknown() {\n\txxx_messageInfo_MsgWithRequiredBytes.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_MsgWithRequiredBytes proto.InternalMessageInfo\n\nfunc (m *MsgWithRequiredBytes) GetByts() []byte {\n\tif m != nil {\n\t\treturn m.Byts\n\t}\n\treturn nil\n}\n\ntype MsgWithRequiredWKT struct {\n\tStr                  *wrapperspb.StringValue `protobuf:\"bytes,1,req,name=str\" json:\"str,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}                `json:\"-\"`\n\tXXX_unrecognized     []byte                  `json:\"-\"`\n\tXXX_sizecache        int32                   `json:\"-\"`\n}\n\nfunc (m *MsgWithRequiredWKT) Reset()         { *m = MsgWithRequiredWKT{} }\nfunc (m *MsgWithRequiredWKT) String() string { return proto.CompactTextString(m) }\nfunc (*MsgWithRequiredWKT) ProtoMessage()    {}\nfunc (*MsgWithRequiredWKT) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_50cab1d8463dea41, []int{12}\n}\n\nfunc (m *MsgWithRequiredWKT) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_MsgWithRequiredWKT.Unmarshal(m, b)\n}\nfunc (m *MsgWithRequiredWKT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_MsgWithRequiredWKT.Marshal(b, m, deterministic)\n}\nfunc (m *MsgWithRequiredWKT) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_MsgWithRequiredWKT.Merge(m, src)\n}\nfunc (m *MsgWithRequiredWKT) XXX_Size() int {\n\treturn xxx_messageInfo_MsgWithRequiredWKT.Size(m)\n}\nfunc (m *MsgWithRequiredWKT) XXX_DiscardUnknown() {\n\txxx_messageInfo_MsgWithRequiredWKT.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_MsgWithRequiredWKT proto.InternalMessageInfo\n\nfunc (m *MsgWithRequiredWKT) GetStr() *wrapperspb.StringValue {\n\tif m != nil {\n\t\treturn m.Str\n\t}\n\treturn nil\n}\n\nvar E_Name = &proto.ExtensionDesc{\n\tExtendedType:  (*Real)(nil),\n\tExtensionType: (*string)(nil),\n\tField:         124,\n\tName:          \"jsonpb_test.name\",\n\tTag:           \"bytes,124,opt,name=name\",\n\tFilename:      \"jsonpb_proto/test2.proto\",\n}\n\nvar E_Extm = &proto.ExtensionDesc{\n\tExtendedType:  (*Real)(nil),\n\tExtensionType: (*MsgWithRequired)(nil),\n\tField:         125,\n\tName:          \"jsonpb_test.extm\",\n\tTag:           \"bytes,125,opt,name=extm\",\n\tFilename:      \"jsonpb_proto/test2.proto\",\n}\n\nfunc init() {\n\tproto.RegisterEnum(\"jsonpb_test.Widget_Color\", Widget_Color_name, Widget_Color_value)\n\tproto.RegisterType((*Simple)(nil), \"jsonpb_test.Simple\")\n\tproto.RegisterType((*NonFinites)(nil), \"jsonpb_test.NonFinites\")\n\tproto.RegisterType((*Repeats)(nil), \"jsonpb_test.Repeats\")\n\tproto.RegisterType((*Widget)(nil), \"jsonpb_test.Widget\")\n\tproto.RegisterType((*Maps)(nil), \"jsonpb_test.Maps\")\n\tproto.RegisterMapType((map[bool]*Simple)(nil), \"jsonpb_test.Maps.MBoolSimpleEntry\")\n\tproto.RegisterMapType((map[int64]string)(nil), \"jsonpb_test.Maps.MInt64StrEntry\")\n\tproto.RegisterType((*MsgWithOneof)(nil), \"jsonpb_test.MsgWithOneof\")\n\tproto.RegisterType((*Real)(nil), \"jsonpb_test.Real\")\n\tproto.RegisterExtension(E_Complex_RealExtension)\n\tproto.RegisterType((*Complex)(nil), \"jsonpb_test.Complex\")\n\tproto.RegisterType((*KnownTypes)(nil), \"jsonpb_test.KnownTypes\")\n\tproto.RegisterType((*MsgWithRequired)(nil), \"jsonpb_test.MsgWithRequired\")\n\tproto.RegisterType((*MsgWithIndirectRequired)(nil), \"jsonpb_test.MsgWithIndirectRequired\")\n\tproto.RegisterMapType((map[string]*MsgWithRequired)(nil), \"jsonpb_test.MsgWithIndirectRequired.MapFieldEntry\")\n\tproto.RegisterType((*MsgWithRequiredBytes)(nil), \"jsonpb_test.MsgWithRequiredBytes\")\n\tproto.RegisterType((*MsgWithRequiredWKT)(nil), \"jsonpb_test.MsgWithRequiredWKT\")\n\tproto.RegisterExtension(E_Name)\n\tproto.RegisterExtension(E_Extm)\n}\n\nfunc init() { proto.RegisterFile(\"jsonpb_proto/test2.proto\", fileDescriptor_50cab1d8463dea41) }\n\nvar fileDescriptor_50cab1d8463dea41 = []byte{\n\t// 1537 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0xdd, 0x6e, 0xdb, 0xc8,\n\t0x15, 0x36, 0x49, 0x51, 0x12, 0x8f, 0xec, 0xc4, 0x99, 0x64, 0x37, 0xb4, 0x1b, 0x6c, 0x09, 0x6d,\n\t0xb7, 0x55, 0xb3, 0xa8, 0xdc, 0xa5, 0x05, 0xa1, 0xc8, 0x76, 0x81, 0xae, 0x13, 0xa7, 0xd9, 0xee,\n\t0xc6, 0x5b, 0x8c, 0x93, 0x06, 0xed, 0x8d, 0x40, 0x99, 0x94, 0xc2, 0x96, 0x9c, 0x51, 0x67, 0x86,\n\t0x4e, 0x84, 0xb6, 0x80, 0xfb, 0x0a, 0xed, 0x23, 0x14, 0xe8, 0x6d, 0xef, 0x7a, 0xd1, 0xe7, 0xe8,\n\t0x03, 0x2d, 0xe6, 0xcc, 0x50, 0x7f, 0x96, 0x8d, 0xbd, 0xb2, 0x66, 0xbe, 0x9f, 0x19, 0xce, 0xf9,\n\t0x78, 0x86, 0x86, 0xf0, 0x8f, 0x92, 0xb3, 0xd9, 0x78, 0x34, 0x13, 0x5c, 0xf1, 0x23, 0x95, 0x49,\n\t0x15, 0xf7, 0xf1, 0x37, 0xe9, 0x58, 0x44, 0xcf, 0x1d, 0x1e, 0x4c, 0x39, 0x9f, 0x16, 0xd9, 0x11,\n\t0x42, 0xe3, 0x6a, 0x72, 0x94, 0xb0, 0xb9, 0xe1, 0x1d, 0x7e, 0xb4, 0x09, 0xa5, 0x95, 0x48, 0x54,\n\t0xce, 0x99, 0xc5, 0x1f, 0x6d, 0xe2, 0x52, 0x89, 0xea, 0x42, 0x59, 0xf4, 0x87, 0x9b, 0xa8, 0xca,\n\t0xcb, 0x4c, 0xaa, 0xa4, 0x9c, 0xdd, 0x64, 0xff, 0x4e, 0x24, 0xb3, 0x59, 0x26, 0xa4, 0xc1, 0xbb,\n\t0xff, 0x69, 0x40, 0xf3, 0x3c, 0x2f, 0x67, 0x45, 0x46, 0x3e, 0x80, 0x26, 0x1f, 0x8d, 0x39, 0x2f,\n\t0x42, 0x27, 0x72, 0x7a, 0x6d, 0xea, 0xf3, 0x13, 0xce, 0x0b, 0xf2, 0x10, 0x5a, 0x7c, 0x94, 0x33,\n\t0x75, 0x1c, 0x87, 0x6e, 0xe4, 0xf4, 0x7c, 0xda, 0xe4, 0x5f, 0xe9, 0x11, 0xf9, 0x08, 0x3a, 0x16,\n\t0x18, 0x49, 0x25, 0x42, 0x0f, 0xc1, 0xc0, 0x80, 0xe7, 0x4a, 0x2c, 0x84, 0xc3, 0x41, 0xd8, 0x88,\n\t0x9c, 0x9e, 0x67, 0x84, 0xc3, 0xc1, 0x42, 0x38, 0x1c, 0xa0, 0xd0, 0x47, 0x30, 0x30, 0xa0, 0x16,\n\t0x1e, 0x40, 0x9b, 0x8f, 0x2a, 0xb3, 0x64, 0x33, 0x72, 0x7a, 0x7b, 0xb4, 0xc5, 0x5f, 0xe3, 0x90,\n\t0x44, 0xb0, 0x5b, 0x43, 0xa8, 0x6d, 0x21, 0x0c, 0x16, 0x5e, 0x13, 0x0f, 0x07, 0x61, 0x3b, 0x72,\n\t0x7a, 0x0d, 0x2b, 0x1e, 0x0e, 0x96, 0x62, 0xbb, 0x70, 0x80, 0x30, 0x58, 0x78, 0x21, 0x96, 0x66,\n\t0x65, 0x88, 0x9c, 0xde, 0x3d, 0xda, 0xe2, 0xe7, 0x2b, 0x2b, 0xcb, 0xe5, 0xca, 0x1d, 0x84, 0xc1,\n\t0xc2, 0x6b, 0xe2, 0xe1, 0x20, 0xdc, 0x8d, 0x9c, 0x1e, 0xb1, 0xe2, 0x7a, 0x65, 0xb9, 0x5c, 0x79,\n\t0x0f, 0x61, 0xb0, 0xf0, 0xe2, 0xb0, 0x26, 0x05, 0x4f, 0x54, 0x78, 0x27, 0x72, 0x7a, 0x2e, 0x6d,\n\t0xf2, 0xe7, 0x7a, 0x64, 0x0e, 0x0b, 0x01, 0x54, 0xde, 0x45, 0x30, 0x30, 0xe0, 0x62, 0xd5, 0x94,\n\t0x57, 0xe3, 0x22, 0x0b, 0xf7, 0x23, 0xa7, 0xe7, 0xd0, 0x16, 0x7f, 0x86, 0x43, 0xb3, 0xaa, 0x81,\n\t0x50, 0x7b, 0x0f, 0x61, 0xb0, 0xf0, 0x72, 0xcb, 0x4a, 0xe4, 0x6c, 0x1a, 0x92, 0xc8, 0xe9, 0x05,\n\t0x7a, 0xcb, 0x38, 0x34, 0x1b, 0x1a, 0xcf, 0x55, 0x26, 0xc3, 0xfb, 0x91, 0xd3, 0xdb, 0xa5, 0x4d,\n\t0x7e, 0xa2, 0x47, 0xdd, 0x7f, 0x38, 0x00, 0x67, 0x9c, 0x3d, 0xcf, 0x59, 0xae, 0x32, 0x49, 0xee,\n\t0x83, 0x3f, 0x19, 0xb1, 0x84, 0x61, 0x68, 0x5c, 0xda, 0x98, 0x9c, 0x25, 0x4c, 0x47, 0x69, 0x32,\n\t0x9a, 0xe5, 0x6c, 0x82, 0x91, 0x71, 0xa9, 0x3f, 0xf9, 0x6d, 0xce, 0x26, 0x66, 0x9a, 0xe9, 0x69,\n\t0xcf, 0x4e, 0x9f, 0xe9, 0xe9, 0xfb, 0xe0, 0xa7, 0x68, 0xd1, 0xc0, 0x0d, 0x36, 0x52, 0x6b, 0x91,\n\t0x1a, 0x0b, 0x1f, 0x67, 0xfd, 0xb4, 0xb6, 0x48, 0x8d, 0x45, 0xd3, 0x4e, 0x6b, 0x8b, 0xee, 0xbf,\n\t0x5d, 0x68, 0xd1, 0x6c, 0x96, 0x25, 0x4a, 0x6a, 0x8a, 0xa8, 0x73, 0xec, 0xe9, 0x1c, 0x8b, 0x3a,\n\t0xc7, 0x62, 0x91, 0x63, 0x4f, 0xe7, 0x58, 0x98, 0x1c, 0xd7, 0xc0, 0x70, 0x10, 0x7a, 0x91, 0xa7,\n\t0x73, 0x2a, 0x4c, 0x4e, 0x0f, 0xa0, 0x2d, 0xea, 0x1c, 0x36, 0x22, 0x4f, 0xe7, 0x50, 0xd8, 0x1c,\n\t0x2e, 0xa0, 0xe1, 0x20, 0xf4, 0x23, 0x4f, 0xa7, 0x4c, 0xd8, 0x94, 0x21, 0x24, 0xeb, 0xf4, 0x7a,\n\t0x3a, 0x43, 0xe2, 0x7c, 0x45, 0x65, 0x13, 0xd2, 0x8a, 0x3c, 0x9d, 0x10, 0x61, 0x13, 0x82, 0x9b,\n\t0x30, 0xf5, 0x6f, 0x47, 0x9e, 0xae, 0xbf, 0x30, 0xf5, 0x47, 0x8d, 0xad, 0x6f, 0x10, 0x79, 0xba,\n\t0xbe, 0xc2, 0xd6, 0xd7, 0xd8, 0x99, 0xea, 0x41, 0xe4, 0xe9, 0xea, 0x89, 0x65, 0xf5, 0x84, 0xad,\n\t0x5e, 0x27, 0xf2, 0x74, 0xf5, 0x84, 0xa9, 0xde, 0xff, 0x5d, 0x68, 0xbe, 0xc9, 0xd3, 0x69, 0xa6,\n\t0xc8, 0x11, 0xf8, 0x17, 0xbc, 0xe0, 0x02, 0x2b, 0x77, 0x27, 0x3e, 0xe8, 0xaf, 0x74, 0xac, 0xbe,\n\t0xe1, 0xf4, 0x9f, 0x6a, 0x02, 0x35, 0x3c, 0x12, 0x6b, 0x53, 0x23, 0xd1, 0x27, 0x78, 0xab, 0xa4,\n\t0x29, 0xf0, 0x2f, 0xf9, 0x14, 0x9a, 0x12, 0xdb, 0x0b, 0xbe, 0x4f, 0x9d, 0xf8, 0xfe, 0x9a, 0xc4,\n\t0x74, 0x1e, 0x6a, 0x29, 0xa4, 0x6f, 0xce, 0x07, 0xe9, 0x7a, 0xdb, 0x37, 0xd0, 0xf5, 0xa1, 0x59,\n\t0x7e, 0x4b, 0x98, 0xa2, 0x87, 0x0f, 0xd0, 0xfd, 0xc1, 0x1a, 0xdd, 0x06, 0x82, 0xd6, 0x24, 0xf2,\n\t0x19, 0x04, 0x62, 0x54, 0x2b, 0x3e, 0xc0, 0x05, 0xb6, 0x2b, 0xda, 0xc2, 0xfe, 0xea, 0x7e, 0x02,\n\t0xbe, 0x79, 0x90, 0x16, 0x78, 0xf4, 0xf4, 0xd9, 0xfe, 0x0e, 0x09, 0xc0, 0xff, 0x35, 0x3d, 0x3d,\n\t0x3d, 0xdb, 0x77, 0x48, 0x1b, 0x1a, 0x27, 0xdf, 0xbc, 0x3e, 0xdd, 0x77, 0xbb, 0xff, 0x72, 0xa1,\n\t0xf1, 0x32, 0x99, 0x49, 0xf2, 0x2b, 0xe8, 0x94, 0x2b, 0xbd, 0xcd, 0xc1, 0x45, 0xa2, 0xb5, 0x45,\n\t0x34, 0xaf, 0xff, 0xb2, 0xee, 0x76, 0xa7, 0x4c, 0x89, 0x39, 0x0d, 0xca, 0x45, 0xf7, 0x7b, 0x0e,\n\t0x7b, 0x25, 0xc6, 0xb7, 0x3e, 0x09, 0x17, 0x3d, 0xba, 0x5b, 0x3c, 0x74, 0xae, 0xcd, 0x51, 0x18,\n\t0x97, 0x4e, 0xb9, 0x9c, 0x39, 0xfc, 0x25, 0xdc, 0x59, 0x5f, 0x84, 0xec, 0x83, 0xf7, 0xa7, 0x6c,\n\t0x8e, 0xe5, 0xf6, 0xa8, 0xfe, 0x49, 0x1e, 0x80, 0x7f, 0x99, 0x14, 0x55, 0x86, 0xaf, 0x69, 0x40,\n\t0xcd, 0xe0, 0x89, 0xfb, 0x0b, 0xe7, 0xf0, 0x1c, 0xf6, 0x37, 0xed, 0x57, 0xf5, 0x6d, 0xa3, 0xff,\n\t0xe9, 0xaa, 0xfe, 0x86, 0x6a, 0x2d, 0x4d, 0xbb, 0xff, 0x74, 0x61, 0xf7, 0xa5, 0x9c, 0xbe, 0xc9,\n\t0xd5, 0xdb, 0x6f, 0x59, 0xc6, 0x27, 0xe4, 0x43, 0xf0, 0x55, 0xae, 0x8a, 0x0c, 0x3d, 0x83, 0x17,\n\t0x3b, 0xd4, 0x0c, 0x49, 0x08, 0x4d, 0x99, 0x14, 0x89, 0x98, 0xa3, 0xb1, 0xf7, 0x62, 0x87, 0xda,\n\t0x31, 0x39, 0x84, 0xd6, 0x53, 0x5e, 0xe9, 0xed, 0x60, 0x0f, 0xd1, 0x9a, 0x7a, 0x82, 0x7c, 0x0c,\n\t0xbb, 0x6f, 0x79, 0x99, 0x8d, 0x92, 0x34, 0x15, 0x99, 0x94, 0xd8, 0x4e, 0x34, 0xa1, 0xa3, 0x67,\n\t0xbf, 0x34, 0x93, 0xe4, 0x37, 0x70, 0xaf, 0x94, 0xd3, 0xd1, 0xbb, 0x5c, 0xbd, 0x1d, 0x89, 0xec,\n\t0xcf, 0x55, 0x2e, 0xb2, 0x14, 0x5b, 0x4c, 0x27, 0x7e, 0xb4, 0x7e, 0xc4, 0x66, 0xa3, 0xd4, 0x72,\n\t0x5e, 0xec, 0xd0, 0xbb, 0xe5, 0xfa, 0x14, 0xf9, 0x1c, 0x80, 0x55, 0x45, 0x31, 0x32, 0x67, 0xd0,\n\t0xc4, 0xd7, 0xe8, 0xb0, 0x6f, 0x6e, 0xdc, 0x7e, 0x7d, 0xe3, 0xf6, 0xcf, 0xaa, 0xa2, 0xf8, 0x9d,\n\t0x66, 0xbc, 0xd8, 0xa1, 0x01, 0xab, 0x07, 0x27, 0x2d, 0xf0, 0x2b, 0x96, 0x73, 0xd6, 0xfd, 0x31,\n\t0x34, 0x68, 0x96, 0x14, 0xcb, 0x62, 0x38, 0xa6, 0xb3, 0xe1, 0xe0, 0x71, 0xbb, 0x9d, 0xee, 0x5f,\n\t0x5d, 0x5d, 0x5d, 0xb9, 0xdd, 0xbf, 0x3b, 0xfa, 0xd9, 0xf5, 0x99, 0xbe, 0x27, 0x8f, 0x20, 0xc8,\n\t0xcb, 0x64, 0x9a, 0x33, 0x7d, 0x46, 0x86, 0xbf, 0x9c, 0x58, 0x6a, 0xe2, 0x33, 0xb8, 0x23, 0xb2,\n\t0xa4, 0x18, 0x65, 0xef, 0x55, 0xc6, 0x64, 0xce, 0x19, 0xb9, 0xb7, 0x11, 0xf8, 0xa4, 0x08, 0xff,\n\t0xb2, 0xe5, 0xdd, 0xb1, 0x0b, 0xd1, 0x3d, 0x2d, 0x3f, 0xad, 0xd5, 0xdd, 0xff, 0xf9, 0x00, 0x5f,\n\t0x33, 0xfe, 0x8e, 0xbd, 0x9a, 0xcf, 0x32, 0x49, 0x7e, 0x04, 0x6e, 0xc2, 0xf0, 0xc2, 0xd2, 0xfa,\n\t0xcd, 0x07, 0xff, 0x92, 0xcd, 0xa9, 0x9b, 0x30, 0xf2, 0x29, 0x78, 0x69, 0x65, 0xda, 0x4c, 0x27,\n\t0x3e, 0xb8, 0x46, 0x7b, 0x66, 0x3f, 0x78, 0xa8, 0x66, 0x91, 0x9f, 0x80, 0x2b, 0x15, 0xde, 0x9f,\n\t0x9d, 0xf8, 0xe1, 0x35, 0xee, 0x39, 0x7e, 0xfc, 0x50, 0x57, 0x2a, 0xf2, 0x18, 0x5c, 0x25, 0x6d,\n\t0xf0, 0xae, 0x1f, 0xfa, 0xab, 0xfa, 0x3b, 0x88, 0xba, 0x4a, 0x6a, 0x6e, 0x71, 0x89, 0x77, 0xe7,\n\t0x36, 0xee, 0x37, 0xb9, 0x54, 0x58, 0x13, 0xea, 0x16, 0x97, 0xa4, 0x07, 0xde, 0x65, 0x52, 0xe0,\n\t0x5d, 0xda, 0x89, 0x3f, 0xbc, 0x46, 0x36, 0x44, 0x4d, 0x21, 0x7d, 0xf0, 0xd2, 0x71, 0x81, 0x39,\n\t0xd4, 0xe1, 0xb9, 0xf6, 0x5c, 0xd8, 0xa5, 0x2d, 0x3f, 0x1d, 0x17, 0xe4, 0x67, 0xe0, 0x4d, 0x0a,\n\t0x85, 0xb1, 0xec, 0xc4, 0x3f, 0xb8, 0xc6, 0xc7, 0x7e, 0x6f, 0xe9, 0x93, 0x42, 0x69, 0x7a, 0x8e,\n\t0xd7, 0xcb, 0x76, 0x3a, 0xbe, 0xdb, 0x96, 0x9e, 0x0f, 0x07, 0x7a, 0x37, 0xd5, 0x70, 0x80, 0x29,\n\t0xdc, 0xb6, 0x9b, 0xd7, 0xab, 0xfc, 0x6a, 0x38, 0x40, 0xfb, 0xe3, 0x18, 0xbf, 0xa0, 0x6e, 0xb0,\n\t0x3f, 0x8e, 0x6b, 0xfb, 0xe3, 0x18, 0xed, 0x8f, 0x63, 0xfc, 0xa4, 0xba, 0xc9, 0x7e, 0xc1, 0xaf,\n\t0x90, 0xdf, 0xc0, 0x3b, 0x38, 0xb8, 0xe1, 0xd0, 0x75, 0x73, 0x31, 0x74, 0xe4, 0x69, 0x7f, 0xdd,\n\t0x30, 0xe1, 0x06, 0x7f, 0x73, 0xaf, 0x59, 0x7f, 0xa9, 0x04, 0xf9, 0x0c, 0xfc, 0xfa, 0x7e, 0xdb,\n\t0xfe, 0x00, 0x78, 0xdf, 0x19, 0x81, 0x61, 0x76, 0x3f, 0x86, 0xbb, 0x1b, 0x2f, 0xb5, 0x6e, 0x69,\n\t0xa6, 0x4d, 0xbb, 0xbd, 0x00, 0x7d, 0xbb, 0xff, 0x75, 0xe1, 0xa1, 0x65, 0x7d, 0xc5, 0xd2, 0x5c,\n\t0x64, 0x17, 0x6a, 0xc1, 0xfe, 0x39, 0x34, 0x64, 0x35, 0x2e, 0x6d, 0x92, 0x6f, 0x6d, 0x17, 0x14,\n\t0x99, 0xe4, 0x5b, 0x08, 0xca, 0x64, 0x36, 0x9a, 0xe4, 0x59, 0x91, 0xda, 0x46, 0x1e, 0x6f, 0x93,\n\t0x6d, 0x2e, 0xa5, 0x1b, 0xfc, 0x73, 0x2d, 0x32, 0x8d, 0xbd, 0x5d, 0xda, 0x21, 0xf9, 0x02, 0x3a,\n\t0xb2, 0xc8, 0x2f, 0x32, 0x6b, 0xe9, 0xa1, 0xe5, 0xed, 0x3b, 0x01, 0x14, 0xa0, 0xfc, 0xf0, 0xf7,\n\t0xb0, 0xb7, 0xe6, 0xbc, 0xda, 0xd3, 0x03, 0xd3, 0xd3, 0xe3, 0xf5, 0x9e, 0x7e, 0xbb, 0xf7, 0x4a,\n\t0x73, 0x7f, 0x0c, 0x0f, 0x36, 0x50, 0xac, 0x00, 0x21, 0xd0, 0x18, 0xcf, 0x95, 0xc4, 0x33, 0xde,\n\t0xa5, 0xf8, 0xbb, 0xfb, 0x0c, 0xc8, 0x06, 0xf7, 0xcd, 0xd7, 0xaf, 0xea, 0x08, 0x68, 0xe2, 0xf7,\n\t0x89, 0xc0, 0x93, 0x4f, 0xa0, 0xc1, 0x92, 0x32, 0xdb, 0xd6, 0xd2, 0xfe, 0x8a, 0xcf, 0x83, 0xf0,\n\t0x93, 0xa7, 0xd0, 0xc8, 0xde, 0xab, 0x72, 0x1b, 0xed, 0x6f, 0xdf, 0xa7, 0x90, 0x5a, 0x7c, 0xf2,\n\t0xc5, 0x1f, 0x3e, 0x9f, 0xe6, 0xea, 0x6d, 0x35, 0xee, 0x5f, 0xf0, 0xf2, 0x68, 0xca, 0x8b, 0x84,\n\t0x4d, 0x97, 0xff, 0x54, 0xe5, 0x4c, 0x65, 0x82, 0x25, 0x05, 0xfe, 0x07, 0x88, 0xb3, 0xf2, 0x68,\n\t0xf5, 0x3f, 0xc3, 0xef, 0x02, 0x00, 0x00, 0xff, 0xff, 0x5b, 0xac, 0xa6, 0xa5, 0x28, 0x0e, 0x00,\n\t0x00,\n}\n"
  },
  {
    "path": "internal/testprotos/jsonpb_proto/test2.proto",
    "content": "// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nsyntax = \"proto2\";\n\noption go_package = \"github.com/golang/protobuf/internal/testprotos/jsonpb_proto\";\n\nimport \"google/protobuf/any.proto\";\nimport \"google/protobuf/duration.proto\";\nimport \"google/protobuf/struct.proto\";\nimport \"google/protobuf/timestamp.proto\";\nimport \"google/protobuf/wrappers.proto\";\n\npackage jsonpb_test;\n\n// Test message for holding primitive types.\nmessage Simple {\n  optional bool o_bool = 1;\n  optional int32 o_int32 = 2;\n  optional int32 o_int32_str = 3;\n  optional int64 o_int64 = 4;\n  optional int64 o_int64_str = 5;\n  optional uint32 o_uint32 = 6;\n  optional uint32 o_uint32_str = 7;\n  optional uint64 o_uint64 = 8;\n  optional uint64 o_uint64_str = 9;\n  optional sint32 o_sint32 = 10;\n  optional sint32 o_sint32_str = 11;\n  optional sint64 o_sint64 = 12;\n  optional sint64 o_sint64_str = 13;\n  optional float o_float = 14;\n  optional float o_float_str = 15;\n  optional double o_double = 16;\n  optional double o_double_str = 17;\n  optional string o_string = 18;\n  optional bytes o_bytes = 19;\n}\n\n// Test message for holding special non-finites primitives.\nmessage NonFinites {\n    optional float f_nan = 1;\n    optional float f_pinf = 2;\n    optional float f_ninf = 3;\n    optional double d_nan = 4;\n    optional double d_pinf = 5;\n    optional double d_ninf = 6;\n}\n\n// Test message for holding repeated primitives.\nmessage Repeats {\n  repeated bool r_bool = 1;\n  repeated int32 r_int32 = 2;\n  repeated int64 r_int64 = 3;\n  repeated uint32 r_uint32 = 4;\n  repeated uint64 r_uint64 = 5;\n  repeated sint32 r_sint32 = 6;\n  repeated sint64 r_sint64 = 7;\n  repeated float r_float = 8;\n  repeated double r_double = 9;\n  repeated string r_string = 10;\n  repeated bytes r_bytes = 11;\n}\n\n// Test message for holding enums and nested messages.\nmessage Widget {\n  enum Color {\n    RED = 0;\n    GREEN = 1;\n    BLUE = 2;\n  };\n  optional Color color = 1;\n  repeated Color r_color = 2;\n\n  optional Simple simple = 10;\n  repeated Simple r_simple = 11;\n\n  optional Repeats repeats = 20;\n  repeated Repeats r_repeats = 21;\n}\n\nmessage Maps {\n  map<int64, string> m_int64_str = 1;\n  map<bool, Simple> m_bool_simple = 2;\n}\n\nmessage MsgWithOneof {\n  oneof union {\n    string title = 1;\n    int64 salary = 2;\n    string Country = 3;\n    string home_address = 4;\n    MsgWithRequired msg_with_required = 5;\n    google.protobuf.NullValue null_value = 6;\n  }\n}\n\nmessage Real {\n  optional double value = 1;\n  extensions 100 to max;\n}\n\nextend Real {\n  optional string name = 124;\n}\n\nmessage Complex {\n  extend Real {\n    optional Complex real_extension = 123;\n  }\n  optional double imaginary = 1;\n  extensions 100 to max;\n}\n\nmessage KnownTypes {\n  optional google.protobuf.Any an = 14;\n  optional google.protobuf.Duration dur = 1;\n  optional google.protobuf.Struct st = 12;\n  optional google.protobuf.Timestamp ts = 2;\n  optional google.protobuf.ListValue lv = 15;\n  optional google.protobuf.Value val = 16;\n\n  optional google.protobuf.DoubleValue dbl = 3;\n  optional google.protobuf.FloatValue flt = 4;\n  optional google.protobuf.Int64Value i64 = 5;\n  optional google.protobuf.UInt64Value u64 = 6;\n  optional google.protobuf.Int32Value i32 = 7;\n  optional google.protobuf.UInt32Value u32 = 8;\n  optional google.protobuf.BoolValue bool = 9;\n  optional google.protobuf.StringValue str = 10;\n  optional google.protobuf.BytesValue bytes = 11;\n}\n\n// Test messages for marshaling/unmarshaling required fields.\nmessage MsgWithRequired {\n  required string str = 1;\n}\n\nmessage MsgWithIndirectRequired {\n  optional MsgWithRequired subm = 1;\n  map<string, MsgWithRequired> map_field = 2;\n  repeated MsgWithRequired slice_field = 3;\n}\n\nmessage MsgWithRequiredBytes {\n  required bytes byts = 1;\n}\n\nmessage MsgWithRequiredWKT {\n  required google.protobuf.StringValue str = 1;\n}\n\nextend Real {\n  optional MsgWithRequired extm = 125;\n}\n"
  },
  {
    "path": "internal/testprotos/jsonpb_proto/test3.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: jsonpb_proto/test3.proto\n\npackage jsonpb_proto\n\nimport (\n\tfmt \"fmt\"\n\tproto \"github.com/golang/protobuf/proto\"\n\tmath \"math\"\n)\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package\n\ntype Numeral int32\n\nconst (\n\tNumeral_UNKNOWN Numeral = 0\n\tNumeral_ARABIC  Numeral = 1\n\tNumeral_ROMAN   Numeral = 2\n)\n\nvar Numeral_name = map[int32]string{\n\t0: \"UNKNOWN\",\n\t1: \"ARABIC\",\n\t2: \"ROMAN\",\n}\n\nvar Numeral_value = map[string]int32{\n\t\"UNKNOWN\": 0,\n\t\"ARABIC\":  1,\n\t\"ROMAN\":   2,\n}\n\nfunc (x Numeral) String() string {\n\treturn proto.EnumName(Numeral_name, int32(x))\n}\n\nfunc (Numeral) EnumDescriptor() ([]byte, []int) {\n\treturn fileDescriptor_813baf511b225405, []int{0}\n}\n\ntype Simple3 struct {\n\tDub                  float64  `protobuf:\"fixed64,1,opt,name=dub,proto3\" json:\"dub,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *Simple3) Reset()         { *m = Simple3{} }\nfunc (m *Simple3) String() string { return proto.CompactTextString(m) }\nfunc (*Simple3) ProtoMessage()    {}\nfunc (*Simple3) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_813baf511b225405, []int{0}\n}\n\nfunc (m *Simple3) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Simple3.Unmarshal(m, b)\n}\nfunc (m *Simple3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Simple3.Marshal(b, m, deterministic)\n}\nfunc (m *Simple3) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Simple3.Merge(m, src)\n}\nfunc (m *Simple3) XXX_Size() int {\n\treturn xxx_messageInfo_Simple3.Size(m)\n}\nfunc (m *Simple3) XXX_DiscardUnknown() {\n\txxx_messageInfo_Simple3.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Simple3 proto.InternalMessageInfo\n\nfunc (m *Simple3) GetDub() float64 {\n\tif m != nil {\n\t\treturn m.Dub\n\t}\n\treturn 0\n}\n\ntype SimpleSlice3 struct {\n\tSlices               []string `protobuf:\"bytes,1,rep,name=slices,proto3\" json:\"slices,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *SimpleSlice3) Reset()         { *m = SimpleSlice3{} }\nfunc (m *SimpleSlice3) String() string { return proto.CompactTextString(m) }\nfunc (*SimpleSlice3) ProtoMessage()    {}\nfunc (*SimpleSlice3) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_813baf511b225405, []int{1}\n}\n\nfunc (m *SimpleSlice3) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_SimpleSlice3.Unmarshal(m, b)\n}\nfunc (m *SimpleSlice3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_SimpleSlice3.Marshal(b, m, deterministic)\n}\nfunc (m *SimpleSlice3) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_SimpleSlice3.Merge(m, src)\n}\nfunc (m *SimpleSlice3) XXX_Size() int {\n\treturn xxx_messageInfo_SimpleSlice3.Size(m)\n}\nfunc (m *SimpleSlice3) XXX_DiscardUnknown() {\n\txxx_messageInfo_SimpleSlice3.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_SimpleSlice3 proto.InternalMessageInfo\n\nfunc (m *SimpleSlice3) GetSlices() []string {\n\tif m != nil {\n\t\treturn m.Slices\n\t}\n\treturn nil\n}\n\ntype SimpleMap3 struct {\n\tStringy              map[string]string `protobuf:\"bytes,1,rep,name=stringy,proto3\" json:\"stringy,omitempty\" protobuf_key:\"bytes,1,opt,name=key,proto3\" protobuf_val:\"bytes,2,opt,name=value,proto3\"`\n\tXXX_NoUnkeyedLiteral struct{}          `json:\"-\"`\n\tXXX_unrecognized     []byte            `json:\"-\"`\n\tXXX_sizecache        int32             `json:\"-\"`\n}\n\nfunc (m *SimpleMap3) Reset()         { *m = SimpleMap3{} }\nfunc (m *SimpleMap3) String() string { return proto.CompactTextString(m) }\nfunc (*SimpleMap3) ProtoMessage()    {}\nfunc (*SimpleMap3) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_813baf511b225405, []int{2}\n}\n\nfunc (m *SimpleMap3) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_SimpleMap3.Unmarshal(m, b)\n}\nfunc (m *SimpleMap3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_SimpleMap3.Marshal(b, m, deterministic)\n}\nfunc (m *SimpleMap3) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_SimpleMap3.Merge(m, src)\n}\nfunc (m *SimpleMap3) XXX_Size() int {\n\treturn xxx_messageInfo_SimpleMap3.Size(m)\n}\nfunc (m *SimpleMap3) XXX_DiscardUnknown() {\n\txxx_messageInfo_SimpleMap3.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_SimpleMap3 proto.InternalMessageInfo\n\nfunc (m *SimpleMap3) GetStringy() map[string]string {\n\tif m != nil {\n\t\treturn m.Stringy\n\t}\n\treturn nil\n}\n\ntype SimpleNull3 struct {\n\tSimple               *Simple3 `protobuf:\"bytes,1,opt,name=simple,proto3\" json:\"simple,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *SimpleNull3) Reset()         { *m = SimpleNull3{} }\nfunc (m *SimpleNull3) String() string { return proto.CompactTextString(m) }\nfunc (*SimpleNull3) ProtoMessage()    {}\nfunc (*SimpleNull3) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_813baf511b225405, []int{3}\n}\n\nfunc (m *SimpleNull3) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_SimpleNull3.Unmarshal(m, b)\n}\nfunc (m *SimpleNull3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_SimpleNull3.Marshal(b, m, deterministic)\n}\nfunc (m *SimpleNull3) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_SimpleNull3.Merge(m, src)\n}\nfunc (m *SimpleNull3) XXX_Size() int {\n\treturn xxx_messageInfo_SimpleNull3.Size(m)\n}\nfunc (m *SimpleNull3) XXX_DiscardUnknown() {\n\txxx_messageInfo_SimpleNull3.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_SimpleNull3 proto.InternalMessageInfo\n\nfunc (m *SimpleNull3) GetSimple() *Simple3 {\n\tif m != nil {\n\t\treturn m.Simple\n\t}\n\treturn nil\n}\n\ntype Mappy struct {\n\tNummy                map[int64]int32    `protobuf:\"bytes,1,rep,name=nummy,proto3\" json:\"nummy,omitempty\" protobuf_key:\"varint,1,opt,name=key,proto3\" protobuf_val:\"varint,2,opt,name=value,proto3\"`\n\tStrry                map[string]string  `protobuf:\"bytes,2,rep,name=strry,proto3\" json:\"strry,omitempty\" protobuf_key:\"bytes,1,opt,name=key,proto3\" protobuf_val:\"bytes,2,opt,name=value,proto3\"`\n\tObjjy                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\"`\n\tBuggy                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\"`\n\tBooly                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\"`\n\tEnumy                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\"`\n\tS32Booly             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\"`\n\tS64Booly             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\"`\n\tU32Booly             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\"`\n\tU64Booly             map[uint64]bool    `protobuf:\"bytes,10,rep,name=u64booly,proto3\" json:\"u64booly,omitempty\" protobuf_key:\"varint,1,opt,name=key,proto3\" protobuf_val:\"varint,2,opt,name=value,proto3\"`\n\tXXX_NoUnkeyedLiteral struct{}           `json:\"-\"`\n\tXXX_unrecognized     []byte             `json:\"-\"`\n\tXXX_sizecache        int32              `json:\"-\"`\n}\n\nfunc (m *Mappy) Reset()         { *m = Mappy{} }\nfunc (m *Mappy) String() string { return proto.CompactTextString(m) }\nfunc (*Mappy) ProtoMessage()    {}\nfunc (*Mappy) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_813baf511b225405, []int{4}\n}\n\nfunc (m *Mappy) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Mappy.Unmarshal(m, b)\n}\nfunc (m *Mappy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Mappy.Marshal(b, m, deterministic)\n}\nfunc (m *Mappy) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Mappy.Merge(m, src)\n}\nfunc (m *Mappy) XXX_Size() int {\n\treturn xxx_messageInfo_Mappy.Size(m)\n}\nfunc (m *Mappy) XXX_DiscardUnknown() {\n\txxx_messageInfo_Mappy.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Mappy proto.InternalMessageInfo\n\nfunc (m *Mappy) GetNummy() map[int64]int32 {\n\tif m != nil {\n\t\treturn m.Nummy\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetStrry() map[string]string {\n\tif m != nil {\n\t\treturn m.Strry\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetObjjy() map[int32]*Simple3 {\n\tif m != nil {\n\t\treturn m.Objjy\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetBuggy() map[int64]string {\n\tif m != nil {\n\t\treturn m.Buggy\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetBooly() map[bool]bool {\n\tif m != nil {\n\t\treturn m.Booly\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetEnumy() map[string]Numeral {\n\tif m != nil {\n\t\treturn m.Enumy\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetS32Booly() map[int32]bool {\n\tif m != nil {\n\t\treturn m.S32Booly\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetS64Booly() map[int64]bool {\n\tif m != nil {\n\t\treturn m.S64Booly\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetU32Booly() map[uint32]bool {\n\tif m != nil {\n\t\treturn m.U32Booly\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetU64Booly() map[uint64]bool {\n\tif m != nil {\n\t\treturn m.U64Booly\n\t}\n\treturn nil\n}\n\nfunc init() {\n\tproto.RegisterEnum(\"jsonpb_test.Numeral\", Numeral_name, Numeral_value)\n\tproto.RegisterType((*Simple3)(nil), \"jsonpb_test.Simple3\")\n\tproto.RegisterType((*SimpleSlice3)(nil), \"jsonpb_test.SimpleSlice3\")\n\tproto.RegisterType((*SimpleMap3)(nil), \"jsonpb_test.SimpleMap3\")\n\tproto.RegisterMapType((map[string]string)(nil), \"jsonpb_test.SimpleMap3.StringyEntry\")\n\tproto.RegisterType((*SimpleNull3)(nil), \"jsonpb_test.SimpleNull3\")\n\tproto.RegisterType((*Mappy)(nil), \"jsonpb_test.Mappy\")\n\tproto.RegisterMapType((map[bool]bool)(nil), \"jsonpb_test.Mappy.BoolyEntry\")\n\tproto.RegisterMapType((map[int64]string)(nil), \"jsonpb_test.Mappy.BuggyEntry\")\n\tproto.RegisterMapType((map[string]Numeral)(nil), \"jsonpb_test.Mappy.EnumyEntry\")\n\tproto.RegisterMapType((map[int64]int32)(nil), \"jsonpb_test.Mappy.NummyEntry\")\n\tproto.RegisterMapType((map[int32]*Simple3)(nil), \"jsonpb_test.Mappy.ObjjyEntry\")\n\tproto.RegisterMapType((map[int32]bool)(nil), \"jsonpb_test.Mappy.S32boolyEntry\")\n\tproto.RegisterMapType((map[int64]bool)(nil), \"jsonpb_test.Mappy.S64boolyEntry\")\n\tproto.RegisterMapType((map[string]string)(nil), \"jsonpb_test.Mappy.StrryEntry\")\n\tproto.RegisterMapType((map[uint32]bool)(nil), \"jsonpb_test.Mappy.U32boolyEntry\")\n\tproto.RegisterMapType((map[uint64]bool)(nil), \"jsonpb_test.Mappy.U64boolyEntry\")\n}\n\nfunc init() { proto.RegisterFile(\"jsonpb_proto/test3.proto\", fileDescriptor_813baf511b225405) }\n\nvar fileDescriptor_813baf511b225405 = []byte{\n\t// 563 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0xdd, 0x8a, 0xd3, 0x40,\n\t0x14, 0xc7, 0x4d, 0xbb, 0x69, 0x9b, 0xd3, 0x5d, 0x29, 0xc3, 0x22, 0xa1, 0x22, 0x94, 0x22, 0xb2,\n\t0x2c, 0x9a, 0x40, 0x23, 0xb2, 0x6c, 0x55, 0x68, 0x65, 0x2f, 0x44, 0x9a, 0x42, 0x4a, 0x11, 0xbc,\n\t0x91, 0x64, 0x8d, 0x31, 0x35, 0x5f, 0x24, 0x19, 0x21, 0x6f, 0xe0, 0x2b, 0xf9, 0x76, 0x32, 0x1f,\n\t0xd9, 0x4c, 0x4a, 0x86, 0xea, 0xd5, 0x9e, 0x99, 0xf3, 0xff, 0xe5, 0x7c, 0xec, 0xbf, 0x0c, 0xe8,\n\t0x87, 0x22, 0x4d, 0x32, 0xef, 0x6b, 0x96, 0xa7, 0x65, 0x6a, 0x96, 0x7e, 0x51, 0x5a, 0x06, 0x8d,\n\t0xd1, 0x98, 0x67, 0xc8, 0xdd, 0xfc, 0x29, 0x0c, 0x77, 0x61, 0x9c, 0x45, 0xbe, 0x85, 0x26, 0xd0,\n\t0xff, 0x86, 0x3d, 0x5d, 0x99, 0x29, 0x57, 0x8a, 0x43, 0xc2, 0xf9, 0x0b, 0x38, 0x67, 0xc9, 0x5d,\n\t0x14, 0xde, 0xfb, 0x16, 0x7a, 0x02, 0x83, 0x82, 0x44, 0x85, 0xae, 0xcc, 0xfa, 0x57, 0x9a, 0xc3,\n\t0x4f, 0xf3, 0xdf, 0x0a, 0x00, 0x13, 0x6e, 0xdc, 0xcc, 0x42, 0xef, 0x61, 0x58, 0x94, 0x79, 0x98,\n\t0x04, 0x15, 0xd5, 0x8d, 0x17, 0xcf, 0x0d, 0xa1, 0xa4, 0xd1, 0x28, 0x8d, 0x1d, 0x93, 0xdd, 0x25,\n\t0x65, 0x5e, 0x39, 0x35, 0x34, 0xbd, 0x85, 0x73, 0x31, 0x41, 0x1a, 0xfb, 0xe9, 0x57, 0xb4, 0x31,\n\t0xcd, 0x21, 0x21, 0xba, 0x04, 0xf5, 0x97, 0x1b, 0x61, 0x5f, 0xef, 0xd1, 0x3b, 0x76, 0xb8, 0xed,\n\t0xdd, 0x28, 0xf3, 0x25, 0x8c, 0xd9, 0xf7, 0x6d, 0x1c, 0x45, 0x16, 0x7a, 0x09, 0x83, 0x82, 0x1e,\n\t0x29, 0x3d, 0x5e, 0x5c, 0x76, 0x74, 0x62, 0x39, 0x5c, 0x33, 0xff, 0xa3, 0x81, 0xba, 0x71, 0xb3,\n\t0xac, 0x42, 0x16, 0xa8, 0x09, 0x8e, 0xe3, 0x7a, 0x80, 0x67, 0x2d, 0x8c, 0x4a, 0x0c, 0x9b, 0xe4,\n\t0x59, 0xe7, 0x4c, 0x4b, 0xa0, 0xa2, 0xcc, 0xf3, 0x4a, 0xef, 0x49, 0xa1, 0x1d, 0xc9, 0x73, 0x88,\n\t0x6a, 0x09, 0x94, 0x7a, 0x87, 0x43, 0xa5, 0xf7, 0xa5, 0xd0, 0x96, 0xe4, 0x39, 0x44, 0xb5, 0x04,\n\t0xf2, 0x70, 0x10, 0x54, 0xfa, 0x99, 0x14, 0x5a, 0x93, 0x3c, 0x87, 0xa8, 0x96, 0x42, 0x69, 0x1a,\n\t0x55, 0xba, 0x2a, 0x87, 0x48, 0xbe, 0x86, 0x48, 0x4c, 0x20, 0x3f, 0xc1, 0x71, 0xa5, 0x0f, 0xa4,\n\t0xd0, 0x1d, 0xc9, 0x73, 0x88, 0x6a, 0xd1, 0x5b, 0x18, 0x15, 0xd6, 0x82, 0x15, 0x1b, 0x52, 0x6e,\n\t0xd6, 0xb5, 0x0b, 0x2e, 0x61, 0xe8, 0x03, 0x41, 0xe9, 0x37, 0xaf, 0x19, 0x3d, 0x92, 0xd3, 0x5c,\n\t0x52, 0xd3, 0xfc, 0x48, 0x68, 0x5c, 0xd7, 0xd6, 0xa4, 0xf4, 0xbe, 0x5d, 0x1b, 0x0b, 0xb5, 0x71,\n\t0x5d, 0x1b, 0xe4, 0x74, 0xbb, 0x76, 0x4d, 0x4c, 0x6f, 0x00, 0x1a, 0x57, 0x88, 0xb6, 0xed, 0x77,\n\t0xd8, 0x56, 0x15, 0x6c, 0x4b, 0xc8, 0xc6, 0x1a, 0xff, 0x63, 0xf8, 0xa9, 0x0d, 0xd0, 0xf8, 0x43,\n\t0x24, 0x55, 0x46, 0x5e, 0x8b, 0xa4, 0xec, 0x07, 0xd0, 0xee, 0xa4, 0xb1, 0xce, 0xa9, 0x19, 0xb4,\n\t0x63, 0xf2, 0x61, 0x2b, 0x22, 0x39, 0xea, 0x20, 0x47, 0x47, 0x33, 0x34, 0x26, 0xea, 0x98, 0xbe,\n\t0x35, 0xc3, 0xe3, 0xa3, 0x19, 0x6c, 0x1c, 0xfb, 0xb9, 0x1b, 0x89, 0xdf, 0x5b, 0xc2, 0x45, 0xcb,\n\t0x5c, 0x1d, 0x6b, 0x91, 0x37, 0x43, 0x60, 0xf1, 0xff, 0x7b, 0x6a, 0x07, 0xc7, 0xf0, 0x5e, 0x56,\n\t0xf9, 0xe2, 0x5f, 0x60, 0x59, 0xe5, 0xb3, 0x13, 0xf0, 0xf5, 0x2b, 0x18, 0xf2, 0x4d, 0xa0, 0x31,\n\t0x0c, 0xf7, 0xf6, 0x27, 0x7b, 0xfb, 0xd9, 0x9e, 0x3c, 0x42, 0x00, 0x83, 0x95, 0xb3, 0x5a, 0x7f,\n\t0xfc, 0x30, 0x51, 0x90, 0x06, 0xaa, 0xb3, 0xdd, 0xac, 0xec, 0x49, 0x6f, 0xfd, 0xee, 0xcb, 0x32,\n\t0x08, 0xcb, 0x1f, 0xd8, 0x33, 0xee, 0xd3, 0xd8, 0x0c, 0xd2, 0xc8, 0x4d, 0x02, 0x93, 0xbe, 0x0f,\n\t0x1e, 0xfe, 0x6e, 0x86, 0x49, 0xe9, 0xe7, 0x89, 0x1b, 0xd1, 0x77, 0x83, 0xde, 0x16, 0xa6, 0xf8,\n\t0x9e, 0x78, 0x03, 0xfa, 0xc7, 0xfa, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x7c, 0xda, 0x44, 0x24, 0x66,\n\t0x06, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/testprotos/jsonpb_proto/test3.proto",
    "content": "// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nsyntax = \"proto3\";\n\noption go_package = \"github.com/golang/protobuf/internal/testprotos/jsonpb_proto\";\n\npackage jsonpb_test;\n\nmessage Simple3 {\n  double dub = 1;\n}\n\nmessage SimpleSlice3 {\n  repeated string slices = 1;\n}\n\nmessage SimpleMap3 {\n  map<string,string> stringy = 1;\n}\n\nmessage SimpleNull3 {\n  Simple3 simple = 1;\n}\n\nenum Numeral {\n  UNKNOWN = 0;\n  ARABIC = 1;\n  ROMAN = 2;\n}\n\nmessage Mappy {\n  map<int64, int32> nummy = 1;\n  map<string, string> strry = 2;\n  map<int32, Simple3> objjy = 3;\n  map<int64, string> buggy = 4;\n  map<bool, bool> booly = 5;\n  map<string, Numeral> enumy = 6;\n  map<int32, bool> s32booly = 7;\n  map<int64, bool> s64booly = 8;\n  map<uint32, bool> u32booly = 9;\n  map<uint64, bool> u64booly = 10;\n}\n"
  },
  {
    "path": "internal/testprotos/proto2_proto/test.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: proto2_proto/test.proto\n\npackage proto2_proto\n\nimport (\n\tfmt \"fmt\"\n\tproto \"github.com/golang/protobuf/proto\"\n\tmath \"math\"\n)\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package\n\ntype FOO int32\n\nconst (\n\tFOO_FOO1 FOO = 1\n)\n\nvar FOO_name = map[int32]string{\n\t1: \"FOO1\",\n}\n\nvar FOO_value = map[string]int32{\n\t\"FOO1\": 1,\n}\n\nfunc (x FOO) Enum() *FOO {\n\tp := new(FOO)\n\t*p = x\n\treturn p\n}\n\nfunc (x FOO) String() string {\n\treturn proto.EnumName(FOO_name, int32(x))\n}\n\nfunc (x *FOO) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(FOO_value, data, \"FOO\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FOO(value)\n\treturn nil\n}\n\nfunc (FOO) EnumDescriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{0}\n}\n\n// An enum, for completeness.\ntype GoTest_KIND int32\n\nconst (\n\tGoTest_VOID GoTest_KIND = 0\n\t// Basic types\n\tGoTest_BOOL        GoTest_KIND = 1\n\tGoTest_BYTES       GoTest_KIND = 2\n\tGoTest_FINGERPRINT GoTest_KIND = 3\n\tGoTest_FLOAT       GoTest_KIND = 4\n\tGoTest_INT         GoTest_KIND = 5\n\tGoTest_STRING      GoTest_KIND = 6\n\tGoTest_TIME        GoTest_KIND = 7\n\t// Groupings\n\tGoTest_TUPLE GoTest_KIND = 8\n\tGoTest_ARRAY GoTest_KIND = 9\n\tGoTest_MAP   GoTest_KIND = 10\n\t// Table types\n\tGoTest_TABLE GoTest_KIND = 11\n\t// Functions\n\tGoTest_FUNCTION GoTest_KIND = 12\n)\n\nvar GoTest_KIND_name = map[int32]string{\n\t0:  \"VOID\",\n\t1:  \"BOOL\",\n\t2:  \"BYTES\",\n\t3:  \"FINGERPRINT\",\n\t4:  \"FLOAT\",\n\t5:  \"INT\",\n\t6:  \"STRING\",\n\t7:  \"TIME\",\n\t8:  \"TUPLE\",\n\t9:  \"ARRAY\",\n\t10: \"MAP\",\n\t11: \"TABLE\",\n\t12: \"FUNCTION\",\n}\n\nvar GoTest_KIND_value = map[string]int32{\n\t\"VOID\":        0,\n\t\"BOOL\":        1,\n\t\"BYTES\":       2,\n\t\"FINGERPRINT\": 3,\n\t\"FLOAT\":       4,\n\t\"INT\":         5,\n\t\"STRING\":      6,\n\t\"TIME\":        7,\n\t\"TUPLE\":       8,\n\t\"ARRAY\":       9,\n\t\"MAP\":         10,\n\t\"TABLE\":       11,\n\t\"FUNCTION\":    12,\n}\n\nfunc (x GoTest_KIND) Enum() *GoTest_KIND {\n\tp := new(GoTest_KIND)\n\t*p = x\n\treturn p\n}\n\nfunc (x GoTest_KIND) String() string {\n\treturn proto.EnumName(GoTest_KIND_name, int32(x))\n}\n\nfunc (x *GoTest_KIND) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(GoTest_KIND_value, data, \"GoTest_KIND\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = GoTest_KIND(value)\n\treturn nil\n}\n\nfunc (GoTest_KIND) EnumDescriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{2, 0}\n}\n\ntype MyMessage_Color int32\n\nconst (\n\tMyMessage_RED   MyMessage_Color = 0\n\tMyMessage_GREEN MyMessage_Color = 1\n\tMyMessage_BLUE  MyMessage_Color = 2\n)\n\nvar MyMessage_Color_name = map[int32]string{\n\t0: \"RED\",\n\t1: \"GREEN\",\n\t2: \"BLUE\",\n}\n\nvar MyMessage_Color_value = map[string]int32{\n\t\"RED\":   0,\n\t\"GREEN\": 1,\n\t\"BLUE\":  2,\n}\n\nfunc (x MyMessage_Color) Enum() *MyMessage_Color {\n\tp := new(MyMessage_Color)\n\t*p = x\n\treturn p\n}\n\nfunc (x MyMessage_Color) String() string {\n\treturn proto.EnumName(MyMessage_Color_name, int32(x))\n}\n\nfunc (x *MyMessage_Color) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(MyMessage_Color_value, data, \"MyMessage_Color\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = MyMessage_Color(value)\n\treturn nil\n}\n\nfunc (MyMessage_Color) EnumDescriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{13, 0}\n}\n\ntype DefaultsMessage_DefaultsEnum int32\n\nconst (\n\tDefaultsMessage_ZERO DefaultsMessage_DefaultsEnum = 0\n\tDefaultsMessage_ONE  DefaultsMessage_DefaultsEnum = 1\n\tDefaultsMessage_TWO  DefaultsMessage_DefaultsEnum = 2\n)\n\nvar DefaultsMessage_DefaultsEnum_name = map[int32]string{\n\t0: \"ZERO\",\n\t1: \"ONE\",\n\t2: \"TWO\",\n}\n\nvar DefaultsMessage_DefaultsEnum_value = map[string]int32{\n\t\"ZERO\": 0,\n\t\"ONE\":  1,\n\t\"TWO\":  2,\n}\n\nfunc (x DefaultsMessage_DefaultsEnum) Enum() *DefaultsMessage_DefaultsEnum {\n\tp := new(DefaultsMessage_DefaultsEnum)\n\t*p = x\n\treturn p\n}\n\nfunc (x DefaultsMessage_DefaultsEnum) String() string {\n\treturn proto.EnumName(DefaultsMessage_DefaultsEnum_name, int32(x))\n}\n\nfunc (x *DefaultsMessage_DefaultsEnum) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(DefaultsMessage_DefaultsEnum_value, data, \"DefaultsMessage_DefaultsEnum\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = DefaultsMessage_DefaultsEnum(value)\n\treturn nil\n}\n\nfunc (DefaultsMessage_DefaultsEnum) EnumDescriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{16, 0}\n}\n\ntype Defaults_Color int32\n\nconst (\n\tDefaults_RED   Defaults_Color = 0\n\tDefaults_GREEN Defaults_Color = 1\n\tDefaults_BLUE  Defaults_Color = 2\n)\n\nvar Defaults_Color_name = map[int32]string{\n\t0: \"RED\",\n\t1: \"GREEN\",\n\t2: \"BLUE\",\n}\n\nvar Defaults_Color_value = map[string]int32{\n\t\"RED\":   0,\n\t\"GREEN\": 1,\n\t\"BLUE\":  2,\n}\n\nfunc (x Defaults_Color) Enum() *Defaults_Color {\n\tp := new(Defaults_Color)\n\t*p = x\n\treturn p\n}\n\nfunc (x Defaults_Color) String() string {\n\treturn proto.EnumName(Defaults_Color_name, int32(x))\n}\n\nfunc (x *Defaults_Color) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(Defaults_Color_value, data, \"Defaults_Color\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Defaults_Color(value)\n\treturn nil\n}\n\nfunc (Defaults_Color) EnumDescriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{20, 0}\n}\n\ntype RepeatedEnum_Color int32\n\nconst (\n\tRepeatedEnum_RED RepeatedEnum_Color = 1\n)\n\nvar RepeatedEnum_Color_name = map[int32]string{\n\t1: \"RED\",\n}\n\nvar RepeatedEnum_Color_value = map[string]int32{\n\t\"RED\": 1,\n}\n\nfunc (x RepeatedEnum_Color) Enum() *RepeatedEnum_Color {\n\tp := new(RepeatedEnum_Color)\n\t*p = x\n\treturn p\n}\n\nfunc (x RepeatedEnum_Color) String() string {\n\treturn proto.EnumName(RepeatedEnum_Color_name, int32(x))\n}\n\nfunc (x *RepeatedEnum_Color) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(RepeatedEnum_Color_value, data, \"RepeatedEnum_Color\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = RepeatedEnum_Color(value)\n\treturn nil\n}\n\nfunc (RepeatedEnum_Color) EnumDescriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{22, 0}\n}\n\ntype GoEnum struct {\n\tFoo                  *FOO     `protobuf:\"varint,1,req,name=foo,enum=proto2_test.FOO\" json:\"foo,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *GoEnum) Reset()         { *m = GoEnum{} }\nfunc (m *GoEnum) String() string { return proto.CompactTextString(m) }\nfunc (*GoEnum) ProtoMessage()    {}\nfunc (*GoEnum) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{0}\n}\n\nfunc (m *GoEnum) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GoEnum.Unmarshal(m, b)\n}\nfunc (m *GoEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GoEnum.Marshal(b, m, deterministic)\n}\nfunc (m *GoEnum) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GoEnum.Merge(m, src)\n}\nfunc (m *GoEnum) XXX_Size() int {\n\treturn xxx_messageInfo_GoEnum.Size(m)\n}\nfunc (m *GoEnum) XXX_DiscardUnknown() {\n\txxx_messageInfo_GoEnum.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GoEnum proto.InternalMessageInfo\n\nfunc (m *GoEnum) GetFoo() FOO {\n\tif m != nil && m.Foo != nil {\n\t\treturn *m.Foo\n\t}\n\treturn FOO_FOO1\n}\n\ntype GoTestField struct {\n\tLabel                *string  `protobuf:\"bytes,1,req,name=Label\" json:\"Label,omitempty\"`\n\tType                 *string  `protobuf:\"bytes,2,req,name=Type\" json:\"Type,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *GoTestField) Reset()         { *m = GoTestField{} }\nfunc (m *GoTestField) String() string { return proto.CompactTextString(m) }\nfunc (*GoTestField) ProtoMessage()    {}\nfunc (*GoTestField) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{1}\n}\n\nfunc (m *GoTestField) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GoTestField.Unmarshal(m, b)\n}\nfunc (m *GoTestField) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GoTestField.Marshal(b, m, deterministic)\n}\nfunc (m *GoTestField) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GoTestField.Merge(m, src)\n}\nfunc (m *GoTestField) XXX_Size() int {\n\treturn xxx_messageInfo_GoTestField.Size(m)\n}\nfunc (m *GoTestField) XXX_DiscardUnknown() {\n\txxx_messageInfo_GoTestField.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GoTestField proto.InternalMessageInfo\n\nfunc (m *GoTestField) GetLabel() string {\n\tif m != nil && m.Label != nil {\n\t\treturn *m.Label\n\t}\n\treturn \"\"\n}\n\nfunc (m *GoTestField) GetType() string {\n\tif m != nil && m.Type != nil {\n\t\treturn *m.Type\n\t}\n\treturn \"\"\n}\n\ntype GoTest struct {\n\t// Some typical parameters\n\tKind  *GoTest_KIND `protobuf:\"varint,1,req,name=Kind,enum=proto2_test.GoTest_KIND\" json:\"Kind,omitempty\"`\n\tTable *string      `protobuf:\"bytes,2,opt,name=Table\" json:\"Table,omitempty\"`\n\tParam *int32       `protobuf:\"varint,3,opt,name=Param\" json:\"Param,omitempty\"`\n\t// Required, repeated and optional foreign fields.\n\tRequiredField *GoTestField   `protobuf:\"bytes,4,req,name=RequiredField\" json:\"RequiredField,omitempty\"`\n\tRepeatedField []*GoTestField `protobuf:\"bytes,5,rep,name=RepeatedField\" json:\"RepeatedField,omitempty\"`\n\tOptionalField *GoTestField   `protobuf:\"bytes,6,opt,name=OptionalField\" json:\"OptionalField,omitempty\"`\n\t// Required fields of all basic types\n\tF_BoolRequired     *bool    `protobuf:\"varint,10,req,name=F_Bool_required,json=FBoolRequired\" json:\"F_Bool_required,omitempty\"`\n\tF_Int32Required    *int32   `protobuf:\"varint,11,req,name=F_Int32_required,json=FInt32Required\" json:\"F_Int32_required,omitempty\"`\n\tF_Int64Required    *int64   `protobuf:\"varint,12,req,name=F_Int64_required,json=FInt64Required\" json:\"F_Int64_required,omitempty\"`\n\tF_Fixed32Required  *uint32  `protobuf:\"fixed32,13,req,name=F_Fixed32_required,json=FFixed32Required\" json:\"F_Fixed32_required,omitempty\"`\n\tF_Fixed64Required  *uint64  `protobuf:\"fixed64,14,req,name=F_Fixed64_required,json=FFixed64Required\" json:\"F_Fixed64_required,omitempty\"`\n\tF_Uint32Required   *uint32  `protobuf:\"varint,15,req,name=F_Uint32_required,json=FUint32Required\" json:\"F_Uint32_required,omitempty\"`\n\tF_Uint64Required   *uint64  `protobuf:\"varint,16,req,name=F_Uint64_required,json=FUint64Required\" json:\"F_Uint64_required,omitempty\"`\n\tF_FloatRequired    *float32 `protobuf:\"fixed32,17,req,name=F_Float_required,json=FFloatRequired\" json:\"F_Float_required,omitempty\"`\n\tF_DoubleRequired   *float64 `protobuf:\"fixed64,18,req,name=F_Double_required,json=FDoubleRequired\" json:\"F_Double_required,omitempty\"`\n\tF_StringRequired   *string  `protobuf:\"bytes,19,req,name=F_String_required,json=FStringRequired\" json:\"F_String_required,omitempty\"`\n\tF_BytesRequired    []byte   `protobuf:\"bytes,101,req,name=F_Bytes_required,json=FBytesRequired\" json:\"F_Bytes_required,omitempty\"`\n\tF_Sint32Required   *int32   `protobuf:\"zigzag32,102,req,name=F_Sint32_required,json=FSint32Required\" json:\"F_Sint32_required,omitempty\"`\n\tF_Sint64Required   *int64   `protobuf:\"zigzag64,103,req,name=F_Sint64_required,json=FSint64Required\" json:\"F_Sint64_required,omitempty\"`\n\tF_Sfixed32Required *int32   `protobuf:\"fixed32,104,req,name=F_Sfixed32_required,json=FSfixed32Required\" json:\"F_Sfixed32_required,omitempty\"`\n\tF_Sfixed64Required *int64   `protobuf:\"fixed64,105,req,name=F_Sfixed64_required,json=FSfixed64Required\" json:\"F_Sfixed64_required,omitempty\"`\n\t// Repeated fields of all basic types\n\tF_BoolRepeated     []bool    `protobuf:\"varint,20,rep,name=F_Bool_repeated,json=FBoolRepeated\" json:\"F_Bool_repeated,omitempty\"`\n\tF_Int32Repeated    []int32   `protobuf:\"varint,21,rep,name=F_Int32_repeated,json=FInt32Repeated\" json:\"F_Int32_repeated,omitempty\"`\n\tF_Int64Repeated    []int64   `protobuf:\"varint,22,rep,name=F_Int64_repeated,json=FInt64Repeated\" json:\"F_Int64_repeated,omitempty\"`\n\tF_Fixed32Repeated  []uint32  `protobuf:\"fixed32,23,rep,name=F_Fixed32_repeated,json=FFixed32Repeated\" json:\"F_Fixed32_repeated,omitempty\"`\n\tF_Fixed64Repeated  []uint64  `protobuf:\"fixed64,24,rep,name=F_Fixed64_repeated,json=FFixed64Repeated\" json:\"F_Fixed64_repeated,omitempty\"`\n\tF_Uint32Repeated   []uint32  `protobuf:\"varint,25,rep,name=F_Uint32_repeated,json=FUint32Repeated\" json:\"F_Uint32_repeated,omitempty\"`\n\tF_Uint64Repeated   []uint64  `protobuf:\"varint,26,rep,name=F_Uint64_repeated,json=FUint64Repeated\" json:\"F_Uint64_repeated,omitempty\"`\n\tF_FloatRepeated    []float32 `protobuf:\"fixed32,27,rep,name=F_Float_repeated,json=FFloatRepeated\" json:\"F_Float_repeated,omitempty\"`\n\tF_DoubleRepeated   []float64 `protobuf:\"fixed64,28,rep,name=F_Double_repeated,json=FDoubleRepeated\" json:\"F_Double_repeated,omitempty\"`\n\tF_StringRepeated   []string  `protobuf:\"bytes,29,rep,name=F_String_repeated,json=FStringRepeated\" json:\"F_String_repeated,omitempty\"`\n\tF_BytesRepeated    [][]byte  `protobuf:\"bytes,201,rep,name=F_Bytes_repeated,json=FBytesRepeated\" json:\"F_Bytes_repeated,omitempty\"`\n\tF_Sint32Repeated   []int32   `protobuf:\"zigzag32,202,rep,name=F_Sint32_repeated,json=FSint32Repeated\" json:\"F_Sint32_repeated,omitempty\"`\n\tF_Sint64Repeated   []int64   `protobuf:\"zigzag64,203,rep,name=F_Sint64_repeated,json=FSint64Repeated\" json:\"F_Sint64_repeated,omitempty\"`\n\tF_Sfixed32Repeated []int32   `protobuf:\"fixed32,204,rep,name=F_Sfixed32_repeated,json=FSfixed32Repeated\" json:\"F_Sfixed32_repeated,omitempty\"`\n\tF_Sfixed64Repeated []int64   `protobuf:\"fixed64,205,rep,name=F_Sfixed64_repeated,json=FSfixed64Repeated\" json:\"F_Sfixed64_repeated,omitempty\"`\n\t// Optional fields of all basic types\n\tF_BoolOptional     *bool    `protobuf:\"varint,30,opt,name=F_Bool_optional,json=FBoolOptional\" json:\"F_Bool_optional,omitempty\"`\n\tF_Int32Optional    *int32   `protobuf:\"varint,31,opt,name=F_Int32_optional,json=FInt32Optional\" json:\"F_Int32_optional,omitempty\"`\n\tF_Int64Optional    *int64   `protobuf:\"varint,32,opt,name=F_Int64_optional,json=FInt64Optional\" json:\"F_Int64_optional,omitempty\"`\n\tF_Fixed32Optional  *uint32  `protobuf:\"fixed32,33,opt,name=F_Fixed32_optional,json=FFixed32Optional\" json:\"F_Fixed32_optional,omitempty\"`\n\tF_Fixed64Optional  *uint64  `protobuf:\"fixed64,34,opt,name=F_Fixed64_optional,json=FFixed64Optional\" json:\"F_Fixed64_optional,omitempty\"`\n\tF_Uint32Optional   *uint32  `protobuf:\"varint,35,opt,name=F_Uint32_optional,json=FUint32Optional\" json:\"F_Uint32_optional,omitempty\"`\n\tF_Uint64Optional   *uint64  `protobuf:\"varint,36,opt,name=F_Uint64_optional,json=FUint64Optional\" json:\"F_Uint64_optional,omitempty\"`\n\tF_FloatOptional    *float32 `protobuf:\"fixed32,37,opt,name=F_Float_optional,json=FFloatOptional\" json:\"F_Float_optional,omitempty\"`\n\tF_DoubleOptional   *float64 `protobuf:\"fixed64,38,opt,name=F_Double_optional,json=FDoubleOptional\" json:\"F_Double_optional,omitempty\"`\n\tF_StringOptional   *string  `protobuf:\"bytes,39,opt,name=F_String_optional,json=FStringOptional\" json:\"F_String_optional,omitempty\"`\n\tF_BytesOptional    []byte   `protobuf:\"bytes,301,opt,name=F_Bytes_optional,json=FBytesOptional\" json:\"F_Bytes_optional,omitempty\"`\n\tF_Sint32Optional   *int32   `protobuf:\"zigzag32,302,opt,name=F_Sint32_optional,json=FSint32Optional\" json:\"F_Sint32_optional,omitempty\"`\n\tF_Sint64Optional   *int64   `protobuf:\"zigzag64,303,opt,name=F_Sint64_optional,json=FSint64Optional\" json:\"F_Sint64_optional,omitempty\"`\n\tF_Sfixed32Optional *int32   `protobuf:\"fixed32,304,opt,name=F_Sfixed32_optional,json=FSfixed32Optional\" json:\"F_Sfixed32_optional,omitempty\"`\n\tF_Sfixed64Optional *int64   `protobuf:\"fixed64,305,opt,name=F_Sfixed64_optional,json=FSfixed64Optional\" json:\"F_Sfixed64_optional,omitempty\"`\n\t// Default-valued fields of all basic types\n\tF_BoolDefaulted     *bool    `protobuf:\"varint,40,opt,name=F_Bool_defaulted,json=FBoolDefaulted,def=1\" json:\"F_Bool_defaulted,omitempty\"`\n\tF_Int32Defaulted    *int32   `protobuf:\"varint,41,opt,name=F_Int32_defaulted,json=FInt32Defaulted,def=32\" json:\"F_Int32_defaulted,omitempty\"`\n\tF_Int64Defaulted    *int64   `protobuf:\"varint,42,opt,name=F_Int64_defaulted,json=FInt64Defaulted,def=64\" json:\"F_Int64_defaulted,omitempty\"`\n\tF_Fixed32Defaulted  *uint32  `protobuf:\"fixed32,43,opt,name=F_Fixed32_defaulted,json=FFixed32Defaulted,def=320\" json:\"F_Fixed32_defaulted,omitempty\"`\n\tF_Fixed64Defaulted  *uint64  `protobuf:\"fixed64,44,opt,name=F_Fixed64_defaulted,json=FFixed64Defaulted,def=640\" json:\"F_Fixed64_defaulted,omitempty\"`\n\tF_Uint32Defaulted   *uint32  `protobuf:\"varint,45,opt,name=F_Uint32_defaulted,json=FUint32Defaulted,def=3200\" json:\"F_Uint32_defaulted,omitempty\"`\n\tF_Uint64Defaulted   *uint64  `protobuf:\"varint,46,opt,name=F_Uint64_defaulted,json=FUint64Defaulted,def=6400\" json:\"F_Uint64_defaulted,omitempty\"`\n\tF_FloatDefaulted    *float32 `protobuf:\"fixed32,47,opt,name=F_Float_defaulted,json=FFloatDefaulted,def=314159\" json:\"F_Float_defaulted,omitempty\"`\n\tF_DoubleDefaulted   *float64 `protobuf:\"fixed64,48,opt,name=F_Double_defaulted,json=FDoubleDefaulted,def=271828\" json:\"F_Double_defaulted,omitempty\"`\n\tF_StringDefaulted   *string  `protobuf:\"bytes,49,opt,name=F_String_defaulted,json=FStringDefaulted,def=hello, \\\"world!\\\"\\n\" json:\"F_String_defaulted,omitempty\"`\n\tF_BytesDefaulted    []byte   `protobuf:\"bytes,401,opt,name=F_Bytes_defaulted,json=FBytesDefaulted,def=Bignose\" json:\"F_Bytes_defaulted,omitempty\"`\n\tF_Sint32Defaulted   *int32   `protobuf:\"zigzag32,402,opt,name=F_Sint32_defaulted,json=FSint32Defaulted,def=-32\" json:\"F_Sint32_defaulted,omitempty\"`\n\tF_Sint64Defaulted   *int64   `protobuf:\"zigzag64,403,opt,name=F_Sint64_defaulted,json=FSint64Defaulted,def=-64\" json:\"F_Sint64_defaulted,omitempty\"`\n\tF_Sfixed32Defaulted *int32   `protobuf:\"fixed32,404,opt,name=F_Sfixed32_defaulted,json=FSfixed32Defaulted,def=-32\" json:\"F_Sfixed32_defaulted,omitempty\"`\n\tF_Sfixed64Defaulted *int64   `protobuf:\"fixed64,405,opt,name=F_Sfixed64_defaulted,json=FSfixed64Defaulted,def=-64\" json:\"F_Sfixed64_defaulted,omitempty\"`\n\t// Packed repeated fields (no string or bytes).\n\tF_BoolRepeatedPacked     []bool                  `protobuf:\"varint,50,rep,packed,name=F_Bool_repeated_packed,json=FBoolRepeatedPacked\" json:\"F_Bool_repeated_packed,omitempty\"`\n\tF_Int32RepeatedPacked    []int32                 `protobuf:\"varint,51,rep,packed,name=F_Int32_repeated_packed,json=FInt32RepeatedPacked\" json:\"F_Int32_repeated_packed,omitempty\"`\n\tF_Int64RepeatedPacked    []int64                 `protobuf:\"varint,52,rep,packed,name=F_Int64_repeated_packed,json=FInt64RepeatedPacked\" json:\"F_Int64_repeated_packed,omitempty\"`\n\tF_Fixed32RepeatedPacked  []uint32                `protobuf:\"fixed32,53,rep,packed,name=F_Fixed32_repeated_packed,json=FFixed32RepeatedPacked\" json:\"F_Fixed32_repeated_packed,omitempty\"`\n\tF_Fixed64RepeatedPacked  []uint64                `protobuf:\"fixed64,54,rep,packed,name=F_Fixed64_repeated_packed,json=FFixed64RepeatedPacked\" json:\"F_Fixed64_repeated_packed,omitempty\"`\n\tF_Uint32RepeatedPacked   []uint32                `protobuf:\"varint,55,rep,packed,name=F_Uint32_repeated_packed,json=FUint32RepeatedPacked\" json:\"F_Uint32_repeated_packed,omitempty\"`\n\tF_Uint64RepeatedPacked   []uint64                `protobuf:\"varint,56,rep,packed,name=F_Uint64_repeated_packed,json=FUint64RepeatedPacked\" json:\"F_Uint64_repeated_packed,omitempty\"`\n\tF_FloatRepeatedPacked    []float32               `protobuf:\"fixed32,57,rep,packed,name=F_Float_repeated_packed,json=FFloatRepeatedPacked\" json:\"F_Float_repeated_packed,omitempty\"`\n\tF_DoubleRepeatedPacked   []float64               `protobuf:\"fixed64,58,rep,packed,name=F_Double_repeated_packed,json=FDoubleRepeatedPacked\" json:\"F_Double_repeated_packed,omitempty\"`\n\tF_Sint32RepeatedPacked   []int32                 `protobuf:\"zigzag32,502,rep,packed,name=F_Sint32_repeated_packed,json=FSint32RepeatedPacked\" json:\"F_Sint32_repeated_packed,omitempty\"`\n\tF_Sint64RepeatedPacked   []int64                 `protobuf:\"zigzag64,503,rep,packed,name=F_Sint64_repeated_packed,json=FSint64RepeatedPacked\" json:\"F_Sint64_repeated_packed,omitempty\"`\n\tF_Sfixed32RepeatedPacked []int32                 `protobuf:\"fixed32,504,rep,packed,name=F_Sfixed32_repeated_packed,json=FSfixed32RepeatedPacked\" json:\"F_Sfixed32_repeated_packed,omitempty\"`\n\tF_Sfixed64RepeatedPacked []int64                 `protobuf:\"fixed64,505,rep,packed,name=F_Sfixed64_repeated_packed,json=FSfixed64RepeatedPacked\" json:\"F_Sfixed64_repeated_packed,omitempty\"`\n\tRequiredgroup            *GoTest_RequiredGroup   `protobuf:\"group,70,req,name=RequiredGroup,json=requiredgroup\" json:\"requiredgroup,omitempty\"`\n\tRepeatedgroup            []*GoTest_RepeatedGroup `protobuf:\"group,80,rep,name=RepeatedGroup,json=repeatedgroup\" json:\"repeatedgroup,omitempty\"`\n\tOptionalgroup            *GoTest_OptionalGroup   `protobuf:\"group,90,opt,name=OptionalGroup,json=optionalgroup\" json:\"optionalgroup,omitempty\"`\n\tXXX_NoUnkeyedLiteral     struct{}                `json:\"-\"`\n\tXXX_unrecognized         []byte                  `json:\"-\"`\n\tXXX_sizecache            int32                   `json:\"-\"`\n}\n\nfunc (m *GoTest) Reset()         { *m = GoTest{} }\nfunc (m *GoTest) String() string { return proto.CompactTextString(m) }\nfunc (*GoTest) ProtoMessage()    {}\nfunc (*GoTest) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{2}\n}\n\nfunc (m *GoTest) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GoTest.Unmarshal(m, b)\n}\nfunc (m *GoTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GoTest.Marshal(b, m, deterministic)\n}\nfunc (m *GoTest) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GoTest.Merge(m, src)\n}\nfunc (m *GoTest) XXX_Size() int {\n\treturn xxx_messageInfo_GoTest.Size(m)\n}\nfunc (m *GoTest) XXX_DiscardUnknown() {\n\txxx_messageInfo_GoTest.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GoTest proto.InternalMessageInfo\n\nconst Default_GoTest_F_BoolDefaulted bool = true\nconst Default_GoTest_F_Int32Defaulted int32 = 32\nconst Default_GoTest_F_Int64Defaulted int64 = 64\nconst Default_GoTest_F_Fixed32Defaulted uint32 = 320\nconst Default_GoTest_F_Fixed64Defaulted uint64 = 640\nconst Default_GoTest_F_Uint32Defaulted uint32 = 3200\nconst Default_GoTest_F_Uint64Defaulted uint64 = 6400\nconst Default_GoTest_F_FloatDefaulted float32 = 314159\nconst Default_GoTest_F_DoubleDefaulted float64 = 271828\nconst Default_GoTest_F_StringDefaulted string = \"hello, \\\"world!\\\"\\n\"\n\nvar Default_GoTest_F_BytesDefaulted []byte = []byte(\"Bignose\")\n\nconst Default_GoTest_F_Sint32Defaulted int32 = -32\nconst Default_GoTest_F_Sint64Defaulted int64 = -64\nconst Default_GoTest_F_Sfixed32Defaulted int32 = -32\nconst Default_GoTest_F_Sfixed64Defaulted int64 = -64\n\nfunc (m *GoTest) GetKind() GoTest_KIND {\n\tif m != nil && m.Kind != nil {\n\t\treturn *m.Kind\n\t}\n\treturn GoTest_VOID\n}\n\nfunc (m *GoTest) GetTable() string {\n\tif m != nil && m.Table != nil {\n\t\treturn *m.Table\n\t}\n\treturn \"\"\n}\n\nfunc (m *GoTest) GetParam() int32 {\n\tif m != nil && m.Param != nil {\n\t\treturn *m.Param\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetRequiredField() *GoTestField {\n\tif m != nil {\n\t\treturn m.RequiredField\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetRepeatedField() []*GoTestField {\n\tif m != nil {\n\t\treturn m.RepeatedField\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetOptionalField() *GoTestField {\n\tif m != nil {\n\t\treturn m.OptionalField\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_BoolRequired() bool {\n\tif m != nil && m.F_BoolRequired != nil {\n\t\treturn *m.F_BoolRequired\n\t}\n\treturn false\n}\n\nfunc (m *GoTest) GetF_Int32Required() int32 {\n\tif m != nil && m.F_Int32Required != nil {\n\t\treturn *m.F_Int32Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Int64Required() int64 {\n\tif m != nil && m.F_Int64Required != nil {\n\t\treturn *m.F_Int64Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Fixed32Required() uint32 {\n\tif m != nil && m.F_Fixed32Required != nil {\n\t\treturn *m.F_Fixed32Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Fixed64Required() uint64 {\n\tif m != nil && m.F_Fixed64Required != nil {\n\t\treturn *m.F_Fixed64Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Uint32Required() uint32 {\n\tif m != nil && m.F_Uint32Required != nil {\n\t\treturn *m.F_Uint32Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Uint64Required() uint64 {\n\tif m != nil && m.F_Uint64Required != nil {\n\t\treturn *m.F_Uint64Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_FloatRequired() float32 {\n\tif m != nil && m.F_FloatRequired != nil {\n\t\treturn *m.F_FloatRequired\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_DoubleRequired() float64 {\n\tif m != nil && m.F_DoubleRequired != nil {\n\t\treturn *m.F_DoubleRequired\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_StringRequired() string {\n\tif m != nil && m.F_StringRequired != nil {\n\t\treturn *m.F_StringRequired\n\t}\n\treturn \"\"\n}\n\nfunc (m *GoTest) GetF_BytesRequired() []byte {\n\tif m != nil {\n\t\treturn m.F_BytesRequired\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sint32Required() int32 {\n\tif m != nil && m.F_Sint32Required != nil {\n\t\treturn *m.F_Sint32Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Sint64Required() int64 {\n\tif m != nil && m.F_Sint64Required != nil {\n\t\treturn *m.F_Sint64Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Sfixed32Required() int32 {\n\tif m != nil && m.F_Sfixed32Required != nil {\n\t\treturn *m.F_Sfixed32Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Sfixed64Required() int64 {\n\tif m != nil && m.F_Sfixed64Required != nil {\n\t\treturn *m.F_Sfixed64Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_BoolRepeated() []bool {\n\tif m != nil {\n\t\treturn m.F_BoolRepeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Int32Repeated() []int32 {\n\tif m != nil {\n\t\treturn m.F_Int32Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Int64Repeated() []int64 {\n\tif m != nil {\n\t\treturn m.F_Int64Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Fixed32Repeated() []uint32 {\n\tif m != nil {\n\t\treturn m.F_Fixed32Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Fixed64Repeated() []uint64 {\n\tif m != nil {\n\t\treturn m.F_Fixed64Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Uint32Repeated() []uint32 {\n\tif m != nil {\n\t\treturn m.F_Uint32Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Uint64Repeated() []uint64 {\n\tif m != nil {\n\t\treturn m.F_Uint64Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_FloatRepeated() []float32 {\n\tif m != nil {\n\t\treturn m.F_FloatRepeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_DoubleRepeated() []float64 {\n\tif m != nil {\n\t\treturn m.F_DoubleRepeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_StringRepeated() []string {\n\tif m != nil {\n\t\treturn m.F_StringRepeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_BytesRepeated() [][]byte {\n\tif m != nil {\n\t\treturn m.F_BytesRepeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sint32Repeated() []int32 {\n\tif m != nil {\n\t\treturn m.F_Sint32Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sint64Repeated() []int64 {\n\tif m != nil {\n\t\treturn m.F_Sint64Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sfixed32Repeated() []int32 {\n\tif m != nil {\n\t\treturn m.F_Sfixed32Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sfixed64Repeated() []int64 {\n\tif m != nil {\n\t\treturn m.F_Sfixed64Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_BoolOptional() bool {\n\tif m != nil && m.F_BoolOptional != nil {\n\t\treturn *m.F_BoolOptional\n\t}\n\treturn false\n}\n\nfunc (m *GoTest) GetF_Int32Optional() int32 {\n\tif m != nil && m.F_Int32Optional != nil {\n\t\treturn *m.F_Int32Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Int64Optional() int64 {\n\tif m != nil && m.F_Int64Optional != nil {\n\t\treturn *m.F_Int64Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Fixed32Optional() uint32 {\n\tif m != nil && m.F_Fixed32Optional != nil {\n\t\treturn *m.F_Fixed32Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Fixed64Optional() uint64 {\n\tif m != nil && m.F_Fixed64Optional != nil {\n\t\treturn *m.F_Fixed64Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Uint32Optional() uint32 {\n\tif m != nil && m.F_Uint32Optional != nil {\n\t\treturn *m.F_Uint32Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Uint64Optional() uint64 {\n\tif m != nil && m.F_Uint64Optional != nil {\n\t\treturn *m.F_Uint64Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_FloatOptional() float32 {\n\tif m != nil && m.F_FloatOptional != nil {\n\t\treturn *m.F_FloatOptional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_DoubleOptional() float64 {\n\tif m != nil && m.F_DoubleOptional != nil {\n\t\treturn *m.F_DoubleOptional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_StringOptional() string {\n\tif m != nil && m.F_StringOptional != nil {\n\t\treturn *m.F_StringOptional\n\t}\n\treturn \"\"\n}\n\nfunc (m *GoTest) GetF_BytesOptional() []byte {\n\tif m != nil {\n\t\treturn m.F_BytesOptional\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sint32Optional() int32 {\n\tif m != nil && m.F_Sint32Optional != nil {\n\t\treturn *m.F_Sint32Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Sint64Optional() int64 {\n\tif m != nil && m.F_Sint64Optional != nil {\n\t\treturn *m.F_Sint64Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Sfixed32Optional() int32 {\n\tif m != nil && m.F_Sfixed32Optional != nil {\n\t\treturn *m.F_Sfixed32Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Sfixed64Optional() int64 {\n\tif m != nil && m.F_Sfixed64Optional != nil {\n\t\treturn *m.F_Sfixed64Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_BoolDefaulted() bool {\n\tif m != nil && m.F_BoolDefaulted != nil {\n\t\treturn *m.F_BoolDefaulted\n\t}\n\treturn Default_GoTest_F_BoolDefaulted\n}\n\nfunc (m *GoTest) GetF_Int32Defaulted() int32 {\n\tif m != nil && m.F_Int32Defaulted != nil {\n\t\treturn *m.F_Int32Defaulted\n\t}\n\treturn Default_GoTest_F_Int32Defaulted\n}\n\nfunc (m *GoTest) GetF_Int64Defaulted() int64 {\n\tif m != nil && m.F_Int64Defaulted != nil {\n\t\treturn *m.F_Int64Defaulted\n\t}\n\treturn Default_GoTest_F_Int64Defaulted\n}\n\nfunc (m *GoTest) GetF_Fixed32Defaulted() uint32 {\n\tif m != nil && m.F_Fixed32Defaulted != nil {\n\t\treturn *m.F_Fixed32Defaulted\n\t}\n\treturn Default_GoTest_F_Fixed32Defaulted\n}\n\nfunc (m *GoTest) GetF_Fixed64Defaulted() uint64 {\n\tif m != nil && m.F_Fixed64Defaulted != nil {\n\t\treturn *m.F_Fixed64Defaulted\n\t}\n\treturn Default_GoTest_F_Fixed64Defaulted\n}\n\nfunc (m *GoTest) GetF_Uint32Defaulted() uint32 {\n\tif m != nil && m.F_Uint32Defaulted != nil {\n\t\treturn *m.F_Uint32Defaulted\n\t}\n\treturn Default_GoTest_F_Uint32Defaulted\n}\n\nfunc (m *GoTest) GetF_Uint64Defaulted() uint64 {\n\tif m != nil && m.F_Uint64Defaulted != nil {\n\t\treturn *m.F_Uint64Defaulted\n\t}\n\treturn Default_GoTest_F_Uint64Defaulted\n}\n\nfunc (m *GoTest) GetF_FloatDefaulted() float32 {\n\tif m != nil && m.F_FloatDefaulted != nil {\n\t\treturn *m.F_FloatDefaulted\n\t}\n\treturn Default_GoTest_F_FloatDefaulted\n}\n\nfunc (m *GoTest) GetF_DoubleDefaulted() float64 {\n\tif m != nil && m.F_DoubleDefaulted != nil {\n\t\treturn *m.F_DoubleDefaulted\n\t}\n\treturn Default_GoTest_F_DoubleDefaulted\n}\n\nfunc (m *GoTest) GetF_StringDefaulted() string {\n\tif m != nil && m.F_StringDefaulted != nil {\n\t\treturn *m.F_StringDefaulted\n\t}\n\treturn Default_GoTest_F_StringDefaulted\n}\n\nfunc (m *GoTest) GetF_BytesDefaulted() []byte {\n\tif m != nil && m.F_BytesDefaulted != nil {\n\t\treturn m.F_BytesDefaulted\n\t}\n\treturn append([]byte(nil), Default_GoTest_F_BytesDefaulted...)\n}\n\nfunc (m *GoTest) GetF_Sint32Defaulted() int32 {\n\tif m != nil && m.F_Sint32Defaulted != nil {\n\t\treturn *m.F_Sint32Defaulted\n\t}\n\treturn Default_GoTest_F_Sint32Defaulted\n}\n\nfunc (m *GoTest) GetF_Sint64Defaulted() int64 {\n\tif m != nil && m.F_Sint64Defaulted != nil {\n\t\treturn *m.F_Sint64Defaulted\n\t}\n\treturn Default_GoTest_F_Sint64Defaulted\n}\n\nfunc (m *GoTest) GetF_Sfixed32Defaulted() int32 {\n\tif m != nil && m.F_Sfixed32Defaulted != nil {\n\t\treturn *m.F_Sfixed32Defaulted\n\t}\n\treturn Default_GoTest_F_Sfixed32Defaulted\n}\n\nfunc (m *GoTest) GetF_Sfixed64Defaulted() int64 {\n\tif m != nil && m.F_Sfixed64Defaulted != nil {\n\t\treturn *m.F_Sfixed64Defaulted\n\t}\n\treturn Default_GoTest_F_Sfixed64Defaulted\n}\n\nfunc (m *GoTest) GetF_BoolRepeatedPacked() []bool {\n\tif m != nil {\n\t\treturn m.F_BoolRepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Int32RepeatedPacked() []int32 {\n\tif m != nil {\n\t\treturn m.F_Int32RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Int64RepeatedPacked() []int64 {\n\tif m != nil {\n\t\treturn m.F_Int64RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Fixed32RepeatedPacked() []uint32 {\n\tif m != nil {\n\t\treturn m.F_Fixed32RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Fixed64RepeatedPacked() []uint64 {\n\tif m != nil {\n\t\treturn m.F_Fixed64RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Uint32RepeatedPacked() []uint32 {\n\tif m != nil {\n\t\treturn m.F_Uint32RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Uint64RepeatedPacked() []uint64 {\n\tif m != nil {\n\t\treturn m.F_Uint64RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_FloatRepeatedPacked() []float32 {\n\tif m != nil {\n\t\treturn m.F_FloatRepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_DoubleRepeatedPacked() []float64 {\n\tif m != nil {\n\t\treturn m.F_DoubleRepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sint32RepeatedPacked() []int32 {\n\tif m != nil {\n\t\treturn m.F_Sint32RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sint64RepeatedPacked() []int64 {\n\tif m != nil {\n\t\treturn m.F_Sint64RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sfixed32RepeatedPacked() []int32 {\n\tif m != nil {\n\t\treturn m.F_Sfixed32RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sfixed64RepeatedPacked() []int64 {\n\tif m != nil {\n\t\treturn m.F_Sfixed64RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetRequiredgroup() *GoTest_RequiredGroup {\n\tif m != nil {\n\t\treturn m.Requiredgroup\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetRepeatedgroup() []*GoTest_RepeatedGroup {\n\tif m != nil {\n\t\treturn m.Repeatedgroup\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetOptionalgroup() *GoTest_OptionalGroup {\n\tif m != nil {\n\t\treturn m.Optionalgroup\n\t}\n\treturn nil\n}\n\n// Required, repeated, and optional groups.\ntype GoTest_RequiredGroup struct {\n\tRequiredField        *string  `protobuf:\"bytes,71,req,name=RequiredField\" json:\"RequiredField,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *GoTest_RequiredGroup) Reset()         { *m = GoTest_RequiredGroup{} }\nfunc (m *GoTest_RequiredGroup) String() string { return proto.CompactTextString(m) }\nfunc (*GoTest_RequiredGroup) ProtoMessage()    {}\nfunc (*GoTest_RequiredGroup) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{2, 0}\n}\n\nfunc (m *GoTest_RequiredGroup) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GoTest_RequiredGroup.Unmarshal(m, b)\n}\nfunc (m *GoTest_RequiredGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GoTest_RequiredGroup.Marshal(b, m, deterministic)\n}\nfunc (m *GoTest_RequiredGroup) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GoTest_RequiredGroup.Merge(m, src)\n}\nfunc (m *GoTest_RequiredGroup) XXX_Size() int {\n\treturn xxx_messageInfo_GoTest_RequiredGroup.Size(m)\n}\nfunc (m *GoTest_RequiredGroup) XXX_DiscardUnknown() {\n\txxx_messageInfo_GoTest_RequiredGroup.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GoTest_RequiredGroup proto.InternalMessageInfo\n\nfunc (m *GoTest_RequiredGroup) GetRequiredField() string {\n\tif m != nil && m.RequiredField != nil {\n\t\treturn *m.RequiredField\n\t}\n\treturn \"\"\n}\n\ntype GoTest_RepeatedGroup struct {\n\tRequiredField        *string  `protobuf:\"bytes,81,req,name=RequiredField\" json:\"RequiredField,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *GoTest_RepeatedGroup) Reset()         { *m = GoTest_RepeatedGroup{} }\nfunc (m *GoTest_RepeatedGroup) String() string { return proto.CompactTextString(m) }\nfunc (*GoTest_RepeatedGroup) ProtoMessage()    {}\nfunc (*GoTest_RepeatedGroup) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{2, 1}\n}\n\nfunc (m *GoTest_RepeatedGroup) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GoTest_RepeatedGroup.Unmarshal(m, b)\n}\nfunc (m *GoTest_RepeatedGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GoTest_RepeatedGroup.Marshal(b, m, deterministic)\n}\nfunc (m *GoTest_RepeatedGroup) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GoTest_RepeatedGroup.Merge(m, src)\n}\nfunc (m *GoTest_RepeatedGroup) XXX_Size() int {\n\treturn xxx_messageInfo_GoTest_RepeatedGroup.Size(m)\n}\nfunc (m *GoTest_RepeatedGroup) XXX_DiscardUnknown() {\n\txxx_messageInfo_GoTest_RepeatedGroup.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GoTest_RepeatedGroup proto.InternalMessageInfo\n\nfunc (m *GoTest_RepeatedGroup) GetRequiredField() string {\n\tif m != nil && m.RequiredField != nil {\n\t\treturn *m.RequiredField\n\t}\n\treturn \"\"\n}\n\ntype GoTest_OptionalGroup struct {\n\tRequiredField        *string  `protobuf:\"bytes,91,req,name=RequiredField\" json:\"RequiredField,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *GoTest_OptionalGroup) Reset()         { *m = GoTest_OptionalGroup{} }\nfunc (m *GoTest_OptionalGroup) String() string { return proto.CompactTextString(m) }\nfunc (*GoTest_OptionalGroup) ProtoMessage()    {}\nfunc (*GoTest_OptionalGroup) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{2, 2}\n}\n\nfunc (m *GoTest_OptionalGroup) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GoTest_OptionalGroup.Unmarshal(m, b)\n}\nfunc (m *GoTest_OptionalGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GoTest_OptionalGroup.Marshal(b, m, deterministic)\n}\nfunc (m *GoTest_OptionalGroup) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GoTest_OptionalGroup.Merge(m, src)\n}\nfunc (m *GoTest_OptionalGroup) XXX_Size() int {\n\treturn xxx_messageInfo_GoTest_OptionalGroup.Size(m)\n}\nfunc (m *GoTest_OptionalGroup) XXX_DiscardUnknown() {\n\txxx_messageInfo_GoTest_OptionalGroup.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GoTest_OptionalGroup proto.InternalMessageInfo\n\nfunc (m *GoTest_OptionalGroup) GetRequiredField() string {\n\tif m != nil && m.RequiredField != nil {\n\t\treturn *m.RequiredField\n\t}\n\treturn \"\"\n}\n\n// For testing a group containing a required field.\ntype GoTestRequiredGroupField struct {\n\tGroup                *GoTestRequiredGroupField_Group `protobuf:\"group,1,req,name=Group,json=group\" json:\"group,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}                        `json:\"-\"`\n\tXXX_unrecognized     []byte                          `json:\"-\"`\n\tXXX_sizecache        int32                           `json:\"-\"`\n}\n\nfunc (m *GoTestRequiredGroupField) Reset()         { *m = GoTestRequiredGroupField{} }\nfunc (m *GoTestRequiredGroupField) String() string { return proto.CompactTextString(m) }\nfunc (*GoTestRequiredGroupField) ProtoMessage()    {}\nfunc (*GoTestRequiredGroupField) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{3}\n}\n\nfunc (m *GoTestRequiredGroupField) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GoTestRequiredGroupField.Unmarshal(m, b)\n}\nfunc (m *GoTestRequiredGroupField) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GoTestRequiredGroupField.Marshal(b, m, deterministic)\n}\nfunc (m *GoTestRequiredGroupField) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GoTestRequiredGroupField.Merge(m, src)\n}\nfunc (m *GoTestRequiredGroupField) XXX_Size() int {\n\treturn xxx_messageInfo_GoTestRequiredGroupField.Size(m)\n}\nfunc (m *GoTestRequiredGroupField) XXX_DiscardUnknown() {\n\txxx_messageInfo_GoTestRequiredGroupField.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GoTestRequiredGroupField proto.InternalMessageInfo\n\nfunc (m *GoTestRequiredGroupField) GetGroup() *GoTestRequiredGroupField_Group {\n\tif m != nil {\n\t\treturn m.Group\n\t}\n\treturn nil\n}\n\ntype GoTestRequiredGroupField_Group struct {\n\tField                *int32   `protobuf:\"varint,2,req,name=Field\" json:\"Field,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *GoTestRequiredGroupField_Group) Reset()         { *m = GoTestRequiredGroupField_Group{} }\nfunc (m *GoTestRequiredGroupField_Group) String() string { return proto.CompactTextString(m) }\nfunc (*GoTestRequiredGroupField_Group) ProtoMessage()    {}\nfunc (*GoTestRequiredGroupField_Group) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{3, 0}\n}\n\nfunc (m *GoTestRequiredGroupField_Group) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GoTestRequiredGroupField_Group.Unmarshal(m, b)\n}\nfunc (m *GoTestRequiredGroupField_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GoTestRequiredGroupField_Group.Marshal(b, m, deterministic)\n}\nfunc (m *GoTestRequiredGroupField_Group) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GoTestRequiredGroupField_Group.Merge(m, src)\n}\nfunc (m *GoTestRequiredGroupField_Group) XXX_Size() int {\n\treturn xxx_messageInfo_GoTestRequiredGroupField_Group.Size(m)\n}\nfunc (m *GoTestRequiredGroupField_Group) XXX_DiscardUnknown() {\n\txxx_messageInfo_GoTestRequiredGroupField_Group.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GoTestRequiredGroupField_Group proto.InternalMessageInfo\n\nfunc (m *GoTestRequiredGroupField_Group) GetField() int32 {\n\tif m != nil && m.Field != nil {\n\t\treturn *m.Field\n\t}\n\treturn 0\n}\n\n// For testing skipping of unrecognized fields.\n// Numbers are all big, larger than tag numbers in GoTestField,\n// the message used in the corresponding test.\ntype GoSkipTest struct {\n\tSkipInt32            *int32                `protobuf:\"varint,11,req,name=skip_int32,json=skipInt32\" json:\"skip_int32,omitempty\"`\n\tSkipFixed32          *uint32               `protobuf:\"fixed32,12,req,name=skip_fixed32,json=skipFixed32\" json:\"skip_fixed32,omitempty\"`\n\tSkipFixed64          *uint64               `protobuf:\"fixed64,13,req,name=skip_fixed64,json=skipFixed64\" json:\"skip_fixed64,omitempty\"`\n\tSkipString           *string               `protobuf:\"bytes,14,req,name=skip_string,json=skipString\" json:\"skip_string,omitempty\"`\n\tSkipgroup            *GoSkipTest_SkipGroup `protobuf:\"group,15,req,name=SkipGroup,json=skipgroup\" json:\"skipgroup,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}              `json:\"-\"`\n\tXXX_unrecognized     []byte                `json:\"-\"`\n\tXXX_sizecache        int32                 `json:\"-\"`\n}\n\nfunc (m *GoSkipTest) Reset()         { *m = GoSkipTest{} }\nfunc (m *GoSkipTest) String() string { return proto.CompactTextString(m) }\nfunc (*GoSkipTest) ProtoMessage()    {}\nfunc (*GoSkipTest) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{4}\n}\n\nfunc (m *GoSkipTest) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GoSkipTest.Unmarshal(m, b)\n}\nfunc (m *GoSkipTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GoSkipTest.Marshal(b, m, deterministic)\n}\nfunc (m *GoSkipTest) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GoSkipTest.Merge(m, src)\n}\nfunc (m *GoSkipTest) XXX_Size() int {\n\treturn xxx_messageInfo_GoSkipTest.Size(m)\n}\nfunc (m *GoSkipTest) XXX_DiscardUnknown() {\n\txxx_messageInfo_GoSkipTest.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GoSkipTest proto.InternalMessageInfo\n\nfunc (m *GoSkipTest) GetSkipInt32() int32 {\n\tif m != nil && m.SkipInt32 != nil {\n\t\treturn *m.SkipInt32\n\t}\n\treturn 0\n}\n\nfunc (m *GoSkipTest) GetSkipFixed32() uint32 {\n\tif m != nil && m.SkipFixed32 != nil {\n\t\treturn *m.SkipFixed32\n\t}\n\treturn 0\n}\n\nfunc (m *GoSkipTest) GetSkipFixed64() uint64 {\n\tif m != nil && m.SkipFixed64 != nil {\n\t\treturn *m.SkipFixed64\n\t}\n\treturn 0\n}\n\nfunc (m *GoSkipTest) GetSkipString() string {\n\tif m != nil && m.SkipString != nil {\n\t\treturn *m.SkipString\n\t}\n\treturn \"\"\n}\n\nfunc (m *GoSkipTest) GetSkipgroup() *GoSkipTest_SkipGroup {\n\tif m != nil {\n\t\treturn m.Skipgroup\n\t}\n\treturn nil\n}\n\ntype GoSkipTest_SkipGroup struct {\n\tGroupInt32           *int32   `protobuf:\"varint,16,req,name=group_int32,json=groupInt32\" json:\"group_int32,omitempty\"`\n\tGroupString          *string  `protobuf:\"bytes,17,req,name=group_string,json=groupString\" json:\"group_string,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *GoSkipTest_SkipGroup) Reset()         { *m = GoSkipTest_SkipGroup{} }\nfunc (m *GoSkipTest_SkipGroup) String() string { return proto.CompactTextString(m) }\nfunc (*GoSkipTest_SkipGroup) ProtoMessage()    {}\nfunc (*GoSkipTest_SkipGroup) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{4, 0}\n}\n\nfunc (m *GoSkipTest_SkipGroup) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GoSkipTest_SkipGroup.Unmarshal(m, b)\n}\nfunc (m *GoSkipTest_SkipGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GoSkipTest_SkipGroup.Marshal(b, m, deterministic)\n}\nfunc (m *GoSkipTest_SkipGroup) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GoSkipTest_SkipGroup.Merge(m, src)\n}\nfunc (m *GoSkipTest_SkipGroup) XXX_Size() int {\n\treturn xxx_messageInfo_GoSkipTest_SkipGroup.Size(m)\n}\nfunc (m *GoSkipTest_SkipGroup) XXX_DiscardUnknown() {\n\txxx_messageInfo_GoSkipTest_SkipGroup.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GoSkipTest_SkipGroup proto.InternalMessageInfo\n\nfunc (m *GoSkipTest_SkipGroup) GetGroupInt32() int32 {\n\tif m != nil && m.GroupInt32 != nil {\n\t\treturn *m.GroupInt32\n\t}\n\treturn 0\n}\n\nfunc (m *GoSkipTest_SkipGroup) GetGroupString() string {\n\tif m != nil && m.GroupString != nil {\n\t\treturn *m.GroupString\n\t}\n\treturn \"\"\n}\n\n// For testing packed/non-packed decoder switching.\n// A serialized instance of one should be deserializable as the other.\ntype NonPackedTest struct {\n\tA                    []int32  `protobuf:\"varint,1,rep,name=a\" json:\"a,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *NonPackedTest) Reset()         { *m = NonPackedTest{} }\nfunc (m *NonPackedTest) String() string { return proto.CompactTextString(m) }\nfunc (*NonPackedTest) ProtoMessage()    {}\nfunc (*NonPackedTest) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{5}\n}\n\nfunc (m *NonPackedTest) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_NonPackedTest.Unmarshal(m, b)\n}\nfunc (m *NonPackedTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_NonPackedTest.Marshal(b, m, deterministic)\n}\nfunc (m *NonPackedTest) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_NonPackedTest.Merge(m, src)\n}\nfunc (m *NonPackedTest) XXX_Size() int {\n\treturn xxx_messageInfo_NonPackedTest.Size(m)\n}\nfunc (m *NonPackedTest) XXX_DiscardUnknown() {\n\txxx_messageInfo_NonPackedTest.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_NonPackedTest proto.InternalMessageInfo\n\nfunc (m *NonPackedTest) GetA() []int32 {\n\tif m != nil {\n\t\treturn m.A\n\t}\n\treturn nil\n}\n\ntype PackedTest struct {\n\tB                    []int32  `protobuf:\"varint,1,rep,packed,name=b\" json:\"b,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *PackedTest) Reset()         { *m = PackedTest{} }\nfunc (m *PackedTest) String() string { return proto.CompactTextString(m) }\nfunc (*PackedTest) ProtoMessage()    {}\nfunc (*PackedTest) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{6}\n}\n\nfunc (m *PackedTest) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_PackedTest.Unmarshal(m, b)\n}\nfunc (m *PackedTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_PackedTest.Marshal(b, m, deterministic)\n}\nfunc (m *PackedTest) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_PackedTest.Merge(m, src)\n}\nfunc (m *PackedTest) XXX_Size() int {\n\treturn xxx_messageInfo_PackedTest.Size(m)\n}\nfunc (m *PackedTest) XXX_DiscardUnknown() {\n\txxx_messageInfo_PackedTest.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_PackedTest proto.InternalMessageInfo\n\nfunc (m *PackedTest) GetB() []int32 {\n\tif m != nil {\n\t\treturn m.B\n\t}\n\treturn nil\n}\n\ntype MaxTag struct {\n\t// Maximum possible tag number.\n\tLastField            *string  `protobuf:\"bytes,536870911,opt,name=last_field,json=lastField\" json:\"last_field,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *MaxTag) Reset()         { *m = MaxTag{} }\nfunc (m *MaxTag) String() string { return proto.CompactTextString(m) }\nfunc (*MaxTag) ProtoMessage()    {}\nfunc (*MaxTag) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{7}\n}\n\nfunc (m *MaxTag) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_MaxTag.Unmarshal(m, b)\n}\nfunc (m *MaxTag) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_MaxTag.Marshal(b, m, deterministic)\n}\nfunc (m *MaxTag) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_MaxTag.Merge(m, src)\n}\nfunc (m *MaxTag) XXX_Size() int {\n\treturn xxx_messageInfo_MaxTag.Size(m)\n}\nfunc (m *MaxTag) XXX_DiscardUnknown() {\n\txxx_messageInfo_MaxTag.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_MaxTag proto.InternalMessageInfo\n\nfunc (m *MaxTag) GetLastField() string {\n\tif m != nil && m.LastField != nil {\n\t\treturn *m.LastField\n\t}\n\treturn \"\"\n}\n\ntype OldMessage struct {\n\tNested               *OldMessage_Nested `protobuf:\"bytes,1,opt,name=nested\" json:\"nested,omitempty\"`\n\tNum                  *int32             `protobuf:\"varint,2,opt,name=num\" json:\"num,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}           `json:\"-\"`\n\tXXX_unrecognized     []byte             `json:\"-\"`\n\tXXX_sizecache        int32              `json:\"-\"`\n}\n\nfunc (m *OldMessage) Reset()         { *m = OldMessage{} }\nfunc (m *OldMessage) String() string { return proto.CompactTextString(m) }\nfunc (*OldMessage) ProtoMessage()    {}\nfunc (*OldMessage) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{8}\n}\n\nfunc (m *OldMessage) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_OldMessage.Unmarshal(m, b)\n}\nfunc (m *OldMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_OldMessage.Marshal(b, m, deterministic)\n}\nfunc (m *OldMessage) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_OldMessage.Merge(m, src)\n}\nfunc (m *OldMessage) XXX_Size() int {\n\treturn xxx_messageInfo_OldMessage.Size(m)\n}\nfunc (m *OldMessage) XXX_DiscardUnknown() {\n\txxx_messageInfo_OldMessage.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_OldMessage proto.InternalMessageInfo\n\nfunc (m *OldMessage) GetNested() *OldMessage_Nested {\n\tif m != nil {\n\t\treturn m.Nested\n\t}\n\treturn nil\n}\n\nfunc (m *OldMessage) GetNum() int32 {\n\tif m != nil && m.Num != nil {\n\t\treturn *m.Num\n\t}\n\treturn 0\n}\n\ntype OldMessage_Nested struct {\n\tName                 *string  `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *OldMessage_Nested) Reset()         { *m = OldMessage_Nested{} }\nfunc (m *OldMessage_Nested) String() string { return proto.CompactTextString(m) }\nfunc (*OldMessage_Nested) ProtoMessage()    {}\nfunc (*OldMessage_Nested) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{8, 0}\n}\n\nfunc (m *OldMessage_Nested) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_OldMessage_Nested.Unmarshal(m, b)\n}\nfunc (m *OldMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_OldMessage_Nested.Marshal(b, m, deterministic)\n}\nfunc (m *OldMessage_Nested) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_OldMessage_Nested.Merge(m, src)\n}\nfunc (m *OldMessage_Nested) XXX_Size() int {\n\treturn xxx_messageInfo_OldMessage_Nested.Size(m)\n}\nfunc (m *OldMessage_Nested) XXX_DiscardUnknown() {\n\txxx_messageInfo_OldMessage_Nested.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_OldMessage_Nested proto.InternalMessageInfo\n\nfunc (m *OldMessage_Nested) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\n// NewMessage is wire compatible with OldMessage;\n// imagine it as a future version.\ntype NewMessage struct {\n\tNested *NewMessage_Nested `protobuf:\"bytes,1,opt,name=nested\" json:\"nested,omitempty\"`\n\t// This is an int32 in OldMessage.\n\tNum                  *int64   `protobuf:\"varint,2,opt,name=num\" json:\"num,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *NewMessage) Reset()         { *m = NewMessage{} }\nfunc (m *NewMessage) String() string { return proto.CompactTextString(m) }\nfunc (*NewMessage) ProtoMessage()    {}\nfunc (*NewMessage) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{9}\n}\n\nfunc (m *NewMessage) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_NewMessage.Unmarshal(m, b)\n}\nfunc (m *NewMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_NewMessage.Marshal(b, m, deterministic)\n}\nfunc (m *NewMessage) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_NewMessage.Merge(m, src)\n}\nfunc (m *NewMessage) XXX_Size() int {\n\treturn xxx_messageInfo_NewMessage.Size(m)\n}\nfunc (m *NewMessage) XXX_DiscardUnknown() {\n\txxx_messageInfo_NewMessage.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_NewMessage proto.InternalMessageInfo\n\nfunc (m *NewMessage) GetNested() *NewMessage_Nested {\n\tif m != nil {\n\t\treturn m.Nested\n\t}\n\treturn nil\n}\n\nfunc (m *NewMessage) GetNum() int64 {\n\tif m != nil && m.Num != nil {\n\t\treturn *m.Num\n\t}\n\treturn 0\n}\n\ntype NewMessage_Nested struct {\n\tName                 *string  `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tFoodGroup            *string  `protobuf:\"bytes,2,opt,name=food_group,json=foodGroup\" json:\"food_group,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *NewMessage_Nested) Reset()         { *m = NewMessage_Nested{} }\nfunc (m *NewMessage_Nested) String() string { return proto.CompactTextString(m) }\nfunc (*NewMessage_Nested) ProtoMessage()    {}\nfunc (*NewMessage_Nested) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{9, 0}\n}\n\nfunc (m *NewMessage_Nested) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_NewMessage_Nested.Unmarshal(m, b)\n}\nfunc (m *NewMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_NewMessage_Nested.Marshal(b, m, deterministic)\n}\nfunc (m *NewMessage_Nested) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_NewMessage_Nested.Merge(m, src)\n}\nfunc (m *NewMessage_Nested) XXX_Size() int {\n\treturn xxx_messageInfo_NewMessage_Nested.Size(m)\n}\nfunc (m *NewMessage_Nested) XXX_DiscardUnknown() {\n\txxx_messageInfo_NewMessage_Nested.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_NewMessage_Nested proto.InternalMessageInfo\n\nfunc (m *NewMessage_Nested) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *NewMessage_Nested) GetFoodGroup() string {\n\tif m != nil && m.FoodGroup != nil {\n\t\treturn *m.FoodGroup\n\t}\n\treturn \"\"\n}\n\ntype InnerMessage struct {\n\tHost                 *string  `protobuf:\"bytes,1,req,name=host\" json:\"host,omitempty\"`\n\tPort                 *int32   `protobuf:\"varint,2,opt,name=port,def=4000\" json:\"port,omitempty\"`\n\tConnected            *bool    `protobuf:\"varint,3,opt,name=connected\" json:\"connected,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *InnerMessage) Reset()         { *m = InnerMessage{} }\nfunc (m *InnerMessage) String() string { return proto.CompactTextString(m) }\nfunc (*InnerMessage) ProtoMessage()    {}\nfunc (*InnerMessage) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{10}\n}\n\nfunc (m *InnerMessage) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_InnerMessage.Unmarshal(m, b)\n}\nfunc (m *InnerMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_InnerMessage.Marshal(b, m, deterministic)\n}\nfunc (m *InnerMessage) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_InnerMessage.Merge(m, src)\n}\nfunc (m *InnerMessage) XXX_Size() int {\n\treturn xxx_messageInfo_InnerMessage.Size(m)\n}\nfunc (m *InnerMessage) XXX_DiscardUnknown() {\n\txxx_messageInfo_InnerMessage.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_InnerMessage proto.InternalMessageInfo\n\nconst Default_InnerMessage_Port int32 = 4000\n\nfunc (m *InnerMessage) GetHost() string {\n\tif m != nil && m.Host != nil {\n\t\treturn *m.Host\n\t}\n\treturn \"\"\n}\n\nfunc (m *InnerMessage) GetPort() int32 {\n\tif m != nil && m.Port != nil {\n\t\treturn *m.Port\n\t}\n\treturn Default_InnerMessage_Port\n}\n\nfunc (m *InnerMessage) GetConnected() bool {\n\tif m != nil && m.Connected != nil {\n\t\treturn *m.Connected\n\t}\n\treturn false\n}\n\ntype OtherMessage struct {\n\tKey                          *int64        `protobuf:\"varint,1,opt,name=key\" json:\"key,omitempty\"`\n\tValue                        []byte        `protobuf:\"bytes,2,opt,name=value\" json:\"value,omitempty\"`\n\tWeight                       *float32      `protobuf:\"fixed32,3,opt,name=weight\" json:\"weight,omitempty\"`\n\tInner                        *InnerMessage `protobuf:\"bytes,4,opt,name=inner\" json:\"inner,omitempty\"`\n\tXXX_NoUnkeyedLiteral         struct{}      `json:\"-\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n\tXXX_sizecache                int32  `json:\"-\"`\n}\n\nfunc (m *OtherMessage) Reset()         { *m = OtherMessage{} }\nfunc (m *OtherMessage) String() string { return proto.CompactTextString(m) }\nfunc (*OtherMessage) ProtoMessage()    {}\nfunc (*OtherMessage) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{11}\n}\n\nvar extRange_OtherMessage = []proto.ExtensionRange{\n\t{Start: 100, End: 536870911},\n}\n\nfunc (*OtherMessage) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_OtherMessage\n}\n\nfunc (m *OtherMessage) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_OtherMessage.Unmarshal(m, b)\n}\nfunc (m *OtherMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_OtherMessage.Marshal(b, m, deterministic)\n}\nfunc (m *OtherMessage) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_OtherMessage.Merge(m, src)\n}\nfunc (m *OtherMessage) XXX_Size() int {\n\treturn xxx_messageInfo_OtherMessage.Size(m)\n}\nfunc (m *OtherMessage) XXX_DiscardUnknown() {\n\txxx_messageInfo_OtherMessage.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_OtherMessage proto.InternalMessageInfo\n\nfunc (m *OtherMessage) GetKey() int64 {\n\tif m != nil && m.Key != nil {\n\t\treturn *m.Key\n\t}\n\treturn 0\n}\n\nfunc (m *OtherMessage) GetValue() []byte {\n\tif m != nil {\n\t\treturn m.Value\n\t}\n\treturn nil\n}\n\nfunc (m *OtherMessage) GetWeight() float32 {\n\tif m != nil && m.Weight != nil {\n\t\treturn *m.Weight\n\t}\n\treturn 0\n}\n\nfunc (m *OtherMessage) GetInner() *InnerMessage {\n\tif m != nil {\n\t\treturn m.Inner\n\t}\n\treturn nil\n}\n\ntype RequiredInnerMessage struct {\n\tLeoFinallyWonAnOscar *InnerMessage `protobuf:\"bytes,1,req,name=leo_finally_won_an_oscar,json=leoFinallyWonAnOscar\" json:\"leo_finally_won_an_oscar,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}      `json:\"-\"`\n\tXXX_unrecognized     []byte        `json:\"-\"`\n\tXXX_sizecache        int32         `json:\"-\"`\n}\n\nfunc (m *RequiredInnerMessage) Reset()         { *m = RequiredInnerMessage{} }\nfunc (m *RequiredInnerMessage) String() string { return proto.CompactTextString(m) }\nfunc (*RequiredInnerMessage) ProtoMessage()    {}\nfunc (*RequiredInnerMessage) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{12}\n}\n\nfunc (m *RequiredInnerMessage) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_RequiredInnerMessage.Unmarshal(m, b)\n}\nfunc (m *RequiredInnerMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_RequiredInnerMessage.Marshal(b, m, deterministic)\n}\nfunc (m *RequiredInnerMessage) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_RequiredInnerMessage.Merge(m, src)\n}\nfunc (m *RequiredInnerMessage) XXX_Size() int {\n\treturn xxx_messageInfo_RequiredInnerMessage.Size(m)\n}\nfunc (m *RequiredInnerMessage) XXX_DiscardUnknown() {\n\txxx_messageInfo_RequiredInnerMessage.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_RequiredInnerMessage proto.InternalMessageInfo\n\nfunc (m *RequiredInnerMessage) GetLeoFinallyWonAnOscar() *InnerMessage {\n\tif m != nil {\n\t\treturn m.LeoFinallyWonAnOscar\n\t}\n\treturn nil\n}\n\ntype MyMessage struct {\n\tCount          *int32                `protobuf:\"varint,1,req,name=count\" json:\"count,omitempty\"`\n\tName           *string               `protobuf:\"bytes,2,opt,name=name\" json:\"name,omitempty\"`\n\tQuote          *string               `protobuf:\"bytes,3,opt,name=quote\" json:\"quote,omitempty\"`\n\tPet            []string              `protobuf:\"bytes,4,rep,name=pet\" json:\"pet,omitempty\"`\n\tInner          *InnerMessage         `protobuf:\"bytes,5,opt,name=inner\" json:\"inner,omitempty\"`\n\tOthers         []*OtherMessage       `protobuf:\"bytes,6,rep,name=others\" json:\"others,omitempty\"`\n\tWeMustGoDeeper *RequiredInnerMessage `protobuf:\"bytes,13,opt,name=we_must_go_deeper,json=weMustGoDeeper\" json:\"we_must_go_deeper,omitempty\"`\n\tRepInner       []*InnerMessage       `protobuf:\"bytes,12,rep,name=rep_inner,json=repInner\" json:\"rep_inner,omitempty\"`\n\tBikeshed       *MyMessage_Color      `protobuf:\"varint,7,opt,name=bikeshed,enum=proto2_test.MyMessage_Color\" json:\"bikeshed,omitempty\"`\n\tSomegroup      *MyMessage_SomeGroup  `protobuf:\"group,8,opt,name=SomeGroup,json=somegroup\" json:\"somegroup,omitempty\"`\n\t// This field becomes [][]byte in the generated code.\n\tRepBytes                     [][]byte `protobuf:\"bytes,10,rep,name=rep_bytes,json=repBytes\" json:\"rep_bytes,omitempty\"`\n\tBigfloat                     *float64 `protobuf:\"fixed64,11,opt,name=bigfloat\" json:\"bigfloat,omitempty\"`\n\tXXX_NoUnkeyedLiteral         struct{} `json:\"-\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n\tXXX_sizecache                int32  `json:\"-\"`\n}\n\nfunc (m *MyMessage) Reset()         { *m = MyMessage{} }\nfunc (m *MyMessage) String() string { return proto.CompactTextString(m) }\nfunc (*MyMessage) ProtoMessage()    {}\nfunc (*MyMessage) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{13}\n}\n\nvar extRange_MyMessage = []proto.ExtensionRange{\n\t{Start: 100, End: 536870911},\n}\n\nfunc (*MyMessage) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_MyMessage\n}\n\nfunc (m *MyMessage) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_MyMessage.Unmarshal(m, b)\n}\nfunc (m *MyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_MyMessage.Marshal(b, m, deterministic)\n}\nfunc (m *MyMessage) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_MyMessage.Merge(m, src)\n}\nfunc (m *MyMessage) XXX_Size() int {\n\treturn xxx_messageInfo_MyMessage.Size(m)\n}\nfunc (m *MyMessage) XXX_DiscardUnknown() {\n\txxx_messageInfo_MyMessage.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_MyMessage proto.InternalMessageInfo\n\nfunc (m *MyMessage) GetCount() int32 {\n\tif m != nil && m.Count != nil {\n\t\treturn *m.Count\n\t}\n\treturn 0\n}\n\nfunc (m *MyMessage) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *MyMessage) GetQuote() string {\n\tif m != nil && m.Quote != nil {\n\t\treturn *m.Quote\n\t}\n\treturn \"\"\n}\n\nfunc (m *MyMessage) GetPet() []string {\n\tif m != nil {\n\t\treturn m.Pet\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetInner() *InnerMessage {\n\tif m != nil {\n\t\treturn m.Inner\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetOthers() []*OtherMessage {\n\tif m != nil {\n\t\treturn m.Others\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetWeMustGoDeeper() *RequiredInnerMessage {\n\tif m != nil {\n\t\treturn m.WeMustGoDeeper\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetRepInner() []*InnerMessage {\n\tif m != nil {\n\t\treturn m.RepInner\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetBikeshed() MyMessage_Color {\n\tif m != nil && m.Bikeshed != nil {\n\t\treturn *m.Bikeshed\n\t}\n\treturn MyMessage_RED\n}\n\nfunc (m *MyMessage) GetSomegroup() *MyMessage_SomeGroup {\n\tif m != nil {\n\t\treturn m.Somegroup\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetRepBytes() [][]byte {\n\tif m != nil {\n\t\treturn m.RepBytes\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetBigfloat() float64 {\n\tif m != nil && m.Bigfloat != nil {\n\t\treturn *m.Bigfloat\n\t}\n\treturn 0\n}\n\ntype MyMessage_SomeGroup struct {\n\tGroupField           *int32   `protobuf:\"varint,9,opt,name=group_field,json=groupField\" json:\"group_field,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *MyMessage_SomeGroup) Reset()         { *m = MyMessage_SomeGroup{} }\nfunc (m *MyMessage_SomeGroup) String() string { return proto.CompactTextString(m) }\nfunc (*MyMessage_SomeGroup) ProtoMessage()    {}\nfunc (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{13, 0}\n}\n\nfunc (m *MyMessage_SomeGroup) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_MyMessage_SomeGroup.Unmarshal(m, b)\n}\nfunc (m *MyMessage_SomeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_MyMessage_SomeGroup.Marshal(b, m, deterministic)\n}\nfunc (m *MyMessage_SomeGroup) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_MyMessage_SomeGroup.Merge(m, src)\n}\nfunc (m *MyMessage_SomeGroup) XXX_Size() int {\n\treturn xxx_messageInfo_MyMessage_SomeGroup.Size(m)\n}\nfunc (m *MyMessage_SomeGroup) XXX_DiscardUnknown() {\n\txxx_messageInfo_MyMessage_SomeGroup.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_MyMessage_SomeGroup proto.InternalMessageInfo\n\nfunc (m *MyMessage_SomeGroup) GetGroupField() int32 {\n\tif m != nil && m.GroupField != nil {\n\t\treturn *m.GroupField\n\t}\n\treturn 0\n}\n\ntype Ext struct {\n\tData                 *string         `protobuf:\"bytes,1,opt,name=data\" json:\"data,omitempty\"`\n\tMapField             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\"`\n\tXXX_NoUnkeyedLiteral struct{}        `json:\"-\"`\n\tXXX_unrecognized     []byte          `json:\"-\"`\n\tXXX_sizecache        int32           `json:\"-\"`\n}\n\nfunc (m *Ext) Reset()         { *m = Ext{} }\nfunc (m *Ext) String() string { return proto.CompactTextString(m) }\nfunc (*Ext) ProtoMessage()    {}\nfunc (*Ext) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{14}\n}\n\nfunc (m *Ext) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Ext.Unmarshal(m, b)\n}\nfunc (m *Ext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Ext.Marshal(b, m, deterministic)\n}\nfunc (m *Ext) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Ext.Merge(m, src)\n}\nfunc (m *Ext) XXX_Size() int {\n\treturn xxx_messageInfo_Ext.Size(m)\n}\nfunc (m *Ext) XXX_DiscardUnknown() {\n\txxx_messageInfo_Ext.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Ext proto.InternalMessageInfo\n\nfunc (m *Ext) GetData() string {\n\tif m != nil && m.Data != nil {\n\t\treturn *m.Data\n\t}\n\treturn \"\"\n}\n\nfunc (m *Ext) GetMapField() map[int32]int32 {\n\tif m != nil {\n\t\treturn m.MapField\n\t}\n\treturn nil\n}\n\nvar E_Ext_More = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessage)(nil),\n\tExtensionType: (*Ext)(nil),\n\tField:         103,\n\tName:          \"proto2_test.Ext.more\",\n\tTag:           \"bytes,103,opt,name=more\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_Ext_Text = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessage)(nil),\n\tExtensionType: (*string)(nil),\n\tField:         104,\n\tName:          \"proto2_test.Ext.text\",\n\tTag:           \"bytes,104,opt,name=text\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_Ext_Number = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         105,\n\tName:          \"proto2_test.Ext.number\",\n\tTag:           \"varint,105,opt,name=number\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\ntype ComplexExtension struct {\n\tFirst                *int32   `protobuf:\"varint,1,opt,name=first\" json:\"first,omitempty\"`\n\tSecond               *int32   `protobuf:\"varint,2,opt,name=second\" json:\"second,omitempty\"`\n\tThird                []int32  `protobuf:\"varint,3,rep,name=third\" json:\"third,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *ComplexExtension) Reset()         { *m = ComplexExtension{} }\nfunc (m *ComplexExtension) String() string { return proto.CompactTextString(m) }\nfunc (*ComplexExtension) ProtoMessage()    {}\nfunc (*ComplexExtension) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{15}\n}\n\nfunc (m *ComplexExtension) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_ComplexExtension.Unmarshal(m, b)\n}\nfunc (m *ComplexExtension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_ComplexExtension.Marshal(b, m, deterministic)\n}\nfunc (m *ComplexExtension) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_ComplexExtension.Merge(m, src)\n}\nfunc (m *ComplexExtension) XXX_Size() int {\n\treturn xxx_messageInfo_ComplexExtension.Size(m)\n}\nfunc (m *ComplexExtension) XXX_DiscardUnknown() {\n\txxx_messageInfo_ComplexExtension.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_ComplexExtension proto.InternalMessageInfo\n\nfunc (m *ComplexExtension) GetFirst() int32 {\n\tif m != nil && m.First != nil {\n\t\treturn *m.First\n\t}\n\treturn 0\n}\n\nfunc (m *ComplexExtension) GetSecond() int32 {\n\tif m != nil && m.Second != nil {\n\t\treturn *m.Second\n\t}\n\treturn 0\n}\n\nfunc (m *ComplexExtension) GetThird() []int32 {\n\tif m != nil {\n\t\treturn m.Third\n\t}\n\treturn nil\n}\n\ntype DefaultsMessage struct {\n\tXXX_NoUnkeyedLiteral         struct{} `json:\"-\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n\tXXX_sizecache                int32  `json:\"-\"`\n}\n\nfunc (m *DefaultsMessage) Reset()         { *m = DefaultsMessage{} }\nfunc (m *DefaultsMessage) String() string { return proto.CompactTextString(m) }\nfunc (*DefaultsMessage) ProtoMessage()    {}\nfunc (*DefaultsMessage) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{16}\n}\n\nvar extRange_DefaultsMessage = []proto.ExtensionRange{\n\t{Start: 100, End: 536870911},\n}\n\nfunc (*DefaultsMessage) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_DefaultsMessage\n}\n\nfunc (m *DefaultsMessage) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_DefaultsMessage.Unmarshal(m, b)\n}\nfunc (m *DefaultsMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_DefaultsMessage.Marshal(b, m, deterministic)\n}\nfunc (m *DefaultsMessage) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_DefaultsMessage.Merge(m, src)\n}\nfunc (m *DefaultsMessage) XXX_Size() int {\n\treturn xxx_messageInfo_DefaultsMessage.Size(m)\n}\nfunc (m *DefaultsMessage) XXX_DiscardUnknown() {\n\txxx_messageInfo_DefaultsMessage.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_DefaultsMessage proto.InternalMessageInfo\n\ntype Empty struct {\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *Empty) Reset()         { *m = Empty{} }\nfunc (m *Empty) String() string { return proto.CompactTextString(m) }\nfunc (*Empty) ProtoMessage()    {}\nfunc (*Empty) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{17}\n}\n\nfunc (m *Empty) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Empty.Unmarshal(m, b)\n}\nfunc (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Empty.Marshal(b, m, deterministic)\n}\nfunc (m *Empty) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Empty.Merge(m, src)\n}\nfunc (m *Empty) XXX_Size() int {\n\treturn xxx_messageInfo_Empty.Size(m)\n}\nfunc (m *Empty) XXX_DiscardUnknown() {\n\txxx_messageInfo_Empty.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Empty proto.InternalMessageInfo\n\ntype MessageList struct {\n\tMessage              []*MessageList_Message `protobuf:\"group,1,rep,name=Message,json=message\" json:\"message,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}               `json:\"-\"`\n\tXXX_unrecognized     []byte                 `json:\"-\"`\n\tXXX_sizecache        int32                  `json:\"-\"`\n}\n\nfunc (m *MessageList) Reset()         { *m = MessageList{} }\nfunc (m *MessageList) String() string { return proto.CompactTextString(m) }\nfunc (*MessageList) ProtoMessage()    {}\nfunc (*MessageList) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{18}\n}\n\nfunc (m *MessageList) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_MessageList.Unmarshal(m, b)\n}\nfunc (m *MessageList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_MessageList.Marshal(b, m, deterministic)\n}\nfunc (m *MessageList) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_MessageList.Merge(m, src)\n}\nfunc (m *MessageList) XXX_Size() int {\n\treturn xxx_messageInfo_MessageList.Size(m)\n}\nfunc (m *MessageList) XXX_DiscardUnknown() {\n\txxx_messageInfo_MessageList.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_MessageList proto.InternalMessageInfo\n\nfunc (m *MessageList) GetMessage() []*MessageList_Message {\n\tif m != nil {\n\t\treturn m.Message\n\t}\n\treturn nil\n}\n\ntype MessageList_Message struct {\n\tName                 *string  `protobuf:\"bytes,2,req,name=name\" json:\"name,omitempty\"`\n\tCount                *int32   `protobuf:\"varint,3,req,name=count\" json:\"count,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *MessageList_Message) Reset()         { *m = MessageList_Message{} }\nfunc (m *MessageList_Message) String() string { return proto.CompactTextString(m) }\nfunc (*MessageList_Message) ProtoMessage()    {}\nfunc (*MessageList_Message) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{18, 0}\n}\n\nfunc (m *MessageList_Message) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_MessageList_Message.Unmarshal(m, b)\n}\nfunc (m *MessageList_Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_MessageList_Message.Marshal(b, m, deterministic)\n}\nfunc (m *MessageList_Message) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_MessageList_Message.Merge(m, src)\n}\nfunc (m *MessageList_Message) XXX_Size() int {\n\treturn xxx_messageInfo_MessageList_Message.Size(m)\n}\nfunc (m *MessageList_Message) XXX_DiscardUnknown() {\n\txxx_messageInfo_MessageList_Message.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_MessageList_Message proto.InternalMessageInfo\n\nfunc (m *MessageList_Message) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *MessageList_Message) GetCount() int32 {\n\tif m != nil && m.Count != nil {\n\t\treturn *m.Count\n\t}\n\treturn 0\n}\n\ntype Strings struct {\n\tStringField          *string  `protobuf:\"bytes,1,opt,name=string_field,json=stringField\" json:\"string_field,omitempty\"`\n\tBytesField           []byte   `protobuf:\"bytes,2,opt,name=bytes_field,json=bytesField\" json:\"bytes_field,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *Strings) Reset()         { *m = Strings{} }\nfunc (m *Strings) String() string { return proto.CompactTextString(m) }\nfunc (*Strings) ProtoMessage()    {}\nfunc (*Strings) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{19}\n}\n\nfunc (m *Strings) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Strings.Unmarshal(m, b)\n}\nfunc (m *Strings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Strings.Marshal(b, m, deterministic)\n}\nfunc (m *Strings) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Strings.Merge(m, src)\n}\nfunc (m *Strings) XXX_Size() int {\n\treturn xxx_messageInfo_Strings.Size(m)\n}\nfunc (m *Strings) XXX_DiscardUnknown() {\n\txxx_messageInfo_Strings.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Strings proto.InternalMessageInfo\n\nfunc (m *Strings) GetStringField() string {\n\tif m != nil && m.StringField != nil {\n\t\treturn *m.StringField\n\t}\n\treturn \"\"\n}\n\nfunc (m *Strings) GetBytesField() []byte {\n\tif m != nil {\n\t\treturn m.BytesField\n\t}\n\treturn nil\n}\n\ntype Defaults struct {\n\t// Default-valued fields of all basic types.\n\t// Same as GoTest, but copied here to make testing easier.\n\tF_Bool    *bool           `protobuf:\"varint,1,opt,name=F_Bool,json=FBool,def=1\" json:\"F_Bool,omitempty\"`\n\tF_Int32   *int32          `protobuf:\"varint,2,opt,name=F_Int32,json=FInt32,def=32\" json:\"F_Int32,omitempty\"`\n\tF_Int64   *int64          `protobuf:\"varint,3,opt,name=F_Int64,json=FInt64,def=64\" json:\"F_Int64,omitempty\"`\n\tF_Fixed32 *uint32         `protobuf:\"fixed32,4,opt,name=F_Fixed32,json=FFixed32,def=320\" json:\"F_Fixed32,omitempty\"`\n\tF_Fixed64 *uint64         `protobuf:\"fixed64,5,opt,name=F_Fixed64,json=FFixed64,def=640\" json:\"F_Fixed64,omitempty\"`\n\tF_Uint32  *uint32         `protobuf:\"varint,6,opt,name=F_Uint32,json=FUint32,def=3200\" json:\"F_Uint32,omitempty\"`\n\tF_Uint64  *uint64         `protobuf:\"varint,7,opt,name=F_Uint64,json=FUint64,def=6400\" json:\"F_Uint64,omitempty\"`\n\tF_Float   *float32        `protobuf:\"fixed32,8,opt,name=F_Float,json=FFloat,def=314159\" json:\"F_Float,omitempty\"`\n\tF_Double  *float64        `protobuf:\"fixed64,9,opt,name=F_Double,json=FDouble,def=271828\" json:\"F_Double,omitempty\"`\n\tF_String  *string         `protobuf:\"bytes,10,opt,name=F_String,json=FString,def=hello, \\\"world!\\\"\\n\" json:\"F_String,omitempty\"`\n\tF_Bytes   []byte          `protobuf:\"bytes,11,opt,name=F_Bytes,json=FBytes,def=Bignose\" json:\"F_Bytes,omitempty\"`\n\tF_Sint32  *int32          `protobuf:\"zigzag32,12,opt,name=F_Sint32,json=FSint32,def=-32\" json:\"F_Sint32,omitempty\"`\n\tF_Sint64  *int64          `protobuf:\"zigzag64,13,opt,name=F_Sint64,json=FSint64,def=-64\" json:\"F_Sint64,omitempty\"`\n\tF_Enum    *Defaults_Color `protobuf:\"varint,14,opt,name=F_Enum,json=FEnum,enum=proto2_test.Defaults_Color,def=1\" json:\"F_Enum,omitempty\"`\n\t// More fields with crazy defaults.\n\tF_Pinf *float32 `protobuf:\"fixed32,15,opt,name=F_Pinf,json=FPinf,def=inf\" json:\"F_Pinf,omitempty\"`\n\tF_Ninf *float32 `protobuf:\"fixed32,16,opt,name=F_Ninf,json=FNinf,def=-inf\" json:\"F_Ninf,omitempty\"`\n\tF_Nan  *float32 `protobuf:\"fixed32,17,opt,name=F_Nan,json=FNan,def=nan\" json:\"F_Nan,omitempty\"`\n\t// Sub-message.\n\tSub *SubDefaults `protobuf:\"bytes,18,opt,name=sub\" json:\"sub,omitempty\"`\n\t// Redundant but explicit defaults.\n\tStrZero              *string  `protobuf:\"bytes,19,opt,name=str_zero,json=strZero,def=\" json:\"str_zero,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *Defaults) Reset()         { *m = Defaults{} }\nfunc (m *Defaults) String() string { return proto.CompactTextString(m) }\nfunc (*Defaults) ProtoMessage()    {}\nfunc (*Defaults) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{20}\n}\n\nfunc (m *Defaults) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Defaults.Unmarshal(m, b)\n}\nfunc (m *Defaults) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Defaults.Marshal(b, m, deterministic)\n}\nfunc (m *Defaults) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Defaults.Merge(m, src)\n}\nfunc (m *Defaults) XXX_Size() int {\n\treturn xxx_messageInfo_Defaults.Size(m)\n}\nfunc (m *Defaults) XXX_DiscardUnknown() {\n\txxx_messageInfo_Defaults.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Defaults proto.InternalMessageInfo\n\nconst Default_Defaults_F_Bool bool = true\nconst Default_Defaults_F_Int32 int32 = 32\nconst Default_Defaults_F_Int64 int64 = 64\nconst Default_Defaults_F_Fixed32 uint32 = 320\nconst Default_Defaults_F_Fixed64 uint64 = 640\nconst Default_Defaults_F_Uint32 uint32 = 3200\nconst Default_Defaults_F_Uint64 uint64 = 6400\nconst Default_Defaults_F_Float float32 = 314159\nconst Default_Defaults_F_Double float64 = 271828\nconst Default_Defaults_F_String string = \"hello, \\\"world!\\\"\\n\"\n\nvar Default_Defaults_F_Bytes []byte = []byte(\"Bignose\")\n\nconst Default_Defaults_F_Sint32 int32 = -32\nconst Default_Defaults_F_Sint64 int64 = -64\nconst Default_Defaults_F_Enum Defaults_Color = Defaults_GREEN\n\nvar Default_Defaults_F_Pinf float32 = float32(math.Inf(1))\nvar Default_Defaults_F_Ninf float32 = float32(math.Inf(-1))\nvar Default_Defaults_F_Nan float32 = float32(math.NaN())\n\nfunc (m *Defaults) GetF_Bool() bool {\n\tif m != nil && m.F_Bool != nil {\n\t\treturn *m.F_Bool\n\t}\n\treturn Default_Defaults_F_Bool\n}\n\nfunc (m *Defaults) GetF_Int32() int32 {\n\tif m != nil && m.F_Int32 != nil {\n\t\treturn *m.F_Int32\n\t}\n\treturn Default_Defaults_F_Int32\n}\n\nfunc (m *Defaults) GetF_Int64() int64 {\n\tif m != nil && m.F_Int64 != nil {\n\t\treturn *m.F_Int64\n\t}\n\treturn Default_Defaults_F_Int64\n}\n\nfunc (m *Defaults) GetF_Fixed32() uint32 {\n\tif m != nil && m.F_Fixed32 != nil {\n\t\treturn *m.F_Fixed32\n\t}\n\treturn Default_Defaults_F_Fixed32\n}\n\nfunc (m *Defaults) GetF_Fixed64() uint64 {\n\tif m != nil && m.F_Fixed64 != nil {\n\t\treturn *m.F_Fixed64\n\t}\n\treturn Default_Defaults_F_Fixed64\n}\n\nfunc (m *Defaults) GetF_Uint32() uint32 {\n\tif m != nil && m.F_Uint32 != nil {\n\t\treturn *m.F_Uint32\n\t}\n\treturn Default_Defaults_F_Uint32\n}\n\nfunc (m *Defaults) GetF_Uint64() uint64 {\n\tif m != nil && m.F_Uint64 != nil {\n\t\treturn *m.F_Uint64\n\t}\n\treturn Default_Defaults_F_Uint64\n}\n\nfunc (m *Defaults) GetF_Float() float32 {\n\tif m != nil && m.F_Float != nil {\n\t\treturn *m.F_Float\n\t}\n\treturn Default_Defaults_F_Float\n}\n\nfunc (m *Defaults) GetF_Double() float64 {\n\tif m != nil && m.F_Double != nil {\n\t\treturn *m.F_Double\n\t}\n\treturn Default_Defaults_F_Double\n}\n\nfunc (m *Defaults) GetF_String() string {\n\tif m != nil && m.F_String != nil {\n\t\treturn *m.F_String\n\t}\n\treturn Default_Defaults_F_String\n}\n\nfunc (m *Defaults) GetF_Bytes() []byte {\n\tif m != nil && m.F_Bytes != nil {\n\t\treturn m.F_Bytes\n\t}\n\treturn append([]byte(nil), Default_Defaults_F_Bytes...)\n}\n\nfunc (m *Defaults) GetF_Sint32() int32 {\n\tif m != nil && m.F_Sint32 != nil {\n\t\treturn *m.F_Sint32\n\t}\n\treturn Default_Defaults_F_Sint32\n}\n\nfunc (m *Defaults) GetF_Sint64() int64 {\n\tif m != nil && m.F_Sint64 != nil {\n\t\treturn *m.F_Sint64\n\t}\n\treturn Default_Defaults_F_Sint64\n}\n\nfunc (m *Defaults) GetF_Enum() Defaults_Color {\n\tif m != nil && m.F_Enum != nil {\n\t\treturn *m.F_Enum\n\t}\n\treturn Default_Defaults_F_Enum\n}\n\nfunc (m *Defaults) GetF_Pinf() float32 {\n\tif m != nil && m.F_Pinf != nil {\n\t\treturn *m.F_Pinf\n\t}\n\treturn Default_Defaults_F_Pinf\n}\n\nfunc (m *Defaults) GetF_Ninf() float32 {\n\tif m != nil && m.F_Ninf != nil {\n\t\treturn *m.F_Ninf\n\t}\n\treturn Default_Defaults_F_Ninf\n}\n\nfunc (m *Defaults) GetF_Nan() float32 {\n\tif m != nil && m.F_Nan != nil {\n\t\treturn *m.F_Nan\n\t}\n\treturn Default_Defaults_F_Nan\n}\n\nfunc (m *Defaults) GetSub() *SubDefaults {\n\tif m != nil {\n\t\treturn m.Sub\n\t}\n\treturn nil\n}\n\nfunc (m *Defaults) GetStrZero() string {\n\tif m != nil && m.StrZero != nil {\n\t\treturn *m.StrZero\n\t}\n\treturn \"\"\n}\n\ntype SubDefaults struct {\n\tN                    *int64   `protobuf:\"varint,1,opt,name=n,def=7\" json:\"n,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *SubDefaults) Reset()         { *m = SubDefaults{} }\nfunc (m *SubDefaults) String() string { return proto.CompactTextString(m) }\nfunc (*SubDefaults) ProtoMessage()    {}\nfunc (*SubDefaults) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{21}\n}\n\nfunc (m *SubDefaults) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_SubDefaults.Unmarshal(m, b)\n}\nfunc (m *SubDefaults) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_SubDefaults.Marshal(b, m, deterministic)\n}\nfunc (m *SubDefaults) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_SubDefaults.Merge(m, src)\n}\nfunc (m *SubDefaults) XXX_Size() int {\n\treturn xxx_messageInfo_SubDefaults.Size(m)\n}\nfunc (m *SubDefaults) XXX_DiscardUnknown() {\n\txxx_messageInfo_SubDefaults.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_SubDefaults proto.InternalMessageInfo\n\nconst Default_SubDefaults_N int64 = 7\n\nfunc (m *SubDefaults) GetN() int64 {\n\tif m != nil && m.N != nil {\n\t\treturn *m.N\n\t}\n\treturn Default_SubDefaults_N\n}\n\ntype RepeatedEnum struct {\n\tColor                []RepeatedEnum_Color `protobuf:\"varint,1,rep,name=color,enum=proto2_test.RepeatedEnum_Color\" json:\"color,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}             `json:\"-\"`\n\tXXX_unrecognized     []byte               `json:\"-\"`\n\tXXX_sizecache        int32                `json:\"-\"`\n}\n\nfunc (m *RepeatedEnum) Reset()         { *m = RepeatedEnum{} }\nfunc (m *RepeatedEnum) String() string { return proto.CompactTextString(m) }\nfunc (*RepeatedEnum) ProtoMessage()    {}\nfunc (*RepeatedEnum) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{22}\n}\n\nfunc (m *RepeatedEnum) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_RepeatedEnum.Unmarshal(m, b)\n}\nfunc (m *RepeatedEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_RepeatedEnum.Marshal(b, m, deterministic)\n}\nfunc (m *RepeatedEnum) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_RepeatedEnum.Merge(m, src)\n}\nfunc (m *RepeatedEnum) XXX_Size() int {\n\treturn xxx_messageInfo_RepeatedEnum.Size(m)\n}\nfunc (m *RepeatedEnum) XXX_DiscardUnknown() {\n\txxx_messageInfo_RepeatedEnum.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_RepeatedEnum proto.InternalMessageInfo\n\nfunc (m *RepeatedEnum) GetColor() []RepeatedEnum_Color {\n\tif m != nil {\n\t\treturn m.Color\n\t}\n\treturn nil\n}\n\ntype MoreRepeated struct {\n\tBools                []bool   `protobuf:\"varint,1,rep,name=bools\" json:\"bools,omitempty\"`\n\tBoolsPacked          []bool   `protobuf:\"varint,2,rep,packed,name=bools_packed,json=boolsPacked\" json:\"bools_packed,omitempty\"`\n\tInts                 []int32  `protobuf:\"varint,3,rep,name=ints\" json:\"ints,omitempty\"`\n\tIntsPacked           []int32  `protobuf:\"varint,4,rep,packed,name=ints_packed,json=intsPacked\" json:\"ints_packed,omitempty\"`\n\tInt64SPacked         []int64  `protobuf:\"varint,7,rep,packed,name=int64s_packed,json=int64sPacked\" json:\"int64s_packed,omitempty\"`\n\tStrings              []string `protobuf:\"bytes,5,rep,name=strings\" json:\"strings,omitempty\"`\n\tFixeds               []uint32 `protobuf:\"fixed32,6,rep,name=fixeds\" json:\"fixeds,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *MoreRepeated) Reset()         { *m = MoreRepeated{} }\nfunc (m *MoreRepeated) String() string { return proto.CompactTextString(m) }\nfunc (*MoreRepeated) ProtoMessage()    {}\nfunc (*MoreRepeated) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{23}\n}\n\nfunc (m *MoreRepeated) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_MoreRepeated.Unmarshal(m, b)\n}\nfunc (m *MoreRepeated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_MoreRepeated.Marshal(b, m, deterministic)\n}\nfunc (m *MoreRepeated) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_MoreRepeated.Merge(m, src)\n}\nfunc (m *MoreRepeated) XXX_Size() int {\n\treturn xxx_messageInfo_MoreRepeated.Size(m)\n}\nfunc (m *MoreRepeated) XXX_DiscardUnknown() {\n\txxx_messageInfo_MoreRepeated.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_MoreRepeated proto.InternalMessageInfo\n\nfunc (m *MoreRepeated) GetBools() []bool {\n\tif m != nil {\n\t\treturn m.Bools\n\t}\n\treturn nil\n}\n\nfunc (m *MoreRepeated) GetBoolsPacked() []bool {\n\tif m != nil {\n\t\treturn m.BoolsPacked\n\t}\n\treturn nil\n}\n\nfunc (m *MoreRepeated) GetInts() []int32 {\n\tif m != nil {\n\t\treturn m.Ints\n\t}\n\treturn nil\n}\n\nfunc (m *MoreRepeated) GetIntsPacked() []int32 {\n\tif m != nil {\n\t\treturn m.IntsPacked\n\t}\n\treturn nil\n}\n\nfunc (m *MoreRepeated) GetInt64SPacked() []int64 {\n\tif m != nil {\n\t\treturn m.Int64SPacked\n\t}\n\treturn nil\n}\n\nfunc (m *MoreRepeated) GetStrings() []string {\n\tif m != nil {\n\t\treturn m.Strings\n\t}\n\treturn nil\n}\n\nfunc (m *MoreRepeated) GetFixeds() []uint32 {\n\tif m != nil {\n\t\treturn m.Fixeds\n\t}\n\treturn nil\n}\n\ntype GroupOld struct {\n\tG                    *GroupOld_G `protobuf:\"group,101,opt,name=G,json=g\" json:\"g,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}    `json:\"-\"`\n\tXXX_unrecognized     []byte      `json:\"-\"`\n\tXXX_sizecache        int32       `json:\"-\"`\n}\n\nfunc (m *GroupOld) Reset()         { *m = GroupOld{} }\nfunc (m *GroupOld) String() string { return proto.CompactTextString(m) }\nfunc (*GroupOld) ProtoMessage()    {}\nfunc (*GroupOld) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{24}\n}\n\nfunc (m *GroupOld) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GroupOld.Unmarshal(m, b)\n}\nfunc (m *GroupOld) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GroupOld.Marshal(b, m, deterministic)\n}\nfunc (m *GroupOld) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GroupOld.Merge(m, src)\n}\nfunc (m *GroupOld) XXX_Size() int {\n\treturn xxx_messageInfo_GroupOld.Size(m)\n}\nfunc (m *GroupOld) XXX_DiscardUnknown() {\n\txxx_messageInfo_GroupOld.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GroupOld proto.InternalMessageInfo\n\nfunc (m *GroupOld) GetG() *GroupOld_G {\n\tif m != nil {\n\t\treturn m.G\n\t}\n\treturn nil\n}\n\ntype GroupOld_G struct {\n\tX                    *int32   `protobuf:\"varint,2,opt,name=x\" json:\"x,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *GroupOld_G) Reset()         { *m = GroupOld_G{} }\nfunc (m *GroupOld_G) String() string { return proto.CompactTextString(m) }\nfunc (*GroupOld_G) ProtoMessage()    {}\nfunc (*GroupOld_G) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{24, 0}\n}\n\nfunc (m *GroupOld_G) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GroupOld_G.Unmarshal(m, b)\n}\nfunc (m *GroupOld_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GroupOld_G.Marshal(b, m, deterministic)\n}\nfunc (m *GroupOld_G) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GroupOld_G.Merge(m, src)\n}\nfunc (m *GroupOld_G) XXX_Size() int {\n\treturn xxx_messageInfo_GroupOld_G.Size(m)\n}\nfunc (m *GroupOld_G) XXX_DiscardUnknown() {\n\txxx_messageInfo_GroupOld_G.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GroupOld_G proto.InternalMessageInfo\n\nfunc (m *GroupOld_G) GetX() int32 {\n\tif m != nil && m.X != nil {\n\t\treturn *m.X\n\t}\n\treturn 0\n}\n\ntype GroupNew struct {\n\tG                    *GroupNew_G `protobuf:\"group,101,opt,name=G,json=g\" json:\"g,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}    `json:\"-\"`\n\tXXX_unrecognized     []byte      `json:\"-\"`\n\tXXX_sizecache        int32       `json:\"-\"`\n}\n\nfunc (m *GroupNew) Reset()         { *m = GroupNew{} }\nfunc (m *GroupNew) String() string { return proto.CompactTextString(m) }\nfunc (*GroupNew) ProtoMessage()    {}\nfunc (*GroupNew) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{25}\n}\n\nfunc (m *GroupNew) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GroupNew.Unmarshal(m, b)\n}\nfunc (m *GroupNew) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GroupNew.Marshal(b, m, deterministic)\n}\nfunc (m *GroupNew) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GroupNew.Merge(m, src)\n}\nfunc (m *GroupNew) XXX_Size() int {\n\treturn xxx_messageInfo_GroupNew.Size(m)\n}\nfunc (m *GroupNew) XXX_DiscardUnknown() {\n\txxx_messageInfo_GroupNew.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GroupNew proto.InternalMessageInfo\n\nfunc (m *GroupNew) GetG() *GroupNew_G {\n\tif m != nil {\n\t\treturn m.G\n\t}\n\treturn nil\n}\n\ntype GroupNew_G struct {\n\tX                    *int32   `protobuf:\"varint,2,opt,name=x\" json:\"x,omitempty\"`\n\tY                    *int32   `protobuf:\"varint,3,opt,name=y\" json:\"y,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *GroupNew_G) Reset()         { *m = GroupNew_G{} }\nfunc (m *GroupNew_G) String() string { return proto.CompactTextString(m) }\nfunc (*GroupNew_G) ProtoMessage()    {}\nfunc (*GroupNew_G) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{25, 0}\n}\n\nfunc (m *GroupNew_G) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_GroupNew_G.Unmarshal(m, b)\n}\nfunc (m *GroupNew_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_GroupNew_G.Marshal(b, m, deterministic)\n}\nfunc (m *GroupNew_G) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_GroupNew_G.Merge(m, src)\n}\nfunc (m *GroupNew_G) XXX_Size() int {\n\treturn xxx_messageInfo_GroupNew_G.Size(m)\n}\nfunc (m *GroupNew_G) XXX_DiscardUnknown() {\n\txxx_messageInfo_GroupNew_G.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_GroupNew_G proto.InternalMessageInfo\n\nfunc (m *GroupNew_G) GetX() int32 {\n\tif m != nil && m.X != nil {\n\t\treturn *m.X\n\t}\n\treturn 0\n}\n\nfunc (m *GroupNew_G) GetY() int32 {\n\tif m != nil && m.Y != nil {\n\t\treturn *m.Y\n\t}\n\treturn 0\n}\n\ntype FloatingPoint struct {\n\tF                    *float64 `protobuf:\"fixed64,1,req,name=f\" json:\"f,omitempty\"`\n\tExact                *bool    `protobuf:\"varint,2,opt,name=exact\" json:\"exact,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *FloatingPoint) Reset()         { *m = FloatingPoint{} }\nfunc (m *FloatingPoint) String() string { return proto.CompactTextString(m) }\nfunc (*FloatingPoint) ProtoMessage()    {}\nfunc (*FloatingPoint) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{26}\n}\n\nfunc (m *FloatingPoint) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_FloatingPoint.Unmarshal(m, b)\n}\nfunc (m *FloatingPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_FloatingPoint.Marshal(b, m, deterministic)\n}\nfunc (m *FloatingPoint) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_FloatingPoint.Merge(m, src)\n}\nfunc (m *FloatingPoint) XXX_Size() int {\n\treturn xxx_messageInfo_FloatingPoint.Size(m)\n}\nfunc (m *FloatingPoint) XXX_DiscardUnknown() {\n\txxx_messageInfo_FloatingPoint.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_FloatingPoint proto.InternalMessageInfo\n\nfunc (m *FloatingPoint) GetF() float64 {\n\tif m != nil && m.F != nil {\n\t\treturn *m.F\n\t}\n\treturn 0\n}\n\nfunc (m *FloatingPoint) GetExact() bool {\n\tif m != nil && m.Exact != nil {\n\t\treturn *m.Exact\n\t}\n\treturn false\n}\n\ntype MessageWithMap struct {\n\tNameMapping          map[int32]string         `protobuf:\"bytes,1,rep,name=name_mapping,json=nameMapping\" json:\"name_mapping,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tMsgMapping           map[int64]*FloatingPoint `protobuf:\"bytes,2,rep,name=msg_mapping,json=msgMapping\" json:\"msg_mapping,omitempty\" protobuf_key:\"zigzag64,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tByteMapping          map[bool][]byte          `protobuf:\"bytes,3,rep,name=byte_mapping,json=byteMapping\" json:\"byte_mapping,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tStrToStr             map[string]string        `protobuf:\"bytes,4,rep,name=str_to_str,json=strToStr\" json:\"str_to_str,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tXXX_NoUnkeyedLiteral struct{}                 `json:\"-\"`\n\tXXX_unrecognized     []byte                   `json:\"-\"`\n\tXXX_sizecache        int32                    `json:\"-\"`\n}\n\nfunc (m *MessageWithMap) Reset()         { *m = MessageWithMap{} }\nfunc (m *MessageWithMap) String() string { return proto.CompactTextString(m) }\nfunc (*MessageWithMap) ProtoMessage()    {}\nfunc (*MessageWithMap) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{27}\n}\n\nfunc (m *MessageWithMap) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_MessageWithMap.Unmarshal(m, b)\n}\nfunc (m *MessageWithMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_MessageWithMap.Marshal(b, m, deterministic)\n}\nfunc (m *MessageWithMap) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_MessageWithMap.Merge(m, src)\n}\nfunc (m *MessageWithMap) XXX_Size() int {\n\treturn xxx_messageInfo_MessageWithMap.Size(m)\n}\nfunc (m *MessageWithMap) XXX_DiscardUnknown() {\n\txxx_messageInfo_MessageWithMap.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_MessageWithMap proto.InternalMessageInfo\n\nfunc (m *MessageWithMap) GetNameMapping() map[int32]string {\n\tif m != nil {\n\t\treturn m.NameMapping\n\t}\n\treturn nil\n}\n\nfunc (m *MessageWithMap) GetMsgMapping() map[int64]*FloatingPoint {\n\tif m != nil {\n\t\treturn m.MsgMapping\n\t}\n\treturn nil\n}\n\nfunc (m *MessageWithMap) GetByteMapping() map[bool][]byte {\n\tif m != nil {\n\t\treturn m.ByteMapping\n\t}\n\treturn nil\n}\n\nfunc (m *MessageWithMap) GetStrToStr() map[string]string {\n\tif m != nil {\n\t\treturn m.StrToStr\n\t}\n\treturn nil\n}\n\ntype Oneof struct {\n\t// Types that are valid to be assigned to Union:\n\t//\t*Oneof_F_Bool\n\t//\t*Oneof_F_Int32\n\t//\t*Oneof_F_Int64\n\t//\t*Oneof_F_Fixed32\n\t//\t*Oneof_F_Fixed64\n\t//\t*Oneof_F_Uint32\n\t//\t*Oneof_F_Uint64\n\t//\t*Oneof_F_Float\n\t//\t*Oneof_F_Double\n\t//\t*Oneof_F_String\n\t//\t*Oneof_F_Bytes\n\t//\t*Oneof_F_Sint32\n\t//\t*Oneof_F_Sint64\n\t//\t*Oneof_F_Enum\n\t//\t*Oneof_F_Message\n\t//\t*Oneof_FGroup\n\t//\t*Oneof_F_Largest_Tag\n\tUnion isOneof_Union `protobuf_oneof:\"union\"`\n\t// Types that are valid to be assigned to Tormato:\n\t//\t*Oneof_Value\n\tTormato              isOneof_Tormato `protobuf_oneof:\"tormato\"`\n\tXXX_NoUnkeyedLiteral struct{}        `json:\"-\"`\n\tXXX_unrecognized     []byte          `json:\"-\"`\n\tXXX_sizecache        int32           `json:\"-\"`\n}\n\nfunc (m *Oneof) Reset()         { *m = Oneof{} }\nfunc (m *Oneof) String() string { return proto.CompactTextString(m) }\nfunc (*Oneof) ProtoMessage()    {}\nfunc (*Oneof) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{28}\n}\n\nfunc (m *Oneof) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Oneof.Unmarshal(m, b)\n}\nfunc (m *Oneof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Oneof.Marshal(b, m, deterministic)\n}\nfunc (m *Oneof) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Oneof.Merge(m, src)\n}\nfunc (m *Oneof) XXX_Size() int {\n\treturn xxx_messageInfo_Oneof.Size(m)\n}\nfunc (m *Oneof) XXX_DiscardUnknown() {\n\txxx_messageInfo_Oneof.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Oneof proto.InternalMessageInfo\n\ntype isOneof_Union interface {\n\tisOneof_Union()\n}\n\ntype Oneof_F_Bool struct {\n\tF_Bool bool `protobuf:\"varint,1,opt,name=F_Bool,json=FBool,oneof\"`\n}\n\ntype Oneof_F_Int32 struct {\n\tF_Int32 int32 `protobuf:\"varint,2,opt,name=F_Int32,json=FInt32,oneof\"`\n}\n\ntype Oneof_F_Int64 struct {\n\tF_Int64 int64 `protobuf:\"varint,3,opt,name=F_Int64,json=FInt64,oneof\"`\n}\n\ntype Oneof_F_Fixed32 struct {\n\tF_Fixed32 uint32 `protobuf:\"fixed32,4,opt,name=F_Fixed32,json=FFixed32,oneof\"`\n}\n\ntype Oneof_F_Fixed64 struct {\n\tF_Fixed64 uint64 `protobuf:\"fixed64,5,opt,name=F_Fixed64,json=FFixed64,oneof\"`\n}\n\ntype Oneof_F_Uint32 struct {\n\tF_Uint32 uint32 `protobuf:\"varint,6,opt,name=F_Uint32,json=FUint32,oneof\"`\n}\n\ntype Oneof_F_Uint64 struct {\n\tF_Uint64 uint64 `protobuf:\"varint,7,opt,name=F_Uint64,json=FUint64,oneof\"`\n}\n\ntype Oneof_F_Float struct {\n\tF_Float float32 `protobuf:\"fixed32,8,opt,name=F_Float,json=FFloat,oneof\"`\n}\n\ntype Oneof_F_Double struct {\n\tF_Double float64 `protobuf:\"fixed64,9,opt,name=F_Double,json=FDouble,oneof\"`\n}\n\ntype Oneof_F_String struct {\n\tF_String string `protobuf:\"bytes,10,opt,name=F_String,json=FString,oneof\"`\n}\n\ntype Oneof_F_Bytes struct {\n\tF_Bytes []byte `protobuf:\"bytes,11,opt,name=F_Bytes,json=FBytes,oneof\"`\n}\n\ntype Oneof_F_Sint32 struct {\n\tF_Sint32 int32 `protobuf:\"zigzag32,12,opt,name=F_Sint32,json=FSint32,oneof\"`\n}\n\ntype Oneof_F_Sint64 struct {\n\tF_Sint64 int64 `protobuf:\"zigzag64,13,opt,name=F_Sint64,json=FSint64,oneof\"`\n}\n\ntype Oneof_F_Enum struct {\n\tF_Enum MyMessage_Color `protobuf:\"varint,14,opt,name=F_Enum,json=FEnum,enum=proto2_test.MyMessage_Color,oneof\"`\n}\n\ntype Oneof_F_Message struct {\n\tF_Message *GoTestField `protobuf:\"bytes,15,opt,name=F_Message,json=FMessage,oneof\"`\n}\n\ntype Oneof_FGroup struct {\n\tFGroup *Oneof_F_Group `protobuf:\"group,16,opt,name=F_Group,json=fGroup,oneof\"`\n}\n\ntype Oneof_F_Largest_Tag struct {\n\tF_Largest_Tag int32 `protobuf:\"varint,536870911,opt,name=F_Largest_Tag,json=FLargestTag,oneof\"`\n}\n\nfunc (*Oneof_F_Bool) isOneof_Union() {}\n\nfunc (*Oneof_F_Int32) isOneof_Union() {}\n\nfunc (*Oneof_F_Int64) isOneof_Union() {}\n\nfunc (*Oneof_F_Fixed32) isOneof_Union() {}\n\nfunc (*Oneof_F_Fixed64) isOneof_Union() {}\n\nfunc (*Oneof_F_Uint32) isOneof_Union() {}\n\nfunc (*Oneof_F_Uint64) isOneof_Union() {}\n\nfunc (*Oneof_F_Float) isOneof_Union() {}\n\nfunc (*Oneof_F_Double) isOneof_Union() {}\n\nfunc (*Oneof_F_String) isOneof_Union() {}\n\nfunc (*Oneof_F_Bytes) isOneof_Union() {}\n\nfunc (*Oneof_F_Sint32) isOneof_Union() {}\n\nfunc (*Oneof_F_Sint64) isOneof_Union() {}\n\nfunc (*Oneof_F_Enum) isOneof_Union() {}\n\nfunc (*Oneof_F_Message) isOneof_Union() {}\n\nfunc (*Oneof_FGroup) isOneof_Union() {}\n\nfunc (*Oneof_F_Largest_Tag) isOneof_Union() {}\n\nfunc (m *Oneof) GetUnion() isOneof_Union {\n\tif m != nil {\n\t\treturn m.Union\n\t}\n\treturn nil\n}\n\nfunc (m *Oneof) GetF_Bool() bool {\n\tif x, ok := m.GetUnion().(*Oneof_F_Bool); ok {\n\t\treturn x.F_Bool\n\t}\n\treturn false\n}\n\nfunc (m *Oneof) GetF_Int32() int32 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Int32); ok {\n\t\treturn x.F_Int32\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Int64() int64 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Int64); ok {\n\t\treturn x.F_Int64\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Fixed32() uint32 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Fixed32); ok {\n\t\treturn x.F_Fixed32\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Fixed64() uint64 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Fixed64); ok {\n\t\treturn x.F_Fixed64\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Uint32() uint32 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Uint32); ok {\n\t\treturn x.F_Uint32\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Uint64() uint64 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Uint64); ok {\n\t\treturn x.F_Uint64\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Float() float32 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Float); ok {\n\t\treturn x.F_Float\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Double() float64 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Double); ok {\n\t\treturn x.F_Double\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_String() string {\n\tif x, ok := m.GetUnion().(*Oneof_F_String); ok {\n\t\treturn x.F_String\n\t}\n\treturn \"\"\n}\n\nfunc (m *Oneof) GetF_Bytes() []byte {\n\tif x, ok := m.GetUnion().(*Oneof_F_Bytes); ok {\n\t\treturn x.F_Bytes\n\t}\n\treturn nil\n}\n\nfunc (m *Oneof) GetF_Sint32() int32 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Sint32); ok {\n\t\treturn x.F_Sint32\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Sint64() int64 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Sint64); ok {\n\t\treturn x.F_Sint64\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Enum() MyMessage_Color {\n\tif x, ok := m.GetUnion().(*Oneof_F_Enum); ok {\n\t\treturn x.F_Enum\n\t}\n\treturn MyMessage_RED\n}\n\nfunc (m *Oneof) GetF_Message() *GoTestField {\n\tif x, ok := m.GetUnion().(*Oneof_F_Message); ok {\n\t\treturn x.F_Message\n\t}\n\treturn nil\n}\n\nfunc (m *Oneof) GetFGroup() *Oneof_F_Group {\n\tif x, ok := m.GetUnion().(*Oneof_FGroup); ok {\n\t\treturn x.FGroup\n\t}\n\treturn nil\n}\n\nfunc (m *Oneof) GetF_Largest_Tag() int32 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Largest_Tag); ok {\n\t\treturn x.F_Largest_Tag\n\t}\n\treturn 0\n}\n\ntype isOneof_Tormato interface {\n\tisOneof_Tormato()\n}\n\ntype Oneof_Value struct {\n\tValue int32 `protobuf:\"varint,100,opt,name=value,oneof\"`\n}\n\nfunc (*Oneof_Value) isOneof_Tormato() {}\n\nfunc (m *Oneof) GetTormato() isOneof_Tormato {\n\tif m != nil {\n\t\treturn m.Tormato\n\t}\n\treturn nil\n}\n\nfunc (m *Oneof) GetValue() int32 {\n\tif x, ok := m.GetTormato().(*Oneof_Value); ok {\n\t\treturn x.Value\n\t}\n\treturn 0\n}\n\n// XXX_OneofWrappers is for the internal use of the proto package.\nfunc (*Oneof) XXX_OneofWrappers() []interface{} {\n\treturn []interface{}{\n\t\t(*Oneof_F_Bool)(nil),\n\t\t(*Oneof_F_Int32)(nil),\n\t\t(*Oneof_F_Int64)(nil),\n\t\t(*Oneof_F_Fixed32)(nil),\n\t\t(*Oneof_F_Fixed64)(nil),\n\t\t(*Oneof_F_Uint32)(nil),\n\t\t(*Oneof_F_Uint64)(nil),\n\t\t(*Oneof_F_Float)(nil),\n\t\t(*Oneof_F_Double)(nil),\n\t\t(*Oneof_F_String)(nil),\n\t\t(*Oneof_F_Bytes)(nil),\n\t\t(*Oneof_F_Sint32)(nil),\n\t\t(*Oneof_F_Sint64)(nil),\n\t\t(*Oneof_F_Enum)(nil),\n\t\t(*Oneof_F_Message)(nil),\n\t\t(*Oneof_FGroup)(nil),\n\t\t(*Oneof_F_Largest_Tag)(nil),\n\t\t(*Oneof_Value)(nil),\n\t}\n}\n\ntype Oneof_F_Group struct {\n\tX                    *int32   `protobuf:\"varint,17,opt,name=x\" json:\"x,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *Oneof_F_Group) Reset()         { *m = Oneof_F_Group{} }\nfunc (m *Oneof_F_Group) String() string { return proto.CompactTextString(m) }\nfunc (*Oneof_F_Group) ProtoMessage()    {}\nfunc (*Oneof_F_Group) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{28, 0}\n}\n\nfunc (m *Oneof_F_Group) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Oneof_F_Group.Unmarshal(m, b)\n}\nfunc (m *Oneof_F_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Oneof_F_Group.Marshal(b, m, deterministic)\n}\nfunc (m *Oneof_F_Group) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Oneof_F_Group.Merge(m, src)\n}\nfunc (m *Oneof_F_Group) XXX_Size() int {\n\treturn xxx_messageInfo_Oneof_F_Group.Size(m)\n}\nfunc (m *Oneof_F_Group) XXX_DiscardUnknown() {\n\txxx_messageInfo_Oneof_F_Group.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Oneof_F_Group proto.InternalMessageInfo\n\nfunc (m *Oneof_F_Group) GetX() int32 {\n\tif m != nil && m.X != nil {\n\t\treturn *m.X\n\t}\n\treturn 0\n}\n\ntype Communique struct {\n\tMakeMeCry *bool `protobuf:\"varint,1,opt,name=make_me_cry,json=makeMeCry\" json:\"make_me_cry,omitempty\"`\n\t// This is a oneof, called \"union\".\n\t//\n\t// Types that are valid to be assigned to Union:\n\t//\t*Communique_Number\n\t//\t*Communique_Name\n\t//\t*Communique_Data\n\t//\t*Communique_TempC\n\t//\t*Communique_Col\n\t//\t*Communique_Msg\n\tUnion                isCommunique_Union `protobuf_oneof:\"union\"`\n\tXXX_NoUnkeyedLiteral struct{}           `json:\"-\"`\n\tXXX_unrecognized     []byte             `json:\"-\"`\n\tXXX_sizecache        int32              `json:\"-\"`\n}\n\nfunc (m *Communique) Reset()         { *m = Communique{} }\nfunc (m *Communique) String() string { return proto.CompactTextString(m) }\nfunc (*Communique) ProtoMessage()    {}\nfunc (*Communique) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{29}\n}\n\nfunc (m *Communique) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Communique.Unmarshal(m, b)\n}\nfunc (m *Communique) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Communique.Marshal(b, m, deterministic)\n}\nfunc (m *Communique) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Communique.Merge(m, src)\n}\nfunc (m *Communique) XXX_Size() int {\n\treturn xxx_messageInfo_Communique.Size(m)\n}\nfunc (m *Communique) XXX_DiscardUnknown() {\n\txxx_messageInfo_Communique.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Communique proto.InternalMessageInfo\n\nfunc (m *Communique) GetMakeMeCry() bool {\n\tif m != nil && m.MakeMeCry != nil {\n\t\treturn *m.MakeMeCry\n\t}\n\treturn false\n}\n\ntype isCommunique_Union interface {\n\tisCommunique_Union()\n}\n\ntype Communique_Number struct {\n\tNumber int32 `protobuf:\"varint,5,opt,name=number,oneof\"`\n}\n\ntype Communique_Name struct {\n\tName string `protobuf:\"bytes,6,opt,name=name,oneof\"`\n}\n\ntype Communique_Data struct {\n\tData []byte `protobuf:\"bytes,7,opt,name=data,oneof\"`\n}\n\ntype Communique_TempC struct {\n\tTempC float64 `protobuf:\"fixed64,8,opt,name=temp_c,json=tempC,oneof\"`\n}\n\ntype Communique_Col struct {\n\tCol MyMessage_Color `protobuf:\"varint,9,opt,name=col,enum=proto2_test.MyMessage_Color,oneof\"`\n}\n\ntype Communique_Msg struct {\n\tMsg *Strings `protobuf:\"bytes,10,opt,name=msg,oneof\"`\n}\n\nfunc (*Communique_Number) isCommunique_Union() {}\n\nfunc (*Communique_Name) isCommunique_Union() {}\n\nfunc (*Communique_Data) isCommunique_Union() {}\n\nfunc (*Communique_TempC) isCommunique_Union() {}\n\nfunc (*Communique_Col) isCommunique_Union() {}\n\nfunc (*Communique_Msg) isCommunique_Union() {}\n\nfunc (m *Communique) GetUnion() isCommunique_Union {\n\tif m != nil {\n\t\treturn m.Union\n\t}\n\treturn nil\n}\n\nfunc (m *Communique) GetNumber() int32 {\n\tif x, ok := m.GetUnion().(*Communique_Number); ok {\n\t\treturn x.Number\n\t}\n\treturn 0\n}\n\nfunc (m *Communique) GetName() string {\n\tif x, ok := m.GetUnion().(*Communique_Name); ok {\n\t\treturn x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *Communique) GetData() []byte {\n\tif x, ok := m.GetUnion().(*Communique_Data); ok {\n\t\treturn x.Data\n\t}\n\treturn nil\n}\n\nfunc (m *Communique) GetTempC() float64 {\n\tif x, ok := m.GetUnion().(*Communique_TempC); ok {\n\t\treturn x.TempC\n\t}\n\treturn 0\n}\n\nfunc (m *Communique) GetCol() MyMessage_Color {\n\tif x, ok := m.GetUnion().(*Communique_Col); ok {\n\t\treturn x.Col\n\t}\n\treturn MyMessage_RED\n}\n\nfunc (m *Communique) GetMsg() *Strings {\n\tif x, ok := m.GetUnion().(*Communique_Msg); ok {\n\t\treturn x.Msg\n\t}\n\treturn nil\n}\n\n// XXX_OneofWrappers is for the internal use of the proto package.\nfunc (*Communique) XXX_OneofWrappers() []interface{} {\n\treturn []interface{}{\n\t\t(*Communique_Number)(nil),\n\t\t(*Communique_Name)(nil),\n\t\t(*Communique_Data)(nil),\n\t\t(*Communique_TempC)(nil),\n\t\t(*Communique_Col)(nil),\n\t\t(*Communique_Msg)(nil),\n\t}\n}\n\ntype TestUTF8 struct {\n\tScalar *string  `protobuf:\"bytes,1,opt,name=scalar\" json:\"scalar,omitempty\"`\n\tVector []string `protobuf:\"bytes,2,rep,name=vector\" json:\"vector,omitempty\"`\n\t// Types that are valid to be assigned to Oneof:\n\t//\t*TestUTF8_Field\n\tOneof                isTestUTF8_Oneof `protobuf_oneof:\"oneof\"`\n\tMapKey               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\"`\n\tMapValue             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\"`\n\tXXX_NoUnkeyedLiteral struct{}         `json:\"-\"`\n\tXXX_unrecognized     []byte           `json:\"-\"`\n\tXXX_sizecache        int32            `json:\"-\"`\n}\n\nfunc (m *TestUTF8) Reset()         { *m = TestUTF8{} }\nfunc (m *TestUTF8) String() string { return proto.CompactTextString(m) }\nfunc (*TestUTF8) ProtoMessage()    {}\nfunc (*TestUTF8) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_e5b3e7ca68f98362, []int{30}\n}\n\nfunc (m *TestUTF8) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_TestUTF8.Unmarshal(m, b)\n}\nfunc (m *TestUTF8) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_TestUTF8.Marshal(b, m, deterministic)\n}\nfunc (m *TestUTF8) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_TestUTF8.Merge(m, src)\n}\nfunc (m *TestUTF8) XXX_Size() int {\n\treturn xxx_messageInfo_TestUTF8.Size(m)\n}\nfunc (m *TestUTF8) XXX_DiscardUnknown() {\n\txxx_messageInfo_TestUTF8.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_TestUTF8 proto.InternalMessageInfo\n\nfunc (m *TestUTF8) GetScalar() string {\n\tif m != nil && m.Scalar != nil {\n\t\treturn *m.Scalar\n\t}\n\treturn \"\"\n}\n\nfunc (m *TestUTF8) GetVector() []string {\n\tif m != nil {\n\t\treturn m.Vector\n\t}\n\treturn nil\n}\n\ntype isTestUTF8_Oneof interface {\n\tisTestUTF8_Oneof()\n}\n\ntype TestUTF8_Field struct {\n\tField string `protobuf:\"bytes,3,opt,name=field,oneof\"`\n}\n\nfunc (*TestUTF8_Field) isTestUTF8_Oneof() {}\n\nfunc (m *TestUTF8) GetOneof() isTestUTF8_Oneof {\n\tif m != nil {\n\t\treturn m.Oneof\n\t}\n\treturn nil\n}\n\nfunc (m *TestUTF8) GetField() string {\n\tif x, ok := m.GetOneof().(*TestUTF8_Field); ok {\n\t\treturn x.Field\n\t}\n\treturn \"\"\n}\n\nfunc (m *TestUTF8) GetMapKey() map[string]int64 {\n\tif m != nil {\n\t\treturn m.MapKey\n\t}\n\treturn nil\n}\n\nfunc (m *TestUTF8) GetMapValue() map[int64]string {\n\tif m != nil {\n\t\treturn m.MapValue\n\t}\n\treturn nil\n}\n\n// XXX_OneofWrappers is for the internal use of the proto package.\nfunc (*TestUTF8) XXX_OneofWrappers() []interface{} {\n\treturn []interface{}{\n\t\t(*TestUTF8_Field)(nil),\n\t}\n}\n\nvar E_Greeting = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessage)(nil),\n\tExtensionType: ([]string)(nil),\n\tField:         106,\n\tName:          \"proto2_test.greeting\",\n\tTag:           \"bytes,106,rep,name=greeting\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_Complex = &proto.ExtensionDesc{\n\tExtendedType:  (*OtherMessage)(nil),\n\tExtensionType: (*ComplexExtension)(nil),\n\tField:         200,\n\tName:          \"proto2_test.complex\",\n\tTag:           \"bytes,200,opt,name=complex\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_RComplex = &proto.ExtensionDesc{\n\tExtendedType:  (*OtherMessage)(nil),\n\tExtensionType: ([]*ComplexExtension)(nil),\n\tField:         201,\n\tName:          \"proto2_test.r_complex\",\n\tTag:           \"bytes,201,rep,name=r_complex\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultDouble = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*float64)(nil),\n\tField:         101,\n\tName:          \"proto2_test.no_default_double\",\n\tTag:           \"fixed64,101,opt,name=no_default_double\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultFloat = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*float32)(nil),\n\tField:         102,\n\tName:          \"proto2_test.no_default_float\",\n\tTag:           \"fixed32,102,opt,name=no_default_float\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultInt32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         103,\n\tName:          \"proto2_test.no_default_int32\",\n\tTag:           \"varint,103,opt,name=no_default_int32\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultInt64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int64)(nil),\n\tField:         104,\n\tName:          \"proto2_test.no_default_int64\",\n\tTag:           \"varint,104,opt,name=no_default_int64\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultUint32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint32)(nil),\n\tField:         105,\n\tName:          \"proto2_test.no_default_uint32\",\n\tTag:           \"varint,105,opt,name=no_default_uint32\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultUint64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint64)(nil),\n\tField:         106,\n\tName:          \"proto2_test.no_default_uint64\",\n\tTag:           \"varint,106,opt,name=no_default_uint64\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultSint32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         107,\n\tName:          \"proto2_test.no_default_sint32\",\n\tTag:           \"zigzag32,107,opt,name=no_default_sint32\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultSint64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int64)(nil),\n\tField:         108,\n\tName:          \"proto2_test.no_default_sint64\",\n\tTag:           \"zigzag64,108,opt,name=no_default_sint64\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultFixed32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint32)(nil),\n\tField:         109,\n\tName:          \"proto2_test.no_default_fixed32\",\n\tTag:           \"fixed32,109,opt,name=no_default_fixed32\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultFixed64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint64)(nil),\n\tField:         110,\n\tName:          \"proto2_test.no_default_fixed64\",\n\tTag:           \"fixed64,110,opt,name=no_default_fixed64\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultSfixed32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         111,\n\tName:          \"proto2_test.no_default_sfixed32\",\n\tTag:           \"fixed32,111,opt,name=no_default_sfixed32\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultSfixed64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int64)(nil),\n\tField:         112,\n\tName:          \"proto2_test.no_default_sfixed64\",\n\tTag:           \"fixed64,112,opt,name=no_default_sfixed64\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultBool = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*bool)(nil),\n\tField:         113,\n\tName:          \"proto2_test.no_default_bool\",\n\tTag:           \"varint,113,opt,name=no_default_bool\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultString = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*string)(nil),\n\tField:         114,\n\tName:          \"proto2_test.no_default_string\",\n\tTag:           \"bytes,114,opt,name=no_default_string\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultBytes = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: ([]byte)(nil),\n\tField:         115,\n\tName:          \"proto2_test.no_default_bytes\",\n\tTag:           \"bytes,115,opt,name=no_default_bytes\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_NoDefaultEnum = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*DefaultsMessage_DefaultsEnum)(nil),\n\tField:         116,\n\tName:          \"proto2_test.no_default_enum\",\n\tTag:           \"varint,116,opt,name=no_default_enum,enum=proto2_test.DefaultsMessage_DefaultsEnum\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultDouble = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*float64)(nil),\n\tField:         201,\n\tName:          \"proto2_test.default_double\",\n\tTag:           \"fixed64,201,opt,name=default_double,def=3.1415\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultFloat = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*float32)(nil),\n\tField:         202,\n\tName:          \"proto2_test.default_float\",\n\tTag:           \"fixed32,202,opt,name=default_float,def=3.14\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultInt32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         203,\n\tName:          \"proto2_test.default_int32\",\n\tTag:           \"varint,203,opt,name=default_int32,def=42\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultInt64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int64)(nil),\n\tField:         204,\n\tName:          \"proto2_test.default_int64\",\n\tTag:           \"varint,204,opt,name=default_int64,def=43\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultUint32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint32)(nil),\n\tField:         205,\n\tName:          \"proto2_test.default_uint32\",\n\tTag:           \"varint,205,opt,name=default_uint32,def=44\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultUint64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint64)(nil),\n\tField:         206,\n\tName:          \"proto2_test.default_uint64\",\n\tTag:           \"varint,206,opt,name=default_uint64,def=45\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultSint32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         207,\n\tName:          \"proto2_test.default_sint32\",\n\tTag:           \"zigzag32,207,opt,name=default_sint32,def=46\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultSint64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int64)(nil),\n\tField:         208,\n\tName:          \"proto2_test.default_sint64\",\n\tTag:           \"zigzag64,208,opt,name=default_sint64,def=47\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultFixed32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint32)(nil),\n\tField:         209,\n\tName:          \"proto2_test.default_fixed32\",\n\tTag:           \"fixed32,209,opt,name=default_fixed32,def=48\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultFixed64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint64)(nil),\n\tField:         210,\n\tName:          \"proto2_test.default_fixed64\",\n\tTag:           \"fixed64,210,opt,name=default_fixed64,def=49\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultSfixed32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         211,\n\tName:          \"proto2_test.default_sfixed32\",\n\tTag:           \"fixed32,211,opt,name=default_sfixed32,def=50\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultSfixed64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int64)(nil),\n\tField:         212,\n\tName:          \"proto2_test.default_sfixed64\",\n\tTag:           \"fixed64,212,opt,name=default_sfixed64,def=51\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultBool = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*bool)(nil),\n\tField:         213,\n\tName:          \"proto2_test.default_bool\",\n\tTag:           \"varint,213,opt,name=default_bool,def=1\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultString = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*string)(nil),\n\tField:         214,\n\tName:          \"proto2_test.default_string\",\n\tTag:           \"bytes,214,opt,name=default_string,def=Hello, string,def=foo\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultBytes = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: ([]byte)(nil),\n\tField:         215,\n\tName:          \"proto2_test.default_bytes\",\n\tTag:           \"bytes,215,opt,name=default_bytes,def=Hello, bytes\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nvar E_DefaultEnum = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*DefaultsMessage_DefaultsEnum)(nil),\n\tField:         216,\n\tName:          \"proto2_test.default_enum\",\n\tTag:           \"varint,216,opt,name=default_enum,enum=proto2_test.DefaultsMessage_DefaultsEnum,def=1\",\n\tFilename:      \"proto2_proto/test.proto\",\n}\n\nfunc init() {\n\tproto.RegisterEnum(\"proto2_test.FOO\", FOO_name, FOO_value)\n\tproto.RegisterEnum(\"proto2_test.GoTest_KIND\", GoTest_KIND_name, GoTest_KIND_value)\n\tproto.RegisterEnum(\"proto2_test.MyMessage_Color\", MyMessage_Color_name, MyMessage_Color_value)\n\tproto.RegisterEnum(\"proto2_test.DefaultsMessage_DefaultsEnum\", DefaultsMessage_DefaultsEnum_name, DefaultsMessage_DefaultsEnum_value)\n\tproto.RegisterEnum(\"proto2_test.Defaults_Color\", Defaults_Color_name, Defaults_Color_value)\n\tproto.RegisterEnum(\"proto2_test.RepeatedEnum_Color\", RepeatedEnum_Color_name, RepeatedEnum_Color_value)\n\tproto.RegisterType((*GoEnum)(nil), \"proto2_test.GoEnum\")\n\tproto.RegisterType((*GoTestField)(nil), \"proto2_test.GoTestField\")\n\tproto.RegisterType((*GoTest)(nil), \"proto2_test.GoTest\")\n\tproto.RegisterType((*GoTest_RequiredGroup)(nil), \"proto2_test.GoTest.RequiredGroup\")\n\tproto.RegisterType((*GoTest_RepeatedGroup)(nil), \"proto2_test.GoTest.RepeatedGroup\")\n\tproto.RegisterType((*GoTest_OptionalGroup)(nil), \"proto2_test.GoTest.OptionalGroup\")\n\tproto.RegisterType((*GoTestRequiredGroupField)(nil), \"proto2_test.GoTestRequiredGroupField\")\n\tproto.RegisterType((*GoTestRequiredGroupField_Group)(nil), \"proto2_test.GoTestRequiredGroupField.Group\")\n\tproto.RegisterType((*GoSkipTest)(nil), \"proto2_test.GoSkipTest\")\n\tproto.RegisterType((*GoSkipTest_SkipGroup)(nil), \"proto2_test.GoSkipTest.SkipGroup\")\n\tproto.RegisterType((*NonPackedTest)(nil), \"proto2_test.NonPackedTest\")\n\tproto.RegisterType((*PackedTest)(nil), \"proto2_test.PackedTest\")\n\tproto.RegisterType((*MaxTag)(nil), \"proto2_test.MaxTag\")\n\tproto.RegisterType((*OldMessage)(nil), \"proto2_test.OldMessage\")\n\tproto.RegisterType((*OldMessage_Nested)(nil), \"proto2_test.OldMessage.Nested\")\n\tproto.RegisterType((*NewMessage)(nil), \"proto2_test.NewMessage\")\n\tproto.RegisterType((*NewMessage_Nested)(nil), \"proto2_test.NewMessage.Nested\")\n\tproto.RegisterType((*InnerMessage)(nil), \"proto2_test.InnerMessage\")\n\tproto.RegisterType((*OtherMessage)(nil), \"proto2_test.OtherMessage\")\n\tproto.RegisterType((*RequiredInnerMessage)(nil), \"proto2_test.RequiredInnerMessage\")\n\tproto.RegisterType((*MyMessage)(nil), \"proto2_test.MyMessage\")\n\tproto.RegisterType((*MyMessage_SomeGroup)(nil), \"proto2_test.MyMessage.SomeGroup\")\n\tproto.RegisterExtension(E_Ext_More)\n\tproto.RegisterExtension(E_Ext_Text)\n\tproto.RegisterExtension(E_Ext_Number)\n\tproto.RegisterType((*Ext)(nil), \"proto2_test.Ext\")\n\tproto.RegisterMapType((map[int32]int32)(nil), \"proto2_test.Ext.MapFieldEntry\")\n\tproto.RegisterType((*ComplexExtension)(nil), \"proto2_test.ComplexExtension\")\n\tproto.RegisterType((*DefaultsMessage)(nil), \"proto2_test.DefaultsMessage\")\n\tproto.RegisterType((*Empty)(nil), \"proto2_test.Empty\")\n\tproto.RegisterType((*MessageList)(nil), \"proto2_test.MessageList\")\n\tproto.RegisterType((*MessageList_Message)(nil), \"proto2_test.MessageList.Message\")\n\tproto.RegisterType((*Strings)(nil), \"proto2_test.Strings\")\n\tproto.RegisterType((*Defaults)(nil), \"proto2_test.Defaults\")\n\tproto.RegisterType((*SubDefaults)(nil), \"proto2_test.SubDefaults\")\n\tproto.RegisterType((*RepeatedEnum)(nil), \"proto2_test.RepeatedEnum\")\n\tproto.RegisterType((*MoreRepeated)(nil), \"proto2_test.MoreRepeated\")\n\tproto.RegisterType((*GroupOld)(nil), \"proto2_test.GroupOld\")\n\tproto.RegisterType((*GroupOld_G)(nil), \"proto2_test.GroupOld.G\")\n\tproto.RegisterType((*GroupNew)(nil), \"proto2_test.GroupNew\")\n\tproto.RegisterType((*GroupNew_G)(nil), \"proto2_test.GroupNew.G\")\n\tproto.RegisterType((*FloatingPoint)(nil), \"proto2_test.FloatingPoint\")\n\tproto.RegisterType((*MessageWithMap)(nil), \"proto2_test.MessageWithMap\")\n\tproto.RegisterMapType((map[bool][]byte)(nil), \"proto2_test.MessageWithMap.ByteMappingEntry\")\n\tproto.RegisterMapType((map[int64]*FloatingPoint)(nil), \"proto2_test.MessageWithMap.MsgMappingEntry\")\n\tproto.RegisterMapType((map[int32]string)(nil), \"proto2_test.MessageWithMap.NameMappingEntry\")\n\tproto.RegisterMapType((map[string]string)(nil), \"proto2_test.MessageWithMap.StrToStrEntry\")\n\tproto.RegisterType((*Oneof)(nil), \"proto2_test.Oneof\")\n\tproto.RegisterType((*Oneof_F_Group)(nil), \"proto2_test.Oneof.F_Group\")\n\tproto.RegisterType((*Communique)(nil), \"proto2_test.Communique\")\n\tproto.RegisterType((*TestUTF8)(nil), \"proto2_test.TestUTF8\")\n\tproto.RegisterMapType((map[string]int64)(nil), \"proto2_test.TestUTF8.MapKeyEntry\")\n\tproto.RegisterMapType((map[int64]string)(nil), \"proto2_test.TestUTF8.MapValueEntry\")\n\tproto.RegisterExtension(E_Greeting)\n\tproto.RegisterExtension(E_Complex)\n\tproto.RegisterExtension(E_RComplex)\n\tproto.RegisterExtension(E_NoDefaultDouble)\n\tproto.RegisterExtension(E_NoDefaultFloat)\n\tproto.RegisterExtension(E_NoDefaultInt32)\n\tproto.RegisterExtension(E_NoDefaultInt64)\n\tproto.RegisterExtension(E_NoDefaultUint32)\n\tproto.RegisterExtension(E_NoDefaultUint64)\n\tproto.RegisterExtension(E_NoDefaultSint32)\n\tproto.RegisterExtension(E_NoDefaultSint64)\n\tproto.RegisterExtension(E_NoDefaultFixed32)\n\tproto.RegisterExtension(E_NoDefaultFixed64)\n\tproto.RegisterExtension(E_NoDefaultSfixed32)\n\tproto.RegisterExtension(E_NoDefaultSfixed64)\n\tproto.RegisterExtension(E_NoDefaultBool)\n\tproto.RegisterExtension(E_NoDefaultString)\n\tproto.RegisterExtension(E_NoDefaultBytes)\n\tproto.RegisterExtension(E_NoDefaultEnum)\n\tproto.RegisterExtension(E_DefaultDouble)\n\tproto.RegisterExtension(E_DefaultFloat)\n\tproto.RegisterExtension(E_DefaultInt32)\n\tproto.RegisterExtension(E_DefaultInt64)\n\tproto.RegisterExtension(E_DefaultUint32)\n\tproto.RegisterExtension(E_DefaultUint64)\n\tproto.RegisterExtension(E_DefaultSint32)\n\tproto.RegisterExtension(E_DefaultSint64)\n\tproto.RegisterExtension(E_DefaultFixed32)\n\tproto.RegisterExtension(E_DefaultFixed64)\n\tproto.RegisterExtension(E_DefaultSfixed32)\n\tproto.RegisterExtension(E_DefaultSfixed64)\n\tproto.RegisterExtension(E_DefaultBool)\n\tproto.RegisterExtension(E_DefaultString)\n\tproto.RegisterExtension(E_DefaultBytes)\n\tproto.RegisterExtension(E_DefaultEnum)\n}\n\nfunc init() { proto.RegisterFile(\"proto2_proto/test.proto\", fileDescriptor_e5b3e7ca68f98362) }\n\nvar fileDescriptor_e5b3e7ca68f98362 = []byte{\n\t// 4330 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5b, 0x4b, 0x73, 0xdb, 0x58,\n\t0x76, 0x36, 0xc0, 0xf7, 0x21, 0x25, 0x42, 0xb7, 0xd5, 0x36, 0x2d, 0xb5, 0x6d, 0x98, 0x3d, 0x3d,\n\t0xc3, 0xb6, 0xdd, 0xb4, 0x4c, 0x51, 0xb4, 0x4d, 0x4f, 0x3b, 0x63, 0xd9, 0xa2, 0xac, 0xb4, 0x24,\n\t0x7a, 0x20, 0xb9, 0xbb, 0xda, 0xb3, 0x60, 0x41, 0x22, 0x48, 0x71, 0x4c, 0x02, 0x6c, 0x12, 0x1c,\n\t0x4b, 0xa9, 0x54, 0xaa, 0xb7, 0xd9, 0xa4, 0x2a, 0x99, 0xa4, 0x2a, 0x3f, 0x20, 0xdb, 0xc9, 0x63,\n\t0x97, 0x45, 0x7e, 0x40, 0x7a, 0x1e, 0x49, 0x26, 0xef, 0xac, 0x52, 0xf9, 0x07, 0x59, 0xe5, 0xb1,\n\t0xea, 0xa9, 0x73, 0xee, 0x05, 0x70, 0x01, 0x52, 0xaf, 0x95, 0x70, 0xef, 0xfd, 0xbe, 0x73, 0x5f,\n\t0x1f, 0xce, 0x39, 0xf7, 0x12, 0x82, 0x6b, 0xc3, 0x91, 0xe3, 0x3a, 0x95, 0x16, 0xfd, 0xb9, 0xef,\n\t0x5a, 0x63, 0xb7, 0x4c, 0x8f, 0x2c, 0x2b, 0x1a, 0xb0, 0xaa, 0x78, 0x0f, 0x92, 0x9b, 0xce, 0x86,\n\t0x3d, 0x19, 0xb0, 0x22, 0xc4, 0x3a, 0x8e, 0x53, 0x50, 0x74, 0xb5, 0x34, 0x5f, 0xd1, 0xca, 0x12,\n\t0xa8, 0xdc, 0x68, 0x36, 0x0d, 0x6c, 0x2c, 0x3e, 0x84, 0xec, 0xa6, 0xb3, 0x6f, 0x8d, 0xdd, 0x46,\n\t0xcf, 0xea, 0xb7, 0xd9, 0x22, 0x24, 0xb6, 0xcd, 0x03, 0xab, 0x4f, 0xa4, 0x8c, 0xc1, 0x0b, 0x8c,\n\t0x41, 0x7c, 0xff, 0x64, 0x68, 0x15, 0x54, 0xaa, 0xa4, 0xe7, 0xe2, 0xdf, 0x14, 0xb1, 0x1f, 0x64,\n\t0xb2, 0x7b, 0x10, 0xff, 0xac, 0x67, 0xb7, 0x45, 0x47, 0x85, 0x50, 0x47, 0x1c, 0x52, 0xfe, 0x6c,\n\t0x6b, 0xf7, 0x85, 0x41, 0x28, 0xec, 0x62, 0xdf, 0x3c, 0xe8, 0xa3, 0x35, 0x05, 0xbb, 0xa0, 0x02,\n\t0xd6, 0xbe, 0x32, 0x47, 0xe6, 0xa0, 0x10, 0xd3, 0x95, 0x52, 0xc2, 0xe0, 0x05, 0xf6, 0x14, 0xe6,\n\t0x0c, 0xeb, 0xab, 0x49, 0x6f, 0x64, 0xb5, 0x69, 0x7c, 0x85, 0xb8, 0xae, 0x96, 0xb2, 0x33, 0xbb,\n\t0xa0, 0x76, 0x23, 0x0c, 0xe7, 0xfc, 0xa1, 0x65, 0xba, 0x1e, 0x3f, 0xa1, 0xc7, 0xce, 0xe3, 0x4b,\n\t0x70, 0xe4, 0x37, 0x87, 0x6e, 0xcf, 0xb1, 0xcd, 0x3e, 0xe7, 0x27, 0x75, 0xe5, 0x6c, 0x7e, 0x08,\n\t0xce, 0xbe, 0x0b, 0xf9, 0x46, 0x6b, 0xdd, 0x71, 0xfa, 0xad, 0x91, 0x18, 0x57, 0x01, 0x74, 0xb5,\n\t0x94, 0x36, 0xe6, 0x1a, 0x58, 0xeb, 0x0d, 0x96, 0x95, 0x40, 0x6b, 0xb4, 0xb6, 0x6c, 0x77, 0xb5,\n\t0x12, 0x00, 0xb3, 0xba, 0x5a, 0x4a, 0x18, 0xf3, 0x0d, 0xaa, 0x9e, 0x42, 0xd6, 0xaa, 0x01, 0x32,\n\t0xa7, 0xab, 0xa5, 0x18, 0x47, 0xd6, 0xaa, 0x3e, 0xf2, 0x1e, 0xb0, 0x46, 0xab, 0xd1, 0x3b, 0xb6,\n\t0xda, 0xb2, 0xd5, 0x39, 0x5d, 0x2d, 0xa5, 0x0c, 0xad, 0x21, 0x1a, 0x66, 0xa0, 0x65, 0xcb, 0xf3,\n\t0xba, 0x5a, 0x4a, 0x7a, 0x68, 0xc9, 0xf6, 0x1d, 0x58, 0x68, 0xb4, 0x5e, 0xf7, 0xc2, 0x03, 0xce,\n\t0xeb, 0x6a, 0x69, 0xce, 0xc8, 0x37, 0x78, 0xfd, 0x34, 0x56, 0x36, 0xac, 0xe9, 0x6a, 0x29, 0x2e,\n\t0xb0, 0x92, 0x5d, 0x9a, 0x5d, 0xa3, 0xef, 0x98, 0x6e, 0x00, 0x5d, 0xd0, 0xd5, 0x92, 0x6a, 0xcc,\n\t0x37, 0xa8, 0x3a, 0x6c, 0xf5, 0x85, 0x33, 0x39, 0xe8, 0x5b, 0x01, 0x94, 0xe9, 0x6a, 0x49, 0x31,\n\t0xf2, 0x0d, 0x5e, 0x1f, 0xc6, 0xee, 0xb9, 0xa3, 0x9e, 0xdd, 0x0d, 0xb0, 0xef, 0x91, 0x96, 0xf3,\n\t0x0d, 0x5e, 0x1f, 0x1e, 0xc1, 0xfa, 0x89, 0x6b, 0x8d, 0x03, 0xa8, 0xa5, 0xab, 0xa5, 0x9c, 0x31,\n\t0xdf, 0xa0, 0xea, 0x88, 0xd5, 0xc8, 0x1a, 0x74, 0x74, 0xb5, 0xb4, 0x80, 0x56, 0x67, 0xac, 0xc1,\n\t0x5e, 0x64, 0x0d, 0xba, 0xba, 0x5a, 0x62, 0x02, 0x2b, 0xad, 0x41, 0x19, 0xde, 0x6b, 0xb4, 0xf6,\n\t0x3a, 0xd1, 0x8d, 0x3b, 0xd2, 0xd5, 0x52, 0xde, 0x58, 0x68, 0x78, 0x2d, 0xb3, 0xf0, 0xb2, 0xf5,\n\t0x9e, 0xae, 0x96, 0x34, 0x1f, 0x2f, 0xd9, 0x97, 0x35, 0xc9, 0xb5, 0x5e, 0x58, 0xd4, 0x63, 0x92,\n\t0x26, 0x79, 0x65, 0x58, 0x93, 0x02, 0xf8, 0xbe, 0x1e, 0x93, 0x35, 0x19, 0x41, 0x52, 0xf7, 0x02,\n\t0x79, 0x55, 0x8f, 0xc9, 0x9a, 0x14, 0xc8, 0x88, 0x26, 0x05, 0xf6, 0x9a, 0x1e, 0x0b, 0x6b, 0x72,\n\t0x0a, 0x2d, 0x5b, 0x2e, 0xe8, 0xb1, 0xb0, 0x26, 0x05, 0x3a, 0xac, 0x49, 0x01, 0xbe, 0xae, 0xc7,\n\t0x42, 0x9a, 0x8c, 0x62, 0x65, 0xc3, 0x4b, 0x7a, 0x2c, 0xa4, 0x49, 0x79, 0x76, 0x9e, 0x26, 0x05,\n\t0x74, 0x59, 0x8f, 0xc9, 0x9a, 0x94, 0xad, 0xfa, 0x9a, 0x14, 0xd0, 0x0f, 0xf4, 0x58, 0x48, 0x93,\n\t0x32, 0xd6, 0xd7, 0xa4, 0xc0, 0xde, 0xd0, 0x63, 0x21, 0x4d, 0x0a, 0xec, 0xc7, 0xb2, 0x26, 0x05,\n\t0xf4, 0x1b, 0x45, 0x8f, 0xc9, 0xa2, 0x14, 0xd0, 0xbb, 0x21, 0x51, 0x0a, 0xec, 0xcf, 0x11, 0x2b,\n\t0xab, 0x32, 0x0a, 0x96, 0x57, 0xe1, 0x17, 0x08, 0x96, 0x65, 0x29, 0xc0, 0xf7, 0x23, 0xb2, 0x14,\n\t0xf0, 0x5f, 0x22, 0x3c, 0xac, 0xcb, 0x69, 0x82, 0x6c, 0xff, 0x57, 0x48, 0x08, 0x0b, 0x53, 0x10,\n\t0x02, 0x61, 0x3a, 0xc2, 0x89, 0x16, 0x6e, 0xea, 0x8a, 0x2f, 0x4c, 0xcf, 0xb3, 0xca, 0xc2, 0xf4,\n\t0x81, 0xb7, 0x28, 0x6a, 0x08, 0x61, 0x4e, 0x21, 0x6b, 0xd5, 0x00, 0xa9, 0xeb, 0x4a, 0x20, 0x4c,\n\t0x1f, 0x19, 0x12, 0xa6, 0x8f, 0xbd, 0xad, 0x2b, 0xb2, 0x30, 0x67, 0xa0, 0x65, 0xcb, 0x45, 0x5d,\n\t0x91, 0x85, 0xe9, 0xa3, 0x65, 0x61, 0xfa, 0xe0, 0x0f, 0x75, 0x45, 0x12, 0xe6, 0x34, 0x56, 0x36,\n\t0xfc, 0x1d, 0x5d, 0x91, 0x84, 0x19, 0x9e, 0x1d, 0x17, 0xa6, 0x0f, 0xfd, 0x48, 0x57, 0x02, 0x61,\n\t0x86, 0xad, 0x0a, 0x61, 0xfa, 0xd0, 0xef, 0xea, 0x8a, 0x24, 0xcc, 0x30, 0x56, 0x08, 0xd3, 0xc7,\n\t0x7e, 0x8f, 0x42, 0xb5, 0x27, 0x4c, 0x1f, 0x2b, 0x09, 0xd3, 0x87, 0xfe, 0x0c, 0xc3, 0xba, 0x2f,\n\t0x4c, 0x1f, 0x2a, 0x0b, 0xd3, 0xc7, 0xfe, 0x39, 0x62, 0x03, 0x61, 0x4e, 0x83, 0xe5, 0x55, 0xf8,\n\t0x0b, 0x04, 0x07, 0xc2, 0xf4, 0xc1, 0x61, 0x61, 0xfa, 0xf0, 0xbf, 0x44, 0xb8, 0x2c, 0xcc, 0x59,\n\t0x04, 0xd9, 0xfe, 0x5f, 0x21, 0x41, 0x16, 0xa6, 0x4f, 0x28, 0xd3, 0x34, 0x51, 0x98, 0x6d, 0xab,\n\t0x63, 0x4e, 0xfa, 0x28, 0xe3, 0x12, 0x2a, 0xb3, 0x1e, 0x77, 0x47, 0x13, 0x0b, 0xe7, 0xea, 0x38,\n\t0xfd, 0x17, 0x5e, 0x1b, 0x2b, 0xe3, 0xf0, 0xb9, 0x40, 0x03, 0xc2, 0xc7, 0xa8, 0xd0, 0xba, 0xba,\n\t0x5a, 0x31, 0xf2, 0x5c, 0xa5, 0xd3, 0xf8, 0x5a, 0x55, 0xc2, 0xdf, 0x41, 0x9d, 0xd6, 0xd5, 0x5a,\n\t0x95, 0xe3, 0x6b, 0xd5, 0x00, 0xbf, 0x8a, 0x13, 0xf0, 0xc4, 0x1a, 0x30, 0xee, 0xa2, 0x5a, 0xeb,\n\t0xb1, 0xd5, 0xca, 0x8a, 0xb1, 0xe0, 0x49, 0x76, 0x16, 0x29, 0xd4, 0xcd, 0x3d, 0x14, 0x6d, 0x3d,\n\t0x56, 0xab, 0xfa, 0x24, 0xb9, 0xa7, 0x0a, 0x0a, 0x5d, 0x48, 0x37, 0xe0, 0x7c, 0x82, 0xda, 0xad,\n\t0xc7, 0x57, 0x2b, 0x2b, 0x2b, 0x86, 0x26, 0x14, 0x3c, 0x83, 0x13, 0xea, 0xa7, 0x8c, 0x1a, 0xae,\n\t0xc7, 0x6b, 0x55, 0x9f, 0x13, 0xee, 0x67, 0xc1, 0x93, 0x72, 0x40, 0xb9, 0x8f, 0x5a, 0xae, 0x27,\n\t0x57, 0x1f, 0x54, 0x1f, 0xac, 0x3d, 0x36, 0xf2, 0x5c, 0xd3, 0x01, 0xa7, 0x8a, 0xfd, 0x08, 0x51,\n\t0x07, 0xa4, 0x15, 0x54, 0x75, 0x3d, 0x59, 0x79, 0xf8, 0xe0, 0x51, 0xe5, 0x91, 0xa1, 0x09, 0x75,\n\t0x07, 0xac, 0xa7, 0xc8, 0x12, 0xf2, 0x0e, 0x58, 0x0f, 0x50, 0xdf, 0x75, 0xed, 0xc8, 0xea, 0xf7,\n\t0x9d, 0x7b, 0x7a, 0xf1, 0x9d, 0x33, 0xea, 0xb7, 0x6f, 0x17, 0xc1, 0xd0, 0x84, 0xe2, 0xe5, 0x5e,\n\t0x17, 0x3c, 0xc9, 0x07, 0xf4, 0x3f, 0xc4, 0xa4, 0x35, 0x57, 0x4f, 0xad, 0xf7, 0xba, 0xb6, 0x33,\n\t0xb6, 0x8c, 0x3c, 0x17, 0x7f, 0x64, 0x4d, 0xf6, 0xa2, 0xeb, 0xf8, 0x47, 0x48, 0x5b, 0xa8, 0xc7,\n\t0x3e, 0x59, 0xad, 0x60, 0x4f, 0xb3, 0xd6, 0x71, 0x2f, 0xba, 0x8e, 0x3f, 0x45, 0x0e, 0xab, 0xc7,\n\t0x3e, 0xa9, 0x55, 0x05, 0x47, 0x5e, 0xc7, 0x1a, 0x2c, 0x4a, 0xef, 0x42, 0xc0, 0xfa, 0x63, 0x64,\n\t0xe5, 0x79, 0x4f, 0xcc, 0x7f, 0x23, 0x66, 0xf2, 0x42, 0xbd, 0xfd, 0x09, 0xf2, 0x34, 0xde, 0x1b,\n\t0xf3, 0x5f, 0x8c, 0x80, 0xf7, 0x10, 0xae, 0x46, 0x72, 0x89, 0xd6, 0xd0, 0x3c, 0x7c, 0x6b, 0xb5,\n\t0x0b, 0x15, 0x4c, 0x29, 0xd6, 0x55, 0x4d, 0x31, 0xde, 0x0b, 0xa5, 0x15, 0xaf, 0xa8, 0x99, 0x3d,\n\t0x86, 0x6b, 0xd1, 0xe4, 0xc2, 0x63, 0xae, 0x62, 0x8e, 0x41, 0xcc, 0xc5, 0x70, 0x9e, 0x11, 0xa1,\n\t0x4a, 0x41, 0xc5, 0xa3, 0x56, 0x31, 0xe9, 0x08, 0xa8, 0x41, 0x6c, 0x11, 0xd4, 0x4f, 0xe1, 0xfa,\n\t0x74, 0xfa, 0xe1, 0x91, 0xd7, 0x30, 0x0b, 0x21, 0xf2, 0xd5, 0x68, 0x26, 0x32, 0x45, 0x9f, 0xd1,\n\t0x77, 0x0d, 0xd3, 0x12, 0x99, 0x3e, 0xd5, 0xfb, 0x13, 0x28, 0x4c, 0x25, 0x28, 0x1e, 0xfb, 0x21,\n\t0xe6, 0x29, 0xc4, 0x7e, 0x3f, 0x92, 0xab, 0x44, 0xc9, 0x33, 0xba, 0x7e, 0x84, 0x89, 0x8b, 0x44,\n\t0x9e, 0xea, 0x99, 0x96, 0x2c, 0x9c, 0xc2, 0x78, 0xdc, 0xc7, 0x98, 0xc9, 0x88, 0x25, 0x0b, 0x65,\n\t0x33, 0x72, 0xbf, 0x91, 0x9c, 0xc6, 0xe3, 0xd6, 0x31, 0xb5, 0x11, 0xfd, 0x86, 0xd3, 0x1b, 0x41,\n\t0xfe, 0x3e, 0x92, 0xf7, 0x66, 0xcf, 0xf8, 0x7f, 0x62, 0x98, 0x94, 0x08, 0xf6, 0xde, 0xac, 0x29,\n\t0xfb, 0xec, 0x19, 0x53, 0xfe, 0x5f, 0x64, 0x33, 0x89, 0x3d, 0x35, 0xe7, 0x1f, 0xc0, 0xd2, 0x8c,\n\t0x7c, 0xc5, 0xe3, 0xff, 0x1f, 0xf2, 0xf3, 0xc4, 0xbf, 0x36, 0x95, 0xba, 0x4c, 0x5b, 0x98, 0x31,\n\t0x82, 0xff, 0x47, 0x0b, 0x5a, 0xc8, 0xc2, 0xd4, 0x18, 0x36, 0x61, 0xce, 0xcb, 0xc7, 0xbb, 0x23,\n\t0x67, 0x32, 0x2c, 0x34, 0x74, 0xb5, 0x04, 0x95, 0xdb, 0xb3, 0x4e, 0xc8, 0x5e, 0x7e, 0xbe, 0x89,\n\t0x40, 0x23, 0xcc, 0xe3, 0x86, 0xb8, 0x69, 0x6e, 0xe8, 0x95, 0x1e, 0x3b, 0xdd, 0x10, 0x07, 0xfa,\n\t0x86, 0x24, 0x1e, 0x1a, 0xf2, 0x02, 0x1e, 0x37, 0xf4, 0x46, 0x57, 0x4e, 0x33, 0xe4, 0xc5, 0x3f,\n\t0x61, 0x28, 0xc4, 0x5b, 0x5a, 0x0b, 0x4e, 0xe6, 0xd4, 0xce, 0xbe, 0x13, 0x3d, 0xaa, 0x6f, 0xd2,\n\t0x01, 0x2b, 0x5c, 0xc9, 0x69, 0xd2, 0xf8, 0xa6, 0x69, 0x3f, 0x3c, 0x85, 0x16, 0x1a, 0xcd, 0x34,\n\t0xed, 0x47, 0x33, 0x68, 0xc5, 0x3f, 0x55, 0x20, 0xfe, 0xd9, 0xd6, 0xee, 0x0b, 0x96, 0x86, 0xf8,\n\t0xe7, 0xcd, 0xad, 0x17, 0xda, 0x15, 0x7c, 0x5a, 0x6f, 0x36, 0xb7, 0x35, 0x85, 0x65, 0x20, 0xb1,\n\t0xfe, 0xe5, 0xfe, 0xc6, 0x9e, 0xa6, 0xb2, 0x3c, 0x64, 0x1b, 0x5b, 0xbb, 0x9b, 0x1b, 0xc6, 0x2b,\n\t0x63, 0x6b, 0x77, 0x5f, 0x8b, 0x61, 0x5b, 0x63, 0xbb, 0xf9, 0x6c, 0x5f, 0x8b, 0xb3, 0x14, 0xc4,\n\t0xb0, 0x2e, 0xc1, 0x00, 0x92, 0x7b, 0xfb, 0xc6, 0xd6, 0xee, 0xa6, 0x96, 0x44, 0x2b, 0xfb, 0x5b,\n\t0x3b, 0x1b, 0x5a, 0x0a, 0x91, 0xfb, 0xaf, 0x5f, 0x6d, 0x6f, 0x68, 0x69, 0x7c, 0x7c, 0x66, 0x18,\n\t0xcf, 0xbe, 0xd4, 0x32, 0x48, 0xda, 0x79, 0xf6, 0x4a, 0x03, 0x6a, 0x7e, 0xb6, 0xbe, 0xbd, 0xa1,\n\t0x65, 0x59, 0x0e, 0xd2, 0x8d, 0xd7, 0xbb, 0xcf, 0xf7, 0xb7, 0x9a, 0xbb, 0x5a, 0xae, 0xf8, 0xbb,\n\t0x50, 0xe0, 0xcb, 0x1c, 0x5a, 0x45, 0x7e, 0x6b, 0xf0, 0x0c, 0x12, 0x7c, 0x73, 0x14, 0x92, 0xcb,\n\t0xdd, 0x19, 0x9b, 0x33, 0xcd, 0x2a, 0xf3, 0x6d, 0xe2, 0xcc, 0xa5, 0x1b, 0x90, 0xe0, 0x0b, 0xb5,\n\t0x08, 0x09, 0xbe, 0x40, 0x2a, 0x5d, 0x27, 0xf0, 0x42, 0xf1, 0xcf, 0x54, 0x80, 0x4d, 0x67, 0xef,\n\t0x6d, 0x6f, 0x48, 0x17, 0x38, 0x37, 0x00, 0xc6, 0x6f, 0x7b, 0xc3, 0x16, 0xbd, 0x85, 0xe2, 0xe2,\n\t0x21, 0x83, 0x35, 0xe4, 0x7f, 0xd9, 0x6d, 0xc8, 0x51, 0xb3, 0x78, 0x4d, 0xe8, 0xbe, 0x21, 0x65,\n\t0x64, 0xb1, 0x4e, 0x38, 0xca, 0x30, 0xa4, 0x56, 0xa5, 0x6b, 0x86, 0xa4, 0x04, 0xa9, 0x55, 0xd9,\n\t0x2d, 0xa0, 0x62, 0x6b, 0x4c, 0x11, 0x95, 0xae, 0x16, 0x32, 0x06, 0xf5, 0xcb, 0x63, 0x2c, 0xfb,\n\t0x2d, 0xa0, 0x3e, 0xf9, 0xd4, 0xf3, 0x33, 0xdf, 0x14, 0x6f, 0xc4, 0x65, 0x7c, 0xe0, 0x13, 0x0e,\n\t0x38, 0x4b, 0x4d, 0xc8, 0xf8, 0xf5, 0xd8, 0x1d, 0xd5, 0x8a, 0x49, 0x69, 0x34, 0x29, 0xa0, 0x2a,\n\t0x7f, 0x56, 0x1c, 0x20, 0x06, 0xb4, 0x40, 0x03, 0xe2, 0x24, 0x3e, 0xa2, 0xe2, 0x0d, 0x98, 0xdb,\n\t0x75, 0x6c, 0xfe, 0x32, 0xd3, 0x42, 0xe5, 0x40, 0x31, 0x0b, 0x0a, 0x1d, 0x82, 0x15, 0xb3, 0x78,\n\t0x13, 0x40, 0x6a, 0xd3, 0x40, 0x39, 0xe0, 0x6d, 0xe4, 0x14, 0x94, 0x83, 0xe2, 0x5d, 0x48, 0xee,\n\t0x98, 0xc7, 0xfb, 0x66, 0x97, 0xdd, 0x06, 0xe8, 0x9b, 0x63, 0xb7, 0xd5, 0xa1, 0xad, 0xf8, 0xf6,\n\t0xdb, 0x6f, 0xbf, 0x55, 0x28, 0xa3, 0xce, 0x60, 0x2d, 0xdf, 0x12, 0x17, 0xa0, 0xd9, 0x6f, 0xef,\n\t0x58, 0xe3, 0xb1, 0xd9, 0xb5, 0x58, 0x0d, 0x92, 0xb6, 0x35, 0xc6, 0x10, 0xac, 0xd0, 0x8d, 0xd3,\n\t0xcd, 0xd0, 0x42, 0x04, 0xc0, 0xf2, 0x2e, 0xa1, 0x0c, 0x81, 0x66, 0x1a, 0xc4, 0xec, 0xc9, 0x80,\n\t0xae, 0xd6, 0x12, 0x06, 0x3e, 0x2e, 0x7d, 0x00, 0x49, 0x8e, 0x61, 0x0c, 0xe2, 0xb6, 0x39, 0xb0,\n\t0x0a, 0xbc, 0x6b, 0x7a, 0x2e, 0xfe, 0x54, 0x01, 0xd8, 0xb5, 0xde, 0x5d, 0xac, 0xdb, 0x00, 0x78,\n\t0x46, 0xb7, 0x31, 0xde, 0xed, 0x93, 0xb3, 0xba, 0x45, 0xc1, 0x75, 0x1c, 0xa7, 0xdd, 0xe2, 0x7b,\n\t0xcd, 0x2f, 0x02, 0x33, 0x58, 0x43, 0x7b, 0x57, 0x7c, 0x03, 0xb9, 0x2d, 0xdb, 0xb6, 0x46, 0xde,\n\t0xb0, 0x18, 0xc4, 0x8f, 0x9c, 0xb1, 0x2b, 0x2e, 0x25, 0xe9, 0x99, 0x15, 0x20, 0x3e, 0x74, 0x46,\n\t0x2e, 0x9f, 0x6a, 0x3d, 0x5e, 0x5d, 0x59, 0x59, 0x31, 0xa8, 0x86, 0x7d, 0x00, 0x99, 0x43, 0xc7,\n\t0xb6, 0xad, 0x43, 0x9c, 0x47, 0x8c, 0x4e, 0x90, 0x41, 0x45, 0xf1, 0xf7, 0x15, 0xc8, 0x35, 0xdd,\n\t0xa3, 0xc0, 0xb8, 0x06, 0xb1, 0xb7, 0xd6, 0x09, 0x0d, 0x2f, 0x66, 0xe0, 0x23, 0xbe, 0x33, 0x3f,\n\t0x31, 0xfb, 0x13, 0x7e, 0x43, 0x99, 0x33, 0x78, 0x81, 0x5d, 0x85, 0xe4, 0x3b, 0xab, 0xd7, 0x3d,\n\t0x72, 0xc9, 0xa6, 0x6a, 0x88, 0x12, 0xbb, 0x0f, 0x89, 0x1e, 0x0e, 0xb6, 0x10, 0xa7, 0x25, 0xbb,\n\t0x1e, 0x5a, 0x32, 0x79, 0x1a, 0x06, 0xc7, 0xdd, 0x49, 0xa7, 0xdb, 0xda, 0xd7, 0x5f, 0x7f, 0xfd,\n\t0xb5, 0x5a, 0xec, 0xc1, 0xa2, 0xf7, 0x22, 0x87, 0xe6, 0xfb, 0x43, 0x28, 0xf4, 0x2d, 0xa7, 0xd5,\n\t0xe9, 0xd9, 0x66, 0xbf, 0x7f, 0xd2, 0x7a, 0xe7, 0xd8, 0x2d, 0xd3, 0x6e, 0x39, 0xe3, 0x43, 0x73,\n\t0x44, 0x6b, 0x70, 0x66, 0x2f, 0x8b, 0x7d, 0xcb, 0x69, 0x70, 0xe6, 0x17, 0x8e, 0xfd, 0xcc, 0x6e,\n\t0x22, 0xad, 0xf8, 0x1f, 0x71, 0xc8, 0xec, 0x9c, 0x78, 0x1d, 0x2c, 0x42, 0xe2, 0xd0, 0x99, 0xd8,\n\t0x7c, 0x45, 0x13, 0x06, 0x2f, 0xf8, 0x3b, 0xa5, 0x4a, 0x3b, 0xb5, 0x08, 0x89, 0xaf, 0x26, 0x8e,\n\t0x6b, 0xd1, 0xa4, 0x33, 0x06, 0x2f, 0xe0, 0x9a, 0x0d, 0x2d, 0xb7, 0x10, 0xa7, 0xfb, 0x0a, 0x7c,\n\t0x0c, 0x56, 0x21, 0x71, 0xb1, 0x55, 0x60, 0x0f, 0x20, 0xe9, 0xe0, 0x36, 0x8c, 0x0b, 0x49, 0xba,\n\t0x93, 0x0d, 0x33, 0xe4, 0x1d, 0x32, 0x04, 0x90, 0x6d, 0xc3, 0xc2, 0x3b, 0xab, 0x35, 0x98, 0x8c,\n\t0xdd, 0x56, 0xd7, 0x69, 0xb5, 0x2d, 0x6b, 0x68, 0x8d, 0x0a, 0x73, 0xd4, 0x5f, 0xd8, 0x51, 0xcc,\n\t0x5a, 0x54, 0x63, 0xfe, 0x9d, 0xb5, 0x33, 0x19, 0xbb, 0x9b, 0xce, 0x0b, 0x22, 0xb2, 0x1a, 0x64,\n\t0x46, 0x16, 0xba, 0x07, 0x1c, 0x75, 0x6e, 0xc6, 0x18, 0x42, 0xec, 0xf4, 0xc8, 0x1a, 0x52, 0x05,\n\t0x7b, 0x04, 0xe9, 0x83, 0xde, 0x5b, 0x6b, 0x7c, 0x64, 0xb5, 0x0b, 0x29, 0x5d, 0x29, 0xcd, 0x57,\n\t0x3e, 0x08, 0xd1, 0xfc, 0x55, 0x2e, 0x3f, 0x77, 0xfa, 0xce, 0xc8, 0xf0, 0xd1, 0xec, 0x29, 0x64,\n\t0xc6, 0xce, 0xc0, 0xe2, 0xa2, 0x4f, 0x53, 0xe0, 0xd5, 0x4f, 0xa1, 0xee, 0x39, 0x03, 0xcb, 0xf3,\n\t0x6f, 0x1e, 0x85, 0x2d, 0xf3, 0x11, 0x1f, 0xe0, 0xd9, 0xa2, 0x00, 0x74, 0xff, 0x83, 0xc3, 0xa2,\n\t0xb3, 0x06, 0x5b, 0xc2, 0x61, 0x75, 0x3b, 0x98, 0xc2, 0x15, 0xb2, 0x74, 0xb4, 0xf7, 0xcb, 0x4b,\n\t0xf7, 0x20, 0xe3, 0x1b, 0x0c, 0x1c, 0x23, 0x77, 0x46, 0x19, 0x72, 0x15, 0xdc, 0x31, 0x72, 0x4f,\n\t0xf4, 0x11, 0x24, 0x68, 0xe4, 0x18, 0xc5, 0x8c, 0x0d, 0x0c, 0x9a, 0x19, 0x48, 0x6c, 0x1a, 0x1b,\n\t0x1b, 0xbb, 0x9a, 0x42, 0xf1, 0x73, 0xfb, 0xf5, 0x86, 0xa6, 0x4a, 0x32, 0xfe, 0x99, 0x0a, 0xb1,\n\t0x8d, 0x63, 0xd2, 0x4f, 0xdb, 0x74, 0x4d, 0xef, 0x4d, 0xc7, 0x67, 0xf6, 0x04, 0x32, 0x03, 0xd3,\n\t0xeb, 0x4b, 0xa5, 0x55, 0x0e, 0x3b, 0x95, 0x8d, 0x63, 0xb7, 0xbc, 0x63, 0xf2, 0xae, 0x37, 0x6c,\n\t0x77, 0x74, 0x62, 0xa4, 0x07, 0xa2, 0xb8, 0xf4, 0x04, 0xe6, 0x42, 0x4d, 0xf2, 0xbb, 0x9a, 0x98,\n\t0xf1, 0xae, 0x26, 0xc4, 0xbb, 0x5a, 0x57, 0x1f, 0x29, 0x95, 0xef, 0x43, 0x7c, 0xe0, 0x8c, 0x2c,\n\t0x76, 0x75, 0xf6, 0x12, 0x17, 0xba, 0x24, 0x1c, 0x2d, 0x3a, 0x18, 0x83, 0x58, 0x95, 0x3b, 0x10,\n\t0x77, 0xad, 0x63, 0xf7, 0x54, 0xf6, 0x11, 0x9f, 0x23, 0x62, 0x2a, 0x65, 0x48, 0xda, 0x93, 0xc1,\n\t0x81, 0x35, 0x3a, 0x15, 0xdd, 0xa3, 0xc1, 0x09, 0x54, 0xf1, 0x73, 0xd0, 0x9e, 0x3b, 0x83, 0x61,\n\t0xdf, 0x3a, 0xde, 0x38, 0x76, 0x2d, 0x7b, 0xdc, 0x73, 0x6c, 0x9c, 0x47, 0xa7, 0x37, 0x22, 0x1f,\n\t0x47, 0xf3, 0xa0, 0x02, 0xfa, 0x9c, 0xb1, 0x75, 0xe8, 0xd8, 0x6d, 0x31, 0x3d, 0x51, 0x42, 0xb4,\n\t0x7b, 0xd4, 0x1b, 0xa1, 0x7b, 0xc3, 0x58, 0xc4, 0x0b, 0xc5, 0x4d, 0xc8, 0x8b, 0xa3, 0xd9, 0x58,\n\t0x74, 0x5c, 0xbc, 0x03, 0x39, 0xaf, 0x8a, 0x7e, 0x12, 0x4a, 0x43, 0xfc, 0xcd, 0x86, 0xd1, 0xd4,\n\t0xae, 0xe0, 0xe6, 0x36, 0x77, 0x37, 0x34, 0x05, 0x1f, 0xf6, 0xbf, 0x68, 0x86, 0x36, 0x34, 0x05,\n\t0x89, 0x8d, 0xc1, 0xd0, 0x3d, 0x29, 0xfe, 0x1e, 0x64, 0x85, 0xa5, 0xed, 0xde, 0xd8, 0x65, 0x75,\n\t0x48, 0x0d, 0xc4, 0x8c, 0x14, 0x4a, 0x40, 0x23, 0xf2, 0x0d, 0xa0, 0xde, 0xb3, 0xe1, 0x11, 0x96,\n\t0x56, 0x21, 0x25, 0xb9, 0x73, 0xe1, 0x67, 0x54, 0xd9, 0xcf, 0x70, 0x8f, 0x14, 0x93, 0x3c, 0x52,\n\t0x71, 0x07, 0x52, 0x3c, 0x14, 0x8f, 0x29, 0xc3, 0xe0, 0xc7, 0x76, 0xae, 0x25, 0x2e, 0xb2, 0x2c,\n\t0xaf, 0xe3, 0x79, 0xd3, 0x2d, 0xc8, 0xd2, 0xbb, 0xe1, 0xab, 0x0d, 0xbd, 0x37, 0x50, 0x15, 0x57,\n\t0xf6, 0x5f, 0x27, 0x20, 0xed, 0x2d, 0x07, 0x5b, 0x86, 0x24, 0x3f, 0xbb, 0x92, 0x29, 0xef, 0x2e,\n\t0x27, 0x41, 0xa7, 0x55, 0xb6, 0x0c, 0x29, 0x71, 0x3e, 0x15, 0x01, 0x46, 0x5d, 0xad, 0x18, 0x49,\n\t0x7e, 0x1e, 0xf5, 0x1b, 0x6b, 0x55, 0xf2, 0x8a, 0xfc, 0x96, 0x26, 0xc9, 0x4f, 0x9c, 0x4c, 0x87,\n\t0x8c, 0x7f, 0xc6, 0xa4, 0x90, 0x20, 0xae, 0x64, 0xd2, 0xde, 0xa1, 0x52, 0x42, 0xd4, 0xaa, 0xe4,\n\t0x2e, 0xc5, 0xfd, 0x4b, 0xba, 0x11, 0xa4, 0x4a, 0x69, 0xef, 0xa4, 0x48, 0xbf, 0x38, 0x79, 0x97,\n\t0x2d, 0x29, 0x71, 0x36, 0x0c, 0x00, 0xb5, 0x2a, 0xf9, 0x20, 0xef, 0x66, 0x25, 0x25, 0xce, 0x7f,\n\t0xec, 0x16, 0x0e, 0x91, 0xce, 0x73, 0xe4, 0x68, 0x82, 0x6b, 0x94, 0x24, 0x3f, 0xe5, 0xb1, 0xdb,\n\t0x68, 0x81, 0x1f, 0xda, 0xc8, 0x05, 0x04, 0x77, 0x26, 0x29, 0x71, 0x96, 0x63, 0x77, 0x11, 0xc2,\n\t0x97, 0xbf, 0x00, 0xa7, 0x5c, 0x90, 0xa4, 0xc4, 0x05, 0x09, 0xd3, 0xb1, 0x43, 0xf2, 0x44, 0xe4,\n\t0x7d, 0xa4, 0xcb, 0x90, 0x24, 0xbf, 0x0c, 0x61, 0x37, 0xc9, 0x1c, 0x9f, 0x54, 0x2e, 0xb8, 0xf8,\n\t0x48, 0x89, 0xc3, 0x5f, 0xd0, 0x4e, 0xe9, 0xa3, 0x7f, 0xc9, 0x91, 0x12, 0xc7, 0x3b, 0xf6, 0x18,\n\t0xf7, 0x0b, 0x45, 0x5c, 0x98, 0x27, 0xaf, 0xbb, 0x1c, 0xd2, 0x9e, 0xb7, 0xad, 0xdc, 0xe9, 0xd6,\n\t0xb9, 0xbf, 0x32, 0x12, 0x0d, 0x52, 0xfd, 0x12, 0x52, 0x5f, 0xf5, 0xec, 0x4e, 0x21, 0x4f, 0x8b,\n\t0x11, 0xeb, 0xd9, 0x1d, 0x23, 0xd1, 0xc0, 0x1a, 0x2e, 0x83, 0x5d, 0x6c, 0xd3, 0xa8, 0x2d, 0xfe,\n\t0x09, 0x6f, 0xc4, 0x2a, 0x56, 0x80, 0x44, 0xa3, 0xb5, 0x6b, 0xda, 0x85, 0x05, 0xce, 0xb3, 0x4d,\n\t0xdb, 0x88, 0x37, 0x76, 0x4d, 0x9b, 0xdd, 0x81, 0xd8, 0x78, 0x72, 0x50, 0x60, 0x33, 0x7e, 0x0f,\n\t0xdc, 0x9b, 0x1c, 0x78, 0xa3, 0x31, 0x10, 0xc4, 0x96, 0x21, 0x3d, 0x76, 0x47, 0xad, 0xdf, 0xb1,\n\t0x46, 0x4e, 0xe1, 0x3d, 0x5a, 0xc8, 0x2b, 0x46, 0x6a, 0xec, 0x8e, 0xde, 0x58, 0x23, 0xe7, 0x82,\n\t0xde, 0xb6, 0x78, 0x13, 0xb2, 0x92, 0x5d, 0x96, 0x07, 0xc5, 0xe6, 0x29, 0x4b, 0x5d, 0x79, 0x68,\n\t0x28, 0x76, 0xf1, 0x0b, 0xc8, 0x79, 0x07, 0x2b, 0x9a, 0xf2, 0x1a, 0xbe, 0x4f, 0x7d, 0x67, 0x44,\n\t0x2f, 0xea, 0x7c, 0xe5, 0x56, 0x24, 0x3e, 0x06, 0x48, 0x11, 0xa5, 0x38, 0xba, 0xa8, 0x45, 0x46,\n\t0xa3, 0x14, 0xff, 0x53, 0x81, 0xdc, 0x8e, 0x33, 0x0a, 0x7e, 0xb9, 0x58, 0x84, 0xc4, 0x81, 0xe3,\n\t0xf4, 0xc7, 0x64, 0x39, 0x6d, 0xf0, 0x02, 0xfb, 0x08, 0x72, 0xf4, 0xe0, 0x1d, 0x8f, 0x55, 0xff,\n\t0xfe, 0x27, 0x4b, 0xf5, 0xe2, 0x44, 0xcc, 0x20, 0xde, 0xb3, 0xdd, 0xb1, 0xf0, 0x5b, 0xf4, 0xcc,\n\t0x3e, 0x84, 0x2c, 0xfe, 0xf5, 0x98, 0x71, 0x3f, 0x85, 0x06, 0xac, 0x16, 0xc4, 0xef, 0xc1, 0x1c,\n\t0xc9, 0xc0, 0x87, 0xa5, 0xfc, 0xbb, 0x9e, 0x1c, 0x6f, 0x10, 0xc0, 0x02, 0xa4, 0xb8, 0x4f, 0x18,\n\t0xd3, 0x8f, 0xbd, 0x19, 0xc3, 0x2b, 0xa2, 0x33, 0xa5, 0xe3, 0x09, 0xcf, 0x38, 0x52, 0x86, 0x28,\n\t0x15, 0x5f, 0x40, 0x9a, 0x22, 0x63, 0xb3, 0xdf, 0x66, 0x1f, 0x81, 0xd2, 0x2d, 0x58, 0x14, 0x9a,\n\t0xaf, 0x85, 0xcf, 0x1e, 0x02, 0x51, 0xde, 0x34, 0x94, 0xee, 0xd2, 0x02, 0x28, 0x9b, 0x78, 0x18,\n\t0x38, 0x16, 0x7e, 0x59, 0x39, 0x2e, 0x1a, 0xc2, 0xca, 0xae, 0xf5, 0xee, 0x1c, 0x2b, 0xbb, 0xd6,\n\t0x3b, 0x6e, 0xe5, 0xd6, 0x94, 0x15, 0x2c, 0x9d, 0x88, 0x9f, 0xc0, 0x95, 0x93, 0xe2, 0x2a, 0xcc,\n\t0xd1, 0xdb, 0xda, 0xb3, 0xbb, 0xaf, 0x9c, 0x9e, 0x4d, 0xe7, 0x8f, 0x0e, 0xe5, 0x6c, 0x8a, 0xa1,\n\t0x74, 0x70, 0x27, 0xac, 0x63, 0xf3, 0x90, 0xe7, 0xc0, 0x69, 0x83, 0x17, 0x8a, 0xff, 0x15, 0x87,\n\t0x79, 0xe1, 0x69, 0xbf, 0xe8, 0xb9, 0x47, 0x3b, 0xe6, 0x90, 0x35, 0x21, 0x87, 0x4e, 0xb6, 0x35,\n\t0x30, 0x87, 0x43, 0x7c, 0x9b, 0x15, 0x8a, 0xc3, 0xf7, 0x66, 0x39, 0x6f, 0x41, 0x29, 0xef, 0x9a,\n\t0x03, 0x6b, 0x87, 0xc3, 0x79, 0x54, 0xce, 0xda, 0x41, 0x0d, 0xdb, 0x86, 0xec, 0x60, 0xdc, 0xf5,\n\t0xed, 0xf1, 0xb8, 0x7e, 0xf7, 0x2c, 0x7b, 0x3b, 0xe3, 0x6e, 0xc8, 0x1c, 0x0c, 0xfc, 0x0a, 0x1c,\n\t0x1e, 0x3a, 0x69, 0xdf, 0x5c, 0xec, 0xfc, 0xe1, 0xa1, 0x4b, 0x09, 0x0f, 0xef, 0x20, 0xa8, 0x61,\n\t0x9b, 0x00, 0xf8, 0xc2, 0xb9, 0x0e, 0x9e, 0xed, 0x48, 0x50, 0xd9, 0xca, 0xc7, 0x67, 0x99, 0xdb,\n\t0x73, 0x47, 0xfb, 0xce, 0x9e, 0x3b, 0x12, 0x09, 0xc8, 0x58, 0x14, 0x97, 0x9e, 0x82, 0x16, 0x5d,\n\t0x88, 0xf3, 0x72, 0x90, 0x8c, 0x94, 0x83, 0x2c, 0x7d, 0x09, 0xf9, 0xc8, 0xc4, 0x65, 0x3a, 0xe3,\n\t0xf4, 0x15, 0x99, 0x9e, 0xad, 0x2c, 0x85, 0x3f, 0xd4, 0x90, 0xf7, 0x5f, 0x36, 0xfd, 0x14, 0xb4,\n\t0xe8, 0x22, 0xc8, 0xb6, 0xd3, 0x67, 0x1c, 0x65, 0x88, 0xff, 0x04, 0xe6, 0x42, 0xb3, 0x96, 0xc9,\n\t0x99, 0x73, 0xe6, 0x55, 0xfc, 0x83, 0x04, 0x24, 0x9a, 0xb6, 0xe5, 0x74, 0xd8, 0xb5, 0x70, 0x14,\n\t0x7d, 0x79, 0xc5, 0x8b, 0xa0, 0xd7, 0x23, 0x11, 0xf4, 0xe5, 0x15, 0x3f, 0x7e, 0x5e, 0x8f, 0xc4,\n\t0x4f, 0xaf, 0xa9, 0x56, 0x65, 0x37, 0xa6, 0xa2, 0xe7, 0xcb, 0x2b, 0x52, 0xe8, 0xbc, 0x31, 0x15,\n\t0x3a, 0x83, 0xe6, 0x5a, 0x15, 0x1d, 0x6d, 0x38, 0x6e, 0xbe, 0xbc, 0x12, 0xc4, 0xcc, 0xe5, 0x68,\n\t0xcc, 0xf4, 0x1b, 0x6b, 0x55, 0x3e, 0x24, 0x29, 0x5e, 0xd2, 0x90, 0x78, 0xa4, 0x5c, 0x8e, 0x46,\n\t0x4a, 0xe2, 0x89, 0x18, 0xb9, 0x1c, 0x8d, 0x91, 0xd4, 0x28, 0x62, 0xe2, 0xf5, 0x48, 0x4c, 0x24,\n\t0xa3, 0x3c, 0x18, 0x2e, 0x47, 0x83, 0x21, 0xe7, 0x49, 0x23, 0x95, 0x23, 0xa1, 0xdf, 0x58, 0xab,\n\t0xb2, 0xb5, 0x48, 0x18, 0x3c, 0xf3, 0xf0, 0x41, 0xdb, 0x41, 0xf1, 0xe0, 0x21, 0xae, 0x9c, 0x97,\n\t0x8e, 0xe6, 0xcf, 0xfe, 0x8a, 0x85, 0xd6, 0xd4, 0x4b, 0xd6, 0xd6, 0x20, 0xd5, 0x11, 0xe7, 0x74,\n\t0x8d, 0x3c, 0x5a, 0x58, 0x9f, 0xa4, 0x82, 0x72, 0xa3, 0x45, 0x9e, 0x0d, 0x27, 0xd8, 0xe1, 0xa7,\n\t0x8c, 0x12, 0xcc, 0x35, 0x5a, 0xdb, 0xe6, 0xa8, 0x6b, 0x8d, 0xdd, 0xd6, 0xbe, 0xd9, 0xf5, 0x2f,\n\t0x3d, 0x50, 0x08, 0xd9, 0x86, 0x68, 0xd9, 0x37, 0xbb, 0xec, 0xaa, 0xa7, 0xb2, 0x36, 0xb5, 0x2a,\n\t0x42, 0x67, 0x4b, 0xd7, 0x70, 0xf5, 0xb8, 0x31, 0xf2, 0x91, 0x0b, 0xc2, 0x47, 0xae, 0xa7, 0x20,\n\t0x31, 0xb1, 0x7b, 0x8e, 0xbd, 0x9e, 0x81, 0x94, 0xeb, 0x8c, 0x06, 0xa6, 0xeb, 0x14, 0xff, 0x5b,\n\t0x01, 0x78, 0xee, 0x0c, 0x06, 0x13, 0xbb, 0xf7, 0xd5, 0xc4, 0x62, 0x37, 0x21, 0x3b, 0x30, 0xdf,\n\t0x5a, 0xad, 0x81, 0xd5, 0x3a, 0x1c, 0x79, 0x2f, 0x44, 0x06, 0xab, 0x76, 0xac, 0xe7, 0xa3, 0x13,\n\t0x56, 0xf0, 0x32, 0x76, 0x12, 0x11, 0x69, 0x53, 0x64, 0xf0, 0x8b, 0x22, 0x37, 0x4d, 0x8a, 0xcd,\n\t0xf4, 0xb2, 0x53, 0x7e, 0xb2, 0x49, 0x89, 0x6d, 0xe4, 0x67, 0x9b, 0x6b, 0x90, 0x74, 0xad, 0xc1,\n\t0xb0, 0x75, 0x48, 0x9a, 0x41, 0x5d, 0x24, 0xb0, 0xfc, 0x9c, 0xad, 0x40, 0xec, 0xd0, 0xe9, 0x93,\n\t0x5a, 0xce, 0xdf, 0x20, 0x84, 0xb2, 0x12, 0xc4, 0x06, 0x63, 0x2e, 0xa1, 0x6c, 0x65, 0x31, 0x9c,\n\t0x4e, 0xf0, 0xf0, 0x85, 0xc8, 0xc1, 0xb8, 0xeb, 0xcf, 0xbe, 0xf8, 0x6b, 0x15, 0xd2, 0xb8, 0x65,\n\t0xaf, 0xf7, 0x1b, 0x8f, 0xe8, 0xa0, 0x70, 0x68, 0xf6, 0xe9, 0x7e, 0x00, 0xdf, 0x55, 0x51, 0xc2,\n\t0xfa, 0x9f, 0x58, 0x87, 0xae, 0x33, 0x22, 0x1f, 0x9d, 0x31, 0x44, 0x09, 0x17, 0x9d, 0x27, 0xc9,\n\t0x31, 0x31, 0x4f, 0x5e, 0xa4, 0x0c, 0xdf, 0x1c, 0xb6, 0xd0, 0x11, 0x70, 0xb7, 0x19, 0x3e, 0x58,\n\t0x7b, 0xfd, 0xe1, 0x89, 0xed, 0x33, 0xeb, 0x84, 0xbb, 0xcb, 0xe4, 0x80, 0x0a, 0xec, 0x07, 0xfc,\n\t0xa8, 0xc7, 0x37, 0x93, 0x7f, 0x68, 0xf5, 0xe1, 0xa9, 0xec, 0xcf, 0x11, 0x15, 0x9c, 0xf7, 0xa8,\n\t0xb8, 0xf4, 0x18, 0xb2, 0x92, 0xe1, 0xf3, 0x3c, 0x52, 0x2c, 0xe2, 0xce, 0x42, 0x56, 0xcf, 0xbb,\n\t0xd6, 0x91, 0xdd, 0x19, 0xae, 0xa9, 0x83, 0x3a, 0xbe, 0x93, 0x87, 0x58, 0xa3, 0xd9, 0xc4, 0xb4,\n\t0xab, 0xd1, 0x6c, 0x3e, 0xd0, 0x94, 0x7a, 0x05, 0xd2, 0xdd, 0x91, 0x65, 0xa1, 0x07, 0x3e, 0xf5,\n\t0x70, 0xf7, 0x63, 0x5a, 0x59, 0x1f, 0x57, 0xdf, 0x83, 0xd4, 0x21, 0x3f, 0xde, 0xb1, 0xd3, 0x2f,\n\t0x35, 0x0a, 0x7f, 0xcb, 0x6f, 0xd8, 0x6e, 0x84, 0x10, 0xd1, 0x63, 0xa1, 0xe1, 0x59, 0xaa, 0x7f,\n\t0x0e, 0x99, 0x51, 0xeb, 0x02, 0x66, 0xbf, 0xe1, 0xb1, 0xfd, 0x1c, 0xb3, 0xe9, 0x91, 0xa8, 0xaa,\n\t0xbf, 0x84, 0x05, 0xdb, 0xf1, 0x7e, 0xf1, 0x6b, 0xb5, 0xb9, 0x57, 0xfb, 0x60, 0x66, 0x6a, 0xed,\n\t0x75, 0x61, 0xf1, 0x0f, 0x07, 0x6c, 0x47, 0x34, 0x70, 0x57, 0x58, 0x6f, 0x80, 0x26, 0x59, 0xa2,\n\t0x8b, 0x87, 0x73, 0x0c, 0x75, 0xf8, 0xc7, 0x0a, 0xbe, 0x21, 0xf2, 0xb7, 0x11, 0x3b, 0xdc, 0x23,\n\t0x9e, 0x6d, 0xa7, 0xcb, 0x3f, 0xfe, 0xf0, 0xed, 0x50, 0x94, 0x99, 0xb6, 0x53, 0xab, 0x9e, 0x63,\n\t0xe7, 0x88, 0x7f, 0x1a, 0x22, 0xdb, 0xa9, 0x55, 0x23, 0x2b, 0x34, 0xb9, 0xc8, 0x80, 0x7a, 0xfc,\n\t0xe3, 0x0e, 0xdf, 0x10, 0x8f, 0x40, 0x33, 0x2c, 0x9d, 0x3b, 0xa4, 0x1f, 0xf3, 0x4f, 0x3f, 0x42,\n\t0x96, 0xa6, 0xc6, 0x34, 0xbe, 0xc8, 0x98, 0xde, 0xf2, 0x4f, 0x2d, 0x7c, 0x4b, 0x7b, 0xb3, 0xc6,\n\t0x34, 0xbe, 0xc8, 0x98, 0xfa, 0xfc, 0x3b, 0x8c, 0x90, 0xa5, 0x5a, 0xb5, 0xfe, 0xdb, 0xc0, 0xe4,\n\t0xfd, 0x17, 0x11, 0xfb, 0x6c, 0x53, 0x03, 0xfe, 0x81, 0x4d, 0xa0, 0x00, 0xce, 0x9a, 0x65, 0xeb,\n\t0xdc, 0x61, 0xd9, 0xfc, 0xf3, 0x9b, 0xb0, 0xad, 0x5a, 0xb5, 0xbe, 0x0d, 0xef, 0xc9, 0x33, 0xbc,\n\t0xd8, 0xc0, 0x1c, 0xfe, 0xf1, 0x48, 0x30, 0x47, 0x41, 0x9b, 0x69, 0xed, 0xdc, 0xa1, 0x0d, 0xf9,\n\t0x97, 0x25, 0x11, 0x6b, 0xb5, 0x6a, 0xfd, 0x05, 0xe4, 0x25, 0x6b, 0x78, 0x50, 0x3a, 0xc7, 0xd2,\n\t0x57, 0xfc, 0x83, 0x28, 0xdf, 0x12, 0xa6, 0x5a, 0xd1, 0x3d, 0xe4, 0xc9, 0xc7, 0xd9, 0x76, 0x46,\n\t0xfc, 0x83, 0x9e, 0x60, 0x44, 0x44, 0x8a, 0xbc, 0x33, 0x74, 0x73, 0x72, 0x8e, 0xa1, 0x31, 0xff,\n\t0xda, 0x27, 0x18, 0x10, 0x72, 0xea, 0x4e, 0x68, 0x5e, 0x16, 0x26, 0x20, 0x67, 0x9b, 0x71, 0x29,\n\t0x54, 0x7e, 0x7c, 0x16, 0xa6, 0x2c, 0x5f, 0x64, 0x49, 0x4b, 0x80, 0xc5, 0xfa, 0x36, 0xcc, 0x5f,\n\t0xca, 0x87, 0x7d, 0xa3, 0xf0, 0x3b, 0x8f, 0xd5, 0xf2, 0x83, 0xea, 0x83, 0x35, 0x63, 0xae, 0x1d,\n\t0x72, 0x65, 0x2f, 0x61, 0xee, 0x32, 0x7e, 0xec, 0xe7, 0x0a, 0xbf, 0x39, 0x40, 0x63, 0x46, 0xae,\n\t0x1d, 0x76, 0x66, 0x73, 0x97, 0xf1, 0x64, 0xbf, 0x50, 0xf8, 0x65, 0x53, 0xb5, 0xe2, 0xdb, 0xf1,\n\t0x9c, 0xd9, 0xdc, 0x65, 0x3c, 0xd9, 0x2f, 0xf9, 0xd5, 0x80, 0x5a, 0x5d, 0x95, 0xed, 0x90, 0xe3,\n\t0x98, 0xbf, 0x94, 0x27, 0xfb, 0x95, 0x42, 0xd7, 0x4f, 0x6a, 0xb5, 0xea, 0xaf, 0x91, 0xef, 0xcc,\n\t0xe6, 0x2f, 0xe5, 0xc9, 0xfe, 0x4e, 0xa1, 0x7b, 0x2a, 0xb5, 0xba, 0x16, 0xb2, 0x14, 0x1e, 0xd3,\n\t0x85, 0x3c, 0xd9, 0xdf, 0x2b, 0x74, 0x7b, 0xa4, 0x56, 0x6b, 0xbe, 0xa5, 0xbd, 0xa9, 0x31, 0x5d,\n\t0xc8, 0x93, 0xfd, 0x03, 0x9d, 0xc2, 0xea, 0x6a, 0xf5, 0x61, 0xc8, 0x12, 0x39, 0xb3, 0xfc, 0xe5,\n\t0x3c, 0xd9, 0xaf, 0x15, 0xba, 0xea, 0x53, 0xab, 0x8f, 0x0c, 0x6f, 0x0c, 0x81, 0x33, 0xcb, 0x5f,\n\t0xce, 0x93, 0xfd, 0xa3, 0x42, 0x97, 0x82, 0x6a, 0xf5, 0x71, 0xd8, 0x16, 0x39, 0x33, 0xed, 0x92,\n\t0x9e, 0xec, 0x9f, 0x14, 0xfa, 0xf4, 0x47, 0x5d, 0x5b, 0x31, 0xbc, 0x61, 0x48, 0xce, 0x4c, 0xbb,\n\t0xa4, 0x27, 0xfb, 0x67, 0x85, 0x3e, 0x08, 0x52, 0xd7, 0x1e, 0x44, 0xac, 0xd5, 0xaa, 0xf5, 0x06,\n\t0xe4, 0x2e, 0xe1, 0xc9, 0xfe, 0x45, 0xbe, 0x75, 0xcd, 0xb6, 0x25, 0x77, 0xf6, 0x23, 0x69, 0x17,\n\t0x2f, 0xe2, 0xcb, 0xfe, 0x95, 0x12, 0xc4, 0xfa, 0xfb, 0x2f, 0xf9, 0xe5, 0x24, 0xe7, 0xdc, 0x6b,\n\t0x5b, 0x9d, 0x4f, 0x3b, 0x8e, 0x13, 0x6c, 0x2c, 0xf7, 0x70, 0xaf, 0x82, 0x17, 0xe9, 0x22, 0xee,\n\t0xed, 0xdf, 0x14, 0xba, 0xcc, 0xcc, 0x09, 0xdb, 0x44, 0xf1, 0x5f, 0x29, 0xee, 0xeb, 0x86, 0xc1,\n\t0xb4, 0x2f, 0xe0, 0xe8, 0xfe, 0x5d, 0xb9, 0xa4, 0xa7, 0xab, 0xc7, 0x9a, 0xbb, 0x1b, 0xfe, 0x02,\n\t0x61, 0xcd, 0xfa, 0xa7, 0x6f, 0x9e, 0x74, 0x7b, 0xee, 0xd1, 0xe4, 0xa0, 0x7c, 0xe8, 0x0c, 0xee,\n\t0x77, 0x9d, 0xbe, 0x69, 0x77, 0xef, 0x93, 0xbd, 0x83, 0x49, 0xe7, 0x7e, 0xcf, 0x76, 0xad, 0x91,\n\t0x6d, 0xf6, 0xe9, 0x1f, 0x44, 0xa8, 0x76, 0x7c, 0x5f, 0xfe, 0xc7, 0x91, 0xdf, 0x04, 0x00, 0x00,\n\t0xff, 0xff, 0x4a, 0x65, 0x66, 0xff, 0x47, 0x32, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/testprotos/proto2_proto/test.proto",
    "content": "// Copyright 2010 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// A feature-rich test file for the protocol compiler and libraries.\n\nsyntax = \"proto2\";\n\noption go_package = \"github.com/golang/protobuf/internal/testprotos/proto2_proto\";\n\npackage proto2_test;\n\nenum FOO { FOO1 = 1; };\n\nmessage GoEnum {\n  required FOO foo = 1;\n}\n\nmessage GoTestField {\n  required string Label = 1;\n  required string Type = 2;\n}\n\nmessage GoTest {\n  // An enum, for completeness.\n  enum KIND {\n    VOID = 0;\n\n    // Basic types\n    BOOL = 1;\n    BYTES = 2;\n    FINGERPRINT = 3;\n    FLOAT = 4;\n    INT = 5;\n    STRING = 6;\n    TIME = 7;\n\n    // Groupings\n    TUPLE = 8;\n    ARRAY = 9;\n    MAP = 10;\n\n    // Table types\n    TABLE = 11;\n\n    // Functions\n    FUNCTION = 12;  // last tag\n  };\n\n  // Some typical parameters\n  required KIND Kind = 1;\n  optional string Table = 2;\n  optional int32 Param = 3;\n\n  // Required, repeated and optional foreign fields.\n  required GoTestField RequiredField = 4;\n  repeated GoTestField RepeatedField = 5;\n  optional GoTestField OptionalField = 6;\n\n  // Required fields of all basic types\n  required bool F_Bool_required = 10;\n  required int32 F_Int32_required = 11;\n  required int64 F_Int64_required = 12;\n  required fixed32 F_Fixed32_required = 13;\n  required fixed64 F_Fixed64_required = 14;\n  required uint32 F_Uint32_required = 15;\n  required uint64 F_Uint64_required = 16;\n  required float F_Float_required = 17;\n  required double F_Double_required = 18;\n  required string F_String_required = 19;\n  required bytes F_Bytes_required = 101;\n  required sint32 F_Sint32_required = 102;\n  required sint64 F_Sint64_required = 103;\n  required sfixed32 F_Sfixed32_required = 104;\n  required sfixed64 F_Sfixed64_required = 105;\n\n  // Repeated fields of all basic types\n  repeated bool F_Bool_repeated = 20;\n  repeated int32 F_Int32_repeated = 21;\n  repeated int64 F_Int64_repeated = 22;\n  repeated fixed32 F_Fixed32_repeated = 23;\n  repeated fixed64 F_Fixed64_repeated = 24;\n  repeated uint32 F_Uint32_repeated = 25;\n  repeated uint64 F_Uint64_repeated = 26;\n  repeated float F_Float_repeated = 27;\n  repeated double F_Double_repeated = 28;\n  repeated string F_String_repeated = 29;\n  repeated bytes F_Bytes_repeated = 201;\n  repeated sint32 F_Sint32_repeated = 202;\n  repeated sint64 F_Sint64_repeated = 203;\n  repeated sfixed32 F_Sfixed32_repeated = 204;\n  repeated sfixed64 F_Sfixed64_repeated = 205;\n\n  // Optional fields of all basic types\n  optional bool F_Bool_optional = 30;\n  optional int32 F_Int32_optional = 31;\n  optional int64 F_Int64_optional = 32;\n  optional fixed32 F_Fixed32_optional = 33;\n  optional fixed64 F_Fixed64_optional = 34;\n  optional uint32 F_Uint32_optional = 35;\n  optional uint64 F_Uint64_optional = 36;\n  optional float F_Float_optional = 37;\n  optional double F_Double_optional = 38;\n  optional string F_String_optional = 39;\n  optional bytes F_Bytes_optional = 301;\n  optional sint32 F_Sint32_optional = 302;\n  optional sint64 F_Sint64_optional = 303;\n  optional sfixed32 F_Sfixed32_optional = 304;\n  optional sfixed64 F_Sfixed64_optional = 305;\n\n  // Default-valued fields of all basic types\n  optional bool F_Bool_defaulted = 40 [default=true];\n  optional int32 F_Int32_defaulted = 41 [default=32];\n  optional int64 F_Int64_defaulted = 42 [default=64];\n  optional fixed32 F_Fixed32_defaulted = 43 [default=320];\n  optional fixed64 F_Fixed64_defaulted = 44 [default=640];\n  optional uint32 F_Uint32_defaulted = 45 [default=3200];\n  optional uint64 F_Uint64_defaulted = 46 [default=6400];\n  optional float F_Float_defaulted = 47 [default=314159.];\n  optional double F_Double_defaulted = 48 [default=271828.];\n  optional string F_String_defaulted = 49 [default=\"hello, \\\"world!\\\"\\n\"];\n  optional bytes F_Bytes_defaulted = 401 [default=\"Bignose\"];\n  optional sint32 F_Sint32_defaulted = 402 [default = -32];\n  optional sint64 F_Sint64_defaulted = 403 [default = -64];\n  optional sfixed32 F_Sfixed32_defaulted = 404 [default = -32];\n  optional sfixed64 F_Sfixed64_defaulted = 405 [default = -64];\n\n  // Packed repeated fields (no string or bytes).\n  repeated bool F_Bool_repeated_packed = 50 [packed=true];\n  repeated int32 F_Int32_repeated_packed = 51 [packed=true];\n  repeated int64 F_Int64_repeated_packed = 52 [packed=true];\n  repeated fixed32 F_Fixed32_repeated_packed = 53 [packed=true];\n  repeated fixed64 F_Fixed64_repeated_packed = 54 [packed=true];\n  repeated uint32 F_Uint32_repeated_packed = 55 [packed=true];\n  repeated uint64 F_Uint64_repeated_packed = 56 [packed=true];\n  repeated float F_Float_repeated_packed = 57 [packed=true];\n  repeated double F_Double_repeated_packed = 58 [packed=true];\n  repeated sint32 F_Sint32_repeated_packed = 502 [packed=true];\n  repeated sint64 F_Sint64_repeated_packed = 503 [packed=true];\n  repeated sfixed32 F_Sfixed32_repeated_packed = 504 [packed=true];\n  repeated sfixed64 F_Sfixed64_repeated_packed = 505 [packed=true];\n\n  // Required, repeated, and optional groups.\n  required group RequiredGroup = 70 {\n    required string RequiredField = 71;\n  };\n\n  repeated group RepeatedGroup = 80 {\n    required string RequiredField = 81;\n  };\n\n  optional group OptionalGroup = 90 {\n    required string RequiredField = 91;\n  };\n}\n\n// For testing a group containing a required field.\nmessage GoTestRequiredGroupField {\n  required group Group = 1 {\n    required int32 Field = 2;\n  };\n}\n\n// For testing skipping of unrecognized fields.\n// Numbers are all big, larger than tag numbers in GoTestField,\n// the message used in the corresponding test.\nmessage GoSkipTest {\n  required int32 skip_int32 = 11;\n  required fixed32 skip_fixed32 = 12;\n  required fixed64 skip_fixed64 = 13;\n  required string skip_string = 14;\n  required group SkipGroup = 15 {\n    required int32 group_int32 = 16;\n    required string group_string = 17;\n  }\n}\n\n// For testing packed/non-packed decoder switching.\n// A serialized instance of one should be deserializable as the other.\nmessage NonPackedTest {\n  repeated int32 a = 1;\n}\n\nmessage PackedTest {\n  repeated int32 b = 1 [packed=true];\n}\n\nmessage MaxTag {\n  // Maximum possible tag number.\n  optional string last_field = 536870911;\n}\n\nmessage OldMessage {\n  message Nested {\n    optional string name = 1;\n  }\n  optional Nested nested = 1;\n\n  optional int32 num = 2;\n}\n\n// NewMessage is wire compatible with OldMessage;\n// imagine it as a future version.\nmessage NewMessage {\n  message Nested {\n    optional string name = 1;\n    optional string food_group = 2;\n  }\n  optional Nested nested = 1;\n\n  // This is an int32 in OldMessage.\n  optional int64 num = 2;\n}\n\n// Smaller tests for ASCII formatting.\n\nmessage InnerMessage {\n  required string host = 1;\n  optional int32 port = 2 [default=4000];\n  optional bool connected = 3;\n}\n\nmessage OtherMessage {\n  optional int64 key = 1;\n  optional bytes value = 2;\n  optional float weight = 3;\n  optional InnerMessage inner = 4;\n\n  extensions 100 to max;\n}\n\nmessage RequiredInnerMessage {\n  required InnerMessage leo_finally_won_an_oscar = 1;\n}\n\nmessage MyMessage {\n  required int32 count = 1;\n  optional string name = 2;\n  optional string quote = 3;\n  repeated string pet = 4;\n  optional InnerMessage inner = 5;\n  repeated OtherMessage others = 6;\n  optional RequiredInnerMessage we_must_go_deeper = 13;\n  repeated InnerMessage rep_inner = 12;\n\n  enum Color {\n    RED = 0;\n    GREEN = 1;\n    BLUE = 2;\n  };\n  optional Color bikeshed = 7;\n\n  optional group SomeGroup = 8 {\n    optional int32 group_field = 9;\n  }\n\n  // This field becomes [][]byte in the generated code.\n  repeated bytes rep_bytes = 10;\n\n  optional double bigfloat = 11;\n\n  extensions 100 to max;\n}\n\nmessage Ext {\n  extend MyMessage {\n    optional Ext more = 103;\n    optional string text = 104;\n    optional int32 number = 105;\n  }\n\n  optional string data = 1;\n  map<int32, int32> map_field = 2;\n}\n\nextend MyMessage {\n  repeated string greeting = 106;\n  // leave field 200 unregistered for testing\n}\n\nmessage ComplexExtension {\n  optional int32 first = 1;\n  optional int32 second = 2;\n  repeated int32 third = 3;\n}\n\nextend OtherMessage {\n  optional ComplexExtension complex = 200;\n  repeated ComplexExtension r_complex = 201;\n}\n\nmessage DefaultsMessage {\n  enum DefaultsEnum {\n    ZERO = 0;\n    ONE = 1;\n    TWO = 2;\n  };\n  extensions 100 to max;\n}\n\nextend DefaultsMessage {\n  optional double no_default_double = 101;\n  optional float no_default_float = 102;\n  optional int32 no_default_int32 = 103;\n  optional int64 no_default_int64 = 104;\n  optional uint32 no_default_uint32 = 105;\n  optional uint64 no_default_uint64 = 106;\n  optional sint32 no_default_sint32 = 107;\n  optional sint64 no_default_sint64 = 108;\n  optional fixed32 no_default_fixed32 = 109;\n  optional fixed64 no_default_fixed64 = 110;\n  optional sfixed32 no_default_sfixed32 = 111;\n  optional sfixed64 no_default_sfixed64 = 112;\n  optional bool no_default_bool = 113;\n  optional string no_default_string = 114;\n  optional bytes no_default_bytes = 115;\n  optional DefaultsMessage.DefaultsEnum no_default_enum = 116;\n\n  optional double default_double = 201 [default = 3.1415];\n  optional float default_float = 202 [default = 3.14];\n  optional int32 default_int32 = 203 [default = 42];\n  optional int64 default_int64 = 204 [default = 43];\n  optional uint32 default_uint32 = 205 [default = 44];\n  optional uint64 default_uint64 = 206 [default = 45];\n  optional sint32 default_sint32 = 207 [default = 46];\n  optional sint64 default_sint64 = 208 [default = 47];\n  optional fixed32 default_fixed32 = 209 [default = 48];\n  optional fixed64 default_fixed64 = 210 [default = 49];\n  optional sfixed32 default_sfixed32 = 211 [default = 50];\n  optional sfixed64 default_sfixed64 = 212 [default = 51];\n  optional bool default_bool = 213 [default = true];\n  optional string default_string = 214 [default = \"Hello, string,def=foo\"];\n  optional bytes default_bytes = 215 [default = \"Hello, bytes\"];\n  optional DefaultsMessage.DefaultsEnum default_enum = 216 [default = ONE];\n}\n\nmessage Empty {\n}\n\nmessage MessageList {\n  repeated group Message = 1 {\n    required string name = 2;\n    required int32 count = 3;\n  }\n}\n\nmessage Strings {\n  optional string string_field = 1;\n  optional bytes bytes_field = 2;\n}\n\nmessage Defaults {\n  enum Color {\n    RED = 0;\n    GREEN = 1;\n    BLUE = 2;\n  }\n\n  // Default-valued fields of all basic types.\n  // Same as GoTest, but copied here to make testing easier.\n  optional bool F_Bool = 1 [default=true];\n  optional int32 F_Int32 = 2 [default=32];\n  optional int64 F_Int64 = 3 [default=64];\n  optional fixed32 F_Fixed32 = 4 [default=320];\n  optional fixed64 F_Fixed64 = 5 [default=640];\n  optional uint32 F_Uint32 = 6 [default=3200];\n  optional uint64 F_Uint64 = 7 [default=6400];\n  optional float F_Float = 8 [default=314159.];\n  optional double F_Double = 9 [default=271828.];\n  optional string F_String = 10 [default=\"hello, \\\"world!\\\"\\n\"];\n  optional bytes F_Bytes = 11 [default=\"Bignose\"];\n  optional sint32 F_Sint32 = 12 [default=-32];\n  optional sint64 F_Sint64 = 13 [default=-64];\n  optional Color F_Enum = 14 [default=GREEN];\n\n  // More fields with crazy defaults.\n  optional float F_Pinf = 15 [default=inf];\n  optional float F_Ninf = 16 [default=-inf];\n  optional float F_Nan = 17 [default=nan];\n\n  // Sub-message.\n  optional SubDefaults sub = 18;\n\n  // Redundant but explicit defaults.\n  optional string str_zero = 19 [default=\"\"];\n}\n\nmessage SubDefaults {\n  optional int64 n = 1 [default=7];\n}\n\nmessage RepeatedEnum {\n  enum Color {\n    RED = 1;\n  }\n  repeated Color color = 1;\n}\n\nmessage MoreRepeated {\n  repeated bool bools = 1;\n  repeated bool bools_packed = 2 [packed=true];\n  repeated int32 ints = 3;\n  repeated int32 ints_packed = 4 [packed=true];\n  repeated int64 int64s_packed = 7 [packed=true];\n  repeated string strings = 5;\n  repeated fixed32 fixeds = 6;\n}\n\n// GroupOld and GroupNew have the same wire format.\n// GroupNew has a new field inside a group.\n\nmessage GroupOld {\n  optional group G = 101 {\n    optional int32 x = 2;\n  }\n}\n\nmessage GroupNew {\n  optional group G = 101 {\n    optional int32 x = 2;\n    optional int32 y = 3;\n  }\n}\n\nmessage FloatingPoint {\n  required double f = 1;\n  optional bool exact = 2;\n}\n\nmessage MessageWithMap {\n  map<int32, string> name_mapping = 1;\n  map<sint64, FloatingPoint> msg_mapping = 2;\n  map<bool, bytes> byte_mapping = 3;\n  map<string, string> str_to_str = 4;\n}\n\nmessage Oneof {\n  oneof union {\n    bool F_Bool = 1;\n    int32 F_Int32 = 2;\n    int64 F_Int64 = 3;\n    fixed32 F_Fixed32 = 4;\n    fixed64 F_Fixed64 = 5;\n    uint32 F_Uint32 = 6;\n    uint64 F_Uint64 = 7;\n    float F_Float = 8;\n    double F_Double = 9;\n    string F_String = 10;\n    bytes F_Bytes = 11;\n    sint32 F_Sint32 = 12;\n    sint64 F_Sint64 = 13;\n    MyMessage.Color F_Enum = 14;\n    GoTestField F_Message = 15;\n    group F_Group = 16 {\n      optional int32 x = 17;\n    }\n    int32 F_Largest_Tag = 536870911;\n  }\n\n  oneof tormato {\n    int32 value = 100;\n  }\n}\n\nmessage Communique {\n  optional bool make_me_cry = 1;\n\n  // This is a oneof, called \"union\".\n  oneof union {\n    int32 number = 5;\n    string name = 6;\n    bytes data = 7;\n    double temp_c = 8;\n    MyMessage.Color col = 9;\n    Strings msg = 10;\n  }\n}\n\nmessage TestUTF8 {\n  optional string scalar = 1;\n  repeated string vector = 2;\n  oneof oneof { string field = 3; }\n  map<string, int64> map_key = 4;\n  map<int64, string> map_value = 5;\n}\n"
  },
  {
    "path": "internal/testprotos/proto3_proto/test.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: proto3_proto/test.proto\n\npackage proto3_proto\n\nimport (\n\tfmt \"fmt\"\n\tproto2_proto \"github.com/golang/protobuf/internal/testprotos/proto2_proto\"\n\tproto \"github.com/golang/protobuf/proto\"\n\tanypb \"google.golang.org/protobuf/types/known/anypb\"\n\tmath \"math\"\n)\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package\n\ntype Message_Humour int32\n\nconst (\n\tMessage_UNKNOWN     Message_Humour = 0\n\tMessage_PUNS        Message_Humour = 1\n\tMessage_SLAPSTICK   Message_Humour = 2\n\tMessage_BILL_BAILEY Message_Humour = 3\n)\n\nvar Message_Humour_name = map[int32]string{\n\t0: \"UNKNOWN\",\n\t1: \"PUNS\",\n\t2: \"SLAPSTICK\",\n\t3: \"BILL_BAILEY\",\n}\n\nvar Message_Humour_value = map[string]int32{\n\t\"UNKNOWN\":     0,\n\t\"PUNS\":        1,\n\t\"SLAPSTICK\":   2,\n\t\"BILL_BAILEY\": 3,\n}\n\nfunc (x Message_Humour) String() string {\n\treturn proto.EnumName(Message_Humour_name, int32(x))\n}\n\nfunc (Message_Humour) EnumDescriptor() ([]byte, []int) {\n\treturn fileDescriptor_ff83f0b8d2b92afa, []int{0, 0}\n}\n\ntype Message struct {\n\tName                 string                               `protobuf:\"bytes,1,opt,name=name,proto3\" json:\"name,omitempty\"`\n\tHilarity             Message_Humour                       `protobuf:\"varint,2,opt,name=hilarity,proto3,enum=proto3_test.Message_Humour\" json:\"hilarity,omitempty\"`\n\tHeightInCm           uint32                               `protobuf:\"varint,3,opt,name=height_in_cm,json=heightInCm,proto3\" json:\"height_in_cm,omitempty\"`\n\tData                 []byte                               `protobuf:\"bytes,4,opt,name=data,proto3\" json:\"data,omitempty\"`\n\tResultCount          int64                                `protobuf:\"varint,7,opt,name=result_count,json=resultCount,proto3\" json:\"result_count,omitempty\"`\n\tTrueScotsman         bool                                 `protobuf:\"varint,8,opt,name=true_scotsman,json=trueScotsman,proto3\" json:\"true_scotsman,omitempty\"`\n\tScore                float32                              `protobuf:\"fixed32,9,opt,name=score,proto3\" json:\"score,omitempty\"`\n\tKey                  []uint64                             `protobuf:\"varint,5,rep,packed,name=key,proto3\" json:\"key,omitempty\"`\n\tShortKey             []int32                              `protobuf:\"varint,19,rep,packed,name=short_key,json=shortKey,proto3\" json:\"short_key,omitempty\"`\n\tNested               *Nested                              `protobuf:\"bytes,6,opt,name=nested,proto3\" json:\"nested,omitempty\"`\n\tRFunny               []Message_Humour                     `protobuf:\"varint,16,rep,packed,name=r_funny,json=rFunny,proto3,enum=proto3_test.Message_Humour\" json:\"r_funny,omitempty\"`\n\tTerrain              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\"`\n\tProto2Field          *proto2_proto.SubDefaults            `protobuf:\"bytes,11,opt,name=proto2_field,json=proto2Field,proto3\" json:\"proto2_field,omitempty\"`\n\tProto2Value          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\"`\n\tAnything             *anypb.Any                           `protobuf:\"bytes,14,opt,name=anything,proto3\" json:\"anything,omitempty\"`\n\tManyThings           []*anypb.Any                         `protobuf:\"bytes,15,rep,name=many_things,json=manyThings,proto3\" json:\"many_things,omitempty\"`\n\tSubmessage           *Message                             `protobuf:\"bytes,17,opt,name=submessage,proto3\" json:\"submessage,omitempty\"`\n\tChildren             []*Message                           `protobuf:\"bytes,18,rep,name=children,proto3\" json:\"children,omitempty\"`\n\tStringMap            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\"`\n\tXXX_NoUnkeyedLiteral struct{}                             `json:\"-\"`\n\tXXX_unrecognized     []byte                               `json:\"-\"`\n\tXXX_sizecache        int32                                `json:\"-\"`\n}\n\nfunc (m *Message) Reset()         { *m = Message{} }\nfunc (m *Message) String() string { return proto.CompactTextString(m) }\nfunc (*Message) ProtoMessage()    {}\nfunc (*Message) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_ff83f0b8d2b92afa, []int{0}\n}\n\nfunc (m *Message) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Message.Unmarshal(m, b)\n}\nfunc (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Message.Marshal(b, m, deterministic)\n}\nfunc (m *Message) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Message.Merge(m, src)\n}\nfunc (m *Message) XXX_Size() int {\n\treturn xxx_messageInfo_Message.Size(m)\n}\nfunc (m *Message) XXX_DiscardUnknown() {\n\txxx_messageInfo_Message.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Message proto.InternalMessageInfo\n\nfunc (m *Message) GetName() string {\n\tif m != nil {\n\t\treturn m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *Message) GetHilarity() Message_Humour {\n\tif m != nil {\n\t\treturn m.Hilarity\n\t}\n\treturn Message_UNKNOWN\n}\n\nfunc (m *Message) GetHeightInCm() uint32 {\n\tif m != nil {\n\t\treturn m.HeightInCm\n\t}\n\treturn 0\n}\n\nfunc (m *Message) GetData() []byte {\n\tif m != nil {\n\t\treturn m.Data\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetResultCount() int64 {\n\tif m != nil {\n\t\treturn m.ResultCount\n\t}\n\treturn 0\n}\n\nfunc (m *Message) GetTrueScotsman() bool {\n\tif m != nil {\n\t\treturn m.TrueScotsman\n\t}\n\treturn false\n}\n\nfunc (m *Message) GetScore() float32 {\n\tif m != nil {\n\t\treturn m.Score\n\t}\n\treturn 0\n}\n\nfunc (m *Message) GetKey() []uint64 {\n\tif m != nil {\n\t\treturn m.Key\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetShortKey() []int32 {\n\tif m != nil {\n\t\treturn m.ShortKey\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetNested() *Nested {\n\tif m != nil {\n\t\treturn m.Nested\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetRFunny() []Message_Humour {\n\tif m != nil {\n\t\treturn m.RFunny\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetTerrain() map[string]*Nested {\n\tif m != nil {\n\t\treturn m.Terrain\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetProto2Field() *proto2_proto.SubDefaults {\n\tif m != nil {\n\t\treturn m.Proto2Field\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetProto2Value() map[string]*proto2_proto.SubDefaults {\n\tif m != nil {\n\t\treturn m.Proto2Value\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetAnything() *anypb.Any {\n\tif m != nil {\n\t\treturn m.Anything\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetManyThings() []*anypb.Any {\n\tif m != nil {\n\t\treturn m.ManyThings\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetSubmessage() *Message {\n\tif m != nil {\n\t\treturn m.Submessage\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetChildren() []*Message {\n\tif m != nil {\n\t\treturn m.Children\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetStringMap() map[string]string {\n\tif m != nil {\n\t\treturn m.StringMap\n\t}\n\treturn nil\n}\n\ntype Nested struct {\n\tBunny                string   `protobuf:\"bytes,1,opt,name=bunny,proto3\" json:\"bunny,omitempty\"`\n\tCute                 bool     `protobuf:\"varint,2,opt,name=cute,proto3\" json:\"cute,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{} `json:\"-\"`\n\tXXX_unrecognized     []byte   `json:\"-\"`\n\tXXX_sizecache        int32    `json:\"-\"`\n}\n\nfunc (m *Nested) Reset()         { *m = Nested{} }\nfunc (m *Nested) String() string { return proto.CompactTextString(m) }\nfunc (*Nested) ProtoMessage()    {}\nfunc (*Nested) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_ff83f0b8d2b92afa, []int{1}\n}\n\nfunc (m *Nested) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_Nested.Unmarshal(m, b)\n}\nfunc (m *Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_Nested.Marshal(b, m, deterministic)\n}\nfunc (m *Nested) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_Nested.Merge(m, src)\n}\nfunc (m *Nested) XXX_Size() int {\n\treturn xxx_messageInfo_Nested.Size(m)\n}\nfunc (m *Nested) XXX_DiscardUnknown() {\n\txxx_messageInfo_Nested.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_Nested proto.InternalMessageInfo\n\nfunc (m *Nested) GetBunny() string {\n\tif m != nil {\n\t\treturn m.Bunny\n\t}\n\treturn \"\"\n}\n\nfunc (m *Nested) GetCute() bool {\n\tif m != nil {\n\t\treturn m.Cute\n\t}\n\treturn false\n}\n\ntype MessageWithMap struct {\n\tByteMapping          map[bool][]byte `protobuf:\"bytes,1,rep,name=byte_mapping,json=byteMapping,proto3\" json:\"byte_mapping,omitempty\" protobuf_key:\"varint,1,opt,name=key,proto3\" protobuf_val:\"bytes,2,opt,name=value,proto3\"`\n\tXXX_NoUnkeyedLiteral struct{}        `json:\"-\"`\n\tXXX_unrecognized     []byte          `json:\"-\"`\n\tXXX_sizecache        int32           `json:\"-\"`\n}\n\nfunc (m *MessageWithMap) Reset()         { *m = MessageWithMap{} }\nfunc (m *MessageWithMap) String() string { return proto.CompactTextString(m) }\nfunc (*MessageWithMap) ProtoMessage()    {}\nfunc (*MessageWithMap) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_ff83f0b8d2b92afa, []int{2}\n}\n\nfunc (m *MessageWithMap) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_MessageWithMap.Unmarshal(m, b)\n}\nfunc (m *MessageWithMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_MessageWithMap.Marshal(b, m, deterministic)\n}\nfunc (m *MessageWithMap) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_MessageWithMap.Merge(m, src)\n}\nfunc (m *MessageWithMap) XXX_Size() int {\n\treturn xxx_messageInfo_MessageWithMap.Size(m)\n}\nfunc (m *MessageWithMap) XXX_DiscardUnknown() {\n\txxx_messageInfo_MessageWithMap.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_MessageWithMap proto.InternalMessageInfo\n\nfunc (m *MessageWithMap) GetByteMapping() map[bool][]byte {\n\tif m != nil {\n\t\treturn m.ByteMapping\n\t}\n\treturn nil\n}\n\ntype IntMap struct {\n\tRtt                  map[int32]int32 `protobuf:\"bytes,1,rep,name=rtt,proto3\" json:\"rtt,omitempty\" protobuf_key:\"varint,1,opt,name=key,proto3\" protobuf_val:\"varint,2,opt,name=value,proto3\"`\n\tXXX_NoUnkeyedLiteral struct{}        `json:\"-\"`\n\tXXX_unrecognized     []byte          `json:\"-\"`\n\tXXX_sizecache        int32           `json:\"-\"`\n}\n\nfunc (m *IntMap) Reset()         { *m = IntMap{} }\nfunc (m *IntMap) String() string { return proto.CompactTextString(m) }\nfunc (*IntMap) ProtoMessage()    {}\nfunc (*IntMap) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_ff83f0b8d2b92afa, []int{3}\n}\n\nfunc (m *IntMap) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_IntMap.Unmarshal(m, b)\n}\nfunc (m *IntMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_IntMap.Marshal(b, m, deterministic)\n}\nfunc (m *IntMap) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_IntMap.Merge(m, src)\n}\nfunc (m *IntMap) XXX_Size() int {\n\treturn xxx_messageInfo_IntMap.Size(m)\n}\nfunc (m *IntMap) XXX_DiscardUnknown() {\n\txxx_messageInfo_IntMap.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_IntMap proto.InternalMessageInfo\n\nfunc (m *IntMap) GetRtt() map[int32]int32 {\n\tif m != nil {\n\t\treturn m.Rtt\n\t}\n\treturn nil\n}\n\ntype IntMaps struct {\n\tMaps                 []*IntMap `protobuf:\"bytes,1,rep,name=maps,proto3\" json:\"maps,omitempty\"`\n\tXXX_NoUnkeyedLiteral struct{}  `json:\"-\"`\n\tXXX_unrecognized     []byte    `json:\"-\"`\n\tXXX_sizecache        int32     `json:\"-\"`\n}\n\nfunc (m *IntMaps) Reset()         { *m = IntMaps{} }\nfunc (m *IntMaps) String() string { return proto.CompactTextString(m) }\nfunc (*IntMaps) ProtoMessage()    {}\nfunc (*IntMaps) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_ff83f0b8d2b92afa, []int{4}\n}\n\nfunc (m *IntMaps) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_IntMaps.Unmarshal(m, b)\n}\nfunc (m *IntMaps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_IntMaps.Marshal(b, m, deterministic)\n}\nfunc (m *IntMaps) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_IntMaps.Merge(m, src)\n}\nfunc (m *IntMaps) XXX_Size() int {\n\treturn xxx_messageInfo_IntMaps.Size(m)\n}\nfunc (m *IntMaps) XXX_DiscardUnknown() {\n\txxx_messageInfo_IntMaps.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_IntMaps proto.InternalMessageInfo\n\nfunc (m *IntMaps) GetMaps() []*IntMap {\n\tif m != nil {\n\t\treturn m.Maps\n\t}\n\treturn nil\n}\n\ntype TestUTF8 struct {\n\tScalar string   `protobuf:\"bytes,1,opt,name=scalar,proto3\" json:\"scalar,omitempty\"`\n\tVector []string `protobuf:\"bytes,2,rep,name=vector,proto3\" json:\"vector,omitempty\"`\n\t// Types that are valid to be assigned to Oneof:\n\t//\t*TestUTF8_Field\n\tOneof                isTestUTF8_Oneof `protobuf_oneof:\"oneof\"`\n\tMapKey               map[string]int64 `protobuf:\"bytes,4,rep,name=map_key,json=mapKey,proto3\" json:\"map_key,omitempty\" protobuf_key:\"bytes,1,opt,name=key,proto3\" protobuf_val:\"varint,2,opt,name=value,proto3\"`\n\tMapValue             map[int64]string `protobuf:\"bytes,5,rep,name=map_value,json=mapValue,proto3\" json:\"map_value,omitempty\" protobuf_key:\"varint,1,opt,name=key,proto3\" protobuf_val:\"bytes,2,opt,name=value,proto3\"`\n\tXXX_NoUnkeyedLiteral struct{}         `json:\"-\"`\n\tXXX_unrecognized     []byte           `json:\"-\"`\n\tXXX_sizecache        int32            `json:\"-\"`\n}\n\nfunc (m *TestUTF8) Reset()         { *m = TestUTF8{} }\nfunc (m *TestUTF8) String() string { return proto.CompactTextString(m) }\nfunc (*TestUTF8) ProtoMessage()    {}\nfunc (*TestUTF8) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor_ff83f0b8d2b92afa, []int{5}\n}\n\nfunc (m *TestUTF8) XXX_Unmarshal(b []byte) error {\n\treturn xxx_messageInfo_TestUTF8.Unmarshal(m, b)\n}\nfunc (m *TestUTF8) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\n\treturn xxx_messageInfo_TestUTF8.Marshal(b, m, deterministic)\n}\nfunc (m *TestUTF8) XXX_Merge(src proto.Message) {\n\txxx_messageInfo_TestUTF8.Merge(m, src)\n}\nfunc (m *TestUTF8) XXX_Size() int {\n\treturn xxx_messageInfo_TestUTF8.Size(m)\n}\nfunc (m *TestUTF8) XXX_DiscardUnknown() {\n\txxx_messageInfo_TestUTF8.DiscardUnknown(m)\n}\n\nvar xxx_messageInfo_TestUTF8 proto.InternalMessageInfo\n\nfunc (m *TestUTF8) GetScalar() string {\n\tif m != nil {\n\t\treturn m.Scalar\n\t}\n\treturn \"\"\n}\n\nfunc (m *TestUTF8) GetVector() []string {\n\tif m != nil {\n\t\treturn m.Vector\n\t}\n\treturn nil\n}\n\ntype isTestUTF8_Oneof interface {\n\tisTestUTF8_Oneof()\n}\n\ntype TestUTF8_Field struct {\n\tField string `protobuf:\"bytes,3,opt,name=field,proto3,oneof\"`\n}\n\nfunc (*TestUTF8_Field) isTestUTF8_Oneof() {}\n\nfunc (m *TestUTF8) GetOneof() isTestUTF8_Oneof {\n\tif m != nil {\n\t\treturn m.Oneof\n\t}\n\treturn nil\n}\n\nfunc (m *TestUTF8) GetField() string {\n\tif x, ok := m.GetOneof().(*TestUTF8_Field); ok {\n\t\treturn x.Field\n\t}\n\treturn \"\"\n}\n\nfunc (m *TestUTF8) GetMapKey() map[string]int64 {\n\tif m != nil {\n\t\treturn m.MapKey\n\t}\n\treturn nil\n}\n\nfunc (m *TestUTF8) GetMapValue() map[int64]string {\n\tif m != nil {\n\t\treturn m.MapValue\n\t}\n\treturn nil\n}\n\n// XXX_OneofWrappers is for the internal use of the proto package.\nfunc (*TestUTF8) XXX_OneofWrappers() []interface{} {\n\treturn []interface{}{\n\t\t(*TestUTF8_Field)(nil),\n\t}\n}\n\nfunc init() {\n\tproto.RegisterEnum(\"proto3_test.Message_Humour\", Message_Humour_name, Message_Humour_value)\n\tproto.RegisterType((*Message)(nil), \"proto3_test.Message\")\n\tproto.RegisterMapType((map[string]*proto2_proto.SubDefaults)(nil), \"proto3_test.Message.Proto2ValueEntry\")\n\tproto.RegisterMapType((map[string]string)(nil), \"proto3_test.Message.StringMapEntry\")\n\tproto.RegisterMapType((map[string]*Nested)(nil), \"proto3_test.Message.TerrainEntry\")\n\tproto.RegisterType((*Nested)(nil), \"proto3_test.Nested\")\n\tproto.RegisterType((*MessageWithMap)(nil), \"proto3_test.MessageWithMap\")\n\tproto.RegisterMapType((map[bool][]byte)(nil), \"proto3_test.MessageWithMap.ByteMappingEntry\")\n\tproto.RegisterType((*IntMap)(nil), \"proto3_test.IntMap\")\n\tproto.RegisterMapType((map[int32]int32)(nil), \"proto3_test.IntMap.RttEntry\")\n\tproto.RegisterType((*IntMaps)(nil), \"proto3_test.IntMaps\")\n\tproto.RegisterType((*TestUTF8)(nil), \"proto3_test.TestUTF8\")\n\tproto.RegisterMapType((map[string]int64)(nil), \"proto3_test.TestUTF8.MapKeyEntry\")\n\tproto.RegisterMapType((map[int64]string)(nil), \"proto3_test.TestUTF8.MapValueEntry\")\n}\n\nfunc init() { proto.RegisterFile(\"proto3_proto/test.proto\", fileDescriptor_ff83f0b8d2b92afa) }\n\nvar fileDescriptor_ff83f0b8d2b92afa = []byte{\n\t// 926 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0x6d, 0x6f, 0xdb, 0x36,\n\t0x10, 0xae, 0x2c, 0xbf, 0xc8, 0x67, 0x3b, 0xf5, 0x98, 0xa0, 0xe3, 0xdc, 0x7d, 0x50, 0x5d, 0x0c,\n\t0xd3, 0xb0, 0x41, 0x1e, 0xbc, 0x6e, 0xeb, 0x9a, 0xbd, 0xc5, 0x59, 0x83, 0x18, 0x89, 0x9d, 0x40,\n\t0x76, 0xd6, 0x6d, 0x5f, 0x04, 0xda, 0xa1, 0x6d, 0x61, 0x12, 0x65, 0x88, 0x54, 0x01, 0xfd, 0x9c,\n\t0xfd, 0xa4, 0xfd, 0xa2, 0x0d, 0x24, 0xe5, 0x54, 0x6e, 0x15, 0xe4, 0x93, 0x79, 0x8f, 0x9f, 0xbb,\n\t0xe7, 0x78, 0x77, 0x3c, 0xc1, 0xc7, 0xdb, 0x24, 0x16, 0xf1, 0x37, 0xbe, 0xfa, 0x19, 0x08, 0xca,\n\t0x85, 0xab, 0x8e, 0xa8, 0x95, 0xff, 0x21, 0xa1, 0xde, 0x27, 0xeb, 0x38, 0x5e, 0x87, 0x74, 0xa0,\n\t0xb0, 0x45, 0xba, 0x1a, 0x10, 0x96, 0x69, 0x5e, 0x4f, 0x07, 0x18, 0x7e, 0x10, 0xa0, 0xff, 0x9f,\n\t0x05, 0x8d, 0x09, 0xe5, 0x9c, 0xac, 0x29, 0x42, 0x50, 0x65, 0x24, 0xa2, 0xd8, 0xb0, 0x0d, 0xa7,\n\t0xe9, 0xa9, 0x33, 0xfa, 0x1e, 0xac, 0x4d, 0x10, 0x92, 0x24, 0x10, 0x19, 0xae, 0xd8, 0x86, 0x73,\n\t0x30, 0x7c, 0xea, 0x16, 0x34, 0xdd, 0xdc, 0xd7, 0x3d, 0x4f, 0xa3, 0x38, 0x4d, 0xbc, 0x3b, 0x32,\n\t0xb2, 0xa1, 0xbd, 0xa1, 0xc1, 0x7a, 0x23, 0xfc, 0x80, 0xf9, 0xcb, 0x08, 0x9b, 0xb6, 0xe1, 0x74,\n\t0x3c, 0xd0, 0xd8, 0x98, 0x9d, 0x46, 0x52, 0xee, 0x96, 0x08, 0x82, 0xab, 0xb6, 0xe1, 0xb4, 0x3d,\n\t0x75, 0x46, 0xcf, 0xa0, 0x9d, 0x50, 0x9e, 0x86, 0xc2, 0x5f, 0xc6, 0x29, 0x13, 0xb8, 0x61, 0x1b,\n\t0x8e, 0xe9, 0xb5, 0x34, 0x76, 0x2a, 0x21, 0xf4, 0x1c, 0x3a, 0x22, 0x49, 0xa9, 0xcf, 0x97, 0xb1,\n\t0xe0, 0x11, 0x61, 0xd8, 0xb2, 0x0d, 0xc7, 0xf2, 0xda, 0x12, 0x9c, 0xe5, 0x18, 0x3a, 0x82, 0x1a,\n\t0x5f, 0xc6, 0x09, 0xc5, 0x4d, 0xdb, 0x70, 0x2a, 0x9e, 0x36, 0x50, 0x17, 0xcc, 0xbf, 0x69, 0x86,\n\t0x6b, 0xb6, 0xe9, 0x54, 0x3d, 0x79, 0x44, 0x4f, 0xa1, 0xc9, 0x37, 0x71, 0x22, 0x7c, 0x89, 0x1f,\n\t0xda, 0xa6, 0x53, 0xf3, 0x2c, 0x05, 0x5c, 0xd0, 0x0c, 0x7d, 0x09, 0x75, 0x46, 0xb9, 0xa0, 0xb7,\n\t0xb8, 0x6e, 0x1b, 0x4e, 0x6b, 0x78, 0xb8, 0x77, 0xf3, 0xa9, 0xfa, 0xcb, 0xcb, 0x29, 0xe8, 0x05,\n\t0x34, 0x12, 0x7f, 0x95, 0x32, 0x96, 0xe1, 0xae, 0x6d, 0x3e, 0x54, 0xa7, 0x7a, 0x72, 0x26, 0xa9,\n\t0xe8, 0x18, 0x1a, 0x82, 0x26, 0x09, 0x09, 0x18, 0x06, 0xdb, 0x74, 0x5a, 0xc3, 0x67, 0xa5, 0x5e,\n\t0x73, 0xcd, 0x79, 0xcd, 0x44, 0x92, 0x79, 0x3b, 0x0f, 0x74, 0x0c, 0xed, 0xbc, 0xad, 0xab, 0x80,\n\t0x86, 0xb7, 0xb8, 0xa5, 0xb2, 0xc4, 0x6e, 0x0e, 0xaa, 0x08, 0xb3, 0x74, 0xf1, 0x1b, 0x5d, 0x91,\n\t0x34, 0x14, 0xdc, 0xd3, 0xc3, 0x32, 0x3c, 0x93, 0x64, 0x74, 0x7e, 0xe7, 0xfc, 0x96, 0x84, 0x29,\n\t0xc5, 0x1d, 0x25, 0xff, 0x59, 0xa9, 0xfc, 0xb5, 0x22, 0xfe, 0x2e, 0x79, 0x3a, 0x85, 0x3c, 0x92,\n\t0x42, 0xd0, 0xd7, 0x60, 0x11, 0x96, 0x89, 0x4d, 0xc0, 0xd6, 0xf8, 0x40, 0xa5, 0x70, 0xe4, 0xea,\n\t0x49, 0x74, 0x77, 0x93, 0xe8, 0x9e, 0xb0, 0xcc, 0xbb, 0x63, 0xa1, 0x6f, 0xa1, 0x15, 0x11, 0x96,\n\t0xf9, 0xca, 0xe2, 0xf8, 0xb1, 0x92, 0x2e, 0x77, 0x02, 0x49, 0x9c, 0x2b, 0x1e, 0x7a, 0x01, 0xc0,\n\t0xd3, 0x45, 0xa4, 0x93, 0xc2, 0x1f, 0xe5, 0x52, 0x25, 0x09, 0x7b, 0x05, 0x9e, 0x4c, 0x6f, 0xb9,\n\t0x09, 0xc2, 0xdb, 0x84, 0x32, 0x8c, 0x72, 0xa5, 0x32, 0x9f, 0x3b, 0x16, 0x1a, 0x01, 0x70, 0x91,\n\t0x04, 0x6c, 0xed, 0x47, 0x64, 0x8b, 0x8f, 0x94, 0xcf, 0xf3, 0xd2, 0xc2, 0xcc, 0x14, 0x6d, 0x42,\n\t0xb6, 0xba, 0x2c, 0x4d, 0xbe, 0xb3, 0x7b, 0x57, 0xd0, 0x2e, 0x36, 0x6d, 0x37, 0x7a, 0xfa, 0x69,\n\t0xa9, 0xd1, 0xfb, 0x02, 0x6a, 0xba, 0xf2, 0x95, 0xfb, 0x87, 0x4b, 0x33, 0x5e, 0x55, 0x5e, 0x1a,\n\t0xbd, 0x3f, 0xa0, 0xfb, 0x7e, 0x1b, 0x4a, 0x82, 0xba, 0xfb, 0x41, 0xef, 0x9f, 0x85, 0x42, 0xe4,\n\t0x1f, 0xe1, 0x60, 0xff, 0x1e, 0x25, 0x71, 0x8f, 0x8a, 0x71, 0x9b, 0x05, 0xef, 0xfe, 0x2f, 0x50,\n\t0xd7, 0x33, 0x8d, 0x5a, 0xd0, 0xb8, 0x99, 0x5e, 0x4c, 0xaf, 0xde, 0x4c, 0xbb, 0x8f, 0x90, 0x05,\n\t0xd5, 0xeb, 0x9b, 0xe9, 0xac, 0x6b, 0xa0, 0x0e, 0x34, 0x67, 0x97, 0x27, 0xd7, 0xb3, 0xf9, 0xf8,\n\t0xf4, 0xa2, 0x5b, 0x41, 0x8f, 0xa1, 0x35, 0x1a, 0x5f, 0x5e, 0xfa, 0xa3, 0x93, 0xf1, 0xe5, 0xeb,\n\t0x3f, 0xbb, 0x66, 0x7f, 0x08, 0x75, 0x7d, 0x5b, 0x29, 0xb2, 0x50, 0x0f, 0x48, 0x0b, 0x6b, 0x43,\n\t0xae, 0x89, 0x65, 0x2a, 0xb4, 0xb2, 0xe5, 0xa9, 0x73, 0xff, 0x1f, 0x03, 0x0e, 0xf2, 0x1e, 0xbc,\n\t0x09, 0xc4, 0x66, 0x42, 0xb6, 0xe8, 0x0a, 0xda, 0x8b, 0x4c, 0x50, 0xd9, 0xb2, 0xad, 0x9c, 0x44,\n\t0x43, 0xb5, 0xed, 0xab, 0xb2, 0xb6, 0xe5, 0x2e, 0xee, 0x28, 0x13, 0x74, 0xa2, 0xe9, 0xf9, 0x58,\n\t0x2f, 0xde, 0x21, 0xbd, 0x9f, 0xa1, 0xfb, 0x3e, 0xa1, 0x58, 0x18, 0xab, 0xa4, 0x30, 0xed, 0x62,\n\t0x61, 0xb6, 0x50, 0x1f, 0x33, 0x21, 0x53, 0x73, 0xc1, 0x4c, 0x84, 0xc8, 0x33, 0xfa, 0x74, 0x2f,\n\t0x23, 0xcd, 0x70, 0x3d, 0x21, 0x74, 0x06, 0x92, 0xd8, 0xfb, 0x0e, 0xac, 0x1d, 0x50, 0x54, 0xac,\n\t0x95, 0x28, 0xd6, 0x8a, 0x8a, 0x43, 0x68, 0xe8, 0x78, 0x1c, 0x7d, 0x0e, 0xd5, 0x88, 0x6c, 0x79,\n\t0xae, 0x79, 0x58, 0xa2, 0xe9, 0x29, 0x42, 0xff, 0xdf, 0x0a, 0x58, 0x73, 0xca, 0xc5, 0xcd, 0xfc,\n\t0xec, 0x25, 0x7a, 0x02, 0x75, 0xbe, 0x24, 0x21, 0x49, 0xf2, 0x0e, 0xe4, 0x96, 0xc4, 0xdf, 0xd2,\n\t0xa5, 0x88, 0x13, 0x5c, 0xb1, 0x4d, 0x89, 0x6b, 0x0b, 0x3d, 0x81, 0x9a, 0xde, 0x3c, 0x72, 0xb9,\n\t0x37, 0xcf, 0x1f, 0x79, 0xda, 0x44, 0xaf, 0xa0, 0x11, 0x91, 0xad, 0xda, 0xa9, 0xd5, 0x92, 0xad,\n\t0xb6, 0xd3, 0x73, 0x27, 0x64, 0x7b, 0x41, 0x33, 0x7d, 0xf3, 0x7a, 0xa4, 0x0c, 0xf4, 0x2b, 0x34,\n\t0xa5, 0xaf, 0xbe, 0x62, 0xad, 0xe4, 0xed, 0x15, 0xbd, 0x0b, 0x2b, 0xc9, 0x8a, 0x72, 0xb3, 0xf7,\n\t0x03, 0xb4, 0x0a, 0x81, 0x1f, 0x1a, 0x66, 0xb3, 0xf8, 0x14, 0x8e, 0xa1, 0xb3, 0x17, 0xb5, 0xe8,\n\t0x6c, 0x3e, 0xf0, 0x12, 0x46, 0x0d, 0xa8, 0xc5, 0x8c, 0xc6, 0xab, 0xd1, 0x4f, 0x7f, 0x1d, 0xaf,\n\t0x03, 0xb1, 0x49, 0x17, 0xee, 0x32, 0x8e, 0x06, 0xeb, 0x38, 0x24, 0x6c, 0xfd, 0xee, 0xa3, 0x1c,\n\t0x30, 0x41, 0x13, 0x46, 0x42, 0xf5, 0x15, 0x56, 0x28, 0x1f, 0x14, 0x3f, 0xef, 0x8b, 0xba, 0xb6,\n\t0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x10, 0x03, 0x1b, 0x06, 0xf5, 0x07, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/testprotos/proto3_proto/test.proto",
    "content": "// Copyright 2014 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nsyntax = \"proto3\";\n\noption go_package = \"github.com/golang/protobuf/internal/testprotos/proto3_proto\";\n\nimport \"google/protobuf/any.proto\";\nimport \"proto2_proto/test.proto\";\n\npackage proto3_test;\n\nmessage Message {\n  enum Humour {\n    UNKNOWN = 0;\n    PUNS = 1;\n    SLAPSTICK = 2;\n    BILL_BAILEY = 3;\n  }\n\n  string name = 1;\n  Humour hilarity = 2;\n  uint32 height_in_cm = 3;\n  bytes data = 4;\n  int64 result_count = 7;\n  bool true_scotsman = 8;\n  float score = 9;\n\n  repeated uint64 key = 5;\n  repeated int32 short_key = 19;\n  Nested nested = 6;\n  repeated Humour r_funny = 16;\n\n  map<string, Nested> terrain = 10;\n  proto2_test.SubDefaults proto2_field = 11;\n  map<string, proto2_test.SubDefaults> proto2_value = 13;\n\n  google.protobuf.Any anything = 14;\n  repeated google.protobuf.Any many_things = 15;\n\n  Message submessage = 17;\n  repeated Message children = 18;\n\n  map<string, string> string_map = 20;\n}\n\nmessage Nested {\n  string bunny = 1;\n  bool cute = 2;\n}\n\nmessage MessageWithMap {\n  map<bool, bytes> byte_mapping = 1;\n}\n\n\nmessage IntMap {\n  map<int32, int32> rtt = 1;\n}\n\nmessage IntMaps {\n  repeated IntMap maps = 1;\n}\n\nmessage TestUTF8 {\n  string scalar = 1;\n  repeated string vector = 2;\n  oneof oneof { string field = 3; }\n  map<string, int64> map_key = 4;\n  map<int64, string> map_value = 5;\n}\n"
  },
  {
    "path": "internal/testprotos/regenerate.bash",
    "content": "#!/bin/bash\n# Copyright 2020 The Go Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style\n# license that can be found in the LICENSE file.\n\n# NOTE: The integration scripts deliberately do not check to\n# make sure that the test protos have been regenerated.\n# It is intentional that older versions of the .pb.go files\n# are checked in to ensure that they continue to function.\n#\n# Versions used:\n#\tprotoc:        v3.9.1\n#\tprotoc-gen-go: v1.3.2\n\nfor X in $(find . -name \"*.proto\" | sed \"s|^\\./||\"); do\n\tprotoc -I$(pwd) --go_out=paths=source_relative:. $X\ndone\n"
  },
  {
    "path": "jsonpb/decode.go",
    "content": "// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage jsonpb\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"math\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/golang/protobuf/proto\"\n\t\"google.golang.org/protobuf/encoding/protojson\"\n\tprotoV2 \"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\nconst wrapJSONUnmarshalV2 = false\n\n// UnmarshalNext unmarshals the next JSON object from d into m.\nfunc UnmarshalNext(d *json.Decoder, m proto.Message) error {\n\treturn new(Unmarshaler).UnmarshalNext(d, m)\n}\n\n// Unmarshal unmarshals a JSON object from r into m.\nfunc Unmarshal(r io.Reader, m proto.Message) error {\n\treturn new(Unmarshaler).Unmarshal(r, m)\n}\n\n// UnmarshalString unmarshals a JSON object from s into m.\nfunc UnmarshalString(s string, m proto.Message) error {\n\treturn new(Unmarshaler).Unmarshal(strings.NewReader(s), m)\n}\n\n// Unmarshaler is a configurable object for converting from a JSON\n// representation to a protocol buffer object.\ntype Unmarshaler struct {\n\t// AllowUnknownFields specifies whether to allow messages to contain\n\t// unknown JSON fields, as opposed to failing to unmarshal.\n\tAllowUnknownFields bool\n\n\t// AnyResolver is used to resolve the google.protobuf.Any well-known type.\n\t// If unset, the global registry is used by default.\n\tAnyResolver AnyResolver\n}\n\n// JSONPBUnmarshaler is implemented by protobuf messages that customize the way\n// they are unmarshaled from JSON. Messages that implement this should also\n// implement JSONPBMarshaler so that the custom format can be produced.\n//\n// The JSON unmarshaling must follow the JSON to proto specification:\n//\n//\thttps://developers.google.com/protocol-buffers/docs/proto3#json\n//\n// Deprecated: Custom types should implement protobuf reflection instead.\ntype JSONPBUnmarshaler interface {\n\tUnmarshalJSONPB(*Unmarshaler, []byte) error\n}\n\n// Unmarshal unmarshals a JSON object from r into m.\nfunc (u *Unmarshaler) Unmarshal(r io.Reader, m proto.Message) error {\n\treturn u.UnmarshalNext(json.NewDecoder(r), m)\n}\n\n// UnmarshalNext unmarshals the next JSON object from d into m.\nfunc (u *Unmarshaler) UnmarshalNext(d *json.Decoder, m proto.Message) error {\n\tif m == nil {\n\t\treturn errors.New(\"invalid nil message\")\n\t}\n\n\t// Parse the next JSON object from the stream.\n\traw := json.RawMessage{}\n\tif err := d.Decode(&raw); err != nil {\n\t\treturn err\n\t}\n\n\t// Check for custom unmarshalers first since they may not properly\n\t// implement protobuf reflection that the logic below relies on.\n\tif jsu, ok := m.(JSONPBUnmarshaler); ok {\n\t\treturn jsu.UnmarshalJSONPB(u, raw)\n\t}\n\n\tmr := proto.MessageReflect(m)\n\n\t// NOTE: For historical reasons, a top-level null is treated as a noop.\n\t// This is incorrect, but kept for compatibility.\n\tif string(raw) == \"null\" && mr.Descriptor().FullName() != \"google.protobuf.Value\" {\n\t\treturn nil\n\t}\n\n\tif wrapJSONUnmarshalV2 {\n\t\t// NOTE: If input message is non-empty, we need to preserve merge semantics\n\t\t// of the old jsonpb implementation. These semantics are not supported by\n\t\t// the protobuf JSON specification.\n\t\tisEmpty := true\n\t\tmr.Range(func(protoreflect.FieldDescriptor, protoreflect.Value) bool {\n\t\t\tisEmpty = false // at least one iteration implies non-empty\n\t\t\treturn false\n\t\t})\n\t\tif !isEmpty {\n\t\t\t// Perform unmarshaling into a newly allocated, empty message.\n\t\t\tmr = mr.New()\n\n\t\t\t// Use a defer to copy all unmarshaled fields into the original message.\n\t\t\tdst := proto.MessageReflect(m)\n\t\t\tdefer mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\t\t\tdst.Set(fd, v)\n\t\t\t\treturn true\n\t\t\t})\n\t\t}\n\n\t\t// Unmarshal using the v2 JSON unmarshaler.\n\t\topts := protojson.UnmarshalOptions{\n\t\t\tDiscardUnknown: u.AllowUnknownFields,\n\t\t}\n\t\tif u.AnyResolver != nil {\n\t\t\topts.Resolver = anyResolver{u.AnyResolver}\n\t\t}\n\t\treturn opts.Unmarshal(raw, mr.Interface())\n\t} else {\n\t\tif err := u.unmarshalMessage(mr, raw); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn protoV2.CheckInitialized(mr.Interface())\n\t}\n}\n\nfunc (u *Unmarshaler) unmarshalMessage(m protoreflect.Message, in []byte) error {\n\tmd := m.Descriptor()\n\tfds := md.Fields()\n\n\tif jsu, ok := proto.MessageV1(m.Interface()).(JSONPBUnmarshaler); ok {\n\t\treturn jsu.UnmarshalJSONPB(u, in)\n\t}\n\n\tif string(in) == \"null\" && md.FullName() != \"google.protobuf.Value\" {\n\t\treturn nil\n\t}\n\n\tswitch wellKnownType(md.FullName()) {\n\tcase \"Any\":\n\t\tvar jsonObject map[string]json.RawMessage\n\t\tif err := json.Unmarshal(in, &jsonObject); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\trawTypeURL, ok := jsonObject[\"@type\"]\n\t\tif !ok {\n\t\t\treturn errors.New(\"Any JSON doesn't have '@type'\")\n\t\t}\n\t\ttypeURL, err := unquoteString(string(rawTypeURL))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"can't unmarshal Any's '@type': %q\", rawTypeURL)\n\t\t}\n\t\tm.Set(fds.ByNumber(1), protoreflect.ValueOfString(typeURL))\n\n\t\tvar m2 protoreflect.Message\n\t\tif u.AnyResolver != nil {\n\t\t\tmi, err := u.AnyResolver.Resolve(typeURL)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tm2 = proto.MessageReflect(mi)\n\t\t} else {\n\t\t\tmt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL)\n\t\t\tif err != nil {\n\t\t\t\tif err == protoregistry.NotFound {\n\t\t\t\t\treturn fmt.Errorf(\"could not resolve Any message type: %v\", typeURL)\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tm2 = mt.New()\n\t\t}\n\n\t\tif wellKnownType(m2.Descriptor().FullName()) != \"\" {\n\t\t\trawValue, ok := jsonObject[\"value\"]\n\t\t\tif !ok {\n\t\t\t\treturn errors.New(\"Any JSON doesn't have 'value'\")\n\t\t\t}\n\t\t\tif err := u.unmarshalMessage(m2, rawValue); err != nil {\n\t\t\t\treturn fmt.Errorf(\"can't unmarshal Any nested proto %v: %v\", typeURL, err)\n\t\t\t}\n\t\t} else {\n\t\t\tdelete(jsonObject, \"@type\")\n\t\t\trawJSON, err := json.Marshal(jsonObject)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"can't generate JSON for Any's nested proto to be unmarshaled: %v\", err)\n\t\t\t}\n\t\t\tif err = u.unmarshalMessage(m2, rawJSON); err != nil {\n\t\t\t\treturn fmt.Errorf(\"can't unmarshal Any nested proto %v: %v\", typeURL, err)\n\t\t\t}\n\t\t}\n\n\t\trawWire, err := protoV2.Marshal(m2.Interface())\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"can't marshal proto %v into Any.Value: %v\", typeURL, err)\n\t\t}\n\t\tm.Set(fds.ByNumber(2), protoreflect.ValueOfBytes(rawWire))\n\t\treturn nil\n\tcase \"BoolValue\", \"BytesValue\", \"StringValue\",\n\t\t\"Int32Value\", \"UInt32Value\", \"FloatValue\",\n\t\t\"Int64Value\", \"UInt64Value\", \"DoubleValue\":\n\t\tfd := fds.ByNumber(1)\n\t\tv, err := u.unmarshalValue(m.NewField(fd), in, fd)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.Set(fd, v)\n\t\treturn nil\n\tcase \"Duration\":\n\t\tv, err := unquoteString(string(in))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\td, err := time.ParseDuration(v)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"bad Duration: %v\", err)\n\t\t}\n\n\t\tsec := d.Nanoseconds() / 1e9\n\t\tnsec := d.Nanoseconds() % 1e9\n\t\tm.Set(fds.ByNumber(1), protoreflect.ValueOfInt64(int64(sec)))\n\t\tm.Set(fds.ByNumber(2), protoreflect.ValueOfInt32(int32(nsec)))\n\t\treturn nil\n\tcase \"Timestamp\":\n\t\tv, err := unquoteString(string(in))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tt, err := time.Parse(time.RFC3339Nano, v)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"bad Timestamp: %v\", err)\n\t\t}\n\n\t\tsec := t.Unix()\n\t\tnsec := t.Nanosecond()\n\t\tm.Set(fds.ByNumber(1), protoreflect.ValueOfInt64(int64(sec)))\n\t\tm.Set(fds.ByNumber(2), protoreflect.ValueOfInt32(int32(nsec)))\n\t\treturn nil\n\tcase \"Value\":\n\t\tswitch {\n\t\tcase string(in) == \"null\":\n\t\t\tm.Set(fds.ByNumber(1), protoreflect.ValueOfEnum(0))\n\t\tcase string(in) == \"true\":\n\t\t\tm.Set(fds.ByNumber(4), protoreflect.ValueOfBool(true))\n\t\tcase string(in) == \"false\":\n\t\t\tm.Set(fds.ByNumber(4), protoreflect.ValueOfBool(false))\n\t\tcase hasPrefixAndSuffix('\"', in, '\"'):\n\t\t\ts, err := unquoteString(string(in))\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unrecognized type for Value %q\", in)\n\t\t\t}\n\t\t\tm.Set(fds.ByNumber(3), protoreflect.ValueOfString(s))\n\t\tcase hasPrefixAndSuffix('[', in, ']'):\n\t\t\tv := m.Mutable(fds.ByNumber(6))\n\t\t\treturn u.unmarshalMessage(v.Message(), in)\n\t\tcase hasPrefixAndSuffix('{', in, '}'):\n\t\t\tv := m.Mutable(fds.ByNumber(5))\n\t\t\treturn u.unmarshalMessage(v.Message(), in)\n\t\tdefault:\n\t\t\tf, err := strconv.ParseFloat(string(in), 0)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unrecognized type for Value %q\", in)\n\t\t\t}\n\t\t\tm.Set(fds.ByNumber(2), protoreflect.ValueOfFloat64(f))\n\t\t}\n\t\treturn nil\n\tcase \"ListValue\":\n\t\tvar jsonArray []json.RawMessage\n\t\tif err := json.Unmarshal(in, &jsonArray); err != nil {\n\t\t\treturn fmt.Errorf(\"bad ListValue: %v\", err)\n\t\t}\n\n\t\tlv := m.Mutable(fds.ByNumber(1)).List()\n\t\tfor _, raw := range jsonArray {\n\t\t\tve := lv.NewElement()\n\t\t\tif err := u.unmarshalMessage(ve.Message(), raw); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlv.Append(ve)\n\t\t}\n\t\treturn nil\n\tcase \"Struct\":\n\t\tvar jsonObject map[string]json.RawMessage\n\t\tif err := json.Unmarshal(in, &jsonObject); err != nil {\n\t\t\treturn fmt.Errorf(\"bad StructValue: %v\", err)\n\t\t}\n\n\t\tmv := m.Mutable(fds.ByNumber(1)).Map()\n\t\tfor key, raw := range jsonObject {\n\t\t\tkv := protoreflect.ValueOf(key).MapKey()\n\t\t\tvv := mv.NewValue()\n\t\t\tif err := u.unmarshalMessage(vv.Message(), raw); err != nil {\n\t\t\t\treturn fmt.Errorf(\"bad value in StructValue for key %q: %v\", key, err)\n\t\t\t}\n\t\t\tmv.Set(kv, vv)\n\t\t}\n\t\treturn nil\n\t}\n\n\tvar jsonObject map[string]json.RawMessage\n\tif err := json.Unmarshal(in, &jsonObject); err != nil {\n\t\treturn err\n\t}\n\n\t// Handle known fields.\n\tfor i := 0; i < fds.Len(); i++ {\n\t\tfd := fds.Get(i)\n\t\tif fd.IsWeak() && fd.Message().IsPlaceholder() {\n\t\t\tcontinue //  weak reference is not linked in\n\t\t}\n\n\t\t// Search for any raw JSON value associated with this field.\n\t\tvar raw json.RawMessage\n\t\tname := string(fd.Name())\n\t\tif fd.Kind() == protoreflect.GroupKind {\n\t\t\tname = string(fd.Message().Name())\n\t\t}\n\t\tif v, ok := jsonObject[name]; ok {\n\t\t\tdelete(jsonObject, name)\n\t\t\traw = v\n\t\t}\n\t\tname = string(fd.JSONName())\n\t\tif v, ok := jsonObject[name]; ok {\n\t\t\tdelete(jsonObject, name)\n\t\t\traw = v\n\t\t}\n\n\t\tfield := m.NewField(fd)\n\t\t// Unmarshal the field value.\n\t\tif raw == nil || (string(raw) == \"null\" && !isSingularWellKnownValue(fd) && !isSingularJSONPBUnmarshaler(field, fd)) {\n\t\t\tcontinue\n\t\t}\n\t\tv, err := u.unmarshalValue(field, raw, fd)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.Set(fd, v)\n\t}\n\n\t// Handle extension fields.\n\tfor name, raw := range jsonObject {\n\t\tif !strings.HasPrefix(name, \"[\") || !strings.HasSuffix(name, \"]\") {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Resolve the extension field by name.\n\t\txname := protoreflect.FullName(name[len(\"[\") : len(name)-len(\"]\")])\n\t\txt, _ := protoregistry.GlobalTypes.FindExtensionByName(xname)\n\t\tif xt == nil && isMessageSet(md) {\n\t\t\txt, _ = protoregistry.GlobalTypes.FindExtensionByName(xname.Append(\"message_set_extension\"))\n\t\t}\n\t\tif xt == nil {\n\t\t\tcontinue\n\t\t}\n\t\tdelete(jsonObject, name)\n\t\tfd := xt.TypeDescriptor()\n\t\tif fd.ContainingMessage().FullName() != m.Descriptor().FullName() {\n\t\t\treturn fmt.Errorf(\"extension field %q does not extend message %q\", xname, m.Descriptor().FullName())\n\t\t}\n\n\t\tfield := m.NewField(fd)\n\t\t// Unmarshal the field value.\n\t\tif raw == nil || (string(raw) == \"null\" && !isSingularWellKnownValue(fd) && !isSingularJSONPBUnmarshaler(field, fd)) {\n\t\t\tcontinue\n\t\t}\n\t\tv, err := u.unmarshalValue(field, raw, fd)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.Set(fd, v)\n\t}\n\n\tif !u.AllowUnknownFields && len(jsonObject) > 0 {\n\t\tfor name := range jsonObject {\n\t\t\treturn fmt.Errorf(\"unknown field %q in %v\", name, md.FullName())\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc isSingularWellKnownValue(fd protoreflect.FieldDescriptor) bool {\n\tif fd.Cardinality() == protoreflect.Repeated {\n\t\treturn false\n\t}\n\tif md := fd.Message(); md != nil {\n\t\treturn md.FullName() == \"google.protobuf.Value\"\n\t}\n\tif ed := fd.Enum(); ed != nil {\n\t\treturn ed.FullName() == \"google.protobuf.NullValue\"\n\t}\n\treturn false\n}\n\nfunc isSingularJSONPBUnmarshaler(v protoreflect.Value, fd protoreflect.FieldDescriptor) bool {\n\tif fd.Message() != nil && fd.Cardinality() != protoreflect.Repeated {\n\t\t_, ok := proto.MessageV1(v.Interface()).(JSONPBUnmarshaler)\n\t\treturn ok\n\t}\n\treturn false\n}\n\nfunc (u *Unmarshaler) unmarshalValue(v protoreflect.Value, in []byte, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) {\n\tswitch {\n\tcase fd.IsList():\n\t\tvar jsonArray []json.RawMessage\n\t\tif err := json.Unmarshal(in, &jsonArray); err != nil {\n\t\t\treturn v, err\n\t\t}\n\t\tlv := v.List()\n\t\tfor _, raw := range jsonArray {\n\t\t\tve, err := u.unmarshalSingularValue(lv.NewElement(), raw, fd)\n\t\t\tif err != nil {\n\t\t\t\treturn v, err\n\t\t\t}\n\t\t\tlv.Append(ve)\n\t\t}\n\t\treturn v, nil\n\tcase fd.IsMap():\n\t\tvar jsonObject map[string]json.RawMessage\n\t\tif err := json.Unmarshal(in, &jsonObject); err != nil {\n\t\t\treturn v, err\n\t\t}\n\t\tkfd := fd.MapKey()\n\t\tvfd := fd.MapValue()\n\t\tmv := v.Map()\n\t\tfor key, raw := range jsonObject {\n\t\t\tvar kv protoreflect.MapKey\n\t\t\tif kfd.Kind() == protoreflect.StringKind {\n\t\t\t\tkv = protoreflect.ValueOf(key).MapKey()\n\t\t\t} else {\n\t\t\t\tv, err := u.unmarshalSingularValue(kfd.Default(), []byte(key), kfd)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn v, err\n\t\t\t\t}\n\t\t\t\tkv = v.MapKey()\n\t\t\t}\n\n\t\t\tvv, err := u.unmarshalSingularValue(mv.NewValue(), raw, vfd)\n\t\t\tif err != nil {\n\t\t\t\treturn v, err\n\t\t\t}\n\t\t\tmv.Set(kv, vv)\n\t\t}\n\t\treturn v, nil\n\tdefault:\n\t\treturn u.unmarshalSingularValue(v, in, fd)\n\t}\n}\n\nvar nonFinite = map[string]float64{\n\t`\"NaN\"`:       math.NaN(),\n\t`\"Infinity\"`:  math.Inf(+1),\n\t`\"-Infinity\"`: math.Inf(-1),\n}\n\nfunc (u *Unmarshaler) unmarshalSingularValue(v protoreflect.Value, in []byte, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) {\n\tswitch fd.Kind() {\n\tcase protoreflect.BoolKind:\n\t\treturn unmarshalValue(in, new(bool))\n\tcase protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:\n\t\treturn unmarshalValue(trimQuote(in), new(int32))\n\tcase protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:\n\t\treturn unmarshalValue(trimQuote(in), new(int64))\n\tcase protoreflect.Uint32Kind, protoreflect.Fixed32Kind:\n\t\treturn unmarshalValue(trimQuote(in), new(uint32))\n\tcase protoreflect.Uint64Kind, protoreflect.Fixed64Kind:\n\t\treturn unmarshalValue(trimQuote(in), new(uint64))\n\tcase protoreflect.FloatKind:\n\t\tif f, ok := nonFinite[string(in)]; ok {\n\t\t\treturn protoreflect.ValueOfFloat32(float32(f)), nil\n\t\t}\n\t\treturn unmarshalValue(trimQuote(in), new(float32))\n\tcase protoreflect.DoubleKind:\n\t\tif f, ok := nonFinite[string(in)]; ok {\n\t\t\treturn protoreflect.ValueOfFloat64(float64(f)), nil\n\t\t}\n\t\treturn unmarshalValue(trimQuote(in), new(float64))\n\tcase protoreflect.StringKind:\n\t\treturn unmarshalValue(in, new(string))\n\tcase protoreflect.BytesKind:\n\t\treturn unmarshalValue(in, new([]byte))\n\tcase protoreflect.EnumKind:\n\t\tif hasPrefixAndSuffix('\"', in, '\"') {\n\t\t\tvd := fd.Enum().Values().ByName(protoreflect.Name(trimQuote(in)))\n\t\t\tif vd == nil {\n\t\t\t\treturn v, fmt.Errorf(\"unknown value %q for enum %s\", in, fd.Enum().FullName())\n\t\t\t}\n\t\t\treturn protoreflect.ValueOfEnum(vd.Number()), nil\n\t\t}\n\t\treturn unmarshalValue(in, new(protoreflect.EnumNumber))\n\tcase protoreflect.MessageKind, protoreflect.GroupKind:\n\t\terr := u.unmarshalMessage(v.Message(), in)\n\t\treturn v, err\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid kind %v\", fd.Kind()))\n\t}\n}\n\nfunc unmarshalValue(in []byte, v interface{}) (protoreflect.Value, error) {\n\terr := json.Unmarshal(in, v)\n\treturn protoreflect.ValueOf(reflect.ValueOf(v).Elem().Interface()), err\n}\n\nfunc unquoteString(in string) (out string, err error) {\n\terr = json.Unmarshal([]byte(in), &out)\n\treturn out, err\n}\n\nfunc hasPrefixAndSuffix(prefix byte, in []byte, suffix byte) bool {\n\tif len(in) >= 2 && in[0] == prefix && in[len(in)-1] == suffix {\n\t\treturn true\n\t}\n\treturn false\n}\n\n// trimQuote is like unquoteString but simply strips surrounding quotes.\n// This is incorrect, but is behavior done by the legacy implementation.\nfunc trimQuote(in []byte) []byte {\n\tif len(in) >= 2 && in[0] == '\"' && in[len(in)-1] == '\"' {\n\t\tin = in[1 : len(in)-1]\n\t}\n\treturn in\n}\n"
  },
  {
    "path": "jsonpb/encode.go",
    "content": "// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage jsonpb\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"math\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/golang/protobuf/proto\"\n\t\"google.golang.org/protobuf/encoding/protojson\"\n\tprotoV2 \"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\nconst wrapJSONMarshalV2 = false\n\n// Marshaler is a configurable object for marshaling protocol buffer messages\n// to the specified JSON representation.\ntype Marshaler struct {\n\t// OrigName specifies whether to use the original protobuf name for fields.\n\tOrigName bool\n\n\t// EnumsAsInts specifies whether to render enum values as integers,\n\t// as opposed to string values.\n\tEnumsAsInts bool\n\n\t// EmitDefaults specifies whether to render fields with zero values.\n\tEmitDefaults bool\n\n\t// Indent controls whether the output is compact or not.\n\t// If empty, the output is compact JSON. Otherwise, every JSON object\n\t// entry and JSON array value will be on its own line.\n\t// Each line will be preceded by repeated copies of Indent, where the\n\t// number of copies is the current indentation depth.\n\tIndent string\n\n\t// AnyResolver is used to resolve the google.protobuf.Any well-known type.\n\t// If unset, the global registry is used by default.\n\tAnyResolver AnyResolver\n}\n\n// JSONPBMarshaler is implemented by protobuf messages that customize the\n// way they are marshaled to JSON. Messages that implement this should also\n// implement JSONPBUnmarshaler so that the custom format can be parsed.\n//\n// The JSON marshaling must follow the proto to JSON specification:\n//\n//\thttps://developers.google.com/protocol-buffers/docs/proto3#json\n//\n// Deprecated: Custom types should implement protobuf reflection instead.\ntype JSONPBMarshaler interface {\n\tMarshalJSONPB(*Marshaler) ([]byte, error)\n}\n\n// Marshal serializes a protobuf message as JSON into w.\nfunc (jm *Marshaler) Marshal(w io.Writer, m proto.Message) error {\n\tb, err := jm.marshal(m)\n\tif len(b) > 0 {\n\t\tif _, err := w.Write(b); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}\n\n// MarshalToString serializes a protobuf message as JSON in string form.\nfunc (jm *Marshaler) MarshalToString(m proto.Message) (string, error) {\n\tb, err := jm.marshal(m)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(b), nil\n}\n\nfunc (jm *Marshaler) marshal(m proto.Message) ([]byte, error) {\n\tv := reflect.ValueOf(m)\n\tif m == nil || (v.Kind() == reflect.Ptr && v.IsNil()) {\n\t\treturn nil, errors.New(\"Marshal called with nil\")\n\t}\n\n\t// Check for custom marshalers first since they may not properly\n\t// implement protobuf reflection that the logic below relies on.\n\tif jsm, ok := m.(JSONPBMarshaler); ok {\n\t\treturn jsm.MarshalJSONPB(jm)\n\t}\n\n\tif wrapJSONMarshalV2 {\n\t\topts := protojson.MarshalOptions{\n\t\t\tUseProtoNames:   jm.OrigName,\n\t\t\tUseEnumNumbers:  jm.EnumsAsInts,\n\t\t\tEmitUnpopulated: jm.EmitDefaults,\n\t\t\tIndent:          jm.Indent,\n\t\t}\n\t\tif jm.AnyResolver != nil {\n\t\t\topts.Resolver = anyResolver{jm.AnyResolver}\n\t\t}\n\t\treturn opts.Marshal(proto.MessageReflect(m).Interface())\n\t} else {\n\t\t// Check for unpopulated required fields first.\n\t\tm2 := proto.MessageReflect(m)\n\t\tif err := protoV2.CheckInitialized(m2.Interface()); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tw := jsonWriter{Marshaler: jm}\n\t\terr := w.marshalMessage(m2, \"\", \"\")\n\t\treturn w.buf, err\n\t}\n}\n\ntype jsonWriter struct {\n\t*Marshaler\n\tbuf []byte\n}\n\nfunc (w *jsonWriter) write(s string) {\n\tw.buf = append(w.buf, s...)\n}\n\nfunc (w *jsonWriter) marshalMessage(m protoreflect.Message, indent, typeURL string) error {\n\tif jsm, ok := proto.MessageV1(m.Interface()).(JSONPBMarshaler); ok {\n\t\tb, err := jsm.MarshalJSONPB(w.Marshaler)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif typeURL != \"\" {\n\t\t\t// we are marshaling this object to an Any type\n\t\t\tvar js map[string]*json.RawMessage\n\t\t\tif err = json.Unmarshal(b, &js); err != nil {\n\t\t\t\treturn fmt.Errorf(\"type %T produced invalid JSON: %v\", m.Interface(), err)\n\t\t\t}\n\t\t\tturl, err := json.Marshal(typeURL)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to marshal type URL %q to JSON: %v\", typeURL, err)\n\t\t\t}\n\t\t\tjs[\"@type\"] = (*json.RawMessage)(&turl)\n\t\t\tif b, err = json.Marshal(js); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tw.write(string(b))\n\t\treturn nil\n\t}\n\n\tmd := m.Descriptor()\n\tfds := md.Fields()\n\n\t// Handle well-known types.\n\tconst secondInNanos = int64(time.Second / time.Nanosecond)\n\tswitch wellKnownType(md.FullName()) {\n\tcase \"Any\":\n\t\treturn w.marshalAny(m, indent)\n\tcase \"BoolValue\", \"BytesValue\", \"StringValue\",\n\t\t\"Int32Value\", \"UInt32Value\", \"FloatValue\",\n\t\t\"Int64Value\", \"UInt64Value\", \"DoubleValue\":\n\t\tfd := fds.ByNumber(1)\n\t\treturn w.marshalValue(fd, m.Get(fd), indent)\n\tcase \"Duration\":\n\t\tconst maxSecondsInDuration = 315576000000\n\t\t// \"Generated output always contains 0, 3, 6, or 9 fractional digits,\n\t\t//  depending on required precision.\"\n\t\ts := m.Get(fds.ByNumber(1)).Int()\n\t\tns := m.Get(fds.ByNumber(2)).Int()\n\t\tif s < -maxSecondsInDuration || s > maxSecondsInDuration {\n\t\t\treturn fmt.Errorf(\"seconds out of range %v\", s)\n\t\t}\n\t\tif ns <= -secondInNanos || ns >= secondInNanos {\n\t\t\treturn fmt.Errorf(\"ns out of range (%v, %v)\", -secondInNanos, secondInNanos)\n\t\t}\n\t\tif (s > 0 && ns < 0) || (s < 0 && ns > 0) {\n\t\t\treturn errors.New(\"signs of seconds and nanos do not match\")\n\t\t}\n\t\tvar sign string\n\t\tif s < 0 || ns < 0 {\n\t\t\tsign, s, ns = \"-\", -1*s, -1*ns\n\t\t}\n\t\tx := fmt.Sprintf(\"%s%d.%09d\", sign, s, ns)\n\t\tx = strings.TrimSuffix(x, \"000\")\n\t\tx = strings.TrimSuffix(x, \"000\")\n\t\tx = strings.TrimSuffix(x, \".000\")\n\t\tw.write(fmt.Sprintf(`\"%vs\"`, x))\n\t\treturn nil\n\tcase \"Timestamp\":\n\t\t// \"RFC 3339, where generated output will always be Z-normalized\n\t\t//  and uses 0, 3, 6 or 9 fractional digits.\"\n\t\ts := m.Get(fds.ByNumber(1)).Int()\n\t\tns := m.Get(fds.ByNumber(2)).Int()\n\t\tif ns < 0 || ns >= secondInNanos {\n\t\t\treturn fmt.Errorf(\"ns out of range [0, %v)\", secondInNanos)\n\t\t}\n\t\tt := time.Unix(s, ns).UTC()\n\t\t// time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits).\n\t\tx := t.Format(\"2006-01-02T15:04:05.000000000\")\n\t\tx = strings.TrimSuffix(x, \"000\")\n\t\tx = strings.TrimSuffix(x, \"000\")\n\t\tx = strings.TrimSuffix(x, \".000\")\n\t\tw.write(fmt.Sprintf(`\"%vZ\"`, x))\n\t\treturn nil\n\tcase \"Value\":\n\t\t// JSON value; which is a null, number, string, bool, object, or array.\n\t\tod := md.Oneofs().Get(0)\n\t\tfd := m.WhichOneof(od)\n\t\tif fd == nil {\n\t\t\treturn errors.New(\"nil Value\")\n\t\t}\n\t\treturn w.marshalValue(fd, m.Get(fd), indent)\n\tcase \"Struct\", \"ListValue\":\n\t\t// JSON object or array.\n\t\tfd := fds.ByNumber(1)\n\t\treturn w.marshalValue(fd, m.Get(fd), indent)\n\t}\n\n\tw.write(\"{\")\n\tif w.Indent != \"\" {\n\t\tw.write(\"\\n\")\n\t}\n\n\tfirstField := true\n\tif typeURL != \"\" {\n\t\tif err := w.marshalTypeURL(indent, typeURL); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfirstField = false\n\t}\n\n\tfor i := 0; i < fds.Len(); {\n\t\tfd := fds.Get(i)\n\t\tif od := fd.ContainingOneof(); od != nil {\n\t\t\tfd = m.WhichOneof(od)\n\t\t\ti += od.Fields().Len()\n\t\t\tif fd == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else {\n\t\t\ti++\n\t\t}\n\n\t\tv := m.Get(fd)\n\n\t\tif !m.Has(fd) {\n\t\t\tif !w.EmitDefaults || fd.ContainingOneof() != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif fd.Cardinality() != protoreflect.Repeated && (fd.Message() != nil || fd.Syntax() == protoreflect.Proto2) {\n\t\t\t\tv = protoreflect.Value{} // use \"null\" for singular messages or proto2 scalars\n\t\t\t}\n\t\t}\n\n\t\tif !firstField {\n\t\t\tw.writeComma()\n\t\t}\n\t\tif err := w.marshalField(fd, v, indent); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfirstField = false\n\t}\n\n\t// Handle proto2 extensions.\n\tif md.ExtensionRanges().Len() > 0 {\n\t\t// Collect a sorted list of all extension descriptor and values.\n\t\ttype ext struct {\n\t\t\tdesc protoreflect.FieldDescriptor\n\t\t\tval  protoreflect.Value\n\t\t}\n\t\tvar exts []ext\n\t\tm.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\t\tif fd.IsExtension() {\n\t\t\t\texts = append(exts, ext{fd, v})\n\t\t\t}\n\t\t\treturn true\n\t\t})\n\t\tsort.Slice(exts, func(i, j int) bool {\n\t\t\treturn exts[i].desc.Number() < exts[j].desc.Number()\n\t\t})\n\n\t\tfor _, ext := range exts {\n\t\t\tif !firstField {\n\t\t\t\tw.writeComma()\n\t\t\t}\n\t\t\tif err := w.marshalField(ext.desc, ext.val, indent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfirstField = false\n\t\t}\n\t}\n\n\tif w.Indent != \"\" {\n\t\tw.write(\"\\n\")\n\t\tw.write(indent)\n\t}\n\tw.write(\"}\")\n\treturn nil\n}\n\nfunc (w *jsonWriter) writeComma() {\n\tif w.Indent != \"\" {\n\t\tw.write(\",\\n\")\n\t} else {\n\t\tw.write(\",\")\n\t}\n}\n\nfunc (w *jsonWriter) marshalAny(m protoreflect.Message, indent string) error {\n\t// \"If the Any contains a value that has a special JSON mapping,\n\t//  it will be converted as follows: {\"@type\": xxx, \"value\": yyy}.\n\t//  Otherwise, the value will be converted into a JSON object,\n\t//  and the \"@type\" field will be inserted to indicate the actual data type.\"\n\tmd := m.Descriptor()\n\ttypeURL := m.Get(md.Fields().ByNumber(1)).String()\n\trawVal := m.Get(md.Fields().ByNumber(2)).Bytes()\n\n\tvar m2 protoreflect.Message\n\tif w.AnyResolver != nil {\n\t\tmi, err := w.AnyResolver.Resolve(typeURL)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm2 = proto.MessageReflect(mi)\n\t} else {\n\t\tmt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm2 = mt.New()\n\t}\n\n\tif err := protoV2.Unmarshal(rawVal, m2.Interface()); err != nil {\n\t\treturn err\n\t}\n\n\tif wellKnownType(m2.Descriptor().FullName()) == \"\" {\n\t\treturn w.marshalMessage(m2, indent, typeURL)\n\t}\n\n\tw.write(\"{\")\n\tif w.Indent != \"\" {\n\t\tw.write(\"\\n\")\n\t}\n\tif err := w.marshalTypeURL(indent, typeURL); err != nil {\n\t\treturn err\n\t}\n\tw.writeComma()\n\tif w.Indent != \"\" {\n\t\tw.write(indent)\n\t\tw.write(w.Indent)\n\t\tw.write(`\"value\": `)\n\t} else {\n\t\tw.write(`\"value\":`)\n\t}\n\tif err := w.marshalMessage(m2, indent+w.Indent, \"\"); err != nil {\n\t\treturn err\n\t}\n\tif w.Indent != \"\" {\n\t\tw.write(\"\\n\")\n\t\tw.write(indent)\n\t}\n\tw.write(\"}\")\n\treturn nil\n}\n\nfunc (w *jsonWriter) marshalTypeURL(indent, typeURL string) error {\n\tif w.Indent != \"\" {\n\t\tw.write(indent)\n\t\tw.write(w.Indent)\n\t}\n\tw.write(`\"@type\":`)\n\tif w.Indent != \"\" {\n\t\tw.write(\" \")\n\t}\n\tb, err := json.Marshal(typeURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw.write(string(b))\n\treturn nil\n}\n\n// marshalField writes field description and value to the Writer.\nfunc (w *jsonWriter) marshalField(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error {\n\tif w.Indent != \"\" {\n\t\tw.write(indent)\n\t\tw.write(w.Indent)\n\t}\n\tw.write(`\"`)\n\tswitch {\n\tcase fd.IsExtension():\n\t\t// For message set, use the fname of the message as the extension name.\n\t\tname := string(fd.FullName())\n\t\tif isMessageSet(fd.ContainingMessage()) {\n\t\t\tname = strings.TrimSuffix(name, \".message_set_extension\")\n\t\t}\n\n\t\tw.write(\"[\" + name + \"]\")\n\tcase w.OrigName:\n\t\tname := string(fd.Name())\n\t\tif fd.Kind() == protoreflect.GroupKind {\n\t\t\tname = string(fd.Message().Name())\n\t\t}\n\t\tw.write(name)\n\tdefault:\n\t\tw.write(string(fd.JSONName()))\n\t}\n\tw.write(`\":`)\n\tif w.Indent != \"\" {\n\t\tw.write(\" \")\n\t}\n\treturn w.marshalValue(fd, v, indent)\n}\n\nfunc (w *jsonWriter) marshalValue(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error {\n\tswitch {\n\tcase fd.IsList():\n\t\tw.write(\"[\")\n\t\tcomma := \"\"\n\t\tlv := v.List()\n\t\tfor i := 0; i < lv.Len(); i++ {\n\t\t\tw.write(comma)\n\t\t\tif w.Indent != \"\" {\n\t\t\t\tw.write(\"\\n\")\n\t\t\t\tw.write(indent)\n\t\t\t\tw.write(w.Indent)\n\t\t\t\tw.write(w.Indent)\n\t\t\t}\n\t\t\tif err := w.marshalSingularValue(fd, lv.Get(i), indent+w.Indent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcomma = \",\"\n\t\t}\n\t\tif w.Indent != \"\" {\n\t\t\tw.write(\"\\n\")\n\t\t\tw.write(indent)\n\t\t\tw.write(w.Indent)\n\t\t}\n\t\tw.write(\"]\")\n\t\treturn nil\n\tcase fd.IsMap():\n\t\tkfd := fd.MapKey()\n\t\tvfd := fd.MapValue()\n\t\tmv := v.Map()\n\n\t\t// Collect a sorted list of all map keys and values.\n\t\ttype entry struct{ key, val protoreflect.Value }\n\t\tvar entries []entry\n\t\tmv.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {\n\t\t\tentries = append(entries, entry{k.Value(), v})\n\t\t\treturn true\n\t\t})\n\t\tsort.Slice(entries, func(i, j int) bool {\n\t\t\tswitch kfd.Kind() {\n\t\t\tcase protoreflect.BoolKind:\n\t\t\t\treturn !entries[i].key.Bool() && entries[j].key.Bool()\n\t\t\tcase protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:\n\t\t\t\treturn entries[i].key.Int() < entries[j].key.Int()\n\t\t\tcase protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind:\n\t\t\t\treturn entries[i].key.Uint() < entries[j].key.Uint()\n\t\t\tcase protoreflect.StringKind:\n\t\t\t\treturn entries[i].key.String() < entries[j].key.String()\n\t\t\tdefault:\n\t\t\t\tpanic(\"invalid kind\")\n\t\t\t}\n\t\t})\n\n\t\tw.write(`{`)\n\t\tcomma := \"\"\n\t\tfor _, entry := range entries {\n\t\t\tw.write(comma)\n\t\t\tif w.Indent != \"\" {\n\t\t\t\tw.write(\"\\n\")\n\t\t\t\tw.write(indent)\n\t\t\t\tw.write(w.Indent)\n\t\t\t\tw.write(w.Indent)\n\t\t\t}\n\n\t\t\ts := fmt.Sprint(entry.key.Interface())\n\t\t\tb, err := json.Marshal(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tw.write(string(b))\n\n\t\t\tw.write(`:`)\n\t\t\tif w.Indent != \"\" {\n\t\t\t\tw.write(` `)\n\t\t\t}\n\n\t\t\tif err := w.marshalSingularValue(vfd, entry.val, indent+w.Indent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcomma = \",\"\n\t\t}\n\t\tif w.Indent != \"\" {\n\t\t\tw.write(\"\\n\")\n\t\t\tw.write(indent)\n\t\t\tw.write(w.Indent)\n\t\t}\n\t\tw.write(`}`)\n\t\treturn nil\n\tdefault:\n\t\treturn w.marshalSingularValue(fd, v, indent)\n\t}\n}\n\nfunc (w *jsonWriter) marshalSingularValue(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error {\n\tswitch {\n\tcase !v.IsValid():\n\t\tw.write(\"null\")\n\t\treturn nil\n\tcase fd.Message() != nil:\n\t\treturn w.marshalMessage(v.Message(), indent+w.Indent, \"\")\n\tcase fd.Enum() != nil:\n\t\tif fd.Enum().FullName() == \"google.protobuf.NullValue\" {\n\t\t\tw.write(\"null\")\n\t\t\treturn nil\n\t\t}\n\n\t\tvd := fd.Enum().Values().ByNumber(v.Enum())\n\t\tif vd == nil || w.EnumsAsInts {\n\t\t\tw.write(strconv.Itoa(int(v.Enum())))\n\t\t} else {\n\t\t\tw.write(`\"` + string(vd.Name()) + `\"`)\n\t\t}\n\t\treturn nil\n\tdefault:\n\t\tswitch v.Interface().(type) {\n\t\tcase float32, float64:\n\t\t\tswitch {\n\t\t\tcase math.IsInf(v.Float(), +1):\n\t\t\t\tw.write(`\"Infinity\"`)\n\t\t\t\treturn nil\n\t\t\tcase math.IsInf(v.Float(), -1):\n\t\t\t\tw.write(`\"-Infinity\"`)\n\t\t\t\treturn nil\n\t\t\tcase math.IsNaN(v.Float()):\n\t\t\t\tw.write(`\"NaN\"`)\n\t\t\t\treturn nil\n\t\t\t}\n\t\tcase int64, uint64:\n\t\t\tw.write(fmt.Sprintf(`\"%d\"`, v.Interface()))\n\t\t\treturn nil\n\t\t}\n\n\t\tb, err := json.Marshal(v.Interface())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tw.write(string(b))\n\t\treturn nil\n\t}\n}\n"
  },
  {
    "path": "jsonpb/json.go",
    "content": "// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package jsonpb provides functionality to marshal and unmarshal between a\n// protocol buffer message and JSON. It follows the specification at\n// https://developers.google.com/protocol-buffers/docs/proto3#json.\n//\n// Do not rely on the default behavior of the standard encoding/json package\n// when called on generated message types as it does not operate correctly.\n//\n// Deprecated: Use the \"google.golang.org/protobuf/encoding/protojson\"\n// package instead.\npackage jsonpb\n\nimport (\n\t\"github.com/golang/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n\t\"google.golang.org/protobuf/runtime/protoimpl\"\n)\n\n// AnyResolver takes a type URL, present in an Any message,\n// and resolves it into an instance of the associated message.\ntype AnyResolver interface {\n\tResolve(typeURL string) (proto.Message, error)\n}\n\ntype anyResolver struct{ AnyResolver }\n\nfunc (r anyResolver) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) {\n\treturn r.FindMessageByURL(string(message))\n}\n\nfunc (r anyResolver) FindMessageByURL(url string) (protoreflect.MessageType, error) {\n\tm, err := r.Resolve(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn protoimpl.X.MessageTypeOf(m), nil\n}\n\nfunc (r anyResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) {\n\treturn protoregistry.GlobalTypes.FindExtensionByName(field)\n}\n\nfunc (r anyResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) {\n\treturn protoregistry.GlobalTypes.FindExtensionByNumber(message, field)\n}\n\nfunc wellKnownType(s protoreflect.FullName) string {\n\tif s.Parent() == \"google.protobuf\" {\n\t\tswitch s.Name() {\n\t\tcase \"Empty\", \"Any\",\n\t\t\t\"BoolValue\", \"BytesValue\", \"StringValue\",\n\t\t\t\"Int32Value\", \"UInt32Value\", \"FloatValue\",\n\t\t\t\"Int64Value\", \"UInt64Value\", \"DoubleValue\",\n\t\t\t\"Duration\", \"Timestamp\",\n\t\t\t\"NullValue\", \"Struct\", \"Value\", \"ListValue\":\n\t\t\treturn string(s.Name())\n\t\t}\n\t}\n\treturn \"\"\n}\n\nfunc isMessageSet(md protoreflect.MessageDescriptor) bool {\n\tms, ok := md.(interface{ IsMessageSet() bool })\n\treturn ok && ms.IsMessageSet()\n}\n"
  },
  {
    "path": "jsonpb/json_test.go",
    "content": "// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage jsonpb\n\nimport (\n\t\"bytes\"\n\t\"compress/gzip\"\n\t\"encoding/json\"\n\t\"io\"\n\t\"math\"\n\t\"reflect\"\n\t\"strings\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\t\"github.com/golang/protobuf/ptypes\"\n\n\tpb2 \"github.com/golang/protobuf/internal/testprotos/jsonpb_proto\"\n\tpb3 \"github.com/golang/protobuf/internal/testprotos/proto3_proto\"\n\tdescpb \"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n\tanypb \"github.com/golang/protobuf/ptypes/any\"\n\tdurpb \"github.com/golang/protobuf/ptypes/duration\"\n\tstpb \"github.com/golang/protobuf/ptypes/struct\"\n\ttspb \"github.com/golang/protobuf/ptypes/timestamp\"\n\twpb \"github.com/golang/protobuf/ptypes/wrappers\"\n)\n\nvar (\n\tmarshaler = Marshaler{}\n\n\tmarshalerAllOptions = Marshaler{\n\t\tIndent: \"  \",\n\t}\n\n\tsimpleObject = &pb2.Simple{\n\t\tOInt32:     proto.Int32(-32),\n\t\tOInt32Str:  proto.Int32(-32),\n\t\tOInt64:     proto.Int64(-6400000000),\n\t\tOInt64Str:  proto.Int64(-6400000000),\n\t\tOUint32:    proto.Uint32(32),\n\t\tOUint32Str: proto.Uint32(32),\n\t\tOUint64:    proto.Uint64(6400000000),\n\t\tOUint64Str: proto.Uint64(6400000000),\n\t\tOSint32:    proto.Int32(-13),\n\t\tOSint32Str: proto.Int32(-13),\n\t\tOSint64:    proto.Int64(-2600000000),\n\t\tOSint64Str: proto.Int64(-2600000000),\n\t\tOFloat:     proto.Float32(3.14),\n\t\tOFloatStr:  proto.Float32(3.14),\n\t\tODouble:    proto.Float64(6.02214179e23),\n\t\tODoubleStr: proto.Float64(6.02214179e23),\n\t\tOBool:      proto.Bool(true),\n\t\tOString:    proto.String(\"hello \\\"there\\\"\"),\n\t\tOBytes:     []byte(\"beep boop\"),\n\t}\n\n\tsimpleObjectInputJSON = `{` +\n\t\t`\"oBool\":true,` +\n\t\t`\"oInt32\":-32,` +\n\t\t`\"oInt32Str\":\"-32\",` +\n\t\t`\"oInt64\":-6400000000,` +\n\t\t`\"oInt64Str\":\"-6400000000\",` +\n\t\t`\"oUint32\":32,` +\n\t\t`\"oUint32Str\":\"32\",` +\n\t\t`\"oUint64\":6400000000,` +\n\t\t`\"oUint64Str\":\"6400000000\",` +\n\t\t`\"oSint32\":-13,` +\n\t\t`\"oSint32Str\":\"-13\",` +\n\t\t`\"oSint64\":-2600000000,` +\n\t\t`\"oSint64Str\":\"-2600000000\",` +\n\t\t`\"oFloat\":3.14,` +\n\t\t`\"oFloatStr\":\"3.14\",` +\n\t\t`\"oDouble\":6.02214179e+23,` +\n\t\t`\"oDoubleStr\":\"6.02214179e+23\",` +\n\t\t`\"oString\":\"hello \\\"there\\\"\",` +\n\t\t`\"oBytes\":\"YmVlcCBib29w\"` +\n\t\t`}`\n\n\tsimpleObjectOutputJSON = `{` +\n\t\t`\"oBool\":true,` +\n\t\t`\"oInt32\":-32,` +\n\t\t`\"oInt32Str\":-32,` +\n\t\t`\"oInt64\":\"-6400000000\",` +\n\t\t`\"oInt64Str\":\"-6400000000\",` +\n\t\t`\"oUint32\":32,` +\n\t\t`\"oUint32Str\":32,` +\n\t\t`\"oUint64\":\"6400000000\",` +\n\t\t`\"oUint64Str\":\"6400000000\",` +\n\t\t`\"oSint32\":-13,` +\n\t\t`\"oSint32Str\":-13,` +\n\t\t`\"oSint64\":\"-2600000000\",` +\n\t\t`\"oSint64Str\":\"-2600000000\",` +\n\t\t`\"oFloat\":3.14,` +\n\t\t`\"oFloatStr\":3.14,` +\n\t\t`\"oDouble\":6.02214179e+23,` +\n\t\t`\"oDoubleStr\":6.02214179e+23,` +\n\t\t`\"oString\":\"hello \\\"there\\\"\",` +\n\t\t`\"oBytes\":\"YmVlcCBib29w\"` +\n\t\t`}`\n\n\tsimpleObjectInputPrettyJSON = `{\n  \"oBool\": true,\n  \"oInt32\": -32,\n  \"oInt32Str\": \"-32\",\n  \"oInt64\": -6400000000,\n  \"oInt64Str\": \"-6400000000\",\n  \"oUint32\": 32,\n  \"oUint32Str\": \"32\",\n  \"oUint64\": 6400000000,\n  \"oUint64Str\": \"6400000000\",\n  \"oSint32\": -13,\n  \"oSint32Str\": \"-13\",\n  \"oSint64\": -2600000000,\n  \"oSint64Str\": \"-2600000000\",\n  \"oFloat\": 3.14,\n  \"oFloatStr\": \"3.14\",\n  \"oDouble\": 6.02214179e+23,\n  \"oDoubleStr\": \"6.02214179e+23\",\n  \"oString\": \"hello \\\"there\\\"\",\n  \"oBytes\": \"YmVlcCBib29w\"\n}`\n\n\tsimpleObjectOutputPrettyJSON = `{\n  \"oBool\": true,\n  \"oInt32\": -32,\n  \"oInt32Str\": -32,\n  \"oInt64\": \"-6400000000\",\n  \"oInt64Str\": \"-6400000000\",\n  \"oUint32\": 32,\n  \"oUint32Str\": 32,\n  \"oUint64\": \"6400000000\",\n  \"oUint64Str\": \"6400000000\",\n  \"oSint32\": -13,\n  \"oSint32Str\": -13,\n  \"oSint64\": \"-2600000000\",\n  \"oSint64Str\": \"-2600000000\",\n  \"oFloat\": 3.14,\n  \"oFloatStr\": 3.14,\n  \"oDouble\": 6.02214179e+23,\n  \"oDoubleStr\": 6.02214179e+23,\n  \"oString\": \"hello \\\"there\\\"\",\n  \"oBytes\": \"YmVlcCBib29w\"\n}`\n\n\trepeatsObject = &pb2.Repeats{\n\t\tRBool:   []bool{true, false, true},\n\t\tRInt32:  []int32{-3, -4, -5},\n\t\tRInt64:  []int64{-123456789, -987654321},\n\t\tRUint32: []uint32{1, 2, 3},\n\t\tRUint64: []uint64{6789012345, 3456789012},\n\t\tRSint32: []int32{-1, -2, -3},\n\t\tRSint64: []int64{-6789012345, -3456789012},\n\t\tRFloat:  []float32{3.14, 6.28},\n\t\tRDouble: []float64{299792458 * 1e20, 6.62606957e-34},\n\t\tRString: []string{\"happy\", \"days\"},\n\t\tRBytes:  [][]byte{[]byte(\"skittles\"), []byte(\"m&m's\")},\n\t}\n\n\trepeatsObjectJSON = `{` +\n\t\t`\"rBool\":[true,false,true],` +\n\t\t`\"rInt32\":[-3,-4,-5],` +\n\t\t`\"rInt64\":[\"-123456789\",\"-987654321\"],` +\n\t\t`\"rUint32\":[1,2,3],` +\n\t\t`\"rUint64\":[\"6789012345\",\"3456789012\"],` +\n\t\t`\"rSint32\":[-1,-2,-3],` +\n\t\t`\"rSint64\":[\"-6789012345\",\"-3456789012\"],` +\n\t\t`\"rFloat\":[3.14,6.28],` +\n\t\t`\"rDouble\":[2.99792458e+28,6.62606957e-34],` +\n\t\t`\"rString\":[\"happy\",\"days\"],` +\n\t\t`\"rBytes\":[\"c2tpdHRsZXM=\",\"bSZtJ3M=\"]` +\n\t\t`}`\n\n\trepeatsObjectPrettyJSON = `{\n  \"rBool\": [\n    true,\n    false,\n    true\n  ],\n  \"rInt32\": [\n    -3,\n    -4,\n    -5\n  ],\n  \"rInt64\": [\n    \"-123456789\",\n    \"-987654321\"\n  ],\n  \"rUint32\": [\n    1,\n    2,\n    3\n  ],\n  \"rUint64\": [\n    \"6789012345\",\n    \"3456789012\"\n  ],\n  \"rSint32\": [\n    -1,\n    -2,\n    -3\n  ],\n  \"rSint64\": [\n    \"-6789012345\",\n    \"-3456789012\"\n  ],\n  \"rFloat\": [\n    3.14,\n    6.28\n  ],\n  \"rDouble\": [\n    2.99792458e+28,\n    6.62606957e-34\n  ],\n  \"rString\": [\n    \"happy\",\n    \"days\"\n  ],\n  \"rBytes\": [\n    \"c2tpdHRsZXM=\",\n    \"bSZtJ3M=\"\n  ]\n}`\n\n\tinnerSimple   = &pb2.Simple{OInt32: proto.Int32(-32)}\n\tinnerSimple2  = &pb2.Simple{OInt64: proto.Int64(25)}\n\tinnerRepeats  = &pb2.Repeats{RString: []string{\"roses\", \"red\"}}\n\tinnerRepeats2 = &pb2.Repeats{RString: []string{\"violets\", \"blue\"}}\n\tcomplexObject = &pb2.Widget{\n\t\tColor:    pb2.Widget_GREEN.Enum(),\n\t\tRColor:   []pb2.Widget_Color{pb2.Widget_RED, pb2.Widget_GREEN, pb2.Widget_BLUE},\n\t\tSimple:   innerSimple,\n\t\tRSimple:  []*pb2.Simple{innerSimple, innerSimple2},\n\t\tRepeats:  innerRepeats,\n\t\tRRepeats: []*pb2.Repeats{innerRepeats, innerRepeats2},\n\t}\n\n\tcomplexObjectJSON = `{\"color\":\"GREEN\",` +\n\t\t`\"rColor\":[\"RED\",\"GREEN\",\"BLUE\"],` +\n\t\t`\"simple\":{\"oInt32\":-32},` +\n\t\t`\"rSimple\":[{\"oInt32\":-32},{\"oInt64\":\"25\"}],` +\n\t\t`\"repeats\":{\"rString\":[\"roses\",\"red\"]},` +\n\t\t`\"rRepeats\":[{\"rString\":[\"roses\",\"red\"]},{\"rString\":[\"violets\",\"blue\"]}]` +\n\t\t`}`\n\n\tcomplexObjectPrettyJSON = `{\n  \"color\": \"GREEN\",\n  \"rColor\": [\n    \"RED\",\n    \"GREEN\",\n    \"BLUE\"\n  ],\n  \"simple\": {\n    \"oInt32\": -32\n  },\n  \"rSimple\": [\n    {\n      \"oInt32\": -32\n    },\n    {\n      \"oInt64\": \"25\"\n    }\n  ],\n  \"repeats\": {\n    \"rString\": [\n      \"roses\",\n      \"red\"\n    ]\n  },\n  \"rRepeats\": [\n    {\n      \"rString\": [\n        \"roses\",\n        \"red\"\n      ]\n    },\n    {\n      \"rString\": [\n        \"violets\",\n        \"blue\"\n      ]\n    }\n  ]\n}`\n\n\tcolorPrettyJSON = `{\n \"color\": 2\n}`\n\n\tcolorListPrettyJSON = `{\n  \"color\": 1000,\n  \"rColor\": [\n    \"RED\"\n  ]\n}`\n\n\tnummyPrettyJSON = `{\n  \"nummy\": {\n    \"1\": 2,\n    \"3\": 4\n  }\n}`\n\n\tobjjyPrettyJSON = `{\n  \"objjy\": {\n    \"1\": {\n      \"dub\": 1\n    }\n  }\n}`\n\trealNumber     = &pb2.Real{Value: proto.Float64(3.14159265359)}\n\trealNumberName = \"Pi\"\n\tcomplexNumber  = &pb2.Complex{Imaginary: proto.Float64(0.5772156649)}\n\trealNumberJSON = `{` +\n\t\t`\"value\":3.14159265359,` +\n\t\t`\"[jsonpb_test.Complex.real_extension]\":{\"imaginary\":0.5772156649},` +\n\t\t`\"[jsonpb_test.name]\":\"Pi\"` +\n\t\t`}`\n\n\tanySimple = &pb2.KnownTypes{\n\t\tAn: &anypb.Any{\n\t\t\tTypeUrl: \"something.example.com/jsonpb_test.Simple\",\n\t\t\tValue: []byte{\n\t\t\t\t// &pb2.Simple{OBool:true}\n\t\t\t\t1 << 3, 1,\n\t\t\t},\n\t\t},\n\t}\n\tanySimpleJSON       = `{\"an\":{\"@type\":\"something.example.com/jsonpb_test.Simple\",\"oBool\":true}}`\n\tanySimplePrettyJSON = `{\n  \"an\": {\n    \"@type\": \"something.example.com/jsonpb_test.Simple\",\n    \"oBool\": true\n  }\n}`\n\n\tanyWellKnown = &pb2.KnownTypes{\n\t\tAn: &anypb.Any{\n\t\t\tTypeUrl: \"type.googleapis.com/google.protobuf.Duration\",\n\t\t\tValue: []byte{\n\t\t\t\t// &durpb.Duration{Seconds: 1, Nanos: 212000000 }\n\t\t\t\t1 << 3, 1, // seconds\n\t\t\t\t2 << 3, 0x80, 0xba, 0x8b, 0x65, // nanos\n\t\t\t},\n\t\t},\n\t}\n\tanyWellKnownJSON       = `{\"an\":{\"@type\":\"type.googleapis.com/google.protobuf.Duration\",\"value\":\"1.212s\"}}`\n\tanyWellKnownPrettyJSON = `{\n  \"an\": {\n    \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n    \"value\": \"1.212s\"\n  }\n}`\n\n\tnonFinites = &pb2.NonFinites{\n\t\tFNan:  proto.Float32(float32(math.NaN())),\n\t\tFPinf: proto.Float32(float32(math.Inf(1))),\n\t\tFNinf: proto.Float32(float32(math.Inf(-1))),\n\t\tDNan:  proto.Float64(float64(math.NaN())),\n\t\tDPinf: proto.Float64(float64(math.Inf(1))),\n\t\tDNinf: proto.Float64(float64(math.Inf(-1))),\n\t}\n\tnonFinitesJSON = `{` +\n\t\t`\"fNan\":\"NaN\",` +\n\t\t`\"fPinf\":\"Infinity\",` +\n\t\t`\"fNinf\":\"-Infinity\",` +\n\t\t`\"dNan\":\"NaN\",` +\n\t\t`\"dPinf\":\"Infinity\",` +\n\t\t`\"dNinf\":\"-Infinity\"` +\n\t\t`}`\n)\n\nfunc init() {\n\tif err := proto.SetExtension(realNumber, pb2.E_Name, &realNumberName); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := proto.SetExtension(realNumber, pb2.E_Complex_RealExtension, complexNumber); err != nil {\n\t\tpanic(err)\n\t}\n}\n\nvar marshalingTests = []struct {\n\tdesc      string\n\tmarshaler Marshaler\n\tpb        proto.Message\n\tjson      string\n}{\n\t{\"simple flat object\", marshaler, simpleObject, simpleObjectOutputJSON},\n\t{\"simple pretty object\", marshalerAllOptions, simpleObject, simpleObjectOutputPrettyJSON},\n\t{\"non-finite floats fields object\", marshaler, nonFinites, nonFinitesJSON},\n\t{\"repeated fields flat object\", marshaler, repeatsObject, repeatsObjectJSON},\n\t{\"repeated fields pretty object\", marshalerAllOptions, repeatsObject, repeatsObjectPrettyJSON},\n\t{\"nested message/enum flat object\", marshaler, complexObject, complexObjectJSON},\n\t{\"nested message/enum pretty object\", marshalerAllOptions, complexObject, complexObjectPrettyJSON},\n\t{\"enum-string flat object\", Marshaler{},\n\t\t&pb2.Widget{Color: pb2.Widget_BLUE.Enum()}, `{\"color\":\"BLUE\"}`},\n\t{\"enum-value pretty object\", Marshaler{EnumsAsInts: true, Indent: \" \"},\n\t\t&pb2.Widget{Color: pb2.Widget_BLUE.Enum()}, colorPrettyJSON},\n\t{\"unknown enum value object\", marshalerAllOptions,\n\t\t&pb2.Widget{Color: pb2.Widget_Color(1000).Enum(), RColor: []pb2.Widget_Color{pb2.Widget_RED}}, colorListPrettyJSON},\n\t{\"repeated proto3 enum\", Marshaler{},\n\t\t&pb3.Message{RFunny: []pb3.Message_Humour{\n\t\t\tpb3.Message_PUNS,\n\t\t\tpb3.Message_SLAPSTICK,\n\t\t}},\n\t\t`{\"rFunny\":[\"PUNS\",\"SLAPSTICK\"]}`},\n\t{\"repeated proto3 enum as int\", Marshaler{EnumsAsInts: true},\n\t\t&pb3.Message{RFunny: []pb3.Message_Humour{\n\t\t\tpb3.Message_PUNS,\n\t\t\tpb3.Message_SLAPSTICK,\n\t\t}},\n\t\t`{\"rFunny\":[1,2]}`},\n\t{\"empty value\", marshaler, &pb2.Simple3{}, `{}`},\n\t{\"empty value emitted\", Marshaler{EmitDefaults: true}, &pb2.Simple3{}, `{\"dub\":0}`},\n\t{\"empty repeated emitted\", Marshaler{EmitDefaults: true}, &pb2.SimpleSlice3{}, `{\"slices\":[]}`},\n\t{\"empty map emitted\", Marshaler{EmitDefaults: true}, &pb2.SimpleMap3{}, `{\"stringy\":{}}`},\n\t{\"nested struct null\", Marshaler{EmitDefaults: true}, &pb2.SimpleNull3{}, `{\"simple\":null}`},\n\t{\"map<int64, int32>\", marshaler, &pb2.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}, `{\"nummy\":{\"1\":2,\"3\":4}}`},\n\t{\"map<int64, int32>\", marshalerAllOptions, &pb2.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}, nummyPrettyJSON},\n\t{\"map<string, string>\", marshaler,\n\t\t&pb2.Mappy{Strry: map[string]string{`\"one\"`: \"two\", \"three\": \"four\"}},\n\t\t`{\"strry\":{\"\\\"one\\\"\":\"two\",\"three\":\"four\"}}`},\n\t{\"map<int32, Object>\", marshaler,\n\t\t&pb2.Mappy{Objjy: map[int32]*pb2.Simple3{1: {Dub: 1}}}, `{\"objjy\":{\"1\":{\"dub\":1}}}`},\n\t{\"map<int32, Object>\", marshalerAllOptions,\n\t\t&pb2.Mappy{Objjy: map[int32]*pb2.Simple3{1: {Dub: 1}}}, objjyPrettyJSON},\n\t{\"map<int64, string>\", marshaler, &pb2.Mappy{Buggy: map[int64]string{1234: \"yup\"}},\n\t\t`{\"buggy\":{\"1234\":\"yup\"}}`},\n\t{\"map<bool, bool>\", marshaler, &pb2.Mappy{Booly: map[bool]bool{false: true}}, `{\"booly\":{\"false\":true}}`},\n\t{\"map<string, enum>\", marshaler, &pb2.Mappy{Enumy: map[string]pb2.Numeral{\"XIV\": pb2.Numeral_ROMAN}}, `{\"enumy\":{\"XIV\":\"ROMAN\"}}`},\n\t{\"map<string, enum as int>\", Marshaler{EnumsAsInts: true}, &pb2.Mappy{Enumy: map[string]pb2.Numeral{\"XIV\": pb2.Numeral_ROMAN}}, `{\"enumy\":{\"XIV\":2}}`},\n\t{\"map<int32, bool>\", marshaler, &pb2.Mappy{S32Booly: map[int32]bool{1: true, 3: false, 10: true, 12: false}}, `{\"s32booly\":{\"1\":true,\"3\":false,\"10\":true,\"12\":false}}`},\n\t{\"map<int64, bool>\", marshaler, &pb2.Mappy{S64Booly: map[int64]bool{1: true, 3: false, 10: true, 12: false}}, `{\"s64booly\":{\"1\":true,\"3\":false,\"10\":true,\"12\":false}}`},\n\t{\"map<uint32, bool>\", marshaler, &pb2.Mappy{U32Booly: map[uint32]bool{1: true, 3: false, 10: true, 12: false}}, `{\"u32booly\":{\"1\":true,\"3\":false,\"10\":true,\"12\":false}}`},\n\t{\"map<uint64, bool>\", marshaler, &pb2.Mappy{U64Booly: map[uint64]bool{1: true, 3: false, 10: true, 12: false}}, `{\"u64booly\":{\"1\":true,\"3\":false,\"10\":true,\"12\":false}}`},\n\t{\"proto2 map<int64, string>\", marshaler, &pb2.Maps{MInt64Str: map[int64]string{213: \"cat\"}},\n\t\t`{\"mInt64Str\":{\"213\":\"cat\"}}`},\n\t{\"proto2 map<bool, Object>\", marshaler,\n\t\t&pb2.Maps{MBoolSimple: map[bool]*pb2.Simple{true: {OInt32: proto.Int32(1)}}},\n\t\t`{\"mBoolSimple\":{\"true\":{\"oInt32\":1}}}`},\n\t{\"oneof, not set\", marshaler, &pb2.MsgWithOneof{}, `{}`},\n\t{\"oneof, set\", marshaler, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_Title{\"Grand Poobah\"}}, `{\"title\":\"Grand Poobah\"}`},\n\t{\"oneof NullValue\", marshaler, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_NullValue{stpb.NullValue_NULL_VALUE}}, `{\"nullValue\":null}`},\n\t{\"force orig_name\", Marshaler{OrigName: true}, &pb2.Simple{OInt32: proto.Int32(4)},\n\t\t`{\"o_int32\":4}`},\n\t{\"proto2 extension\", marshaler, realNumber, realNumberJSON},\n\t{\"Any with message\", marshaler, anySimple, anySimpleJSON},\n\t{\"Any with message and indent\", marshalerAllOptions, anySimple, anySimplePrettyJSON},\n\t{\"Any with WKT\", marshaler, anyWellKnown, anyWellKnownJSON},\n\t{\"Any with WKT and indent\", marshalerAllOptions, anyWellKnown, anyWellKnownPrettyJSON},\n\t{\"Duration empty\", marshaler, &durpb.Duration{}, `\"0s\"`},\n\t{\"Duration with secs\", marshaler, &durpb.Duration{Seconds: 3}, `\"3s\"`},\n\t{\"Duration with -secs\", marshaler, &durpb.Duration{Seconds: -3}, `\"-3s\"`},\n\t{\"Duration with nanos\", marshaler, &durpb.Duration{Nanos: 1e6}, `\"0.001s\"`},\n\t{\"Duration with -nanos\", marshaler, &durpb.Duration{Nanos: -1e6}, `\"-0.001s\"`},\n\t{\"Duration with large secs\", marshaler, &durpb.Duration{Seconds: 1e10, Nanos: 1}, `\"10000000000.000000001s\"`},\n\t{\"Duration with 6-digit nanos\", marshaler, &durpb.Duration{Nanos: 1e4}, `\"0.000010s\"`},\n\t{\"Duration with 3-digit nanos\", marshaler, &durpb.Duration{Nanos: 1e6}, `\"0.001s\"`},\n\t{\"Duration with -secs -nanos\", marshaler, &durpb.Duration{Seconds: -123, Nanos: -450}, `\"-123.000000450s\"`},\n\t{\"Duration max value\", marshaler, &durpb.Duration{Seconds: 315576000000, Nanos: 999999999}, `\"315576000000.999999999s\"`},\n\t{\"Duration min value\", marshaler, &durpb.Duration{Seconds: -315576000000, Nanos: -999999999}, `\"-315576000000.999999999s\"`},\n\t{\"Struct\", marshaler, &pb2.KnownTypes{St: &stpb.Struct{\n\t\tFields: map[string]*stpb.Value{\n\t\t\t\"one\": {Kind: &stpb.Value_StringValue{\"loneliest number\"}},\n\t\t\t\"two\": {Kind: &stpb.Value_NullValue{stpb.NullValue_NULL_VALUE}},\n\t\t},\n\t}}, `{\"st\":{\"one\":\"loneliest number\",\"two\":null}}`},\n\t{\"empty ListValue\", marshaler, &pb2.KnownTypes{Lv: &stpb.ListValue{}}, `{\"lv\":[]}`},\n\t{\"basic ListValue\", marshaler, &pb2.KnownTypes{Lv: &stpb.ListValue{Values: []*stpb.Value{\n\t\t{Kind: &stpb.Value_StringValue{\"x\"}},\n\t\t{Kind: &stpb.Value_NullValue{}},\n\t\t{Kind: &stpb.Value_NumberValue{3}},\n\t\t{Kind: &stpb.Value_BoolValue{true}},\n\t}}}, `{\"lv\":[\"x\",null,3,true]}`},\n\t{\"Timestamp\", marshaler, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 21e6}}, `{\"ts\":\"2014-05-13T16:53:20.021Z\"}`},\n\t{\"Timestamp\", marshaler, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 0}}, `{\"ts\":\"2014-05-13T16:53:20Z\"}`},\n\t{\"number Value\", marshaler, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NumberValue{1}}}, `{\"val\":1}`},\n\t{\"null Value\", marshaler, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NullValue{stpb.NullValue_NULL_VALUE}}}, `{\"val\":null}`},\n\t{\"string number value\", marshaler, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_StringValue{\"9223372036854775807\"}}}, `{\"val\":\"9223372036854775807\"}`},\n\t{\"list of lists Value\", marshaler, &pb2.KnownTypes{Val: &stpb.Value{\n\t\tKind: &stpb.Value_ListValue{&stpb.ListValue{\n\t\t\tValues: []*stpb.Value{\n\t\t\t\t{Kind: &stpb.Value_StringValue{\"x\"}},\n\t\t\t\t{Kind: &stpb.Value_ListValue{&stpb.ListValue{\n\t\t\t\t\tValues: []*stpb.Value{\n\t\t\t\t\t\t{Kind: &stpb.Value_ListValue{&stpb.ListValue{\n\t\t\t\t\t\t\tValues: []*stpb.Value{{Kind: &stpb.Value_StringValue{\"y\"}}},\n\t\t\t\t\t\t}}},\n\t\t\t\t\t\t{Kind: &stpb.Value_StringValue{\"z\"}},\n\t\t\t\t\t},\n\t\t\t\t}}},\n\t\t\t},\n\t\t}},\n\t}}, `{\"val\":[\"x\",[[\"y\"],\"z\"]]}`},\n\n\t{\"DoubleValue\", marshaler, &pb2.KnownTypes{Dbl: &wpb.DoubleValue{Value: 1.2}}, `{\"dbl\":1.2}`},\n\t{\"FloatValue\", marshaler, &pb2.KnownTypes{Flt: &wpb.FloatValue{Value: 1.2}}, `{\"flt\":1.2}`},\n\t{\"Int64Value\", marshaler, &pb2.KnownTypes{I64: &wpb.Int64Value{Value: -3}}, `{\"i64\":\"-3\"}`},\n\t{\"UInt64Value\", marshaler, &pb2.KnownTypes{U64: &wpb.UInt64Value{Value: 3}}, `{\"u64\":\"3\"}`},\n\t{\"Int32Value\", marshaler, &pb2.KnownTypes{I32: &wpb.Int32Value{Value: -4}}, `{\"i32\":-4}`},\n\t{\"UInt32Value\", marshaler, &pb2.KnownTypes{U32: &wpb.UInt32Value{Value: 4}}, `{\"u32\":4}`},\n\t{\"BoolValue\", marshaler, &pb2.KnownTypes{Bool: &wpb.BoolValue{Value: true}}, `{\"bool\":true}`},\n\t{\"StringValue\", marshaler, &pb2.KnownTypes{Str: &wpb.StringValue{Value: \"plush\"}}, `{\"str\":\"plush\"}`},\n\t{\"BytesValue\", marshaler, &pb2.KnownTypes{Bytes: &wpb.BytesValue{Value: []byte(\"wow\")}}, `{\"bytes\":\"d293\"}`},\n\n\t{\"required\", marshaler, &pb2.MsgWithRequired{Str: proto.String(\"hello\")}, `{\"str\":\"hello\"}`},\n\t{\"required bytes\", marshaler, &pb2.MsgWithRequiredBytes{Byts: []byte{}}, `{\"byts\":\"\"}`},\n}\n\nfunc TestMarshaling(t *testing.T) {\n\tfor _, tt := range marshalingTests {\n\t\tjson, err := tt.marshaler.MarshalToString(tt.pb)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%s: marshaling error: %v\", tt.desc, err)\n\t\t} else if tt.json != json {\n\t\t\tt.Errorf(\"%s:\\ngot:  %v\\nwant: %v\", tt.desc, json, tt.json)\n\t\t}\n\t}\n}\n\nfunc TestMarshalingNil(t *testing.T) {\n\tvar msg *pb2.Simple\n\tm := &Marshaler{}\n\tif _, err := m.MarshalToString(msg); err == nil {\n\t\tt.Errorf(\"mashaling nil returned no error\")\n\t}\n}\n\nfunc TestMarshalIllegalTime(t *testing.T) {\n\ttests := []struct {\n\t\tpb   proto.Message\n\t\tfail bool\n\t}{\n\t\t{&durpb.Duration{Seconds: 1, Nanos: 0}, false},\n\t\t{&durpb.Duration{Seconds: -1, Nanos: 0}, false},\n\t\t{&durpb.Duration{Seconds: 1, Nanos: -1}, true},\n\t\t{&durpb.Duration{Seconds: -1, Nanos: 1}, true},\n\t\t{&durpb.Duration{Seconds: 315576000001}, true},\n\t\t{&durpb.Duration{Seconds: -315576000001}, true},\n\t\t{&durpb.Duration{Seconds: 1, Nanos: 1000000000}, true},\n\t\t{&durpb.Duration{Seconds: -1, Nanos: -1000000000}, true},\n\t\t{&tspb.Timestamp{Seconds: 1, Nanos: 1}, false},\n\t\t{&tspb.Timestamp{Seconds: 1, Nanos: -1}, true},\n\t\t{&tspb.Timestamp{Seconds: 1, Nanos: 1000000000}, true},\n\t}\n\tfor _, tt := range tests {\n\t\t_, err := marshaler.MarshalToString(tt.pb)\n\t\tif err == nil && tt.fail {\n\t\t\tt.Errorf(\"marshaler.MarshalToString(%v) = _, <nil>; want _, <non-nil>\", tt.pb)\n\t\t}\n\t\tif err != nil && !tt.fail {\n\t\t\tt.Errorf(\"marshaler.MarshalToString(%v) = _, %v; want _, <nil>\", tt.pb, err)\n\t\t}\n\t}\n}\n\nfunc TestMarshalJSONPBMarshaler(t *testing.T) {\n\trawJson := `{ \"foo\": \"bar\", \"baz\": [0, 1, 2, 3] }`\n\tmsg := dynamicMessage{RawJson: rawJson}\n\tstr, err := new(Marshaler).MarshalToString(&msg)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error while marshaling JSONPBMarshaler: %v\", err)\n\t}\n\tif str != rawJson {\n\t\tt.Errorf(\"marshaling JSON produced incorrect output: got %s, wanted %s\", str, rawJson)\n\t}\n}\n\nfunc TestMarshalAnyJSONPBMarshaler(t *testing.T) {\n\tmsg := dynamicMessage{RawJson: `{ \"foo\": \"bar\", \"baz\": [0, 1, 2, 3] }`}\n\ta, err := ptypes.MarshalAny(&msg)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error while marshaling to Any: %v\", err)\n\t}\n\tstr, err := new(Marshaler).MarshalToString(a)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error while marshaling Any to JSON: %v\", err)\n\t}\n\t// after custom marshaling, it's round-tripped through JSON decoding/encoding already,\n\t// so the keys are sorted, whitespace is compacted, and \"@type\" key has been added\n\twant := `{\"@type\":\"type.googleapis.com/` + dynamicMessageName + `\",\"baz\":[0,1,2,3],\"foo\":\"bar\"}`\n\tif str != want {\n\t\tt.Errorf(\"marshaling JSON produced incorrect output: got %s, wanted %s\", str, want)\n\t}\n}\n\nfunc TestMarshalWithCustomValidation(t *testing.T) {\n\tmsg := dynamicMessage{RawJson: `{ \"foo\": \"bar\", \"baz\": [0, 1, 2, 3] }`, Dummy: &dynamicMessage{}}\n\n\tjs, err := new(Marshaler).MarshalToString(&msg)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error while marshaling to json: %v\", err)\n\t}\n\terr = Unmarshal(strings.NewReader(js), &msg)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error while unmarshaling from json: %v\", err)\n\t}\n}\n\n// Test marshaling message containing unset required fields should produce error.\nfunc TestMarshalUnsetRequiredFields(t *testing.T) {\n\tmsgExt := &pb2.Real{}\n\tproto.SetExtension(msgExt, pb2.E_Extm, &pb2.MsgWithRequired{})\n\n\ttests := []struct {\n\t\tdesc      string\n\t\tmarshaler *Marshaler\n\t\tpb        proto.Message\n\t}{\n\t\t{\n\t\t\tdesc:      \"direct required field\",\n\t\t\tmarshaler: &Marshaler{},\n\t\t\tpb:        &pb2.MsgWithRequired{},\n\t\t},\n\t\t{\n\t\t\tdesc:      \"direct required field + emit defaults\",\n\t\t\tmarshaler: &Marshaler{EmitDefaults: true},\n\t\t\tpb:        &pb2.MsgWithRequired{},\n\t\t},\n\t\t{\n\t\t\tdesc:      \"indirect required field\",\n\t\t\tmarshaler: &Marshaler{},\n\t\t\tpb:        &pb2.MsgWithIndirectRequired{Subm: &pb2.MsgWithRequired{}},\n\t\t},\n\t\t{\n\t\t\tdesc:      \"indirect required field + emit defaults\",\n\t\t\tmarshaler: &Marshaler{EmitDefaults: true},\n\t\t\tpb:        &pb2.MsgWithIndirectRequired{Subm: &pb2.MsgWithRequired{}},\n\t\t},\n\t\t{\n\t\t\tdesc:      \"direct required wkt field\",\n\t\t\tmarshaler: &Marshaler{},\n\t\t\tpb:        &pb2.MsgWithRequiredWKT{},\n\t\t},\n\t\t{\n\t\t\tdesc:      \"direct required wkt field + emit defaults\",\n\t\t\tmarshaler: &Marshaler{EmitDefaults: true},\n\t\t\tpb:        &pb2.MsgWithRequiredWKT{},\n\t\t},\n\t\t{\n\t\t\tdesc:      \"direct required bytes field\",\n\t\t\tmarshaler: &Marshaler{},\n\t\t\tpb:        &pb2.MsgWithRequiredBytes{},\n\t\t},\n\t\t{\n\t\t\tdesc:      \"required in map value\",\n\t\t\tmarshaler: &Marshaler{},\n\t\t\tpb: &pb2.MsgWithIndirectRequired{\n\t\t\t\tMapField: map[string]*pb2.MsgWithRequired{\n\t\t\t\t\t\"key\": {},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdesc:      \"required in repeated item\",\n\t\t\tmarshaler: &Marshaler{},\n\t\t\tpb: &pb2.MsgWithIndirectRequired{\n\t\t\t\tSliceField: []*pb2.MsgWithRequired{\n\t\t\t\t\t{Str: proto.String(\"hello\")},\n\t\t\t\t\t{},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdesc:      \"required inside oneof\",\n\t\t\tmarshaler: &Marshaler{},\n\t\t\tpb: &pb2.MsgWithOneof{\n\t\t\t\tUnion: &pb2.MsgWithOneof_MsgWithRequired{&pb2.MsgWithRequired{}},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdesc:      \"required inside extension\",\n\t\t\tmarshaler: &Marshaler{},\n\t\t\tpb:        msgExt,\n\t\t},\n\t}\n\n\tfor _, tc := range tests {\n\t\tif _, err := tc.marshaler.MarshalToString(tc.pb); err == nil {\n\t\t\tt.Errorf(\"%s: expected error while marshaling with unset required fields %+v\", tc.desc, tc.pb)\n\t\t}\n\t}\n}\n\nvar unmarshalingTests = []struct {\n\tdesc        string\n\tunmarshaler Unmarshaler\n\tjson        string\n\tpb          proto.Message\n}{\n\t{\"simple flat object\", Unmarshaler{}, simpleObjectInputJSON, simpleObject},\n\t{\"simple pretty object\", Unmarshaler{}, simpleObjectInputPrettyJSON, simpleObject},\n\t{\"repeated fields flat object\", Unmarshaler{}, repeatsObjectJSON, repeatsObject},\n\t{\"repeated fields pretty object\", Unmarshaler{}, repeatsObjectPrettyJSON, repeatsObject},\n\t{\"nested message/enum flat object\", Unmarshaler{}, complexObjectJSON, complexObject},\n\t{\"nested message/enum pretty object\", Unmarshaler{}, complexObjectPrettyJSON, complexObject},\n\t{\"enum-string object\", Unmarshaler{}, `{\"color\":\"BLUE\"}`, &pb2.Widget{Color: pb2.Widget_BLUE.Enum()}},\n\t{\"enum-value object\", Unmarshaler{}, \"{\\n \\\"color\\\": 2\\n}\", &pb2.Widget{Color: pb2.Widget_BLUE.Enum()}},\n\t{\"unknown field with allowed option\", Unmarshaler{AllowUnknownFields: true}, `{\"unknown\": \"foo\"}`, new(pb2.Simple)},\n\t{\"proto3 enum string\", Unmarshaler{}, `{\"hilarity\":\"PUNS\"}`, &pb3.Message{Hilarity: pb3.Message_PUNS}},\n\t{\"proto3 enum value\", Unmarshaler{}, `{\"hilarity\":1}`, &pb3.Message{Hilarity: pb3.Message_PUNS}},\n\t{\"unknown enum value object\",\n\t\tUnmarshaler{},\n\t\t\"{\\n  \\\"color\\\": 1000,\\n  \\\"r_color\\\": [\\n    \\\"RED\\\"\\n  ]\\n}\",\n\t\t&pb2.Widget{Color: pb2.Widget_Color(1000).Enum(), RColor: []pb2.Widget_Color{pb2.Widget_RED}}},\n\t{\"repeated proto3 enum\", Unmarshaler{}, `{\"rFunny\":[\"PUNS\",\"SLAPSTICK\"]}`,\n\t\t&pb3.Message{RFunny: []pb3.Message_Humour{\n\t\t\tpb3.Message_PUNS,\n\t\t\tpb3.Message_SLAPSTICK,\n\t\t}}},\n\t{\"repeated proto3 enum as int\", Unmarshaler{}, `{\"rFunny\":[1,2]}`,\n\t\t&pb3.Message{RFunny: []pb3.Message_Humour{\n\t\t\tpb3.Message_PUNS,\n\t\t\tpb3.Message_SLAPSTICK,\n\t\t}}},\n\t{\"repeated proto3 enum as mix of strings and ints\", Unmarshaler{}, `{\"rFunny\":[\"PUNS\",2]}`,\n\t\t&pb3.Message{RFunny: []pb3.Message_Humour{\n\t\t\tpb3.Message_PUNS,\n\t\t\tpb3.Message_SLAPSTICK,\n\t\t}}},\n\t{\"unquoted int64 object\", Unmarshaler{}, `{\"oInt64\":-314}`, &pb2.Simple{OInt64: proto.Int64(-314)}},\n\t{\"unquoted uint64 object\", Unmarshaler{}, `{\"oUint64\":123}`, &pb2.Simple{OUint64: proto.Uint64(123)}},\n\t{\"NaN\", Unmarshaler{}, `{\"oDouble\":\"NaN\"}`, &pb2.Simple{ODouble: proto.Float64(math.NaN())}},\n\t{\"Inf\", Unmarshaler{}, `{\"oFloat\":\"Infinity\"}`, &pb2.Simple{OFloat: proto.Float32(float32(math.Inf(1)))}},\n\t{\"-Inf\", Unmarshaler{}, `{\"oDouble\":\"-Infinity\"}`, &pb2.Simple{ODouble: proto.Float64(math.Inf(-1))}},\n\t{\"map<int64, int32>\", Unmarshaler{}, `{\"nummy\":{\"1\":2,\"3\":4}}`, &pb2.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}},\n\t{\"map<string, string>\", Unmarshaler{}, `{\"strry\":{\"\\\"one\\\"\":\"two\",\"three\":\"four\"}}`, &pb2.Mappy{Strry: map[string]string{`\"one\"`: \"two\", \"three\": \"four\"}}},\n\t{\"map<int32, Object>\", Unmarshaler{}, `{\"objjy\":{\"1\":{\"dub\":1}}}`, &pb2.Mappy{Objjy: map[int32]*pb2.Simple3{1: {Dub: 1}}}},\n\t{\"proto2 extension\", Unmarshaler{}, realNumberJSON, realNumber},\n\t{\"Any with message\", Unmarshaler{}, anySimpleJSON, anySimple},\n\t{\"Any with message and indent\", Unmarshaler{}, anySimplePrettyJSON, anySimple},\n\t{\"Any with WKT\", Unmarshaler{}, anyWellKnownJSON, anyWellKnown},\n\t{\"Any with WKT and indent\", Unmarshaler{}, anyWellKnownPrettyJSON, anyWellKnown},\n\t{\"map<string, enum>\", Unmarshaler{}, `{\"enumy\":{\"XIV\":\"ROMAN\"}}`, &pb2.Mappy{Enumy: map[string]pb2.Numeral{\"XIV\": pb2.Numeral_ROMAN}}},\n\t{\"map<string, enum as int>\", Unmarshaler{}, `{\"enumy\":{\"XIV\":2}}`, &pb2.Mappy{Enumy: map[string]pb2.Numeral{\"XIV\": pb2.Numeral_ROMAN}}},\n\t{\"oneof\", Unmarshaler{}, `{\"salary\":31000}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_Salary{31000}}},\n\t{\"oneof spec name\", Unmarshaler{}, `{\"Country\":\"Australia\"}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_Country{\"Australia\"}}},\n\t{\"oneof orig_name\", Unmarshaler{}, `{\"Country\":\"Australia\"}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_Country{\"Australia\"}}},\n\t{\"oneof spec name2\", Unmarshaler{}, `{\"homeAddress\":\"Australia\"}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_HomeAddress{\"Australia\"}}},\n\t{\"oneof orig_name2\", Unmarshaler{}, `{\"home_address\":\"Australia\"}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_HomeAddress{\"Australia\"}}},\n\t{\"oneof NullValue\", Unmarshaler{}, `{\"nullValue\":null}`, &pb2.MsgWithOneof{Union: &pb2.MsgWithOneof_NullValue{stpb.NullValue_NULL_VALUE}}},\n\t{\"orig_name input\", Unmarshaler{}, `{\"o_bool\":true}`, &pb2.Simple{OBool: proto.Bool(true)}},\n\t{\"camelName input\", Unmarshaler{}, `{\"oBool\":true}`, &pb2.Simple{OBool: proto.Bool(true)}},\n\n\t{\"Duration\", Unmarshaler{}, `{\"dur\":\"3.000s\"}`, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}},\n\t{\"Duration\", Unmarshaler{}, `{\"dur\":\"4s\"}`, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 4}}},\n\t{\"Duration with unicode\", Unmarshaler{}, `{\"dur\": \"3\\u0073\"}`, &pb2.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}},\n\t{\"null Duration\", Unmarshaler{}, `{\"dur\":null}`, &pb2.KnownTypes{Dur: nil}},\n\t{\"Timestamp\", Unmarshaler{}, `{\"ts\":\"2014-05-13T16:53:20.021Z\"}`, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 21e6}}},\n\t{\"Timestamp\", Unmarshaler{}, `{\"ts\":\"2014-05-13T16:53:20Z\"}`, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 0}}},\n\t{\"Timestamp with unicode\", Unmarshaler{}, `{\"ts\": \"2014-05-13T16:53:20\\u005a\"}`, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 0}}},\n\t{\"PreEpochTimestamp\", Unmarshaler{}, `{\"ts\":\"1969-12-31T23:59:58.999999995Z\"}`, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: -2, Nanos: 999999995}}},\n\t{\"ZeroTimeTimestamp\", Unmarshaler{}, `{\"ts\":\"0001-01-01T00:00:00Z\"}`, &pb2.KnownTypes{Ts: &tspb.Timestamp{Seconds: -62135596800, Nanos: 0}}},\n\t{\"null Timestamp\", Unmarshaler{}, `{\"ts\":null}`, &pb2.KnownTypes{Ts: nil}},\n\t{\"null Struct\", Unmarshaler{}, `{\"st\": null}`, &pb2.KnownTypes{St: nil}},\n\t{\"empty Struct\", Unmarshaler{}, `{\"st\": {}}`, &pb2.KnownTypes{St: &stpb.Struct{}}},\n\t{\"basic Struct\", Unmarshaler{}, `{\"st\": {\"a\": \"x\", \"b\": null, \"c\": 3, \"d\": true}}`, &pb2.KnownTypes{St: &stpb.Struct{Fields: map[string]*stpb.Value{\n\t\t\"a\": {Kind: &stpb.Value_StringValue{\"x\"}},\n\t\t\"b\": {Kind: &stpb.Value_NullValue{}},\n\t\t\"c\": {Kind: &stpb.Value_NumberValue{3}},\n\t\t\"d\": {Kind: &stpb.Value_BoolValue{true}},\n\t}}}},\n\t{\"nested Struct\", Unmarshaler{}, `{\"st\": {\"a\": {\"b\": 1, \"c\": [{\"d\": true}, \"f\"]}}}`, &pb2.KnownTypes{St: &stpb.Struct{Fields: map[string]*stpb.Value{\n\t\t\"a\": {Kind: &stpb.Value_StructValue{&stpb.Struct{Fields: map[string]*stpb.Value{\n\t\t\t\"b\": {Kind: &stpb.Value_NumberValue{1}},\n\t\t\t\"c\": {Kind: &stpb.Value_ListValue{&stpb.ListValue{Values: []*stpb.Value{\n\t\t\t\t{Kind: &stpb.Value_StructValue{&stpb.Struct{Fields: map[string]*stpb.Value{\"d\": {Kind: &stpb.Value_BoolValue{true}}}}}},\n\t\t\t\t{Kind: &stpb.Value_StringValue{\"f\"}},\n\t\t\t}}}},\n\t\t}}}},\n\t}}}},\n\t{\"null ListValue\", Unmarshaler{}, `{\"lv\": null}`, &pb2.KnownTypes{Lv: nil}},\n\t{\"empty ListValue\", Unmarshaler{}, `{\"lv\": []}`, &pb2.KnownTypes{Lv: &stpb.ListValue{}}},\n\t{\"basic ListValue\", Unmarshaler{}, `{\"lv\": [\"x\", null, 3, true]}`, &pb2.KnownTypes{Lv: &stpb.ListValue{Values: []*stpb.Value{\n\t\t{Kind: &stpb.Value_StringValue{\"x\"}},\n\t\t{Kind: &stpb.Value_NullValue{}},\n\t\t{Kind: &stpb.Value_NumberValue{3}},\n\t\t{Kind: &stpb.Value_BoolValue{true}},\n\t}}}},\n\t{\"number Value\", Unmarshaler{}, `{\"val\":1}`, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NumberValue{1}}}},\n\t{\"null Value\", Unmarshaler{}, `{\"val\":null}`, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NullValue{stpb.NullValue_NULL_VALUE}}}},\n\t{\"bool Value\", Unmarshaler{}, `{\"val\":true}`, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_BoolValue{true}}}},\n\t{\"string Value\", Unmarshaler{}, `{\"val\":\"x\"}`, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_StringValue{\"x\"}}}},\n\t{\"string number value\", Unmarshaler{}, `{\"val\":\"9223372036854775807\"}`, &pb2.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_StringValue{\"9223372036854775807\"}}}},\n\t{\"list of lists Value\", Unmarshaler{}, `{\"val\":[\"x\", [[\"y\"], \"z\"]]}`, &pb2.KnownTypes{Val: &stpb.Value{\n\t\tKind: &stpb.Value_ListValue{&stpb.ListValue{\n\t\t\tValues: []*stpb.Value{\n\t\t\t\t{Kind: &stpb.Value_StringValue{\"x\"}},\n\t\t\t\t{Kind: &stpb.Value_ListValue{&stpb.ListValue{\n\t\t\t\t\tValues: []*stpb.Value{\n\t\t\t\t\t\t{Kind: &stpb.Value_ListValue{&stpb.ListValue{\n\t\t\t\t\t\t\tValues: []*stpb.Value{{Kind: &stpb.Value_StringValue{\"y\"}}},\n\t\t\t\t\t\t}}},\n\t\t\t\t\t\t{Kind: &stpb.Value_StringValue{\"z\"}},\n\t\t\t\t\t},\n\t\t\t\t}}},\n\t\t\t},\n\t\t}}}}},\n\n\t{\"DoubleValue\", Unmarshaler{}, `{\"dbl\":1.2}`, &pb2.KnownTypes{Dbl: &wpb.DoubleValue{Value: 1.2}}},\n\t{\"FloatValue\", Unmarshaler{}, `{\"flt\":1.2}`, &pb2.KnownTypes{Flt: &wpb.FloatValue{Value: 1.2}}},\n\t{\"Int64Value\", Unmarshaler{}, `{\"i64\":\"-3\"}`, &pb2.KnownTypes{I64: &wpb.Int64Value{Value: -3}}},\n\t{\"UInt64Value\", Unmarshaler{}, `{\"u64\":\"3\"}`, &pb2.KnownTypes{U64: &wpb.UInt64Value{Value: 3}}},\n\t{\"Int32Value\", Unmarshaler{}, `{\"i32\":-4}`, &pb2.KnownTypes{I32: &wpb.Int32Value{Value: -4}}},\n\t{\"UInt32Value\", Unmarshaler{}, `{\"u32\":4}`, &pb2.KnownTypes{U32: &wpb.UInt32Value{Value: 4}}},\n\t{\"BoolValue\", Unmarshaler{}, `{\"bool\":true}`, &pb2.KnownTypes{Bool: &wpb.BoolValue{Value: true}}},\n\t{\"StringValue\", Unmarshaler{}, `{\"str\":\"plush\"}`, &pb2.KnownTypes{Str: &wpb.StringValue{Value: \"plush\"}}},\n\t{\"StringValue containing escaped character\", Unmarshaler{}, `{\"str\":\"a\\/b\"}`, &pb2.KnownTypes{Str: &wpb.StringValue{Value: \"a/b\"}}},\n\t{\"StructValue containing StringValue's\", Unmarshaler{}, `{\"escaped\": \"a\\/b\", \"unicode\": \"\\u00004E16\\u0000754C\"}`,\n\t\t&stpb.Struct{\n\t\t\tFields: map[string]*stpb.Value{\n\t\t\t\t\"escaped\": {Kind: &stpb.Value_StringValue{\"a/b\"}},\n\t\t\t\t\"unicode\": {Kind: &stpb.Value_StringValue{\"\\u00004E16\\u0000754C\"}},\n\t\t\t},\n\t\t}},\n\t{\"BytesValue\", Unmarshaler{}, `{\"bytes\":\"d293\"}`, &pb2.KnownTypes{Bytes: &wpb.BytesValue{Value: []byte(\"wow\")}}},\n\n\t// Ensure that `null` as a value ends up with a nil pointer instead of a [type]Value struct.\n\t{\"null DoubleValue\", Unmarshaler{}, `{\"dbl\":null}`, &pb2.KnownTypes{Dbl: nil}},\n\t{\"null FloatValue\", Unmarshaler{}, `{\"flt\":null}`, &pb2.KnownTypes{Flt: nil}},\n\t{\"null Int64Value\", Unmarshaler{}, `{\"i64\":null}`, &pb2.KnownTypes{I64: nil}},\n\t{\"null UInt64Value\", Unmarshaler{}, `{\"u64\":null}`, &pb2.KnownTypes{U64: nil}},\n\t{\"null Int32Value\", Unmarshaler{}, `{\"i32\":null}`, &pb2.KnownTypes{I32: nil}},\n\t{\"null UInt32Value\", Unmarshaler{}, `{\"u32\":null}`, &pb2.KnownTypes{U32: nil}},\n\t{\"null BoolValue\", Unmarshaler{}, `{\"bool\":null}`, &pb2.KnownTypes{Bool: nil}},\n\t{\"null StringValue\", Unmarshaler{}, `{\"str\":null}`, &pb2.KnownTypes{Str: nil}},\n\t{\"null BytesValue\", Unmarshaler{}, `{\"bytes\":null}`, &pb2.KnownTypes{Bytes: nil}},\n\n\t{\"required\", Unmarshaler{}, `{\"str\":\"hello\"}`, &pb2.MsgWithRequired{Str: proto.String(\"hello\")}},\n\t{\"required bytes\", Unmarshaler{}, `{\"byts\": []}`, &pb2.MsgWithRequiredBytes{Byts: []byte{}}},\n}\n\nfunc TestUnmarshaling(t *testing.T) {\n\tfor _, tt := range unmarshalingTests {\n\t\t// Make a new instance of the type of our wanted object.\n\t\tp := reflect.New(reflect.TypeOf(tt.pb).Elem()).Interface().(proto.Message)\n\n\t\terr := tt.unmarshaler.Unmarshal(strings.NewReader(tt.json), p)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"unmarshaling %s: %v\", tt.desc, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// For easier diffs, compare text strings of the protos.\n\t\texp := proto.MarshalTextString(tt.pb)\n\t\tact := proto.MarshalTextString(p)\n\t\tif string(exp) != string(act) {\n\t\t\tt.Errorf(\"%s: got [%s] want [%s]\", tt.desc, act, exp)\n\t\t}\n\t}\n}\n\nfunc TestUnmarshalNullArray(t *testing.T) {\n\tvar repeats pb2.Repeats\n\tif err := UnmarshalString(`{\"rBool\":null}`, &repeats); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !proto.Equal(&repeats, &pb2.Repeats{}) {\n\t\tt.Errorf(\"got non-nil fields in [%#v]\", repeats)\n\t}\n}\n\nfunc TestUnmarshalNullObject(t *testing.T) {\n\tvar maps pb2.Maps\n\tif err := UnmarshalString(`{\"mInt64Str\":null}`, &maps); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !proto.Equal(&maps, &pb2.Maps{}) {\n\t\tt.Errorf(\"got non-nil fields in [%#v]\", maps)\n\t}\n}\n\nfunc TestUnmarshalNext(t *testing.T) {\n\t// We only need to check against a few, not all of them.\n\ttests := unmarshalingTests[:5]\n\n\t// Create a buffer with many concatenated JSON objects.\n\tvar b bytes.Buffer\n\tfor _, tt := range tests {\n\t\tb.WriteString(tt.json)\n\t}\n\n\tdec := json.NewDecoder(&b)\n\tfor _, tt := range tests {\n\t\t// Make a new instance of the type of our wanted object.\n\t\tp := reflect.New(reflect.TypeOf(tt.pb).Elem()).Interface().(proto.Message)\n\n\t\terr := tt.unmarshaler.UnmarshalNext(dec, p)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%s: %v\", tt.desc, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// For easier diffs, compare text strings of the protos.\n\t\texp := proto.MarshalTextString(tt.pb)\n\t\tact := proto.MarshalTextString(p)\n\t\tif string(exp) != string(act) {\n\t\t\tt.Errorf(\"%s: got [%s] want [%s]\", tt.desc, act, exp)\n\t\t}\n\t}\n\n\tp := &pb2.Simple{}\n\terr := new(Unmarshaler).UnmarshalNext(dec, p)\n\tif err != io.EOF {\n\t\tt.Errorf(\"eof: got %v, want io.EOF\", err)\n\t}\n}\n\nvar unmarshalingShouldError = []struct {\n\tdesc string\n\tin   string\n\tpb   proto.Message\n}{\n\t{\"a value\", \"666\", new(pb2.Simple)},\n\t{\"gibberish\", \"{adskja123;l23=-=\", new(pb2.Simple)},\n\t{\"unknown field\", `{\"unknown\": \"foo\"}`, new(pb2.Simple)},\n\t{\"unknown enum name\", `{\"hilarity\":\"DAVE\"}`, new(pb3.Message)},\n\t{\"Duration containing invalid character\", `{\"dur\": \"3\\U0073\"}`, &pb2.KnownTypes{}},\n\t{\"Timestamp containing invalid character\", `{\"ts\": \"2014-05-13T16:53:20\\U005a\"}`, &pb2.KnownTypes{}},\n\t{\"StringValue containing invalid character\", `{\"str\": \"\\U00004E16\\U0000754C\"}`, &pb2.KnownTypes{}},\n\t{\"StructValue containing invalid character\", `{\"str\": \"\\U00004E16\\U0000754C\"}`, &stpb.Struct{}},\n\t{\"repeated proto3 enum with non array input\", `{\"rFunny\":\"PUNS\"}`, &pb3.Message{RFunny: []pb3.Message_Humour{}}},\n\t{\"unknown extension field\", `{\"[ext_unknown]\": \"value\"}`, &pb2.Real{}},\n\t{\"extension field for wrong message\", `{\"[jsonpb_test.name]\": \"value\"}`, &pb2.Complex{}},\n}\n\nfunc TestUnmarshalingBadInput(t *testing.T) {\n\tfor _, tt := range unmarshalingShouldError {\n\t\terr := UnmarshalString(tt.in, tt.pb)\n\t\tif err == nil {\n\t\t\tt.Errorf(\"expected error while parsing %q\", tt.desc)\n\t\t}\n\t}\n}\n\ntype funcResolver func(turl string) (proto.Message, error)\n\nfunc (fn funcResolver) Resolve(turl string) (proto.Message, error) {\n\treturn fn(turl)\n}\n\nfunc TestAnyWithCustomResolver(t *testing.T) {\n\tvar resolvedTypeUrls []string\n\tresolver := funcResolver(func(turl string) (proto.Message, error) {\n\t\tresolvedTypeUrls = append(resolvedTypeUrls, turl)\n\t\treturn new(pb2.Simple), nil\n\t})\n\tmsg := &pb2.Simple{\n\t\tOBytes:  []byte{1, 2, 3, 4},\n\t\tOBool:   proto.Bool(true),\n\t\tOString: proto.String(\"foobar\"),\n\t\tOInt64:  proto.Int64(1020304),\n\t}\n\tmsgBytes, err := proto.Marshal(msg)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error while marshaling message: %v\", err)\n\t}\n\t// make an Any with a type URL that won't resolve w/out custom resolver\n\tany := &anypb.Any{\n\t\tTypeUrl: \"https://foobar.com/some.random.MessageKind\",\n\t\tValue:   msgBytes,\n\t}\n\n\tm := Marshaler{AnyResolver: resolver}\n\tjs, err := m.MarshalToString(any)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error while marshaling any to JSON: %v\", err)\n\t}\n\tif len(resolvedTypeUrls) != 1 {\n\t\tt.Errorf(\"custom resolver was not invoked during marshaling\")\n\t} else if resolvedTypeUrls[0] != \"https://foobar.com/some.random.MessageKind\" {\n\t\tt.Errorf(\"custom resolver was invoked with wrong URL: got %q, wanted %q\", resolvedTypeUrls[0], \"https://foobar.com/some.random.MessageKind\")\n\t}\n\twanted := `{\"@type\":\"https://foobar.com/some.random.MessageKind\",\"oBool\":true,\"oInt64\":\"1020304\",\"oString\":\"foobar\",\"oBytes\":\"AQIDBA==\"}`\n\tif js != wanted {\n\t\tt.Errorf(\"marshaling JSON produced incorrect output: got %s, wanted %s\", js, wanted)\n\t}\n\n\tu := Unmarshaler{AnyResolver: resolver}\n\troundTrip := &anypb.Any{}\n\terr = u.Unmarshal(bytes.NewReader([]byte(js)), roundTrip)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error while unmarshaling any from JSON: %v\", err)\n\t}\n\tif len(resolvedTypeUrls) != 2 {\n\t\tt.Errorf(\"custom resolver was not invoked during marshaling\")\n\t} else if resolvedTypeUrls[1] != \"https://foobar.com/some.random.MessageKind\" {\n\t\tt.Errorf(\"custom resolver was invoked with wrong URL: got %q, wanted %q\", resolvedTypeUrls[1], \"https://foobar.com/some.random.MessageKind\")\n\t}\n\tif !proto.Equal(any, roundTrip) {\n\t\tt.Errorf(\"message contents not set correctly after unmarshaling JSON: got %s, wanted %s\", roundTrip, any)\n\t}\n}\n\nfunc TestUnmarshalJSONPBUnmarshaler(t *testing.T) {\n\trawJson := `{ \"foo\": \"bar\", \"baz\": [0, 1, 2, 3] }`\n\tvar msg dynamicMessage\n\tif err := Unmarshal(strings.NewReader(rawJson), &msg); err != nil {\n\t\tt.Errorf(\"an unexpected error while parsing into JSONPBUnmarshaler: %v\", err)\n\t}\n\tif msg.RawJson != rawJson {\n\t\tt.Errorf(\"message contents not set correctly after unmarshaling JSON: got %s, wanted %s\", msg.RawJson, rawJson)\n\t}\n}\n\nfunc TestUnmarshalNullWithJSONPBUnmarshaler(t *testing.T) {\n\trawJson := `{\"stringField\":null}`\n\tvar ptrFieldMsg ptrFieldMessage\n\tif err := Unmarshal(strings.NewReader(rawJson), &ptrFieldMsg); err != nil {\n\t\tt.Errorf(\"unmarshal error: %v\", err)\n\t}\n\n\twant := ptrFieldMessage{StringField: &stringField{IsSet: true, StringValue: \"null\"}}\n\tif !proto.Equal(&ptrFieldMsg, &want) {\n\t\tt.Errorf(\"unmarshal result StringField: got %v, want %v\", ptrFieldMsg, want)\n\t}\n}\n\nfunc TestUnmarshalAnyJSONPBUnmarshaler(t *testing.T) {\n\trawJson := `{ \"@type\": \"blah.com/` + dynamicMessageName + `\", \"foo\": \"bar\", \"baz\": [0, 1, 2, 3] }`\n\tvar got anypb.Any\n\tif err := Unmarshal(strings.NewReader(rawJson), &got); err != nil {\n\t\tt.Errorf(\"an unexpected error while parsing into JSONPBUnmarshaler: %v\", err)\n\t}\n\n\tdm := &dynamicMessage{RawJson: `{\"baz\":[0,1,2,3],\"foo\":\"bar\"}`}\n\tvar want anypb.Any\n\tif b, err := proto.Marshal(dm); err != nil {\n\t\tt.Errorf(\"an unexpected error while marshaling message: %v\", err)\n\t} else {\n\t\twant.TypeUrl = \"blah.com/\" + dynamicMessageName\n\t\twant.Value = b\n\t}\n\n\tif !proto.Equal(&got, &want) {\n\t\tt.Errorf(\"message contents not set correctly after unmarshaling JSON: got %v, wanted %v\", &got, &want)\n\t}\n}\n\nconst (\n\tdynamicMessageName = \"github_com.golang.protobuf.jsonpb.dynamicMessage\"\n)\n\nfunc init() {\n\t// we register the custom type below so that we can use it in Any types\n\tproto.RegisterType((*dynamicMessage)(nil), dynamicMessageName)\n}\n\ntype ptrFieldMessage struct {\n\tStringField *stringField `protobuf:\"bytes,1,opt,name=stringField\"`\n}\n\nfunc (m *ptrFieldMessage) Reset() {\n}\n\nfunc (m *ptrFieldMessage) String() string {\n\treturn m.StringField.StringValue\n}\n\nfunc (m *ptrFieldMessage) ProtoMessage() {\n}\n\nfunc (m *ptrFieldMessage) Descriptor() ([]byte, []int) {\n\treturn testMessageFD, []int{0}\n}\n\ntype stringField struct {\n\tIsSet       bool   `protobuf:\"varint,1,opt,name=isSet\"`\n\tStringValue string `protobuf:\"bytes,2,opt,name=stringValue\"`\n}\n\nfunc (s *stringField) Reset() {\n}\n\nfunc (s *stringField) String() string {\n\treturn s.StringValue\n}\n\nfunc (s *stringField) ProtoMessage() {\n}\n\nfunc (s *stringField) Descriptor() ([]byte, []int) {\n\treturn testMessageFD, []int{1}\n}\n\nfunc (s *stringField) UnmarshalJSONPB(jum *Unmarshaler, js []byte) error {\n\ts.IsSet = true\n\ts.StringValue = string(js)\n\treturn nil\n}\n\n// dynamicMessage implements protobuf.Message but is not a normal generated message type.\n// It provides implementations of JSONPBMarshaler and JSONPBUnmarshaler for JSON support.\ntype dynamicMessage struct {\n\tRawJson string `protobuf:\"bytes,1,opt,name=rawJson\"`\n\n\t// an unexported nested message is present just to ensure that it\n\t// won't result in a panic (see issue #509)\n\tDummy *dynamicMessage `protobuf:\"bytes,2,opt,name=dummy\"`\n}\n\nfunc (m *dynamicMessage) Reset() {\n\tm.RawJson = \"{}\"\n}\n\nfunc (m *dynamicMessage) String() string {\n\treturn m.RawJson\n}\n\nfunc (m *dynamicMessage) ProtoMessage() {\n}\n\nfunc (m *dynamicMessage) Descriptor() ([]byte, []int) {\n\treturn testMessageFD, []int{2}\n}\n\nfunc (m *dynamicMessage) MarshalJSONPB(jm *Marshaler) ([]byte, error) {\n\treturn []byte(m.RawJson), nil\n}\n\nfunc (m *dynamicMessage) UnmarshalJSONPB(jum *Unmarshaler, js []byte) error {\n\tm.RawJson = string(js)\n\treturn nil\n}\n\nvar testMessageFD = func() []byte {\n\tfd := new(descpb.FileDescriptorProto)\n\tproto.UnmarshalText(`\n\t\tname:    \"jsonpb.proto\"\n\t\tpackage: \"github_com.golang.protobuf.jsonpb\"\n\t\tsyntax:  \"proto3\"\n\t\tmessage_type: [{\n\t\t\tname: \"ptrFieldMessage\"\n\t\t\tfield: [\n\t\t\t\t{name:\"stringField\" number:1 label:LABEL_OPTIONAL type:TYPE_MESSAGE type_name:\".github_com.golang.protobuf.jsonpb.stringField\"}\n\t\t\t]\n\t\t}, {\n\t\t\tname: \"stringField\"\n\t\t\tfield: [\n\t\t\t\t{name:\"isSet\"       number:1 label:LABEL_OPTIONAL type:TYPE_BOOL},\n\t\t\t\t{name:\"stringValue\" number:2 label:LABEL_OPTIONAL type:TYPE_STRING}\n\t\t\t]\n\t\t}, {\n\t\t\tname: \"dynamicMessage\"\n\t\t\tfield: [\n\t\t\t\t{name:\"rawJson\" number:1 label:LABEL_OPTIONAL type:TYPE_BYTES},\n\t\t\t\t{name:\"dummy\"   number:2 label:LABEL_OPTIONAL type:TYPE_MESSAGE type_name:\".github_com.golang.protobuf.jsonpb.dynamicMessage\"}\n\t\t\t]\n\t\t}]\n\t`, fd)\n\tb, _ := proto.Marshal(fd)\n\tvar buf bytes.Buffer\n\tzw := gzip.NewWriter(&buf)\n\tzw.Write(b)\n\tzw.Close()\n\treturn buf.Bytes()\n}()\n\n// Test unmarshaling message containing unset required fields should produce error.\nfunc TestUnmarshalUnsetRequiredFields(t *testing.T) {\n\ttests := []struct {\n\t\tdesc string\n\t\tpb   proto.Message\n\t\tjson string\n\t}{\n\t\t{\n\t\t\tdesc: \"direct required field missing\",\n\t\t\tpb:   &pb2.MsgWithRequired{},\n\t\t\tjson: `{}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"direct required field set to null\",\n\t\t\tpb:   &pb2.MsgWithRequired{},\n\t\t\tjson: `{\"str\": null}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"indirect required field missing\",\n\t\t\tpb:   &pb2.MsgWithIndirectRequired{},\n\t\t\tjson: `{\"subm\": {}}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"indirect required field set to null\",\n\t\t\tpb:   &pb2.MsgWithIndirectRequired{},\n\t\t\tjson: `{\"subm\": {\"str\": null}}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"direct required bytes field missing\",\n\t\t\tpb:   &pb2.MsgWithRequiredBytes{},\n\t\t\tjson: `{}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"direct required bytes field set to null\",\n\t\t\tpb:   &pb2.MsgWithRequiredBytes{},\n\t\t\tjson: `{\"byts\": null}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"direct required wkt field missing\",\n\t\t\tpb:   &pb2.MsgWithRequiredWKT{},\n\t\t\tjson: `{}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"direct required wkt field set to null\",\n\t\t\tpb:   &pb2.MsgWithRequiredWKT{},\n\t\t\tjson: `{\"str\": null}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"any containing message with required field set to null\",\n\t\t\tpb:   &pb2.KnownTypes{},\n\t\t\tjson: `{\"an\": {\"@type\": \"example.com/jsonpb.MsgWithRequired\", \"str\": null}}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"any containing message with missing required field\",\n\t\t\tpb:   &pb2.KnownTypes{},\n\t\t\tjson: `{\"an\": {\"@type\": \"example.com/jsonpb.MsgWithRequired\"}}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"missing required in map value\",\n\t\t\tpb:   &pb2.MsgWithIndirectRequired{},\n\t\t\tjson: `{\"map_field\": {\"a\": {}, \"b\": {\"str\": \"hi\"}}}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"required in map value set to null\",\n\t\t\tpb:   &pb2.MsgWithIndirectRequired{},\n\t\t\tjson: `{\"map_field\": {\"a\": {\"str\": \"hello\"}, \"b\": {\"str\": null}}}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"missing required in slice item\",\n\t\t\tpb:   &pb2.MsgWithIndirectRequired{},\n\t\t\tjson: `{\"slice_field\": [{}, {\"str\": \"hi\"}]}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"required in slice item set to null\",\n\t\t\tpb:   &pb2.MsgWithIndirectRequired{},\n\t\t\tjson: `{\"slice_field\": [{\"str\": \"hello\"}, {\"str\": null}]}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"required inside oneof missing\",\n\t\t\tpb:   &pb2.MsgWithOneof{},\n\t\t\tjson: `{\"msgWithRequired\": {}}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"required inside oneof set to null\",\n\t\t\tpb:   &pb2.MsgWithOneof{},\n\t\t\tjson: `{\"msgWithRequired\": {\"str\": null}}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"required field in extension missing\",\n\t\t\tpb:   &pb2.Real{},\n\t\t\tjson: `{\"[jsonpb.extm]\":{}}`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"required field in extension set to null\",\n\t\t\tpb:   &pb2.Real{},\n\t\t\tjson: `{\"[jsonpb.extm]\":{\"str\": null}}`,\n\t\t},\n\t}\n\n\tfor _, tc := range tests {\n\t\tif err := UnmarshalString(tc.json, tc.pb); err == nil {\n\t\t\tt.Errorf(\"%s: expected error while unmarshaling with unset required fields %s\", tc.desc, tc.json)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "proto/buffer.go",
    "content": "// Copyright 2019 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\n\t\"google.golang.org/protobuf/encoding/prototext\"\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/runtime/protoimpl\"\n)\n\nconst (\n\tWireVarint     = 0\n\tWireFixed32    = 5\n\tWireFixed64    = 1\n\tWireBytes      = 2\n\tWireStartGroup = 3\n\tWireEndGroup   = 4\n)\n\n// EncodeVarint returns the varint encoded bytes of v.\nfunc EncodeVarint(v uint64) []byte {\n\treturn protowire.AppendVarint(nil, v)\n}\n\n// SizeVarint returns the length of the varint encoded bytes of v.\n// This is equal to len(EncodeVarint(v)).\nfunc SizeVarint(v uint64) int {\n\treturn protowire.SizeVarint(v)\n}\n\n// DecodeVarint parses a varint encoded integer from b,\n// returning the integer value and the length of the varint.\n// It returns (0, 0) if there is a parse error.\nfunc DecodeVarint(b []byte) (uint64, int) {\n\tv, n := protowire.ConsumeVarint(b)\n\tif n < 0 {\n\t\treturn 0, 0\n\t}\n\treturn v, n\n}\n\n// Buffer is a buffer for encoding and decoding the protobuf wire format.\n// It may be reused between invocations to reduce memory usage.\ntype Buffer struct {\n\tbuf           []byte\n\tidx           int\n\tdeterministic bool\n}\n\n// NewBuffer allocates a new Buffer initialized with buf,\n// where the contents of buf are considered the unread portion of the buffer.\nfunc NewBuffer(buf []byte) *Buffer {\n\treturn &Buffer{buf: buf}\n}\n\n// SetDeterministic specifies whether to use deterministic serialization.\n//\n// Deterministic serialization guarantees that for a given binary, equal\n// messages will always be serialized to the same bytes. This implies:\n//\n//   - Repeated serialization of a message will return the same bytes.\n//   - Different processes of the same binary (which may be executing on\n//     different machines) will serialize equal messages to the same bytes.\n//\n// Note that the deterministic serialization is NOT canonical across\n// languages. It is not guaranteed to remain stable over time. It is unstable\n// across different builds with schema changes due to unknown fields.\n// Users who need canonical serialization (e.g., persistent storage in a\n// canonical form, fingerprinting, etc.) should define their own\n// canonicalization specification and implement their own serializer rather\n// than relying on this API.\n//\n// If deterministic serialization is requested, map entries will be sorted\n// by keys in lexographical order. This is an implementation detail and\n// subject to change.\nfunc (b *Buffer) SetDeterministic(deterministic bool) {\n\tb.deterministic = deterministic\n}\n\n// SetBuf sets buf as the internal buffer,\n// where the contents of buf are considered the unread portion of the buffer.\nfunc (b *Buffer) SetBuf(buf []byte) {\n\tb.buf = buf\n\tb.idx = 0\n}\n\n// Reset clears the internal buffer of all written and unread data.\nfunc (b *Buffer) Reset() {\n\tb.buf = b.buf[:0]\n\tb.idx = 0\n}\n\n// Bytes returns the internal buffer.\nfunc (b *Buffer) Bytes() []byte {\n\treturn b.buf\n}\n\n// Unread returns the unread portion of the buffer.\nfunc (b *Buffer) Unread() []byte {\n\treturn b.buf[b.idx:]\n}\n\n// Marshal appends the wire-format encoding of m to the buffer.\nfunc (b *Buffer) Marshal(m Message) error {\n\tvar err error\n\tb.buf, err = marshalAppend(b.buf, m, b.deterministic)\n\treturn err\n}\n\n// Unmarshal parses the wire-format message in the buffer and\n// places the decoded results in m.\n// It does not reset m before unmarshaling.\nfunc (b *Buffer) Unmarshal(m Message) error {\n\terr := UnmarshalMerge(b.Unread(), m)\n\tb.idx = len(b.buf)\n\treturn err\n}\n\ntype unknownFields struct{ XXX_unrecognized protoimpl.UnknownFields }\n\nfunc (m *unknownFields) String() string { panic(\"not implemented\") }\nfunc (m *unknownFields) Reset()         { panic(\"not implemented\") }\nfunc (m *unknownFields) ProtoMessage()  { panic(\"not implemented\") }\n\n// DebugPrint dumps the encoded bytes of b with a header and footer including s\n// to stdout. This is only intended for debugging.\nfunc (*Buffer) DebugPrint(s string, b []byte) {\n\tm := MessageReflect(new(unknownFields))\n\tm.SetUnknown(b)\n\tb, _ = prototext.MarshalOptions{AllowPartial: true, Indent: \"\\t\"}.Marshal(m.Interface())\n\tfmt.Printf(\"==== %s ====\\n%s==== %s ====\\n\", s, b, s)\n}\n\n// EncodeVarint appends an unsigned varint encoding to the buffer.\nfunc (b *Buffer) EncodeVarint(v uint64) error {\n\tb.buf = protowire.AppendVarint(b.buf, v)\n\treturn nil\n}\n\n// EncodeZigzag32 appends a 32-bit zig-zag varint encoding to the buffer.\nfunc (b *Buffer) EncodeZigzag32(v uint64) error {\n\treturn b.EncodeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31))))\n}\n\n// EncodeZigzag64 appends a 64-bit zig-zag varint encoding to the buffer.\nfunc (b *Buffer) EncodeZigzag64(v uint64) error {\n\treturn b.EncodeVarint(uint64((uint64(v) << 1) ^ uint64((int64(v) >> 63))))\n}\n\n// EncodeFixed32 appends a 32-bit little-endian integer to the buffer.\nfunc (b *Buffer) EncodeFixed32(v uint64) error {\n\tb.buf = protowire.AppendFixed32(b.buf, uint32(v))\n\treturn nil\n}\n\n// EncodeFixed64 appends a 64-bit little-endian integer to the buffer.\nfunc (b *Buffer) EncodeFixed64(v uint64) error {\n\tb.buf = protowire.AppendFixed64(b.buf, uint64(v))\n\treturn nil\n}\n\n// EncodeRawBytes appends a length-prefixed raw bytes to the buffer.\nfunc (b *Buffer) EncodeRawBytes(v []byte) error {\n\tb.buf = protowire.AppendBytes(b.buf, v)\n\treturn nil\n}\n\n// EncodeStringBytes appends a length-prefixed raw bytes to the buffer.\n// It does not validate whether v contains valid UTF-8.\nfunc (b *Buffer) EncodeStringBytes(v string) error {\n\tb.buf = protowire.AppendString(b.buf, v)\n\treturn nil\n}\n\n// EncodeMessage appends a length-prefixed encoded message to the buffer.\nfunc (b *Buffer) EncodeMessage(m Message) error {\n\tvar err error\n\tb.buf = protowire.AppendVarint(b.buf, uint64(Size(m)))\n\tb.buf, err = marshalAppend(b.buf, m, b.deterministic)\n\treturn err\n}\n\n// DecodeVarint consumes an encoded unsigned varint from the buffer.\nfunc (b *Buffer) DecodeVarint() (uint64, error) {\n\tv, n := protowire.ConsumeVarint(b.buf[b.idx:])\n\tif n < 0 {\n\t\treturn 0, protowire.ParseError(n)\n\t}\n\tb.idx += n\n\treturn uint64(v), nil\n}\n\n// DecodeZigzag32 consumes an encoded 32-bit zig-zag varint from the buffer.\nfunc (b *Buffer) DecodeZigzag32() (uint64, error) {\n\tv, err := b.DecodeVarint()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn uint64((uint32(v) >> 1) ^ uint32((int32(v&1)<<31)>>31)), nil\n}\n\n// DecodeZigzag64 consumes an encoded 64-bit zig-zag varint from the buffer.\nfunc (b *Buffer) DecodeZigzag64() (uint64, error) {\n\tv, err := b.DecodeVarint()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn uint64((uint64(v) >> 1) ^ uint64((int64(v&1)<<63)>>63)), nil\n}\n\n// DecodeFixed32 consumes a 32-bit little-endian integer from the buffer.\nfunc (b *Buffer) DecodeFixed32() (uint64, error) {\n\tv, n := protowire.ConsumeFixed32(b.buf[b.idx:])\n\tif n < 0 {\n\t\treturn 0, protowire.ParseError(n)\n\t}\n\tb.idx += n\n\treturn uint64(v), nil\n}\n\n// DecodeFixed64 consumes a 64-bit little-endian integer from the buffer.\nfunc (b *Buffer) DecodeFixed64() (uint64, error) {\n\tv, n := protowire.ConsumeFixed64(b.buf[b.idx:])\n\tif n < 0 {\n\t\treturn 0, protowire.ParseError(n)\n\t}\n\tb.idx += n\n\treturn uint64(v), nil\n}\n\n// DecodeRawBytes consumes a length-prefixed raw bytes from the buffer.\n// If alloc is specified, it returns a copy the raw bytes\n// rather than a sub-slice of the buffer.\nfunc (b *Buffer) DecodeRawBytes(alloc bool) ([]byte, error) {\n\tv, n := protowire.ConsumeBytes(b.buf[b.idx:])\n\tif n < 0 {\n\t\treturn nil, protowire.ParseError(n)\n\t}\n\tb.idx += n\n\tif alloc {\n\t\tv = append([]byte(nil), v...)\n\t}\n\treturn v, nil\n}\n\n// DecodeStringBytes consumes a length-prefixed raw bytes from the buffer.\n// It does not validate whether the raw bytes contain valid UTF-8.\nfunc (b *Buffer) DecodeStringBytes() (string, error) {\n\tv, n := protowire.ConsumeString(b.buf[b.idx:])\n\tif n < 0 {\n\t\treturn \"\", protowire.ParseError(n)\n\t}\n\tb.idx += n\n\treturn v, nil\n}\n\n// DecodeMessage consumes a length-prefixed message from the buffer.\n// It does not reset m before unmarshaling.\nfunc (b *Buffer) DecodeMessage(m Message) error {\n\tv, err := b.DecodeRawBytes(false)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn UnmarshalMerge(v, m)\n}\n\n// DecodeGroup consumes a message group from the buffer.\n// It assumes that the start group marker has already been consumed and\n// consumes all bytes until (and including the end group marker).\n// It does not reset m before unmarshaling.\nfunc (b *Buffer) DecodeGroup(m Message) error {\n\tv, n, err := consumeGroup(b.buf[b.idx:])\n\tif err != nil {\n\t\treturn err\n\t}\n\tb.idx += n\n\treturn UnmarshalMerge(v, m)\n}\n\n// consumeGroup parses b until it finds an end group marker, returning\n// the raw bytes of the message (excluding the end group marker) and the\n// the total length of the message (including the end group marker).\nfunc consumeGroup(b []byte) ([]byte, int, error) {\n\tb0 := b\n\tdepth := 1 // assume this follows a start group marker\n\tfor {\n\t\t_, wtyp, tagLen := protowire.ConsumeTag(b)\n\t\tif tagLen < 0 {\n\t\t\treturn nil, 0, protowire.ParseError(tagLen)\n\t\t}\n\t\tb = b[tagLen:]\n\n\t\tvar valLen int\n\t\tswitch wtyp {\n\t\tcase protowire.VarintType:\n\t\t\t_, valLen = protowire.ConsumeVarint(b)\n\t\tcase protowire.Fixed32Type:\n\t\t\t_, valLen = protowire.ConsumeFixed32(b)\n\t\tcase protowire.Fixed64Type:\n\t\t\t_, valLen = protowire.ConsumeFixed64(b)\n\t\tcase protowire.BytesType:\n\t\t\t_, valLen = protowire.ConsumeBytes(b)\n\t\tcase protowire.StartGroupType:\n\t\t\tdepth++\n\t\tcase protowire.EndGroupType:\n\t\t\tdepth--\n\t\tdefault:\n\t\t\treturn nil, 0, errors.New(\"proto: cannot parse reserved wire type\")\n\t\t}\n\t\tif valLen < 0 {\n\t\t\treturn nil, 0, protowire.ParseError(valLen)\n\t\t}\n\t\tb = b[valLen:]\n\n\t\tif depth == 0 {\n\t\t\treturn b0[:len(b0)-len(b)-tagLen], len(b0) - len(b), nil\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "proto/defaults.go",
    "content": "// Copyright 2019 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto\n\nimport (\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// SetDefaults sets unpopulated scalar fields to their default values.\n// Fields within a oneof are not set even if they have a default value.\n// SetDefaults is recursively called upon any populated message fields.\nfunc SetDefaults(m Message) {\n\tif m != nil {\n\t\tsetDefaults(MessageReflect(m))\n\t}\n}\n\nfunc setDefaults(m protoreflect.Message) {\n\tfds := m.Descriptor().Fields()\n\tfor i := 0; i < fds.Len(); i++ {\n\t\tfd := fds.Get(i)\n\t\tif !m.Has(fd) {\n\t\t\tif fd.HasDefault() && fd.ContainingOneof() == nil {\n\t\t\t\tv := fd.Default()\n\t\t\t\tif fd.Kind() == protoreflect.BytesKind {\n\t\t\t\t\tv = protoreflect.ValueOf(append([]byte(nil), v.Bytes()...)) // copy the default bytes\n\t\t\t\t}\n\t\t\t\tm.Set(fd, v)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t}\n\n\tm.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tswitch {\n\t\t// Handle singular message.\n\t\tcase fd.Cardinality() != protoreflect.Repeated:\n\t\t\tif fd.Message() != nil {\n\t\t\t\tsetDefaults(m.Get(fd).Message())\n\t\t\t}\n\t\t// Handle list of messages.\n\t\tcase fd.IsList():\n\t\t\tif fd.Message() != nil {\n\t\t\t\tls := m.Get(fd).List()\n\t\t\t\tfor i := 0; i < ls.Len(); i++ {\n\t\t\t\t\tsetDefaults(ls.Get(i).Message())\n\t\t\t\t}\n\t\t\t}\n\t\t// Handle map of messages.\n\t\tcase fd.IsMap():\n\t\t\tif fd.MapValue().Message() != nil {\n\t\t\t\tms := m.Get(fd).Map()\n\t\t\t\tms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool {\n\t\t\t\t\tsetDefaults(v.Message())\n\t\t\t\t\treturn true\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\treturn true\n\t})\n}\n"
  },
  {
    "path": "proto/deprecated.go",
    "content": "// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"strconv\"\n\n\tprotoV2 \"google.golang.org/protobuf/proto\"\n)\n\nvar (\n\t// Deprecated: No longer returned.\n\tErrNil = errors.New(\"proto: Marshal called with nil\")\n\n\t// Deprecated: No longer returned.\n\tErrTooLarge = errors.New(\"proto: message encodes to over 2 GB\")\n\n\t// Deprecated: No longer returned.\n\tErrInternalBadWireType = errors.New(\"proto: internal error: bad wiretype for oneof\")\n)\n\n// Deprecated: Do not use.\ntype Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 }\n\n// Deprecated: Do not use.\nfunc GetStats() Stats { return Stats{} }\n\n// Deprecated: Do not use.\nfunc MarshalMessageSet(interface{}) ([]byte, error) {\n\treturn nil, errors.New(\"proto: not implemented\")\n}\n\n// Deprecated: Do not use.\nfunc UnmarshalMessageSet([]byte, interface{}) error {\n\treturn errors.New(\"proto: not implemented\")\n}\n\n// Deprecated: Do not use.\nfunc MarshalMessageSetJSON(interface{}) ([]byte, error) {\n\treturn nil, errors.New(\"proto: not implemented\")\n}\n\n// Deprecated: Do not use.\nfunc UnmarshalMessageSetJSON([]byte, interface{}) error {\n\treturn errors.New(\"proto: not implemented\")\n}\n\n// Deprecated: Do not use.\nfunc RegisterMessageSetType(Message, int32, string) {}\n\n// Deprecated: Do not use.\nfunc EnumName(m map[int32]string, v int32) string {\n\ts, ok := m[v]\n\tif ok {\n\t\treturn s\n\t}\n\treturn strconv.Itoa(int(v))\n}\n\n// Deprecated: Do not use.\nfunc UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) {\n\tif data[0] == '\"' {\n\t\t// New style: enums are strings.\n\t\tvar repr string\n\t\tif err := json.Unmarshal(data, &repr); err != nil {\n\t\t\treturn -1, err\n\t\t}\n\t\tval, ok := m[repr]\n\t\tif !ok {\n\t\t\treturn 0, fmt.Errorf(\"unrecognized enum %s value %q\", enumName, repr)\n\t\t}\n\t\treturn val, nil\n\t}\n\t// Old style: enums are ints.\n\tvar val int32\n\tif err := json.Unmarshal(data, &val); err != nil {\n\t\treturn 0, fmt.Errorf(\"cannot unmarshal %#q into enum %s\", data, enumName)\n\t}\n\treturn val, nil\n}\n\n// Deprecated: Do not use; this type existed for intenal-use only.\ntype InternalMessageInfo struct{}\n\n// Deprecated: Do not use; this method existed for intenal-use only.\nfunc (*InternalMessageInfo) DiscardUnknown(m Message) {\n\tDiscardUnknown(m)\n}\n\n// Deprecated: Do not use; this method existed for intenal-use only.\nfunc (*InternalMessageInfo) Marshal(b []byte, m Message, deterministic bool) ([]byte, error) {\n\treturn protoV2.MarshalOptions{Deterministic: deterministic}.MarshalAppend(b, MessageV2(m))\n}\n\n// Deprecated: Do not use; this method existed for intenal-use only.\nfunc (*InternalMessageInfo) Merge(dst, src Message) {\n\tprotoV2.Merge(MessageV2(dst), MessageV2(src))\n}\n\n// Deprecated: Do not use; this method existed for intenal-use only.\nfunc (*InternalMessageInfo) Size(m Message) int {\n\treturn protoV2.Size(MessageV2(m))\n}\n\n// Deprecated: Do not use; this method existed for intenal-use only.\nfunc (*InternalMessageInfo) Unmarshal(m Message, b []byte) error {\n\treturn protoV2.UnmarshalOptions{Merge: true}.Unmarshal(b, MessageV2(m))\n}\n"
  },
  {
    "path": "proto/discard.go",
    "content": "// Copyright 2019 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto\n\nimport (\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// DiscardUnknown recursively discards all unknown fields from this message\n// and all embedded messages.\n//\n// When unmarshaling a message with unrecognized fields, the tags and values\n// of such fields are preserved in the Message. This allows a later call to\n// marshal to be able to produce a message that continues to have those\n// unrecognized fields. To avoid this, DiscardUnknown is used to\n// explicitly clear the unknown fields after unmarshaling.\nfunc DiscardUnknown(m Message) {\n\tif m != nil {\n\t\tdiscardUnknown(MessageReflect(m))\n\t}\n}\n\nfunc discardUnknown(m protoreflect.Message) {\n\tm.Range(func(fd protoreflect.FieldDescriptor, val protoreflect.Value) bool {\n\t\tswitch {\n\t\t// Handle singular message.\n\t\tcase fd.Cardinality() != protoreflect.Repeated:\n\t\t\tif fd.Message() != nil {\n\t\t\t\tdiscardUnknown(m.Get(fd).Message())\n\t\t\t}\n\t\t// Handle list of messages.\n\t\tcase fd.IsList():\n\t\t\tif fd.Message() != nil {\n\t\t\t\tls := m.Get(fd).List()\n\t\t\t\tfor i := 0; i < ls.Len(); i++ {\n\t\t\t\t\tdiscardUnknown(ls.Get(i).Message())\n\t\t\t\t}\n\t\t\t}\n\t\t// Handle map of messages.\n\t\tcase fd.IsMap():\n\t\t\tif fd.MapValue().Message() != nil {\n\t\t\t\tms := m.Get(fd).Map()\n\t\t\t\tms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool {\n\t\t\t\t\tdiscardUnknown(v.Message())\n\t\t\t\t\treturn true\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\treturn true\n\t})\n\n\t// Discard unknown fields.\n\tif len(m.GetUnknown()) > 0 {\n\t\tm.SetUnknown(nil)\n\t}\n}\n"
  },
  {
    "path": "proto/discard_test.go",
    "content": "// Copyright 2017 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto_test\n\nimport (\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\t\"google.golang.org/protobuf/testing/protopack\"\n\n\tpb2 \"github.com/golang/protobuf/internal/testprotos/proto2_proto\"\n\tpb3 \"github.com/golang/protobuf/internal/testprotos/proto3_proto\"\n)\n\nvar rawFields = protopack.Message{\n\tprotopack.Tag{5, protopack.Fixed32Type}, protopack.Uint32(4041331395),\n}.Marshal()\n\nfunc TestDiscardUnknown(t *testing.T) {\n\ttests := []struct {\n\t\tdesc     string\n\t\tin, want proto.Message\n\t}{{\n\t\tdesc: \"Nil\",\n\t\tin:   nil, want: nil, // Should not panic\n\t}, {\n\t\tdesc: \"NilPtr\",\n\t\tin:   (*pb3.Message)(nil), want: (*pb3.Message)(nil), // Should not panic\n\t}, {\n\t\tdesc: \"Nested\",\n\t\tin: &pb3.Message{\n\t\t\tName:             \"Aaron\",\n\t\t\tNested:           &pb3.Nested{Cute: true, XXX_unrecognized: []byte(rawFields)},\n\t\t\tXXX_unrecognized: []byte(rawFields),\n\t\t},\n\t\twant: &pb3.Message{\n\t\t\tName:   \"Aaron\",\n\t\t\tNested: &pb3.Nested{Cute: true},\n\t\t},\n\t}, {\n\t\tdesc: \"Slice\",\n\t\tin: &pb3.Message{\n\t\t\tName: \"Aaron\",\n\t\t\tChildren: []*pb3.Message{\n\t\t\t\t{Name: \"Sarah\", XXX_unrecognized: []byte(rawFields)},\n\t\t\t\t{Name: \"Abraham\", XXX_unrecognized: []byte(rawFields)},\n\t\t\t},\n\t\t\tXXX_unrecognized: []byte(rawFields),\n\t\t},\n\t\twant: &pb3.Message{\n\t\t\tName: \"Aaron\",\n\t\t\tChildren: []*pb3.Message{\n\t\t\t\t{Name: \"Sarah\"},\n\t\t\t\t{Name: \"Abraham\"},\n\t\t\t},\n\t\t},\n\t}, {\n\t\tdesc: \"OneOf\",\n\t\tin: &pb2.Communique{\n\t\t\tUnion: &pb2.Communique_Msg{&pb2.Strings{\n\t\t\t\tStringField:      proto.String(\"123\"),\n\t\t\t\tXXX_unrecognized: []byte(rawFields),\n\t\t\t}},\n\t\t\tXXX_unrecognized: []byte(rawFields),\n\t\t},\n\t\twant: &pb2.Communique{\n\t\t\tUnion: &pb2.Communique_Msg{&pb2.Strings{StringField: proto.String(\"123\")}},\n\t\t},\n\t}, {\n\t\tdesc: \"Map\",\n\t\tin: &pb2.MessageWithMap{MsgMapping: map[int64]*pb2.FloatingPoint{\n\t\t\t0x4002: &pb2.FloatingPoint{\n\t\t\t\tExact:            proto.Bool(true),\n\t\t\t\tXXX_unrecognized: []byte(rawFields),\n\t\t\t},\n\t\t}},\n\t\twant: &pb2.MessageWithMap{MsgMapping: map[int64]*pb2.FloatingPoint{\n\t\t\t0x4002: &pb2.FloatingPoint{Exact: proto.Bool(true)},\n\t\t}},\n\t}, {\n\t\tdesc: \"Extension\",\n\t\tin: func() proto.Message {\n\t\t\tm := &pb2.MyMessage{\n\t\t\t\tCount: proto.Int32(42),\n\t\t\t\tSomegroup: &pb2.MyMessage_SomeGroup{\n\t\t\t\t\tGroupField:       proto.Int32(6),\n\t\t\t\t\tXXX_unrecognized: []byte(rawFields),\n\t\t\t\t},\n\t\t\t\tXXX_unrecognized: []byte(rawFields),\n\t\t\t}\n\t\t\tproto.SetExtension(m, pb2.E_Ext_More, &pb2.Ext{\n\t\t\t\tData:             proto.String(\"extension\"),\n\t\t\t\tXXX_unrecognized: []byte(rawFields),\n\t\t\t})\n\t\t\treturn m\n\t\t}(),\n\t\twant: func() proto.Message {\n\t\t\tm := &pb2.MyMessage{\n\t\t\t\tCount:     proto.Int32(42),\n\t\t\t\tSomegroup: &pb2.MyMessage_SomeGroup{GroupField: proto.Int32(6)},\n\t\t\t}\n\t\t\tproto.SetExtension(m, pb2.E_Ext_More, &pb2.Ext{Data: proto.String(\"extension\")})\n\t\t\treturn m\n\t\t}(),\n\t}}\n\n\tfor _, tt := range tests {\n\t\tproto.DiscardUnknown(tt.in)\n\t\tif !proto.Equal(tt.in, tt.want) {\n\t\t\tt.Errorf(\"test %s, expected unknown fields to be discarded\\ngot  %v\\nwant %v\", tt.desc, tt.in, tt.want)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "proto/extensions.go",
    "content": "// Copyright 2010 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n\t\"google.golang.org/protobuf/runtime/protoimpl\"\n)\n\ntype (\n\t// ExtensionDesc represents an extension descriptor and\n\t// is used to interact with an extension field in a message.\n\t//\n\t// Variables of this type are generated in code by protoc-gen-go.\n\tExtensionDesc = protoimpl.ExtensionInfo\n\n\t// ExtensionRange represents a range of message extensions.\n\t// Used in code generated by protoc-gen-go.\n\tExtensionRange = protoiface.ExtensionRangeV1\n\n\t// Deprecated: Do not use; this is an internal type.\n\tExtension = protoimpl.ExtensionFieldV1\n\n\t// Deprecated: Do not use; this is an internal type.\n\tXXX_InternalExtensions = protoimpl.ExtensionFields\n)\n\n// ErrMissingExtension reports whether the extension was not present.\nvar ErrMissingExtension = errors.New(\"proto: missing extension\")\n\nvar errNotExtendable = errors.New(\"proto: not an extendable proto.Message\")\n\n// HasExtension reports whether the extension field is present in m\n// either as an explicitly populated field or as an unknown field.\nfunc HasExtension(m Message, xt *ExtensionDesc) (has bool) {\n\tmr := MessageReflect(m)\n\tif mr == nil || !mr.IsValid() {\n\t\treturn false\n\t}\n\n\t// Check whether any populated known field matches the field number.\n\txtd := xt.TypeDescriptor()\n\tif isValidExtension(mr.Descriptor(), xtd) {\n\t\thas = mr.Has(xtd)\n\t} else {\n\t\tmr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {\n\t\t\thas = int32(fd.Number()) == xt.Field\n\t\t\treturn !has\n\t\t})\n\t}\n\n\t// Check whether any unknown field matches the field number.\n\tfor b := mr.GetUnknown(); !has && len(b) > 0; {\n\t\tnum, _, n := protowire.ConsumeField(b)\n\t\thas = int32(num) == xt.Field\n\t\tb = b[n:]\n\t}\n\treturn has\n}\n\n// ClearExtension removes the extension field from m\n// either as an explicitly populated field or as an unknown field.\nfunc ClearExtension(m Message, xt *ExtensionDesc) {\n\tmr := MessageReflect(m)\n\tif mr == nil || !mr.IsValid() {\n\t\treturn\n\t}\n\n\txtd := xt.TypeDescriptor()\n\tif isValidExtension(mr.Descriptor(), xtd) {\n\t\tmr.Clear(xtd)\n\t} else {\n\t\tmr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {\n\t\t\tif int32(fd.Number()) == xt.Field {\n\t\t\t\tmr.Clear(fd)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t})\n\t}\n\tclearUnknown(mr, fieldNum(xt.Field))\n}\n\n// ClearAllExtensions clears all extensions from m.\n// This includes populated fields and unknown fields in the extension range.\nfunc ClearAllExtensions(m Message) {\n\tmr := MessageReflect(m)\n\tif mr == nil || !mr.IsValid() {\n\t\treturn\n\t}\n\n\tmr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {\n\t\tif fd.IsExtension() {\n\t\t\tmr.Clear(fd)\n\t\t}\n\t\treturn true\n\t})\n\tclearUnknown(mr, mr.Descriptor().ExtensionRanges())\n}\n\n// GetExtension retrieves a proto2 extended field from m.\n//\n// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil),\n// then GetExtension parses the encoded field and returns a Go value of the specified type.\n// If the field is not present, then the default value is returned (if one is specified),\n// otherwise ErrMissingExtension is reported.\n//\n// If the descriptor is type incomplete (i.e., ExtensionDesc.ExtensionType is nil),\n// then GetExtension returns the raw encoded bytes for the extension field.\nfunc GetExtension(m Message, xt *ExtensionDesc) (interface{}, error) {\n\tmr := MessageReflect(m)\n\tif mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 {\n\t\treturn nil, errNotExtendable\n\t}\n\n\t// Retrieve the unknown fields for this extension field.\n\tvar bo protoreflect.RawFields\n\tfor bi := mr.GetUnknown(); len(bi) > 0; {\n\t\tnum, _, n := protowire.ConsumeField(bi)\n\t\tif int32(num) == xt.Field {\n\t\t\tbo = append(bo, bi[:n]...)\n\t\t}\n\t\tbi = bi[n:]\n\t}\n\n\t// For type incomplete descriptors, only retrieve the unknown fields.\n\tif xt.ExtensionType == nil {\n\t\treturn []byte(bo), nil\n\t}\n\n\t// If the extension field only exists as unknown fields, unmarshal it.\n\t// This is rarely done since proto.Unmarshal eagerly unmarshals extensions.\n\txtd := xt.TypeDescriptor()\n\tif !isValidExtension(mr.Descriptor(), xtd) {\n\t\treturn nil, fmt.Errorf(\"proto: bad extended type; %T does not extend %T\", xt.ExtendedType, m)\n\t}\n\tif !mr.Has(xtd) && len(bo) > 0 {\n\t\tm2 := mr.New()\n\t\tif err := (proto.UnmarshalOptions{\n\t\t\tResolver: extensionResolver{xt},\n\t\t}.Unmarshal(bo, m2.Interface())); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif m2.Has(xtd) {\n\t\t\tmr.Set(xtd, m2.Get(xtd))\n\t\t\tclearUnknown(mr, fieldNum(xt.Field))\n\t\t}\n\t}\n\n\t// Check whether the message has the extension field set or a default.\n\tvar pv protoreflect.Value\n\tswitch {\n\tcase mr.Has(xtd):\n\t\tpv = mr.Get(xtd)\n\tcase xtd.HasDefault():\n\t\tpv = xtd.Default()\n\tdefault:\n\t\treturn nil, ErrMissingExtension\n\t}\n\n\tv := xt.InterfaceOf(pv)\n\trv := reflect.ValueOf(v)\n\tif isScalarKind(rv.Kind()) {\n\t\trv2 := reflect.New(rv.Type())\n\t\trv2.Elem().Set(rv)\n\t\tv = rv2.Interface()\n\t}\n\treturn v, nil\n}\n\n// extensionResolver is a custom extension resolver that stores a single\n// extension type that takes precedence over the global registry.\ntype extensionResolver struct{ xt protoreflect.ExtensionType }\n\nfunc (r extensionResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) {\n\tif xtd := r.xt.TypeDescriptor(); xtd.FullName() == field {\n\t\treturn r.xt, nil\n\t}\n\treturn protoregistry.GlobalTypes.FindExtensionByName(field)\n}\n\nfunc (r extensionResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) {\n\tif xtd := r.xt.TypeDescriptor(); xtd.ContainingMessage().FullName() == message && xtd.Number() == field {\n\t\treturn r.xt, nil\n\t}\n\treturn protoregistry.GlobalTypes.FindExtensionByNumber(message, field)\n}\n\n// GetExtensions returns a list of the extensions values present in m,\n// corresponding with the provided list of extension descriptors, xts.\n// If an extension is missing in m, the corresponding value is nil.\nfunc GetExtensions(m Message, xts []*ExtensionDesc) ([]interface{}, error) {\n\tmr := MessageReflect(m)\n\tif mr == nil || !mr.IsValid() {\n\t\treturn nil, errNotExtendable\n\t}\n\n\tvs := make([]interface{}, len(xts))\n\tfor i, xt := range xts {\n\t\tv, err := GetExtension(m, xt)\n\t\tif err != nil {\n\t\t\tif err == ErrMissingExtension {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn vs, err\n\t\t}\n\t\tvs[i] = v\n\t}\n\treturn vs, nil\n}\n\n// SetExtension sets an extension field in m to the provided value.\nfunc SetExtension(m Message, xt *ExtensionDesc, v interface{}) error {\n\tmr := MessageReflect(m)\n\tif mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 {\n\t\treturn errNotExtendable\n\t}\n\n\trv := reflect.ValueOf(v)\n\tif reflect.TypeOf(v) != reflect.TypeOf(xt.ExtensionType) {\n\t\treturn fmt.Errorf(\"proto: bad extension value type. got: %T, want: %T\", v, xt.ExtensionType)\n\t}\n\tif rv.Kind() == reflect.Ptr {\n\t\tif rv.IsNil() {\n\t\t\treturn fmt.Errorf(\"proto: SetExtension called with nil value of type %T\", v)\n\t\t}\n\t\tif isScalarKind(rv.Elem().Kind()) {\n\t\t\tv = rv.Elem().Interface()\n\t\t}\n\t}\n\n\txtd := xt.TypeDescriptor()\n\tif !isValidExtension(mr.Descriptor(), xtd) {\n\t\treturn fmt.Errorf(\"proto: bad extended type; %T does not extend %T\", xt.ExtendedType, m)\n\t}\n\tmr.Set(xtd, xt.ValueOf(v))\n\tclearUnknown(mr, fieldNum(xt.Field))\n\treturn nil\n}\n\n// SetRawExtension inserts b into the unknown fields of m.\n//\n// Deprecated: Use Message.ProtoReflect.SetUnknown instead.\nfunc SetRawExtension(m Message, fnum int32, b []byte) {\n\tmr := MessageReflect(m)\n\tif mr == nil || !mr.IsValid() {\n\t\treturn\n\t}\n\n\t// Verify that the raw field is valid.\n\tfor b0 := b; len(b0) > 0; {\n\t\tnum, _, n := protowire.ConsumeField(b0)\n\t\tif int32(num) != fnum {\n\t\t\tpanic(fmt.Sprintf(\"mismatching field number: got %d, want %d\", num, fnum))\n\t\t}\n\t\tb0 = b0[n:]\n\t}\n\n\tClearExtension(m, &ExtensionDesc{Field: fnum})\n\tmr.SetUnknown(append(mr.GetUnknown(), b...))\n}\n\n// ExtensionDescs returns a list of extension descriptors found in m,\n// containing descriptors for both populated extension fields in m and\n// also unknown fields of m that are in the extension range.\n// For the later case, an type incomplete descriptor is provided where only\n// the ExtensionDesc.Field field is populated.\n// The order of the extension descriptors is undefined.\nfunc ExtensionDescs(m Message) ([]*ExtensionDesc, error) {\n\tmr := MessageReflect(m)\n\tif mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 {\n\t\treturn nil, errNotExtendable\n\t}\n\n\t// Collect a set of known extension descriptors.\n\textDescs := make(map[protoreflect.FieldNumber]*ExtensionDesc)\n\tmr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tif fd.IsExtension() {\n\t\t\txt := fd.(protoreflect.ExtensionTypeDescriptor)\n\t\t\tif xd, ok := xt.Type().(*ExtensionDesc); ok {\n\t\t\t\textDescs[fd.Number()] = xd\n\t\t\t}\n\t\t}\n\t\treturn true\n\t})\n\n\t// Collect a set of unknown extension descriptors.\n\textRanges := mr.Descriptor().ExtensionRanges()\n\tfor b := mr.GetUnknown(); len(b) > 0; {\n\t\tnum, _, n := protowire.ConsumeField(b)\n\t\tif extRanges.Has(num) && extDescs[num] == nil {\n\t\t\textDescs[num] = nil\n\t\t}\n\t\tb = b[n:]\n\t}\n\n\t// Transpose the set of descriptors into a list.\n\tvar xts []*ExtensionDesc\n\tfor num, xt := range extDescs {\n\t\tif xt == nil {\n\t\t\txt = &ExtensionDesc{Field: int32(num)}\n\t\t}\n\t\txts = append(xts, xt)\n\t}\n\treturn xts, nil\n}\n\n// isValidExtension reports whether xtd is a valid extension descriptor for md.\nfunc isValidExtension(md protoreflect.MessageDescriptor, xtd protoreflect.ExtensionTypeDescriptor) bool {\n\treturn xtd.ContainingMessage() == md && md.ExtensionRanges().Has(xtd.Number())\n}\n\n// isScalarKind reports whether k is a protobuf scalar kind (except bytes).\n// This function exists for historical reasons since the representation of\n// scalars differs between v1 and v2, where v1 uses *T and v2 uses T.\nfunc isScalarKind(k reflect.Kind) bool {\n\tswitch k {\n\tcase reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\n// clearUnknown removes unknown fields from m where remover.Has reports true.\nfunc clearUnknown(m protoreflect.Message, remover interface {\n\tHas(protoreflect.FieldNumber) bool\n}) {\n\tvar bo protoreflect.RawFields\n\tfor bi := m.GetUnknown(); len(bi) > 0; {\n\t\tnum, _, n := protowire.ConsumeField(bi)\n\t\tif !remover.Has(num) {\n\t\t\tbo = append(bo, bi[:n]...)\n\t\t}\n\t\tbi = bi[n:]\n\t}\n\tif bi := m.GetUnknown(); len(bi) != len(bo) {\n\t\tm.SetUnknown(bo)\n\t}\n}\n\ntype fieldNum protoreflect.FieldNumber\n\nfunc (n1 fieldNum) Has(n2 protoreflect.FieldNumber) bool {\n\treturn protoreflect.FieldNumber(n1) == n2\n}\n"
  },
  {
    "path": "proto/extensions_test.go",
    "content": "// Copyright 2014 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto_test\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strings\"\n\t\"sync\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\n\tpb2 \"github.com/golang/protobuf/internal/testprotos/proto2_proto\"\n)\n\nfunc TestGetExtensionsWithMissingExtensions(t *testing.T) {\n\tmsg := &pb2.MyMessage{}\n\text1 := &pb2.Ext{}\n\tif err := proto.SetExtension(msg, pb2.E_Ext_More, ext1); err != nil {\n\t\tt.Fatalf(\"Could not set ext1: %s\", err)\n\t}\n\texts, err := proto.GetExtensions(msg, []*proto.ExtensionDesc{\n\t\tpb2.E_Ext_More,\n\t\tpb2.E_Ext_Text,\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"GetExtensions() failed: %s\", err)\n\t}\n\tif exts[0] != ext1 {\n\t\tt.Errorf(\"ext1 not in returned extensions: %T %v\", exts[0], exts[0])\n\t}\n\tif exts[1] != nil {\n\t\tt.Errorf(\"ext2 in returned extensions: %T %v\", exts[1], exts[1])\n\t}\n}\n\nfunc TestGetExtensionForIncompleteDesc(t *testing.T) {\n\tmsg := &pb2.MyMessage{Count: proto.Int32(0)}\n\textdesc1 := &proto.ExtensionDesc{\n\t\tExtendedType:  (*pb2.MyMessage)(nil),\n\t\tExtensionType: (*bool)(nil),\n\t\tField:         123456789,\n\t\tName:          \"a.b\",\n\t\tTag:           \"varint,123456789,opt\",\n\t}\n\text1 := proto.Bool(true)\n\tif err := proto.SetExtension(msg, extdesc1, ext1); err != nil {\n\t\tt.Fatalf(\"Could not set ext1: %s\", err)\n\t}\n\textdesc2 := &proto.ExtensionDesc{\n\t\tExtendedType:  (*pb2.MyMessage)(nil),\n\t\tExtensionType: ([]byte)(nil),\n\t\tField:         123456790,\n\t\tName:          \"a.c\",\n\t\tTag:           \"bytes,123456790,opt\",\n\t}\n\text2 := []byte{0, 1, 2, 3, 4, 5, 6, 7}\n\tif err := proto.SetExtension(msg, extdesc2, ext2); err != nil {\n\t\tt.Fatalf(\"Could not set ext2: %s\", err)\n\t}\n\textdesc3 := &proto.ExtensionDesc{\n\t\tExtendedType:  (*pb2.MyMessage)(nil),\n\t\tExtensionType: (*pb2.Ext)(nil),\n\t\tField:         123456791,\n\t\tName:          \"a.d\",\n\t\tTag:           \"bytes,123456791,opt\",\n\t}\n\text3 := &pb2.Ext{Data: proto.String(\"foo\")}\n\tif err := proto.SetExtension(msg, extdesc3, ext3); err != nil {\n\t\tt.Fatalf(\"Could not set ext3: %s\", err)\n\t}\n\n\tb, err := proto.Marshal(msg)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not marshal msg: %v\", err)\n\t}\n\tif err := proto.Unmarshal(b, msg); err != nil {\n\t\tt.Fatalf(\"Could not unmarshal into msg: %v\", err)\n\t}\n\n\tvar expected proto.Buffer\n\tif err := expected.EncodeVarint(uint64((extdesc1.Field << 3) | proto.WireVarint)); err != nil {\n\t\tt.Fatalf(\"failed to compute expected prefix for ext1: %s\", err)\n\t}\n\tif err := expected.EncodeVarint(1 /* bool true */); err != nil {\n\t\tt.Fatalf(\"failed to compute expected value for ext1: %s\", err)\n\t}\n\n\tif b, err := proto.GetExtension(msg, &proto.ExtensionDesc{Field: extdesc1.Field}); err != nil {\n\t\tt.Fatalf(\"Failed to get raw value for ext1: %s\", err)\n\t} else if !reflect.DeepEqual(b, expected.Bytes()) {\n\t\tt.Fatalf(\"Raw value for ext1: got %v, want %v\", b, expected.Bytes())\n\t}\n\n\texpected = proto.Buffer{} // reset\n\tif err := expected.EncodeVarint(uint64((extdesc2.Field << 3) | proto.WireBytes)); err != nil {\n\t\tt.Fatalf(\"failed to compute expected prefix for ext2: %s\", err)\n\t}\n\tif err := expected.EncodeRawBytes(ext2); err != nil {\n\t\tt.Fatalf(\"failed to compute expected value for ext2: %s\", err)\n\t}\n\n\tif b, err := proto.GetExtension(msg, &proto.ExtensionDesc{Field: extdesc2.Field}); err != nil {\n\t\tt.Fatalf(\"Failed to get raw value for ext2: %s\", err)\n\t} else if !reflect.DeepEqual(b, expected.Bytes()) {\n\t\tt.Fatalf(\"Raw value for ext2: got %v, want %v\", b, expected.Bytes())\n\t}\n\n\texpected = proto.Buffer{} // reset\n\tif err := expected.EncodeVarint(uint64((extdesc3.Field << 3) | proto.WireBytes)); err != nil {\n\t\tt.Fatalf(\"failed to compute expected prefix for ext3: %s\", err)\n\t}\n\tif b, err := proto.Marshal(ext3); err != nil {\n\t\tt.Fatalf(\"failed to compute expected value for ext3: %s\", err)\n\t} else if err := expected.EncodeRawBytes(b); err != nil {\n\t\tt.Fatalf(\"failed to compute expected value for ext3: %s\", err)\n\t}\n\n\tif b, err := proto.GetExtension(msg, &proto.ExtensionDesc{Field: extdesc3.Field}); err != nil {\n\t\tt.Fatalf(\"Failed to get raw value for ext3: %s\", err)\n\t} else if !reflect.DeepEqual(b, expected.Bytes()) {\n\t\tt.Fatalf(\"Raw value for ext3: got %v, want %v\", b, expected.Bytes())\n\t}\n}\n\nfunc TestExtensionDescsWithUnregisteredExtensions(t *testing.T) {\n\tmsg := &pb2.MyMessage{Count: proto.Int32(0)}\n\textdesc1 := pb2.E_Ext_More\n\tif descs, err := proto.ExtensionDescs(msg); len(descs) != 0 || err != nil {\n\t\tt.Errorf(\"proto.ExtensionDescs: got %d descs, error %v; want 0, nil\", len(descs), err)\n\t}\n\n\text1 := &pb2.Ext{}\n\tif err := proto.SetExtension(msg, extdesc1, ext1); err != nil {\n\t\tt.Fatalf(\"Could not set ext1: %s\", err)\n\t}\n\textdesc2 := &proto.ExtensionDesc{\n\t\tExtendedType:  (*pb2.MyMessage)(nil),\n\t\tExtensionType: (*bool)(nil),\n\t\tField:         123456789,\n\t\tName:          \"a.b\",\n\t\tTag:           \"varint,123456789,opt\",\n\t}\n\text2 := proto.Bool(false)\n\tif err := proto.SetExtension(msg, extdesc2, ext2); err != nil {\n\t\tt.Fatalf(\"Could not set ext2: %s\", err)\n\t}\n\n\tb, err := proto.Marshal(msg)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not marshal msg: %v\", err)\n\t}\n\tif err := proto.Unmarshal(b, msg); err != nil {\n\t\tt.Fatalf(\"Could not unmarshal into msg: %v\", err)\n\t}\n\n\tdescs, err := proto.ExtensionDescs(msg)\n\tif err != nil {\n\t\tt.Fatalf(\"proto.ExtensionDescs: got error %v\", err)\n\t}\n\tsortExtDescs(descs)\n\twantDescs := []*proto.ExtensionDesc{extdesc1, {Field: extdesc2.Field}}\n\tif !reflect.DeepEqual(descs, wantDescs) {\n\t\tt.Errorf(\"proto.ExtensionDescs(msg) sorted extension ids: got %+v, want %+v\", descs, wantDescs)\n\t}\n}\n\ntype ExtensionDescSlice []*proto.ExtensionDesc\n\nfunc (s ExtensionDescSlice) Len() int           { return len(s) }\nfunc (s ExtensionDescSlice) Less(i, j int) bool { return s[i].Field < s[j].Field }\nfunc (s ExtensionDescSlice) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }\n\nfunc sortExtDescs(s []*proto.ExtensionDesc) {\n\tsort.Sort(ExtensionDescSlice(s))\n}\n\nfunc TestGetExtensionStability(t *testing.T) {\n\tcheck := func(m *pb2.MyMessage) bool {\n\t\text1, err := proto.GetExtension(m, pb2.E_Ext_More)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"GetExtension() failed: %s\", err)\n\t\t}\n\t\text2, err := proto.GetExtension(m, pb2.E_Ext_More)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"GetExtension() failed: %s\", err)\n\t\t}\n\t\treturn ext1 == ext2\n\t}\n\tmsg := &pb2.MyMessage{Count: proto.Int32(4)}\n\text0 := &pb2.Ext{}\n\tif err := proto.SetExtension(msg, pb2.E_Ext_More, ext0); err != nil {\n\t\tt.Fatalf(\"Could not set ext1: %s\", ext0)\n\t}\n\tif !check(msg) {\n\t\tt.Errorf(\"GetExtension() not stable before marshaling\")\n\t}\n\tbb, err := proto.Marshal(msg)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal() failed: %s\", err)\n\t}\n\tmsg1 := &pb2.MyMessage{}\n\terr = proto.Unmarshal(bb, msg1)\n\tif err != nil {\n\t\tt.Fatalf(\"Unmarshal() failed: %s\", err)\n\t}\n\tif !check(msg1) {\n\t\tt.Errorf(\"GetExtension() not stable after unmarshaling\")\n\t}\n}\n\nfunc TestGetExtensionDefaults(t *testing.T) {\n\tvar setFloat64 float64 = 1\n\tvar setFloat32 float32 = 2\n\tvar setInt32 int32 = 3\n\tvar setInt64 int64 = 4\n\tvar setUint32 uint32 = 5\n\tvar setUint64 uint64 = 6\n\tvar setBool = true\n\tvar setBool2 = false\n\tvar setString = \"Goodnight string\"\n\tvar setBytes = []byte(\"Goodnight bytes\")\n\tvar setEnum = pb2.DefaultsMessage_TWO\n\n\ttype testcase struct {\n\t\text  *proto.ExtensionDesc // Extension we are testing.\n\t\twant interface{}          // Expected value of extension, or nil (meaning that GetExtension will fail).\n\t\tdef  interface{}          // Expected value of extension after ClearExtension().\n\t}\n\ttests := []testcase{\n\t\t{pb2.E_NoDefaultDouble, setFloat64, nil},\n\t\t{pb2.E_NoDefaultFloat, setFloat32, nil},\n\t\t{pb2.E_NoDefaultInt32, setInt32, nil},\n\t\t{pb2.E_NoDefaultInt64, setInt64, nil},\n\t\t{pb2.E_NoDefaultUint32, setUint32, nil},\n\t\t{pb2.E_NoDefaultUint64, setUint64, nil},\n\t\t{pb2.E_NoDefaultSint32, setInt32, nil},\n\t\t{pb2.E_NoDefaultSint64, setInt64, nil},\n\t\t{pb2.E_NoDefaultFixed32, setUint32, nil},\n\t\t{pb2.E_NoDefaultFixed64, setUint64, nil},\n\t\t{pb2.E_NoDefaultSfixed32, setInt32, nil},\n\t\t{pb2.E_NoDefaultSfixed64, setInt64, nil},\n\t\t{pb2.E_NoDefaultBool, setBool, nil},\n\t\t{pb2.E_NoDefaultBool, setBool2, nil},\n\t\t{pb2.E_NoDefaultString, setString, nil},\n\t\t{pb2.E_NoDefaultBytes, setBytes, nil},\n\t\t{pb2.E_NoDefaultEnum, setEnum, nil},\n\t\t{pb2.E_DefaultDouble, setFloat64, float64(3.1415)},\n\t\t{pb2.E_DefaultFloat, setFloat32, float32(3.14)},\n\t\t{pb2.E_DefaultInt32, setInt32, int32(42)},\n\t\t{pb2.E_DefaultInt64, setInt64, int64(43)},\n\t\t{pb2.E_DefaultUint32, setUint32, uint32(44)},\n\t\t{pb2.E_DefaultUint64, setUint64, uint64(45)},\n\t\t{pb2.E_DefaultSint32, setInt32, int32(46)},\n\t\t{pb2.E_DefaultSint64, setInt64, int64(47)},\n\t\t{pb2.E_DefaultFixed32, setUint32, uint32(48)},\n\t\t{pb2.E_DefaultFixed64, setUint64, uint64(49)},\n\t\t{pb2.E_DefaultSfixed32, setInt32, int32(50)},\n\t\t{pb2.E_DefaultSfixed64, setInt64, int64(51)},\n\t\t{pb2.E_DefaultBool, setBool, true},\n\t\t{pb2.E_DefaultBool, setBool2, true},\n\t\t{pb2.E_DefaultString, setString, \"Hello, string,def=foo\"},\n\t\t{pb2.E_DefaultBytes, setBytes, []byte(\"Hello, bytes\")},\n\t\t{pb2.E_DefaultEnum, setEnum, pb2.DefaultsMessage_ONE},\n\t}\n\n\tcheckVal := func(t *testing.T, name string, test testcase, msg *pb2.DefaultsMessage, valWant interface{}) {\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\tval, err := proto.GetExtension(msg, test.ext)\n\t\t\tif err != nil {\n\t\t\t\tif valWant != nil {\n\t\t\t\t\tt.Errorf(\"GetExtension(): %s\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif want := proto.ErrMissingExtension; err != want {\n\t\t\t\t\tt.Errorf(\"Unexpected error: got %v, want %v\", err, want)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// All proto2 extension values are either a pointer to a value or a slice of values.\n\t\t\tty := reflect.TypeOf(val)\n\t\t\ttyWant := reflect.TypeOf(test.ext.ExtensionType)\n\t\t\tif got, want := ty, tyWant; got != want {\n\t\t\t\tt.Errorf(\"unexpected reflect.TypeOf(): got %v want %v\", got, want)\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttye := ty.Elem()\n\t\t\ttyeWant := tyWant.Elem()\n\t\t\tif got, want := tye, tyeWant; got != want {\n\t\t\t\tt.Errorf(\"unexpected reflect.TypeOf().Elem(): got %v want %v\", got, want)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Check the name of the type of the value.\n\t\t\t// If it is an enum it will be type int32 with the name of the enum.\n\t\t\tif got, want := tye.Name(), tye.Name(); got != want {\n\t\t\t\tt.Errorf(\"unexpected reflect.TypeOf().Elem().Name(): got %v want %v\", got, want)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Check that value is what we expect.\n\t\t\t// If we have a pointer in val, get the value it points to.\n\t\t\tvalExp := val\n\t\t\tif ty.Kind() == reflect.Ptr {\n\t\t\t\tvalExp = reflect.ValueOf(val).Elem().Interface()\n\t\t\t}\n\t\t\tif got, want := valExp, valWant; !reflect.DeepEqual(got, want) {\n\t\t\t\tt.Errorf(\"unexpected reflect.DeepEqual(): got %v want %v\", got, want)\n\t\t\t\treturn\n\t\t\t}\n\t\t})\n\t}\n\n\tsetTo := func(test testcase) interface{} {\n\t\tsetTo := reflect.ValueOf(test.want)\n\t\tif typ := reflect.TypeOf(test.ext.ExtensionType); typ.Kind() == reflect.Ptr {\n\t\t\tsetTo = reflect.New(typ).Elem()\n\t\t\tsetTo.Set(reflect.New(setTo.Type().Elem()))\n\t\t\tsetTo.Elem().Set(reflect.ValueOf(test.want))\n\t\t}\n\t\treturn setTo.Interface()\n\t}\n\n\tfor _, test := range tests {\n\t\tmsg := &pb2.DefaultsMessage{}\n\t\tname := test.ext.Name\n\n\t\t// Check the initial value.\n\t\tcheckVal(t, name+\"/initial\", test, msg, test.def)\n\n\t\t// Set the per-type value and check value.\n\t\tif err := proto.SetExtension(msg, test.ext, setTo(test)); err != nil {\n\t\t\tt.Errorf(\"%s: SetExtension(): %v\", name, err)\n\t\t\tcontinue\n\t\t}\n\t\tcheckVal(t, name+\"/set\", test, msg, test.want)\n\n\t\t// Set and check the value.\n\t\tproto.ClearExtension(msg, test.ext)\n\t\tcheckVal(t, name+\"/cleared\", test, msg, test.def)\n\t}\n}\n\nfunc TestNilMessage(t *testing.T) {\n\tname := \"nil interface\"\n\tif got, err := proto.GetExtension(nil, pb2.E_Ext_More); err == nil {\n\t\tt.Errorf(\"%s: got %T %v, expected to fail\", name, got, got)\n\t} else if !strings.Contains(err.Error(), \"extendable\") {\n\t\tt.Errorf(\"%s: got error %v, expected not-extendable error\", name, err)\n\t}\n\n\t// Regression tests: all functions of the Extension API\n\t// used to panic when passed (*M)(nil), where M is a concrete message\n\t// type.  Now they handle this gracefully as a no-op or reported error.\n\tvar nilMsg *pb2.MyMessage\n\tdesc := pb2.E_Ext_More\n\n\tisNotExtendable := func(err error) bool {\n\t\treturn strings.Contains(fmt.Sprint(err), \"not an extendable\")\n\t}\n\n\tif proto.HasExtension(nilMsg, desc) {\n\t\tt.Error(\"HasExtension(nil) = true\")\n\t}\n\n\tif _, err := proto.GetExtensions(nilMsg, []*proto.ExtensionDesc{desc}); !isNotExtendable(err) {\n\t\tt.Errorf(\"GetExtensions(nil) = %q (wrong error)\", err)\n\t}\n\n\tif _, err := proto.ExtensionDescs(nilMsg); !isNotExtendable(err) {\n\t\tt.Errorf(\"ExtensionDescs(nil) = %q (wrong error)\", err)\n\t}\n\n\tif err := proto.SetExtension(nilMsg, desc, nil); !isNotExtendable(err) {\n\t\tt.Errorf(\"SetExtension(nil) = %q (wrong error)\", err)\n\t}\n\n\tproto.ClearExtension(nilMsg, desc) // no-op\n\tproto.ClearAllExtensions(nilMsg)   // no-op\n}\n\nfunc TestExtensionsRoundTrip(t *testing.T) {\n\tmsg := &pb2.MyMessage{}\n\text1 := &pb2.Ext{\n\t\tData: proto.String(\"hi\"),\n\t}\n\text2 := &pb2.Ext{\n\t\tData: proto.String(\"there\"),\n\t}\n\texists := proto.HasExtension(msg, pb2.E_Ext_More)\n\tif exists {\n\t\tt.Error(\"Extension More present unexpectedly\")\n\t}\n\tif err := proto.SetExtension(msg, pb2.E_Ext_More, ext1); err != nil {\n\t\tt.Error(err)\n\t}\n\tif err := proto.SetExtension(msg, pb2.E_Ext_More, ext2); err != nil {\n\t\tt.Error(err)\n\t}\n\te, err := proto.GetExtension(msg, pb2.E_Ext_More)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tx, ok := e.(*pb2.Ext)\n\tif !ok {\n\t\tt.Errorf(\"e has type %T, expected test_proto.Ext\", e)\n\t} else if *x.Data != \"there\" {\n\t\tt.Errorf(\"SetExtension failed to overwrite, got %+v, not 'there'\", x)\n\t}\n\tproto.ClearExtension(msg, pb2.E_Ext_More)\n\tif _, err = proto.GetExtension(msg, pb2.E_Ext_More); err != proto.ErrMissingExtension {\n\t\tt.Errorf(\"got %v, expected ErrMissingExtension\", e)\n\t}\n\tif err := proto.SetExtension(msg, pb2.E_Ext_More, 12); err == nil {\n\t\tt.Error(\"expected some sort of type mismatch error, got nil\")\n\t}\n}\n\nfunc TestNilExtension(t *testing.T) {\n\tmsg := &pb2.MyMessage{\n\t\tCount: proto.Int32(1),\n\t}\n\tif err := proto.SetExtension(msg, pb2.E_Ext_Text, proto.String(\"hello\")); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := proto.SetExtension(msg, pb2.E_Ext_More, (*pb2.Ext)(nil)); err == nil {\n\t\tt.Error(\"expected SetExtension to fail due to a nil extension\")\n\t} else if want := fmt.Sprintf(\"proto: SetExtension called with nil value of type %T\", new(pb2.Ext)); err.Error() != want {\n\t\tt.Errorf(\"expected error %v, got %v\", want, err)\n\t}\n\t// Note: if the behavior of Marshal is ever changed to ignore nil extensions, update\n\t// this test to verify that E_Ext_Text is properly propagated through marshal->unmarshal.\n}\n\nfunc TestMarshalUnmarshalRepeatedExtension(t *testing.T) {\n\t// Add a repeated extension to the result.\n\ttests := []struct {\n\t\tname string\n\t\text  []*pb2.ComplexExtension\n\t}{\n\t\t{\n\t\t\t\"two fields\",\n\t\t\t[]*pb2.ComplexExtension{\n\t\t\t\t{First: proto.Int32(7)},\n\t\t\t\t{Second: proto.Int32(11)},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"repeated field\",\n\t\t\t[]*pb2.ComplexExtension{\n\t\t\t\t{Third: []int32{1000}},\n\t\t\t\t{Third: []int32{2000}},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"two fields and repeated field\",\n\t\t\t[]*pb2.ComplexExtension{\n\t\t\t\t{Third: []int32{1000}},\n\t\t\t\t{First: proto.Int32(9)},\n\t\t\t\t{Second: proto.Int32(21)},\n\t\t\t\t{Third: []int32{2000}},\n\t\t\t},\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\t// Marshal message with a repeated extension.\n\t\tmsg1 := new(pb2.OtherMessage)\n\t\terr := proto.SetExtension(msg1, pb2.E_RComplex, test.ext)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"[%s] Error setting extension: %v\", test.name, err)\n\t\t}\n\t\tb, err := proto.Marshal(msg1)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"[%s] Error marshaling message: %v\", test.name, err)\n\t\t}\n\n\t\t// Unmarshal and read the merged proto.\n\t\tmsg2 := new(pb2.OtherMessage)\n\t\terr = proto.Unmarshal(b, msg2)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"[%s] Error unmarshaling message: %v\", test.name, err)\n\t\t}\n\t\te, err := proto.GetExtension(msg2, pb2.E_RComplex)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"[%s] Error getting extension: %v\", test.name, err)\n\t\t}\n\t\text := e.([]*pb2.ComplexExtension)\n\t\tif ext == nil {\n\t\t\tt.Fatalf(\"[%s] Invalid extension\", test.name)\n\t\t}\n\t\tif len(ext) != len(test.ext) {\n\t\t\tt.Errorf(\"[%s] Wrong length of ComplexExtension: got: %v want: %v\\n\", test.name, len(ext), len(test.ext))\n\t\t}\n\t\tfor i := range test.ext {\n\t\t\tif !proto.Equal(ext[i], test.ext[i]) {\n\t\t\t\tt.Errorf(\"[%s] Wrong value for ComplexExtension[%d]: got: %v want: %v\\n\", test.name, i, ext[i], test.ext[i])\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc TestUnmarshalRepeatingNonRepeatedExtension(t *testing.T) {\n\t// We may see multiple instances of the same extension in the wire\n\t// format. For example, the proto compiler may encode custom options in\n\t// this way. Here, we verify that we merge the extensions together.\n\ttests := []struct {\n\t\tname string\n\t\text  []*pb2.ComplexExtension\n\t}{\n\t\t{\n\t\t\t\"two fields\",\n\t\t\t[]*pb2.ComplexExtension{\n\t\t\t\t{First: proto.Int32(7)},\n\t\t\t\t{Second: proto.Int32(11)},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"repeated field\",\n\t\t\t[]*pb2.ComplexExtension{\n\t\t\t\t{Third: []int32{1000}},\n\t\t\t\t{Third: []int32{2000}},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"two fields and repeated field\",\n\t\t\t[]*pb2.ComplexExtension{\n\t\t\t\t{Third: []int32{1000}},\n\t\t\t\t{First: proto.Int32(9)},\n\t\t\t\t{Second: proto.Int32(21)},\n\t\t\t\t{Third: []int32{2000}},\n\t\t\t},\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tvar buf bytes.Buffer\n\t\tvar want pb2.ComplexExtension\n\n\t\t// Generate a serialized representation of a repeated extension\n\t\t// by catenating bytes together.\n\t\tfor i, e := range test.ext {\n\t\t\t// Merge to create the wanted proto.\n\t\t\tproto.Merge(&want, e)\n\n\t\t\t// serialize the message\n\t\t\tmsg := new(pb2.OtherMessage)\n\t\t\terr := proto.SetExtension(msg, pb2.E_Complex, e)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"[%s] Error setting extension %d: %v\", test.name, i, err)\n\t\t\t}\n\t\t\tb, err := proto.Marshal(msg)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"[%s] Error marshaling message %d: %v\", test.name, i, err)\n\t\t\t}\n\t\t\tbuf.Write(b)\n\t\t}\n\n\t\t// Unmarshal and read the merged proto.\n\t\tmsg2 := new(pb2.OtherMessage)\n\t\terr := proto.Unmarshal(buf.Bytes(), msg2)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"[%s] Error unmarshaling message: %v\", test.name, err)\n\t\t}\n\t\te, err := proto.GetExtension(msg2, pb2.E_Complex)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"[%s] Error getting extension: %v\", test.name, err)\n\t\t}\n\t\text := e.(*pb2.ComplexExtension)\n\t\tif ext == nil {\n\t\t\tt.Fatalf(\"[%s] Invalid extension\", test.name)\n\t\t}\n\t\tif !proto.Equal(ext, &want) {\n\t\t\tt.Errorf(\"[%s] Wrong value for ComplexExtension: got: %s want: %s\\n\", test.name, ext, &want)\n\t\t}\n\t}\n}\n\nfunc TestClearAllExtensions(t *testing.T) {\n\t// unregistered extension\n\tdesc := &proto.ExtensionDesc{\n\t\tExtendedType:  (*pb2.MyMessage)(nil),\n\t\tExtensionType: (*bool)(nil),\n\t\tField:         101010100,\n\t\tName:          \"emptyextension\",\n\t\tTag:           \"varint,0,opt\",\n\t}\n\tm := &pb2.MyMessage{}\n\tif proto.HasExtension(m, desc) {\n\t\tt.Errorf(\"proto.HasExtension(%s): got true, want false\", proto.MarshalTextString(m))\n\t}\n\tif err := proto.SetExtension(m, desc, proto.Bool(true)); err != nil {\n\t\tt.Errorf(\"proto.SetExtension(m, desc, true): got error %q, want nil\", err)\n\t}\n\tif !proto.HasExtension(m, desc) {\n\t\tt.Errorf(\"proto.HasExtension(%s): got false, want true\", proto.MarshalTextString(m))\n\t}\n\tproto.ClearAllExtensions(m)\n\tif proto.HasExtension(m, desc) {\n\t\tt.Errorf(\"proto.HasExtension(%s): got true, want false\", proto.MarshalTextString(m))\n\t}\n}\n\nfunc TestMarshalRace(t *testing.T) {\n\text := &pb2.Ext{}\n\tm := &pb2.MyMessage{Count: proto.Int32(4)}\n\tif err := proto.SetExtension(m, pb2.E_Ext_More, ext); err != nil {\n\t\tt.Fatalf(\"proto.SetExtension(m, desc, true): got error %q, want nil\", err)\n\t}\n\n\tb, err := proto.Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not marshal message: %v\", err)\n\t}\n\tif err := proto.Unmarshal(b, m); err != nil {\n\t\tt.Fatalf(\"Could not unmarshal message: %v\", err)\n\t}\n\t// after Unmarshal, the extension is in undecoded form.\n\t// GetExtension will decode it lazily. Make sure this does\n\t// not race against Marshal.\n\n\twg := sync.WaitGroup{}\n\terrs := make(chan error, 3)\n\tfor n := 3; n > 0; n-- {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\t_, err := proto.Marshal(m)\n\t\t\terrs <- err\n\t\t}()\n\t}\n\twg.Wait()\n\tclose(errs)\n\n\tfor err = range errs {\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "proto/properties.go",
    "content": "// Copyright 2010 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoimpl\"\n)\n\n// StructProperties represents protocol buffer type information for a\n// generated protobuf message in the open-struct API.\n//\n// Deprecated: Do not use.\ntype StructProperties struct {\n\t// Prop are the properties for each field.\n\t//\n\t// Fields belonging to a oneof are stored in OneofTypes instead, with a\n\t// single Properties representing the parent oneof held here.\n\t//\n\t// The order of Prop matches the order of fields in the Go struct.\n\t// Struct fields that are not related to protobufs have a \"XXX_\" prefix\n\t// in the Properties.Name and must be ignored by the user.\n\tProp []*Properties\n\n\t// OneofTypes contains information about the oneof fields in this message.\n\t// It is keyed by the protobuf field name.\n\tOneofTypes map[string]*OneofProperties\n}\n\n// Properties represents the type information for a protobuf message field.\n//\n// Deprecated: Do not use.\ntype Properties struct {\n\t// Name is a placeholder name with little meaningful semantic value.\n\t// If the name has an \"XXX_\" prefix, the entire Properties must be ignored.\n\tName string\n\t// OrigName is the protobuf field name or oneof name.\n\tOrigName string\n\t// JSONName is the JSON name for the protobuf field.\n\tJSONName string\n\t// Enum is a placeholder name for enums.\n\t// For historical reasons, this is neither the Go name for the enum,\n\t// nor the protobuf name for the enum.\n\tEnum string // Deprecated: Do not use.\n\t// Weak contains the full name of the weakly referenced message.\n\tWeak string\n\t// Wire is a string representation of the wire type.\n\tWire string\n\t// WireType is the protobuf wire type for the field.\n\tWireType int\n\t// Tag is the protobuf field number.\n\tTag int\n\t// Required reports whether this is a required field.\n\tRequired bool\n\t// Optional reports whether this is a optional field.\n\tOptional bool\n\t// Repeated reports whether this is a repeated field.\n\tRepeated bool\n\t// Packed reports whether this is a packed repeated field of scalars.\n\tPacked bool\n\t// Proto3 reports whether this field operates under the proto3 syntax.\n\tProto3 bool\n\t// Oneof reports whether this field belongs within a oneof.\n\tOneof bool\n\n\t// Default is the default value in string form.\n\tDefault string\n\t// HasDefault reports whether the field has a default value.\n\tHasDefault bool\n\n\t// MapKeyProp is the properties for the key field for a map field.\n\tMapKeyProp *Properties\n\t// MapValProp is the properties for the value field for a map field.\n\tMapValProp *Properties\n}\n\n// OneofProperties represents the type information for a protobuf oneof.\n//\n// Deprecated: Do not use.\ntype OneofProperties struct {\n\t// Type is a pointer to the generated wrapper type for the field value.\n\t// This is nil for messages that are not in the open-struct API.\n\tType reflect.Type\n\t// Field is the index into StructProperties.Prop for the containing oneof.\n\tField int\n\t// Prop is the properties for the field.\n\tProp *Properties\n}\n\n// String formats the properties in the protobuf struct field tag style.\nfunc (p *Properties) String() string {\n\ts := p.Wire\n\ts += \",\" + strconv.Itoa(p.Tag)\n\tif p.Required {\n\t\ts += \",req\"\n\t}\n\tif p.Optional {\n\t\ts += \",opt\"\n\t}\n\tif p.Repeated {\n\t\ts += \",rep\"\n\t}\n\tif p.Packed {\n\t\ts += \",packed\"\n\t}\n\ts += \",name=\" + p.OrigName\n\tif p.JSONName != \"\" {\n\t\ts += \",json=\" + p.JSONName\n\t}\n\tif len(p.Enum) > 0 {\n\t\ts += \",enum=\" + p.Enum\n\t}\n\tif len(p.Weak) > 0 {\n\t\ts += \",weak=\" + p.Weak\n\t}\n\tif p.Proto3 {\n\t\ts += \",proto3\"\n\t}\n\tif p.Oneof {\n\t\ts += \",oneof\"\n\t}\n\tif p.HasDefault {\n\t\ts += \",def=\" + p.Default\n\t}\n\treturn s\n}\n\n// Parse populates p by parsing a string in the protobuf struct field tag style.\nfunc (p *Properties) Parse(tag string) {\n\t// For example: \"bytes,49,opt,name=foo,def=hello!\"\n\tfor len(tag) > 0 {\n\t\ti := strings.IndexByte(tag, ',')\n\t\tif i < 0 {\n\t\t\ti = len(tag)\n\t\t}\n\t\tswitch s := tag[:i]; {\n\t\tcase strings.HasPrefix(s, \"name=\"):\n\t\t\tp.OrigName = s[len(\"name=\"):]\n\t\tcase strings.HasPrefix(s, \"json=\"):\n\t\t\tp.JSONName = s[len(\"json=\"):]\n\t\tcase strings.HasPrefix(s, \"enum=\"):\n\t\t\tp.Enum = s[len(\"enum=\"):]\n\t\tcase strings.HasPrefix(s, \"weak=\"):\n\t\t\tp.Weak = s[len(\"weak=\"):]\n\t\tcase strings.Trim(s, \"0123456789\") == \"\":\n\t\t\tn, _ := strconv.ParseUint(s, 10, 32)\n\t\t\tp.Tag = int(n)\n\t\tcase s == \"opt\":\n\t\t\tp.Optional = true\n\t\tcase s == \"req\":\n\t\t\tp.Required = true\n\t\tcase s == \"rep\":\n\t\t\tp.Repeated = true\n\t\tcase s == \"varint\" || s == \"zigzag32\" || s == \"zigzag64\":\n\t\t\tp.Wire = s\n\t\t\tp.WireType = WireVarint\n\t\tcase s == \"fixed32\":\n\t\t\tp.Wire = s\n\t\t\tp.WireType = WireFixed32\n\t\tcase s == \"fixed64\":\n\t\t\tp.Wire = s\n\t\t\tp.WireType = WireFixed64\n\t\tcase s == \"bytes\":\n\t\t\tp.Wire = s\n\t\t\tp.WireType = WireBytes\n\t\tcase s == \"group\":\n\t\t\tp.Wire = s\n\t\t\tp.WireType = WireStartGroup\n\t\tcase s == \"packed\":\n\t\t\tp.Packed = true\n\t\tcase s == \"proto3\":\n\t\t\tp.Proto3 = true\n\t\tcase s == \"oneof\":\n\t\t\tp.Oneof = true\n\t\tcase strings.HasPrefix(s, \"def=\"):\n\t\t\t// The default tag is special in that everything afterwards is the\n\t\t\t// default regardless of the presence of commas.\n\t\t\tp.HasDefault = true\n\t\t\tp.Default, i = tag[len(\"def=\"):], len(tag)\n\t\t}\n\t\ttag = strings.TrimPrefix(tag[i:], \",\")\n\t}\n}\n\n// Init populates the properties from a protocol buffer struct tag.\n//\n// Deprecated: Do not use.\nfunc (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) {\n\tp.Name = name\n\tp.OrigName = name\n\tif tag == \"\" {\n\t\treturn\n\t}\n\tp.Parse(tag)\n\n\tif typ != nil && typ.Kind() == reflect.Map {\n\t\tp.MapKeyProp = new(Properties)\n\t\tp.MapKeyProp.Init(nil, \"Key\", f.Tag.Get(\"protobuf_key\"), nil)\n\t\tp.MapValProp = new(Properties)\n\t\tp.MapValProp.Init(nil, \"Value\", f.Tag.Get(\"protobuf_val\"), nil)\n\t}\n}\n\nvar propertiesCache sync.Map // map[reflect.Type]*StructProperties\n\n// GetProperties returns the list of properties for the type represented by t,\n// which must be a generated protocol buffer message in the open-struct API,\n// where protobuf message fields are represented by exported Go struct fields.\n//\n// Deprecated: Use protobuf reflection instead.\nfunc GetProperties(t reflect.Type) *StructProperties {\n\tif p, ok := propertiesCache.Load(t); ok {\n\t\treturn p.(*StructProperties)\n\t}\n\tp, _ := propertiesCache.LoadOrStore(t, newProperties(t))\n\treturn p.(*StructProperties)\n}\n\nfunc newProperties(t reflect.Type) *StructProperties {\n\tif t.Kind() != reflect.Struct {\n\t\tpanic(fmt.Sprintf(\"%v is not a generated message in the open-struct API\", t))\n\t}\n\n\tvar hasOneof bool\n\tprop := new(StructProperties)\n\n\t// Construct a list of properties for each field in the struct.\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tp := new(Properties)\n\t\tf := t.Field(i)\n\t\ttagField := f.Tag.Get(\"protobuf\")\n\t\tp.Init(f.Type, f.Name, tagField, &f)\n\n\t\ttagOneof := f.Tag.Get(\"protobuf_oneof\")\n\t\tif tagOneof != \"\" {\n\t\t\thasOneof = true\n\t\t\tp.OrigName = tagOneof\n\t\t}\n\n\t\t// Rename unrelated struct fields with the \"XXX_\" prefix since so much\n\t\t// user code simply checks for this to exclude special fields.\n\t\tif tagField == \"\" && tagOneof == \"\" && !strings.HasPrefix(p.Name, \"XXX_\") {\n\t\t\tp.Name = \"XXX_\" + p.Name\n\t\t\tp.OrigName = \"XXX_\" + p.OrigName\n\t\t} else if p.Weak != \"\" {\n\t\t\tp.Name = p.OrigName // avoid possible \"XXX_\" prefix on weak field\n\t\t}\n\n\t\tprop.Prop = append(prop.Prop, p)\n\t}\n\n\t// Construct a mapping of oneof field names to properties.\n\tif hasOneof {\n\t\tvar oneofWrappers []interface{}\n\t\tif fn, ok := reflect.PtrTo(t).MethodByName(\"XXX_OneofFuncs\"); ok {\n\t\t\toneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[3].Interface().([]interface{})\n\t\t}\n\t\tif fn, ok := reflect.PtrTo(t).MethodByName(\"XXX_OneofWrappers\"); ok {\n\t\t\toneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0].Interface().([]interface{})\n\t\t}\n\t\tif m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoreflect.ProtoMessage); ok {\n\t\t\tif m, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *protoimpl.MessageInfo }); ok {\n\t\t\t\toneofWrappers = m.ProtoMessageInfo().OneofWrappers\n\t\t\t}\n\t\t}\n\n\t\tprop.OneofTypes = make(map[string]*OneofProperties)\n\t\tfor _, wrapper := range oneofWrappers {\n\t\t\tp := &OneofProperties{\n\t\t\t\tType: reflect.ValueOf(wrapper).Type(), // *T\n\t\t\t\tProp: new(Properties),\n\t\t\t}\n\t\t\tf := p.Type.Elem().Field(0)\n\t\t\tp.Prop.Name = f.Name\n\t\t\tp.Prop.Parse(f.Tag.Get(\"protobuf\"))\n\n\t\t\t// Determine the struct field that contains this oneof.\n\t\t\t// Each wrapper is assignable to exactly one parent field.\n\t\t\tvar foundOneof bool\n\t\t\tfor i := 0; i < t.NumField() && !foundOneof; i++ {\n\t\t\t\tif p.Type.AssignableTo(t.Field(i).Type) {\n\t\t\t\t\tp.Field = i\n\t\t\t\t\tfoundOneof = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !foundOneof {\n\t\t\t\tpanic(fmt.Sprintf(\"%v is not a generated message in the open-struct API\", t))\n\t\t\t}\n\t\t\tprop.OneofTypes[p.Prop.OrigName] = p\n\t\t}\n\t}\n\n\treturn prop\n}\n\nfunc (sp *StructProperties) Len() int           { return len(sp.Prop) }\nfunc (sp *StructProperties) Less(i, j int) bool { return false }\nfunc (sp *StructProperties) Swap(i, j int)      { return }\n"
  },
  {
    "path": "proto/proto.go",
    "content": "// Copyright 2019 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package proto provides functionality for handling protocol buffer messages.\n// In particular, it provides marshaling and unmarshaling between a protobuf\n// message and the binary wire format.\n//\n// See https://developers.google.com/protocol-buffers/docs/gotutorial for\n// more information.\n//\n// Deprecated: Use the \"google.golang.org/protobuf/proto\" package instead.\npackage proto\n\nimport (\n\tprotoV2 \"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n\t\"google.golang.org/protobuf/runtime/protoimpl\"\n)\n\nconst (\n\tProtoPackageIsVersion1 = true\n\tProtoPackageIsVersion2 = true\n\tProtoPackageIsVersion3 = true\n\tProtoPackageIsVersion4 = true\n)\n\n// GeneratedEnum is any enum type generated by protoc-gen-go\n// which is a named int32 kind.\n// This type exists for documentation purposes.\ntype GeneratedEnum interface{}\n\n// GeneratedMessage is any message type generated by protoc-gen-go\n// which is a pointer to a named struct kind.\n// This type exists for documentation purposes.\ntype GeneratedMessage interface{}\n\n// Message is a protocol buffer message.\n//\n// This is the v1 version of the message interface and is marginally better\n// than an empty interface as it lacks any method to programatically interact\n// with the contents of the message.\n//\n// A v2 message is declared in \"google.golang.org/protobuf/proto\".Message and\n// exposes protobuf reflection as a first-class feature of the interface.\n//\n// To convert a v1 message to a v2 message, use the MessageV2 function.\n// To convert a v2 message to a v1 message, use the MessageV1 function.\ntype Message = protoiface.MessageV1\n\n// MessageV1 converts either a v1 or v2 message to a v1 message.\n// It returns nil if m is nil.\nfunc MessageV1(m GeneratedMessage) protoiface.MessageV1 {\n\treturn protoimpl.X.ProtoMessageV1Of(m)\n}\n\n// MessageV2 converts either a v1 or v2 message to a v2 message.\n// It returns nil if m is nil.\nfunc MessageV2(m GeneratedMessage) protoV2.Message {\n\treturn protoimpl.X.ProtoMessageV2Of(m)\n}\n\n// MessageReflect returns a reflective view for a message.\n// It returns nil if m is nil.\nfunc MessageReflect(m Message) protoreflect.Message {\n\treturn protoimpl.X.MessageOf(m)\n}\n\n// Marshaler is implemented by messages that can marshal themselves.\n// This interface is used by the following functions: Size, Marshal,\n// Buffer.Marshal, and Buffer.EncodeMessage.\n//\n// Deprecated: Do not implement.\ntype Marshaler interface {\n\t// Marshal formats the encoded bytes of the message.\n\t// It should be deterministic and emit valid protobuf wire data.\n\t// The caller takes ownership of the returned buffer.\n\tMarshal() ([]byte, error)\n}\n\n// Unmarshaler is implemented by messages that can unmarshal themselves.\n// This interface is used by the following functions: Unmarshal, UnmarshalMerge,\n// Buffer.Unmarshal, Buffer.DecodeMessage, and Buffer.DecodeGroup.\n//\n// Deprecated: Do not implement.\ntype Unmarshaler interface {\n\t// Unmarshal parses the encoded bytes of the protobuf wire input.\n\t// The provided buffer is only valid for during method call.\n\t// It should not reset the receiver message.\n\tUnmarshal([]byte) error\n}\n\n// Merger is implemented by messages that can merge themselves.\n// This interface is used by the following functions: Clone and Merge.\n//\n// Deprecated: Do not implement.\ntype Merger interface {\n\t// Merge merges the contents of src into the receiver message.\n\t// It clones all data structures in src such that it aliases no mutable\n\t// memory referenced by src.\n\tMerge(src Message)\n}\n\n// RequiredNotSetError is an error type returned when\n// marshaling or unmarshaling a message with missing required fields.\ntype RequiredNotSetError struct {\n\terr error\n}\n\nfunc (e *RequiredNotSetError) Error() string {\n\tif e.err != nil {\n\t\treturn e.err.Error()\n\t}\n\treturn \"proto: required field not set\"\n}\nfunc (e *RequiredNotSetError) RequiredNotSet() bool {\n\treturn true\n}\n\nfunc checkRequiredNotSet(m protoV2.Message) error {\n\tif err := protoV2.CheckInitialized(m); err != nil {\n\t\treturn &RequiredNotSetError{err: err}\n\t}\n\treturn nil\n}\n\n// Clone returns a deep copy of src.\nfunc Clone(src Message) Message {\n\treturn MessageV1(protoV2.Clone(MessageV2(src)))\n}\n\n// Merge merges src into dst, which must be messages of the same type.\n//\n// Populated scalar fields in src are copied to dst, while populated\n// singular messages in src are merged into dst by recursively calling Merge.\n// The elements of every list field in src is appended to the corresponded\n// list fields in dst. The entries of every map field in src is copied into\n// the corresponding map field in dst, possibly replacing existing entries.\n// The unknown fields of src are appended to the unknown fields of dst.\nfunc Merge(dst, src Message) {\n\tprotoV2.Merge(MessageV2(dst), MessageV2(src))\n}\n\n// Equal reports whether two messages are equal.\n// If two messages marshal to the same bytes under deterministic serialization,\n// then Equal is guaranteed to report true.\n//\n// Two messages are equal if they are the same protobuf message type,\n// have the same set of populated known and extension field values,\n// and the same set of unknown fields values.\n//\n// Scalar values are compared with the equivalent of the == operator in Go,\n// except bytes values which are compared using bytes.Equal and\n// floating point values which specially treat NaNs as equal.\n// Message values are compared by recursively calling Equal.\n// Lists are equal if each element value is also equal.\n// Maps are equal if they have the same set of keys, where the pair of values\n// for each key is also equal.\nfunc Equal(x, y Message) bool {\n\treturn protoV2.Equal(MessageV2(x), MessageV2(y))\n}\n\nfunc isMessageSet(md protoreflect.MessageDescriptor) bool {\n\tms, ok := md.(interface{ IsMessageSet() bool })\n\treturn ok && ms.IsMessageSet()\n}\n"
  },
  {
    "path": "proto/proto_clone_test.go",
    "content": "// Copyright 2011 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto_test\n\nimport (\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\n\tpb2 \"github.com/golang/protobuf/internal/testprotos/proto2_proto\"\n\tpb3 \"github.com/golang/protobuf/internal/testprotos/proto3_proto\"\n)\n\nvar cloneTestMessage = &pb2.MyMessage{\n\tCount: proto.Int32(42),\n\tName:  proto.String(\"Dave\"),\n\tPet:   []string{\"bunny\", \"kitty\", \"horsey\"},\n\tInner: &pb2.InnerMessage{\n\t\tHost:      proto.String(\"niles\"),\n\t\tPort:      proto.Int32(9099),\n\t\tConnected: proto.Bool(true),\n\t},\n\tOthers: []*pb2.OtherMessage{\n\t\t{\n\t\t\tValue: []byte(\"some bytes\"),\n\t\t},\n\t},\n\tSomegroup: &pb2.MyMessage_SomeGroup{\n\t\tGroupField: proto.Int32(6),\n\t},\n\tRepBytes: [][]byte{[]byte(\"sham\"), []byte(\"wow\")},\n}\n\nfunc init() {\n\text := &pb2.Ext{\n\t\tData: proto.String(\"extension\"),\n\t}\n\tif err := proto.SetExtension(cloneTestMessage, pb2.E_Ext_More, ext); err != nil {\n\t\tpanic(\"SetExtension: \" + err.Error())\n\t}\n\tif err := proto.SetExtension(cloneTestMessage, pb2.E_Ext_Text, proto.String(\"hello\")); err != nil {\n\t\tpanic(\"SetExtension: \" + err.Error())\n\t}\n\tif err := proto.SetExtension(cloneTestMessage, pb2.E_Greeting, []string{\"one\", \"two\"}); err != nil {\n\t\tpanic(\"SetExtension: \" + err.Error())\n\t}\n}\n\nfunc TestClone(t *testing.T) {\n\t// Create a clone using a marshal/unmarshal roundtrip.\n\tvanilla := new(pb2.MyMessage)\n\tb, err := proto.Marshal(cloneTestMessage)\n\tif err != nil {\n\t\tt.Errorf(\"unexpected Marshal error: %v\", err)\n\t}\n\tif err := proto.Unmarshal(b, vanilla); err != nil {\n\t\tt.Errorf(\"unexpected Unarshal error: %v\", err)\n\t}\n\n\t// Create a clone using Clone and verify that it is equal to the original.\n\tm := proto.Clone(cloneTestMessage).(*pb2.MyMessage)\n\tif !proto.Equal(m, cloneTestMessage) {\n\t\tt.Fatalf(\"Clone(%v) = %v\", cloneTestMessage, m)\n\t}\n\n\t// Mutate the clone, which should not affect the original.\n\tx1, err := proto.GetExtension(m, pb2.E_Ext_More)\n\tif err != nil {\n\t\tt.Errorf(\"unexpected GetExtension(%v) error: %v\", pb2.E_Ext_More.Name, err)\n\t}\n\tx2, err := proto.GetExtension(m, pb2.E_Ext_Text)\n\tif err != nil {\n\t\tt.Errorf(\"unexpected GetExtension(%v) error: %v\", pb2.E_Ext_Text.Name, err)\n\t}\n\tx3, err := proto.GetExtension(m, pb2.E_Greeting)\n\tif err != nil {\n\t\tt.Errorf(\"unexpected GetExtension(%v) error: %v\", pb2.E_Greeting.Name, err)\n\t}\n\t*m.Inner.Port++\n\t*(x1.(*pb2.Ext)).Data = \"blah blah\"\n\t*(x2.(*string)) = \"goodbye\"\n\tx3.([]string)[0] = \"zero\"\n\tif !proto.Equal(cloneTestMessage, vanilla) {\n\t\tt.Fatalf(\"mutation on original detected:\\ngot  %v\\nwant %v\", cloneTestMessage, vanilla)\n\t}\n}\n\nfunc TestCloneNil(t *testing.T) {\n\tvar m *pb2.MyMessage\n\tif c := proto.Clone(m); !proto.Equal(m, c) {\n\t\tt.Errorf(\"Clone(%v) = %v\", m, c)\n\t}\n}\n\nvar mergeTests = []struct {\n\tsrc, dst, want proto.Message\n}{\n\t{\n\t\tsrc: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t},\n\t\tdst: &pb2.MyMessage{\n\t\t\tName: proto.String(\"Dave\"),\n\t\t},\n\t\twant: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(\"Dave\"),\n\t\t},\n\t},\n\t{\n\t\tsrc: &pb2.MyMessage{\n\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\tHost:      proto.String(\"hey\"),\n\t\t\t\tConnected: proto.Bool(true),\n\t\t\t},\n\t\t\tPet: []string{\"horsey\"},\n\t\t\tOthers: []*pb2.OtherMessage{\n\t\t\t\t{\n\t\t\t\t\tValue: []byte(\"some bytes\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tdst: &pb2.MyMessage{\n\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\tHost: proto.String(\"niles\"),\n\t\t\t\tPort: proto.Int32(9099),\n\t\t\t},\n\t\t\tPet: []string{\"bunny\", \"kitty\"},\n\t\t\tOthers: []*pb2.OtherMessage{\n\t\t\t\t{\n\t\t\t\t\tKey: proto.Int64(31415926535),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t// Explicitly test a src=nil field\n\t\t\t\t\tInner: nil,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\twant: &pb2.MyMessage{\n\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\tHost:      proto.String(\"hey\"),\n\t\t\t\tConnected: proto.Bool(true),\n\t\t\t\tPort:      proto.Int32(9099),\n\t\t\t},\n\t\t\tPet: []string{\"bunny\", \"kitty\", \"horsey\"},\n\t\t\tOthers: []*pb2.OtherMessage{\n\t\t\t\t{\n\t\t\t\t\tKey: proto.Int64(31415926535),\n\t\t\t\t},\n\t\t\t\t{},\n\t\t\t\t{\n\t\t\t\t\tValue: []byte(\"some bytes\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tsrc: &pb2.MyMessage{\n\t\t\tRepBytes: [][]byte{[]byte(\"wow\")},\n\t\t},\n\t\tdst: &pb2.MyMessage{\n\t\t\tSomegroup: &pb2.MyMessage_SomeGroup{\n\t\t\t\tGroupField: proto.Int32(6),\n\t\t\t},\n\t\t\tRepBytes: [][]byte{[]byte(\"sham\")},\n\t\t},\n\t\twant: &pb2.MyMessage{\n\t\t\tSomegroup: &pb2.MyMessage_SomeGroup{\n\t\t\t\tGroupField: proto.Int32(6),\n\t\t\t},\n\t\t\tRepBytes: [][]byte{[]byte(\"sham\"), []byte(\"wow\")},\n\t\t},\n\t},\n\t// Check that a scalar bytes field replaces rather than appends.\n\t{\n\t\tsrc:  &pb2.OtherMessage{Value: []byte(\"foo\")},\n\t\tdst:  &pb2.OtherMessage{Value: []byte(\"bar\")},\n\t\twant: &pb2.OtherMessage{Value: []byte(\"foo\")},\n\t},\n\t{\n\t\tsrc: &pb2.MessageWithMap{\n\t\t\tNameMapping: map[int32]string{6: \"Nigel\"},\n\t\t\tMsgMapping: map[int64]*pb2.FloatingPoint{\n\t\t\t\t0x4001: &pb2.FloatingPoint{F: proto.Float64(2.0)},\n\t\t\t\t0x4002: &pb2.FloatingPoint{\n\t\t\t\t\tF: proto.Float64(2.0),\n\t\t\t\t},\n\t\t\t},\n\t\t\tByteMapping: map[bool][]byte{true: []byte(\"wowsa\")},\n\t\t},\n\t\tdst: &pb2.MessageWithMap{\n\t\t\tNameMapping: map[int32]string{\n\t\t\t\t6: \"Bruce\", // should be overwritten\n\t\t\t\t7: \"Andrew\",\n\t\t\t},\n\t\t\tMsgMapping: map[int64]*pb2.FloatingPoint{\n\t\t\t\t0x4002: &pb2.FloatingPoint{\n\t\t\t\t\tF:     proto.Float64(3.0),\n\t\t\t\t\tExact: proto.Bool(true),\n\t\t\t\t}, // the entire message should be overwritten\n\t\t\t},\n\t\t},\n\t\twant: &pb2.MessageWithMap{\n\t\t\tNameMapping: map[int32]string{\n\t\t\t\t6: \"Nigel\",\n\t\t\t\t7: \"Andrew\",\n\t\t\t},\n\t\t\tMsgMapping: map[int64]*pb2.FloatingPoint{\n\t\t\t\t0x4001: &pb2.FloatingPoint{F: proto.Float64(2.0)},\n\t\t\t\t0x4002: &pb2.FloatingPoint{\n\t\t\t\t\tF: proto.Float64(2.0),\n\t\t\t\t},\n\t\t\t},\n\t\t\tByteMapping: map[bool][]byte{true: []byte(\"wowsa\")},\n\t\t},\n\t},\n\t// proto3 shouldn't merge zero values,\n\t// in the same way that proto2 shouldn't merge nils.\n\t{\n\t\tsrc: &pb3.Message{\n\t\t\tName: \"Aaron\",\n\t\t\tData: []byte(\"\"), // zero value, but not nil\n\t\t},\n\t\tdst: &pb3.Message{\n\t\t\tHeightInCm: 176,\n\t\t\tData:       []byte(\"texas!\"),\n\t\t},\n\t\twant: &pb3.Message{\n\t\t\tName:       \"Aaron\",\n\t\t\tHeightInCm: 176,\n\t\t\tData:       []byte(\"texas!\"),\n\t\t},\n\t},\n\t{ // Oneof fields should merge by assignment.\n\t\tsrc:  &pb2.Communique{Union: &pb2.Communique_Number{41}},\n\t\tdst:  &pb2.Communique{Union: &pb2.Communique_Name{\"Bobby Tables\"}},\n\t\twant: &pb2.Communique{Union: &pb2.Communique_Number{41}},\n\t},\n\t{ // Oneof nil is the same as not set.\n\t\tsrc:  &pb2.Communique{},\n\t\tdst:  &pb2.Communique{Union: &pb2.Communique_Name{\"Bobby Tables\"}},\n\t\twant: &pb2.Communique{Union: &pb2.Communique_Name{\"Bobby Tables\"}},\n\t},\n\t{\n\t\tsrc:  &pb2.Communique{Union: &pb2.Communique_Number{1337}},\n\t\tdst:  &pb2.Communique{},\n\t\twant: &pb2.Communique{Union: &pb2.Communique_Number{1337}},\n\t},\n\t{\n\t\tsrc:  &pb2.Communique{Union: &pb2.Communique_Col{pb2.MyMessage_RED}},\n\t\tdst:  &pb2.Communique{},\n\t\twant: &pb2.Communique{Union: &pb2.Communique_Col{pb2.MyMessage_RED}},\n\t},\n\t{\n\t\tsrc:  &pb2.Communique{Union: &pb2.Communique_Data{[]byte(\"hello\")}},\n\t\tdst:  &pb2.Communique{},\n\t\twant: &pb2.Communique{Union: &pb2.Communique_Data{[]byte(\"hello\")}},\n\t},\n\t{\n\t\tsrc:  &pb2.Communique{Union: &pb2.Communique_Msg{&pb2.Strings{BytesField: []byte{1, 2, 3}}}},\n\t\tdst:  &pb2.Communique{},\n\t\twant: &pb2.Communique{Union: &pb2.Communique_Msg{&pb2.Strings{BytesField: []byte{1, 2, 3}}}},\n\t},\n\t{\n\t\tsrc:  &pb2.Communique{Union: &pb2.Communique_Msg{}},\n\t\tdst:  &pb2.Communique{},\n\t\twant: &pb2.Communique{Union: &pb2.Communique_Msg{}},\n\t},\n\t{\n\t\tsrc:  &pb2.Communique{Union: &pb2.Communique_Msg{&pb2.Strings{StringField: proto.String(\"123\")}}},\n\t\tdst:  &pb2.Communique{Union: &pb2.Communique_Msg{&pb2.Strings{BytesField: []byte{1, 2, 3}}}},\n\t\twant: &pb2.Communique{Union: &pb2.Communique_Msg{&pb2.Strings{StringField: proto.String(\"123\"), BytesField: []byte{1, 2, 3}}}},\n\t},\n\t{\n\t\tsrc: &pb3.Message{\n\t\t\tTerrain: map[string]*pb3.Nested{\n\t\t\t\t\"kay_a\": &pb3.Nested{Cute: true},      // replace\n\t\t\t\t\"kay_b\": &pb3.Nested{Bunny: \"rabbit\"}, // insert\n\t\t\t},\n\t\t},\n\t\tdst: &pb3.Message{\n\t\t\tTerrain: map[string]*pb3.Nested{\n\t\t\t\t\"kay_a\": &pb3.Nested{Bunny: \"lost\"},  // replaced\n\t\t\t\t\"kay_c\": &pb3.Nested{Bunny: \"bunny\"}, // keep\n\t\t\t},\n\t\t},\n\t\twant: &pb3.Message{\n\t\t\tTerrain: map[string]*pb3.Nested{\n\t\t\t\t\"kay_a\": &pb3.Nested{Cute: true},\n\t\t\t\t\"kay_b\": &pb3.Nested{Bunny: \"rabbit\"},\n\t\t\t\t\"kay_c\": &pb3.Nested{Bunny: \"bunny\"},\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tsrc: &pb2.GoTest{\n\t\t\tF_BoolRepeated:   []bool{},\n\t\t\tF_Int32Repeated:  []int32{},\n\t\t\tF_Int64Repeated:  []int64{},\n\t\t\tF_Uint32Repeated: []uint32{},\n\t\t\tF_Uint64Repeated: []uint64{},\n\t\t\tF_FloatRepeated:  []float32{},\n\t\t\tF_DoubleRepeated: []float64{},\n\t\t\tF_StringRepeated: []string{},\n\t\t\tF_BytesRepeated:  [][]byte{},\n\t\t},\n\t\tdst: &pb2.GoTest{},\n\t\twant: &pb2.GoTest{\n\t\t\tF_BoolRepeated:   []bool{},\n\t\t\tF_Int32Repeated:  []int32{},\n\t\t\tF_Int64Repeated:  []int64{},\n\t\t\tF_Uint32Repeated: []uint32{},\n\t\t\tF_Uint64Repeated: []uint64{},\n\t\t\tF_FloatRepeated:  []float32{},\n\t\t\tF_DoubleRepeated: []float64{},\n\t\t\tF_StringRepeated: []string{},\n\t\t\tF_BytesRepeated:  [][]byte{},\n\t\t},\n\t},\n\t{\n\t\tsrc: &pb2.GoTest{},\n\t\tdst: &pb2.GoTest{\n\t\t\tF_BoolRepeated:   []bool{},\n\t\t\tF_Int32Repeated:  []int32{},\n\t\t\tF_Int64Repeated:  []int64{},\n\t\t\tF_Uint32Repeated: []uint32{},\n\t\t\tF_Uint64Repeated: []uint64{},\n\t\t\tF_FloatRepeated:  []float32{},\n\t\t\tF_DoubleRepeated: []float64{},\n\t\t\tF_StringRepeated: []string{},\n\t\t\tF_BytesRepeated:  [][]byte{},\n\t\t},\n\t\twant: &pb2.GoTest{\n\t\t\tF_BoolRepeated:   []bool{},\n\t\t\tF_Int32Repeated:  []int32{},\n\t\t\tF_Int64Repeated:  []int64{},\n\t\t\tF_Uint32Repeated: []uint32{},\n\t\t\tF_Uint64Repeated: []uint64{},\n\t\t\tF_FloatRepeated:  []float32{},\n\t\t\tF_DoubleRepeated: []float64{},\n\t\t\tF_StringRepeated: []string{},\n\t\t\tF_BytesRepeated:  [][]byte{},\n\t\t},\n\t},\n\t{\n\t\tsrc: &pb2.GoTest{\n\t\t\tF_BytesRepeated: [][]byte{nil, []byte{}, []byte{0}},\n\t\t},\n\t\tdst: &pb2.GoTest{},\n\t\twant: &pb2.GoTest{\n\t\t\tF_BytesRepeated: [][]byte{nil, []byte{}, []byte{0}},\n\t\t},\n\t},\n\t{\n\t\tsrc: &pb2.MyMessage{\n\t\t\tOthers: []*pb2.OtherMessage{},\n\t\t},\n\t\tdst: &pb2.MyMessage{},\n\t\twant: &pb2.MyMessage{\n\t\t\tOthers: []*pb2.OtherMessage{},\n\t\t},\n\t},\n}\n\nfunc TestMerge(t *testing.T) {\n\tfor _, m := range mergeTests {\n\t\tgot := proto.Clone(m.dst)\n\t\tif !proto.Equal(got, m.dst) {\n\t\t\tt.Errorf(\"Clone()\\ngot  %v\\nwant %v\", got, m.dst)\n\t\t\tcontinue\n\t\t}\n\t\tproto.Merge(got, m.src)\n\t\tif !proto.Equal(got, m.want) {\n\t\t\tt.Errorf(\"Merge(%v, %v)\\ngot  %v\\nwant %v\", m.dst, m.src, got, m.want)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "proto/proto_equal_test.go",
    "content": "// Copyright 2011 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto_test\n\nimport (\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\n\tpb2 \"github.com/golang/protobuf/internal/testprotos/proto2_proto\"\n\tpb3 \"github.com/golang/protobuf/internal/testprotos/proto3_proto\"\n)\n\n// Four identical base messages.\n// The init function adds extensions to some of them.\nvar messageWithoutExtension = &pb2.MyMessage{Count: proto.Int32(7)}\nvar messageWithExtension1a = &pb2.MyMessage{Count: proto.Int32(7)}\nvar messageWithExtension1b = &pb2.MyMessage{Count: proto.Int32(7)}\nvar messageWithExtension2 = &pb2.MyMessage{Count: proto.Int32(7)}\nvar messageWithExtension3a = &pb2.MyMessage{Count: proto.Int32(7)}\nvar messageWithExtension3b = &pb2.MyMessage{Count: proto.Int32(7)}\nvar messageWithExtension3c = &pb2.MyMessage{Count: proto.Int32(7)}\n\n// Two messages with non-message extensions.\nvar messageWithInt32Extension1 = &pb2.MyMessage{Count: proto.Int32(8)}\nvar messageWithInt32Extension2 = &pb2.MyMessage{Count: proto.Int32(8)}\n\nfunc init() {\n\text1 := &pb2.Ext{Data: proto.String(\"Kirk\")}\n\text2 := &pb2.Ext{Data: proto.String(\"Picard\")}\n\n\t// messageWithExtension1a has ext1, but never marshals it.\n\tif err := proto.SetExtension(messageWithExtension1a, pb2.E_Ext_More, ext1); err != nil {\n\t\tpanic(\"proto.SetExtension on 1a failed: \" + err.Error())\n\t}\n\n\t// messageWithExtension1b is the unmarshaled form of messageWithExtension1a.\n\tif err := proto.SetExtension(messageWithExtension1b, pb2.E_Ext_More, ext1); err != nil {\n\t\tpanic(\"proto.SetExtension on 1b failed: \" + err.Error())\n\t}\n\tbuf, err := proto.Marshal(messageWithExtension1b)\n\tif err != nil {\n\t\tpanic(\"proto.Marshal of 1b failed: \" + err.Error())\n\t}\n\tmessageWithExtension1b.Reset()\n\tif err := proto.Unmarshal(buf, messageWithExtension1b); err != nil {\n\t\tpanic(\"proto.Unmarshal of 1b failed: \" + err.Error())\n\t}\n\n\t// messageWithExtension2 has ext2.\n\tif err := proto.SetExtension(messageWithExtension2, pb2.E_Ext_More, ext2); err != nil {\n\t\tpanic(\"proto.SetExtension on 2 failed: \" + err.Error())\n\t}\n\n\tif err := proto.SetExtension(messageWithInt32Extension1, pb2.E_Ext_Number, proto.Int32(23)); err != nil {\n\t\tpanic(\"proto.SetExtension on Int32-1 failed: \" + err.Error())\n\t}\n\tif err := proto.SetExtension(messageWithInt32Extension1, pb2.E_Ext_Number, proto.Int32(24)); err != nil {\n\t\tpanic(\"proto.SetExtension on Int32-2 failed: \" + err.Error())\n\t}\n\n\t// messageWithExtension3{a,b,c} has unregistered extension.\n\tif proto.RegisteredExtensions(messageWithExtension3a)[200] != nil {\n\t\tpanic(\"expect extension 200 unregistered\")\n\t}\n\tbytes := []byte{\n\t\t0xc0, 0x0c, 0x01, // id=200, wiretype=0 (varint), data=1\n\t}\n\tbytes2 := []byte{\n\t\t0xc0, 0x0c, 0x02, // id=200, wiretype=0 (varint), data=2\n\t}\n\tproto.SetRawExtension(messageWithExtension3a, 200, bytes)\n\tproto.SetRawExtension(messageWithExtension3b, 200, bytes)\n\tproto.SetRawExtension(messageWithExtension3c, 200, bytes2)\n}\n\nvar EqualTests = []struct {\n\tdesc string\n\ta, b proto.Message\n\texp  bool\n}{\n\t{\"different types\", &pb2.GoEnum{}, &pb2.GoTestField{}, false},\n\t{\"equal empty\", &pb2.GoEnum{}, &pb2.GoEnum{}, true},\n\t{\"nil vs nil\", nil, nil, true},\n\t{\"typed nil vs typed nil\", (*pb2.GoEnum)(nil), (*pb2.GoEnum)(nil), true},\n\t{\"typed nil vs empty\", (*pb2.GoEnum)(nil), &pb2.GoEnum{}, false},\n\t{\"different typed nil\", (*pb2.GoEnum)(nil), (*pb2.GoTestField)(nil), false},\n\n\t{\"one set field, one unset field\", &pb2.GoTestField{Label: proto.String(\"foo\")}, &pb2.GoTestField{}, false},\n\t{\"one set field zero, one unset field\", &pb2.GoTest{Param: proto.Int32(0)}, &pb2.GoTest{}, false},\n\t{\"different set fields\", &pb2.GoTestField{Label: proto.String(\"foo\")}, &pb2.GoTestField{Label: proto.String(\"bar\")}, false},\n\t{\"equal set\", &pb2.GoTestField{Label: proto.String(\"foo\")}, &pb2.GoTestField{Label: proto.String(\"foo\")}, true},\n\n\t{\"repeated, one set\", &pb2.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb2.GoTest{}, false},\n\t{\"repeated, different length\", &pb2.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb2.GoTest{F_Int32Repeated: []int32{2}}, false},\n\t{\"repeated, different value\", &pb2.GoTest{F_Int32Repeated: []int32{2}}, &pb2.GoTest{F_Int32Repeated: []int32{3}}, false},\n\t{\"repeated, equal\", &pb2.GoTest{F_Int32Repeated: []int32{2, 4}}, &pb2.GoTest{F_Int32Repeated: []int32{2, 4}}, true},\n\t{\"repeated, nil equal nil\", &pb2.GoTest{F_Int32Repeated: nil}, &pb2.GoTest{F_Int32Repeated: nil}, true},\n\t{\"repeated, nil equal empty\", &pb2.GoTest{F_Int32Repeated: nil}, &pb2.GoTest{F_Int32Repeated: []int32{}}, true},\n\t{\"repeated, empty equal nil\", &pb2.GoTest{F_Int32Repeated: []int32{}}, &pb2.GoTest{F_Int32Repeated: nil}, true},\n\n\t{\n\t\t\"nested, different\",\n\t\t&pb2.GoTest{RequiredField: &pb2.GoTestField{Label: proto.String(\"foo\")}},\n\t\t&pb2.GoTest{RequiredField: &pb2.GoTestField{Label: proto.String(\"bar\")}},\n\t\tfalse,\n\t},\n\t{\n\t\t\"nested, equal\",\n\t\t&pb2.GoTest{RequiredField: &pb2.GoTestField{Label: proto.String(\"wow\")}},\n\t\t&pb2.GoTest{RequiredField: &pb2.GoTestField{Label: proto.String(\"wow\")}},\n\t\ttrue,\n\t},\n\n\t{\"bytes\", &pb2.OtherMessage{Value: []byte(\"foo\")}, &pb2.OtherMessage{Value: []byte(\"foo\")}, true},\n\t{\"bytes, empty\", &pb2.OtherMessage{Value: []byte{}}, &pb2.OtherMessage{Value: []byte{}}, true},\n\t{\"bytes, empty vs nil\", &pb2.OtherMessage{Value: []byte{}}, &pb2.OtherMessage{Value: nil}, false},\n\t{\n\t\t\"repeated bytes\",\n\t\t&pb2.MyMessage{RepBytes: [][]byte{[]byte(\"sham\"), []byte(\"wow\")}},\n\t\t&pb2.MyMessage{RepBytes: [][]byte{[]byte(\"sham\"), []byte(\"wow\")}},\n\t\ttrue,\n\t},\n\t// In proto3, []byte{} and []byte(nil) are equal.\n\t{\"proto3 bytes, empty vs nil\", &pb3.Message{Data: []byte{}}, &pb3.Message{Data: nil}, true},\n\n\t{\"extension vs. no extension\", messageWithoutExtension, messageWithExtension1a, false},\n\t{\"extension vs. same extension\", messageWithExtension1a, messageWithExtension1b, true},\n\t{\"extension vs. different extension\", messageWithExtension1a, messageWithExtension2, false},\n\n\t{\"int32 extension vs. itself\", messageWithInt32Extension1, messageWithInt32Extension1, true},\n\t{\"int32 extension vs. a different int32\", messageWithInt32Extension1, messageWithInt32Extension2, false},\n\n\t{\"unregistered extension same\", messageWithExtension3a, messageWithExtension3b, true},\n\t{\"unregistered extension different\", messageWithExtension3a, messageWithExtension3c, false},\n\n\t{\n\t\t\"message with group\",\n\t\t&pb2.MyMessage{\n\t\t\tCount: proto.Int32(1),\n\t\t\tSomegroup: &pb2.MyMessage_SomeGroup{\n\t\t\t\tGroupField: proto.Int32(5),\n\t\t\t},\n\t\t},\n\t\t&pb2.MyMessage{\n\t\t\tCount: proto.Int32(1),\n\t\t\tSomegroup: &pb2.MyMessage_SomeGroup{\n\t\t\t\tGroupField: proto.Int32(5),\n\t\t\t},\n\t\t},\n\t\ttrue,\n\t},\n\n\t{\n\t\t\"map same\",\n\t\t&pb2.MessageWithMap{NameMapping: map[int32]string{1: \"Ken\"}},\n\t\t&pb2.MessageWithMap{NameMapping: map[int32]string{1: \"Ken\"}},\n\t\ttrue,\n\t},\n\t{\n\t\t\"map different entry\",\n\t\t&pb2.MessageWithMap{NameMapping: map[int32]string{1: \"Ken\"}},\n\t\t&pb2.MessageWithMap{NameMapping: map[int32]string{2: \"Rob\"}},\n\t\tfalse,\n\t},\n\t{\n\t\t\"map different key only\",\n\t\t&pb2.MessageWithMap{NameMapping: map[int32]string{1: \"Ken\"}},\n\t\t&pb2.MessageWithMap{NameMapping: map[int32]string{2: \"Ken\"}},\n\t\tfalse,\n\t},\n\t{\n\t\t\"map different value only\",\n\t\t&pb2.MessageWithMap{NameMapping: map[int32]string{1: \"Ken\"}},\n\t\t&pb2.MessageWithMap{NameMapping: map[int32]string{1: \"Rob\"}},\n\t\tfalse,\n\t},\n\t{\n\t\t\"zero-length maps same\",\n\t\t&pb2.MessageWithMap{NameMapping: map[int32]string{}},\n\t\t&pb2.MessageWithMap{NameMapping: nil},\n\t\ttrue,\n\t},\n\t{\n\t\t\"orders in map don't matter\",\n\t\t&pb2.MessageWithMap{NameMapping: map[int32]string{1: \"Ken\", 2: \"Rob\"}},\n\t\t&pb2.MessageWithMap{NameMapping: map[int32]string{2: \"Rob\", 1: \"Ken\"}},\n\t\ttrue,\n\t},\n\t{\n\t\t\"oneof same\",\n\t\t&pb2.Communique{Union: &pb2.Communique_Number{41}},\n\t\t&pb2.Communique{Union: &pb2.Communique_Number{41}},\n\t\ttrue,\n\t},\n\t{\n\t\t\"oneof one nil\",\n\t\t&pb2.Communique{Union: &pb2.Communique_Number{41}},\n\t\t&pb2.Communique{},\n\t\tfalse,\n\t},\n\t{\n\t\t\"oneof different\",\n\t\t&pb2.Communique{Union: &pb2.Communique_Number{41}},\n\t\t&pb2.Communique{Union: &pb2.Communique_Name{\"Bobby Tables\"}},\n\t\tfalse,\n\t},\n}\n\nfunc TestEqual(t *testing.T) {\n\tfor _, tc := range EqualTests {\n\t\tif res := proto.Equal(tc.a, tc.b); res != tc.exp {\n\t\t\tt.Errorf(\"%v: Equal(%v, %v) = %v, want %v\", tc.desc, tc.a, tc.b, res, tc.exp)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "proto/proto_test.go",
    "content": "// Copyright 2010 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto_test\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"math\"\n\t\"math/rand\"\n\t\"reflect\"\n\t\"runtime/debug\"\n\t\"strings\"\n\t\"sync\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/golang/protobuf/proto\"\n\t\"google.golang.org/protobuf/testing/protopack\"\n\n\tpb2 \"github.com/golang/protobuf/internal/testprotos/proto2_proto\"\n\tpb3 \"github.com/golang/protobuf/internal/testprotos/proto3_proto\"\n\ttspb \"github.com/golang/protobuf/ptypes/timestamp\"\n)\n\nfunc initGoTestField() *pb2.GoTestField {\n\tf := new(pb2.GoTestField)\n\tf.Label = proto.String(\"label\")\n\tf.Type = proto.String(\"type\")\n\treturn f\n}\n\n// These are all structurally equivalent but the tag numbers differ.\n// (It's remarkable that required, optional, and repeated all have\n// 8 letters.)\nfunc initGoTest_RequiredGroup() *pb2.GoTest_RequiredGroup {\n\treturn &pb2.GoTest_RequiredGroup{\n\t\tRequiredField: proto.String(\"required\"),\n\t}\n}\n\nfunc initGoTest_OptionalGroup() *pb2.GoTest_OptionalGroup {\n\treturn &pb2.GoTest_OptionalGroup{\n\t\tRequiredField: proto.String(\"optional\"),\n\t}\n}\n\nfunc initGoTest_RepeatedGroup() *pb2.GoTest_RepeatedGroup {\n\treturn &pb2.GoTest_RepeatedGroup{\n\t\tRequiredField: proto.String(\"repeated\"),\n\t}\n}\n\nfunc initGoTest(setdefaults bool) *pb2.GoTest {\n\tpb := new(pb2.GoTest)\n\tif setdefaults {\n\t\tpb.F_BoolDefaulted = proto.Bool(pb2.Default_GoTest_F_BoolDefaulted)\n\t\tpb.F_Int32Defaulted = proto.Int32(pb2.Default_GoTest_F_Int32Defaulted)\n\t\tpb.F_Int64Defaulted = proto.Int64(pb2.Default_GoTest_F_Int64Defaulted)\n\t\tpb.F_Fixed32Defaulted = proto.Uint32(pb2.Default_GoTest_F_Fixed32Defaulted)\n\t\tpb.F_Fixed64Defaulted = proto.Uint64(pb2.Default_GoTest_F_Fixed64Defaulted)\n\t\tpb.F_Uint32Defaulted = proto.Uint32(pb2.Default_GoTest_F_Uint32Defaulted)\n\t\tpb.F_Uint64Defaulted = proto.Uint64(pb2.Default_GoTest_F_Uint64Defaulted)\n\t\tpb.F_FloatDefaulted = proto.Float32(pb2.Default_GoTest_F_FloatDefaulted)\n\t\tpb.F_DoubleDefaulted = proto.Float64(pb2.Default_GoTest_F_DoubleDefaulted)\n\t\tpb.F_StringDefaulted = proto.String(pb2.Default_GoTest_F_StringDefaulted)\n\t\tpb.F_BytesDefaulted = pb2.Default_GoTest_F_BytesDefaulted\n\t\tpb.F_Sint32Defaulted = proto.Int32(pb2.Default_GoTest_F_Sint32Defaulted)\n\t\tpb.F_Sint64Defaulted = proto.Int64(pb2.Default_GoTest_F_Sint64Defaulted)\n\t\tpb.F_Sfixed32Defaulted = proto.Int32(pb2.Default_GoTest_F_Sfixed32Defaulted)\n\t\tpb.F_Sfixed64Defaulted = proto.Int64(pb2.Default_GoTest_F_Sfixed64Defaulted)\n\t}\n\n\tpb.Kind = pb2.GoTest_TIME.Enum()\n\tpb.RequiredField = initGoTestField()\n\tpb.F_BoolRequired = proto.Bool(true)\n\tpb.F_Int32Required = proto.Int32(3)\n\tpb.F_Int64Required = proto.Int64(6)\n\tpb.F_Fixed32Required = proto.Uint32(32)\n\tpb.F_Fixed64Required = proto.Uint64(64)\n\tpb.F_Uint32Required = proto.Uint32(3232)\n\tpb.F_Uint64Required = proto.Uint64(6464)\n\tpb.F_FloatRequired = proto.Float32(3232)\n\tpb.F_DoubleRequired = proto.Float64(6464)\n\tpb.F_StringRequired = proto.String(\"string\")\n\tpb.F_BytesRequired = []byte(\"bytes\")\n\tpb.F_Sint32Required = proto.Int32(-32)\n\tpb.F_Sint64Required = proto.Int64(-64)\n\tpb.F_Sfixed32Required = proto.Int32(-32)\n\tpb.F_Sfixed64Required = proto.Int64(-64)\n\tpb.Requiredgroup = initGoTest_RequiredGroup()\n\n\treturn pb\n}\n\nfunc overify(t *testing.T, pb *pb2.GoTest, want []byte) {\n\tbb := new(proto.Buffer)\n\terr := bb.Marshal(pb)\n\tgot := bb.Bytes()\n\tif err != nil {\n\t\tt.Logf(\"overify marshal-1 err = %v\", err)\n\t}\n\tif !bytes.Equal(got, want) {\n\t\tt.Fatalf(\"got %q\\nwant  %q\", got, want)\n\t}\n\n\t// Now test Unmarshal by recreating the original buffer.\n\tpbd := new(pb2.GoTest)\n\terr = bb.Unmarshal(pbd)\n\tif err != nil {\n\t\tt.Fatalf(\"overify unmarshal err = %v\", err)\n\t}\n\tbb.Reset()\n\terr = bb.Marshal(pbd)\n\tgot = bb.Bytes()\n\tif err != nil {\n\t\tt.Fatalf(\"overify marshal-2 err = %v\", err)\n\t}\n\tif !bytes.Equal(got, want) {\n\t\tt.Fatalf(\"got %q\\nwant  %q\", got, want)\n\t}\n}\n\n// When hooks are enabled, RequiredNotSetError is typed alias to internal/proto\n// package. Binary serialization has not been wrapped yet and hence produces\n// requiredNotSetError instead. This function is a work-around to identify both\n// aliased and non-aliased types.\nfunc isRequiredNotSetError(err error) bool {\n\te, ok := err.(interface{ RequiredNotSet() bool })\n\treturn ok && e.RequiredNotSet()\n}\n\n// Simple tests for numeric encode/decode primitives (varint, etc.)\nfunc TestNumericPrimitives(t *testing.T) {\n\tfor i := uint64(0); i < 1e6; i += 111 {\n\t\to := new(proto.Buffer)\n\t\tif o.EncodeVarint(i) != nil {\n\t\t\tt.Error(\"EncodeVarint\")\n\t\t\tbreak\n\t\t}\n\t\tx, e := o.DecodeVarint()\n\t\tif e != nil {\n\t\t\tt.Fatal(\"DecodeVarint\")\n\t\t}\n\t\tif x != i {\n\t\t\tt.Fatal(\"varint decode fail:\", i, x)\n\t\t}\n\n\t\to.Reset()\n\t\tif o.EncodeFixed32(i) != nil {\n\t\t\tt.Fatal(\"encFixed32\")\n\t\t}\n\t\tx, e = o.DecodeFixed32()\n\t\tif e != nil {\n\t\t\tt.Fatal(\"decFixed32\")\n\t\t}\n\t\tif x != i {\n\t\t\tt.Fatal(\"fixed32 decode fail:\", i, x)\n\t\t}\n\n\t\to.Reset()\n\t\tif o.EncodeFixed64(i*1234567) != nil {\n\t\t\tt.Error(\"encFixed64\")\n\t\t\tbreak\n\t\t}\n\t\tx, e = o.DecodeFixed64()\n\t\tif e != nil {\n\t\t\tt.Error(\"decFixed64\")\n\t\t\tbreak\n\t\t}\n\t\tif x != i*1234567 {\n\t\t\tt.Error(\"fixed64 decode fail:\", i*1234567, x)\n\t\t\tbreak\n\t\t}\n\n\t\to.Reset()\n\t\ti32 := int32(i - 12345)\n\t\tif o.EncodeZigzag32(uint64(i32)) != nil {\n\t\t\tt.Fatal(\"EncodeZigzag32\")\n\t\t}\n\t\tx, e = o.DecodeZigzag32()\n\t\tif e != nil {\n\t\t\tt.Fatal(\"DecodeZigzag32\")\n\t\t}\n\t\tif x != uint64(uint32(i32)) {\n\t\t\tt.Fatal(\"zigzag32 decode fail:\", i32, x)\n\t\t}\n\n\t\to.Reset()\n\t\ti64 := int64(i - 12345)\n\t\tif o.EncodeZigzag64(uint64(i64)) != nil {\n\t\t\tt.Fatal(\"EncodeZigzag64\")\n\t\t}\n\t\tx, e = o.DecodeZigzag64()\n\t\tif e != nil {\n\t\t\tt.Fatal(\"DecodeZigzag64\")\n\t\t}\n\t\tif x != uint64(i64) {\n\t\t\tt.Fatal(\"zigzag64 decode fail:\", i64, x)\n\t\t}\n\t}\n}\n\n// fakeMarshaler is a simple struct implementing Marshaler and Message interfaces.\ntype fakeMarshaler struct {\n\tb   []byte\n\terr error\n}\n\nfunc (f *fakeMarshaler) Marshal() ([]byte, error) { return f.b, f.err }\nfunc (f *fakeMarshaler) String() string           { return fmt.Sprintf(\"Bytes: %v Error: %v\", f.b, f.err) }\nfunc (f *fakeMarshaler) ProtoMessage()            {}\nfunc (f *fakeMarshaler) Reset()                   {}\n\ntype msgWithFakeMarshaler struct {\n\tM *fakeMarshaler `protobuf:\"bytes,1,opt,name=fake\"`\n}\n\nfunc (m *msgWithFakeMarshaler) String() string { return proto.CompactTextString(m) }\nfunc (m *msgWithFakeMarshaler) ProtoMessage()  {}\nfunc (m *msgWithFakeMarshaler) Reset()         {}\n\n// Simple tests for proto messages that implement the Marshaler interface.\nfunc TestMarshalerEncoding(t *testing.T) {\n\ttests := []struct {\n\t\tname    string\n\t\tm       proto.Message\n\t\twant    []byte\n\t\terrType reflect.Type\n\t}{\n\t\t{\n\t\t\tname: \"Marshaler that fails\",\n\t\t\tm: &fakeMarshaler{\n\t\t\t\terr: errors.New(\"some marshal err\"),\n\t\t\t\tb:   []byte{5, 6, 7},\n\t\t\t},\n\t\t\terrType: reflect.TypeOf(errors.New(\"some marshal err\")),\n\t\t},\n\t\t{\n\t\t\tname: \"Marshaler that fails with RequiredNotSetError\",\n\t\t\tm: &msgWithFakeMarshaler{\n\t\t\t\tM: &fakeMarshaler{\n\t\t\t\t\terr: &proto.RequiredNotSetError{},\n\t\t\t\t\tb:   []byte{5, 6, 7},\n\t\t\t\t},\n\t\t\t},\n\t\t\terrType: reflect.TypeOf(&proto.RequiredNotSetError{}),\n\t\t},\n\t\t{\n\t\t\tname: \"Marshaler that succeeds\",\n\t\t\tm: &fakeMarshaler{\n\t\t\t\tb: []byte{0, 1, 2, 3, 4, 127, 255},\n\t\t\t},\n\t\t\twant: []byte{0, 1, 2, 3, 4, 127, 255},\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tb := proto.NewBuffer(nil)\n\t\t\terr := b.Marshal(test.m)\n\t\t\tif reflect.TypeOf(err) != test.errType {\n\t\t\t\tt.Errorf(\"got err %T(%v) wanted %T\", err, err, test.errType)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn // skip comparing output when marshal fails.\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(test.want, b.Bytes()) {\n\t\t\t\tt.Errorf(\"got bytes %v wanted %v\", b.Bytes(), test.want)\n\t\t\t}\n\t\t\tif size := proto.Size(test.m); size != len(b.Bytes()) {\n\t\t\t\tt.Errorf(\"Size(_) = %v, but marshaled to %v bytes\", size, len(b.Bytes()))\n\t\t\t}\n\n\t\t\tm, mErr := proto.Marshal(test.m)\n\t\t\tif !bytes.Equal(b.Bytes(), m) {\n\t\t\t\tt.Errorf(\"Marshal returned %v, but (*Buffer).Marshal wrote %v\", m, b.Bytes())\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(err, mErr) {\n\t\t\t\tt.Errorf(\"Marshal err = %v, but (*Buffer).Marshal returned %v\", mErr, err)\n\t\t\t}\n\t\t})\n\t}\n}\n\n// Ensure that Buffer.Marshal uses O(N) memory for N messages\nfunc TestBufferMarshalAllocs(t *testing.T) {\n\tvalue := &pb2.OtherMessage{Key: proto.Int64(1)}\n\tmsg := &pb2.MyMessage{Count: proto.Int32(1), Others: []*pb2.OtherMessage{value}}\n\n\tfor _, prealloc := range []int{0, 100, 10000} {\n\t\tconst count = 1000\n\t\tvar b proto.Buffer\n\t\ts := make([]byte, 0, proto.Size(msg))\n\t\tmarshalAllocs := testing.AllocsPerRun(count, func() {\n\t\t\tb.SetBuf(s)\n\t\t\terr := b.Marshal(msg)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Marshal err = %q\", err)\n\t\t\t}\n\t\t})\n\n\t\tb.SetBuf(make([]byte, 0, prealloc))\n\t\tbufferAllocs := testing.AllocsPerRun(count, func() {\n\t\t\terr := b.Marshal(msg)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Marshal err = %q\", err)\n\t\t\t}\n\t\t})\n\n\t\tif marshalAllocs != bufferAllocs {\n\t\t\tt.Errorf(\"%v allocs/op when writing to a preallocated buffer\", marshalAllocs)\n\t\t\tt.Errorf(\"%v allocs/op when repeatedly appending to a buffer\", bufferAllocs)\n\t\t\tt.Errorf(\"expect amortized allocs/op to be identical\")\n\t\t}\n\t}\n}\n\n// Simple tests for bytes\nfunc TestBytesPrimitives(t *testing.T) {\n\tbb := new(proto.Buffer)\n\twant := []byte(\"now is the time\")\n\tif err := bb.EncodeRawBytes(want); err != nil {\n\t\tt.Errorf(\"EncodeRawBytes error: %v\", err)\n\t}\n\tgot, err := bb.DecodeRawBytes(false)\n\tif err != nil {\n\t\tt.Errorf(\"DecodeRawBytes error: %v\", err)\n\t}\n\tif !bytes.Equal(got, want) {\n\t\tt.Errorf(\"got %q\\nwant  %q\", got, want)\n\t}\n}\n\n// Simple tests for strings\nfunc TestStringPrimitives(t *testing.T) {\n\tbb := new(proto.Buffer)\n\twant := \"now is the time\"\n\tif err := bb.EncodeStringBytes(want); err != nil {\n\t\tt.Errorf(\"EncodeStringBytes error: %v\", err)\n\t}\n\tgot, err := bb.DecodeStringBytes()\n\tif err != nil {\n\t\tt.Errorf(\"DecodeStringBytes error: %v\", err)\n\t}\n\tif got != want {\n\t\tt.Errorf(\"got %q\\nwant  %q\", got, want)\n\t}\n}\n\n// Do we catch the \"required bit not set\" case?\nfunc TestRequiredBit(t *testing.T) {\n\to := new(proto.Buffer)\n\tpb := new(pb2.GoTest)\n\terr := o.Marshal(pb)\n\tif err == nil {\n\t\tt.Error(\"did not catch missing required fields\")\n\t} else if !strings.Contains(err.Error(), \"Kind\") {\n\t\tt.Error(\"wrong error type:\", err)\n\t}\n}\n\n// Check that all fields are nil.\n// Clearly silly, and a residue from a more interesting test with an earlier,\n// different initialization property, but it once caught a compiler bug so\n// it lives.\nfunc checkInitialized(pb *pb2.GoTest, t *testing.T) {\n\tswitch {\n\tcase pb.F_BoolDefaulted != nil:\n\t\tt.Error(\"New or Reset did not set boolean:\", *pb.F_BoolDefaulted)\n\tcase pb.F_Int32Defaulted != nil:\n\t\tt.Error(\"New or Reset did not set int32:\", *pb.F_Int32Defaulted)\n\tcase pb.F_Int64Defaulted != nil:\n\t\tt.Error(\"New or Reset did not set int64:\", *pb.F_Int64Defaulted)\n\tcase pb.F_Fixed32Defaulted != nil:\n\t\tt.Error(\"New or Reset did not set fixed32:\", *pb.F_Fixed32Defaulted)\n\tcase pb.F_Fixed64Defaulted != nil:\n\t\tt.Error(\"New or Reset did not set fixed64:\", *pb.F_Fixed64Defaulted)\n\tcase pb.F_Uint32Defaulted != nil:\n\t\tt.Error(\"New or Reset did not set uint32:\", *pb.F_Uint32Defaulted)\n\tcase pb.F_Uint64Defaulted != nil:\n\t\tt.Error(\"New or Reset did not set uint64:\", *pb.F_Uint64Defaulted)\n\tcase pb.F_FloatDefaulted != nil:\n\t\tt.Error(\"New or Reset did not set float:\", *pb.F_FloatDefaulted)\n\tcase pb.F_DoubleDefaulted != nil:\n\t\tt.Error(\"New or Reset did not set double:\", *pb.F_DoubleDefaulted)\n\tcase pb.F_StringDefaulted != nil:\n\t\tt.Error(\"New or Reset did not set string:\", *pb.F_StringDefaulted)\n\tcase pb.F_BytesDefaulted != nil:\n\t\tt.Error(\"New or Reset did not set bytes:\", string(pb.F_BytesDefaulted))\n\tcase pb.F_Sint32Defaulted != nil:\n\t\tt.Error(\"New or Reset did not set int32:\", *pb.F_Sint32Defaulted)\n\tcase pb.F_Sint64Defaulted != nil:\n\t\tt.Error(\"New or Reset did not set int64:\", *pb.F_Sint64Defaulted)\n\t}\n}\n\n// Does Reset() reset?\nfunc TestReset(t *testing.T) {\n\tpb := initGoTest(true)\n\t// muck with some values\n\tpb.F_BoolDefaulted = proto.Bool(false)\n\tpb.F_Int32Defaulted = proto.Int32(237)\n\tpb.F_Int64Defaulted = proto.Int64(12346)\n\tpb.F_Fixed32Defaulted = proto.Uint32(32000)\n\tpb.F_Fixed64Defaulted = proto.Uint64(666)\n\tpb.F_Uint32Defaulted = proto.Uint32(323232)\n\tpb.F_Uint64Defaulted = nil\n\tpb.F_FloatDefaulted = nil\n\tpb.F_DoubleDefaulted = proto.Float64(0)\n\tpb.F_StringDefaulted = proto.String(\"gotcha\")\n\tpb.F_BytesDefaulted = []byte(\"asdfasdf\")\n\tpb.F_Sint32Defaulted = proto.Int32(123)\n\tpb.F_Sint64Defaulted = proto.Int64(789)\n\tpb.Reset()\n\tcheckInitialized(pb, t)\n}\n\n// All required fields set, no defaults provided.\nfunc TestEncodeDecode1(t *testing.T) {\n\tpb := initGoTest(false)\n\toverify(t, pb,\n\t\tprotopack.Message{\n\t\t\tprotopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7),\n\t\t\tprotopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.String(\"label\"),\n\t\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"type\"),\n\t\t\t}),\n\t\t\tprotopack.Tag{10, protopack.VarintType}, protopack.Bool(true),\n\t\t\tprotopack.Tag{11, protopack.VarintType}, protopack.Varint(3),\n\t\t\tprotopack.Tag{12, protopack.VarintType}, protopack.Varint(6),\n\t\t\tprotopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32),\n\t\t\tprotopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64),\n\t\t\tprotopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232),\n\t\t\tprotopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464),\n\t\t\tprotopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232),\n\t\t\tprotopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464),\n\t\t\tprotopack.Tag{19, protopack.BytesType}, protopack.String(\"string\"),\n\t\t\tprotopack.Tag{70, protopack.StartGroupType},\n\t\t\tprotopack.Message{\n\t\t\t\tprotopack.Tag{71, protopack.BytesType}, protopack.String(\"required\"),\n\t\t\t},\n\t\t\tprotopack.Tag{70, protopack.EndGroupType},\n\t\t\tprotopack.Tag{101, protopack.BytesType}, protopack.Bytes(\"bytes\"),\n\t\t\tprotopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32),\n\t\t\tprotopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64),\n\t\t\tprotopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32),\n\t\t\tprotopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64),\n\t\t}.Marshal())\n}\n\n// All required fields set, defaults provided.\nfunc TestEncodeDecode2(t *testing.T) {\n\tpb := initGoTest(true)\n\toverify(t, pb,\n\t\tprotopack.Message{\n\t\t\tprotopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7),\n\t\t\tprotopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.String(\"label\"),\n\t\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"type\"),\n\t\t\t}),\n\t\t\tprotopack.Tag{10, protopack.VarintType}, protopack.Bool(true),\n\t\t\tprotopack.Tag{11, protopack.VarintType}, protopack.Varint(3),\n\t\t\tprotopack.Tag{12, protopack.VarintType}, protopack.Varint(6),\n\t\t\tprotopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32),\n\t\t\tprotopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64),\n\t\t\tprotopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232),\n\t\t\tprotopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464),\n\t\t\tprotopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232),\n\t\t\tprotopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464),\n\t\t\tprotopack.Tag{19, protopack.BytesType}, protopack.String(\"string\"),\n\t\t\tprotopack.Tag{40, protopack.VarintType}, protopack.Bool(true),\n\t\t\tprotopack.Tag{41, protopack.VarintType}, protopack.Varint(32),\n\t\t\tprotopack.Tag{42, protopack.VarintType}, protopack.Varint(64),\n\t\t\tprotopack.Tag{43, protopack.Fixed32Type}, protopack.Uint32(320),\n\t\t\tprotopack.Tag{44, protopack.Fixed64Type}, protopack.Uint64(640),\n\t\t\tprotopack.Tag{45, protopack.VarintType}, protopack.Uvarint(3200),\n\t\t\tprotopack.Tag{46, protopack.VarintType}, protopack.Uvarint(6400),\n\t\t\tprotopack.Tag{47, protopack.Fixed32Type}, protopack.Float32(314159),\n\t\t\tprotopack.Tag{48, protopack.Fixed64Type}, protopack.Float64(271828),\n\t\t\tprotopack.Tag{49, protopack.BytesType}, protopack.String(\"hello, \\\"world!\\\"\\n\"),\n\t\t\tprotopack.Tag{70, protopack.StartGroupType},\n\t\t\tprotopack.Message{\n\t\t\t\tprotopack.Tag{71, protopack.BytesType}, protopack.String(\"required\"),\n\t\t\t},\n\t\t\tprotopack.Tag{70, protopack.EndGroupType},\n\t\t\tprotopack.Tag{101, protopack.BytesType}, protopack.Bytes(\"bytes\"),\n\t\t\tprotopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32),\n\t\t\tprotopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64),\n\t\t\tprotopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32),\n\t\t\tprotopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64),\n\t\t\tprotopack.Tag{401, protopack.BytesType}, protopack.Bytes(\"Bignose\"),\n\t\t\tprotopack.Tag{402, protopack.VarintType}, protopack.Svarint(-32),\n\t\t\tprotopack.Tag{403, protopack.VarintType}, protopack.Svarint(-64),\n\t\t\tprotopack.Tag{404, protopack.Fixed32Type}, protopack.Int32(-32),\n\t\t\tprotopack.Tag{405, protopack.Fixed64Type}, protopack.Int64(-64),\n\t\t}.Marshal())\n}\n\n// All default fields set to their default value by hand\nfunc TestEncodeDecode3(t *testing.T) {\n\tpb := initGoTest(false)\n\tpb.F_BoolDefaulted = proto.Bool(true)\n\tpb.F_Int32Defaulted = proto.Int32(32)\n\tpb.F_Int64Defaulted = proto.Int64(64)\n\tpb.F_Fixed32Defaulted = proto.Uint32(320)\n\tpb.F_Fixed64Defaulted = proto.Uint64(640)\n\tpb.F_Uint32Defaulted = proto.Uint32(3200)\n\tpb.F_Uint64Defaulted = proto.Uint64(6400)\n\tpb.F_FloatDefaulted = proto.Float32(314159)\n\tpb.F_DoubleDefaulted = proto.Float64(271828)\n\tpb.F_StringDefaulted = proto.String(\"hello, \\\"world!\\\"\\n\")\n\tpb.F_BytesDefaulted = []byte(\"Bignose\")\n\tpb.F_Sint32Defaulted = proto.Int32(-32)\n\tpb.F_Sint64Defaulted = proto.Int64(-64)\n\tpb.F_Sfixed32Defaulted = proto.Int32(-32)\n\tpb.F_Sfixed64Defaulted = proto.Int64(-64)\n\n\toverify(t, pb,\n\t\tprotopack.Message{\n\t\t\tprotopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7),\n\t\t\tprotopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.String(\"label\"),\n\t\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"type\"),\n\t\t\t}),\n\t\t\tprotopack.Tag{10, protopack.VarintType}, protopack.Bool(true),\n\t\t\tprotopack.Tag{11, protopack.VarintType}, protopack.Varint(3),\n\t\t\tprotopack.Tag{12, protopack.VarintType}, protopack.Varint(6),\n\t\t\tprotopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32),\n\t\t\tprotopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64),\n\t\t\tprotopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232),\n\t\t\tprotopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464),\n\t\t\tprotopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232),\n\t\t\tprotopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464),\n\t\t\tprotopack.Tag{19, protopack.BytesType}, protopack.String(\"string\"),\n\t\t\tprotopack.Tag{40, protopack.VarintType}, protopack.Bool(true),\n\t\t\tprotopack.Tag{41, protopack.VarintType}, protopack.Varint(32),\n\t\t\tprotopack.Tag{42, protopack.VarintType}, protopack.Varint(64),\n\t\t\tprotopack.Tag{43, protopack.Fixed32Type}, protopack.Uint32(320),\n\t\t\tprotopack.Tag{44, protopack.Fixed64Type}, protopack.Uint64(640),\n\t\t\tprotopack.Tag{45, protopack.VarintType}, protopack.Uvarint(3200),\n\t\t\tprotopack.Tag{46, protopack.VarintType}, protopack.Uvarint(6400),\n\t\t\tprotopack.Tag{47, protopack.Fixed32Type}, protopack.Float32(314159),\n\t\t\tprotopack.Tag{48, protopack.Fixed64Type}, protopack.Float64(271828),\n\t\t\tprotopack.Tag{49, protopack.BytesType}, protopack.String(\"hello, \\\"world!\\\"\\n\"),\n\t\t\tprotopack.Tag{70, protopack.StartGroupType},\n\t\t\tprotopack.Message{\n\t\t\t\tprotopack.Tag{71, protopack.BytesType}, protopack.String(\"required\"),\n\t\t\t},\n\t\t\tprotopack.Tag{70, protopack.EndGroupType},\n\t\t\tprotopack.Tag{101, protopack.BytesType}, protopack.Bytes(\"bytes\"),\n\t\t\tprotopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32),\n\t\t\tprotopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64),\n\t\t\tprotopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32),\n\t\t\tprotopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64),\n\t\t\tprotopack.Tag{401, protopack.BytesType}, protopack.Bytes(\"Bignose\"),\n\t\t\tprotopack.Tag{402, protopack.VarintType}, protopack.Svarint(-32),\n\t\t\tprotopack.Tag{403, protopack.VarintType}, protopack.Svarint(-64),\n\t\t\tprotopack.Tag{404, protopack.Fixed32Type}, protopack.Int32(-32),\n\t\t\tprotopack.Tag{405, protopack.Fixed64Type}, protopack.Int64(-64),\n\t\t}.Marshal())\n}\n\n// All required fields set, defaults provided, all non-defaulted optional fields have values.\nfunc TestEncodeDecode4(t *testing.T) {\n\tpb := initGoTest(true)\n\tpb.Table = proto.String(\"hello\")\n\tpb.Param = proto.Int32(7)\n\tpb.OptionalField = initGoTestField()\n\tpb.F_BoolOptional = proto.Bool(true)\n\tpb.F_Int32Optional = proto.Int32(32)\n\tpb.F_Int64Optional = proto.Int64(64)\n\tpb.F_Fixed32Optional = proto.Uint32(3232)\n\tpb.F_Fixed64Optional = proto.Uint64(6464)\n\tpb.F_Uint32Optional = proto.Uint32(323232)\n\tpb.F_Uint64Optional = proto.Uint64(646464)\n\tpb.F_FloatOptional = proto.Float32(32.)\n\tpb.F_DoubleOptional = proto.Float64(64.)\n\tpb.F_StringOptional = proto.String(\"hello\")\n\tpb.F_BytesOptional = []byte(\"Bignose\")\n\tpb.F_Sint32Optional = proto.Int32(-32)\n\tpb.F_Sint64Optional = proto.Int64(-64)\n\tpb.F_Sfixed32Optional = proto.Int32(-32)\n\tpb.F_Sfixed64Optional = proto.Int64(-64)\n\tpb.Optionalgroup = initGoTest_OptionalGroup()\n\n\toverify(t, pb,\n\t\tprotopack.Message{\n\t\t\tprotopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7),\n\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"hello\"),\n\t\t\tprotopack.Tag{3, protopack.VarintType}, protopack.Varint(7),\n\t\t\tprotopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.String(\"label\"),\n\t\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"type\"),\n\t\t\t}),\n\t\t\tprotopack.Tag{6, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.String(\"label\"),\n\t\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"type\"),\n\t\t\t}),\n\t\t\tprotopack.Tag{10, protopack.VarintType}, protopack.Bool(true),\n\t\t\tprotopack.Tag{11, protopack.VarintType}, protopack.Varint(3),\n\t\t\tprotopack.Tag{12, protopack.VarintType}, protopack.Varint(6),\n\t\t\tprotopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32),\n\t\t\tprotopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64),\n\t\t\tprotopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232),\n\t\t\tprotopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464),\n\t\t\tprotopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232),\n\t\t\tprotopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464),\n\t\t\tprotopack.Tag{19, protopack.BytesType}, protopack.String(\"string\"),\n\t\t\tprotopack.Tag{30, protopack.VarintType}, protopack.Bool(true),\n\t\t\tprotopack.Tag{31, protopack.VarintType}, protopack.Varint(32),\n\t\t\tprotopack.Tag{32, protopack.VarintType}, protopack.Varint(64),\n\t\t\tprotopack.Tag{33, protopack.Fixed32Type}, protopack.Uint32(3232),\n\t\t\tprotopack.Tag{34, protopack.Fixed64Type}, protopack.Uint64(6464),\n\t\t\tprotopack.Tag{35, protopack.VarintType}, protopack.Uvarint(323232),\n\t\t\tprotopack.Tag{36, protopack.VarintType}, protopack.Uvarint(646464),\n\t\t\tprotopack.Tag{37, protopack.Fixed32Type}, protopack.Float32(32),\n\t\t\tprotopack.Tag{38, protopack.Fixed64Type}, protopack.Float64(64),\n\t\t\tprotopack.Tag{39, protopack.BytesType}, protopack.String(\"hello\"),\n\t\t\tprotopack.Tag{40, protopack.VarintType}, protopack.Bool(true),\n\t\t\tprotopack.Tag{41, protopack.VarintType}, protopack.Varint(32),\n\t\t\tprotopack.Tag{42, protopack.VarintType}, protopack.Varint(64),\n\t\t\tprotopack.Tag{43, protopack.Fixed32Type}, protopack.Uint32(320),\n\t\t\tprotopack.Tag{44, protopack.Fixed64Type}, protopack.Uint64(640),\n\t\t\tprotopack.Tag{45, protopack.VarintType}, protopack.Uvarint(3200),\n\t\t\tprotopack.Tag{46, protopack.VarintType}, protopack.Uvarint(6400),\n\t\t\tprotopack.Tag{47, protopack.Fixed32Type}, protopack.Float32(314159),\n\t\t\tprotopack.Tag{48, protopack.Fixed64Type}, protopack.Float64(271828),\n\t\t\tprotopack.Tag{49, protopack.BytesType}, protopack.String(\"hello, \\\"world!\\\"\\n\"),\n\t\t\tprotopack.Tag{70, protopack.StartGroupType},\n\t\t\tprotopack.Message{\n\t\t\t\tprotopack.Tag{71, protopack.BytesType}, protopack.String(\"required\"),\n\t\t\t},\n\t\t\tprotopack.Tag{70, protopack.EndGroupType},\n\t\t\tprotopack.Tag{90, protopack.StartGroupType},\n\t\t\tprotopack.Message{\n\t\t\t\tprotopack.Tag{91, protopack.BytesType}, protopack.String(\"optional\"),\n\t\t\t},\n\t\t\tprotopack.Tag{90, protopack.EndGroupType},\n\t\t\tprotopack.Tag{101, protopack.BytesType}, protopack.Bytes(\"bytes\"),\n\t\t\tprotopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32),\n\t\t\tprotopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64),\n\t\t\tprotopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32),\n\t\t\tprotopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64),\n\t\t\tprotopack.Tag{301, protopack.BytesType}, protopack.Bytes(\"Bignose\"),\n\t\t\tprotopack.Tag{302, protopack.VarintType}, protopack.Svarint(-32),\n\t\t\tprotopack.Tag{303, protopack.VarintType}, protopack.Svarint(-64),\n\t\t\tprotopack.Tag{304, protopack.Fixed32Type}, protopack.Int32(-32),\n\t\t\tprotopack.Tag{305, protopack.Fixed64Type}, protopack.Int64(-64),\n\t\t\tprotopack.Tag{401, protopack.BytesType}, protopack.Bytes(\"Bignose\"),\n\t\t\tprotopack.Tag{402, protopack.VarintType}, protopack.Svarint(-32),\n\t\t\tprotopack.Tag{403, protopack.VarintType}, protopack.Svarint(-64),\n\t\t\tprotopack.Tag{404, protopack.Fixed32Type}, protopack.Int32(-32),\n\t\t\tprotopack.Tag{405, protopack.Fixed64Type}, protopack.Int64(-64),\n\t\t}.Marshal())\n}\n\n// All required fields set, defaults provided, all repeated fields given two values.\nfunc TestEncodeDecode5(t *testing.T) {\n\tpb := initGoTest(true)\n\tpb.RepeatedField = []*pb2.GoTestField{initGoTestField(), initGoTestField()}\n\tpb.F_BoolRepeated = []bool{false, true}\n\tpb.F_Int32Repeated = []int32{32, 33}\n\tpb.F_Int64Repeated = []int64{64, 65}\n\tpb.F_Fixed32Repeated = []uint32{3232, 3333}\n\tpb.F_Fixed64Repeated = []uint64{6464, 6565}\n\tpb.F_Uint32Repeated = []uint32{323232, 333333}\n\tpb.F_Uint64Repeated = []uint64{646464, 656565}\n\tpb.F_FloatRepeated = []float32{32., 33.}\n\tpb.F_DoubleRepeated = []float64{64., 65.}\n\tpb.F_StringRepeated = []string{\"hello\", \"sailor\"}\n\tpb.F_BytesRepeated = [][]byte{[]byte(\"big\"), []byte(\"nose\")}\n\tpb.F_Sint32Repeated = []int32{32, -32}\n\tpb.F_Sint64Repeated = []int64{64, -64}\n\tpb.F_Sfixed32Repeated = []int32{32, -32}\n\tpb.F_Sfixed64Repeated = []int64{64, -64}\n\tpb.Repeatedgroup = []*pb2.GoTest_RepeatedGroup{initGoTest_RepeatedGroup(), initGoTest_RepeatedGroup()}\n\n\toverify(t, pb,\n\t\tprotopack.Message{\n\t\t\tprotopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7),\n\t\t\tprotopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.String(\"label\"),\n\t\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"type\"),\n\t\t\t}),\n\t\t\tprotopack.Tag{5, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.String(\"label\"),\n\t\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"type\"),\n\t\t\t}),\n\t\t\tprotopack.Tag{5, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.String(\"label\"),\n\t\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"type\"),\n\t\t\t}),\n\t\t\tprotopack.Tag{10, protopack.VarintType}, protopack.Bool(true),\n\t\t\tprotopack.Tag{11, protopack.VarintType}, protopack.Varint(3),\n\t\t\tprotopack.Tag{12, protopack.VarintType}, protopack.Varint(6),\n\t\t\tprotopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32),\n\t\t\tprotopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64),\n\t\t\tprotopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232),\n\t\t\tprotopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464),\n\t\t\tprotopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232),\n\t\t\tprotopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464),\n\t\t\tprotopack.Tag{19, protopack.BytesType}, protopack.String(\"string\"),\n\t\t\tprotopack.Tag{20, protopack.VarintType}, protopack.Bool(false),\n\t\t\tprotopack.Tag{20, protopack.VarintType}, protopack.Bool(true),\n\t\t\tprotopack.Tag{21, protopack.VarintType}, protopack.Varint(32),\n\t\t\tprotopack.Tag{21, protopack.VarintType}, protopack.Varint(33),\n\t\t\tprotopack.Tag{22, protopack.VarintType}, protopack.Varint(64),\n\t\t\tprotopack.Tag{22, protopack.VarintType}, protopack.Varint(65),\n\t\t\tprotopack.Tag{23, protopack.Fixed32Type}, protopack.Uint32(3232),\n\t\t\tprotopack.Tag{23, protopack.Fixed32Type}, protopack.Uint32(3333),\n\t\t\tprotopack.Tag{24, protopack.Fixed64Type}, protopack.Uint64(6464),\n\t\t\tprotopack.Tag{24, protopack.Fixed64Type}, protopack.Uint64(6565),\n\t\t\tprotopack.Tag{25, protopack.VarintType}, protopack.Uvarint(323232),\n\t\t\tprotopack.Tag{25, protopack.VarintType}, protopack.Uvarint(333333),\n\t\t\tprotopack.Tag{26, protopack.VarintType}, protopack.Uvarint(646464),\n\t\t\tprotopack.Tag{26, protopack.VarintType}, protopack.Uvarint(656565),\n\t\t\tprotopack.Tag{27, protopack.Fixed32Type}, protopack.Float32(32),\n\t\t\tprotopack.Tag{27, protopack.Fixed32Type}, protopack.Float32(33),\n\t\t\tprotopack.Tag{28, protopack.Fixed64Type}, protopack.Float64(64),\n\t\t\tprotopack.Tag{28, protopack.Fixed64Type}, protopack.Float64(65),\n\t\t\tprotopack.Tag{29, protopack.BytesType}, protopack.String(\"hello\"),\n\t\t\tprotopack.Tag{29, protopack.BytesType}, protopack.String(\"sailor\"),\n\t\t\tprotopack.Tag{40, protopack.VarintType}, protopack.Bool(true),\n\t\t\tprotopack.Tag{41, protopack.VarintType}, protopack.Varint(32),\n\t\t\tprotopack.Tag{42, protopack.VarintType}, protopack.Varint(64),\n\t\t\tprotopack.Tag{43, protopack.Fixed32Type}, protopack.Uint32(320),\n\t\t\tprotopack.Tag{44, protopack.Fixed64Type}, protopack.Uint64(640),\n\t\t\tprotopack.Tag{45, protopack.VarintType}, protopack.Uvarint(3200),\n\t\t\tprotopack.Tag{46, protopack.VarintType}, protopack.Uvarint(6400),\n\t\t\tprotopack.Tag{47, protopack.Fixed32Type}, protopack.Float32(314159),\n\t\t\tprotopack.Tag{48, protopack.Fixed64Type}, protopack.Float64(271828),\n\t\t\tprotopack.Tag{49, protopack.BytesType}, protopack.String(\"hello, \\\"world!\\\"\\n\"),\n\t\t\tprotopack.Tag{70, protopack.StartGroupType},\n\t\t\tprotopack.Message{\n\t\t\t\tprotopack.Tag{71, protopack.BytesType}, protopack.String(\"required\"),\n\t\t\t},\n\t\t\tprotopack.Tag{70, protopack.EndGroupType},\n\t\t\tprotopack.Tag{80, protopack.StartGroupType},\n\t\t\tprotopack.Message{\n\t\t\t\tprotopack.Tag{81, protopack.BytesType}, protopack.String(\"repeated\"),\n\t\t\t},\n\t\t\tprotopack.Tag{80, protopack.EndGroupType},\n\t\t\tprotopack.Tag{80, protopack.StartGroupType},\n\t\t\tprotopack.Message{\n\t\t\t\tprotopack.Tag{81, protopack.BytesType}, protopack.String(\"repeated\"),\n\t\t\t},\n\t\t\tprotopack.Tag{80, protopack.EndGroupType},\n\t\t\tprotopack.Tag{101, protopack.BytesType}, protopack.Bytes(\"bytes\"),\n\t\t\tprotopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32),\n\t\t\tprotopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64),\n\t\t\tprotopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32),\n\t\t\tprotopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64),\n\t\t\tprotopack.Tag{201, protopack.BytesType}, protopack.Bytes(\"big\"),\n\t\t\tprotopack.Tag{201, protopack.BytesType}, protopack.Bytes(\"nose\"),\n\t\t\tprotopack.Tag{202, protopack.VarintType}, protopack.Svarint(32),\n\t\t\tprotopack.Tag{202, protopack.VarintType}, protopack.Svarint(-32),\n\t\t\tprotopack.Tag{203, protopack.VarintType}, protopack.Svarint(64),\n\t\t\tprotopack.Tag{203, protopack.VarintType}, protopack.Svarint(-64),\n\t\t\tprotopack.Tag{204, protopack.Fixed32Type}, protopack.Int32(32),\n\t\t\tprotopack.Tag{204, protopack.Fixed32Type}, protopack.Int32(-32),\n\t\t\tprotopack.Tag{205, protopack.Fixed64Type}, protopack.Int64(64),\n\t\t\tprotopack.Tag{205, protopack.Fixed64Type}, protopack.Int64(-64),\n\t\t\tprotopack.Tag{401, protopack.BytesType}, protopack.Bytes(\"Bignose\"),\n\t\t\tprotopack.Tag{402, protopack.VarintType}, protopack.Svarint(-32),\n\t\t\tprotopack.Tag{403, protopack.VarintType}, protopack.Svarint(-64),\n\t\t\tprotopack.Tag{404, protopack.Fixed32Type}, protopack.Int32(-32),\n\t\t\tprotopack.Tag{405, protopack.Fixed64Type}, protopack.Int64(-64),\n\t\t}.Marshal())\n}\n\n// All required fields set, all packed repeated fields given two values.\nfunc TestEncodeDecode6(t *testing.T) {\n\tpb := initGoTest(false)\n\tpb.F_BoolRepeatedPacked = []bool{false, true}\n\tpb.F_Int32RepeatedPacked = []int32{32, 33}\n\tpb.F_Int64RepeatedPacked = []int64{64, 65}\n\tpb.F_Fixed32RepeatedPacked = []uint32{3232, 3333}\n\tpb.F_Fixed64RepeatedPacked = []uint64{6464, 6565}\n\tpb.F_Uint32RepeatedPacked = []uint32{323232, 333333}\n\tpb.F_Uint64RepeatedPacked = []uint64{646464, 656565}\n\tpb.F_FloatRepeatedPacked = []float32{32., 33.}\n\tpb.F_DoubleRepeatedPacked = []float64{64., 65.}\n\tpb.F_Sint32RepeatedPacked = []int32{32, -32}\n\tpb.F_Sint64RepeatedPacked = []int64{64, -64}\n\tpb.F_Sfixed32RepeatedPacked = []int32{32, -32}\n\tpb.F_Sfixed64RepeatedPacked = []int64{64, -64}\n\n\toverify(t, pb,\n\t\tprotopack.Message{\n\t\t\tprotopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7),\n\t\t\tprotopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.String(\"label\"),\n\t\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"type\"),\n\t\t\t}),\n\t\t\tprotopack.Tag{10, protopack.VarintType}, protopack.Bool(true),\n\t\t\tprotopack.Tag{11, protopack.VarintType}, protopack.Varint(3),\n\t\t\tprotopack.Tag{12, protopack.VarintType}, protopack.Varint(6),\n\t\t\tprotopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32),\n\t\t\tprotopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64),\n\t\t\tprotopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232),\n\t\t\tprotopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464),\n\t\t\tprotopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232),\n\t\t\tprotopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464),\n\t\t\tprotopack.Tag{19, protopack.BytesType}, protopack.String(\"string\"),\n\t\t\tprotopack.Tag{50, protopack.BytesType}, protopack.LengthPrefix{protopack.Bool(false), protopack.Bool(true)},\n\t\t\tprotopack.Tag{51, protopack.BytesType}, protopack.LengthPrefix{protopack.Varint(32), protopack.Varint(33)},\n\t\t\tprotopack.Tag{52, protopack.BytesType}, protopack.LengthPrefix{protopack.Varint(64), protopack.Varint(65)},\n\t\t\tprotopack.Tag{53, protopack.BytesType}, protopack.LengthPrefix{protopack.Uint32(3232), protopack.Uint32(3333)},\n\t\t\tprotopack.Tag{54, protopack.BytesType}, protopack.LengthPrefix{protopack.Uint64(6464), protopack.Uint64(6565)},\n\t\t\tprotopack.Tag{55, protopack.BytesType}, protopack.LengthPrefix{protopack.Uvarint(323232), protopack.Uvarint(333333)},\n\t\t\tprotopack.Tag{56, protopack.BytesType}, protopack.LengthPrefix{protopack.Uvarint(646464), protopack.Uvarint(656565)},\n\t\t\tprotopack.Tag{57, protopack.BytesType}, protopack.LengthPrefix{protopack.Float32(32), protopack.Float32(33)},\n\t\t\tprotopack.Tag{58, protopack.BytesType}, protopack.LengthPrefix{protopack.Float64(64), protopack.Float64(65)},\n\t\t\tprotopack.Tag{70, protopack.StartGroupType},\n\t\t\tprotopack.Message{\n\t\t\t\tprotopack.Tag{71, protopack.BytesType}, protopack.String(\"required\"),\n\t\t\t},\n\t\t\tprotopack.Tag{70, protopack.EndGroupType},\n\t\t\tprotopack.Tag{101, protopack.BytesType}, protopack.Bytes(\"bytes\"),\n\t\t\tprotopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32),\n\t\t\tprotopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64),\n\t\t\tprotopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32),\n\t\t\tprotopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64),\n\t\t\tprotopack.Tag{502, protopack.BytesType}, protopack.LengthPrefix{protopack.Svarint(32), protopack.Svarint(-32)},\n\t\t\tprotopack.Tag{503, protopack.BytesType}, protopack.LengthPrefix{protopack.Svarint(64), protopack.Svarint(-64)},\n\t\t\tprotopack.Tag{504, protopack.BytesType}, protopack.LengthPrefix{protopack.Int32(32), protopack.Int32(-32)},\n\t\t\tprotopack.Tag{505, protopack.BytesType}, protopack.LengthPrefix{protopack.Int64(64), protopack.Int64(-64)},\n\t\t}.Marshal())\n}\n\n// Test that we can encode empty bytes fields.\nfunc TestEncodeDecodeBytes1(t *testing.T) {\n\tpb := initGoTest(false)\n\n\t// Create our bytes\n\tpb.F_BytesRequired = []byte{}\n\tpb.F_BytesRepeated = [][]byte{{}}\n\tpb.F_BytesOptional = []byte{}\n\n\td, err := proto.Marshal(pb)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tpbd := new(pb2.GoTest)\n\tif err := proto.Unmarshal(d, pbd); err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif pbd.F_BytesRequired == nil || len(pbd.F_BytesRequired) != 0 {\n\t\tt.Error(\"required empty bytes field is incorrect\")\n\t}\n\tif pbd.F_BytesRepeated == nil || len(pbd.F_BytesRepeated) == 1 && pbd.F_BytesRepeated[0] == nil {\n\t\tt.Error(\"repeated empty bytes field is incorrect\")\n\t}\n\tif pbd.F_BytesOptional == nil || len(pbd.F_BytesOptional) != 0 {\n\t\tt.Error(\"optional empty bytes field is incorrect\")\n\t}\n}\n\n// Test that we encode nil-valued fields of a repeated bytes field correctly.\n// Since entries in a repeated field cannot be nil, nil must mean empty value.\nfunc TestEncodeDecodeBytes2(t *testing.T) {\n\tpb := initGoTest(false)\n\n\t// Create our bytes\n\tpb.F_BytesRepeated = [][]byte{nil}\n\n\td, err := proto.Marshal(pb)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tpbd := new(pb2.GoTest)\n\tif err := proto.Unmarshal(d, pbd); err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif len(pbd.F_BytesRepeated) != 1 || pbd.F_BytesRepeated[0] == nil {\n\t\tt.Error(\"Unexpected value for repeated bytes field\")\n\t}\n}\n\n// All required fields set, defaults provided, all repeated fields given two values.\nfunc TestSkippingUnrecognizedFields(t *testing.T) {\n\to := new(proto.Buffer)\n\tpb := initGoTestField()\n\n\t// Marshal it normally.\n\to.Marshal(pb)\n\n\t// Now new a GoSkipTest record.\n\tskip := &pb2.GoSkipTest{\n\t\tSkipInt32:   proto.Int32(32),\n\t\tSkipFixed32: proto.Uint32(3232),\n\t\tSkipFixed64: proto.Uint64(6464),\n\t\tSkipString:  proto.String(\"skipper\"),\n\t\tSkipgroup: &pb2.GoSkipTest_SkipGroup{\n\t\t\tGroupInt32:  proto.Int32(75),\n\t\t\tGroupString: proto.String(\"wxyz\"),\n\t\t},\n\t}\n\n\t// Marshal it into same buffer.\n\to.Marshal(skip)\n\n\tpbd := new(pb2.GoTestField)\n\to.Unmarshal(pbd)\n\n\t// The __unrecognized field should be a marshaling of GoSkipTest\n\tskipd := new(pb2.GoSkipTest)\n\n\to.SetBuf(pbd.XXX_unrecognized)\n\to.Unmarshal(skipd)\n\n\tswitch {\n\tcase *skipd.SkipInt32 != *skip.SkipInt32:\n\t\tt.Error(\"skip int32\", skipd.SkipInt32)\n\tcase *skipd.SkipFixed32 != *skip.SkipFixed32:\n\t\tt.Error(\"skip fixed32\", skipd.SkipFixed32)\n\tcase *skipd.SkipFixed64 != *skip.SkipFixed64:\n\t\tt.Error(\"skip fixed64\", skipd.SkipFixed64)\n\tcase *skipd.SkipString != *skip.SkipString:\n\t\tt.Error(\"skip string\", *skipd.SkipString)\n\tcase *skipd.Skipgroup.GroupInt32 != *skip.Skipgroup.GroupInt32:\n\t\tt.Error(\"skip group int32\", skipd.Skipgroup.GroupInt32)\n\tcase *skipd.Skipgroup.GroupString != *skip.Skipgroup.GroupString:\n\t\tt.Error(\"skip group string\", *skipd.Skipgroup.GroupString)\n\t}\n}\n\n// Check that unrecognized fields of a submessage are preserved.\nfunc TestSubmessageUnrecognizedFields(t *testing.T) {\n\tnm := &pb2.NewMessage{\n\t\tNested: &pb2.NewMessage_Nested{\n\t\t\tName:      proto.String(\"Nigel\"),\n\t\t\tFoodGroup: proto.String(\"carbs\"),\n\t\t},\n\t}\n\tb, err := proto.Marshal(nm)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal of NewMessage: %v\", err)\n\t}\n\n\t// Unmarshal into an OldMessage.\n\tom := new(pb2.OldMessage)\n\tif err := proto.Unmarshal(b, om); err != nil {\n\t\tt.Fatalf(\"Unmarshal to OldMessage: %v\", err)\n\t}\n\texp := &pb2.OldMessage{\n\t\tNested: &pb2.OldMessage_Nested{\n\t\t\tName: proto.String(\"Nigel\"),\n\t\t\t// normal protocol buffer users should not do this\n\t\t\tXXX_unrecognized: []byte(\"\\x12\\x05carbs\"),\n\t\t},\n\t}\n\tif !proto.Equal(om, exp) {\n\t\tt.Errorf(\"om = %v, want %v\", om, exp)\n\t}\n\n\t// Clone the OldMessage.\n\tom = proto.Clone(om).(*pb2.OldMessage)\n\tif !proto.Equal(om, exp) {\n\t\tt.Errorf(\"Clone(om) = %v, want %v\", om, exp)\n\t}\n\n\t// Marshal the OldMessage, then unmarshal it into an empty NewMessage.\n\tif b, err = proto.Marshal(om); err != nil {\n\t\tt.Fatalf(\"Marshal of OldMessage: %v\", err)\n\t}\n\tt.Logf(\"Marshal(%v) -> %q\", om, b)\n\tnm2 := new(pb2.NewMessage)\n\tif err := proto.Unmarshal(b, nm2); err != nil {\n\t\tt.Fatalf(\"Unmarshal to NewMessage: %v\", err)\n\t}\n\tif !proto.Equal(nm, nm2) {\n\t\tt.Errorf(\"NewMessage round-trip: %v => %v\", nm, nm2)\n\t}\n}\n\n// Check that an int32 field can be upgraded to an int64 field.\nfunc TestNegativeInt32(t *testing.T) {\n\tom := &pb2.OldMessage{\n\t\tNum: proto.Int32(-1),\n\t}\n\tb, err := proto.Marshal(om)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal of OldMessage: %v\", err)\n\t}\n\n\t// Check the size. It should be 11 bytes;\n\t// 1 for the field/wire type, and 10 for the negative number.\n\tif len(b) != 11 {\n\t\tt.Errorf(\"%v marshaled as %q, wanted 11 bytes\", om, b)\n\t}\n\n\t// Unmarshal into a NewMessage.\n\tnm := new(pb2.NewMessage)\n\tif err := proto.Unmarshal(b, nm); err != nil {\n\t\tt.Fatalf(\"Unmarshal to NewMessage: %v\", err)\n\t}\n\twant := &pb2.NewMessage{\n\t\tNum: proto.Int64(-1),\n\t}\n\tif !proto.Equal(nm, want) {\n\t\tt.Errorf(\"nm = %v, want %v\", nm, want)\n\t}\n}\n\n// Check that we can grow an array (repeated field) to have many elements.\n// This test doesn't depend only on our encoding; for variety, it makes sure\n// we create, encode, and decode the correct contents explicitly.  It's therefore\n// a bit messier.\n// This test also uses (and hence tests) the Marshal/Unmarshal functions\n// instead of the methods.\nfunc TestBigRepeated(t *testing.T) {\n\tpb := initGoTest(true)\n\n\t// Create the arrays\n\tconst N = 50 // Internally the library starts much smaller.\n\tpb.Repeatedgroup = make([]*pb2.GoTest_RepeatedGroup, N)\n\tpb.F_Sint64Repeated = make([]int64, N)\n\tpb.F_Sint32Repeated = make([]int32, N)\n\tpb.F_BytesRepeated = make([][]byte, N)\n\tpb.F_StringRepeated = make([]string, N)\n\tpb.F_DoubleRepeated = make([]float64, N)\n\tpb.F_FloatRepeated = make([]float32, N)\n\tpb.F_Uint64Repeated = make([]uint64, N)\n\tpb.F_Uint32Repeated = make([]uint32, N)\n\tpb.F_Fixed64Repeated = make([]uint64, N)\n\tpb.F_Fixed32Repeated = make([]uint32, N)\n\tpb.F_Int64Repeated = make([]int64, N)\n\tpb.F_Int32Repeated = make([]int32, N)\n\tpb.F_BoolRepeated = make([]bool, N)\n\tpb.RepeatedField = make([]*pb2.GoTestField, N)\n\n\t// Fill in the arrays with checkable values.\n\tigtf := initGoTestField()\n\tigtrg := initGoTest_RepeatedGroup()\n\tfor i := 0; i < N; i++ {\n\t\tpb.Repeatedgroup[i] = igtrg\n\t\tpb.F_Sint64Repeated[i] = int64(i)\n\t\tpb.F_Sint32Repeated[i] = int32(i)\n\t\ts := fmt.Sprint(i)\n\t\tpb.F_BytesRepeated[i] = []byte(s)\n\t\tpb.F_StringRepeated[i] = s\n\t\tpb.F_DoubleRepeated[i] = float64(i)\n\t\tpb.F_FloatRepeated[i] = float32(i)\n\t\tpb.F_Uint64Repeated[i] = uint64(i)\n\t\tpb.F_Uint32Repeated[i] = uint32(i)\n\t\tpb.F_Fixed64Repeated[i] = uint64(i)\n\t\tpb.F_Fixed32Repeated[i] = uint32(i)\n\t\tpb.F_Int64Repeated[i] = int64(i)\n\t\tpb.F_Int32Repeated[i] = int32(i)\n\t\tpb.F_BoolRepeated[i] = i%2 == 0\n\t\tpb.RepeatedField[i] = igtf\n\t}\n\n\t// Marshal.\n\tbuf, _ := proto.Marshal(pb)\n\n\t// Now test Unmarshal by recreating the original buffer.\n\tpbd := new(pb2.GoTest)\n\tproto.Unmarshal(buf, pbd)\n\n\t// Check the checkable values\n\tfor i := uint64(0); i < N; i++ {\n\t\tswitch {\n\t\tcase pbd.Repeatedgroup[i] == nil:\n\t\t\tt.Error(\"pbd.Repeatedgroup bad\")\n\t\tcase uint64(pbd.F_Sint64Repeated[i]) != i:\n\t\t\tt.Error(\"pbd.F_Sint64Repeated bad\", uint64(pbd.F_Sint64Repeated[i]), i)\n\t\tcase uint64(pbd.F_Sint32Repeated[i]) != i:\n\t\t\tt.Error(\"pbd.F_Sint32Repeated bad\", uint64(pbd.F_Sint32Repeated[i]), i)\n\t\tcase !bytes.Equal(pbd.F_BytesRepeated[i], []byte(fmt.Sprint(i))):\n\t\t\tt.Error(\"pbd.F_BytesRepeated bad\", pbd.F_BytesRepeated[i], i)\n\t\tcase pbd.F_StringRepeated[i] != string(fmt.Sprint(i)):\n\t\t\tt.Error(\"pbd.F_Sint32Repeated bad\", pbd.F_StringRepeated[i], i)\n\t\tcase uint64(pbd.F_DoubleRepeated[i]) != i:\n\t\t\tt.Error(\"pbd.F_DoubleRepeated bad\", uint64(pbd.F_DoubleRepeated[i]), i)\n\t\tcase uint64(pbd.F_FloatRepeated[i]) != i:\n\t\t\tt.Error(\"pbd.F_FloatRepeated bad\", uint64(pbd.F_FloatRepeated[i]), i)\n\t\tcase pbd.F_Uint64Repeated[i] != i:\n\t\t\tt.Error(\"pbd.F_Uint64Repeated bad\", pbd.F_Uint64Repeated[i], i)\n\t\tcase uint64(pbd.F_Uint32Repeated[i]) != i:\n\t\t\tt.Error(\"pbd.F_Uint32Repeated bad\", uint64(pbd.F_Uint32Repeated[i]), i)\n\t\tcase pbd.F_Fixed64Repeated[i] != i:\n\t\t\tt.Error(\"pbd.F_Fixed64Repeated bad\", pbd.F_Fixed64Repeated[i], i)\n\t\tcase uint64(pbd.F_Fixed32Repeated[i]) != i:\n\t\t\tt.Error(\"pbd.F_Fixed32Repeated bad\", uint64(pbd.F_Fixed32Repeated[i]), i)\n\t\tcase uint64(pbd.F_Int64Repeated[i]) != i:\n\t\t\tt.Error(\"pbd.F_Int64Repeated bad\", uint64(pbd.F_Int64Repeated[i]), i)\n\t\tcase uint64(pbd.F_Int32Repeated[i]) != i:\n\t\t\tt.Error(\"pbd.F_Int32Repeated bad\", uint64(pbd.F_Int32Repeated[i]), i)\n\t\tcase pbd.F_BoolRepeated[i] != (i%2 == 0):\n\t\t\tt.Error(\"pbd.F_BoolRepeated bad\", pbd.F_BoolRepeated[i], i)\n\t\tcase pbd.RepeatedField[i] == nil:\n\t\t\tt.Error(\"pbd.RepeatedField bad\")\n\t\t}\n\t}\n}\n\nfunc TestBadWireTypeUnknown(t *testing.T) {\n\tb := protopack.Message{\n\t\tprotopack.Tag{1, protopack.BytesType}, protopack.Bytes(\"x\"),\n\t\tprotopack.Tag{1, protopack.Fixed32Type}, protopack.Uint32(0),\n\t\tprotopack.Tag{1, protopack.VarintType}, protopack.Varint(11),\n\t\tprotopack.Tag{2, protopack.VarintType}, protopack.Uvarint(22),\n\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"aaa\"),\n\t\tprotopack.Tag{2, protopack.Fixed32Type}, protopack.Uint32(33),\n\t\tprotopack.Tag{4, protopack.VarintType}, protopack.Uvarint(44),\n\t\tprotopack.Tag{4, protopack.BytesType}, protopack.String(\"bbb\"),\n\t\tprotopack.Tag{4, protopack.Fixed32Type}, protopack.Uint32(55),\n\t\tprotopack.Tag{4, protopack.BytesType}, protopack.String(\"ccc\"),\n\t\tprotopack.Tag{4, protopack.Fixed64Type}, protopack.Uint64(66),\n\t\tprotopack.Tag{11, protopack.VarintType}, protopack.Uvarint(77),\n\t\tprotopack.Tag{11, protopack.BytesType}, protopack.Bytes(\"ddd\"),\n\t\tprotopack.Tag{11, protopack.Fixed64Type}, protopack.Float64(88),\n\t\tprotopack.Tag{11, protopack.Fixed32Type}, protopack.Uint32(99),\n\t}.Marshal()\n\n\tm := new(pb2.MyMessage)\n\tif err := proto.Unmarshal(b, m); err != nil {\n\t\tt.Errorf(\"unexpected Unmarshal error: %v\", err)\n\t}\n\n\tunknown := protopack.Message{\n\t\tprotopack.Tag{1, protopack.BytesType}, protopack.Bytes(\"x\"),\n\t\tprotopack.Tag{1, protopack.Fixed32Type}, protopack.Uint32(0),\n\t\tprotopack.Tag{2, protopack.VarintType}, protopack.Uvarint(22),\n\t\tprotopack.Tag{2, protopack.Fixed32Type}, protopack.Uint32(33),\n\t\tprotopack.Tag{4, protopack.VarintType}, protopack.Uvarint(44),\n\t\tprotopack.Tag{4, protopack.Fixed32Type}, protopack.Uint32(55),\n\t\tprotopack.Tag{4, protopack.Fixed64Type}, protopack.Uint64(66),\n\t\tprotopack.Tag{11, protopack.VarintType}, protopack.Uvarint(77),\n\t\tprotopack.Tag{11, protopack.BytesType}, protopack.Bytes(\"ddd\"),\n\t\tprotopack.Tag{11, protopack.Fixed32Type}, protopack.Uint32(99),\n\t}.Marshal()\n\tif !bytes.Equal(m.XXX_unrecognized, unknown) {\n\t\tt.Errorf(\"unknown bytes mismatch:\\ngot  %x\\nwant %x\", m.XXX_unrecognized, unknown)\n\t}\n\tproto.DiscardUnknown(m)\n\n\twant := &pb2.MyMessage{Count: proto.Int32(11), Name: proto.String(\"aaa\"), Pet: []string{\"bbb\", \"ccc\"}, Bigfloat: proto.Float64(88)}\n\tif !proto.Equal(m, want) {\n\t\tt.Errorf(\"message mismatch:\\ngot  %v\\nwant %v\", m, want)\n\t}\n}\n\nfunc encodeDecode(t *testing.T, in, out proto.Message, msg string) {\n\tbuf, err := proto.Marshal(in)\n\tif err != nil {\n\t\tt.Fatalf(\"failed marshaling %v: %v\", msg, err)\n\t}\n\tif err := proto.Unmarshal(buf, out); err != nil {\n\t\tt.Fatalf(\"failed unmarshaling %v: %v\", msg, err)\n\t}\n}\n\nfunc TestPackedNonPackedDecoderSwitching(t *testing.T) {\n\tnp, p := new(pb2.NonPackedTest), new(pb2.PackedTest)\n\n\t// non-packed -> packed\n\tnp.A = []int32{0, 1, 1, 2, 3, 5}\n\tencodeDecode(t, np, p, \"non-packed -> packed\")\n\tif !reflect.DeepEqual(np.A, p.B) {\n\t\tt.Errorf(\"failed non-packed -> packed; np.A=%+v, p.B=%+v\", np.A, p.B)\n\t}\n\n\t// packed -> non-packed\n\tnp.Reset()\n\tp.B = []int32{3, 1, 4, 1, 5, 9}\n\tencodeDecode(t, p, np, \"packed -> non-packed\")\n\tif !reflect.DeepEqual(p.B, np.A) {\n\t\tt.Errorf(\"failed packed -> non-packed; p.B=%+v, np.A=%+v\", p.B, np.A)\n\t}\n}\n\nfunc TestProto1RepeatedGroup(t *testing.T) {\n\tpb := &pb2.MessageList{\n\t\tMessage: []*pb2.MessageList_Message{\n\t\t\t{\n\t\t\t\tName:  proto.String(\"blah\"),\n\t\t\t\tCount: proto.Int32(7),\n\t\t\t},\n\t\t\t// NOTE: pb.Message[1] is a nil\n\t\t\tnil,\n\t\t},\n\t}\n\n\to := new(proto.Buffer)\n\terr := o.Marshal(pb)\n\tif err == nil {\n\t\tt.Fatalf(\"expected error when marshaling repeted nil MessageList.Message\")\n\t}\n\tif _, ok := err.(*proto.RequiredNotSetError); !ok {\n\t\tt.Fatalf(\"unexpected error when marshaling: %v\", err)\n\t}\n}\n\n// Test that enums work.  Checks for a bug introduced by making enums\n// named types instead of int32: newInt32FromUint64 would crash with\n// a type mismatch in reflect.PointTo.\nfunc TestEnum(t *testing.T) {\n\tpb := new(pb2.GoEnum)\n\tpb.Foo = pb2.FOO_FOO1.Enum()\n\to := new(proto.Buffer)\n\tif err := o.Marshal(pb); err != nil {\n\t\tt.Fatal(\"error encoding enum:\", err)\n\t}\n\tpb1 := new(pb2.GoEnum)\n\tif err := o.Unmarshal(pb1); err != nil {\n\t\tt.Fatal(\"error decoding enum:\", err)\n\t}\n\tif *pb1.Foo != pb2.FOO_FOO1 {\n\t\tt.Error(\"expected 7 but got \", *pb1.Foo)\n\t}\n}\n\n// Enum types have String methods. Check that enum fields can be printed.\n// We don't care what the value actually is, just as long as it doesn't crash.\nfunc TestPrintingNilEnumFields(t *testing.T) {\n\tpb := new(pb2.GoEnum)\n\t_ = fmt.Sprintf(\"%+v\", pb)\n}\n\n// Verify that absent required fields cause Marshal/Unmarshal to return errors.\nfunc TestRequiredFieldEnforcement(t *testing.T) {\n\tpb := new(pb2.GoTestField)\n\t_, err := proto.Marshal(pb)\n\tif err == nil {\n\t\tt.Error(\"marshal: expected error, got nil\")\n\t} else if !isRequiredNotSetError(err) {\n\t\tt.Errorf(\"marshal: bad error type: %v\", err)\n\t}\n\n\t// A slightly sneaky, yet valid, proto. It encodes the same required field twice,\n\t// so simply counting the required fields is insufficient.\n\t// field 1, encoding 2, value \"hi\"\n\tbuf := []byte(\"\\x0A\\x02hi\\x0A\\x02hi\")\n\terr = proto.Unmarshal(buf, pb)\n\tif err == nil {\n\t\tt.Error(\"unmarshal: expected error, got nil\")\n\t} else if !isRequiredNotSetError(err) {\n\t\tt.Errorf(\"unmarshal: bad error type: %v\", err)\n\t}\n}\n\n// Verify that absent required fields in groups cause Marshal/Unmarshal to return errors.\nfunc TestRequiredFieldEnforcementGroups(t *testing.T) {\n\tpb := &pb2.GoTestRequiredGroupField{Group: &pb2.GoTestRequiredGroupField_Group{}}\n\tif _, err := proto.Marshal(pb); err == nil {\n\t\tt.Error(\"marshal: expected error, got nil\")\n\t} else if !isRequiredNotSetError(err) {\n\t\tt.Errorf(\"marshal: bad error type: %v\", err)\n\t}\n\n\tbuf := []byte{11, 12}\n\tif err := proto.Unmarshal(buf, pb); err == nil {\n\t\tt.Error(\"unmarshal: expected error, got nil\")\n\t} else if !isRequiredNotSetError(err) {\n\t\tt.Errorf(\"unmarshal: bad error type: %v\", err)\n\t}\n}\n\nfunc TestTypedNilMarshal(t *testing.T) {\n\t// A typed nil should return ErrNil and not crash.\n\tvar m *pb2.GoEnum\n\tif _, err := proto.Marshal(m); err != proto.ErrNil {\n\t\tt.Errorf(\"Marshal(%#v): got %v, want ErrNil\", m, err)\n\t}\n}\n\nfunc TestTypedNilMarshalInOneof(t *testing.T) {\n\t// It should not panic.\n\tm := &pb2.Communique{Union: &pb2.Communique_Msg{nil}}\n\tif _, err := proto.Marshal(m); err == proto.ErrNil {\n\t\tt.Errorf(\"Marshal(%#v): got %v, want nil or errOneofHasNil\", m, err)\n\t}\n}\n\n// A type that implements the Marshaler interface, but is not nillable.\ntype nonNillableInt uint64\n\nfunc (nni nonNillableInt) Marshal() ([]byte, error) {\n\treturn proto.EncodeVarint(uint64(nni)), nil\n}\n\ntype NNIMessage struct {\n\tnni nonNillableInt\n}\n\nfunc (*NNIMessage) Reset()         {}\nfunc (*NNIMessage) String() string { return \"\" }\nfunc (*NNIMessage) ProtoMessage()  {}\n\ntype NMMessage struct{}\n\nfunc (*NMMessage) Reset()         {}\nfunc (*NMMessage) String() string { return \"\" }\nfunc (*NMMessage) ProtoMessage()  {}\n\n// Verify a type that uses the Marshaler interface, but has a nil pointer.\nfunc TestNilMarshaler(t *testing.T) {\n\t// Try a struct with a Marshaler field that is nil.\n\t// It should be directly marshable.\n\tnmm := new(NMMessage)\n\tif _, err := proto.Marshal(nmm); err != nil {\n\t\tt.Error(\"unexpected error marshaling nmm: \", err)\n\t}\n\n\t// Try a struct with a Marshaler field that is not nillable.\n\tnnim := new(NNIMessage)\n\tnnim.nni = 7\n\tvar _ proto.Marshaler = nnim.nni // verify it is truly a Marshaler\n\tif _, err := proto.Marshal(nnim); err != nil {\n\t\tt.Error(\"unexpected error marshaling nnim: \", err)\n\t}\n}\n\nfunc TestAllSetDefaults(t *testing.T) {\n\t// Exercise SetDefaults with all scalar field types.\n\tgot := &pb2.Defaults{\n\t\t// NaN != NaN, so override that here.\n\t\tF_Nan: proto.Float32(1.7),\n\t}\n\twant := &pb2.Defaults{\n\t\tF_Bool:    proto.Bool(true),\n\t\tF_Int32:   proto.Int32(32),\n\t\tF_Int64:   proto.Int64(64),\n\t\tF_Fixed32: proto.Uint32(320),\n\t\tF_Fixed64: proto.Uint64(640),\n\t\tF_Uint32:  proto.Uint32(3200),\n\t\tF_Uint64:  proto.Uint64(6400),\n\t\tF_Float:   proto.Float32(314159),\n\t\tF_Double:  proto.Float64(271828),\n\t\tF_String:  proto.String(`hello, \"world!\"` + \"\\n\"),\n\t\tF_Bytes:   []byte(\"Bignose\"),\n\t\tF_Sint32:  proto.Int32(-32),\n\t\tF_Sint64:  proto.Int64(-64),\n\t\tF_Enum:    pb2.Defaults_GREEN.Enum(),\n\t\tF_Pinf:    proto.Float32(float32(math.Inf(1))),\n\t\tF_Ninf:    proto.Float32(float32(math.Inf(-1))),\n\t\tF_Nan:     proto.Float32(1.7),\n\t\tStrZero:   proto.String(\"\"),\n\t}\n\tproto.SetDefaults(got)\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"SetDefaults failed\\n got %v\\nwant %v\", got, want)\n\t}\n}\n\nfunc TestSetDefaultsWithSetField(t *testing.T) {\n\t// Check that a set value is not overridden.\n\tm := &pb2.Defaults{\n\t\tF_Int32: proto.Int32(12),\n\t}\n\tproto.SetDefaults(m)\n\tif v := m.GetF_Int32(); v != 12 {\n\t\tt.Errorf(\"m.FInt32 = %v, want 12\", v)\n\t}\n}\n\nfunc TestSetDefaultsWithSubMessage(t *testing.T) {\n\tgot := &pb2.OtherMessage{\n\t\tKey: proto.Int64(123),\n\t\tInner: &pb2.InnerMessage{\n\t\t\tHost: proto.String(\"gopher\"),\n\t\t},\n\t}\n\twant := &pb2.OtherMessage{\n\t\tKey: proto.Int64(123),\n\t\tInner: &pb2.InnerMessage{\n\t\t\tHost: proto.String(\"gopher\"),\n\t\t\tPort: proto.Int32(4000),\n\t\t},\n\t}\n\tproto.SetDefaults(got)\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"\\n got %v\\nwant %v\", got, want)\n\t}\n}\n\nfunc TestSetDefaultsWithRepeatedSubMessage(t *testing.T) {\n\tgot := &pb2.MyMessage{\n\t\tRepInner: []*pb2.InnerMessage{{}},\n\t}\n\twant := &pb2.MyMessage{\n\t\tRepInner: []*pb2.InnerMessage{{\n\t\t\tPort: proto.Int32(4000),\n\t\t}},\n\t}\n\tproto.SetDefaults(got)\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"\\n got %v\\nwant %v\", got, want)\n\t}\n}\n\nfunc TestSetDefaultWithRepeatedNonMessage(t *testing.T) {\n\tgot := &pb2.MyMessage{\n\t\tPet: []string{\"turtle\", \"wombat\"},\n\t}\n\twant := proto.Clone(got)\n\tproto.SetDefaults(got)\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"\\n got %v\\nwant %v\", got, want)\n\t}\n}\n\nfunc TestMaximumTagNumber(t *testing.T) {\n\tm := &pb2.MaxTag{\n\t\tLastField: proto.String(\"natural goat essence\"),\n\t}\n\tbuf, err := proto.Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"proto.Marshal failed: %v\", err)\n\t}\n\tm2 := new(pb2.MaxTag)\n\tif err := proto.Unmarshal(buf, m2); err != nil {\n\t\tt.Fatalf(\"proto.Unmarshal failed: %v\", err)\n\t}\n\tif got, want := m2.GetLastField(), *m.LastField; got != want {\n\t\tt.Errorf(\"got %q, want %q\", got, want)\n\t}\n}\n\nfunc TestJSON(t *testing.T) {\n\tm := &pb2.MyMessage{\n\t\tCount: proto.Int32(4),\n\t\tPet:   []string{\"bunny\", \"kitty\"},\n\t\tInner: &pb2.InnerMessage{\n\t\t\tHost: proto.String(\"cauchy\"),\n\t\t},\n\t\tBikeshed: pb2.MyMessage_GREEN.Enum(),\n\t}\n\tconst want = `{\"count\":4,\"pet\":[\"bunny\",\"kitty\"],\"inner\":{\"host\":\"cauchy\"},\"bikeshed\":1}`\n\n\tb, err := json.Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"json.Marshal failed: %v\", err)\n\t}\n\ts := string(b)\n\tif s != want {\n\t\tt.Errorf(\"got  %s\\nwant %s\", s, want)\n\t}\n\n\treceived := new(pb2.MyMessage)\n\tif err := json.Unmarshal(b, received); err != nil {\n\t\tt.Fatalf(\"json.Unmarshal failed: %v\", err)\n\t}\n\tif !proto.Equal(received, m) {\n\t\tt.Fatalf(\"got %s, want %s\", received, m)\n\t}\n\n\t// Test unmarshaling of JSON with symbolic enum name.\n\tconst old = `{\"count\":4,\"pet\":[\"bunny\",\"kitty\"],\"inner\":{\"host\":\"cauchy\"},\"bikeshed\":\"GREEN\"}`\n\treceived.Reset()\n\tif err := json.Unmarshal([]byte(old), received); err != nil {\n\t\tt.Fatalf(\"json.Unmarshal failed: %v\", err)\n\t}\n\tif !proto.Equal(received, m) {\n\t\tt.Fatalf(\"got %s, want %s\", received, m)\n\t}\n}\n\nfunc TestBadWireType(t *testing.T) {\n\tb := []byte{7<<3 | 6} // field 7, wire type 6\n\tpb := new(pb2.OtherMessage)\n\tif err := proto.Unmarshal(b, pb); err == nil {\n\t\tt.Errorf(\"Unmarshal did not fail\")\n\t}\n}\n\nfunc TestBytesWithInvalidLength(t *testing.T) {\n\t// If a byte sequence has an invalid (negative) length, Unmarshal should not panic.\n\tb := protopack.Message{\n\t\tprotopack.Tag{2, protopack.BytesType}, protopack.Denormalized{+1, protopack.Uvarint(34359738367)},\n\t}.Marshal()\n\tproto.Unmarshal(b, new(pb2.MyMessage))\n}\n\nfunc TestLengthOverflow(t *testing.T) {\n\t// Overflowing a length should not panic.\n\tb := protopack.Message{\n\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"\\x01\"),\n\t\tprotopack.Tag{3, protopack.BytesType}, protopack.Uvarint(9223372036854775807),\n\t\tprotopack.Raw(\"\\x01\"),\n\t}.Marshal()\n\tproto.Unmarshal(b, new(pb2.MyMessage))\n}\n\nfunc TestVarintOverflow(t *testing.T) {\n\t// Overflowing a 64-bit length should not be allowed.\n\tb := protopack.Message{\n\t\tprotopack.Tag{1, protopack.VarintType}, protopack.Varint(1),\n\t\tprotopack.Tag{3, protopack.BytesType},\n\t\tprotopack.Raw(\"\\x80\\x80\\x80\\x80\\x80\\x80\\x80\\x80\\x80\\x80\\x01\"),\n\t}.Marshal()\n\tif err := proto.Unmarshal(b, new(pb2.MyMessage)); err == nil {\n\t\tt.Fatalf(\"Overflowed uint64 length without error\")\n\t}\n}\n\nfunc TestBytesWithInvalidLengthInGroup(t *testing.T) {\n\t// Overflowing a 64-bit length should not be allowed.\n\tb := protopack.Message{\n\t\tprotopack.Tag{775, protopack.StartGroupType},\n\t\tprotopack.Message{\n\t\t\tprotopack.Tag{774, protopack.BytesType}, protopack.Uvarint(13654841034505509168),\n\t\t\tprotopack.Raw(\"\"),\n\t\t},\n\t}.Marshal()\n\tif err := proto.Unmarshal(b, new(pb2.MyMessage)); err == nil {\n\t\tt.Fatalf(\"Overflowed uint64 length without error\")\n\t}\n}\n\nfunc TestUnmarshalFuzz(t *testing.T) {\n\tconst N = 1000\n\tseed := time.Now().UnixNano()\n\tt.Logf(\"RNG seed is %d\", seed)\n\trng := rand.New(rand.NewSource(seed))\n\tbuf := make([]byte, 20)\n\tfor i := 0; i < N; i++ {\n\t\tfor j := range buf {\n\t\t\tbuf[j] = byte(rng.Intn(256))\n\t\t}\n\t\tfuzzUnmarshal(t, buf)\n\t}\n}\n\nfunc TestMergeMessages(t *testing.T) {\n\tpb := &pb2.MessageList{Message: []*pb2.MessageList_Message{{Name: proto.String(\"x\"), Count: proto.Int32(1)}}}\n\tdata, err := proto.Marshal(pb)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal: %v\", err)\n\t}\n\n\tpb1 := new(pb2.MessageList)\n\tif err := proto.Unmarshal(data, pb1); err != nil {\n\t\tt.Fatalf(\"first Unmarshal: %v\", err)\n\t}\n\tif err := proto.Unmarshal(data, pb1); err != nil {\n\t\tt.Fatalf(\"second Unmarshal: %v\", err)\n\t}\n\tif len(pb1.Message) != 1 {\n\t\tt.Errorf(\"two Unmarshals produced %d Messages, want 1\", len(pb1.Message))\n\t}\n\n\tpb2 := new(pb2.MessageList)\n\tif err := proto.UnmarshalMerge(data, pb2); err != nil {\n\t\tt.Fatalf(\"first UnmarshalMerge: %v\", err)\n\t}\n\tif err := proto.UnmarshalMerge(data, pb2); err != nil {\n\t\tt.Fatalf(\"second UnmarshalMerge: %v\", err)\n\t}\n\tif len(pb2.Message) != 2 {\n\t\tt.Errorf(\"two UnmarshalMerges produced %d Messages, want 2\", len(pb2.Message))\n\t}\n}\n\nfunc TestExtensionMarshalOrder(t *testing.T) {\n\tm := &pb2.MyMessage{Count: proto.Int(123)}\n\tif err := proto.SetExtension(m, pb2.E_Ext_More, &pb2.Ext{Data: proto.String(\"alpha\")}); err != nil {\n\t\tt.Fatalf(\"SetExtension: %v\", err)\n\t}\n\tif err := proto.SetExtension(m, pb2.E_Ext_Text, proto.String(\"aleph\")); err != nil {\n\t\tt.Fatalf(\"SetExtension: %v\", err)\n\t}\n\tif err := proto.SetExtension(m, pb2.E_Ext_Number, proto.Int32(1)); err != nil {\n\t\tt.Fatalf(\"SetExtension: %v\", err)\n\t}\n\n\t// Serialize m several times, and check we get the same bytes each time.\n\tvar orig []byte\n\tfor i := 0; i < 100; i++ {\n\t\tb, err := proto.Marshal(m)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Marshal: %v\", err)\n\t\t}\n\t\tif i == 0 {\n\t\t\torig = b\n\t\t\tcontinue\n\t\t}\n\t\tif !bytes.Equal(b, orig) {\n\t\t\tt.Errorf(\"Bytes differ on attempt #%d\", i)\n\t\t}\n\t}\n}\n\nfunc TestExtensionMapFieldMarshalDeterministic(t *testing.T) {\n\tm := &pb2.MyMessage{Count: proto.Int(123)}\n\tif err := proto.SetExtension(m, pb2.E_Ext_More, &pb2.Ext{MapField: map[int32]int32{1: 1, 2: 2, 3: 3, 4: 4}}); err != nil {\n\t\tt.Fatalf(\"SetExtension: %v\", err)\n\t}\n\tmarshal := func(m proto.Message) []byte {\n\t\tvar b proto.Buffer\n\t\tb.SetDeterministic(true)\n\t\tif err := b.Marshal(m); err != nil {\n\t\t\tt.Fatalf(\"Marshal failed: %v\", err)\n\t\t}\n\t\treturn b.Bytes()\n\t}\n\n\twant := marshal(m)\n\tfor i := 0; i < 100; i++ {\n\t\tif got := marshal(m); !bytes.Equal(got, want) {\n\t\t\tt.Errorf(\"Marshal produced inconsistent output with determinism enabled (pass %d).\\n got %v\\nwant %v\", i, got, want)\n\t\t}\n\t}\n}\n\nfunc TestUnmarshalMergesMessages(t *testing.T) {\n\t// If a nested message occurs twice in the input,\n\t// the fields should be merged when decoding.\n\ta := &pb2.OtherMessage{\n\t\tKey: proto.Int64(123),\n\t\tInner: &pb2.InnerMessage{\n\t\t\tHost: proto.String(\"polhode\"),\n\t\t\tPort: proto.Int32(1234),\n\t\t},\n\t}\n\taData, err := proto.Marshal(a)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal(a): %v\", err)\n\t}\n\tb := &pb2.OtherMessage{\n\t\tWeight: proto.Float32(1.2),\n\t\tInner: &pb2.InnerMessage{\n\t\t\tHost:      proto.String(\"herpolhode\"),\n\t\t\tConnected: proto.Bool(true),\n\t\t},\n\t}\n\tbData, err := proto.Marshal(b)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal(b): %v\", err)\n\t}\n\twant := &pb2.OtherMessage{\n\t\tKey:    proto.Int64(123),\n\t\tWeight: proto.Float32(1.2),\n\t\tInner: &pb2.InnerMessage{\n\t\t\tHost:      proto.String(\"herpolhode\"),\n\t\t\tPort:      proto.Int32(1234),\n\t\t\tConnected: proto.Bool(true),\n\t\t},\n\t}\n\tgot := new(pb2.OtherMessage)\n\tif err := proto.Unmarshal(append(aData, bData...), got); err != nil {\n\t\tt.Fatalf(\"Unmarshal: %v\", err)\n\t}\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"\\n got %v\\nwant %v\", got, want)\n\t}\n}\n\nfunc TestUnmarshalMergesGroups(t *testing.T) {\n\t// If a nested group occurs twice in the input,\n\t// the fields should be merged when decoding.\n\ta := &pb2.GroupNew{\n\t\tG: &pb2.GroupNew_G{\n\t\t\tX: proto.Int32(7),\n\t\t\tY: proto.Int32(8),\n\t\t},\n\t}\n\taData, err := proto.Marshal(a)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal(a): %v\", err)\n\t}\n\tb := &pb2.GroupNew{\n\t\tG: &pb2.GroupNew_G{\n\t\t\tX: proto.Int32(9),\n\t\t},\n\t}\n\tbData, err := proto.Marshal(b)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal(b): %v\", err)\n\t}\n\twant := &pb2.GroupNew{\n\t\tG: &pb2.GroupNew_G{\n\t\t\tX: proto.Int32(9),\n\t\t\tY: proto.Int32(8),\n\t\t},\n\t}\n\tgot := new(pb2.GroupNew)\n\tif err := proto.Unmarshal(append(aData, bData...), got); err != nil {\n\t\tt.Fatalf(\"Unmarshal: %v\", err)\n\t}\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"\\n got %v\\nwant %v\", got, want)\n\t}\n}\n\nfunc TestEncodingSizes(t *testing.T) {\n\ttests := []struct {\n\t\tm proto.Message\n\t\tn int\n\t}{\n\t\t{&pb2.Defaults{F_Int32: proto.Int32(math.MaxInt32)}, 6},\n\t\t{&pb2.Defaults{F_Int32: proto.Int32(math.MinInt32)}, 11},\n\t\t{&pb2.Defaults{F_Uint32: proto.Uint32(uint32(math.MaxInt32) + 1)}, 6},\n\t\t{&pb2.Defaults{F_Uint32: proto.Uint32(math.MaxUint32)}, 6},\n\t}\n\tfor _, test := range tests {\n\t\tb, err := proto.Marshal(test.m)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Marshal(%v): %v\", test.m, err)\n\t\t\tcontinue\n\t\t}\n\t\tif len(b) != test.n {\n\t\t\tt.Errorf(\"Marshal(%v) yielded %d bytes, want %d bytes\", test.m, len(b), test.n)\n\t\t}\n\t}\n}\n\nfunc TestRequiredNotSetError(t *testing.T) {\n\tpb := initGoTest(false)\n\tpb.RequiredField.Label = nil\n\tpb.F_Int32Required = nil\n\tpb.F_Int64Required = nil\n\n\twant := protopack.Message{\n\t\tprotopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7),\n\t\tprotopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"type\"),\n\t\t}),\n\t\tprotopack.Tag{10, protopack.VarintType}, protopack.Bool(true),\n\t\tprotopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32),\n\t\tprotopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64),\n\t\tprotopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232),\n\t\tprotopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464),\n\t\tprotopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232),\n\t\tprotopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464),\n\t\tprotopack.Tag{19, protopack.BytesType}, protopack.String(\"string\"),\n\t\tprotopack.Tag{70, protopack.StartGroupType},\n\t\tprotopack.Message{\n\t\t\tprotopack.Tag{71, protopack.BytesType}, protopack.String(\"required\"),\n\t\t},\n\t\tprotopack.Tag{70, protopack.EndGroupType},\n\t\tprotopack.Tag{101, protopack.BytesType}, protopack.Bytes(\"bytes\"),\n\t\tprotopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32),\n\t\tprotopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64),\n\t\tprotopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32),\n\t\tprotopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64),\n\t}.Marshal()\n\n\tgot, err := proto.Marshal(pb)\n\tif !isRequiredNotSetError(err) {\n\t\tt.Logf(\"marshal-1 err = %v, want *RequiredNotSetError\", err)\n\t\tt.Fatalf(\"got %q\\nwant  %q\", got, want)\n\t}\n\tif !bytes.Equal(got, want) {\n\t\tt.Fatalf(\"got %q\\nwant  %q\", got, want)\n\t}\n\n\t// Now test Unmarshal by recreating the original buffer.\n\tpbd := new(pb2.GoTest)\n\terr = proto.Unmarshal(got, pbd)\n\tif !isRequiredNotSetError(err) {\n\t\tt.Errorf(\"unmarshal err = %v, want *RequiredNotSetError\", err)\n\t\tt.Fatalf(\"got %q\\nwant  %q\", got, want)\n\t}\n\tgot, err = proto.Marshal(pbd)\n\tif !isRequiredNotSetError(err) {\n\t\tt.Errorf(\"marshal-2 err = %v, want *RequiredNotSetError\", err)\n\t\tt.Fatalf(\"got %q\\nwant  %q\", got, want)\n\t}\n\tif !bytes.Equal(got, want) {\n\t\tt.Fatalf(\"got %q\\nwant  %q\", got, want)\n\t}\n}\n\nfunc TestRequiredNotSetErrorWithBadWireTypes(t *testing.T) {\n\t// Required field expects a varint, and properly found a varint.\n\tif err := proto.Unmarshal([]byte{0x08, 0x00}, new(pb2.GoEnum)); err != nil {\n\t\tt.Errorf(\"Unmarshal = %v, want nil\", err)\n\t}\n\t// Required field expects a varint, but found a fixed32 instead.\n\tif err := proto.Unmarshal([]byte{0x0d, 0x00, 0x00, 0x00, 0x00}, new(pb2.GoEnum)); err == nil {\n\t\tt.Errorf(\"Unmarshal = nil, want RequiredNotSetError\")\n\t}\n\t// Required field expects a varint, and found both a varint and fixed32 (ignored).\n\tm := new(pb2.GoEnum)\n\tif err := proto.Unmarshal([]byte{0x08, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00}, m); err != nil {\n\t\tt.Errorf(\"Unmarshal = %v, want nil\", err)\n\t}\n\tif !bytes.Equal(m.XXX_unrecognized, []byte{0x0d, 0x00, 0x00, 0x00, 0x00}) {\n\t\tt.Errorf(\"expected fixed32 to appear as unknown bytes: %x\", m.XXX_unrecognized)\n\t}\n}\n\nfunc fuzzUnmarshal(t *testing.T, data []byte) {\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tt.Errorf(\"These bytes caused a panic: %+v\", data)\n\t\t\tt.Logf(\"Stack:\\n%s\", debug.Stack())\n\t\t\tt.FailNow()\n\t\t}\n\t}()\n\n\tpb := new(pb2.MyMessage)\n\tproto.Unmarshal(data, pb)\n}\n\nfunc TestMapFieldMarshal(t *testing.T) {\n\tm := &pb2.MessageWithMap{\n\t\tNameMapping: map[int32]string{\n\t\t\t1: \"Rob\",\n\t\t\t4: \"Ian\",\n\t\t\t8: \"Dave\",\n\t\t},\n\t}\n\tb, err := proto.Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal: %v\", err)\n\t}\n\n\t// b should be the concatenation of these three byte sequences in some order.\n\tparts := []string{\n\t\t\"\\n\\a\\b\\x01\\x12\\x03Rob\",\n\t\t\"\\n\\a\\b\\x04\\x12\\x03Ian\",\n\t\t\"\\n\\b\\b\\x08\\x12\\x04Dave\",\n\t}\n\tok := false\n\tfor i := range parts {\n\t\tfor j := range parts {\n\t\t\tif j == i {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor k := range parts {\n\t\t\t\tif k == i || k == j {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry := parts[i] + parts[j] + parts[k]\n\t\t\t\tif bytes.Equal(b, []byte(try)) {\n\t\t\t\t\tok = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif !ok {\n\t\tt.Fatalf(\"Incorrect Marshal output.\\n got %q\\nwant %q (or a permutation of that)\", b, parts[0]+parts[1]+parts[2])\n\t}\n\tt.Logf(\"FYI b: %q\", b)\n}\n\nfunc TestMapFieldDeterministicMarshal(t *testing.T) {\n\tm := &pb2.MessageWithMap{\n\t\tNameMapping: map[int32]string{\n\t\t\t1: \"Rob\",\n\t\t\t4: \"Ian\",\n\t\t\t8: \"Dave\",\n\t\t},\n\t}\n\n\tmarshal := func(m proto.Message) []byte {\n\t\tvar b proto.Buffer\n\t\tb.SetDeterministic(true)\n\t\tif err := b.Marshal(m); err != nil {\n\t\t\tt.Fatalf(\"Marshal failed: %v\", err)\n\t\t}\n\t\treturn b.Bytes()\n\t}\n\n\twant := marshal(m)\n\tfor i := 0; i < 10; i++ {\n\t\tif got := marshal(m); !bytes.Equal(got, want) {\n\t\t\tt.Errorf(\"Marshal produced inconsistent output with determinism enabled (pass %d).\\n got %v\\nwant %v\", i, got, want)\n\t\t}\n\t}\n}\n\nfunc TestMapFieldRoundTrips(t *testing.T) {\n\tm := &pb2.MessageWithMap{\n\t\tNameMapping: map[int32]string{\n\t\t\t1: \"Rob\",\n\t\t\t4: \"Ian\",\n\t\t\t8: \"Dave\",\n\t\t},\n\t\tMsgMapping: map[int64]*pb2.FloatingPoint{\n\t\t\t0x7001: {F: proto.Float64(2.0)},\n\t\t},\n\t\tByteMapping: map[bool][]byte{\n\t\t\tfalse: []byte(\"that's not right!\"),\n\t\t\ttrue:  []byte(\"aye, 'tis true!\"),\n\t\t},\n\t}\n\tb, err := proto.Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal: %v\", err)\n\t}\n\tt.Logf(\"FYI b: %q\", b)\n\tm2 := new(pb2.MessageWithMap)\n\tif err := proto.Unmarshal(b, m2); err != nil {\n\t\tt.Fatalf(\"Unmarshal: %v\", err)\n\t}\n\tif !proto.Equal(m, m2) {\n\t\tt.Errorf(\"Map did not survive a round trip.\\ninitial: %v\\n  final: %v\", m, m2)\n\t}\n}\n\nfunc TestMapFieldWithNil(t *testing.T) {\n\tm1 := &pb2.MessageWithMap{\n\t\tMsgMapping: map[int64]*pb2.FloatingPoint{\n\t\t\t1: nil,\n\t\t},\n\t}\n\tb, err := proto.Marshal(m1)\n\tif _, ok := err.(*proto.RequiredNotSetError); !ok {\n\t\tt.Fatalf(\"Marshal(%v): err=%v, want RequiredNotSet\", m1, err)\n\t}\n\tm2 := new(pb2.MessageWithMap)\n\terr = proto.Unmarshal(b, m2)\n\tif _, ok := err.(*proto.RequiredNotSetError); !ok {\n\t\tt.Fatalf(\"Unmarshal(%v): err=%v, want RequiredNotSet\", m1, err)\n\t}\n\tif !proto.Equal(m1, m2) {\n\t\tt.Fatalf(\"roundtrip marshal/unmarshal changed message; got:\\n%v\\nwant:\\n%v\", m2, m1)\n\t}\n}\n\nfunc TestMapFieldWithNilBytes(t *testing.T) {\n\tm1 := &pb2.MessageWithMap{\n\t\tByteMapping: map[bool][]byte{\n\t\t\tfalse: {},\n\t\t\ttrue:  nil,\n\t\t},\n\t}\n\tn := proto.Size(m1)\n\tb, err := proto.Marshal(m1)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal: %v\", err)\n\t}\n\tif n != len(b) {\n\t\tt.Errorf(\"Size(m1) = %d; want len(Marshal(m1)) = %d\", n, len(b))\n\t}\n\tm2 := new(pb2.MessageWithMap)\n\tif err := proto.Unmarshal(b, m2); err != nil {\n\t\tt.Fatalf(\"Unmarshal: %v, got these bytes: %v\", err, b)\n\t}\n\tif v, ok := m2.ByteMapping[false]; !ok {\n\t\tt.Error(\"byte_mapping[false] not present\")\n\t} else if len(v) != 0 {\n\t\tt.Errorf(\"byte_mapping[false] not empty: %#v\", v)\n\t}\n\tif v, ok := m2.ByteMapping[true]; !ok {\n\t\tt.Error(\"byte_mapping[true] not present\")\n\t} else if len(v) != 0 {\n\t\tt.Errorf(\"byte_mapping[true] not empty: %#v\", v)\n\t}\n}\n\nfunc TestDecodeMapFieldMissingKey(t *testing.T) {\n\tb := []byte{\n\t\t0x0A, 0x03, // message, tag 1 (name_mapping), of length 3 bytes\n\t\t// no key\n\t\t0x12, 0x01, 0x6D, // string value of length 1 byte, value \"m\"\n\t}\n\tgot := &pb2.MessageWithMap{}\n\terr := proto.Unmarshal(b, got)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to marshal map with missing key: %v\", err)\n\t}\n\twant := &pb2.MessageWithMap{NameMapping: map[int32]string{0: \"m\"}}\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"Unmarshaled map with no key was not as expected. got: %v, want %v\", got, want)\n\t}\n}\n\nfunc TestDecodeMapFieldMissingValue(t *testing.T) {\n\tb := protopack.Message{\n\t\tprotopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\tprotopack.Tag{1, protopack.VarintType}, protopack.Uvarint(1),\n\t\t}),\n\t}.Marshal()\n\tgot := &pb2.MessageWithMap{}\n\terr := proto.Unmarshal(b, got)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to marshal map with missing value: %v\", err)\n\t}\n\twant := &pb2.MessageWithMap{NameMapping: map[int32]string{1: \"\"}}\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"Unmarshaled map with no value was not as expected. got: %v, want %v\", got, want)\n\t}\n}\n\nfunc TestOneof(t *testing.T) {\n\tm := &pb2.Communique{}\n\tb, err := proto.Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal of empty message with oneof: %v\", err)\n\t}\n\tif len(b) != 0 {\n\t\tt.Errorf(\"Marshal of empty message yielded too many bytes: %v\", b)\n\t}\n\n\tm = &pb2.Communique{\n\t\tUnion: &pb2.Communique_Name{\"Barry\"},\n\t}\n\n\t// Round-trip.\n\tb, err = proto.Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal of message with oneof: %v\", err)\n\t}\n\tif len(b) != 7 { // name tag/wire (1) + name len (1) + name (5)\n\t\tt.Errorf(\"Incorrect marshal of message with oneof: %v\", b)\n\t}\n\tm.Reset()\n\tif err := proto.Unmarshal(b, m); err != nil {\n\t\tt.Fatalf(\"Unmarshal of message with oneof: %v\", err)\n\t}\n\tif x, ok := m.Union.(*pb2.Communique_Name); !ok || x.Name != \"Barry\" {\n\t\tt.Errorf(\"After round trip, Union = %+v\", m.Union)\n\t}\n\tif name := m.GetName(); name != \"Barry\" {\n\t\tt.Errorf(\"After round trip, GetName = %q, want %q\", name, \"Barry\")\n\t}\n\n\t// Let's try with a message in the oneof.\n\tm.Union = &pb2.Communique_Msg{&pb2.Strings{StringField: proto.String(\"deep deep string\")}}\n\tb, err = proto.Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal of message with oneof set to message: %v\", err)\n\t}\n\tif len(b) != 20 { // msg tag/wire (1) + msg len (1) + msg (1 + 1 + 16)\n\t\tt.Errorf(\"Incorrect marshal of message with oneof set to message: %v\", b)\n\t}\n\tm.Reset()\n\tif err := proto.Unmarshal(b, m); err != nil {\n\t\tt.Fatalf(\"Unmarshal of message with oneof set to message: %v\", err)\n\t}\n\tss, ok := m.Union.(*pb2.Communique_Msg)\n\tif !ok || ss.Msg.GetStringField() != \"deep deep string\" {\n\t\tt.Errorf(\"After round trip with oneof set to message, Union = %+v\", m.Union)\n\t}\n}\n\nfunc TestOneofNilBytes(t *testing.T) {\n\t// A oneof with nil byte slice should marshal to tag + 0 (size), with no error.\n\tm := &pb2.Communique{Union: &pb2.Communique_Data{Data: nil}}\n\tb, err := proto.Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal failed: %v\", err)\n\t}\n\twant := protopack.Message{\n\t\tprotopack.Tag{7, protopack.BytesType}, protopack.Bytes(\"\"),\n\t}.Marshal()\n\tif !bytes.Equal(b, want) {\n\t\tt.Errorf(\"Wrong result of Marshal: got %x, want %x\", b, want)\n\t}\n}\n\nfunc TestInefficientPackedBool(t *testing.T) {\n\t// https://github.com/golang/protobuf/issues/76\n\tinp := protopack.Message{\n\t\tprotopack.Tag{2, protopack.BytesType}, protopack.Bytes(\"\\xb90\"),\n\t}.Marshal()\n\tif err := proto.Unmarshal(inp, new(pb2.MoreRepeated)); err != nil {\n\t\tt.Error(err)\n\t}\n}\n\n// Make sure pure-reflect-based implementation handles\n// []int32-[]enum conversion correctly.\nfunc TestRepeatedEnum2(t *testing.T) {\n\tpb := &pb2.RepeatedEnum{\n\t\tColor: []pb2.RepeatedEnum_Color{pb2.RepeatedEnum_RED},\n\t}\n\tb, err := proto.Marshal(pb)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal failed: %v\", err)\n\t}\n\tx := new(pb2.RepeatedEnum)\n\terr = proto.Unmarshal(b, x)\n\tif err != nil {\n\t\tt.Fatalf(\"Unmarshal failed: %v\", err)\n\t}\n\tif !proto.Equal(pb, x) {\n\t\tt.Errorf(\"Incorrect result: want: %v got: %v\", pb, x)\n\t}\n}\n\n// TestConcurrentMarshal makes sure that it is safe to marshal\n// same message in multiple goroutines concurrently.\nfunc TestConcurrentMarshal(t *testing.T) {\n\tpb := initGoTest(true)\n\tconst N = 100\n\tb := make([][]byte, N)\n\n\tvar wg sync.WaitGroup\n\tfor i := 0; i < N; i++ {\n\t\twg.Add(1)\n\t\tgo func(i int) {\n\t\t\tdefer wg.Done()\n\t\t\tvar err error\n\t\t\tb[i], err = proto.Marshal(pb)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"marshal error: %v\", err)\n\t\t\t}\n\t\t}(i)\n\t}\n\n\twg.Wait()\n\tfor i := 1; i < N; i++ {\n\t\tif !bytes.Equal(b[0], b[i]) {\n\t\t\tt.Errorf(\"concurrent marshal result not same: b[0] = %v, b[%d] = %v\", b[0], i, b[i])\n\t\t}\n\t}\n}\n\nfunc TestInvalidUTF8(t *testing.T) {\n\tconst invalidUTF8 = \"\\xde\\xad\\xbe\\xef\\x80\\x00\\xff\"\n\ttests := []struct {\n\t\tlabel  string\n\t\tproto2 proto.Message\n\t\tproto3 proto.Message\n\t\twant   []byte\n\t}{{\n\t\tlabel:  \"Scalar\",\n\t\tproto2: &pb2.TestUTF8{Scalar: proto.String(invalidUTF8)},\n\t\tproto3: &pb3.TestUTF8{Scalar: invalidUTF8},\n\t\twant:   []byte{0x0a, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff},\n\t}, {\n\t\tlabel:  \"Vector\",\n\t\tproto2: &pb2.TestUTF8{Vector: []string{invalidUTF8}},\n\t\tproto3: &pb3.TestUTF8{Vector: []string{invalidUTF8}},\n\t\twant:   []byte{0x12, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff},\n\t}, {\n\t\tlabel:  \"Oneof\",\n\t\tproto2: &pb2.TestUTF8{Oneof: &pb2.TestUTF8_Field{invalidUTF8}},\n\t\tproto3: &pb3.TestUTF8{Oneof: &pb3.TestUTF8_Field{invalidUTF8}},\n\t\twant:   []byte{0x1a, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff},\n\t}, {\n\t\tlabel:  \"MapKey\",\n\t\tproto2: &pb2.TestUTF8{MapKey: map[string]int64{invalidUTF8: 0}},\n\t\tproto3: &pb3.TestUTF8{MapKey: map[string]int64{invalidUTF8: 0}},\n\t\twant:   []byte{0x22, 0x0b, 0x0a, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff, 0x10, 0x00},\n\t}, {\n\t\tlabel:  \"MapValue\",\n\t\tproto2: &pb2.TestUTF8{MapValue: map[int64]string{0: invalidUTF8}},\n\t\tproto3: &pb3.TestUTF8{MapValue: map[int64]string{0: invalidUTF8}},\n\t\twant:   []byte{0x2a, 0x0b, 0x08, 0x00, 0x12, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff},\n\t}}\n\n\tfor _, tt := range tests {\n\t\t// Proto2 should not validate UTF-8.\n\t\tb, err := proto.Marshal(tt.proto2)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Marshal(proto2.%s) = %v, want nil\", tt.label, err)\n\t\t}\n\t\tif !bytes.Equal(b, tt.want) {\n\t\t\tt.Errorf(\"Marshal(proto2.%s) = %x, want %x\", tt.label, b, tt.want)\n\t\t}\n\n\t\tm := proto.Clone(tt.proto2)\n\t\tm.Reset()\n\t\tif err = proto.Unmarshal(tt.want, m); err != nil {\n\t\t\tt.Errorf(\"Unmarshal(proto2.%s) = %v, want nil\", tt.label, err)\n\t\t}\n\t\tif !proto.Equal(m, tt.proto2) {\n\t\t\tt.Errorf(\"proto2.%s: output mismatch:\\ngot  %v\\nwant %v\", tt.label, m, tt.proto2)\n\t\t}\n\n\t\t// Proto3 should validate UTF-8.\n\t\tif _, err := proto.Marshal(tt.proto3); err == nil {\n\t\t\tt.Errorf(\"Marshal(proto3.%s) = %v, want non-nil\", tt.label, err)\n\t\t}\n\n\t\tm = proto.Clone(tt.proto3)\n\t\tm.Reset()\n\t\tif err := proto.Unmarshal(tt.want, m); err == nil {\n\t\t\tt.Errorf(\"Unmarshal(proto3.%s) = %v, want non-nil\", tt.label, err)\n\t\t}\n\t}\n}\n\nfunc TestRequired(t *testing.T) {\n\t// The F_BoolRequired field appears after all of the required fields.\n\t// It should still be handled even after multiple required field violations.\n\tm := &pb2.GoTest{F_BoolRequired: proto.Bool(true)}\n\tgot, err := proto.Marshal(m)\n\tif !isRequiredNotSetError(err) {\n\t\tt.Errorf(\"Marshal() = %v, want RequiredNotSetError error\", err)\n\t}\n\tif want := []byte{0x50, 0x01}; !bytes.Equal(got, want) {\n\t\tt.Errorf(\"Marshal() = %x, want %x\", got, want)\n\t}\n\n\tm = new(pb2.GoTest)\n\terr = proto.Unmarshal(got, m)\n\tif !isRequiredNotSetError(err) {\n\t\tt.Errorf(\"Marshal() = %v, want RequiredNotSetError error\", err)\n\t}\n\tif !m.GetF_BoolRequired() {\n\t\tt.Error(\"m.F_BoolRequired = false, want true\")\n\t}\n}\n\nfunc TestUnknownV2(t *testing.T) {\n\tm := new(tspb.Timestamp)\n\tm.ProtoReflect().SetUnknown([]byte(\"\\x92\\x4d\\x12unknown field 1234\"))\n\tgot := proto.CompactTextString(m)\n\tif !strings.Contains(got, \"unknown field 1234\") {\n\t\tt.Errorf(\"got %q, want contains %q\", got, \"unknown field 1234\")\n\t}\n}\n\nfunc testMsg() *pb2.GoTest {\n\tpb := initGoTest(true)\n\tconst N = 1000 // Internally the library starts much smaller.\n\tpb.F_Int32Repeated = make([]int32, N)\n\tpb.F_DoubleRepeated = make([]float64, N)\n\tfor i := 0; i < N; i++ {\n\t\tpb.F_Int32Repeated[i] = int32(i)\n\t\tpb.F_DoubleRepeated[i] = float64(i)\n\t}\n\treturn pb\n}\n\nfunc bytesMsg() *pb2.GoTest {\n\tpb := initGoTest(true)\n\tbuf := make([]byte, 4000)\n\tfor i := range buf {\n\t\tbuf[i] = byte(i)\n\t}\n\tpb.F_BytesDefaulted = buf\n\treturn pb\n}\n\nfunc benchmarkMarshal(b *testing.B, pb proto.Message, marshal func(proto.Message) ([]byte, error)) {\n\td, _ := marshal(pb)\n\tb.SetBytes(int64(len(d)))\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tmarshal(pb)\n\t}\n}\n\nfunc benchmarkBufferMarshal(b *testing.B, pb proto.Message) {\n\tp := proto.NewBuffer(nil)\n\tbenchmarkMarshal(b, pb, func(pb0 proto.Message) ([]byte, error) {\n\t\tp.Reset()\n\t\terr := p.Marshal(pb0)\n\t\treturn p.Bytes(), err\n\t})\n}\n\nfunc benchmarkSize(b *testing.B, pb proto.Message) {\n\tbenchmarkMarshal(b, pb, func(pb0 proto.Message) ([]byte, error) {\n\t\tproto.Size(pb)\n\t\treturn nil, nil\n\t})\n}\n\nfunc TestProto3ZeroValues(t *testing.T) {\n\ttests := []struct {\n\t\tdesc string\n\t\tm    proto.Message\n\t}{\n\t\t{\"zero message\", &pb3.Message{}},\n\t\t{\"empty bytes field\", &pb3.Message{Data: []byte{}}},\n\t}\n\tfor _, test := range tests {\n\t\tb, err := proto.Marshal(test.m)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%s: proto.Marshal: %v\", test.desc, err)\n\t\t\tcontinue\n\t\t}\n\t\tif len(b) > 0 {\n\t\t\tt.Errorf(\"%s: Encoding is non-empty: %q\", test.desc, b)\n\t\t}\n\t}\n}\n\nfunc TestRoundTripProto3(t *testing.T) {\n\tm := &pb3.Message{\n\t\tName:         \"David\",          // (2 | 1<<3): 0x0a 0x05 \"David\"\n\t\tHilarity:     pb3.Message_PUNS, // (0 | 2<<3): 0x10 0x01\n\t\tHeightInCm:   178,              // (0 | 3<<3): 0x18 0xb2 0x01\n\t\tData:         []byte(\"roboto\"), // (2 | 4<<3): 0x20 0x06 \"roboto\"\n\t\tResultCount:  47,               // (0 | 7<<3): 0x38 0x2f\n\t\tTrueScotsman: true,             // (0 | 8<<3): 0x40 0x01\n\t\tScore:        8.1,              // (5 | 9<<3): 0x4d <8.1>\n\n\t\tKey: []uint64{1, 0xdeadbeef},\n\t\tNested: &pb3.Nested{\n\t\t\tBunny: \"Monty\",\n\t\t},\n\t}\n\tt.Logf(\" m: %v\", m)\n\n\tb, err := proto.Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"proto.Marshal: %v\", err)\n\t}\n\tt.Logf(\" b: %q\", b)\n\n\tm2 := new(pb3.Message)\n\tif err := proto.Unmarshal(b, m2); err != nil {\n\t\tt.Fatalf(\"proto.Unmarshal: %v\", err)\n\t}\n\tt.Logf(\"m2: %v\", m2)\n\n\tif !proto.Equal(m, m2) {\n\t\tt.Errorf(\"proto.Equal returned false:\\n m: %v\\nm2: %v\", m, m2)\n\t}\n}\n\nfunc TestGettersForBasicTypesExist(t *testing.T) {\n\tvar m pb3.Message\n\tif got := m.GetNested().GetBunny(); got != \"\" {\n\t\tt.Errorf(\"m.GetNested().GetBunny() = %q, want empty string\", got)\n\t}\n\tif got := m.GetNested().GetCute(); got {\n\t\tt.Errorf(\"m.GetNested().GetCute() = %t, want false\", got)\n\t}\n}\n\nfunc TestProto3SetDefaults(t *testing.T) {\n\tin := &pb3.Message{\n\t\tTerrain: map[string]*pb3.Nested{\n\t\t\t\"meadow\": new(pb3.Nested),\n\t\t},\n\t\tProto2Field: new(pb2.SubDefaults),\n\t\tProto2Value: map[string]*pb2.SubDefaults{\n\t\t\t\"badlands\": new(pb2.SubDefaults),\n\t\t},\n\t}\n\n\tgot := proto.Clone(in).(*pb3.Message)\n\tproto.SetDefaults(got)\n\n\t// There are no defaults in proto3.  Everything should be the zero value, but\n\t// we need to remember to set defaults for nested proto2 messages.\n\twant := &pb3.Message{\n\t\tTerrain: map[string]*pb3.Nested{\n\t\t\t\"meadow\": new(pb3.Nested),\n\t\t},\n\t\tProto2Field: &pb2.SubDefaults{N: proto.Int64(7)},\n\t\tProto2Value: map[string]*pb2.SubDefaults{\n\t\t\t\"badlands\": &pb2.SubDefaults{N: proto.Int64(7)},\n\t\t},\n\t}\n\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"with in = %v\\nproto.SetDefaults(in) =>\\ngot %v\\nwant %v\", in, got, want)\n\t}\n}\n\nfunc TestUnknownFieldPreservation(t *testing.T) {\n\tb1 := \"\\x0a\\x05David\"      // Known tag 1\n\tb2 := \"\\xc2\\x0c\\x06Google\" // Unknown tag 200\n\tb := []byte(b1 + b2)\n\n\tm := new(pb3.Message)\n\tif err := proto.Unmarshal(b, m); err != nil {\n\t\tt.Fatalf(\"proto.Unmarshal: %v\", err)\n\t}\n\n\tif !bytes.Equal(m.XXX_unrecognized, []byte(b2)) {\n\t\tt.Fatalf(\"mismatching unknown fields:\\ngot  %q\\nwant %q\", m.XXX_unrecognized, b2)\n\t}\n}\n\nfunc TestMap(t *testing.T) {\n\tb := protopack.Message{\n\t\tprotopack.Tag{20, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.String(\"Key1\"),\n\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"Val1\"),\n\t\t}),\n\t\tprotopack.Tag{20, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.String(\"Key2\"),\n\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"Val2a\"),\n\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"Val2\"),\n\t\t}),\n\t\tprotopack.Tag{20, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.String(\"Key3\"),\n\t\t\tprotopack.Tag{1, protopack.Fixed32Type}, protopack.Uint32(5),\n\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"Val3b\"),\n\t\t\tprotopack.Tag{3, protopack.BytesType}, protopack.Bytes(\"Val3a\"),\n\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.String(\"Val3\"),\n\t\t\tprotopack.Tag{2, protopack.Fixed32Type}, protopack.Uint32(5),\n\t\t}),\n\t\tprotopack.Tag{20, protopack.BytesType}, protopack.LengthPrefix{},\n\t\tprotopack.Tag{20, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{\n\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.String(\"Key4\"),\n\t\t\tprotopack.Tag{2, protopack.StartGroupType},\n\t\t\tprotopack.Message{\n\t\t\t\tprotopack.Tag{1, protopack.BytesType}, protopack.Bytes(\"SomeURL\"),\n\t\t\t\tprotopack.Tag{2, protopack.BytesType}, protopack.Bytes(\"SomeTitle\"),\n\t\t\t\tprotopack.Tag{3, protopack.BytesType}, protopack.Bytes(\"Snippet1\"),\n\t\t\t},\n\t\t\tprotopack.Tag{2, protopack.EndGroupType},\n\t\t}),\n\t}.Marshal()\n\n\tvar m pb3.Message\n\tif err := proto.Unmarshal(b, &m); err != nil {\n\t\tt.Fatalf(\"proto.Unmarshal error: %v\", err)\n\t}\n\n\tgot := m.StringMap\n\twant := map[string]string{\n\t\t\"\":     \"\",\n\t\t\"Key1\": \"Val1\",\n\t\t\"Key2\": \"Val2\",\n\t\t\"Key3\": \"Val3\",\n\t\t\"Key4\": \"\",\n\t}\n\n\tif !reflect.DeepEqual(got, want) {\n\t\tt.Errorf(\"maps differ:\\ngot  %#v\\nwant %#v\", got, want)\n\t}\n}\n\nfunc marshalled() []byte {\n\tm := &pb3.IntMaps{}\n\tfor i := 0; i < 1000; i++ {\n\t\tm.Maps = append(m.Maps, &pb3.IntMap{\n\t\t\tRtt: map[int32]int32{1: 2},\n\t\t})\n\t}\n\tb, err := proto.Marshal(m)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Can't marshal %+v: %v\", m, err))\n\t}\n\treturn b\n}\n\nvar messageWithExtension1 = &pb2.MyMessage{Count: proto.Int32(7)}\n\n// messageWithExtension2 is in equal_test.go.\nvar messageWithExtension3 = &pb2.MyMessage{Count: proto.Int32(8)}\n\nfunc init() {\n\tif err := proto.SetExtension(messageWithExtension1, pb2.E_Ext_More, &pb2.Ext{Data: proto.String(\"Abbott\")}); err != nil {\n\t\tlog.Panicf(\"proto.SetExtension: %v\", err)\n\t}\n\tif err := proto.SetExtension(messageWithExtension3, pb2.E_Ext_More, &pb2.Ext{Data: proto.String(\"Costello\")}); err != nil {\n\t\tlog.Panicf(\"proto.SetExtension: %v\", err)\n\t}\n\n\t// Force messageWithExtension3 to have the extension encoded.\n\tproto.Marshal(messageWithExtension3)\n\n}\n\n// non-pointer custom message\ntype nonptrMessage struct{}\n\nfunc (m nonptrMessage) ProtoMessage()  {}\nfunc (m nonptrMessage) Reset()         {}\nfunc (m nonptrMessage) String() string { return \"\" }\n\nfunc (m nonptrMessage) Marshal() ([]byte, error) {\n\treturn []byte{42}, nil\n}\n\nvar SizeTests = []struct {\n\tdesc string\n\tpb   proto.Message\n}{\n\t{\"empty\", &pb2.OtherMessage{}},\n\t// Basic types.\n\t{\"bool\", &pb2.Defaults{F_Bool: proto.Bool(true)}},\n\t{\"int32\", &pb2.Defaults{F_Int32: proto.Int32(12)}},\n\t{\"negative int32\", &pb2.Defaults{F_Int32: proto.Int32(-1)}},\n\t{\"small int64\", &pb2.Defaults{F_Int64: proto.Int64(1)}},\n\t{\"big int64\", &pb2.Defaults{F_Int64: proto.Int64(1 << 20)}},\n\t{\"negative int64\", &pb2.Defaults{F_Int64: proto.Int64(-1)}},\n\t{\"fixed32\", &pb2.Defaults{F_Fixed32: proto.Uint32(71)}},\n\t{\"fixed64\", &pb2.Defaults{F_Fixed64: proto.Uint64(72)}},\n\t{\"uint32\", &pb2.Defaults{F_Uint32: proto.Uint32(123)}},\n\t{\"uint64\", &pb2.Defaults{F_Uint64: proto.Uint64(124)}},\n\t{\"float\", &pb2.Defaults{F_Float: proto.Float32(12.6)}},\n\t{\"double\", &pb2.Defaults{F_Double: proto.Float64(13.9)}},\n\t{\"string\", &pb2.Defaults{F_String: proto.String(\"niles\")}},\n\t{\"bytes\", &pb2.Defaults{F_Bytes: []byte(\"wowsa\")}},\n\t{\"bytes, empty\", &pb2.Defaults{F_Bytes: []byte{}}},\n\t{\"sint32\", &pb2.Defaults{F_Sint32: proto.Int32(65)}},\n\t{\"sint64\", &pb2.Defaults{F_Sint64: proto.Int64(67)}},\n\t{\"enum\", &pb2.Defaults{F_Enum: pb2.Defaults_BLUE.Enum()}},\n\t// Repeated.\n\t{\"empty repeated bool\", &pb2.MoreRepeated{Bools: []bool{}}},\n\t{\"repeated bool\", &pb2.MoreRepeated{Bools: []bool{false, true, true, false}}},\n\t{\"packed repeated bool\", &pb2.MoreRepeated{BoolsPacked: []bool{false, true, true, false, true, true, true}}},\n\t{\"repeated int32\", &pb2.MoreRepeated{Ints: []int32{1, 12203, 1729, -1}}},\n\t{\"repeated int32 packed\", &pb2.MoreRepeated{IntsPacked: []int32{1, 12203, 1729}}},\n\t{\"repeated int64 packed\", &pb2.MoreRepeated{Int64SPacked: []int64{\n\t\t// Need enough large numbers to verify that the header is counting the number of bytes\n\t\t// for the field, not the number of elements.\n\t\t1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62,\n\t\t1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62,\n\t}}},\n\t{\"repeated string\", &pb2.MoreRepeated{Strings: []string{\"r\", \"ken\", \"gri\"}}},\n\t{\"repeated fixed\", &pb2.MoreRepeated{Fixeds: []uint32{1, 2, 3, 4}}},\n\t// Nested.\n\t{\"nested\", &pb2.OldMessage{Nested: &pb2.OldMessage_Nested{Name: proto.String(\"whatever\")}}},\n\t{\"group\", &pb2.GroupOld{G: &pb2.GroupOld_G{X: proto.Int32(12345)}}},\n\t// Other things.\n\t{\"unrecognized\", &pb2.MoreRepeated{XXX_unrecognized: []byte{13<<3 | 0, 4}}},\n\t{\"extension (unencoded)\", messageWithExtension1},\n\t{\"extension (encoded)\", messageWithExtension3},\n\t// proto3 message\n\t{\"proto3 empty\", &pb3.Message{}},\n\t{\"proto3 bool\", &pb3.Message{TrueScotsman: true}},\n\t{\"proto3 int64\", &pb3.Message{ResultCount: 1}},\n\t{\"proto3 uint32\", &pb3.Message{HeightInCm: 123}},\n\t{\"proto3 float\", &pb3.Message{Score: 12.6}},\n\t{\"proto3 string\", &pb3.Message{Name: \"Snezana\"}},\n\t{\"proto3 bytes\", &pb3.Message{Data: []byte(\"wowsa\")}},\n\t{\"proto3 bytes, empty\", &pb3.Message{Data: []byte{}}},\n\t{\"proto3 enum\", &pb3.Message{Hilarity: pb3.Message_PUNS}},\n\t{\"proto3 map field with empty bytes\", &pb3.MessageWithMap{ByteMapping: map[bool][]byte{false: []byte{}}}},\n\n\t{\"map field\", &pb2.MessageWithMap{NameMapping: map[int32]string{1: \"Rob\", 7: \"Andrew\"}}},\n\t{\"map field with message\", &pb2.MessageWithMap{MsgMapping: map[int64]*pb2.FloatingPoint{0x7001: &pb2.FloatingPoint{F: proto.Float64(2.0)}}}},\n\t{\"map field with bytes\", &pb2.MessageWithMap{ByteMapping: map[bool][]byte{true: []byte(\"this time for sure\")}}},\n\t{\"map field with empty bytes\", &pb2.MessageWithMap{ByteMapping: map[bool][]byte{true: []byte{}}}},\n\n\t{\"map field with big entry\", &pb2.MessageWithMap{NameMapping: map[int32]string{8: strings.Repeat(\"x\", 125)}}},\n\t{\"map field with big key and val\", &pb2.MessageWithMap{StrToStr: map[string]string{strings.Repeat(\"x\", 70): strings.Repeat(\"y\", 70)}}},\n\t{\"map field with big numeric key\", &pb2.MessageWithMap{NameMapping: map[int32]string{0xf00d: \"om nom nom\"}}},\n\n\t{\"oneof not set\", &pb2.Oneof{}},\n\t{\"oneof bool\", &pb2.Oneof{Union: &pb2.Oneof_F_Bool{true}}},\n\t{\"oneof zero int32\", &pb2.Oneof{Union: &pb2.Oneof_F_Int32{0}}},\n\t{\"oneof big int32\", &pb2.Oneof{Union: &pb2.Oneof_F_Int32{1 << 20}}},\n\t{\"oneof int64\", &pb2.Oneof{Union: &pb2.Oneof_F_Int64{42}}},\n\t{\"oneof fixed32\", &pb2.Oneof{Union: &pb2.Oneof_F_Fixed32{43}}},\n\t{\"oneof fixed64\", &pb2.Oneof{Union: &pb2.Oneof_F_Fixed64{44}}},\n\t{\"oneof uint32\", &pb2.Oneof{Union: &pb2.Oneof_F_Uint32{45}}},\n\t{\"oneof uint64\", &pb2.Oneof{Union: &pb2.Oneof_F_Uint64{46}}},\n\t{\"oneof float\", &pb2.Oneof{Union: &pb2.Oneof_F_Float{47.1}}},\n\t{\"oneof double\", &pb2.Oneof{Union: &pb2.Oneof_F_Double{48.9}}},\n\t{\"oneof string\", &pb2.Oneof{Union: &pb2.Oneof_F_String{\"Rhythmic Fman\"}}},\n\t{\"oneof bytes\", &pb2.Oneof{Union: &pb2.Oneof_F_Bytes{[]byte(\"let go\")}}},\n\t{\"oneof sint32\", &pb2.Oneof{Union: &pb2.Oneof_F_Sint32{50}}},\n\t{\"oneof sint64\", &pb2.Oneof{Union: &pb2.Oneof_F_Sint64{51}}},\n\t{\"oneof enum\", &pb2.Oneof{Union: &pb2.Oneof_F_Enum{pb2.MyMessage_BLUE}}},\n\t{\"message for oneof\", &pb2.GoTestField{Label: proto.String(\"k\"), Type: proto.String(\"v\")}},\n\t{\"oneof message\", &pb2.Oneof{Union: &pb2.Oneof_F_Message{&pb2.GoTestField{Label: proto.String(\"k\"), Type: proto.String(\"v\")}}}},\n\t{\"oneof group\", &pb2.Oneof{Union: &pb2.Oneof_FGroup{&pb2.Oneof_F_Group{X: proto.Int32(52)}}}},\n\t{\"oneof largest tag\", &pb2.Oneof{Union: &pb2.Oneof_F_Largest_Tag{1}}},\n\t{\"multiple oneofs\", &pb2.Oneof{Union: &pb2.Oneof_F_Int32{1}, Tormato: &pb2.Oneof_Value{2}}},\n\n\t{\"non-pointer message\", nonptrMessage{}},\n}\n\nfunc TestSize(t *testing.T) {\n\tfor _, tc := range SizeTests {\n\t\tt.Run(tc.desc, func(t *testing.T) {\n\t\t\tsize := proto.Size(tc.pb)\n\t\t\tb, err := proto.Marshal(tc.pb)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"%v: Marshal failed: %v\", tc.desc, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif size != len(b) {\n\t\t\t\tt.Errorf(\"%v: Size(%v) = %d, want %d\", tc.desc, tc.pb, size, len(b))\n\t\t\t\tt.Logf(\"%v: bytes: %#v\", tc.desc, b)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestVarintSize(t *testing.T) {\n\t// Check the edge cases carefully.\n\ttestCases := []struct {\n\t\tn    uint64\n\t\tsize int\n\t}{\n\t\t{0, 1},\n\t\t{1, 1},\n\t\t{127, 1},\n\t\t{128, 2},\n\t\t{16383, 2},\n\t\t{16384, 3},\n\t\t{math.MaxInt64, 9},\n\t\t{math.MaxInt64 + 1, 10},\n\t}\n\tfor _, tc := range testCases {\n\t\tsize := proto.SizeVarint(tc.n)\n\t\tif size != tc.size {\n\t\t\tt.Errorf(\"sizeVarint(%d) = %d, want %d\", tc.n, size, tc.size)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "proto/registry.go",
    "content": "// Copyright 2019 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto\n\nimport (\n\t\"bytes\"\n\t\"compress/gzip\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"reflect\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/reflect/protodesc\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n\t\"google.golang.org/protobuf/runtime/protoimpl\"\n)\n\n// filePath is the path to the proto source file.\ntype filePath = string // e.g., \"google/protobuf/descriptor.proto\"\n\n// fileDescGZIP is the compressed contents of the encoded FileDescriptorProto.\ntype fileDescGZIP = []byte\n\nvar fileCache sync.Map // map[filePath]fileDescGZIP\n\n// RegisterFile is called from generated code to register the compressed\n// FileDescriptorProto with the file path for a proto source file.\n//\n// Deprecated: Use protoregistry.GlobalFiles.RegisterFile instead.\nfunc RegisterFile(s filePath, d fileDescGZIP) {\n\t// Decompress the descriptor.\n\tzr, err := gzip.NewReader(bytes.NewReader(d))\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"proto: invalid compressed file descriptor: %v\", err))\n\t}\n\tb, err := ioutil.ReadAll(zr)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"proto: invalid compressed file descriptor: %v\", err))\n\t}\n\n\t// Construct a protoreflect.FileDescriptor from the raw descriptor.\n\t// Note that DescBuilder.Build automatically registers the constructed\n\t// file descriptor with the v2 registry.\n\tprotoimpl.DescBuilder{RawDescriptor: b}.Build()\n\n\t// Locally cache the raw descriptor form for the file.\n\tfileCache.Store(s, d)\n}\n\n// FileDescriptor returns the compressed FileDescriptorProto given the file path\n// for a proto source file. It returns nil if not found.\n//\n// Deprecated: Use protoregistry.GlobalFiles.FindFileByPath instead.\nfunc FileDescriptor(s filePath) fileDescGZIP {\n\tif v, ok := fileCache.Load(s); ok {\n\t\treturn v.(fileDescGZIP)\n\t}\n\n\t// Find the descriptor in the v2 registry.\n\tvar b []byte\n\tif fd, _ := protoregistry.GlobalFiles.FindFileByPath(s); fd != nil {\n\t\tb, _ = Marshal(protodesc.ToFileDescriptorProto(fd))\n\t}\n\n\t// Locally cache the raw descriptor form for the file.\n\tif len(b) > 0 {\n\t\tv, _ := fileCache.LoadOrStore(s, protoimpl.X.CompressGZIP(b))\n\t\treturn v.(fileDescGZIP)\n\t}\n\treturn nil\n}\n\n// enumName is the name of an enum. For historical reasons, the enum name is\n// neither the full Go name nor the full protobuf name of the enum.\n// The name is the dot-separated combination of just the proto package that the\n// enum is declared within followed by the Go type name of the generated enum.\ntype enumName = string // e.g., \"my.proto.package.GoMessage_GoEnum\"\n\n// enumsByName maps enum values by name to their numeric counterpart.\ntype enumsByName = map[string]int32\n\n// enumsByNumber maps enum values by number to their name counterpart.\ntype enumsByNumber = map[int32]string\n\nvar enumCache sync.Map     // map[enumName]enumsByName\nvar numFilesCache sync.Map // map[protoreflect.FullName]int\n\n// RegisterEnum is called from the generated code to register the mapping of\n// enum value names to enum numbers for the enum identified by s.\n//\n// Deprecated: Use protoregistry.GlobalTypes.RegisterEnum instead.\nfunc RegisterEnum(s enumName, _ enumsByNumber, m enumsByName) {\n\tif _, ok := enumCache.Load(s); ok {\n\t\tpanic(\"proto: duplicate enum registered: \" + s)\n\t}\n\tenumCache.Store(s, m)\n\n\t// This does not forward registration to the v2 registry since this API\n\t// lacks sufficient information to construct a complete v2 enum descriptor.\n}\n\n// EnumValueMap returns the mapping from enum value names to enum numbers for\n// the enum of the given name. It returns nil if not found.\n//\n// Deprecated: Use protoregistry.GlobalTypes.FindEnumByName instead.\nfunc EnumValueMap(s enumName) enumsByName {\n\tif v, ok := enumCache.Load(s); ok {\n\t\treturn v.(enumsByName)\n\t}\n\n\t// Check whether the cache is stale. If the number of files in the current\n\t// package differs, then it means that some enums may have been recently\n\t// registered upstream that we do not know about.\n\tvar protoPkg protoreflect.FullName\n\tif i := strings.LastIndexByte(s, '.'); i >= 0 {\n\t\tprotoPkg = protoreflect.FullName(s[:i])\n\t}\n\tv, _ := numFilesCache.Load(protoPkg)\n\tnumFiles, _ := v.(int)\n\tif protoregistry.GlobalFiles.NumFilesByPackage(protoPkg) == numFiles {\n\t\treturn nil // cache is up-to-date; was not found earlier\n\t}\n\n\t// Update the enum cache for all enums declared in the given proto package.\n\tnumFiles = 0\n\tprotoregistry.GlobalFiles.RangeFilesByPackage(protoPkg, func(fd protoreflect.FileDescriptor) bool {\n\t\twalkEnums(fd, func(ed protoreflect.EnumDescriptor) {\n\t\t\tname := protoimpl.X.LegacyEnumName(ed)\n\t\t\tif _, ok := enumCache.Load(name); !ok {\n\t\t\t\tm := make(enumsByName)\n\t\t\t\tevs := ed.Values()\n\t\t\t\tfor i := evs.Len() - 1; i >= 0; i-- {\n\t\t\t\t\tev := evs.Get(i)\n\t\t\t\t\tm[string(ev.Name())] = int32(ev.Number())\n\t\t\t\t}\n\t\t\t\tenumCache.LoadOrStore(name, m)\n\t\t\t}\n\t\t})\n\t\tnumFiles++\n\t\treturn true\n\t})\n\tnumFilesCache.Store(protoPkg, numFiles)\n\n\t// Check cache again for enum map.\n\tif v, ok := enumCache.Load(s); ok {\n\t\treturn v.(enumsByName)\n\t}\n\treturn nil\n}\n\n// walkEnums recursively walks all enums declared in d.\nfunc walkEnums(d interface {\n\tEnums() protoreflect.EnumDescriptors\n\tMessages() protoreflect.MessageDescriptors\n}, f func(protoreflect.EnumDescriptor)) {\n\teds := d.Enums()\n\tfor i := eds.Len() - 1; i >= 0; i-- {\n\t\tf(eds.Get(i))\n\t}\n\tmds := d.Messages()\n\tfor i := mds.Len() - 1; i >= 0; i-- {\n\t\twalkEnums(mds.Get(i), f)\n\t}\n}\n\n// messageName is the full name of protobuf message.\ntype messageName = string\n\nvar messageTypeCache sync.Map // map[messageName]reflect.Type\n\n// RegisterType is called from generated code to register the message Go type\n// for a message of the given name.\n//\n// Deprecated: Use protoregistry.GlobalTypes.RegisterMessage instead.\nfunc RegisterType(m Message, s messageName) {\n\tmt := protoimpl.X.LegacyMessageTypeOf(m, protoreflect.FullName(s))\n\tif err := protoregistry.GlobalTypes.RegisterMessage(mt); err != nil {\n\t\tpanic(err)\n\t}\n\tmessageTypeCache.Store(s, reflect.TypeOf(m))\n}\n\n// RegisterMapType is called from generated code to register the Go map type\n// for a protobuf message representing a map entry.\n//\n// Deprecated: Do not use.\nfunc RegisterMapType(m interface{}, s messageName) {\n\tt := reflect.TypeOf(m)\n\tif t.Kind() != reflect.Map {\n\t\tpanic(fmt.Sprintf(\"invalid map kind: %v\", t))\n\t}\n\tif _, ok := messageTypeCache.Load(s); ok {\n\t\tpanic(fmt.Errorf(\"proto: duplicate proto message registered: %s\", s))\n\t}\n\tmessageTypeCache.Store(s, t)\n}\n\n// MessageType returns the message type for a named message.\n// It returns nil if not found.\n//\n// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead.\nfunc MessageType(s messageName) reflect.Type {\n\tif v, ok := messageTypeCache.Load(s); ok {\n\t\treturn v.(reflect.Type)\n\t}\n\n\t// Derive the message type from the v2 registry.\n\tvar t reflect.Type\n\tif mt, _ := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(s)); mt != nil {\n\t\tt = messageGoType(mt)\n\t}\n\n\t// If we could not get a concrete type, it is possible that it is a\n\t// pseudo-message for a map entry.\n\tif t == nil {\n\t\td, _ := protoregistry.GlobalFiles.FindDescriptorByName(protoreflect.FullName(s))\n\t\tif md, _ := d.(protoreflect.MessageDescriptor); md != nil && md.IsMapEntry() {\n\t\t\tkt := goTypeForField(md.Fields().ByNumber(1))\n\t\t\tvt := goTypeForField(md.Fields().ByNumber(2))\n\t\t\tt = reflect.MapOf(kt, vt)\n\t\t}\n\t}\n\n\t// Locally cache the message type for the given name.\n\tif t != nil {\n\t\tv, _ := messageTypeCache.LoadOrStore(s, t)\n\t\treturn v.(reflect.Type)\n\t}\n\treturn nil\n}\n\nfunc goTypeForField(fd protoreflect.FieldDescriptor) reflect.Type {\n\tswitch k := fd.Kind(); k {\n\tcase protoreflect.EnumKind:\n\t\tif et, _ := protoregistry.GlobalTypes.FindEnumByName(fd.Enum().FullName()); et != nil {\n\t\t\treturn enumGoType(et)\n\t\t}\n\t\treturn reflect.TypeOf(protoreflect.EnumNumber(0))\n\tcase protoreflect.MessageKind, protoreflect.GroupKind:\n\t\tif mt, _ := protoregistry.GlobalTypes.FindMessageByName(fd.Message().FullName()); mt != nil {\n\t\t\treturn messageGoType(mt)\n\t\t}\n\t\treturn reflect.TypeOf((*protoreflect.Message)(nil)).Elem()\n\tdefault:\n\t\treturn reflect.TypeOf(fd.Default().Interface())\n\t}\n}\n\nfunc enumGoType(et protoreflect.EnumType) reflect.Type {\n\treturn reflect.TypeOf(et.New(0))\n}\n\nfunc messageGoType(mt protoreflect.MessageType) reflect.Type {\n\treturn reflect.TypeOf(MessageV1(mt.Zero().Interface()))\n}\n\n// MessageName returns the full protobuf name for the given message type.\n//\n// Deprecated: Use protoreflect.MessageDescriptor.FullName instead.\nfunc MessageName(m Message) messageName {\n\tif m == nil {\n\t\treturn \"\"\n\t}\n\tif m, ok := m.(interface{ XXX_MessageName() messageName }); ok {\n\t\treturn m.XXX_MessageName()\n\t}\n\treturn messageName(protoimpl.X.MessageDescriptorOf(m).FullName())\n}\n\n// RegisterExtension is called from the generated code to register\n// the extension descriptor.\n//\n// Deprecated: Use protoregistry.GlobalTypes.RegisterExtension instead.\nfunc RegisterExtension(d *ExtensionDesc) {\n\tif err := protoregistry.GlobalTypes.RegisterExtension(d); err != nil {\n\t\tpanic(err)\n\t}\n}\n\ntype extensionsByNumber = map[int32]*ExtensionDesc\n\nvar extensionCache sync.Map // map[messageName]extensionsByNumber\n\n// RegisteredExtensions returns a map of the registered extensions for the\n// provided protobuf message, indexed by the extension field number.\n//\n// Deprecated: Use protoregistry.GlobalTypes.RangeExtensionsByMessage instead.\nfunc RegisteredExtensions(m Message) extensionsByNumber {\n\t// Check whether the cache is stale. If the number of extensions for\n\t// the given message differs, then it means that some extensions were\n\t// recently registered upstream that we do not know about.\n\ts := MessageName(m)\n\tv, _ := extensionCache.Load(s)\n\txs, _ := v.(extensionsByNumber)\n\tif protoregistry.GlobalTypes.NumExtensionsByMessage(protoreflect.FullName(s)) == len(xs) {\n\t\treturn xs // cache is up-to-date\n\t}\n\n\t// Cache is stale, re-compute the extensions map.\n\txs = make(extensionsByNumber)\n\tprotoregistry.GlobalTypes.RangeExtensionsByMessage(protoreflect.FullName(s), func(xt protoreflect.ExtensionType) bool {\n\t\tif xd, ok := xt.(*ExtensionDesc); ok {\n\t\t\txs[int32(xt.TypeDescriptor().Number())] = xd\n\t\t} else {\n\t\t\t// TODO: This implies that the protoreflect.ExtensionType is a\n\t\t\t// custom type not generated by protoc-gen-go. We could try and\n\t\t\t// convert the type to an ExtensionDesc.\n\t\t}\n\t\treturn true\n\t})\n\textensionCache.Store(s, xs)\n\treturn xs\n}\n"
  },
  {
    "path": "proto/registry_test.go",
    "content": "// Copyright 2019 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto_test\n\nimport (\n\t\"reflect\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\n\tdescpb \"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n)\n\nfunc TestRegistry(t *testing.T) {\n\tfile := new(descpb.DescriptorProto).ProtoReflect().Descriptor().ParentFile()\n\tpath := file.Path()\n\tpkg := file.Package()\n\tif got := proto.FileDescriptor(path); len(got) == 0 {\n\t\tt.Errorf(\"FileDescriptor(%q) = empty, want non-empty\", path)\n\t}\n\n\tname := protoreflect.FullName(pkg + \".FieldDescriptorProto_Label\")\n\tif got := proto.EnumValueMap(string(name)); len(got) == 0 {\n\t\tt.Errorf(\"EnumValueMap(%q) = empty, want non-empty\", name)\n\t}\n\n\tmsg := new(descpb.EnumDescriptorProto_EnumReservedRange)\n\tname = msg.ProtoReflect().Descriptor().FullName()\n\twantType := reflect.TypeOf(msg)\n\tgotType := proto.MessageType(string(name))\n\tif gotType != wantType {\n\t\tt.Errorf(\"MessageType(%q) = %v, want %v\", name, gotType, wantType)\n\t}\n}\n"
  },
  {
    "path": "proto/text_decode.go",
    "content": "// Copyright 2010 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto\n\nimport (\n\t\"encoding\"\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/encoding/prototext\"\n\tprotoV2 \"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\nconst wrapTextUnmarshalV2 = false\n\n// ParseError is returned by UnmarshalText.\ntype ParseError struct {\n\tMessage string\n\n\t// Deprecated: Do not use.\n\tLine, Offset int\n}\n\nfunc (e *ParseError) Error() string {\n\tif wrapTextUnmarshalV2 {\n\t\treturn e.Message\n\t}\n\tif e.Line == 1 {\n\t\treturn fmt.Sprintf(\"line 1.%d: %v\", e.Offset, e.Message)\n\t}\n\treturn fmt.Sprintf(\"line %d: %v\", e.Line, e.Message)\n}\n\n// UnmarshalText parses a proto text formatted string into m.\nfunc UnmarshalText(s string, m Message) error {\n\tif u, ok := m.(encoding.TextUnmarshaler); ok {\n\t\treturn u.UnmarshalText([]byte(s))\n\t}\n\n\tm.Reset()\n\tmi := MessageV2(m)\n\n\tif wrapTextUnmarshalV2 {\n\t\terr := prototext.UnmarshalOptions{\n\t\t\tAllowPartial: true,\n\t\t}.Unmarshal([]byte(s), mi)\n\t\tif err != nil {\n\t\t\treturn &ParseError{Message: err.Error()}\n\t\t}\n\t\treturn checkRequiredNotSet(mi)\n\t} else {\n\t\tif err := newTextParser(s).unmarshalMessage(mi.ProtoReflect(), \"\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn checkRequiredNotSet(mi)\n\t}\n}\n\ntype textParser struct {\n\ts            string // remaining input\n\tdone         bool   // whether the parsing is finished (success or error)\n\tbacked       bool   // whether back() was called\n\toffset, line int\n\tcur          token\n}\n\ntype token struct {\n\tvalue    string\n\terr      *ParseError\n\tline     int    // line number\n\toffset   int    // byte number from start of input, not start of line\n\tunquoted string // the unquoted version of value, if it was a quoted string\n}\n\nfunc newTextParser(s string) *textParser {\n\tp := new(textParser)\n\tp.s = s\n\tp.line = 1\n\tp.cur.line = 1\n\treturn p\n}\n\nfunc (p *textParser) unmarshalMessage(m protoreflect.Message, terminator string) (err error) {\n\tmd := m.Descriptor()\n\tfds := md.Fields()\n\n\t// A struct is a sequence of \"name: value\", terminated by one of\n\t// '>' or '}', or the end of the input.  A name may also be\n\t// \"[extension]\" or \"[type/url]\".\n\t//\n\t// The whole struct can also be an expanded Any message, like:\n\t// [type/url] < ... struct contents ... >\n\tseen := make(map[protoreflect.FieldNumber]bool)\n\tfor {\n\t\ttok := p.next()\n\t\tif tok.err != nil {\n\t\t\treturn tok.err\n\t\t}\n\t\tif tok.value == terminator {\n\t\t\tbreak\n\t\t}\n\t\tif tok.value == \"[\" {\n\t\t\tif err := p.unmarshalExtensionOrAny(m, seen); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// This is a normal, non-extension field.\n\t\tname := protoreflect.Name(tok.value)\n\t\tfd := fds.ByName(name)\n\t\tswitch {\n\t\tcase fd == nil:\n\t\t\tgd := fds.ByName(protoreflect.Name(strings.ToLower(string(name))))\n\t\t\tif gd != nil && gd.Kind() == protoreflect.GroupKind && gd.Message().Name() == name {\n\t\t\t\tfd = gd\n\t\t\t}\n\t\tcase fd.Kind() == protoreflect.GroupKind && fd.Message().Name() != name:\n\t\t\tfd = nil\n\t\tcase fd.IsWeak() && fd.Message().IsPlaceholder():\n\t\t\tfd = nil\n\t\t}\n\t\tif fd == nil {\n\t\t\ttypeName := string(md.FullName())\n\t\t\tif m, ok := m.Interface().(Message); ok {\n\t\t\t\tt := reflect.TypeOf(m)\n\t\t\t\tif t.Kind() == reflect.Ptr {\n\t\t\t\t\ttypeName = t.Elem().String()\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn p.errorf(\"unknown field name %q in %v\", name, typeName)\n\t\t}\n\t\tif od := fd.ContainingOneof(); od != nil && m.WhichOneof(od) != nil {\n\t\t\treturn p.errorf(\"field '%s' would overwrite already parsed oneof '%s'\", name, od.Name())\n\t\t}\n\t\tif fd.Cardinality() != protoreflect.Repeated && seen[fd.Number()] {\n\t\t\treturn p.errorf(\"non-repeated field %q was repeated\", fd.Name())\n\t\t}\n\t\tseen[fd.Number()] = true\n\n\t\t// Consume any colon.\n\t\tif err := p.checkForColon(fd); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Parse into the field.\n\t\tv := m.Get(fd)\n\t\tif !m.Has(fd) && (fd.IsList() || fd.IsMap() || fd.Message() != nil) {\n\t\t\tv = m.Mutable(fd)\n\t\t}\n\t\tif v, err = p.unmarshalValue(v, fd); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.Set(fd, v)\n\n\t\tif err := p.consumeOptionalSeparator(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (p *textParser) unmarshalExtensionOrAny(m protoreflect.Message, seen map[protoreflect.FieldNumber]bool) error {\n\tname, err := p.consumeExtensionOrAnyName()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If it contains a slash, it's an Any type URL.\n\tif slashIdx := strings.LastIndex(name, \"/\"); slashIdx >= 0 {\n\t\ttok := p.next()\n\t\tif tok.err != nil {\n\t\t\treturn tok.err\n\t\t}\n\t\t// consume an optional colon\n\t\tif tok.value == \":\" {\n\t\t\ttok = p.next()\n\t\t\tif tok.err != nil {\n\t\t\t\treturn tok.err\n\t\t\t}\n\t\t}\n\n\t\tvar terminator string\n\t\tswitch tok.value {\n\t\tcase \"<\":\n\t\t\tterminator = \">\"\n\t\tcase \"{\":\n\t\t\tterminator = \"}\"\n\t\tdefault:\n\t\t\treturn p.errorf(\"expected '{' or '<', found %q\", tok.value)\n\t\t}\n\n\t\tmt, err := protoregistry.GlobalTypes.FindMessageByURL(name)\n\t\tif err != nil {\n\t\t\treturn p.errorf(\"unrecognized message %q in google.protobuf.Any\", name[slashIdx+len(\"/\"):])\n\t\t}\n\t\tm2 := mt.New()\n\t\tif err := p.unmarshalMessage(m2, terminator); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tb, err := protoV2.Marshal(m2.Interface())\n\t\tif err != nil {\n\t\t\treturn p.errorf(\"failed to marshal message of type %q: %v\", name[slashIdx+len(\"/\"):], err)\n\t\t}\n\n\t\turlFD := m.Descriptor().Fields().ByName(\"type_url\")\n\t\tvalFD := m.Descriptor().Fields().ByName(\"value\")\n\t\tif seen[urlFD.Number()] {\n\t\t\treturn p.errorf(\"Any message unpacked multiple times, or %q already set\", urlFD.Name())\n\t\t}\n\t\tif seen[valFD.Number()] {\n\t\t\treturn p.errorf(\"Any message unpacked multiple times, or %q already set\", valFD.Name())\n\t\t}\n\t\tm.Set(urlFD, protoreflect.ValueOfString(name))\n\t\tm.Set(valFD, protoreflect.ValueOfBytes(b))\n\t\tseen[urlFD.Number()] = true\n\t\tseen[valFD.Number()] = true\n\t\treturn nil\n\t}\n\n\txname := protoreflect.FullName(name)\n\txt, _ := protoregistry.GlobalTypes.FindExtensionByName(xname)\n\tif xt == nil && isMessageSet(m.Descriptor()) {\n\t\txt, _ = protoregistry.GlobalTypes.FindExtensionByName(xname.Append(\"message_set_extension\"))\n\t}\n\tif xt == nil {\n\t\treturn p.errorf(\"unrecognized extension %q\", name)\n\t}\n\tfd := xt.TypeDescriptor()\n\tif fd.ContainingMessage().FullName() != m.Descriptor().FullName() {\n\t\treturn p.errorf(\"extension field %q does not extend message %q\", name, m.Descriptor().FullName())\n\t}\n\n\tif err := p.checkForColon(fd); err != nil {\n\t\treturn err\n\t}\n\n\tv := m.Get(fd)\n\tif !m.Has(fd) && (fd.IsList() || fd.IsMap() || fd.Message() != nil) {\n\t\tv = m.Mutable(fd)\n\t}\n\tv, err = p.unmarshalValue(v, fd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tm.Set(fd, v)\n\treturn p.consumeOptionalSeparator()\n}\n\nfunc (p *textParser) unmarshalValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) {\n\ttok := p.next()\n\tif tok.err != nil {\n\t\treturn v, tok.err\n\t}\n\tif tok.value == \"\" {\n\t\treturn v, p.errorf(\"unexpected EOF\")\n\t}\n\n\tswitch {\n\tcase fd.IsList():\n\t\tlv := v.List()\n\t\tvar err error\n\t\tif tok.value == \"[\" {\n\t\t\t// Repeated field with list notation, like [1,2,3].\n\t\t\tfor {\n\t\t\t\tvv := lv.NewElement()\n\t\t\t\tvv, err = p.unmarshalSingularValue(vv, fd)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn v, err\n\t\t\t\t}\n\t\t\t\tlv.Append(vv)\n\n\t\t\t\ttok := p.next()\n\t\t\t\tif tok.err != nil {\n\t\t\t\t\treturn v, tok.err\n\t\t\t\t}\n\t\t\t\tif tok.value == \"]\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif tok.value != \",\" {\n\t\t\t\t\treturn v, p.errorf(\"Expected ']' or ',' found %q\", tok.value)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn v, nil\n\t\t}\n\n\t\t// One value of the repeated field.\n\t\tp.back()\n\t\tvv := lv.NewElement()\n\t\tvv, err = p.unmarshalSingularValue(vv, fd)\n\t\tif err != nil {\n\t\t\treturn v, err\n\t\t}\n\t\tlv.Append(vv)\n\t\treturn v, nil\n\tcase fd.IsMap():\n\t\t// The map entry should be this sequence of tokens:\n\t\t//\t< key : KEY value : VALUE >\n\t\t// However, implementations may omit key or value, and technically\n\t\t// we should support them in any order.\n\t\tvar terminator string\n\t\tswitch tok.value {\n\t\tcase \"<\":\n\t\t\tterminator = \">\"\n\t\tcase \"{\":\n\t\t\tterminator = \"}\"\n\t\tdefault:\n\t\t\treturn v, p.errorf(\"expected '{' or '<', found %q\", tok.value)\n\t\t}\n\n\t\tkeyFD := fd.MapKey()\n\t\tvalFD := fd.MapValue()\n\n\t\tmv := v.Map()\n\t\tkv := keyFD.Default()\n\t\tvv := mv.NewValue()\n\t\tfor {\n\t\t\ttok := p.next()\n\t\t\tif tok.err != nil {\n\t\t\t\treturn v, tok.err\n\t\t\t}\n\t\t\tif tok.value == terminator {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tvar err error\n\t\t\tswitch tok.value {\n\t\t\tcase \"key\":\n\t\t\t\tif err := p.consumeToken(\":\"); err != nil {\n\t\t\t\t\treturn v, err\n\t\t\t\t}\n\t\t\t\tif kv, err = p.unmarshalSingularValue(kv, keyFD); err != nil {\n\t\t\t\t\treturn v, err\n\t\t\t\t}\n\t\t\t\tif err := p.consumeOptionalSeparator(); err != nil {\n\t\t\t\t\treturn v, err\n\t\t\t\t}\n\t\t\tcase \"value\":\n\t\t\t\tif err := p.checkForColon(valFD); err != nil {\n\t\t\t\t\treturn v, err\n\t\t\t\t}\n\t\t\t\tif vv, err = p.unmarshalSingularValue(vv, valFD); err != nil {\n\t\t\t\t\treturn v, err\n\t\t\t\t}\n\t\t\t\tif err := p.consumeOptionalSeparator(); err != nil {\n\t\t\t\t\treturn v, err\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tp.back()\n\t\t\t\treturn v, p.errorf(`expected \"key\", \"value\", or %q, found %q`, terminator, tok.value)\n\t\t\t}\n\t\t}\n\t\tmv.Set(kv.MapKey(), vv)\n\t\treturn v, nil\n\tdefault:\n\t\tp.back()\n\t\treturn p.unmarshalSingularValue(v, fd)\n\t}\n}\n\nfunc (p *textParser) unmarshalSingularValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) {\n\ttok := p.next()\n\tif tok.err != nil {\n\t\treturn v, tok.err\n\t}\n\tif tok.value == \"\" {\n\t\treturn v, p.errorf(\"unexpected EOF\")\n\t}\n\n\tswitch fd.Kind() {\n\tcase protoreflect.BoolKind:\n\t\tswitch tok.value {\n\t\tcase \"true\", \"1\", \"t\", \"True\":\n\t\t\treturn protoreflect.ValueOfBool(true), nil\n\t\tcase \"false\", \"0\", \"f\", \"False\":\n\t\t\treturn protoreflect.ValueOfBool(false), nil\n\t\t}\n\tcase protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:\n\t\tif x, err := strconv.ParseInt(tok.value, 0, 32); err == nil {\n\t\t\treturn protoreflect.ValueOfInt32(int32(x)), nil\n\t\t}\n\n\t\t// The C++ parser accepts large positive hex numbers that uses\n\t\t// two's complement arithmetic to represent negative numbers.\n\t\t// This feature is here for backwards compatibility with C++.\n\t\tif strings.HasPrefix(tok.value, \"0x\") {\n\t\t\tif x, err := strconv.ParseUint(tok.value, 0, 32); err == nil {\n\t\t\t\treturn protoreflect.ValueOfInt32(int32(-(int64(^x) + 1))), nil\n\t\t\t}\n\t\t}\n\tcase protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:\n\t\tif x, err := strconv.ParseInt(tok.value, 0, 64); err == nil {\n\t\t\treturn protoreflect.ValueOfInt64(int64(x)), nil\n\t\t}\n\n\t\t// The C++ parser accepts large positive hex numbers that uses\n\t\t// two's complement arithmetic to represent negative numbers.\n\t\t// This feature is here for backwards compatibility with C++.\n\t\tif strings.HasPrefix(tok.value, \"0x\") {\n\t\t\tif x, err := strconv.ParseUint(tok.value, 0, 64); err == nil {\n\t\t\t\treturn protoreflect.ValueOfInt64(int64(-(int64(^x) + 1))), nil\n\t\t\t}\n\t\t}\n\tcase protoreflect.Uint32Kind, protoreflect.Fixed32Kind:\n\t\tif x, err := strconv.ParseUint(tok.value, 0, 32); err == nil {\n\t\t\treturn protoreflect.ValueOfUint32(uint32(x)), nil\n\t\t}\n\tcase protoreflect.Uint64Kind, protoreflect.Fixed64Kind:\n\t\tif x, err := strconv.ParseUint(tok.value, 0, 64); err == nil {\n\t\t\treturn protoreflect.ValueOfUint64(uint64(x)), nil\n\t\t}\n\tcase protoreflect.FloatKind:\n\t\t// Ignore 'f' for compatibility with output generated by C++,\n\t\t// but don't remove 'f' when the value is \"-inf\" or \"inf\".\n\t\tv := tok.value\n\t\tif strings.HasSuffix(v, \"f\") && v != \"-inf\" && v != \"inf\" {\n\t\t\tv = v[:len(v)-len(\"f\")]\n\t\t}\n\t\tif x, err := strconv.ParseFloat(v, 32); err == nil {\n\t\t\treturn protoreflect.ValueOfFloat32(float32(x)), nil\n\t\t}\n\tcase protoreflect.DoubleKind:\n\t\t// Ignore 'f' for compatibility with output generated by C++,\n\t\t// but don't remove 'f' when the value is \"-inf\" or \"inf\".\n\t\tv := tok.value\n\t\tif strings.HasSuffix(v, \"f\") && v != \"-inf\" && v != \"inf\" {\n\t\t\tv = v[:len(v)-len(\"f\")]\n\t\t}\n\t\tif x, err := strconv.ParseFloat(v, 64); err == nil {\n\t\t\treturn protoreflect.ValueOfFloat64(float64(x)), nil\n\t\t}\n\tcase protoreflect.StringKind:\n\t\tif isQuote(tok.value[0]) {\n\t\t\treturn protoreflect.ValueOfString(tok.unquoted), nil\n\t\t}\n\tcase protoreflect.BytesKind:\n\t\tif isQuote(tok.value[0]) {\n\t\t\treturn protoreflect.ValueOfBytes([]byte(tok.unquoted)), nil\n\t\t}\n\tcase protoreflect.EnumKind:\n\t\tif x, err := strconv.ParseInt(tok.value, 0, 32); err == nil {\n\t\t\treturn protoreflect.ValueOfEnum(protoreflect.EnumNumber(x)), nil\n\t\t}\n\t\tvd := fd.Enum().Values().ByName(protoreflect.Name(tok.value))\n\t\tif vd != nil {\n\t\t\treturn protoreflect.ValueOfEnum(vd.Number()), nil\n\t\t}\n\tcase protoreflect.MessageKind, protoreflect.GroupKind:\n\t\tvar terminator string\n\t\tswitch tok.value {\n\t\tcase \"{\":\n\t\t\tterminator = \"}\"\n\t\tcase \"<\":\n\t\t\tterminator = \">\"\n\t\tdefault:\n\t\t\treturn v, p.errorf(\"expected '{' or '<', found %q\", tok.value)\n\t\t}\n\t\terr := p.unmarshalMessage(v.Message(), terminator)\n\t\treturn v, err\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid kind %v\", fd.Kind()))\n\t}\n\treturn v, p.errorf(\"invalid %v: %v\", fd.Kind(), tok.value)\n}\n\n// Consume a ':' from the input stream (if the next token is a colon),\n// returning an error if a colon is needed but not present.\nfunc (p *textParser) checkForColon(fd protoreflect.FieldDescriptor) *ParseError {\n\ttok := p.next()\n\tif tok.err != nil {\n\t\treturn tok.err\n\t}\n\tif tok.value != \":\" {\n\t\tif fd.Message() == nil {\n\t\t\treturn p.errorf(\"expected ':', found %q\", tok.value)\n\t\t}\n\t\tp.back()\n\t}\n\treturn nil\n}\n\n// consumeExtensionOrAnyName consumes an extension name or an Any type URL and\n// the following ']'. It returns the name or URL consumed.\nfunc (p *textParser) consumeExtensionOrAnyName() (string, error) {\n\ttok := p.next()\n\tif tok.err != nil {\n\t\treturn \"\", tok.err\n\t}\n\n\t// If extension name or type url is quoted, it's a single token.\n\tif len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] {\n\t\tname, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0]))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn name, p.consumeToken(\"]\")\n\t}\n\n\t// Consume everything up to \"]\"\n\tvar parts []string\n\tfor tok.value != \"]\" {\n\t\tparts = append(parts, tok.value)\n\t\ttok = p.next()\n\t\tif tok.err != nil {\n\t\t\treturn \"\", p.errorf(\"unrecognized type_url or extension name: %s\", tok.err)\n\t\t}\n\t\tif p.done && tok.value != \"]\" {\n\t\t\treturn \"\", p.errorf(\"unclosed type_url or extension name\")\n\t\t}\n\t}\n\treturn strings.Join(parts, \"\"), nil\n}\n\n// consumeOptionalSeparator consumes an optional semicolon or comma.\n// It is used in unmarshalMessage to provide backward compatibility.\nfunc (p *textParser) consumeOptionalSeparator() error {\n\ttok := p.next()\n\tif tok.err != nil {\n\t\treturn tok.err\n\t}\n\tif tok.value != \";\" && tok.value != \",\" {\n\t\tp.back()\n\t}\n\treturn nil\n}\n\nfunc (p *textParser) errorf(format string, a ...interface{}) *ParseError {\n\tpe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset}\n\tp.cur.err = pe\n\tp.done = true\n\treturn pe\n}\n\nfunc (p *textParser) skipWhitespace() {\n\ti := 0\n\tfor i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') {\n\t\tif p.s[i] == '#' {\n\t\t\t// comment; skip to end of line or input\n\t\t\tfor i < len(p.s) && p.s[i] != '\\n' {\n\t\t\t\ti++\n\t\t\t}\n\t\t\tif i == len(p.s) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif p.s[i] == '\\n' {\n\t\t\tp.line++\n\t\t}\n\t\ti++\n\t}\n\tp.offset += i\n\tp.s = p.s[i:len(p.s)]\n\tif len(p.s) == 0 {\n\t\tp.done = true\n\t}\n}\n\nfunc (p *textParser) advance() {\n\t// Skip whitespace\n\tp.skipWhitespace()\n\tif p.done {\n\t\treturn\n\t}\n\n\t// Start of non-whitespace\n\tp.cur.err = nil\n\tp.cur.offset, p.cur.line = p.offset, p.line\n\tp.cur.unquoted = \"\"\n\tswitch p.s[0] {\n\tcase '<', '>', '{', '}', ':', '[', ']', ';', ',', '/':\n\t\t// Single symbol\n\t\tp.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)]\n\tcase '\"', '\\'':\n\t\t// Quoted string\n\t\ti := 1\n\t\tfor i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\\n' {\n\t\t\tif p.s[i] == '\\\\' && i+1 < len(p.s) {\n\t\t\t\t// skip escaped char\n\t\t\t\ti++\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t\tif i >= len(p.s) || p.s[i] != p.s[0] {\n\t\t\tp.errorf(\"unmatched quote\")\n\t\t\treturn\n\t\t}\n\t\tunq, err := unquoteC(p.s[1:i], rune(p.s[0]))\n\t\tif err != nil {\n\t\t\tp.errorf(\"invalid quoted string %s: %v\", p.s[0:i+1], err)\n\t\t\treturn\n\t\t}\n\t\tp.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)]\n\t\tp.cur.unquoted = unq\n\tdefault:\n\t\ti := 0\n\t\tfor i < len(p.s) && isIdentOrNumberChar(p.s[i]) {\n\t\t\ti++\n\t\t}\n\t\tif i == 0 {\n\t\t\tp.errorf(\"unexpected byte %#x\", p.s[0])\n\t\t\treturn\n\t\t}\n\t\tp.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)]\n\t}\n\tp.offset += len(p.cur.value)\n}\n\n// Back off the parser by one token. Can only be done between calls to next().\n// It makes the next advance() a no-op.\nfunc (p *textParser) back() { p.backed = true }\n\n// Advances the parser and returns the new current token.\nfunc (p *textParser) next() *token {\n\tif p.backed || p.done {\n\t\tp.backed = false\n\t\treturn &p.cur\n\t}\n\tp.advance()\n\tif p.done {\n\t\tp.cur.value = \"\"\n\t} else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) {\n\t\t// Look for multiple quoted strings separated by whitespace,\n\t\t// and concatenate them.\n\t\tcat := p.cur\n\t\tfor {\n\t\t\tp.skipWhitespace()\n\t\t\tif p.done || !isQuote(p.s[0]) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tp.advance()\n\t\t\tif p.cur.err != nil {\n\t\t\t\treturn &p.cur\n\t\t\t}\n\t\t\tcat.value += \" \" + p.cur.value\n\t\t\tcat.unquoted += p.cur.unquoted\n\t\t}\n\t\tp.done = false // parser may have seen EOF, but we want to return cat\n\t\tp.cur = cat\n\t}\n\treturn &p.cur\n}\n\nfunc (p *textParser) consumeToken(s string) error {\n\ttok := p.next()\n\tif tok.err != nil {\n\t\treturn tok.err\n\t}\n\tif tok.value != s {\n\t\tp.back()\n\t\treturn p.errorf(\"expected %q, found %q\", s, tok.value)\n\t}\n\treturn nil\n}\n\nvar errBadUTF8 = errors.New(\"proto: bad UTF-8\")\n\nfunc unquoteC(s string, quote rune) (string, error) {\n\t// This is based on C++'s tokenizer.cc.\n\t// Despite its name, this is *not* parsing C syntax.\n\t// For instance, \"\\0\" is an invalid quoted string.\n\n\t// Avoid allocation in trivial cases.\n\tsimple := true\n\tfor _, r := range s {\n\t\tif r == '\\\\' || r == quote {\n\t\t\tsimple = false\n\t\t\tbreak\n\t\t}\n\t}\n\tif simple {\n\t\treturn s, nil\n\t}\n\n\tbuf := make([]byte, 0, 3*len(s)/2)\n\tfor len(s) > 0 {\n\t\tr, n := utf8.DecodeRuneInString(s)\n\t\tif r == utf8.RuneError && n == 1 {\n\t\t\treturn \"\", errBadUTF8\n\t\t}\n\t\ts = s[n:]\n\t\tif r != '\\\\' {\n\t\t\tif r < utf8.RuneSelf {\n\t\t\t\tbuf = append(buf, byte(r))\n\t\t\t} else {\n\t\t\t\tbuf = append(buf, string(r)...)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tch, tail, err := unescape(s)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tbuf = append(buf, ch...)\n\t\ts = tail\n\t}\n\treturn string(buf), nil\n}\n\nfunc unescape(s string) (ch string, tail string, err error) {\n\tr, n := utf8.DecodeRuneInString(s)\n\tif r == utf8.RuneError && n == 1 {\n\t\treturn \"\", \"\", errBadUTF8\n\t}\n\ts = s[n:]\n\tswitch r {\n\tcase 'a':\n\t\treturn \"\\a\", s, nil\n\tcase 'b':\n\t\treturn \"\\b\", s, nil\n\tcase 'f':\n\t\treturn \"\\f\", s, nil\n\tcase 'n':\n\t\treturn \"\\n\", s, nil\n\tcase 'r':\n\t\treturn \"\\r\", s, nil\n\tcase 't':\n\t\treturn \"\\t\", s, nil\n\tcase 'v':\n\t\treturn \"\\v\", s, nil\n\tcase '?':\n\t\treturn \"?\", s, nil // trigraph workaround\n\tcase '\\'', '\"', '\\\\':\n\t\treturn string(r), s, nil\n\tcase '0', '1', '2', '3', '4', '5', '6', '7':\n\t\tif len(s) < 2 {\n\t\t\treturn \"\", \"\", fmt.Errorf(`\\%c requires 2 following digits`, r)\n\t\t}\n\t\tss := string(r) + s[:2]\n\t\ts = s[2:]\n\t\ti, err := strconv.ParseUint(ss, 8, 8)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", fmt.Errorf(`\\%s contains non-octal digits`, ss)\n\t\t}\n\t\treturn string([]byte{byte(i)}), s, nil\n\tcase 'x', 'X', 'u', 'U':\n\t\tvar n int\n\t\tswitch r {\n\t\tcase 'x', 'X':\n\t\t\tn = 2\n\t\tcase 'u':\n\t\t\tn = 4\n\t\tcase 'U':\n\t\t\tn = 8\n\t\t}\n\t\tif len(s) < n {\n\t\t\treturn \"\", \"\", fmt.Errorf(`\\%c requires %d following digits`, r, n)\n\t\t}\n\t\tss := s[:n]\n\t\ts = s[n:]\n\t\ti, err := strconv.ParseUint(ss, 16, 64)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", fmt.Errorf(`\\%c%s contains non-hexadecimal digits`, r, ss)\n\t\t}\n\t\tif r == 'x' || r == 'X' {\n\t\t\treturn string([]byte{byte(i)}), s, nil\n\t\t}\n\t\tif i > utf8.MaxRune {\n\t\t\treturn \"\", \"\", fmt.Errorf(`\\%c%s is not a valid Unicode code point`, r, ss)\n\t\t}\n\t\treturn string(rune(i)), s, nil\n\t}\n\treturn \"\", \"\", fmt.Errorf(`unknown escape \\%c`, r)\n}\n\nfunc isIdentOrNumberChar(c byte) bool {\n\tswitch {\n\tcase 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z':\n\t\treturn true\n\tcase '0' <= c && c <= '9':\n\t\treturn true\n\t}\n\tswitch c {\n\tcase '-', '+', '.', '_':\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc isWhitespace(c byte) bool {\n\tswitch c {\n\tcase ' ', '\\t', '\\n', '\\r':\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc isQuote(c byte) bool {\n\tswitch c {\n\tcase '\"', '\\'':\n\t\treturn true\n\t}\n\treturn false\n}\n"
  },
  {
    "path": "proto/text_encode.go",
    "content": "// Copyright 2010 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto\n\nimport (\n\t\"bytes\"\n\t\"encoding\"\n\t\"fmt\"\n\t\"io\"\n\t\"math\"\n\t\"sort\"\n\t\"strings\"\n\n\t\"google.golang.org/protobuf/encoding/prototext\"\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\nconst wrapTextMarshalV2 = false\n\n// TextMarshaler is a configurable text format marshaler.\ntype TextMarshaler struct {\n\tCompact   bool // use compact text format (one line)\n\tExpandAny bool // expand google.protobuf.Any messages of known types\n}\n\n// Marshal writes the proto text format of m to w.\nfunc (tm *TextMarshaler) Marshal(w io.Writer, m Message) error {\n\tb, err := tm.marshal(m)\n\tif len(b) > 0 {\n\t\tif _, err := w.Write(b); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}\n\n// Text returns a proto text formatted string of m.\nfunc (tm *TextMarshaler) Text(m Message) string {\n\tb, _ := tm.marshal(m)\n\treturn string(b)\n}\n\nfunc (tm *TextMarshaler) marshal(m Message) ([]byte, error) {\n\tmr := MessageReflect(m)\n\tif mr == nil || !mr.IsValid() {\n\t\treturn []byte(\"<nil>\"), nil\n\t}\n\n\tif wrapTextMarshalV2 {\n\t\tif m, ok := m.(encoding.TextMarshaler); ok {\n\t\t\treturn m.MarshalText()\n\t\t}\n\n\t\topts := prototext.MarshalOptions{\n\t\t\tAllowPartial: true,\n\t\t\tEmitUnknown:  true,\n\t\t}\n\t\tif !tm.Compact {\n\t\t\topts.Indent = \"  \"\n\t\t}\n\t\tif !tm.ExpandAny {\n\t\t\topts.Resolver = (*protoregistry.Types)(nil)\n\t\t}\n\t\treturn opts.Marshal(mr.Interface())\n\t} else {\n\t\tw := &textWriter{\n\t\t\tcompact:   tm.Compact,\n\t\t\texpandAny: tm.ExpandAny,\n\t\t\tcomplete:  true,\n\t\t}\n\n\t\tif m, ok := m.(encoding.TextMarshaler); ok {\n\t\t\tb, err := m.MarshalText()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tw.Write(b)\n\t\t\treturn w.buf, nil\n\t\t}\n\n\t\terr := w.writeMessage(mr)\n\t\treturn w.buf, err\n\t}\n}\n\nvar (\n\tdefaultTextMarshaler = TextMarshaler{}\n\tcompactTextMarshaler = TextMarshaler{Compact: true}\n)\n\n// MarshalText writes the proto text format of m to w.\nfunc MarshalText(w io.Writer, m Message) error { return defaultTextMarshaler.Marshal(w, m) }\n\n// MarshalTextString returns a proto text formatted string of m.\nfunc MarshalTextString(m Message) string { return defaultTextMarshaler.Text(m) }\n\n// CompactText writes the compact proto text format of m to w.\nfunc CompactText(w io.Writer, m Message) error { return compactTextMarshaler.Marshal(w, m) }\n\n// CompactTextString returns a compact proto text formatted string of m.\nfunc CompactTextString(m Message) string { return compactTextMarshaler.Text(m) }\n\nvar (\n\tnewline         = []byte(\"\\n\")\n\tendBraceNewline = []byte(\"}\\n\")\n\tposInf          = []byte(\"inf\")\n\tnegInf          = []byte(\"-inf\")\n\tnan             = []byte(\"nan\")\n)\n\n// textWriter is an io.Writer that tracks its indentation level.\ntype textWriter struct {\n\tcompact   bool // same as TextMarshaler.Compact\n\texpandAny bool // same as TextMarshaler.ExpandAny\n\tcomplete  bool // whether the current position is a complete line\n\tindent    int  // indentation level; never negative\n\tbuf       []byte\n}\n\nfunc (w *textWriter) Write(p []byte) (n int, _ error) {\n\tnewlines := bytes.Count(p, newline)\n\tif newlines == 0 {\n\t\tif !w.compact && w.complete {\n\t\t\tw.writeIndent()\n\t\t}\n\t\tw.buf = append(w.buf, p...)\n\t\tw.complete = false\n\t\treturn len(p), nil\n\t}\n\n\tfrags := bytes.SplitN(p, newline, newlines+1)\n\tif w.compact {\n\t\tfor i, frag := range frags {\n\t\t\tif i > 0 {\n\t\t\t\tw.buf = append(w.buf, ' ')\n\t\t\t\tn++\n\t\t\t}\n\t\t\tw.buf = append(w.buf, frag...)\n\t\t\tn += len(frag)\n\t\t}\n\t\treturn n, nil\n\t}\n\n\tfor i, frag := range frags {\n\t\tif w.complete {\n\t\t\tw.writeIndent()\n\t\t}\n\t\tw.buf = append(w.buf, frag...)\n\t\tn += len(frag)\n\t\tif i+1 < len(frags) {\n\t\t\tw.buf = append(w.buf, '\\n')\n\t\t\tn++\n\t\t}\n\t}\n\tw.complete = len(frags[len(frags)-1]) == 0\n\treturn n, nil\n}\n\nfunc (w *textWriter) WriteByte(c byte) error {\n\tif w.compact && c == '\\n' {\n\t\tc = ' '\n\t}\n\tif !w.compact && w.complete {\n\t\tw.writeIndent()\n\t}\n\tw.buf = append(w.buf, c)\n\tw.complete = c == '\\n'\n\treturn nil\n}\n\nfunc (w *textWriter) writeName(fd protoreflect.FieldDescriptor) {\n\tif !w.compact && w.complete {\n\t\tw.writeIndent()\n\t}\n\tw.complete = false\n\n\tif fd.Kind() != protoreflect.GroupKind {\n\t\tw.buf = append(w.buf, fd.Name()...)\n\t\tw.WriteByte(':')\n\t} else {\n\t\t// Use message type name for group field name.\n\t\tw.buf = append(w.buf, fd.Message().Name()...)\n\t}\n\n\tif !w.compact {\n\t\tw.WriteByte(' ')\n\t}\n}\n\nfunc requiresQuotes(u string) bool {\n\t// When type URL contains any characters except [0-9A-Za-z./\\-]*, it must be quoted.\n\tfor _, ch := range u {\n\t\tswitch {\n\t\tcase ch == '.' || ch == '/' || ch == '_':\n\t\t\tcontinue\n\t\tcase '0' <= ch && ch <= '9':\n\t\t\tcontinue\n\t\tcase 'A' <= ch && ch <= 'Z':\n\t\t\tcontinue\n\t\tcase 'a' <= ch && ch <= 'z':\n\t\t\tcontinue\n\t\tdefault:\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n// writeProto3Any writes an expanded google.protobuf.Any message.\n//\n// It returns (false, nil) if sv value can't be unmarshaled (e.g. because\n// required messages are not linked in).\n//\n// It returns (true, error) when sv was written in expanded format or an error\n// was encountered.\nfunc (w *textWriter) writeProto3Any(m protoreflect.Message) (bool, error) {\n\tmd := m.Descriptor()\n\tfdURL := md.Fields().ByName(\"type_url\")\n\tfdVal := md.Fields().ByName(\"value\")\n\n\turl := m.Get(fdURL).String()\n\tmt, err := protoregistry.GlobalTypes.FindMessageByURL(url)\n\tif err != nil {\n\t\treturn false, nil\n\t}\n\n\tb := m.Get(fdVal).Bytes()\n\tm2 := mt.New()\n\tif err := proto.Unmarshal(b, m2.Interface()); err != nil {\n\t\treturn false, nil\n\t}\n\tw.Write([]byte(\"[\"))\n\tif requiresQuotes(url) {\n\t\tw.writeQuotedString(url)\n\t} else {\n\t\tw.Write([]byte(url))\n\t}\n\tif w.compact {\n\t\tw.Write([]byte(\"]:<\"))\n\t} else {\n\t\tw.Write([]byte(\"]: <\\n\"))\n\t\tw.indent++\n\t}\n\tif err := w.writeMessage(m2); err != nil {\n\t\treturn true, err\n\t}\n\tif w.compact {\n\t\tw.Write([]byte(\"> \"))\n\t} else {\n\t\tw.indent--\n\t\tw.Write([]byte(\">\\n\"))\n\t}\n\treturn true, nil\n}\n\nfunc (w *textWriter) writeMessage(m protoreflect.Message) error {\n\tmd := m.Descriptor()\n\tif w.expandAny && md.FullName() == \"google.protobuf.Any\" {\n\t\tif canExpand, err := w.writeProto3Any(m); canExpand {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfds := md.Fields()\n\tfor i := 0; i < fds.Len(); {\n\t\tfd := fds.Get(i)\n\t\tif od := fd.ContainingOneof(); od != nil {\n\t\t\tfd = m.WhichOneof(od)\n\t\t\ti += od.Fields().Len()\n\t\t} else {\n\t\t\ti++\n\t\t}\n\t\tif fd == nil || !m.Has(fd) {\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch {\n\t\tcase fd.IsList():\n\t\t\tlv := m.Get(fd).List()\n\t\t\tfor j := 0; j < lv.Len(); j++ {\n\t\t\t\tw.writeName(fd)\n\t\t\t\tv := lv.Get(j)\n\t\t\t\tif err := w.writeSingularValue(v, fd); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tw.WriteByte('\\n')\n\t\t\t}\n\t\tcase fd.IsMap():\n\t\t\tkfd := fd.MapKey()\n\t\t\tvfd := fd.MapValue()\n\t\t\tmv := m.Get(fd).Map()\n\n\t\t\ttype entry struct{ key, val protoreflect.Value }\n\t\t\tvar entries []entry\n\t\t\tmv.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {\n\t\t\t\tentries = append(entries, entry{k.Value(), v})\n\t\t\t\treturn true\n\t\t\t})\n\t\t\tsort.Slice(entries, func(i, j int) bool {\n\t\t\t\tswitch kfd.Kind() {\n\t\t\t\tcase protoreflect.BoolKind:\n\t\t\t\t\treturn !entries[i].key.Bool() && entries[j].key.Bool()\n\t\t\t\tcase protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:\n\t\t\t\t\treturn entries[i].key.Int() < entries[j].key.Int()\n\t\t\t\tcase protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind:\n\t\t\t\t\treturn entries[i].key.Uint() < entries[j].key.Uint()\n\t\t\t\tcase protoreflect.StringKind:\n\t\t\t\t\treturn entries[i].key.String() < entries[j].key.String()\n\t\t\t\tdefault:\n\t\t\t\t\tpanic(\"invalid kind\")\n\t\t\t\t}\n\t\t\t})\n\t\t\tfor _, entry := range entries {\n\t\t\t\tw.writeName(fd)\n\t\t\t\tw.WriteByte('<')\n\t\t\t\tif !w.compact {\n\t\t\t\t\tw.WriteByte('\\n')\n\t\t\t\t}\n\t\t\t\tw.indent++\n\t\t\t\tw.writeName(kfd)\n\t\t\t\tif err := w.writeSingularValue(entry.key, kfd); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tw.WriteByte('\\n')\n\t\t\t\tw.writeName(vfd)\n\t\t\t\tif err := w.writeSingularValue(entry.val, vfd); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tw.WriteByte('\\n')\n\t\t\t\tw.indent--\n\t\t\t\tw.WriteByte('>')\n\t\t\t\tw.WriteByte('\\n')\n\t\t\t}\n\t\tdefault:\n\t\t\tw.writeName(fd)\n\t\t\tif err := w.writeSingularValue(m.Get(fd), fd); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tw.WriteByte('\\n')\n\t\t}\n\t}\n\n\tif b := m.GetUnknown(); len(b) > 0 {\n\t\tw.writeUnknownFields(b)\n\t}\n\treturn w.writeExtensions(m)\n}\n\nfunc (w *textWriter) writeSingularValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) error {\n\tswitch fd.Kind() {\n\tcase protoreflect.FloatKind, protoreflect.DoubleKind:\n\t\tswitch vf := v.Float(); {\n\t\tcase math.IsInf(vf, +1):\n\t\t\tw.Write(posInf)\n\t\tcase math.IsInf(vf, -1):\n\t\t\tw.Write(negInf)\n\t\tcase math.IsNaN(vf):\n\t\t\tw.Write(nan)\n\t\tdefault:\n\t\t\tfmt.Fprint(w, v.Interface())\n\t\t}\n\tcase protoreflect.StringKind:\n\t\t// NOTE: This does not validate UTF-8 for historical reasons.\n\t\tw.writeQuotedString(string(v.String()))\n\tcase protoreflect.BytesKind:\n\t\tw.writeQuotedString(string(v.Bytes()))\n\tcase protoreflect.MessageKind, protoreflect.GroupKind:\n\t\tvar bra, ket byte = '<', '>'\n\t\tif fd.Kind() == protoreflect.GroupKind {\n\t\t\tbra, ket = '{', '}'\n\t\t}\n\t\tw.WriteByte(bra)\n\t\tif !w.compact {\n\t\t\tw.WriteByte('\\n')\n\t\t}\n\t\tw.indent++\n\t\tm := v.Message()\n\t\tif m2, ok := m.Interface().(encoding.TextMarshaler); ok {\n\t\t\tb, err := m2.MarshalText()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tw.Write(b)\n\t\t} else {\n\t\t\tw.writeMessage(m)\n\t\t}\n\t\tw.indent--\n\t\tw.WriteByte(ket)\n\tcase protoreflect.EnumKind:\n\t\tif ev := fd.Enum().Values().ByNumber(v.Enum()); ev != nil {\n\t\t\tfmt.Fprint(w, ev.Name())\n\t\t} else {\n\t\t\tfmt.Fprint(w, v.Enum())\n\t\t}\n\tdefault:\n\t\tfmt.Fprint(w, v.Interface())\n\t}\n\treturn nil\n}\n\n// writeQuotedString writes a quoted string in the protocol buffer text format.\nfunc (w *textWriter) writeQuotedString(s string) {\n\tw.WriteByte('\"')\n\tfor i := 0; i < len(s); i++ {\n\t\tswitch c := s[i]; c {\n\t\tcase '\\n':\n\t\t\tw.buf = append(w.buf, `\\n`...)\n\t\tcase '\\r':\n\t\t\tw.buf = append(w.buf, `\\r`...)\n\t\tcase '\\t':\n\t\t\tw.buf = append(w.buf, `\\t`...)\n\t\tcase '\"':\n\t\t\tw.buf = append(w.buf, `\\\"`...)\n\t\tcase '\\\\':\n\t\t\tw.buf = append(w.buf, `\\\\`...)\n\t\tdefault:\n\t\t\tif isPrint := c >= 0x20 && c < 0x7f; isPrint {\n\t\t\t\tw.buf = append(w.buf, c)\n\t\t\t} else {\n\t\t\t\tw.buf = append(w.buf, fmt.Sprintf(`\\%03o`, c)...)\n\t\t\t}\n\t\t}\n\t}\n\tw.WriteByte('\"')\n}\n\nfunc (w *textWriter) writeUnknownFields(b []byte) {\n\tif !w.compact {\n\t\tfmt.Fprintf(w, \"/* %d unknown bytes */\\n\", len(b))\n\t}\n\n\tfor len(b) > 0 {\n\t\tnum, wtyp, n := protowire.ConsumeTag(b)\n\t\tif n < 0 {\n\t\t\treturn\n\t\t}\n\t\tb = b[n:]\n\n\t\tif wtyp == protowire.EndGroupType {\n\t\t\tw.indent--\n\t\t\tw.Write(endBraceNewline)\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Fprint(w, num)\n\t\tif wtyp != protowire.StartGroupType {\n\t\t\tw.WriteByte(':')\n\t\t}\n\t\tif !w.compact || wtyp == protowire.StartGroupType {\n\t\t\tw.WriteByte(' ')\n\t\t}\n\t\tswitch wtyp {\n\t\tcase protowire.VarintType:\n\t\t\tv, n := protowire.ConsumeVarint(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t\tfmt.Fprint(w, v)\n\t\tcase protowire.Fixed32Type:\n\t\t\tv, n := protowire.ConsumeFixed32(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t\tfmt.Fprint(w, v)\n\t\tcase protowire.Fixed64Type:\n\t\t\tv, n := protowire.ConsumeFixed64(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t\tfmt.Fprint(w, v)\n\t\tcase protowire.BytesType:\n\t\t\tv, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t\tfmt.Fprintf(w, \"%q\", v)\n\t\tcase protowire.StartGroupType:\n\t\t\tw.WriteByte('{')\n\t\t\tw.indent++\n\t\tdefault:\n\t\t\tfmt.Fprintf(w, \"/* unknown wire type %d */\", wtyp)\n\t\t}\n\t\tw.WriteByte('\\n')\n\t}\n}\n\n// writeExtensions writes all the extensions in m.\nfunc (w *textWriter) writeExtensions(m protoreflect.Message) error {\n\tmd := m.Descriptor()\n\tif md.ExtensionRanges().Len() == 0 {\n\t\treturn nil\n\t}\n\n\ttype ext struct {\n\t\tdesc protoreflect.FieldDescriptor\n\t\tval  protoreflect.Value\n\t}\n\tvar exts []ext\n\tm.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tif fd.IsExtension() {\n\t\t\texts = append(exts, ext{fd, v})\n\t\t}\n\t\treturn true\n\t})\n\tsort.Slice(exts, func(i, j int) bool {\n\t\treturn exts[i].desc.Number() < exts[j].desc.Number()\n\t})\n\n\tfor _, ext := range exts {\n\t\t// For message set, use the name of the message as the extension name.\n\t\tname := string(ext.desc.FullName())\n\t\tif isMessageSet(ext.desc.ContainingMessage()) {\n\t\t\tname = strings.TrimSuffix(name, \".message_set_extension\")\n\t\t}\n\n\t\tif !ext.desc.IsList() {\n\t\t\tif err := w.writeSingularExtension(name, ext.val, ext.desc); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tlv := ext.val.List()\n\t\t\tfor i := 0; i < lv.Len(); i++ {\n\t\t\t\tif err := w.writeSingularExtension(name, lv.Get(i), ext.desc); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (w *textWriter) writeSingularExtension(name string, v protoreflect.Value, fd protoreflect.FieldDescriptor) error {\n\tfmt.Fprintf(w, \"[%s]:\", name)\n\tif !w.compact {\n\t\tw.WriteByte(' ')\n\t}\n\tif err := w.writeSingularValue(v, fd); err != nil {\n\t\treturn err\n\t}\n\tw.WriteByte('\\n')\n\treturn nil\n}\n\nfunc (w *textWriter) writeIndent() {\n\tif !w.complete {\n\t\treturn\n\t}\n\tfor i := 0; i < w.indent*2; i++ {\n\t\tw.buf = append(w.buf, ' ')\n\t}\n\tw.complete = false\n}\n"
  },
  {
    "path": "proto/text_test.go",
    "content": "// Copyright 2016 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto_test\n\nimport (\n\t\"bytes\"\n\t\"errors\"\n\t\"math\"\n\t\"strings\"\n\t\"sync\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\t\"github.com/google/go-cmp/cmp\"\n\n\tpb2 \"github.com/golang/protobuf/internal/testprotos/proto2_proto\"\n\tpb3 \"github.com/golang/protobuf/internal/testprotos/proto3_proto\"\n\tanypb \"github.com/golang/protobuf/ptypes/any\"\n)\n\nvar (\n\texpandedMarshaler        = proto.TextMarshaler{ExpandAny: true}\n\texpandedCompactMarshaler = proto.TextMarshaler{Compact: true, ExpandAny: true}\n)\n\n// anyEqual reports whether two messages which may be google.protobuf.Any or may\n// contain google.protobuf.Any fields are equal. We can't use proto.Equal for\n// comparison, because semantically equivalent messages may be marshaled to\n// binary in different tag order. Instead, trust that TextMarshaler with\n// ExpandAny option works and compare the text marshaling results.\nfunc anyEqual(got, want proto.Message) bool {\n\t// if messages are proto.Equal, no need to marshal.\n\tif proto.Equal(got, want) {\n\t\treturn true\n\t}\n\tg := expandedMarshaler.Text(got)\n\tw := expandedMarshaler.Text(want)\n\treturn g == w\n}\n\ntype golden struct {\n\tm    proto.Message\n\tt, c string\n}\n\nvar goldenMessages = makeGolden()\n\nfunc makeGolden() []golden {\n\tnested := &pb3.Nested{Bunny: \"Monty\"}\n\tnb, err := proto.Marshal(nested)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tm1 := &pb3.Message{\n\t\tName:        \"David\",\n\t\tResultCount: 47,\n\t\tAnything:    &anypb.Any{TypeUrl: \"type.googleapis.com/\" + proto.MessageName(nested), Value: nb},\n\t}\n\tm2 := &pb3.Message{\n\t\tName:        \"David\",\n\t\tResultCount: 47,\n\t\tAnything:    &anypb.Any{TypeUrl: \"http://[::1]/type.googleapis.com/\" + proto.MessageName(nested), Value: nb},\n\t}\n\tm3 := &pb3.Message{\n\t\tName:        \"David\",\n\t\tResultCount: 47,\n\t\tAnything:    &anypb.Any{TypeUrl: `type.googleapis.com/\"/` + proto.MessageName(nested), Value: nb},\n\t}\n\tm4 := &pb3.Message{\n\t\tName:        \"David\",\n\t\tResultCount: 47,\n\t\tAnything:    &anypb.Any{TypeUrl: \"type.googleapis.com/a/path/\" + proto.MessageName(nested), Value: nb},\n\t}\n\tm5 := &anypb.Any{TypeUrl: \"type.googleapis.com/\" + proto.MessageName(nested), Value: nb}\n\n\tany1 := &pb2.MyMessage{Count: proto.Int32(47), Name: proto.String(\"David\")}\n\tproto.SetExtension(any1, pb2.E_Ext_More, &pb2.Ext{Data: proto.String(\"foo\")})\n\tproto.SetExtension(any1, pb2.E_Ext_Text, proto.String(\"bar\"))\n\tany1b, err := proto.Marshal(any1)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tany2 := &pb2.MyMessage{Count: proto.Int32(42), Bikeshed: pb2.MyMessage_GREEN.Enum(), RepBytes: [][]byte{[]byte(\"roboto\")}}\n\tproto.SetExtension(any2, pb2.E_Ext_More, &pb2.Ext{Data: proto.String(\"baz\")})\n\tany2b, err := proto.Marshal(any2)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tm6 := &pb3.Message{\n\t\tName:        \"David\",\n\t\tResultCount: 47,\n\t\tAnything:    &anypb.Any{TypeUrl: \"type.googleapis.com/\" + proto.MessageName(any1), Value: any1b},\n\t\tManyThings: []*anypb.Any{\n\t\t\t&anypb.Any{TypeUrl: \"type.googleapis.com/\" + proto.MessageName(any2), Value: any2b},\n\t\t\t&anypb.Any{TypeUrl: \"type.googleapis.com/\" + proto.MessageName(any1), Value: any1b},\n\t\t},\n\t}\n\n\tconst (\n\t\tm1Golden = `\nname: \"David\"\nresult_count: 47\nanything: <\n  [type.googleapis.com/proto3_test.Nested]: <\n    bunny: \"Monty\"\n  >\n>\n`\n\t\tm2Golden = `\nname: \"David\"\nresult_count: 47\nanything: <\n  [\"http://[::1]/type.googleapis.com/proto3_test.Nested\"]: <\n    bunny: \"Monty\"\n  >\n>\n`\n\t\tm3Golden = `\nname: \"David\"\nresult_count: 47\nanything: <\n  [\"type.googleapis.com/\\\"/proto3_test.Nested\"]: <\n    bunny: \"Monty\"\n  >\n>\n`\n\t\tm4Golden = `\nname: \"David\"\nresult_count: 47\nanything: <\n  [type.googleapis.com/a/path/proto3_test.Nested]: <\n    bunny: \"Monty\"\n  >\n>\n`\n\t\tm5Golden = `\n[type.googleapis.com/proto3_test.Nested]: <\n  bunny: \"Monty\"\n>\n`\n\t\tm6Golden = `\nname: \"David\"\nresult_count: 47\nanything: <\n  [type.googleapis.com/proto2_test.MyMessage]: <\n    count: 47\n    name: \"David\"\n    [proto2_test.Ext.more]: <\n      data: \"foo\"\n    >\n    [proto2_test.Ext.text]: \"bar\"\n  >\n>\nmany_things: <\n  [type.googleapis.com/proto2_test.MyMessage]: <\n    count: 42\n    bikeshed: GREEN\n    rep_bytes: \"roboto\"\n    [proto2_test.Ext.more]: <\n      data: \"baz\"\n    >\n  >\n>\nmany_things: <\n  [type.googleapis.com/proto2_test.MyMessage]: <\n    count: 47\n    name: \"David\"\n    [proto2_test.Ext.more]: <\n      data: \"foo\"\n    >\n    [proto2_test.Ext.text]: \"bar\"\n  >\n>\n`\n\t)\n\treturn []golden{\n\t\t{m1, strings.TrimSpace(m1Golden) + \"\\n\", strings.TrimSpace(compact(m1Golden)) + \" \"},\n\t\t{m2, strings.TrimSpace(m2Golden) + \"\\n\", strings.TrimSpace(compact(m2Golden)) + \" \"},\n\t\t{m3, strings.TrimSpace(m3Golden) + \"\\n\", strings.TrimSpace(compact(m3Golden)) + \" \"},\n\t\t{m4, strings.TrimSpace(m4Golden) + \"\\n\", strings.TrimSpace(compact(m4Golden)) + \" \"},\n\t\t{m5, strings.TrimSpace(m5Golden) + \"\\n\", strings.TrimSpace(compact(m5Golden)) + \" \"},\n\t\t{m6, strings.TrimSpace(m6Golden) + \"\\n\", strings.TrimSpace(compact(m6Golden)) + \" \"},\n\t}\n}\n\nfunc TestMarshalGolden(t *testing.T) {\n\tfor _, tt := range goldenMessages {\n\t\tt.Run(\"\", func(t *testing.T) {\n\t\t\tif got, want := expandedMarshaler.Text(tt.m), tt.t; got != want {\n\t\t\t\tt.Errorf(\"message %v: got:\\n%s\\nwant:\\n%s\", tt.m, got, want)\n\t\t\t}\n\t\t\tif got, want := expandedCompactMarshaler.Text(tt.m), tt.c; got != want {\n\t\t\t\tt.Errorf(\"message %v: got:\\n`%s`\\nwant:\\n`%s`\", tt.m, got, want)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestUnmarshalGolden(t *testing.T) {\n\tfor _, tt := range goldenMessages {\n\t\tt.Run(\"\", func(t *testing.T) {\n\t\t\twant := tt.m\n\t\t\tgot := proto.Clone(tt.m)\n\t\t\tgot.Reset()\n\t\t\tif err := proto.UnmarshalText(tt.t, got); err != nil {\n\t\t\t\tt.Errorf(\"failed to unmarshal\\n%s\\nerror: %v\", tt.t, err)\n\t\t\t}\n\t\t\tif !anyEqual(got, want) {\n\t\t\t\tt.Errorf(\"message:\\n%s\\ngot:\\n%s\\nwant:\\n%s\", tt.t, got, want)\n\t\t\t}\n\t\t\tgot.Reset()\n\t\t\tif err := proto.UnmarshalText(tt.c, got); err != nil {\n\t\t\t\tt.Errorf(\"failed to unmarshal\\n%s\\nerror: %v\", tt.c, err)\n\t\t\t}\n\t\t\tif !anyEqual(got, want) {\n\t\t\t\tt.Errorf(\"message:\\n%s\\ngot:\\n%s\\nwant:\\n%s\", tt.c, got, want)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestMarshalUnknownAny(t *testing.T) {\n\tm := &pb3.Message{\n\t\tAnything: &anypb.Any{\n\t\t\tTypeUrl: \"foo\",\n\t\t\tValue:   []byte(\"bar\"),\n\t\t},\n\t}\n\twant := `anything: <\n  type_url: \"foo\"\n  value: \"bar\"\n>\n`\n\tgot := expandedMarshaler.Text(m)\n\tif got != want {\n\t\tt.Errorf(\"got:\\n%s\\nwant:\\n%s\", got, want)\n\t}\n}\n\nfunc TestAmbiguousAny(t *testing.T) {\n\tpb := &anypb.Any{}\n\terr := proto.UnmarshalText(`\n\ttype_url: \"ttt/proto3_test.Nested\"\n\tvalue: \"\\n\\x05Monty\"\n\t`, pb)\n\tif err != nil {\n\t\tt.Errorf(\"unexpected proto.UnmarshalText error: %v\", err)\n\t}\n}\n\nfunc TestUnmarshalOverwriteAny(t *testing.T) {\n\tpb := &anypb.Any{}\n\terr := proto.UnmarshalText(`\n  [type.googleapis.com/a/path/proto3_test.Nested]: <\n    bunny: \"Monty\"\n  >\n  [type.googleapis.com/a/path/proto3_test.Nested]: <\n    bunny: \"Rabbit of Caerbannog\"\n  >\n\t`, pb)\n\twant := `line 7: Any message unpacked multiple times, or \"type_url\" already set`\n\tif err.Error() != want {\n\t\tt.Errorf(\"incorrect error:\\ngot:  %v\\nwant: %v\", err.Error(), want)\n\t}\n}\n\nfunc TestUnmarshalAnyMixAndMatch(t *testing.T) {\n\tpb := &anypb.Any{}\n\terr := proto.UnmarshalText(`\n\tvalue: \"\\n\\x05Monty\"\n  [type.googleapis.com/a/path/proto3_test.Nested]: <\n    bunny: \"Rabbit of Caerbannog\"\n  >\n\t`, pb)\n\twant := `line 5: Any message unpacked multiple times, or \"value\" already set`\n\tif err.Error() != want {\n\t\tt.Errorf(\"incorrect error:\\ngot:  %v\\nwant: %v\", err.Error(), want)\n\t}\n}\n\n// textMessage implements the methods that allow it to marshal and unmarshal\n// itself as text.\ntype textMessage struct {\n}\n\nfunc (*textMessage) MarshalText() ([]byte, error) {\n\treturn []byte(\"custom\"), nil\n}\n\nfunc (*textMessage) UnmarshalText(bytes []byte) error {\n\tif string(bytes) != \"custom\" {\n\t\treturn errors.New(\"expected 'custom'\")\n\t}\n\treturn nil\n}\n\nfunc (*textMessage) Reset()         {}\nfunc (*textMessage) String() string { return \"\" }\nfunc (*textMessage) ProtoMessage()  {}\n\nfunc newTestMessage() *pb2.MyMessage {\n\tmsg := &pb2.MyMessage{\n\t\tCount: proto.Int32(42),\n\t\tName:  proto.String(\"Dave\"),\n\t\tQuote: proto.String(`\"I didn't want to go.\"`),\n\t\tPet:   []string{\"bunny\", \"kitty\", \"horsey\"},\n\t\tInner: &pb2.InnerMessage{\n\t\t\tHost:      proto.String(\"footrest.syd\"),\n\t\t\tPort:      proto.Int32(7001),\n\t\t\tConnected: proto.Bool(true),\n\t\t},\n\t\tOthers: []*pb2.OtherMessage{\n\t\t\t{\n\t\t\t\tKey:   proto.Int64(0xdeadbeef),\n\t\t\t\tValue: []byte{1, 65, 7, 12},\n\t\t\t},\n\t\t\t{\n\t\t\t\tWeight: proto.Float32(6.022),\n\t\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\t\tHost: proto.String(\"lesha.mtv\"),\n\t\t\t\t\tPort: proto.Int32(8002),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tBikeshed: pb2.MyMessage_BLUE.Enum(),\n\t\tSomegroup: &pb2.MyMessage_SomeGroup{\n\t\t\tGroupField: proto.Int32(8),\n\t\t},\n\t\t// One normally wouldn't do this.\n\t\t// This is an undeclared tag 13, as a varint (wire type 0) with value 4.\n\t\tXXX_unrecognized: []byte{13<<3 | 0, 4},\n\t}\n\text := &pb2.Ext{\n\t\tData: proto.String(\"Big gobs for big rats\"),\n\t}\n\tif err := proto.SetExtension(msg, pb2.E_Ext_More, ext); err != nil {\n\t\tpanic(err)\n\t}\n\tgreetings := []string{\"adg\", \"easy\", \"cow\"}\n\tif err := proto.SetExtension(msg, pb2.E_Greeting, greetings); err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Add an unknown extension. We marshal a pb2.Ext, and fake the ID.\n\tb, err := proto.Marshal(&pb2.Ext{Data: proto.String(\"3G skiing\")})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tb = append(proto.EncodeVarint(201<<3|proto.WireBytes), b...)\n\tproto.SetRawExtension(msg, 201, b)\n\n\t// Extensions can be plain fields, too, so let's test that.\n\tb = append(proto.EncodeVarint(202<<3|proto.WireVarint), 19)\n\tproto.SetRawExtension(msg, 202, b)\n\n\treturn msg\n}\n\nconst text = `count: 42\nname: \"Dave\"\nquote: \"\\\"I didn't want to go.\\\"\"\npet: \"bunny\"\npet: \"kitty\"\npet: \"horsey\"\ninner: <\n  host: \"footrest.syd\"\n  port: 7001\n  connected: true\n>\nothers: <\n  key: 3735928559\n  value: \"\\001A\\007\\014\"\n>\nothers: <\n  weight: 6.022\n  inner: <\n    host: \"lesha.mtv\"\n    port: 8002\n  >\n>\nbikeshed: BLUE\nSomeGroup {\n  group_field: 8\n}\n/* 18 unknown bytes */\n13: 4\n201: \"\\t3G skiing\"\n202: 19\n[proto2_test.Ext.more]: <\n  data: \"Big gobs for big rats\"\n>\n[proto2_test.greeting]: \"adg\"\n[proto2_test.greeting]: \"easy\"\n[proto2_test.greeting]: \"cow\"\n`\n\nfunc TestMarshalText(t *testing.T) {\n\tbuf := new(bytes.Buffer)\n\tif err := proto.MarshalText(buf, newTestMessage()); err != nil {\n\t\tt.Fatalf(\"proto.MarshalText: %v\", err)\n\t}\n\tgot := buf.String()\n\tif diff := cmp.Diff(text, got); got != text {\n\t\tt.Errorf(\"diff (-want +got):\\n%v\\n\\ngot:\\n%v\\n\\nwant:\\n%v\", diff, got, text)\n\t}\n}\n\nfunc TestMarshalTextCustomMessage(t *testing.T) {\n\tbuf := new(bytes.Buffer)\n\tif err := proto.MarshalText(buf, &textMessage{}); err != nil {\n\t\tt.Fatalf(\"proto.MarshalText: %v\", err)\n\t}\n\tgot := buf.String()\n\tif got != \"custom\" {\n\t\tt.Errorf(\"got:\\n%v\\n\\nwant:\\n%v\", got, \"custom\")\n\t}\n}\nfunc TestMarshalTextNil(t *testing.T) {\n\twant := \"<nil>\"\n\ttests := []proto.Message{nil, (*pb2.MyMessage)(nil)}\n\tfor i, test := range tests {\n\t\tbuf := new(bytes.Buffer)\n\t\tif err := proto.MarshalText(buf, test); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif got := buf.String(); got != want {\n\t\t\tt.Errorf(\"%d: got %q want %q\", i, got, want)\n\t\t}\n\t}\n}\n\nfunc TestMarshalTextUnknownEnum(t *testing.T) {\n\t// The Color enum only specifies values 0-2.\n\tm := &pb2.MyMessage{Bikeshed: pb2.MyMessage_Color(3).Enum()}\n\tgot := m.String()\n\tconst want = `bikeshed:3 `\n\tif got != want {\n\t\tt.Errorf(\"\\n got %q\\nwant %q\", got, want)\n\t}\n}\n\nfunc TestTextOneof(t *testing.T) {\n\ttests := []struct {\n\t\tm    proto.Message\n\t\twant string\n\t}{\n\t\t// zero message\n\t\t{&pb2.Communique{}, ``},\n\t\t// scalar field\n\t\t{&pb2.Communique{Union: &pb2.Communique_Number{4}}, `number:4`},\n\t\t// message field\n\t\t{&pb2.Communique{Union: &pb2.Communique_Msg{\n\t\t\t&pb2.Strings{StringField: proto.String(\"why hello!\")},\n\t\t}}, `msg:<string_field:\"why hello!\" >`},\n\t\t// bad oneof (should not panic)\n\t\t{&pb2.Communique{Union: &pb2.Communique_Msg{nil}}, `msg:<>`},\n\t}\n\tfor _, test := range tests {\n\t\tgot := strings.TrimSpace(test.m.String())\n\t\tif got != test.want {\n\t\t\tt.Errorf(\"got:\\n%s\\n\\nwant:\\n%s\", got, test.want)\n\t\t}\n\t}\n}\n\nfunc compact(src string) string {\n\t// s/[ \\n]+/ /g; s/ $//;\n\tdst := make([]byte, len(src))\n\tspace, comment := false, false\n\tj := 0\n\tfor i := 0; i < len(src); i++ {\n\t\tif strings.HasPrefix(src[i:], \"/*\") {\n\t\t\tcomment = true\n\t\t\ti++\n\t\t\tcontinue\n\t\t}\n\t\tif comment && strings.HasPrefix(src[i:], \"*/\") {\n\t\t\tcomment = false\n\t\t\ti++\n\t\t\tcontinue\n\t\t}\n\t\tif comment {\n\t\t\tcontinue\n\t\t}\n\t\tc := src[i]\n\t\tif c == ' ' || c == '\\n' {\n\t\t\tspace = true\n\t\t\tcontinue\n\t\t}\n\t\tif j > 0 && (dst[j-1] == ':' || dst[j-1] == '<' || dst[j-1] == '{') {\n\t\t\tspace = false\n\t\t}\n\t\tif c == '{' {\n\t\t\tspace = false\n\t\t}\n\t\tif space {\n\t\t\tdst[j] = ' '\n\t\t\tj++\n\t\t\tspace = false\n\t\t}\n\t\tdst[j] = c\n\t\tj++\n\t}\n\tif space {\n\t\tdst[j] = ' '\n\t\tj++\n\t}\n\treturn string(dst[0:j])\n}\n\nfunc TestCompactText(t *testing.T) {\n\tgot := proto.CompactTextString(newTestMessage())\n\tif got != compact(text) {\n\t\tt.Errorf(\"got:\\n%v\\n\\nwant:\\n%v\", got, compact(text))\n\t}\n}\n\nfunc TestStringEscaping(t *testing.T) {\n\ttestCases := []struct {\n\t\tin  *pb2.Strings\n\t\tout string\n\t}{\n\t\t{\n\t\t\t// Test data from C++ test (TextFormatTest.StringEscape).\n\t\t\t// Single divergence: we don't escape apostrophes.\n\t\t\t&pb2.Strings{StringField: proto.String(\"\\\"A string with ' characters \\n and \\r newlines and \\t tabs and \\001 slashes \\\\ and  multiple   spaces\")},\n\t\t\t\"string_field: \\\"\\\\\\\"A string with ' characters \\\\n and \\\\r newlines and \\\\t tabs and \\\\001 slashes \\\\\\\\ and  multiple   spaces\\\"\\n\",\n\t\t},\n\t\t{\n\t\t\t// Test data from the same C++ test.\n\t\t\t&pb2.Strings{StringField: proto.String(\"\\350\\260\\267\\346\\255\\214\")},\n\t\t\t\"string_field: \\\"\\\\350\\\\260\\\\267\\\\346\\\\255\\\\214\\\"\\n\",\n\t\t},\n\t\t{\n\t\t\t// Some UTF-8.\n\t\t\t&pb2.Strings{StringField: proto.String(\"\\x00\\x01\\xff\\x81\")},\n\t\t\t`string_field: \"\\000\\001\\377\\201\"` + \"\\n\",\n\t\t},\n\t}\n\n\tfor _, tc := range testCases {\n\t\tt.Run(\"\", func(t *testing.T) {\n\t\t\tvar buf bytes.Buffer\n\t\t\tif err := proto.MarshalText(&buf, tc.in); err != nil {\n\t\t\t\tt.Fatalf(\"proto.MarsalText error: %v\", err)\n\t\t\t}\n\t\t\tgot := buf.String()\n\t\t\tif got != tc.out {\n\t\t\t\tt.Fatalf(\"want:\\n%s\\n\\nwant:\\n%s\", got, tc.out)\n\t\t\t}\n\n\t\t\t// Check round-trip.\n\t\t\tpb := new(pb2.Strings)\n\t\t\tif err := proto.UnmarshalText(got, pb); err != nil {\n\t\t\t\tt.Fatalf(\"proto.UnmarshalText error: %v\", err)\n\t\t\t}\n\t\t\tif !proto.Equal(pb, tc.in) {\n\t\t\t\tt.Fatalf(\"proto.Equal mismatch:\\ngot:\\n%v\\n\\nwant:\\n%v\", pb, tc.in)\n\t\t\t}\n\t\t})\n\t}\n}\n\n// A limitedWriter accepts some output before it fails.\n// This is a proxy for something like a nearly-full or imminently-failing disk,\n// or a network connection that is about to die.\ntype limitedWriter struct {\n\tb     bytes.Buffer\n\tlimit int\n}\n\nvar outOfSpace = errors.New(\"proto: insufficient space\")\n\nfunc (w *limitedWriter) Write(p []byte) (n int, err error) {\n\tvar avail = w.limit - w.b.Len()\n\tif avail <= 0 {\n\t\treturn 0, outOfSpace\n\t}\n\tif len(p) <= avail {\n\t\treturn w.b.Write(p)\n\t}\n\tn, _ = w.b.Write(p[:avail])\n\treturn n, outOfSpace\n}\n\nfunc TestMarshalTextFailing(t *testing.T) {\n\t// Try lots of different sizes to exercise more error code-paths.\n\tfor lim := 0; lim < len(text); lim++ {\n\t\tbuf := new(limitedWriter)\n\t\tbuf.limit = lim\n\t\terr := proto.MarshalText(buf, newTestMessage())\n\t\t// We expect a certain error, but also some partial results in the buffer.\n\t\tif err != outOfSpace {\n\t\t\tt.Errorf(\"error mismatch: got %v, want %v\", err, outOfSpace)\n\t\t}\n\t\tgot := buf.b.String()\n\t\twant := text[:buf.limit]\n\t\tif got != want {\n\t\t\tt.Errorf(\"text mismatch:\\n\\ngot:\\n%v\\n\\nwant:\\n%v\", got, want)\n\t\t}\n\t}\n}\n\nfunc TestFloats(t *testing.T) {\n\ttests := []struct {\n\t\tf    float64\n\t\twant string\n\t}{\n\t\t{0, \"0\"},\n\t\t{4.7, \"4.7\"},\n\t\t{math.Inf(1), \"inf\"},\n\t\t{math.Inf(-1), \"-inf\"},\n\t\t{math.NaN(), \"nan\"},\n\t}\n\tfor _, test := range tests {\n\t\tmsg := &pb2.FloatingPoint{F: &test.f}\n\t\tgot := strings.TrimSpace(msg.String())\n\t\twant := `f:` + test.want\n\t\tif got != want {\n\t\t\tt.Errorf(\"f=%f: got %q, want %q\", test.f, got, want)\n\t\t}\n\t}\n}\n\nfunc TestRepeatedNilText(t *testing.T) {\n\tm := &pb2.MessageList{\n\t\tMessage: []*pb2.MessageList_Message{\n\t\t\tnil,\n\t\t\t&pb2.MessageList_Message{\n\t\t\t\tName: proto.String(\"Horse\"),\n\t\t\t},\n\t\t\tnil,\n\t\t},\n\t}\n\twant := `Message {\n}\nMessage {\n  name: \"Horse\"\n}\nMessage {\n}\n`\n\tif got := proto.MarshalTextString(m); got != want {\n\t\tt.Errorf(\"got:\\n%s\\n\\nwant:\\n%s\", got, want)\n\t}\n}\n\nfunc TestProto3Text(t *testing.T) {\n\ttests := []struct {\n\t\tm    proto.Message\n\t\twant string\n\t}{\n\t\t// zero message\n\t\t{&pb3.Message{}, ``},\n\t\t// zero message except for an empty byte slice\n\t\t{&pb3.Message{Data: []byte{}}, ``},\n\t\t// trivial case\n\t\t{&pb3.Message{Name: \"Rob\", HeightInCm: 175}, `name:\"Rob\" height_in_cm:175`},\n\t\t// empty map\n\t\t{&pb2.MessageWithMap{}, ``},\n\t\t// non-empty map; map format is the same as a repeated struct,\n\t\t// and they are sorted by key (numerically for numeric keys).\n\t\t{\n\t\t\t&pb2.MessageWithMap{NameMapping: map[int32]string{\n\t\t\t\t-1:      \"Negatory\",\n\t\t\t\t7:       \"Lucky\",\n\t\t\t\t1234:    \"Feist\",\n\t\t\t\t6345789: \"Otis\",\n\t\t\t}},\n\t\t\t`name_mapping:<key:-1 value:\"Negatory\" > ` +\n\t\t\t\t`name_mapping:<key:7 value:\"Lucky\" > ` +\n\t\t\t\t`name_mapping:<key:1234 value:\"Feist\" > ` +\n\t\t\t\t`name_mapping:<key:6345789 value:\"Otis\" >`,\n\t\t},\n\t\t// map with nil value; not well-defined, but we shouldn't crash\n\t\t{\n\t\t\t&pb2.MessageWithMap{MsgMapping: map[int64]*pb2.FloatingPoint{7: nil}},\n\t\t\t`msg_mapping:<key:7 value:<> >`,\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tgot := strings.TrimSpace(test.m.String())\n\t\tif got != test.want {\n\t\t\tt.Errorf(\"got:\\n%s\\n\\nwant:\\n%s\", got, test.want)\n\t\t}\n\t}\n}\n\nfunc TestRacyMarshal(t *testing.T) {\n\t// This test should be run with the race detector.\n\n\tany := &pb2.MyMessage{Count: proto.Int32(47), Name: proto.String(\"David\")}\n\tproto.SetExtension(any, pb2.E_Ext_Text, proto.String(\"bar\"))\n\tb, err := proto.Marshal(any)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tm := &pb3.Message{\n\t\tName:        \"David\",\n\t\tResultCount: 47,\n\t\tAnything:    &anypb.Any{TypeUrl: \"type.googleapis.com/\" + proto.MessageName(any), Value: b},\n\t}\n\n\twantText := proto.MarshalTextString(m)\n\twantBytes, err := proto.Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"proto.Marshal error: %v\", err)\n\t}\n\n\tvar wg sync.WaitGroup\n\tdefer wg.Wait()\n\twg.Add(20)\n\tfor i := 0; i < 10; i++ {\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tgot := proto.MarshalTextString(m)\n\t\t\tif got != wantText {\n\t\t\t\tt.Errorf(\"proto.MarshalTextString = %q, want %q\", got, wantText)\n\t\t\t}\n\t\t}()\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tgot, err := proto.Marshal(m)\n\t\t\tif !bytes.Equal(got, wantBytes) || err != nil {\n\t\t\t\tt.Errorf(\"proto.Marshal = (%x, %v), want (%x, nil)\", got, err, wantBytes)\n\t\t\t}\n\t\t}()\n\t}\n}\n\ntype UnmarshalTextTest struct {\n\tin  string\n\terr string // if \"\", no error expected\n\tout *pb2.MyMessage\n}\n\nfunc buildExtStructTest(text string) UnmarshalTextTest {\n\tmsg := &pb2.MyMessage{\n\t\tCount: proto.Int32(42),\n\t}\n\tproto.SetExtension(msg, pb2.E_Ext_More, &pb2.Ext{\n\t\tData: proto.String(\"Hello, world!\"),\n\t})\n\treturn UnmarshalTextTest{in: text, out: msg}\n}\n\nfunc buildExtDataTest(text string) UnmarshalTextTest {\n\tmsg := &pb2.MyMessage{\n\t\tCount: proto.Int32(42),\n\t}\n\tproto.SetExtension(msg, pb2.E_Ext_Text, proto.String(\"Hello, world!\"))\n\tproto.SetExtension(msg, pb2.E_Ext_Number, proto.Int32(1729))\n\treturn UnmarshalTextTest{in: text, out: msg}\n}\n\nfunc buildExtRepStringTest(text string) UnmarshalTextTest {\n\tmsg := &pb2.MyMessage{\n\t\tCount: proto.Int32(42),\n\t}\n\tif err := proto.SetExtension(msg, pb2.E_Greeting, []string{\"bula\", \"hola\"}); err != nil {\n\t\tpanic(err)\n\t}\n\treturn UnmarshalTextTest{in: text, out: msg}\n}\n\nvar unmarshalTextTests = []UnmarshalTextTest{\n\t// Basic\n\t{\n\t\tin: \" count:42\\n  name:\\\"Dave\\\" \",\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(\"Dave\"),\n\t\t},\n\t},\n\n\t// Empty quoted string\n\t{\n\t\tin: `count:42 name:\"\"`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(\"\"),\n\t\t},\n\t},\n\n\t// Quoted string concatenation with double quotes\n\t{\n\t\tin: `count:42 name: \"My name is \"` + \"\\n\" + `\"elsewhere\"`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(\"My name is elsewhere\"),\n\t\t},\n\t},\n\n\t// Quoted string concatenation with single quotes\n\t{\n\t\tin: \"count:42 name: 'My name is '\\n'elsewhere'\",\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(\"My name is elsewhere\"),\n\t\t},\n\t},\n\n\t// Quoted string concatenations with mixed quotes\n\t{\n\t\tin: \"count:42 name: 'My name is '\\n\\\"elsewhere\\\"\",\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(\"My name is elsewhere\"),\n\t\t},\n\t},\n\t{\n\t\tin: \"count:42 name: \\\"My name is \\\"\\n'elsewhere'\",\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(\"My name is elsewhere\"),\n\t\t},\n\t},\n\n\t// Quoted string with escaped apostrophe\n\t{\n\t\tin: `count:42 name: \"HOLIDAY - New Year\\'s Day\"`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(\"HOLIDAY - New Year's Day\"),\n\t\t},\n\t},\n\n\t// Quoted string with single quote\n\t{\n\t\tin: `count:42 name: 'Roger \"The Ramster\" Ramjet'`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(`Roger \"The Ramster\" Ramjet`),\n\t\t},\n\t},\n\n\t// Quoted string with all the accepted special characters from the C++ test\n\t{\n\t\tin: `count:42 name: ` + \"\\\"\\\\\\\"A string with \\\\' characters \\\\n and \\\\r newlines and \\\\t tabs and \\\\001 slashes \\\\\\\\ and  multiple   spaces\\\"\",\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(\"\\\"A string with ' characters \\n and \\r newlines and \\t tabs and \\001 slashes \\\\ and  multiple   spaces\"),\n\t\t},\n\t},\n\n\t// Quoted string with quoted backslash\n\t{\n\t\tin: `count:42 name: \"\\\\'xyz\"`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(`\\'xyz`),\n\t\t},\n\t},\n\n\t// Quoted string with UTF-8 bytes.\n\t{\n\t\tin: \"count:42 name: '\\303\\277\\302\\201\\x00\\xAB\\xCD\\xEF'\",\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(\"\\303\\277\\302\\201\\x00\\xAB\\xCD\\xEF\"),\n\t\t},\n\t},\n\n\t// Quoted string with unicode escapes.\n\t{\n\t\tin: `count: 42 name: \"\\u0047\\U00000047\\uffff\\U0010ffff\"`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(\"GG\\uffff\\U0010ffff\"),\n\t\t},\n\t},\n\n\t// Bad quoted string\n\t{\n\t\tin:  `inner: < host: \"\\0\" >` + \"\\n\",\n\t\terr: `line 1.15: invalid quoted string \"\\0\": \\0 requires 2 following digits`,\n\t},\n\n\t// Bad \\u escape\n\t{\n\t\tin:  `count: 42 name: \"\\u000\"`,\n\t\terr: `line 1.16: invalid quoted string \"\\u000\": \\u requires 4 following digits`,\n\t},\n\n\t// Bad \\U escape\n\t{\n\t\tin:  `count: 42 name: \"\\U0000000\"`,\n\t\terr: `line 1.16: invalid quoted string \"\\U0000000\": \\U requires 8 following digits`,\n\t},\n\n\t// Bad \\U escape\n\t{\n\t\tin:  `count: 42 name: \"\\xxx\"`,\n\t\terr: `line 1.16: invalid quoted string \"\\xxx\": \\xxx contains non-hexadecimal digits`,\n\t},\n\n\t// Number too large for int64\n\t{\n\t\tin:  \"count: 1 others { key: 123456789012345678901 }\",\n\t\terr: \"line 1.23: invalid int64: 123456789012345678901\",\n\t},\n\n\t// Number too large for int32\n\t{\n\t\tin:  \"count: 1234567890123\",\n\t\terr: \"line 1.7: invalid int32: 1234567890123\",\n\t},\n\n\t// Number in hexadecimal\n\t{\n\t\tin: \"count: 0x2beef\",\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(0x2beef),\n\t\t},\n\t},\n\n\t// Number in octal\n\t{\n\t\tin: \"count: 024601\",\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(024601),\n\t\t},\n\t},\n\n\t// Floating point number with \"f\" suffix\n\t{\n\t\tin: \"count: 4 others:< weight: 17.0f >\",\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(4),\n\t\t\tOthers: []*pb2.OtherMessage{\n\t\t\t\t{\n\t\t\t\t\tWeight: proto.Float32(17),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\n\t// Floating point positive infinity\n\t{\n\t\tin: \"count: 4 bigfloat: inf\",\n\t\tout: &pb2.MyMessage{\n\t\t\tCount:    proto.Int32(4),\n\t\t\tBigfloat: proto.Float64(math.Inf(1)),\n\t\t},\n\t},\n\n\t// Floating point negative infinity\n\t{\n\t\tin: \"count: 4 bigfloat: -inf\",\n\t\tout: &pb2.MyMessage{\n\t\t\tCount:    proto.Int32(4),\n\t\t\tBigfloat: proto.Float64(math.Inf(-1)),\n\t\t},\n\t},\n\n\t// Number too large for float32\n\t{\n\t\tin:  \"others:< weight: 12345678901234567890123456789012345678901234567890 >\",\n\t\terr: \"line 1.17: invalid float: 12345678901234567890123456789012345678901234567890\",\n\t},\n\n\t// Number posing as a quoted string\n\t{\n\t\tin:  `inner: < host: 12 >` + \"\\n\",\n\t\terr: `line 1.15: invalid string: 12`,\n\t},\n\n\t// Quoted string posing as int32\n\t{\n\t\tin:  `count: \"12\"`,\n\t\terr: `line 1.7: invalid int32: \"12\"`,\n\t},\n\n\t// Quoted string posing a float32\n\t{\n\t\tin:  `others:< weight: \"17.4\" >`,\n\t\terr: `line 1.17: invalid float: \"17.4\"`,\n\t},\n\n\t// unclosed bracket doesn't cause infinite loop\n\t{\n\t\tin:  `[`,\n\t\terr: `line 1.0: unclosed type_url or extension name`,\n\t},\n\n\t// Enum\n\t{\n\t\tin: `count:42 bikeshed: BLUE`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount:    proto.Int32(42),\n\t\t\tBikeshed: pb2.MyMessage_BLUE.Enum(),\n\t\t},\n\t},\n\n\t// Repeated field\n\t{\n\t\tin: `count:42 pet: \"horsey\" pet:\"bunny\"`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tPet:   []string{\"horsey\", \"bunny\"},\n\t\t},\n\t},\n\n\t// Repeated field with list notation\n\t{\n\t\tin: `count:42 pet: [\"horsey\", \"bunny\"]`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tPet:   []string{\"horsey\", \"bunny\"},\n\t\t},\n\t},\n\n\t// Repeated message with/without colon and <>/{}\n\t{\n\t\tin: `count:42 others:{} others{} others:<> others:{}`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tOthers: []*pb2.OtherMessage{\n\t\t\t\t{},\n\t\t\t\t{},\n\t\t\t\t{},\n\t\t\t\t{},\n\t\t\t},\n\t\t},\n\t},\n\n\t// Missing colon for inner message\n\t{\n\t\tin: `count:42 inner < host: \"cauchy.syd\" >`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\tHost: proto.String(\"cauchy.syd\"),\n\t\t\t},\n\t\t},\n\t},\n\n\t// Missing colon for string field\n\t{\n\t\tin:  `name \"Dave\"`,\n\t\terr: `line 1.5: expected ':', found \"\\\"Dave\\\"\"`,\n\t},\n\n\t// Missing colon for int32 field\n\t{\n\t\tin:  `count 42`,\n\t\terr: `line 1.6: expected ':', found \"42\"`,\n\t},\n\n\t// Missing required field\n\t{\n\t\tin:  `name: \"Pawel\"`,\n\t\terr: `required field proto2_test.MyMessage.count not set`,\n\t\tout: &pb2.MyMessage{\n\t\t\tName: proto.String(\"Pawel\"),\n\t\t},\n\t},\n\n\t// Missing required field in a required submessage\n\t{\n\t\tin:  `count: 42 we_must_go_deeper < leo_finally_won_an_oscar <> >`,\n\t\terr: `required field proto2_test.InnerMessage.host not set`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount:          proto.Int32(42),\n\t\t\tWeMustGoDeeper: &pb2.RequiredInnerMessage{LeoFinallyWonAnOscar: &pb2.InnerMessage{}},\n\t\t},\n\t},\n\n\t// Repeated non-repeated field\n\t{\n\t\tin:  `name: \"Rob\" name: \"Russ\"`,\n\t\terr: `line 1.12: non-repeated field \"name\" was repeated`,\n\t},\n\n\t// Group\n\t{\n\t\tin: `count: 17 SomeGroup { group_field: 12 }`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(17),\n\t\t\tSomegroup: &pb2.MyMessage_SomeGroup{\n\t\t\t\tGroupField: proto.Int32(12),\n\t\t\t},\n\t\t},\n\t},\n\n\t// Semicolon between fields\n\t{\n\t\tin: `count:3;name:\"Calvin\"`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(3),\n\t\t\tName:  proto.String(\"Calvin\"),\n\t\t},\n\t},\n\t// Comma between fields\n\t{\n\t\tin: `count:4,name:\"Ezekiel\"`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(4),\n\t\t\tName:  proto.String(\"Ezekiel\"),\n\t\t},\n\t},\n\n\t// Boolean false\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: false }`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\tHost:      proto.String(\"example.com\"),\n\t\t\t\tConnected: proto.Bool(false),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean true\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: true }`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\tHost:      proto.String(\"example.com\"),\n\t\t\t\tConnected: proto.Bool(true),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean 0\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: 0 }`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\tHost:      proto.String(\"example.com\"),\n\t\t\t\tConnected: proto.Bool(false),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean 1\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: 1 }`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\tHost:      proto.String(\"example.com\"),\n\t\t\t\tConnected: proto.Bool(true),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean f\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: f }`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\tHost:      proto.String(\"example.com\"),\n\t\t\t\tConnected: proto.Bool(false),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean t\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: t }`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\tHost:      proto.String(\"example.com\"),\n\t\t\t\tConnected: proto.Bool(true),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean False\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: False }`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\tHost:      proto.String(\"example.com\"),\n\t\t\t\tConnected: proto.Bool(false),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean True\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: True }`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\tHost:      proto.String(\"example.com\"),\n\t\t\t\tConnected: proto.Bool(true),\n\t\t\t},\n\t\t},\n\t},\n\n\t// Extension\n\tbuildExtStructTest(`count: 42 [proto2_test.Ext.more]:<data:\"Hello, world!\" >`),\n\tbuildExtStructTest(`count: 42 [proto2_test.Ext.more] {data:\"Hello, world!\"}`),\n\tbuildExtDataTest(`count: 42 [proto2_test.Ext.text]:\"Hello, world!\" [proto2_test.Ext.number]:1729`),\n\tbuildExtRepStringTest(`count: 42 [proto2_test.greeting]:\"bula\" [proto2_test.greeting]:\"hola\"`),\n\t{\n\t\tin:  `[proto2_test.complex]:<>`,\n\t\terr: `line 1.20: extension field \"proto2_test.complex\" does not extend message \"proto2_test.MyMessage\"`,\n\t},\n\n\t// Big all-in-one\n\t{\n\t\tin: \"count:42  # Meaning\\n\" +\n\t\t\t`name:\"Dave\" ` +\n\t\t\t`quote:\"\\\"I didn't want to go.\\\"\" ` +\n\t\t\t`pet:\"bunny\" ` +\n\t\t\t`pet:\"kitty\" ` +\n\t\t\t`pet:\"horsey\" ` +\n\t\t\t`inner:<` +\n\t\t\t`  host:\"footrest.syd\" ` +\n\t\t\t`  port:7001 ` +\n\t\t\t`  connected:true ` +\n\t\t\t`> ` +\n\t\t\t`others:<` +\n\t\t\t`  key:3735928559 ` +\n\t\t\t`  value:\"\\x01A\\a\\f\" ` +\n\t\t\t`> ` +\n\t\t\t`others:<` +\n\t\t\t\"  weight:58.9  # Atomic weight of Co\\n\" +\n\t\t\t`  inner:<` +\n\t\t\t`    host:\"lesha.mtv\" ` +\n\t\t\t`    port:8002 ` +\n\t\t\t`  >` +\n\t\t\t`>`,\n\t\tout: &pb2.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(\"Dave\"),\n\t\t\tQuote: proto.String(`\"I didn't want to go.\"`),\n\t\t\tPet:   []string{\"bunny\", \"kitty\", \"horsey\"},\n\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\tHost:      proto.String(\"footrest.syd\"),\n\t\t\t\tPort:      proto.Int32(7001),\n\t\t\t\tConnected: proto.Bool(true),\n\t\t\t},\n\t\t\tOthers: []*pb2.OtherMessage{\n\t\t\t\t{\n\t\t\t\t\tKey:   proto.Int64(3735928559),\n\t\t\t\t\tValue: []byte{0x1, 'A', '\\a', '\\f'},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tWeight: proto.Float32(58.9),\n\t\t\t\t\tInner: &pb2.InnerMessage{\n\t\t\t\t\t\tHost: proto.String(\"lesha.mtv\"),\n\t\t\t\t\t\tPort: proto.Int32(8002),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n}\n\nfunc TestUnmarshalText(t *testing.T) {\n\tfor _, test := range unmarshalTextTests {\n\t\tt.Run(\"\", func(t *testing.T) {\n\t\t\tpb := new(pb2.MyMessage)\n\t\t\terr := proto.UnmarshalText(test.in, pb)\n\t\t\tif test.err == \"\" {\n\t\t\t\t// We don't expect failure.\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Errorf(\"proto.UnmarshalText error: %v\", err)\n\t\t\t\t} else if !proto.Equal(pb, test.out) {\n\t\t\t\t\tt.Errorf(\"proto.Equal mismatch:\\ngot:  %v\\nwant: %v\", pb, test.out)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// We do expect failure.\n\t\t\t\tif err == nil {\n\t\t\t\t\tt.Errorf(\"proto.UnmarshalText: got nil error, want %v\", test.err)\n\t\t\t\t} else if !strings.Contains(err.Error(), test.err) {\n\t\t\t\t\tt.Errorf(\"proto.UnmarshalText error mismatch:\\ngot:  %v\\nwant: %v\", err.Error(), test.err)\n\t\t\t\t} else if _, ok := err.(*proto.RequiredNotSetError); ok && test.out != nil && !proto.Equal(pb, test.out) {\n\t\t\t\t\tt.Errorf(\"proto.Equal mismatch:\\ngot  %v\\nwant: %v\", pb, test.out)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestUnmarshalTextCustomMessage(t *testing.T) {\n\tmsg := &textMessage{}\n\tif err := proto.UnmarshalText(\"custom\", msg); err != nil {\n\t\tt.Errorf(\"proto.UnmarshalText error: %v\", err)\n\t}\n\tif err := proto.UnmarshalText(\"not custom\", msg); err == nil {\n\t\tt.Errorf(\"proto.UnmarshalText: got nil error, want non-nil\")\n\t}\n}\n\n// Regression test; this caused a panic.\nfunc TestRepeatedEnum(t *testing.T) {\n\tpb := new(pb2.RepeatedEnum)\n\tif err := proto.UnmarshalText(\"color: RED\", pb); err != nil {\n\t\tt.Fatal(err)\n\t}\n\texp := &pb2.RepeatedEnum{\n\t\tColor: []pb2.RepeatedEnum_Color{pb2.RepeatedEnum_RED},\n\t}\n\tif !proto.Equal(pb, exp) {\n\t\tt.Errorf(\"proto.Equal mismatch:\\ngot:  %v\\nwant %v\", pb, exp)\n\t}\n}\n\nfunc TestProto3TextParsing(t *testing.T) {\n\tm := new(pb3.Message)\n\tconst in = `name: \"Wallace\" true_scotsman: true`\n\twant := &pb3.Message{\n\t\tName:         \"Wallace\",\n\t\tTrueScotsman: true,\n\t}\n\tif err := proto.UnmarshalText(in, m); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !proto.Equal(m, want) {\n\t\tt.Errorf(\"proto.Equal mismatch:\\ngot:  %v\\nwant %v\", m, want)\n\t}\n}\n\nfunc TestMapParsing(t *testing.T) {\n\tm := new(pb2.MessageWithMap)\n\tconst in = `name_mapping:<key:1234 value:\"Feist\"> name_mapping:<key:1 value:\"Beatles\">` +\n\t\t`msg_mapping:<key:-4, value:<f: 2.0>,>` + // separating commas are okay\n\t\t`msg_mapping<key:-2 value<f: 4.0>>` + // no colon after \"value\"\n\t\t`msg_mapping:<value:<f: 5.0>>` + // omitted key\n\t\t`byte_mapping:<key:true value:\"so be it\">` +\n\t\t`byte_mapping:<>` // omitted key and value\n\twant := &pb2.MessageWithMap{\n\t\tNameMapping: map[int32]string{\n\t\t\t1:    \"Beatles\",\n\t\t\t1234: \"Feist\",\n\t\t},\n\t\tMsgMapping: map[int64]*pb2.FloatingPoint{\n\t\t\t-4: {F: proto.Float64(2.0)},\n\t\t\t-2: {F: proto.Float64(4.0)},\n\t\t\t0:  {F: proto.Float64(5.0)},\n\t\t},\n\t\tByteMapping: map[bool][]byte{\n\t\t\tfalse: nil,\n\t\t\ttrue:  []byte(\"so be it\"),\n\t\t},\n\t}\n\tif err := proto.UnmarshalText(in, m); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !proto.Equal(m, want) {\n\t\tt.Errorf(\"proto.Equal mismatch:\\ngot:  %v\\nwant %v\", m, want)\n\t}\n}\n\nfunc TestOneofParsing(t *testing.T) {\n\tconst in = `name:\"Shrek\"`\n\tm := new(pb2.Communique)\n\twant := &pb2.Communique{Union: &pb2.Communique_Name{\"Shrek\"}}\n\tif err := proto.UnmarshalText(in, m); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !proto.Equal(m, want) {\n\t\tt.Errorf(\"\\n got %v\\nwant %v\", m, want)\n\t}\n\n\tconst inOverwrite = `name:\"Shrek\" number:42`\n\tm = new(pb2.Communique)\n\ttestErr := \"line 1.13: field 'number' would overwrite already parsed oneof 'union'\"\n\tif err := proto.UnmarshalText(inOverwrite, m); err == nil {\n\t\tt.Errorf(\"proto.UnmarshalText: got nil error, want %v\", testErr)\n\t} else if err.Error() != testErr {\n\t\tt.Errorf(\"error mismatch:\\ngot:  %v\\nwant: %v\", err.Error(), testErr)\n\t}\n}\n"
  },
  {
    "path": "proto/wire.go",
    "content": "// Copyright 2019 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto\n\nimport (\n\tprotoV2 \"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// Size returns the size in bytes of the wire-format encoding of m.\nfunc Size(m Message) int {\n\tif m == nil {\n\t\treturn 0\n\t}\n\tmi := MessageV2(m)\n\treturn protoV2.Size(mi)\n}\n\n// Marshal returns the wire-format encoding of m.\nfunc Marshal(m Message) ([]byte, error) {\n\tb, err := marshalAppend(nil, m, false)\n\tif b == nil {\n\t\tb = zeroBytes\n\t}\n\treturn b, err\n}\n\nvar zeroBytes = make([]byte, 0, 0)\n\nfunc marshalAppend(buf []byte, m Message, deterministic bool) ([]byte, error) {\n\tif m == nil {\n\t\treturn nil, ErrNil\n\t}\n\tmi := MessageV2(m)\n\tnbuf, err := protoV2.MarshalOptions{\n\t\tDeterministic: deterministic,\n\t\tAllowPartial:  true,\n\t}.MarshalAppend(buf, mi)\n\tif err != nil {\n\t\treturn buf, err\n\t}\n\tif len(buf) == len(nbuf) {\n\t\tif !mi.ProtoReflect().IsValid() {\n\t\t\treturn buf, ErrNil\n\t\t}\n\t}\n\treturn nbuf, checkRequiredNotSet(mi)\n}\n\n// Unmarshal parses a wire-format message in b and places the decoded results in m.\n//\n// Unmarshal resets m before starting to unmarshal, so any existing data in m is always\n// removed. Use UnmarshalMerge to preserve and append to existing data.\nfunc Unmarshal(b []byte, m Message) error {\n\tm.Reset()\n\treturn UnmarshalMerge(b, m)\n}\n\n// UnmarshalMerge parses a wire-format message in b and places the decoded results in m.\nfunc UnmarshalMerge(b []byte, m Message) error {\n\tmi := MessageV2(m)\n\tout, err := protoV2.UnmarshalOptions{\n\t\tAllowPartial: true,\n\t\tMerge:        true,\n\t}.UnmarshalState(protoiface.UnmarshalInput{\n\t\tBuf:     b,\n\t\tMessage: mi.ProtoReflect(),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif out.Flags&protoiface.UnmarshalInitialized > 0 {\n\t\treturn nil\n\t}\n\treturn checkRequiredNotSet(mi)\n}\n"
  },
  {
    "path": "proto/wrappers.go",
    "content": "// Copyright 2019 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage proto\n\n// Bool stores v in a new bool value and returns a pointer to it.\nfunc Bool(v bool) *bool { return &v }\n\n// Int stores v in a new int32 value and returns a pointer to it.\n//\n// Deprecated: Use Int32 instead.\nfunc Int(v int) *int32 { return Int32(int32(v)) }\n\n// Int32 stores v in a new int32 value and returns a pointer to it.\nfunc Int32(v int32) *int32 { return &v }\n\n// Int64 stores v in a new int64 value and returns a pointer to it.\nfunc Int64(v int64) *int64 { return &v }\n\n// Uint32 stores v in a new uint32 value and returns a pointer to it.\nfunc Uint32(v uint32) *uint32 { return &v }\n\n// Uint64 stores v in a new uint64 value and returns a pointer to it.\nfunc Uint64(v uint64) *uint64 { return &v }\n\n// Float32 stores v in a new float32 value and returns a pointer to it.\nfunc Float32(v float32) *float32 { return &v }\n\n// Float64 stores v in a new float64 value and returns a pointer to it.\nfunc Float64(v float64) *float64 { return &v }\n\n// String stores v in a new string value and returns a pointer to it.\nfunc String(v string) *string { return &v }\n"
  },
  {
    "path": "protoc-gen-go/descriptor/descriptor.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto\n\npackage descriptor\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\tdescriptorpb \"google.golang.org/protobuf/types/descriptorpb\"\n\treflect \"reflect\"\n)\n\n// Symbols defined in public import of google/protobuf/descriptor.proto.\n\ntype Edition = descriptorpb.Edition\n\nconst Edition_EDITION_UNKNOWN = descriptorpb.Edition_EDITION_UNKNOWN\nconst Edition_EDITION_PROTO2 = descriptorpb.Edition_EDITION_PROTO2\nconst Edition_EDITION_PROTO3 = descriptorpb.Edition_EDITION_PROTO3\nconst Edition_EDITION_2023 = descriptorpb.Edition_EDITION_2023\nconst Edition_EDITION_2024 = descriptorpb.Edition_EDITION_2024\nconst Edition_EDITION_1_TEST_ONLY = descriptorpb.Edition_EDITION_1_TEST_ONLY\nconst Edition_EDITION_2_TEST_ONLY = descriptorpb.Edition_EDITION_2_TEST_ONLY\nconst Edition_EDITION_99997_TEST_ONLY = descriptorpb.Edition_EDITION_99997_TEST_ONLY\nconst Edition_EDITION_99998_TEST_ONLY = descriptorpb.Edition_EDITION_99998_TEST_ONLY\nconst Edition_EDITION_99999_TEST_ONLY = descriptorpb.Edition_EDITION_99999_TEST_ONLY\nconst Edition_EDITION_MAX = descriptorpb.Edition_EDITION_MAX\n\nvar Edition_name = descriptorpb.Edition_name\nvar Edition_value = descriptorpb.Edition_value\n\ntype ExtensionRangeOptions_VerificationState = descriptorpb.ExtensionRangeOptions_VerificationState\n\nconst ExtensionRangeOptions_DECLARATION = descriptorpb.ExtensionRangeOptions_DECLARATION\nconst ExtensionRangeOptions_UNVERIFIED = descriptorpb.ExtensionRangeOptions_UNVERIFIED\n\nvar ExtensionRangeOptions_VerificationState_name = descriptorpb.ExtensionRangeOptions_VerificationState_name\nvar ExtensionRangeOptions_VerificationState_value = descriptorpb.ExtensionRangeOptions_VerificationState_value\n\ntype FieldDescriptorProto_Type = descriptorpb.FieldDescriptorProto_Type\n\nconst FieldDescriptorProto_TYPE_DOUBLE = descriptorpb.FieldDescriptorProto_TYPE_DOUBLE\nconst FieldDescriptorProto_TYPE_FLOAT = descriptorpb.FieldDescriptorProto_TYPE_FLOAT\nconst FieldDescriptorProto_TYPE_INT64 = descriptorpb.FieldDescriptorProto_TYPE_INT64\nconst FieldDescriptorProto_TYPE_UINT64 = descriptorpb.FieldDescriptorProto_TYPE_UINT64\nconst FieldDescriptorProto_TYPE_INT32 = descriptorpb.FieldDescriptorProto_TYPE_INT32\nconst FieldDescriptorProto_TYPE_FIXED64 = descriptorpb.FieldDescriptorProto_TYPE_FIXED64\nconst FieldDescriptorProto_TYPE_FIXED32 = descriptorpb.FieldDescriptorProto_TYPE_FIXED32\nconst FieldDescriptorProto_TYPE_BOOL = descriptorpb.FieldDescriptorProto_TYPE_BOOL\nconst FieldDescriptorProto_TYPE_STRING = descriptorpb.FieldDescriptorProto_TYPE_STRING\nconst FieldDescriptorProto_TYPE_GROUP = descriptorpb.FieldDescriptorProto_TYPE_GROUP\nconst FieldDescriptorProto_TYPE_MESSAGE = descriptorpb.FieldDescriptorProto_TYPE_MESSAGE\nconst FieldDescriptorProto_TYPE_BYTES = descriptorpb.FieldDescriptorProto_TYPE_BYTES\nconst FieldDescriptorProto_TYPE_UINT32 = descriptorpb.FieldDescriptorProto_TYPE_UINT32\nconst FieldDescriptorProto_TYPE_ENUM = descriptorpb.FieldDescriptorProto_TYPE_ENUM\nconst FieldDescriptorProto_TYPE_SFIXED32 = descriptorpb.FieldDescriptorProto_TYPE_SFIXED32\nconst FieldDescriptorProto_TYPE_SFIXED64 = descriptorpb.FieldDescriptorProto_TYPE_SFIXED64\nconst FieldDescriptorProto_TYPE_SINT32 = descriptorpb.FieldDescriptorProto_TYPE_SINT32\nconst FieldDescriptorProto_TYPE_SINT64 = descriptorpb.FieldDescriptorProto_TYPE_SINT64\n\nvar FieldDescriptorProto_Type_name = descriptorpb.FieldDescriptorProto_Type_name\nvar FieldDescriptorProto_Type_value = descriptorpb.FieldDescriptorProto_Type_value\n\ntype FieldDescriptorProto_Label = descriptorpb.FieldDescriptorProto_Label\n\nconst FieldDescriptorProto_LABEL_OPTIONAL = descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL\nconst FieldDescriptorProto_LABEL_REPEATED = descriptorpb.FieldDescriptorProto_LABEL_REPEATED\nconst FieldDescriptorProto_LABEL_REQUIRED = descriptorpb.FieldDescriptorProto_LABEL_REQUIRED\n\nvar FieldDescriptorProto_Label_name = descriptorpb.FieldDescriptorProto_Label_name\nvar FieldDescriptorProto_Label_value = descriptorpb.FieldDescriptorProto_Label_value\n\ntype FileOptions_OptimizeMode = descriptorpb.FileOptions_OptimizeMode\n\nconst FileOptions_SPEED = descriptorpb.FileOptions_SPEED\nconst FileOptions_CODE_SIZE = descriptorpb.FileOptions_CODE_SIZE\nconst FileOptions_LITE_RUNTIME = descriptorpb.FileOptions_LITE_RUNTIME\n\nvar FileOptions_OptimizeMode_name = descriptorpb.FileOptions_OptimizeMode_name\nvar FileOptions_OptimizeMode_value = descriptorpb.FileOptions_OptimizeMode_value\n\ntype FieldOptions_CType = descriptorpb.FieldOptions_CType\n\nconst FieldOptions_STRING = descriptorpb.FieldOptions_STRING\nconst FieldOptions_CORD = descriptorpb.FieldOptions_CORD\nconst FieldOptions_STRING_PIECE = descriptorpb.FieldOptions_STRING_PIECE\n\nvar FieldOptions_CType_name = descriptorpb.FieldOptions_CType_name\nvar FieldOptions_CType_value = descriptorpb.FieldOptions_CType_value\n\ntype FieldOptions_JSType = descriptorpb.FieldOptions_JSType\n\nconst FieldOptions_JS_NORMAL = descriptorpb.FieldOptions_JS_NORMAL\nconst FieldOptions_JS_STRING = descriptorpb.FieldOptions_JS_STRING\nconst FieldOptions_JS_NUMBER = descriptorpb.FieldOptions_JS_NUMBER\n\nvar FieldOptions_JSType_name = descriptorpb.FieldOptions_JSType_name\nvar FieldOptions_JSType_value = descriptorpb.FieldOptions_JSType_value\n\ntype FieldOptions_OptionRetention = descriptorpb.FieldOptions_OptionRetention\n\nconst FieldOptions_RETENTION_UNKNOWN = descriptorpb.FieldOptions_RETENTION_UNKNOWN\nconst FieldOptions_RETENTION_RUNTIME = descriptorpb.FieldOptions_RETENTION_RUNTIME\nconst FieldOptions_RETENTION_SOURCE = descriptorpb.FieldOptions_RETENTION_SOURCE\n\nvar FieldOptions_OptionRetention_name = descriptorpb.FieldOptions_OptionRetention_name\nvar FieldOptions_OptionRetention_value = descriptorpb.FieldOptions_OptionRetention_value\n\ntype FieldOptions_OptionTargetType = descriptorpb.FieldOptions_OptionTargetType\n\nconst FieldOptions_TARGET_TYPE_UNKNOWN = descriptorpb.FieldOptions_TARGET_TYPE_UNKNOWN\nconst FieldOptions_TARGET_TYPE_FILE = descriptorpb.FieldOptions_TARGET_TYPE_FILE\nconst FieldOptions_TARGET_TYPE_EXTENSION_RANGE = descriptorpb.FieldOptions_TARGET_TYPE_EXTENSION_RANGE\nconst FieldOptions_TARGET_TYPE_MESSAGE = descriptorpb.FieldOptions_TARGET_TYPE_MESSAGE\nconst FieldOptions_TARGET_TYPE_FIELD = descriptorpb.FieldOptions_TARGET_TYPE_FIELD\nconst FieldOptions_TARGET_TYPE_ONEOF = descriptorpb.FieldOptions_TARGET_TYPE_ONEOF\nconst FieldOptions_TARGET_TYPE_ENUM = descriptorpb.FieldOptions_TARGET_TYPE_ENUM\nconst FieldOptions_TARGET_TYPE_ENUM_ENTRY = descriptorpb.FieldOptions_TARGET_TYPE_ENUM_ENTRY\nconst FieldOptions_TARGET_TYPE_SERVICE = descriptorpb.FieldOptions_TARGET_TYPE_SERVICE\nconst FieldOptions_TARGET_TYPE_METHOD = descriptorpb.FieldOptions_TARGET_TYPE_METHOD\n\nvar FieldOptions_OptionTargetType_name = descriptorpb.FieldOptions_OptionTargetType_name\nvar FieldOptions_OptionTargetType_value = descriptorpb.FieldOptions_OptionTargetType_value\n\ntype MethodOptions_IdempotencyLevel = descriptorpb.MethodOptions_IdempotencyLevel\n\nconst MethodOptions_IDEMPOTENCY_UNKNOWN = descriptorpb.MethodOptions_IDEMPOTENCY_UNKNOWN\nconst MethodOptions_NO_SIDE_EFFECTS = descriptorpb.MethodOptions_NO_SIDE_EFFECTS\nconst MethodOptions_IDEMPOTENT = descriptorpb.MethodOptions_IDEMPOTENT\n\nvar MethodOptions_IdempotencyLevel_name = descriptorpb.MethodOptions_IdempotencyLevel_name\nvar MethodOptions_IdempotencyLevel_value = descriptorpb.MethodOptions_IdempotencyLevel_value\n\ntype FeatureSet_FieldPresence = descriptorpb.FeatureSet_FieldPresence\n\nconst FeatureSet_FIELD_PRESENCE_UNKNOWN = descriptorpb.FeatureSet_FIELD_PRESENCE_UNKNOWN\nconst FeatureSet_EXPLICIT = descriptorpb.FeatureSet_EXPLICIT\nconst FeatureSet_IMPLICIT = descriptorpb.FeatureSet_IMPLICIT\nconst FeatureSet_LEGACY_REQUIRED = descriptorpb.FeatureSet_LEGACY_REQUIRED\n\nvar FeatureSet_FieldPresence_name = descriptorpb.FeatureSet_FieldPresence_name\nvar FeatureSet_FieldPresence_value = descriptorpb.FeatureSet_FieldPresence_value\n\ntype FeatureSet_EnumType = descriptorpb.FeatureSet_EnumType\n\nconst FeatureSet_ENUM_TYPE_UNKNOWN = descriptorpb.FeatureSet_ENUM_TYPE_UNKNOWN\nconst FeatureSet_OPEN = descriptorpb.FeatureSet_OPEN\nconst FeatureSet_CLOSED = descriptorpb.FeatureSet_CLOSED\n\nvar FeatureSet_EnumType_name = descriptorpb.FeatureSet_EnumType_name\nvar FeatureSet_EnumType_value = descriptorpb.FeatureSet_EnumType_value\n\ntype FeatureSet_RepeatedFieldEncoding = descriptorpb.FeatureSet_RepeatedFieldEncoding\n\nconst FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = descriptorpb.FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN\nconst FeatureSet_PACKED = descriptorpb.FeatureSet_PACKED\nconst FeatureSet_EXPANDED = descriptorpb.FeatureSet_EXPANDED\n\nvar FeatureSet_RepeatedFieldEncoding_name = descriptorpb.FeatureSet_RepeatedFieldEncoding_name\nvar FeatureSet_RepeatedFieldEncoding_value = descriptorpb.FeatureSet_RepeatedFieldEncoding_value\n\ntype FeatureSet_Utf8Validation = descriptorpb.FeatureSet_Utf8Validation\n\nconst FeatureSet_UTF8_VALIDATION_UNKNOWN = descriptorpb.FeatureSet_UTF8_VALIDATION_UNKNOWN\nconst FeatureSet_VERIFY = descriptorpb.FeatureSet_VERIFY\nconst FeatureSet_NONE = descriptorpb.FeatureSet_NONE\n\nvar FeatureSet_Utf8Validation_name = descriptorpb.FeatureSet_Utf8Validation_name\nvar FeatureSet_Utf8Validation_value = descriptorpb.FeatureSet_Utf8Validation_value\n\ntype FeatureSet_MessageEncoding = descriptorpb.FeatureSet_MessageEncoding\n\nconst FeatureSet_MESSAGE_ENCODING_UNKNOWN = descriptorpb.FeatureSet_MESSAGE_ENCODING_UNKNOWN\nconst FeatureSet_LENGTH_PREFIXED = descriptorpb.FeatureSet_LENGTH_PREFIXED\nconst FeatureSet_DELIMITED = descriptorpb.FeatureSet_DELIMITED\n\nvar FeatureSet_MessageEncoding_name = descriptorpb.FeatureSet_MessageEncoding_name\nvar FeatureSet_MessageEncoding_value = descriptorpb.FeatureSet_MessageEncoding_value\n\ntype FeatureSet_JsonFormat = descriptorpb.FeatureSet_JsonFormat\n\nconst FeatureSet_JSON_FORMAT_UNKNOWN = descriptorpb.FeatureSet_JSON_FORMAT_UNKNOWN\nconst FeatureSet_ALLOW = descriptorpb.FeatureSet_ALLOW\nconst FeatureSet_LEGACY_BEST_EFFORT = descriptorpb.FeatureSet_LEGACY_BEST_EFFORT\n\nvar FeatureSet_JsonFormat_name = descriptorpb.FeatureSet_JsonFormat_name\nvar FeatureSet_JsonFormat_value = descriptorpb.FeatureSet_JsonFormat_value\n\ntype GeneratedCodeInfo_Annotation_Semantic = descriptorpb.GeneratedCodeInfo_Annotation_Semantic\n\nconst GeneratedCodeInfo_Annotation_NONE = descriptorpb.GeneratedCodeInfo_Annotation_NONE\nconst GeneratedCodeInfo_Annotation_SET = descriptorpb.GeneratedCodeInfo_Annotation_SET\nconst GeneratedCodeInfo_Annotation_ALIAS = descriptorpb.GeneratedCodeInfo_Annotation_ALIAS\n\nvar GeneratedCodeInfo_Annotation_Semantic_name = descriptorpb.GeneratedCodeInfo_Annotation_Semantic_name\nvar GeneratedCodeInfo_Annotation_Semantic_value = descriptorpb.GeneratedCodeInfo_Annotation_Semantic_value\n\ntype FileDescriptorSet = descriptorpb.FileDescriptorSet\ntype FileDescriptorProto = descriptorpb.FileDescriptorProto\ntype DescriptorProto = descriptorpb.DescriptorProto\ntype ExtensionRangeOptions = descriptorpb.ExtensionRangeOptions\n\nconst Default_ExtensionRangeOptions_Verification = descriptorpb.Default_ExtensionRangeOptions_Verification\n\ntype FieldDescriptorProto = descriptorpb.FieldDescriptorProto\ntype OneofDescriptorProto = descriptorpb.OneofDescriptorProto\ntype EnumDescriptorProto = descriptorpb.EnumDescriptorProto\ntype EnumValueDescriptorProto = descriptorpb.EnumValueDescriptorProto\ntype ServiceDescriptorProto = descriptorpb.ServiceDescriptorProto\ntype MethodDescriptorProto = descriptorpb.MethodDescriptorProto\n\nconst Default_MethodDescriptorProto_ClientStreaming = descriptorpb.Default_MethodDescriptorProto_ClientStreaming\nconst Default_MethodDescriptorProto_ServerStreaming = descriptorpb.Default_MethodDescriptorProto_ServerStreaming\n\ntype FileOptions = descriptorpb.FileOptions\n\nconst Default_FileOptions_JavaMultipleFiles = descriptorpb.Default_FileOptions_JavaMultipleFiles\nconst Default_FileOptions_JavaStringCheckUtf8 = descriptorpb.Default_FileOptions_JavaStringCheckUtf8\nconst Default_FileOptions_OptimizeFor = descriptorpb.Default_FileOptions_OptimizeFor\nconst Default_FileOptions_CcGenericServices = descriptorpb.Default_FileOptions_CcGenericServices\nconst Default_FileOptions_JavaGenericServices = descriptorpb.Default_FileOptions_JavaGenericServices\nconst Default_FileOptions_PyGenericServices = descriptorpb.Default_FileOptions_PyGenericServices\nconst Default_FileOptions_Deprecated = descriptorpb.Default_FileOptions_Deprecated\nconst Default_FileOptions_CcEnableArenas = descriptorpb.Default_FileOptions_CcEnableArenas\n\ntype MessageOptions = descriptorpb.MessageOptions\n\nconst Default_MessageOptions_MessageSetWireFormat = descriptorpb.Default_MessageOptions_MessageSetWireFormat\nconst Default_MessageOptions_NoStandardDescriptorAccessor = descriptorpb.Default_MessageOptions_NoStandardDescriptorAccessor\nconst Default_MessageOptions_Deprecated = descriptorpb.Default_MessageOptions_Deprecated\n\ntype FieldOptions = descriptorpb.FieldOptions\n\nconst Default_FieldOptions_Ctype = descriptorpb.Default_FieldOptions_Ctype\nconst Default_FieldOptions_Jstype = descriptorpb.Default_FieldOptions_Jstype\nconst Default_FieldOptions_Lazy = descriptorpb.Default_FieldOptions_Lazy\nconst Default_FieldOptions_UnverifiedLazy = descriptorpb.Default_FieldOptions_UnverifiedLazy\nconst Default_FieldOptions_Deprecated = descriptorpb.Default_FieldOptions_Deprecated\nconst Default_FieldOptions_Weak = descriptorpb.Default_FieldOptions_Weak\nconst Default_FieldOptions_DebugRedact = descriptorpb.Default_FieldOptions_DebugRedact\n\ntype OneofOptions = descriptorpb.OneofOptions\ntype EnumOptions = descriptorpb.EnumOptions\n\nconst Default_EnumOptions_Deprecated = descriptorpb.Default_EnumOptions_Deprecated\n\ntype EnumValueOptions = descriptorpb.EnumValueOptions\n\nconst Default_EnumValueOptions_Deprecated = descriptorpb.Default_EnumValueOptions_Deprecated\nconst Default_EnumValueOptions_DebugRedact = descriptorpb.Default_EnumValueOptions_DebugRedact\n\ntype ServiceOptions = descriptorpb.ServiceOptions\n\nconst Default_ServiceOptions_Deprecated = descriptorpb.Default_ServiceOptions_Deprecated\n\ntype MethodOptions = descriptorpb.MethodOptions\n\nconst Default_MethodOptions_Deprecated = descriptorpb.Default_MethodOptions_Deprecated\nconst Default_MethodOptions_IdempotencyLevel = descriptorpb.Default_MethodOptions_IdempotencyLevel\n\ntype UninterpretedOption = descriptorpb.UninterpretedOption\ntype FeatureSet = descriptorpb.FeatureSet\ntype FeatureSetDefaults = descriptorpb.FeatureSetDefaults\ntype SourceCodeInfo = descriptorpb.SourceCodeInfo\ntype GeneratedCodeInfo = descriptorpb.GeneratedCodeInfo\ntype DescriptorProto_ExtensionRange = descriptorpb.DescriptorProto_ExtensionRange\ntype DescriptorProto_ReservedRange = descriptorpb.DescriptorProto_ReservedRange\ntype ExtensionRangeOptions_Declaration = descriptorpb.ExtensionRangeOptions_Declaration\ntype EnumDescriptorProto_EnumReservedRange = descriptorpb.EnumDescriptorProto_EnumReservedRange\ntype FieldOptions_EditionDefault = descriptorpb.FieldOptions_EditionDefault\ntype UninterpretedOption_NamePart = descriptorpb.UninterpretedOption_NamePart\ntype FeatureSetDefaults_FeatureSetEditionDefault = descriptorpb.FeatureSetDefaults_FeatureSetEditionDefault\ntype SourceCodeInfo_Location = descriptorpb.SourceCodeInfo_Location\ntype GeneratedCodeInfo_Annotation = descriptorpb.GeneratedCodeInfo_Annotation\n\nvar File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto protoreflect.FileDescriptor\n\nvar file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc = []byte{\n\t0x0a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c,\n\t0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f,\n\t0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72,\n\t0x69, 0x70, 0x74, 0x6f, 0x72, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70,\n\t0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,\n\t0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68,\n\t0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65,\n\t0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x3b,\n\t0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x32,\n}\n\nvar file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = []interface{}{}\nvar file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = []int32{\n\t0, // [0:0] is the sub-list for method output_type\n\t0, // [0:0] is the sub-list for method input_type\n\t0, // [0:0] is the sub-list for extension type_name\n\t0, // [0:0] is the sub-list for extension extendee\n\t0, // [0:0] is the sub-list for field type_name\n}\n\nfunc init() { file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_init() }\nfunc file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_init() {\n\tif File_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto != nil {\n\t\treturn\n\t}\n\ttype x struct{}\n\tout := protoimpl.TypeBuilder{\n\t\tFile: protoimpl.DescBuilder{\n\t\t\tGoPackagePath: reflect.TypeOf(x{}).PkgPath(),\n\t\t\tRawDescriptor: file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes,\n\t\tDependencyIndexes: file_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs,\n\t}.Build()\n\tFile_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto = out.File\n\tfile_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_rawDesc = nil\n\tfile_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_goTypes = nil\n\tfile_github_com_golang_protobuf_protoc_gen_go_descriptor_descriptor_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "protoc-gen-go/generator/generator.go",
    "content": "// Copyright 2010 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package generator is deprecated.\n//\n// This package is excluded from the Go protocol buffer compatibility guarantee\n// and may be deleted at some point in the future.\n//\n// Deprecated: Use the \"google.golang.org/protobuf/compiler/protogen\" package\n// instead to write protoc plugins in Go.\npackage generator\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"compress/gzip\"\n\t\"crypto/sha256\"\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"go/ast\"\n\t\"go/build\"\n\t\"go/parser\"\n\t\"go/printer\"\n\t\"go/token\"\n\t\"log\"\n\t\"os\"\n\t\"path\"\n\t\"sort\"\n\t\"strconv\"\n\t\"strings\"\n\t\"unicode\"\n\t\"unicode/utf8\"\n\n\t\"github.com/golang/protobuf/proto\"\n\t\"github.com/golang/protobuf/protoc-gen-go/generator/internal/remap\"\n\n\t\"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n\tplugin \"github.com/golang/protobuf/protoc-gen-go/plugin\"\n)\n\nfunc init() {\n\tfmt.Fprint(os.Stderr,\n\t\t\"WARNING: Package \\\"github.com/golang/protobuf/protoc-gen-go/generator\\\" is deprecated.\\n\"+\n\t\t\t\"\\tA future release of golang/protobuf will delete this package,\\n\"+\n\t\t\t\"\\twhich has long been excluded from the compatibility promise.\\n\\n\")\n}\n\n// generatedCodeVersion indicates a version of the generated code.\n// It is incremented whenever an incompatibility between the generated code and\n// proto package is introduced; the generated code references\n// a constant, proto.ProtoPackageIsVersionN (where N is generatedCodeVersion).\nconst generatedCodeVersion = 3\n\n// A Plugin provides functionality to add to the output during Go code generation,\n// such as to produce RPC stubs.\ntype Plugin interface {\n\t// Name identifies the plugin.\n\tName() string\n\t// Init is called once after data structures are built but before\n\t// code generation begins.\n\tInit(g *Generator)\n\t// Generate produces the code generated by the plugin for this file,\n\t// except for the imports, by calling the generator's methods P, In, and Out.\n\tGenerate(file *FileDescriptor)\n\t// GenerateImports produces the import declarations for this file.\n\t// It is called after Generate.\n\tGenerateImports(file *FileDescriptor)\n}\n\nvar plugins []Plugin\n\n// RegisterPlugin installs a (second-order) plugin to be run when the Go output is generated.\n// It is typically called during initialization.\nfunc RegisterPlugin(p Plugin) {\n\tplugins = append(plugins, p)\n}\n\n// A GoImportPath is the import path of a Go package. e.g., \"google.golang.org/genproto/protobuf\".\ntype GoImportPath string\n\nfunc (p GoImportPath) String() string { return strconv.Quote(string(p)) }\n\n// A GoPackageName is the name of a Go package. e.g., \"protobuf\".\ntype GoPackageName string\n\n// Each type we import as a protocol buffer (other than FileDescriptorProto) needs\n// a pointer to the FileDescriptorProto that represents it.  These types achieve that\n// wrapping by placing each Proto inside a struct with the pointer to its File. The\n// structs have the same names as their contents, with \"Proto\" removed.\n// FileDescriptor is used to store the things that it points to.\n\n// The file and package name method are common to messages and enums.\ntype common struct {\n\tfile *FileDescriptor // File this object comes from.\n}\n\n// GoImportPath is the import path of the Go package containing the type.\nfunc (c *common) GoImportPath() GoImportPath {\n\treturn c.file.importPath\n}\n\nfunc (c *common) File() *FileDescriptor { return c.file }\n\nfunc fileIsProto3(file *descriptor.FileDescriptorProto) bool {\n\treturn file.GetSyntax() == \"proto3\"\n}\n\nfunc (c *common) proto3() bool { return fileIsProto3(c.file.FileDescriptorProto) }\n\n// Descriptor represents a protocol buffer message.\ntype Descriptor struct {\n\tcommon\n\t*descriptor.DescriptorProto\n\tparent   *Descriptor            // The containing message, if any.\n\tnested   []*Descriptor          // Inner messages, if any.\n\tenums    []*EnumDescriptor      // Inner enums, if any.\n\text      []*ExtensionDescriptor // Extensions, if any.\n\ttypename []string               // Cached typename vector.\n\tindex    int                    // The index into the container, whether the file or another message.\n\tpath     string                 // The SourceCodeInfo path as comma-separated integers.\n\tgroup    bool\n}\n\n// TypeName returns the elements of the dotted type name.\n// The package name is not part of this name.\nfunc (d *Descriptor) TypeName() []string {\n\tif d.typename != nil {\n\t\treturn d.typename\n\t}\n\tn := 0\n\tfor parent := d; parent != nil; parent = parent.parent {\n\t\tn++\n\t}\n\ts := make([]string, n)\n\tfor parent := d; parent != nil; parent = parent.parent {\n\t\tn--\n\t\ts[n] = parent.GetName()\n\t}\n\td.typename = s\n\treturn s\n}\n\n// EnumDescriptor describes an enum. If it's at top level, its parent will be nil.\n// Otherwise it will be the descriptor of the message in which it is defined.\ntype EnumDescriptor struct {\n\tcommon\n\t*descriptor.EnumDescriptorProto\n\tparent   *Descriptor // The containing message, if any.\n\ttypename []string    // Cached typename vector.\n\tindex    int         // The index into the container, whether the file or a message.\n\tpath     string      // The SourceCodeInfo path as comma-separated integers.\n}\n\n// TypeName returns the elements of the dotted type name.\n// The package name is not part of this name.\nfunc (e *EnumDescriptor) TypeName() (s []string) {\n\tif e.typename != nil {\n\t\treturn e.typename\n\t}\n\tname := e.GetName()\n\tif e.parent == nil {\n\t\ts = make([]string, 1)\n\t} else {\n\t\tpname := e.parent.TypeName()\n\t\ts = make([]string, len(pname)+1)\n\t\tcopy(s, pname)\n\t}\n\ts[len(s)-1] = name\n\te.typename = s\n\treturn s\n}\n\n// Everything but the last element of the full type name, CamelCased.\n// The values of type Foo.Bar are call Foo_value1... not Foo_Bar_value1... .\nfunc (e *EnumDescriptor) prefix() string {\n\tif e.parent == nil {\n\t\t// If the enum is not part of a message, the prefix is just the type name.\n\t\treturn CamelCase(*e.Name) + \"_\"\n\t}\n\ttypeName := e.TypeName()\n\treturn CamelCaseSlice(typeName[0:len(typeName)-1]) + \"_\"\n}\n\n// The integer value of the named constant in this enumerated type.\nfunc (e *EnumDescriptor) integerValueAsString(name string) string {\n\tfor _, c := range e.Value {\n\t\tif c.GetName() == name {\n\t\t\treturn fmt.Sprint(c.GetNumber())\n\t\t}\n\t}\n\tlog.Fatal(\"cannot find value for enum constant\")\n\treturn \"\"\n}\n\n// ExtensionDescriptor describes an extension. If it's at top level, its parent will be nil.\n// Otherwise it will be the descriptor of the message in which it is defined.\ntype ExtensionDescriptor struct {\n\tcommon\n\t*descriptor.FieldDescriptorProto\n\tparent *Descriptor // The containing message, if any.\n}\n\n// TypeName returns the elements of the dotted type name.\n// The package name is not part of this name.\nfunc (e *ExtensionDescriptor) TypeName() (s []string) {\n\tname := e.GetName()\n\tif e.parent == nil {\n\t\t// top-level extension\n\t\ts = make([]string, 1)\n\t} else {\n\t\tpname := e.parent.TypeName()\n\t\ts = make([]string, len(pname)+1)\n\t\tcopy(s, pname)\n\t}\n\ts[len(s)-1] = name\n\treturn s\n}\n\n// DescName returns the variable name used for the generated descriptor.\nfunc (e *ExtensionDescriptor) DescName() string {\n\t// The full type name.\n\ttypeName := e.TypeName()\n\t// Each scope of the extension is individually CamelCased, and all are joined with \"_\" with an \"E_\" prefix.\n\tfor i, s := range typeName {\n\t\ttypeName[i] = CamelCase(s)\n\t}\n\treturn \"E_\" + strings.Join(typeName, \"_\")\n}\n\n// ImportedDescriptor describes a type that has been publicly imported from another file.\ntype ImportedDescriptor struct {\n\tcommon\n\to Object\n}\n\nfunc (id *ImportedDescriptor) TypeName() []string { return id.o.TypeName() }\n\n// FileDescriptor describes an protocol buffer descriptor file (.proto).\n// It includes slices of all the messages and enums defined within it.\n// Those slices are constructed by WrapTypes.\ntype FileDescriptor struct {\n\t*descriptor.FileDescriptorProto\n\tdesc []*Descriptor          // All the messages defined in this file.\n\tenum []*EnumDescriptor      // All the enums defined in this file.\n\text  []*ExtensionDescriptor // All the top-level extensions defined in this file.\n\timp  []*ImportedDescriptor  // All types defined in files publicly imported by this file.\n\n\t// Comments, stored as a map of path (comma-separated integers) to the comment.\n\tcomments map[string]*descriptor.SourceCodeInfo_Location\n\n\t// The full list of symbols that are exported,\n\t// as a map from the exported object to its symbols.\n\t// This is used for supporting public imports.\n\texported map[Object][]symbol\n\n\timportPath  GoImportPath  // Import path of this file's package.\n\tpackageName GoPackageName // Name of this file's Go package.\n\n\tproto3 bool // whether to generate proto3 code for this file\n}\n\n// VarName is the variable name we'll use in the generated code to refer\n// to the compressed bytes of this descriptor. It is not exported, so\n// it is only valid inside the generated package.\nfunc (d *FileDescriptor) VarName() string {\n\th := sha256.Sum256([]byte(d.GetName()))\n\treturn fmt.Sprintf(\"fileDescriptor_%s\", hex.EncodeToString(h[:8]))\n}\n\n// goPackageOption interprets the file's go_package option.\n// If there is no go_package, it returns (\"\", \"\", false).\n// If there's a simple name, it returns (\"\", pkg, true).\n// If the option implies an import path, it returns (impPath, pkg, true).\nfunc (d *FileDescriptor) goPackageOption() (impPath GoImportPath, pkg GoPackageName, ok bool) {\n\topt := d.GetOptions().GetGoPackage()\n\tif opt == \"\" {\n\t\treturn \"\", \"\", false\n\t}\n\t// A semicolon-delimited suffix delimits the import path and package name.\n\tsc := strings.Index(opt, \";\")\n\tif sc >= 0 {\n\t\treturn GoImportPath(opt[:sc]), cleanPackageName(opt[sc+1:]), true\n\t}\n\t// The presence of a slash implies there's an import path.\n\tslash := strings.LastIndex(opt, \"/\")\n\tif slash >= 0 {\n\t\treturn GoImportPath(opt), cleanPackageName(opt[slash+1:]), true\n\t}\n\treturn \"\", cleanPackageName(opt), true\n}\n\n// goFileName returns the output name for the generated Go file.\nfunc (d *FileDescriptor) goFileName(pathType pathType) string {\n\tname := *d.Name\n\tif ext := path.Ext(name); ext == \".proto\" || ext == \".protodevel\" {\n\t\tname = name[:len(name)-len(ext)]\n\t}\n\tname += \".pb.go\"\n\n\tif pathType == pathTypeSourceRelative {\n\t\treturn name\n\t}\n\n\t// Does the file have a \"go_package\" option?\n\t// If it does, it may override the filename.\n\tif impPath, _, ok := d.goPackageOption(); ok && impPath != \"\" {\n\t\t// Replace the existing dirname with the declared import path.\n\t\t_, name = path.Split(name)\n\t\tname = path.Join(string(impPath), name)\n\t\treturn name\n\t}\n\n\treturn name\n}\n\nfunc (d *FileDescriptor) addExport(obj Object, sym symbol) {\n\td.exported[obj] = append(d.exported[obj], sym)\n}\n\n// symbol is an interface representing an exported Go symbol.\ntype symbol interface {\n\t// GenerateAlias should generate an appropriate alias\n\t// for the symbol from the named package.\n\tGenerateAlias(g *Generator, filename string, pkg GoPackageName)\n}\n\ntype messageSymbol struct {\n\tsym                         string\n\thasExtensions, isMessageSet bool\n\toneofTypes                  []string\n}\n\ntype getterSymbol struct {\n\tname     string\n\ttyp      string\n\ttypeName string // canonical name in proto world; empty for proto.Message and similar\n\tgenType  bool   // whether typ contains a generated type (message/group/enum)\n}\n\nfunc (ms *messageSymbol) GenerateAlias(g *Generator, filename string, pkg GoPackageName) {\n\tg.P(\"// \", ms.sym, \" from public import \", filename)\n\tg.P(\"type \", ms.sym, \" = \", pkg, \".\", ms.sym)\n\tfor _, name := range ms.oneofTypes {\n\t\tg.P(\"type \", name, \" = \", pkg, \".\", name)\n\t}\n}\n\ntype enumSymbol struct {\n\tname   string\n\tproto3 bool // Whether this came from a proto3 file.\n}\n\nfunc (es enumSymbol) GenerateAlias(g *Generator, filename string, pkg GoPackageName) {\n\ts := es.name\n\tg.P(\"// \", s, \" from public import \", filename)\n\tg.P(\"type \", s, \" = \", pkg, \".\", s)\n\tg.P(\"var \", s, \"_name = \", pkg, \".\", s, \"_name\")\n\tg.P(\"var \", s, \"_value = \", pkg, \".\", s, \"_value\")\n}\n\ntype constOrVarSymbol struct {\n\tsym  string\n\ttyp  string // either \"const\" or \"var\"\n\tcast string // if non-empty, a type cast is required (used for enums)\n}\n\nfunc (cs constOrVarSymbol) GenerateAlias(g *Generator, filename string, pkg GoPackageName) {\n\tv := string(pkg) + \".\" + cs.sym\n\tif cs.cast != \"\" {\n\t\tv = cs.cast + \"(\" + v + \")\"\n\t}\n\tg.P(cs.typ, \" \", cs.sym, \" = \", v)\n}\n\n// Object is an interface abstracting the abilities shared by enums, messages, extensions and imported objects.\ntype Object interface {\n\tGoImportPath() GoImportPath\n\tTypeName() []string\n\tFile() *FileDescriptor\n}\n\n// Generator is the type whose methods generate the output, stored in the associated response structure.\ntype Generator struct {\n\t*bytes.Buffer\n\n\tRequest  *plugin.CodeGeneratorRequest  // The input.\n\tResponse *plugin.CodeGeneratorResponse // The output.\n\n\tParam             map[string]string // Command-line parameters.\n\tPackageImportPath string            // Go import path of the package we're generating code for\n\tImportPrefix      string            // String to prefix to imported package file names.\n\tImportMap         map[string]string // Mapping from .proto file name to import path\n\n\tPkg map[string]string // The names under which we import support packages\n\n\toutputImportPath GoImportPath                   // Package we're generating code for.\n\tallFiles         []*FileDescriptor              // All files in the tree\n\tallFilesByName   map[string]*FileDescriptor     // All files by filename.\n\tgenFiles         []*FileDescriptor              // Those files we will generate output for.\n\tfile             *FileDescriptor                // The file we are compiling now.\n\tpackageNames     map[GoImportPath]GoPackageName // Imported package names in the current file.\n\tusedPackages     map[GoImportPath]bool          // Packages used in current file.\n\tusedPackageNames map[GoPackageName]bool         // Package names used in the current file.\n\taddedImports     map[GoImportPath]bool          // Additional imports to emit.\n\ttypeNameToObject map[string]Object              // Key is a fully-qualified name in input syntax.\n\tinit             []string                       // Lines to emit in the init function.\n\tindent           string\n\tpathType         pathType // How to generate output filenames.\n\twriteOutput      bool\n\tannotateCode     bool                                       // whether to store annotations\n\tannotations      []*descriptor.GeneratedCodeInfo_Annotation // annotations to store\n}\n\ntype pathType int\n\nconst (\n\tpathTypeImport pathType = iota\n\tpathTypeSourceRelative\n)\n\n// New creates a new generator and allocates the request and response protobufs.\nfunc New() *Generator {\n\tg := new(Generator)\n\tg.Buffer = new(bytes.Buffer)\n\tg.Request = new(plugin.CodeGeneratorRequest)\n\tg.Response = new(plugin.CodeGeneratorResponse)\n\treturn g\n}\n\n// Error reports a problem, including an error, and exits the program.\nfunc (g *Generator) Error(err error, msgs ...string) {\n\ts := strings.Join(msgs, \" \") + \":\" + err.Error()\n\tlog.Print(\"protoc-gen-go: error:\", s)\n\tos.Exit(1)\n}\n\n// Fail reports a problem and exits the program.\nfunc (g *Generator) Fail(msgs ...string) {\n\ts := strings.Join(msgs, \" \")\n\tlog.Print(\"protoc-gen-go: error:\", s)\n\tos.Exit(1)\n}\n\n// CommandLineParameters breaks the comma-separated list of key=value pairs\n// in the parameter (a member of the request protobuf) into a key/value map.\n// It then sets file name mappings defined by those entries.\nfunc (g *Generator) CommandLineParameters(parameter string) {\n\tg.Param = make(map[string]string)\n\tfor _, p := range strings.Split(parameter, \",\") {\n\t\tif i := strings.Index(p, \"=\"); i < 0 {\n\t\t\tg.Param[p] = \"\"\n\t\t} else {\n\t\t\tg.Param[p[0:i]] = p[i+1:]\n\t\t}\n\t}\n\n\tg.ImportMap = make(map[string]string)\n\tpluginList := \"none\" // Default list of plugin names to enable (empty means all).\n\tfor k, v := range g.Param {\n\t\tswitch k {\n\t\tcase \"import_prefix\":\n\t\t\tg.ImportPrefix = v\n\t\tcase \"import_path\":\n\t\t\tg.PackageImportPath = v\n\t\tcase \"paths\":\n\t\t\tswitch v {\n\t\t\tcase \"import\":\n\t\t\t\tg.pathType = pathTypeImport\n\t\t\tcase \"source_relative\":\n\t\t\t\tg.pathType = pathTypeSourceRelative\n\t\t\tdefault:\n\t\t\t\tg.Fail(fmt.Sprintf(`Unknown path type %q: want \"import\" or \"source_relative\".`, v))\n\t\t\t}\n\t\tcase \"plugins\":\n\t\t\tpluginList = v\n\t\tcase \"annotate_code\":\n\t\t\tif v == \"true\" {\n\t\t\t\tg.annotateCode = true\n\t\t\t}\n\t\tdefault:\n\t\t\tif len(k) > 0 && k[0] == 'M' {\n\t\t\t\tg.ImportMap[k[1:]] = v\n\t\t\t}\n\t\t}\n\t}\n\tif pluginList != \"\" {\n\t\t// Amend the set of plugins.\n\t\tenabled := make(map[string]bool)\n\t\tfor _, name := range strings.Split(pluginList, \"+\") {\n\t\t\tenabled[name] = true\n\t\t}\n\t\tvar nplugins []Plugin\n\t\tfor _, p := range plugins {\n\t\t\tif enabled[p.Name()] {\n\t\t\t\tnplugins = append(nplugins, p)\n\t\t\t}\n\t\t}\n\t\tplugins = nplugins\n\t}\n}\n\n// DefaultPackageName returns the package name printed for the object.\n// If its file is in a different package, it returns the package name we're using for this file, plus \".\".\n// Otherwise it returns the empty string.\nfunc (g *Generator) DefaultPackageName(obj Object) string {\n\timportPath := obj.GoImportPath()\n\tif importPath == g.outputImportPath {\n\t\treturn \"\"\n\t}\n\treturn string(g.GoPackageName(importPath)) + \".\"\n}\n\n// GoPackageName returns the name used for a package.\nfunc (g *Generator) GoPackageName(importPath GoImportPath) GoPackageName {\n\tif name, ok := g.packageNames[importPath]; ok {\n\t\treturn name\n\t}\n\tname := cleanPackageName(baseName(string(importPath)))\n\tfor i, orig := 1, name; g.usedPackageNames[name] || isGoPredeclaredIdentifier[string(name)]; i++ {\n\t\tname = orig + GoPackageName(strconv.Itoa(i))\n\t}\n\tg.packageNames[importPath] = name\n\tg.usedPackageNames[name] = true\n\treturn name\n}\n\n// AddImport adds a package to the generated file's import section.\n// It returns the name used for the package.\nfunc (g *Generator) AddImport(importPath GoImportPath) GoPackageName {\n\tg.addedImports[importPath] = true\n\treturn g.GoPackageName(importPath)\n}\n\nvar globalPackageNames = map[GoPackageName]bool{\n\t\"fmt\":   true,\n\t\"math\":  true,\n\t\"proto\": true,\n}\n\n// Create and remember a guaranteed unique package name. Pkg is the candidate name.\n// The FileDescriptor parameter is unused.\nfunc RegisterUniquePackageName(pkg string, f *FileDescriptor) string {\n\tname := cleanPackageName(pkg)\n\tfor i, orig := 1, name; globalPackageNames[name]; i++ {\n\t\tname = orig + GoPackageName(strconv.Itoa(i))\n\t}\n\tglobalPackageNames[name] = true\n\treturn string(name)\n}\n\nvar isGoKeyword = map[string]bool{\n\t\"break\":       true,\n\t\"case\":        true,\n\t\"chan\":        true,\n\t\"const\":       true,\n\t\"continue\":    true,\n\t\"default\":     true,\n\t\"else\":        true,\n\t\"defer\":       true,\n\t\"fallthrough\": true,\n\t\"for\":         true,\n\t\"func\":        true,\n\t\"go\":          true,\n\t\"goto\":        true,\n\t\"if\":          true,\n\t\"import\":      true,\n\t\"interface\":   true,\n\t\"map\":         true,\n\t\"package\":     true,\n\t\"range\":       true,\n\t\"return\":      true,\n\t\"select\":      true,\n\t\"struct\":      true,\n\t\"switch\":      true,\n\t\"type\":        true,\n\t\"var\":         true,\n}\n\nvar isGoPredeclaredIdentifier = map[string]bool{\n\t\"append\":     true,\n\t\"bool\":       true,\n\t\"byte\":       true,\n\t\"cap\":        true,\n\t\"close\":      true,\n\t\"complex\":    true,\n\t\"complex128\": true,\n\t\"complex64\":  true,\n\t\"copy\":       true,\n\t\"delete\":     true,\n\t\"error\":      true,\n\t\"false\":      true,\n\t\"float32\":    true,\n\t\"float64\":    true,\n\t\"imag\":       true,\n\t\"int\":        true,\n\t\"int16\":      true,\n\t\"int32\":      true,\n\t\"int64\":      true,\n\t\"int8\":       true,\n\t\"iota\":       true,\n\t\"len\":        true,\n\t\"make\":       true,\n\t\"new\":        true,\n\t\"nil\":        true,\n\t\"panic\":      true,\n\t\"print\":      true,\n\t\"println\":    true,\n\t\"real\":       true,\n\t\"recover\":    true,\n\t\"rune\":       true,\n\t\"string\":     true,\n\t\"true\":       true,\n\t\"uint\":       true,\n\t\"uint16\":     true,\n\t\"uint32\":     true,\n\t\"uint64\":     true,\n\t\"uint8\":      true,\n\t\"uintptr\":    true,\n}\n\nfunc cleanPackageName(name string) GoPackageName {\n\tname = strings.Map(badToUnderscore, name)\n\t// Identifier must not be keyword or predeclared identifier: insert _.\n\tif isGoKeyword[name] {\n\t\tname = \"_\" + name\n\t}\n\t// Identifier must not begin with digit: insert _.\n\tif r, _ := utf8.DecodeRuneInString(name); unicode.IsDigit(r) {\n\t\tname = \"_\" + name\n\t}\n\treturn GoPackageName(name)\n}\n\n// defaultGoPackage returns the package name to use,\n// derived from the import path of the package we're building code for.\nfunc (g *Generator) defaultGoPackage() GoPackageName {\n\tp := g.PackageImportPath\n\tif i := strings.LastIndex(p, \"/\"); i >= 0 {\n\t\tp = p[i+1:]\n\t}\n\treturn cleanPackageName(p)\n}\n\n// SetPackageNames sets the package name for this run.\n// The package name must agree across all files being generated.\n// It also defines unique package names for all imported files.\nfunc (g *Generator) SetPackageNames() {\n\tg.outputImportPath = g.genFiles[0].importPath\n\n\tdefaultPackageNames := make(map[GoImportPath]GoPackageName)\n\tfor _, f := range g.genFiles {\n\t\tif _, p, ok := f.goPackageOption(); ok {\n\t\t\tdefaultPackageNames[f.importPath] = p\n\t\t}\n\t}\n\tfor _, f := range g.genFiles {\n\t\tif _, p, ok := f.goPackageOption(); ok {\n\t\t\t// Source file: option go_package = \"quux/bar\";\n\t\t\tf.packageName = p\n\t\t} else if p, ok := defaultPackageNames[f.importPath]; ok {\n\t\t\t// A go_package option in another file in the same package.\n\t\t\t//\n\t\t\t// This is a poor choice in general, since every source file should\n\t\t\t// contain a go_package option. Supported mainly for historical\n\t\t\t// compatibility.\n\t\t\tf.packageName = p\n\t\t} else if p := g.defaultGoPackage(); p != \"\" {\n\t\t\t// Command-line: import_path=quux/bar.\n\t\t\t//\n\t\t\t// The import_path flag sets a package name for files which don't\n\t\t\t// contain a go_package option.\n\t\t\tf.packageName = p\n\t\t} else if p := f.GetPackage(); p != \"\" {\n\t\t\t// Source file: package quux.bar;\n\t\t\tf.packageName = cleanPackageName(p)\n\t\t} else {\n\t\t\t// Source filename.\n\t\t\tf.packageName = cleanPackageName(baseName(f.GetName()))\n\t\t}\n\t}\n\n\t// Check that all files have a consistent package name and import path.\n\tfor _, f := range g.genFiles[1:] {\n\t\tif a, b := g.genFiles[0].importPath, f.importPath; a != b {\n\t\t\tg.Fail(fmt.Sprintf(\"inconsistent package import paths: %v, %v\", a, b))\n\t\t}\n\t\tif a, b := g.genFiles[0].packageName, f.packageName; a != b {\n\t\t\tg.Fail(fmt.Sprintf(\"inconsistent package names: %v, %v\", a, b))\n\t\t}\n\t}\n\n\t// Names of support packages. These never vary (if there are conflicts,\n\t// we rename the conflicting package), so this could be removed someday.\n\tg.Pkg = map[string]string{\n\t\t\"fmt\":   \"fmt\",\n\t\t\"math\":  \"math\",\n\t\t\"proto\": \"proto\",\n\t}\n}\n\n// WrapTypes walks the incoming data, wrapping DescriptorProtos, EnumDescriptorProtos\n// and FileDescriptorProtos into file-referenced objects within the Generator.\n// It also creates the list of files to generate and so should be called before GenerateAllFiles.\nfunc (g *Generator) WrapTypes() {\n\tg.allFiles = make([]*FileDescriptor, 0, len(g.Request.ProtoFile))\n\tg.allFilesByName = make(map[string]*FileDescriptor, len(g.allFiles))\n\tgenFileNames := make(map[string]bool)\n\tfor _, n := range g.Request.FileToGenerate {\n\t\tgenFileNames[n] = true\n\t}\n\tfor _, f := range g.Request.ProtoFile {\n\t\tfd := &FileDescriptor{\n\t\t\tFileDescriptorProto: f,\n\t\t\texported:            make(map[Object][]symbol),\n\t\t\tproto3:              fileIsProto3(f),\n\t\t}\n\t\t// The import path may be set in a number of ways.\n\t\tif substitution, ok := g.ImportMap[f.GetName()]; ok {\n\t\t\t// Command-line: M=foo.proto=quux/bar.\n\t\t\t//\n\t\t\t// Explicit mapping of source file to import path.\n\t\t\tfd.importPath = GoImportPath(substitution)\n\t\t} else if genFileNames[f.GetName()] && g.PackageImportPath != \"\" {\n\t\t\t// Command-line: import_path=quux/bar.\n\t\t\t//\n\t\t\t// The import_path flag sets the import path for every file that\n\t\t\t// we generate code for.\n\t\t\tfd.importPath = GoImportPath(g.PackageImportPath)\n\t\t} else if p, _, _ := fd.goPackageOption(); p != \"\" {\n\t\t\t// Source file: option go_package = \"quux/bar\";\n\t\t\t//\n\t\t\t// The go_package option sets the import path. Most users should use this.\n\t\t\tfd.importPath = p\n\t\t} else {\n\t\t\t// Source filename.\n\t\t\t//\n\t\t\t// Last resort when nothing else is available.\n\t\t\tfd.importPath = GoImportPath(path.Dir(f.GetName()))\n\t\t}\n\t\t// We must wrap the descriptors before we wrap the enums\n\t\tfd.desc = wrapDescriptors(fd)\n\t\tg.buildNestedDescriptors(fd.desc)\n\t\tfd.enum = wrapEnumDescriptors(fd, fd.desc)\n\t\tg.buildNestedEnums(fd.desc, fd.enum)\n\t\tfd.ext = wrapExtensions(fd)\n\t\textractComments(fd)\n\t\tg.allFiles = append(g.allFiles, fd)\n\t\tg.allFilesByName[f.GetName()] = fd\n\t}\n\tfor _, fd := range g.allFiles {\n\t\tfd.imp = wrapImported(fd, g)\n\t}\n\n\tg.genFiles = make([]*FileDescriptor, 0, len(g.Request.FileToGenerate))\n\tfor _, fileName := range g.Request.FileToGenerate {\n\t\tfd := g.allFilesByName[fileName]\n\t\tif fd == nil {\n\t\t\tg.Fail(\"could not find file named\", fileName)\n\t\t}\n\t\tg.genFiles = append(g.genFiles, fd)\n\t}\n}\n\n// Scan the descriptors in this file.  For each one, build the slice of nested descriptors\nfunc (g *Generator) buildNestedDescriptors(descs []*Descriptor) {\n\tfor _, desc := range descs {\n\t\tif len(desc.NestedType) != 0 {\n\t\t\tfor _, nest := range descs {\n\t\t\t\tif nest.parent == desc {\n\t\t\t\t\tdesc.nested = append(desc.nested, nest)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(desc.nested) != len(desc.NestedType) {\n\t\t\t\tg.Fail(\"internal error: nesting failure for\", desc.GetName())\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc (g *Generator) buildNestedEnums(descs []*Descriptor, enums []*EnumDescriptor) {\n\tfor _, desc := range descs {\n\t\tif len(desc.EnumType) != 0 {\n\t\t\tfor _, enum := range enums {\n\t\t\t\tif enum.parent == desc {\n\t\t\t\t\tdesc.enums = append(desc.enums, enum)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(desc.enums) != len(desc.EnumType) {\n\t\t\t\tg.Fail(\"internal error: enum nesting failure for\", desc.GetName())\n\t\t\t}\n\t\t}\n\t}\n}\n\n// Construct the Descriptor\nfunc newDescriptor(desc *descriptor.DescriptorProto, parent *Descriptor, file *FileDescriptor, index int) *Descriptor {\n\td := &Descriptor{\n\t\tcommon:          common{file},\n\t\tDescriptorProto: desc,\n\t\tparent:          parent,\n\t\tindex:           index,\n\t}\n\tif parent == nil {\n\t\td.path = fmt.Sprintf(\"%d,%d\", messagePath, index)\n\t} else {\n\t\td.path = fmt.Sprintf(\"%s,%d,%d\", parent.path, messageMessagePath, index)\n\t}\n\n\t// The only way to distinguish a group from a message is whether\n\t// the containing message has a TYPE_GROUP field that matches.\n\tif parent != nil {\n\t\tparts := d.TypeName()\n\t\tif file.Package != nil {\n\t\t\tparts = append([]string{*file.Package}, parts...)\n\t\t}\n\t\texp := \".\" + strings.Join(parts, \".\")\n\t\tfor _, field := range parent.Field {\n\t\t\tif field.GetType() == descriptor.FieldDescriptorProto_TYPE_GROUP && field.GetTypeName() == exp {\n\t\t\t\td.group = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, field := range desc.Extension {\n\t\td.ext = append(d.ext, &ExtensionDescriptor{common{file}, field, d})\n\t}\n\n\treturn d\n}\n\n// Return a slice of all the Descriptors defined within this file\nfunc wrapDescriptors(file *FileDescriptor) []*Descriptor {\n\tsl := make([]*Descriptor, 0, len(file.MessageType)+10)\n\tfor i, desc := range file.MessageType {\n\t\tsl = wrapThisDescriptor(sl, desc, nil, file, i)\n\t}\n\treturn sl\n}\n\n// Wrap this Descriptor, recursively\nfunc wrapThisDescriptor(sl []*Descriptor, desc *descriptor.DescriptorProto, parent *Descriptor, file *FileDescriptor, index int) []*Descriptor {\n\tsl = append(sl, newDescriptor(desc, parent, file, index))\n\tme := sl[len(sl)-1]\n\tfor i, nested := range desc.NestedType {\n\t\tsl = wrapThisDescriptor(sl, nested, me, file, i)\n\t}\n\treturn sl\n}\n\n// Construct the EnumDescriptor\nfunc newEnumDescriptor(desc *descriptor.EnumDescriptorProto, parent *Descriptor, file *FileDescriptor, index int) *EnumDescriptor {\n\ted := &EnumDescriptor{\n\t\tcommon:              common{file},\n\t\tEnumDescriptorProto: desc,\n\t\tparent:              parent,\n\t\tindex:               index,\n\t}\n\tif parent == nil {\n\t\ted.path = fmt.Sprintf(\"%d,%d\", enumPath, index)\n\t} else {\n\t\ted.path = fmt.Sprintf(\"%s,%d,%d\", parent.path, messageEnumPath, index)\n\t}\n\treturn ed\n}\n\n// Return a slice of all the EnumDescriptors defined within this file\nfunc wrapEnumDescriptors(file *FileDescriptor, descs []*Descriptor) []*EnumDescriptor {\n\tsl := make([]*EnumDescriptor, 0, len(file.EnumType)+10)\n\t// Top-level enums.\n\tfor i, enum := range file.EnumType {\n\t\tsl = append(sl, newEnumDescriptor(enum, nil, file, i))\n\t}\n\t// Enums within messages. Enums within embedded messages appear in the outer-most message.\n\tfor _, nested := range descs {\n\t\tfor i, enum := range nested.EnumType {\n\t\t\tsl = append(sl, newEnumDescriptor(enum, nested, file, i))\n\t\t}\n\t}\n\treturn sl\n}\n\n// Return a slice of all the top-level ExtensionDescriptors defined within this file.\nfunc wrapExtensions(file *FileDescriptor) []*ExtensionDescriptor {\n\tvar sl []*ExtensionDescriptor\n\tfor _, field := range file.Extension {\n\t\tsl = append(sl, &ExtensionDescriptor{common{file}, field, nil})\n\t}\n\treturn sl\n}\n\n// Return a slice of all the types that are publicly imported into this file.\nfunc wrapImported(file *FileDescriptor, g *Generator) (sl []*ImportedDescriptor) {\n\tfor _, index := range file.PublicDependency {\n\t\tdf := g.fileByName(file.Dependency[index])\n\t\tfor _, d := range df.desc {\n\t\t\tif d.GetOptions().GetMapEntry() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsl = append(sl, &ImportedDescriptor{common{file}, d})\n\t\t}\n\t\tfor _, e := range df.enum {\n\t\t\tsl = append(sl, &ImportedDescriptor{common{file}, e})\n\t\t}\n\t\tfor _, ext := range df.ext {\n\t\t\tsl = append(sl, &ImportedDescriptor{common{file}, ext})\n\t\t}\n\t}\n\treturn\n}\n\nfunc extractComments(file *FileDescriptor) {\n\tfile.comments = make(map[string]*descriptor.SourceCodeInfo_Location)\n\tfor _, loc := range file.GetSourceCodeInfo().GetLocation() {\n\t\tif loc.LeadingComments == nil {\n\t\t\tcontinue\n\t\t}\n\t\tvar p []string\n\t\tfor _, n := range loc.Path {\n\t\t\tp = append(p, strconv.Itoa(int(n)))\n\t\t}\n\t\tfile.comments[strings.Join(p, \",\")] = loc\n\t}\n}\n\n// BuildTypeNameMap builds the map from fully qualified type names to objects.\n// The key names for the map come from the input data, which puts a period at the beginning.\n// It should be called after SetPackageNames and before GenerateAllFiles.\nfunc (g *Generator) BuildTypeNameMap() {\n\tg.typeNameToObject = make(map[string]Object)\n\tfor _, f := range g.allFiles {\n\t\t// The names in this loop are defined by the proto world, not us, so the\n\t\t// package name may be empty.  If so, the dotted package name of X will\n\t\t// be \".X\"; otherwise it will be \".pkg.X\".\n\t\tdottedPkg := \".\" + f.GetPackage()\n\t\tif dottedPkg != \".\" {\n\t\t\tdottedPkg += \".\"\n\t\t}\n\t\tfor _, enum := range f.enum {\n\t\t\tname := dottedPkg + dottedSlice(enum.TypeName())\n\t\t\tg.typeNameToObject[name] = enum\n\t\t}\n\t\tfor _, desc := range f.desc {\n\t\t\tname := dottedPkg + dottedSlice(desc.TypeName())\n\t\t\tg.typeNameToObject[name] = desc\n\t\t}\n\t}\n}\n\n// ObjectNamed, given a fully-qualified input type name as it appears in the input data,\n// returns the descriptor for the message or enum with that name.\nfunc (g *Generator) ObjectNamed(typeName string) Object {\n\to, ok := g.typeNameToObject[typeName]\n\tif !ok {\n\t\tg.Fail(\"can't find object with type\", typeName)\n\t}\n\treturn o\n}\n\n// AnnotatedAtoms is a list of atoms (as consumed by P) that records the file name and proto AST path from which they originated.\ntype AnnotatedAtoms struct {\n\tsource string\n\tpath   string\n\tatoms  []interface{}\n}\n\n// Annotate records the file name and proto AST path of a list of atoms\n// so that a later call to P can emit a link from each atom to its origin.\nfunc Annotate(file *FileDescriptor, path string, atoms ...interface{}) *AnnotatedAtoms {\n\treturn &AnnotatedAtoms{source: *file.Name, path: path, atoms: atoms}\n}\n\n// printAtom prints the (atomic, non-annotation) argument to the generated output.\nfunc (g *Generator) printAtom(v interface{}) {\n\tswitch v := v.(type) {\n\tcase string:\n\t\tg.WriteString(v)\n\tcase *string:\n\t\tg.WriteString(*v)\n\tcase bool:\n\t\tfmt.Fprint(g, v)\n\tcase *bool:\n\t\tfmt.Fprint(g, *v)\n\tcase int:\n\t\tfmt.Fprint(g, v)\n\tcase *int32:\n\t\tfmt.Fprint(g, *v)\n\tcase *int64:\n\t\tfmt.Fprint(g, *v)\n\tcase float64:\n\t\tfmt.Fprint(g, v)\n\tcase *float64:\n\t\tfmt.Fprint(g, *v)\n\tcase GoPackageName:\n\t\tg.WriteString(string(v))\n\tcase GoImportPath:\n\t\tg.WriteString(strconv.Quote(string(v)))\n\tdefault:\n\t\tg.Fail(fmt.Sprintf(\"unknown type in printer: %T\", v))\n\t}\n}\n\n// P prints the arguments to the generated output.  It handles strings and int32s, plus\n// handling indirections because they may be *string, etc.  Any inputs of type AnnotatedAtoms may emit\n// annotations in a .meta file in addition to outputting the atoms themselves (if g.annotateCode\n// is true).\nfunc (g *Generator) P(str ...interface{}) {\n\tif !g.writeOutput {\n\t\treturn\n\t}\n\tg.WriteString(g.indent)\n\tfor _, v := range str {\n\t\tswitch v := v.(type) {\n\t\tcase *AnnotatedAtoms:\n\t\t\tbegin := int32(g.Len())\n\t\t\tfor _, v := range v.atoms {\n\t\t\t\tg.printAtom(v)\n\t\t\t}\n\t\t\tif g.annotateCode {\n\t\t\t\tend := int32(g.Len())\n\t\t\t\tvar path []int32\n\t\t\t\tfor _, token := range strings.Split(v.path, \",\") {\n\t\t\t\t\tval, err := strconv.ParseInt(token, 10, 32)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tg.Fail(\"could not parse proto AST path: \", err.Error())\n\t\t\t\t\t}\n\t\t\t\t\tpath = append(path, int32(val))\n\t\t\t\t}\n\t\t\t\tg.annotations = append(g.annotations, &descriptor.GeneratedCodeInfo_Annotation{\n\t\t\t\t\tPath:       path,\n\t\t\t\t\tSourceFile: &v.source,\n\t\t\t\t\tBegin:      &begin,\n\t\t\t\t\tEnd:        &end,\n\t\t\t\t})\n\t\t\t}\n\t\tdefault:\n\t\t\tg.printAtom(v)\n\t\t}\n\t}\n\tg.WriteByte('\\n')\n}\n\n// addInitf stores the given statement to be printed inside the file's init function.\n// The statement is given as a format specifier and arguments.\nfunc (g *Generator) addInitf(stmt string, a ...interface{}) {\n\tg.init = append(g.init, fmt.Sprintf(stmt, a...))\n}\n\n// In Indents the output one tab stop.\nfunc (g *Generator) In() { g.indent += \"\\t\" }\n\n// Out unindents the output one tab stop.\nfunc (g *Generator) Out() {\n\tif len(g.indent) > 0 {\n\t\tg.indent = g.indent[1:]\n\t}\n}\n\n// GenerateAllFiles generates the output for all the files we're outputting.\nfunc (g *Generator) GenerateAllFiles() {\n\t// Initialize the plugins\n\tfor _, p := range plugins {\n\t\tp.Init(g)\n\t}\n\t// Generate the output. The generator runs for every file, even the files\n\t// that we don't generate output for, so that we can collate the full list\n\t// of exported symbols to support public imports.\n\tgenFileMap := make(map[*FileDescriptor]bool, len(g.genFiles))\n\tfor _, file := range g.genFiles {\n\t\tgenFileMap[file] = true\n\t}\n\tfor _, file := range g.allFiles {\n\t\tg.Reset()\n\t\tg.annotations = nil\n\t\tg.writeOutput = genFileMap[file]\n\t\tg.generate(file)\n\t\tif !g.writeOutput {\n\t\t\tcontinue\n\t\t}\n\t\tfname := file.goFileName(g.pathType)\n\t\tg.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{\n\t\t\tName:    proto.String(fname),\n\t\t\tContent: proto.String(g.String()),\n\t\t})\n\t\tif g.annotateCode {\n\t\t\t// Store the generated code annotations in text, as the protoc plugin protocol requires that\n\t\t\t// strings contain valid UTF-8.\n\t\t\tg.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{\n\t\t\t\tName:    proto.String(file.goFileName(g.pathType) + \".meta\"),\n\t\t\t\tContent: proto.String(proto.CompactTextString(&descriptor.GeneratedCodeInfo{Annotation: g.annotations})),\n\t\t\t})\n\t\t}\n\t}\n}\n\n// Run all the plugins associated with the file.\nfunc (g *Generator) runPlugins(file *FileDescriptor) {\n\tfor _, p := range plugins {\n\t\tp.Generate(file)\n\t}\n}\n\n// Fill the response protocol buffer with the generated output for all the files we're\n// supposed to generate.\nfunc (g *Generator) generate(file *FileDescriptor) {\n\tg.file = file\n\tg.usedPackages = make(map[GoImportPath]bool)\n\tg.packageNames = make(map[GoImportPath]GoPackageName)\n\tg.usedPackageNames = make(map[GoPackageName]bool)\n\tg.addedImports = make(map[GoImportPath]bool)\n\tfor name := range globalPackageNames {\n\t\tg.usedPackageNames[name] = true\n\t}\n\n\tg.P(\"// This is a compile-time assertion to ensure that this generated file\")\n\tg.P(\"// is compatible with the proto package it is being compiled against.\")\n\tg.P(\"// A compilation error at this line likely means your copy of the\")\n\tg.P(\"// proto package needs to be updated.\")\n\tg.P(\"const _ = \", g.Pkg[\"proto\"], \".ProtoPackageIsVersion\", generatedCodeVersion, \" // please upgrade the proto package\")\n\tg.P()\n\n\tfor _, td := range g.file.imp {\n\t\tg.generateImported(td)\n\t}\n\tfor _, enum := range g.file.enum {\n\t\tg.generateEnum(enum)\n\t}\n\tfor _, desc := range g.file.desc {\n\t\t// Don't generate virtual messages for maps.\n\t\tif desc.GetOptions().GetMapEntry() {\n\t\t\tcontinue\n\t\t}\n\t\tg.generateMessage(desc)\n\t}\n\tfor _, ext := range g.file.ext {\n\t\tg.generateExtension(ext)\n\t}\n\tg.generateInitFunction()\n\tg.generateFileDescriptor(file)\n\n\t// Run the plugins before the imports so we know which imports are necessary.\n\tg.runPlugins(file)\n\n\t// Generate header and imports last, though they appear first in the output.\n\trem := g.Buffer\n\tremAnno := g.annotations\n\tg.Buffer = new(bytes.Buffer)\n\tg.annotations = nil\n\tg.generateHeader()\n\tg.generateImports()\n\tif !g.writeOutput {\n\t\treturn\n\t}\n\t// Adjust the offsets for annotations displaced by the header and imports.\n\tfor _, anno := range remAnno {\n\t\t*anno.Begin += int32(g.Len())\n\t\t*anno.End += int32(g.Len())\n\t\tg.annotations = append(g.annotations, anno)\n\t}\n\tg.Write(rem.Bytes())\n\n\t// Reformat generated code and patch annotation locations.\n\tfset := token.NewFileSet()\n\toriginal := g.Bytes()\n\tif g.annotateCode {\n\t\t// make a copy independent of g; we'll need it after Reset.\n\t\toriginal = append([]byte(nil), original...)\n\t}\n\tfileAST, err := parser.ParseFile(fset, \"\", original, parser.ParseComments)\n\tif err != nil {\n\t\t// Print out the bad code with line numbers.\n\t\t// This should never happen in practice, but it can while changing generated code,\n\t\t// so consider this a debugging aid.\n\t\tvar src bytes.Buffer\n\t\ts := bufio.NewScanner(bytes.NewReader(original))\n\t\tfor line := 1; s.Scan(); line++ {\n\t\t\tfmt.Fprintf(&src, \"%5d\\t%s\\n\", line, s.Bytes())\n\t\t}\n\t\tg.Fail(\"bad Go source code was generated:\", err.Error(), \"\\n\"+src.String())\n\t}\n\tast.SortImports(fset, fileAST)\n\tg.Reset()\n\terr = (&printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8}).Fprint(g, fset, fileAST)\n\tif err != nil {\n\t\tg.Fail(\"generated Go source code could not be reformatted:\", err.Error())\n\t}\n\tif g.annotateCode {\n\t\tm, err := remap.Compute(original, g.Bytes())\n\t\tif err != nil {\n\t\t\tg.Fail(\"formatted generated Go source code could not be mapped back to the original code:\", err.Error())\n\t\t}\n\t\tfor _, anno := range g.annotations {\n\t\t\tnew, ok := m.Find(int(*anno.Begin), int(*anno.End))\n\t\t\tif !ok {\n\t\t\t\tg.Fail(\"span in formatted generated Go source code could not be mapped back to the original code\")\n\t\t\t}\n\t\t\t*anno.Begin = int32(new.Pos)\n\t\t\t*anno.End = int32(new.End)\n\t\t}\n\t}\n}\n\n// Generate the header, including package definition\nfunc (g *Generator) generateHeader() {\n\tg.P(\"// Code generated by protoc-gen-go. DO NOT EDIT.\")\n\tif g.file.GetOptions().GetDeprecated() {\n\t\tg.P(\"// \", g.file.Name, \" is a deprecated file.\")\n\t} else {\n\t\tg.P(\"// source: \", g.file.Name)\n\t}\n\tg.P()\n\tg.PrintComments(strconv.Itoa(packagePath))\n\tg.P()\n\tg.P(\"package \", g.file.packageName)\n\tg.P()\n}\n\n// deprecationComment is the standard comment added to deprecated\n// messages, fields, enums, and enum values.\nvar deprecationComment = \"// Deprecated: Do not use.\"\n\n// PrintComments prints any comments from the source .proto file.\n// The path is a comma-separated list of integers.\n// It returns an indication of whether any comments were printed.\n// See descriptor.proto for its format.\nfunc (g *Generator) PrintComments(path string) bool {\n\tif !g.writeOutput {\n\t\treturn false\n\t}\n\tif c, ok := g.makeComments(path); ok {\n\t\tg.P(c)\n\t\treturn true\n\t}\n\treturn false\n}\n\n// makeComments generates the comment string for the field, no \"\\n\" at the end\nfunc (g *Generator) makeComments(path string) (string, bool) {\n\tloc, ok := g.file.comments[path]\n\tif !ok {\n\t\treturn \"\", false\n\t}\n\tw := new(bytes.Buffer)\n\tnl := \"\"\n\tfor _, line := range strings.Split(strings.TrimSuffix(loc.GetLeadingComments(), \"\\n\"), \"\\n\") {\n\t\tfmt.Fprintf(w, \"%s//%s\", nl, line)\n\t\tnl = \"\\n\"\n\t}\n\treturn w.String(), true\n}\n\nfunc (g *Generator) fileByName(filename string) *FileDescriptor {\n\treturn g.allFilesByName[filename]\n}\n\n// weak returns whether the ith import of the current file is a weak import.\nfunc (g *Generator) weak(i int32) bool {\n\tfor _, j := range g.file.WeakDependency {\n\t\tif j == i {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n// Generate the imports\nfunc (g *Generator) generateImports() {\n\timports := make(map[GoImportPath]GoPackageName)\n\tfor i, s := range g.file.Dependency {\n\t\tfd := g.fileByName(s)\n\t\timportPath := fd.importPath\n\t\t// Do not import our own package.\n\t\tif importPath == g.file.importPath {\n\t\t\tcontinue\n\t\t}\n\t\t// Do not import weak imports.\n\t\tif g.weak(int32(i)) {\n\t\t\tcontinue\n\t\t}\n\t\t// Do not import a package twice.\n\t\tif _, ok := imports[importPath]; ok {\n\t\t\tcontinue\n\t\t}\n\t\t// We need to import all the dependencies, even if we don't reference them,\n\t\t// because other code and tools depend on having the full transitive closure\n\t\t// of protocol buffer types in the binary.\n\t\tpackageName := g.GoPackageName(importPath)\n\t\tif _, ok := g.usedPackages[importPath]; !ok {\n\t\t\tpackageName = \"_\"\n\t\t}\n\t\timports[importPath] = packageName\n\t}\n\tfor importPath := range g.addedImports {\n\t\timports[importPath] = g.GoPackageName(importPath)\n\t}\n\t// We almost always need a proto import.  Rather than computing when we\n\t// do, which is tricky when there's a plugin, just import it and\n\t// reference it later. The same argument applies to the fmt and math packages.\n\tg.P(\"import (\")\n\tg.P(g.Pkg[\"fmt\"] + ` \"fmt\"`)\n\tg.P(g.Pkg[\"math\"] + ` \"math\"`)\n\tg.P(g.Pkg[\"proto\"]+\" \", GoImportPath(g.ImportPrefix)+\"github.com/golang/protobuf/proto\")\n\tfor importPath, packageName := range imports {\n\t\tg.P(packageName, \" \", GoImportPath(g.ImportPrefix)+importPath)\n\t}\n\tg.P(\")\")\n\tg.P()\n\t// TODO: may need to worry about uniqueness across plugins\n\tfor _, p := range plugins {\n\t\tp.GenerateImports(g.file)\n\t\tg.P()\n\t}\n\tg.P(\"// Reference imports to suppress errors if they are not otherwise used.\")\n\tg.P(\"var _ = \", g.Pkg[\"proto\"], \".Marshal\")\n\tg.P(\"var _ = \", g.Pkg[\"fmt\"], \".Errorf\")\n\tg.P(\"var _ = \", g.Pkg[\"math\"], \".Inf\")\n\tg.P()\n}\n\nfunc (g *Generator) generateImported(id *ImportedDescriptor) {\n\tdf := id.o.File()\n\tfilename := *df.Name\n\tif df.importPath == g.file.importPath {\n\t\t// Don't generate type aliases for files in the same Go package as this one.\n\t\treturn\n\t}\n\tif !supportTypeAliases {\n\t\tg.Fail(fmt.Sprintf(\"%s: public imports require at least go1.9\", filename))\n\t}\n\tg.usedPackages[df.importPath] = true\n\n\tfor _, sym := range df.exported[id.o] {\n\t\tsym.GenerateAlias(g, filename, g.GoPackageName(df.importPath))\n\t}\n\n\tg.P()\n}\n\n// Generate the enum definitions for this EnumDescriptor.\nfunc (g *Generator) generateEnum(enum *EnumDescriptor) {\n\t// The full type name\n\ttypeName := enum.TypeName()\n\t// The full type name, CamelCased.\n\tccTypeName := CamelCaseSlice(typeName)\n\tccPrefix := enum.prefix()\n\n\tdeprecatedEnum := \"\"\n\tif enum.GetOptions().GetDeprecated() {\n\t\tdeprecatedEnum = deprecationComment\n\t}\n\tg.PrintComments(enum.path)\n\tg.P(\"type \", Annotate(enum.file, enum.path, ccTypeName), \" int32\", deprecatedEnum)\n\tg.file.addExport(enum, enumSymbol{ccTypeName, enum.proto3()})\n\tg.P(\"const (\")\n\tfor i, e := range enum.Value {\n\t\tetorPath := fmt.Sprintf(\"%s,%d,%d\", enum.path, enumValuePath, i)\n\t\tg.PrintComments(etorPath)\n\n\t\tdeprecatedValue := \"\"\n\t\tif e.GetOptions().GetDeprecated() {\n\t\t\tdeprecatedValue = deprecationComment\n\t\t}\n\n\t\tname := ccPrefix + *e.Name\n\t\tg.P(Annotate(enum.file, etorPath, name), \" \", ccTypeName, \" = \", e.Number, \" \", deprecatedValue)\n\t\tg.file.addExport(enum, constOrVarSymbol{name, \"const\", ccTypeName})\n\t}\n\tg.P(\")\")\n\tg.P()\n\tg.P(\"var \", ccTypeName, \"_name = map[int32]string{\")\n\tgenerated := make(map[int32]bool) // avoid duplicate values\n\tfor _, e := range enum.Value {\n\t\tduplicate := \"\"\n\t\tif _, present := generated[*e.Number]; present {\n\t\t\tduplicate = \"// Duplicate value: \"\n\t\t}\n\t\tg.P(duplicate, e.Number, \": \", strconv.Quote(*e.Name), \",\")\n\t\tgenerated[*e.Number] = true\n\t}\n\tg.P(\"}\")\n\tg.P()\n\tg.P(\"var \", ccTypeName, \"_value = map[string]int32{\")\n\tfor _, e := range enum.Value {\n\t\tg.P(strconv.Quote(*e.Name), \": \", e.Number, \",\")\n\t}\n\tg.P(\"}\")\n\tg.P()\n\n\tif !enum.proto3() {\n\t\tg.P(\"func (x \", ccTypeName, \") Enum() *\", ccTypeName, \" {\")\n\t\tg.P(\"p := new(\", ccTypeName, \")\")\n\t\tg.P(\"*p = x\")\n\t\tg.P(\"return p\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\n\tg.P(\"func (x \", ccTypeName, \") String() string {\")\n\tg.P(\"return \", g.Pkg[\"proto\"], \".EnumName(\", ccTypeName, \"_name, int32(x))\")\n\tg.P(\"}\")\n\tg.P()\n\n\tif !enum.proto3() {\n\t\tg.P(\"func (x *\", ccTypeName, \") UnmarshalJSON(data []byte) error {\")\n\t\tg.P(\"value, err := \", g.Pkg[\"proto\"], \".UnmarshalJSONEnum(\", ccTypeName, `_value, data, \"`, ccTypeName, `\")`)\n\t\tg.P(\"if err != nil {\")\n\t\tg.P(\"return err\")\n\t\tg.P(\"}\")\n\t\tg.P(\"*x = \", ccTypeName, \"(value)\")\n\t\tg.P(\"return nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\n\tvar indexes []string\n\tfor m := enum.parent; m != nil; m = m.parent {\n\t\t// XXX: skip groups?\n\t\tindexes = append([]string{strconv.Itoa(m.index)}, indexes...)\n\t}\n\tindexes = append(indexes, strconv.Itoa(enum.index))\n\tg.P(\"func (\", ccTypeName, \") EnumDescriptor() ([]byte, []int) {\")\n\tg.P(\"return \", g.file.VarName(), \", []int{\", strings.Join(indexes, \", \"), \"}\")\n\tg.P(\"}\")\n\tg.P()\n\tif enum.file.GetPackage() == \"google.protobuf\" && enum.GetName() == \"NullValue\" {\n\t\tg.P(\"func (\", ccTypeName, `) XXX_WellKnownType() string { return \"`, enum.GetName(), `\" }`)\n\t\tg.P()\n\t}\n\n\tg.generateEnumRegistration(enum)\n}\n\n// The tag is a string like \"varint,2,opt,name=fieldname,def=7\" that\n// identifies details of the field for the protocol buffer marshaling and unmarshaling\n// code.  The fields are:\n//\n//\twire encoding\n//\tprotocol tag number\n//\topt,req,rep for optional, required, or repeated\n//\tpacked whether the encoding is \"packed\" (optional; repeated primitives only)\n//\tname= the original declared name\n//\tenum= the name of the enum type if it is an enum-typed field.\n//\tproto3 if this field is in a proto3 message\n//\tdef= string representation of the default value, if any.\n//\n// The default value must be in a representation that can be used at run-time\n// to generate the default value. Thus bools become 0 and 1, for instance.\nfunc (g *Generator) goTag(message *Descriptor, field *descriptor.FieldDescriptorProto, wiretype string) string {\n\toptrepreq := \"\"\n\tswitch {\n\tcase isOptional(field):\n\t\toptrepreq = \"opt\"\n\tcase isRequired(field):\n\t\toptrepreq = \"req\"\n\tcase isRepeated(field):\n\t\toptrepreq = \"rep\"\n\t}\n\tvar defaultValue string\n\tif dv := field.DefaultValue; dv != nil { // set means an explicit default\n\t\tdefaultValue = *dv\n\t\t// Some types need tweaking.\n\t\tswitch *field.Type {\n\t\tcase descriptor.FieldDescriptorProto_TYPE_BOOL:\n\t\t\tif defaultValue == \"true\" {\n\t\t\t\tdefaultValue = \"1\"\n\t\t\t} else {\n\t\t\t\tdefaultValue = \"0\"\n\t\t\t}\n\t\tcase descriptor.FieldDescriptorProto_TYPE_STRING,\n\t\t\tdescriptor.FieldDescriptorProto_TYPE_BYTES:\n\t\t\t// Nothing to do. Quoting is done for the whole tag.\n\t\tcase descriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\t\t// For enums we need to provide the integer constant.\n\t\t\tobj := g.ObjectNamed(field.GetTypeName())\n\t\t\tif id, ok := obj.(*ImportedDescriptor); ok {\n\t\t\t\t// It is an enum that was publicly imported.\n\t\t\t\t// We need the underlying type.\n\t\t\t\tobj = id.o\n\t\t\t}\n\t\t\tenum, ok := obj.(*EnumDescriptor)\n\t\t\tif !ok {\n\t\t\t\tlog.Printf(\"obj is a %T\", obj)\n\t\t\t\tif id, ok := obj.(*ImportedDescriptor); ok {\n\t\t\t\t\tlog.Printf(\"id.o is a %T\", id.o)\n\t\t\t\t}\n\t\t\t\tg.Fail(\"unknown enum type\", CamelCaseSlice(obj.TypeName()))\n\t\t\t}\n\t\t\tdefaultValue = enum.integerValueAsString(defaultValue)\n\t\tcase descriptor.FieldDescriptorProto_TYPE_FLOAT:\n\t\t\tif def := defaultValue; def != \"inf\" && def != \"-inf\" && def != \"nan\" {\n\t\t\t\tif f, err := strconv.ParseFloat(defaultValue, 32); err == nil {\n\t\t\t\t\tdefaultValue = fmt.Sprint(float32(f))\n\t\t\t\t}\n\t\t\t}\n\t\tcase descriptor.FieldDescriptorProto_TYPE_DOUBLE:\n\t\t\tif def := defaultValue; def != \"inf\" && def != \"-inf\" && def != \"nan\" {\n\t\t\t\tif f, err := strconv.ParseFloat(defaultValue, 64); err == nil {\n\t\t\t\t\tdefaultValue = fmt.Sprint(f)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdefaultValue = \",def=\" + defaultValue\n\t}\n\tenum := \"\"\n\tif *field.Type == descriptor.FieldDescriptorProto_TYPE_ENUM {\n\t\t// We avoid using obj.GoPackageName(), because we want to use the\n\t\t// original (proto-world) package name.\n\t\tobj := g.ObjectNamed(field.GetTypeName())\n\t\tif id, ok := obj.(*ImportedDescriptor); ok {\n\t\t\tobj = id.o\n\t\t}\n\t\tenum = \",enum=\"\n\t\tif pkg := obj.File().GetPackage(); pkg != \"\" {\n\t\t\tenum += pkg + \".\"\n\t\t}\n\t\tenum += CamelCaseSlice(obj.TypeName())\n\t}\n\tpacked := \"\"\n\tif (field.Options != nil && field.Options.GetPacked()) ||\n\t\t// Per https://developers.google.com/protocol-buffers/docs/proto3#simple:\n\t\t// \"In proto3, repeated fields of scalar numeric types use packed encoding by default.\"\n\t\t(message.proto3() && (field.Options == nil || field.Options.Packed == nil) &&\n\t\t\tisRepeated(field) && isScalar(field)) {\n\t\tpacked = \",packed\"\n\t}\n\tfieldName := field.GetName()\n\tname := fieldName\n\tif *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP {\n\t\t// We must use the type name for groups instead of\n\t\t// the field name to preserve capitalization.\n\t\t// type_name in FieldDescriptorProto is fully-qualified,\n\t\t// but we only want the local part.\n\t\tname = *field.TypeName\n\t\tif i := strings.LastIndex(name, \".\"); i >= 0 {\n\t\t\tname = name[i+1:]\n\t\t}\n\t}\n\tif json := field.GetJsonName(); field.Extendee == nil && json != \"\" && json != name {\n\t\t// TODO: escaping might be needed, in which case\n\t\t// perhaps this should be in its own \"json\" tag.\n\t\tname += \",json=\" + json\n\t}\n\tname = \",name=\" + name\n\tif message.proto3() {\n\t\tname += \",proto3\"\n\t}\n\toneof := \"\"\n\tif field.OneofIndex != nil {\n\t\toneof = \",oneof\"\n\t}\n\treturn strconv.Quote(fmt.Sprintf(\"%s,%d,%s%s%s%s%s%s\",\n\t\twiretype,\n\t\tfield.GetNumber(),\n\t\toptrepreq,\n\t\tpacked,\n\t\tname,\n\t\tenum,\n\t\toneof,\n\t\tdefaultValue))\n}\n\nfunc needsStar(typ descriptor.FieldDescriptorProto_Type) bool {\n\tswitch typ {\n\tcase descriptor.FieldDescriptorProto_TYPE_GROUP:\n\t\treturn false\n\tcase descriptor.FieldDescriptorProto_TYPE_MESSAGE:\n\t\treturn false\n\tcase descriptor.FieldDescriptorProto_TYPE_BYTES:\n\t\treturn false\n\t}\n\treturn true\n}\n\n// TypeName is the printed name appropriate for an item. If the object is in the current file,\n// TypeName drops the package name and underscores the rest.\n// Otherwise the object is from another package; and the result is the underscored\n// package name followed by the item name.\n// The result always has an initial capital.\nfunc (g *Generator) TypeName(obj Object) string {\n\treturn g.DefaultPackageName(obj) + CamelCaseSlice(obj.TypeName())\n}\n\n// GoType returns a string representing the type name, and the wire type\nfunc (g *Generator) GoType(message *Descriptor, field *descriptor.FieldDescriptorProto) (typ string, wire string) {\n\t// TODO: Options.\n\tswitch *field.Type {\n\tcase descriptor.FieldDescriptorProto_TYPE_DOUBLE:\n\t\ttyp, wire = \"float64\", \"fixed64\"\n\tcase descriptor.FieldDescriptorProto_TYPE_FLOAT:\n\t\ttyp, wire = \"float32\", \"fixed32\"\n\tcase descriptor.FieldDescriptorProto_TYPE_INT64:\n\t\ttyp, wire = \"int64\", \"varint\"\n\tcase descriptor.FieldDescriptorProto_TYPE_UINT64:\n\t\ttyp, wire = \"uint64\", \"varint\"\n\tcase descriptor.FieldDescriptorProto_TYPE_INT32:\n\t\ttyp, wire = \"int32\", \"varint\"\n\tcase descriptor.FieldDescriptorProto_TYPE_UINT32:\n\t\ttyp, wire = \"uint32\", \"varint\"\n\tcase descriptor.FieldDescriptorProto_TYPE_FIXED64:\n\t\ttyp, wire = \"uint64\", \"fixed64\"\n\tcase descriptor.FieldDescriptorProto_TYPE_FIXED32:\n\t\ttyp, wire = \"uint32\", \"fixed32\"\n\tcase descriptor.FieldDescriptorProto_TYPE_BOOL:\n\t\ttyp, wire = \"bool\", \"varint\"\n\tcase descriptor.FieldDescriptorProto_TYPE_STRING:\n\t\ttyp, wire = \"string\", \"bytes\"\n\tcase descriptor.FieldDescriptorProto_TYPE_GROUP:\n\t\tdesc := g.ObjectNamed(field.GetTypeName())\n\t\ttyp, wire = \"*\"+g.TypeName(desc), \"group\"\n\tcase descriptor.FieldDescriptorProto_TYPE_MESSAGE:\n\t\tdesc := g.ObjectNamed(field.GetTypeName())\n\t\ttyp, wire = \"*\"+g.TypeName(desc), \"bytes\"\n\tcase descriptor.FieldDescriptorProto_TYPE_BYTES:\n\t\ttyp, wire = \"[]byte\", \"bytes\"\n\tcase descriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\tdesc := g.ObjectNamed(field.GetTypeName())\n\t\ttyp, wire = g.TypeName(desc), \"varint\"\n\tcase descriptor.FieldDescriptorProto_TYPE_SFIXED32:\n\t\ttyp, wire = \"int32\", \"fixed32\"\n\tcase descriptor.FieldDescriptorProto_TYPE_SFIXED64:\n\t\ttyp, wire = \"int64\", \"fixed64\"\n\tcase descriptor.FieldDescriptorProto_TYPE_SINT32:\n\t\ttyp, wire = \"int32\", \"zigzag32\"\n\tcase descriptor.FieldDescriptorProto_TYPE_SINT64:\n\t\ttyp, wire = \"int64\", \"zigzag64\"\n\tdefault:\n\t\tg.Fail(\"unknown type for\", field.GetName())\n\t}\n\tif isRepeated(field) {\n\t\ttyp = \"[]\" + typ\n\t} else if message != nil && message.proto3() {\n\t\treturn\n\t} else if field.OneofIndex != nil && message != nil {\n\t\treturn\n\t} else if needsStar(*field.Type) {\n\t\ttyp = \"*\" + typ\n\t}\n\treturn\n}\n\nfunc (g *Generator) RecordTypeUse(t string) {\n\tif _, ok := g.typeNameToObject[t]; !ok {\n\t\treturn\n\t}\n\timportPath := g.ObjectNamed(t).GoImportPath()\n\tif importPath == g.outputImportPath {\n\t\t// Don't record use of objects in our package.\n\t\treturn\n\t}\n\tg.AddImport(importPath)\n\tg.usedPackages[importPath] = true\n}\n\n// Method names that may be generated.  Fields with these names get an\n// underscore appended. Any change to this set is a potential incompatible\n// API change because it changes generated field names.\nvar methodNames = [...]string{\n\t\"Reset\",\n\t\"String\",\n\t\"ProtoMessage\",\n\t\"Marshal\",\n\t\"Unmarshal\",\n\t\"ExtensionRangeArray\",\n\t\"ExtensionMap\",\n\t\"Descriptor\",\n}\n\n// Names of messages in the `google.protobuf` package for which\n// we will generate XXX_WellKnownType methods.\nvar wellKnownTypes = map[string]bool{\n\t\"Any\":       true,\n\t\"Duration\":  true,\n\t\"Empty\":     true,\n\t\"Struct\":    true,\n\t\"Timestamp\": true,\n\n\t\"Value\":       true,\n\t\"ListValue\":   true,\n\t\"DoubleValue\": true,\n\t\"FloatValue\":  true,\n\t\"Int64Value\":  true,\n\t\"UInt64Value\": true,\n\t\"Int32Value\":  true,\n\t\"UInt32Value\": true,\n\t\"BoolValue\":   true,\n\t\"StringValue\": true,\n\t\"BytesValue\":  true,\n}\n\n// getterDefault finds the default value for the field to return from a getter,\n// regardless of if it's a built in default or explicit from the source. Returns e.g. \"nil\", `\"\"`, \"Default_MessageType_FieldName\"\nfunc (g *Generator) getterDefault(field *descriptor.FieldDescriptorProto, goMessageType string) string {\n\tif isRepeated(field) {\n\t\treturn \"nil\"\n\t}\n\tif def := field.GetDefaultValue(); def != \"\" {\n\t\tdefaultConstant := g.defaultConstantName(goMessageType, field.GetName())\n\t\tif *field.Type != descriptor.FieldDescriptorProto_TYPE_BYTES {\n\t\t\treturn defaultConstant\n\t\t}\n\t\treturn \"append([]byte(nil), \" + defaultConstant + \"...)\"\n\t}\n\tswitch *field.Type {\n\tcase descriptor.FieldDescriptorProto_TYPE_BOOL:\n\t\treturn \"false\"\n\tcase descriptor.FieldDescriptorProto_TYPE_STRING:\n\t\treturn `\"\"`\n\tcase descriptor.FieldDescriptorProto_TYPE_GROUP, descriptor.FieldDescriptorProto_TYPE_MESSAGE, descriptor.FieldDescriptorProto_TYPE_BYTES:\n\t\treturn \"nil\"\n\tcase descriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\tobj := g.ObjectNamed(field.GetTypeName())\n\t\tvar enum *EnumDescriptor\n\t\tif id, ok := obj.(*ImportedDescriptor); ok {\n\t\t\t// The enum type has been publicly imported.\n\t\t\tenum, _ = id.o.(*EnumDescriptor)\n\t\t} else {\n\t\t\tenum, _ = obj.(*EnumDescriptor)\n\t\t}\n\t\tif enum == nil {\n\t\t\tlog.Printf(\"don't know how to generate getter for %s\", field.GetName())\n\t\t\treturn \"nil\"\n\t\t}\n\t\tif len(enum.Value) == 0 {\n\t\t\treturn \"0 // empty enum\"\n\t\t}\n\t\tfirst := enum.Value[0].GetName()\n\t\treturn g.DefaultPackageName(obj) + enum.prefix() + first\n\tdefault:\n\t\treturn \"0\"\n\t}\n}\n\n// defaultConstantName builds the name of the default constant from the message\n// type name and the untouched field name, e.g. \"Default_MessageType_FieldName\"\nfunc (g *Generator) defaultConstantName(goMessageType, protoFieldName string) string {\n\treturn \"Default_\" + goMessageType + \"_\" + CamelCase(protoFieldName)\n}\n\n// The different types of fields in a message and how to actually print them\n// Most of the logic for generateMessage is in the methods of these types.\n//\n// Note that the content of the field is irrelevant, a simpleField can contain\n// anything from a scalar to a group (which is just a message).\n//\n// Extension fields (and message sets) are however handled separately.\n//\n// simpleField - a field that is neiter weak nor oneof, possibly repeated\n// oneofField - field containing list of subfields:\n// - oneofSubField - a field within the oneof\n\n// msgCtx contains the context for the generator functions.\ntype msgCtx struct {\n\tgoName  string      // Go struct name of the message, e.g. MessageName\n\tmessage *Descriptor // The descriptor for the message\n}\n\n// fieldCommon contains data common to all types of fields.\ntype fieldCommon struct {\n\tgoName     string // Go name of field, e.g. \"FieldName\" or \"Descriptor_\"\n\tprotoName  string // Name of field in proto language, e.g. \"field_name\" or \"descriptor\"\n\tgetterName string // Name of the getter, e.g. \"GetFieldName\" or \"GetDescriptor_\"\n\tgoType     string // The Go type as a string, e.g. \"*int32\" or \"*OtherMessage\"\n\ttags       string // The tag string/annotation for the type, e.g. `protobuf:\"varint,8,opt,name=region_id,json=regionId\"`\n\tfullPath   string // The full path of the field as used by Annotate etc, e.g. \"4,0,2,0\"\n}\n\n// getProtoName gets the proto name of a field, e.g. \"field_name\" or \"descriptor\".\nfunc (f *fieldCommon) getProtoName() string {\n\treturn f.protoName\n}\n\n// getGoType returns the go type of the field  as a string, e.g. \"*int32\".\nfunc (f *fieldCommon) getGoType() string {\n\treturn f.goType\n}\n\n// simpleField is not weak, not a oneof, not an extension. Can be required, optional or repeated.\ntype simpleField struct {\n\tfieldCommon\n\tprotoTypeName string                               // Proto type name, empty if primitive, e.g. \".google.protobuf.Duration\"\n\tprotoType     descriptor.FieldDescriptorProto_Type // Actual type enum value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64\n\tdeprecated    string                               // Deprecation comment, if any, e.g. \"// Deprecated: Do not use.\"\n\tgetterDef     string                               // Default for getters, e.g. \"nil\", `\"\"` or \"Default_MessageType_FieldName\"\n\tprotoDef      string                               // Default value as defined in the proto file, e.g \"yoshi\" or \"5\"\n\tcomment       string                               // The full comment for the field, e.g. \"// Useful information\"\n}\n\n// decl prints the declaration of the field in the struct (if any).\nfunc (f *simpleField) decl(g *Generator, mc *msgCtx) {\n\tg.P(f.comment, Annotate(mc.message.file, f.fullPath, f.goName), \"\\t\", f.goType, \"\\t`\", f.tags, \"`\", f.deprecated)\n}\n\n// getter prints the getter for the field.\nfunc (f *simpleField) getter(g *Generator, mc *msgCtx) {\n\tstar := \"\"\n\ttname := f.goType\n\tif needsStar(f.protoType) && tname[0] == '*' {\n\t\ttname = tname[1:]\n\t\tstar = \"*\"\n\t}\n\tif f.deprecated != \"\" {\n\t\tg.P(f.deprecated)\n\t}\n\tg.P(\"func (m *\", mc.goName, \") \", Annotate(mc.message.file, f.fullPath, f.getterName), \"() \"+tname+\" {\")\n\tif f.getterDef == \"nil\" { // Simpler getter\n\t\tg.P(\"if m != nil {\")\n\t\tg.P(\"return m.\" + f.goName)\n\t\tg.P(\"}\")\n\t\tg.P(\"return nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t\treturn\n\t}\n\tif mc.message.proto3() {\n\t\tg.P(\"if m != nil {\")\n\t} else {\n\t\tg.P(\"if m != nil && m.\" + f.goName + \" != nil {\")\n\t}\n\tg.P(\"return \" + star + \"m.\" + f.goName)\n\tg.P(\"}\")\n\tg.P(\"return \", f.getterDef)\n\tg.P(\"}\")\n\tg.P()\n}\n\n// setter prints the setter method of the field.\nfunc (f *simpleField) setter(g *Generator, mc *msgCtx) {\n\t// No setter for regular fields yet\n}\n\n// getProtoDef returns the default value explicitly stated in the proto file, e.g \"yoshi\" or \"5\".\nfunc (f *simpleField) getProtoDef() string {\n\treturn f.protoDef\n}\n\n// getProtoTypeName returns the protobuf type name for the field as returned by field.GetTypeName(), e.g. \".google.protobuf.Duration\".\nfunc (f *simpleField) getProtoTypeName() string {\n\treturn f.protoTypeName\n}\n\n// getProtoType returns the *field.Type value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64.\nfunc (f *simpleField) getProtoType() descriptor.FieldDescriptorProto_Type {\n\treturn f.protoType\n}\n\n// oneofSubFields are kept slize held by each oneofField. They do not appear in the top level slize of fields for the message.\ntype oneofSubField struct {\n\tfieldCommon\n\tprotoTypeName string                               // Proto type name, empty if primitive, e.g. \".google.protobuf.Duration\"\n\tprotoType     descriptor.FieldDescriptorProto_Type // Actual type enum value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64\n\toneofTypeName string                               // Type name of the enclosing struct, e.g. \"MessageName_FieldName\"\n\tfieldNumber   int                                  // Actual field number, as defined in proto, e.g. 12\n\tgetterDef     string                               // Default for getters, e.g. \"nil\", `\"\"` or \"Default_MessageType_FieldName\"\n\tprotoDef      string                               // Default value as defined in the proto file, e.g \"yoshi\" or \"5\"\n\tdeprecated    string                               // Deprecation comment, if any.\n}\n\n// typedNil prints a nil casted to the pointer to this field.\n// - for XXX_OneofWrappers\nfunc (f *oneofSubField) typedNil(g *Generator) {\n\tg.P(\"(*\", f.oneofTypeName, \")(nil),\")\n}\n\n// getProtoDef returns the default value explicitly stated in the proto file, e.g \"yoshi\" or \"5\".\nfunc (f *oneofSubField) getProtoDef() string {\n\treturn f.protoDef\n}\n\n// getProtoTypeName returns the protobuf type name for the field as returned by field.GetTypeName(), e.g. \".google.protobuf.Duration\".\nfunc (f *oneofSubField) getProtoTypeName() string {\n\treturn f.protoTypeName\n}\n\n// getProtoType returns the *field.Type value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64.\nfunc (f *oneofSubField) getProtoType() descriptor.FieldDescriptorProto_Type {\n\treturn f.protoType\n}\n\n// oneofField represents the oneof on top level.\n// The alternative fields within the oneof are represented by oneofSubField.\ntype oneofField struct {\n\tfieldCommon\n\tsubFields []*oneofSubField // All the possible oneof fields\n\tcomment   string           // The full comment for the field, e.g. \"// Types that are valid to be assigned to MyOneof:\\n\\\\\"\n}\n\n// decl prints the declaration of the field in the struct (if any).\nfunc (f *oneofField) decl(g *Generator, mc *msgCtx) {\n\tcomment := f.comment\n\tfor _, sf := range f.subFields {\n\t\tcomment += \"//\\t*\" + sf.oneofTypeName + \"\\n\"\n\t}\n\tg.P(comment, Annotate(mc.message.file, f.fullPath, f.goName), \" \", f.goType, \" `\", f.tags, \"`\")\n}\n\n// getter for a oneof field will print additional discriminators and interfaces for the oneof,\n// also it prints all the getters for the sub fields.\nfunc (f *oneofField) getter(g *Generator, mc *msgCtx) {\n\t// The discriminator type\n\tg.P(\"type \", f.goType, \" interface {\")\n\tg.P(f.goType, \"()\")\n\tg.P(\"}\")\n\tg.P()\n\t// The subField types, fulfilling the discriminator type contract\n\tfor _, sf := range f.subFields {\n\t\tg.P(\"type \", Annotate(mc.message.file, sf.fullPath, sf.oneofTypeName), \" struct {\")\n\t\tg.P(Annotate(mc.message.file, sf.fullPath, sf.goName), \" \", sf.goType, \" `\", sf.tags, \"`\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\tfor _, sf := range f.subFields {\n\t\tg.P(\"func (*\", sf.oneofTypeName, \") \", f.goType, \"() {}\")\n\t\tg.P()\n\t}\n\t// Getter for the oneof field\n\tg.P(\"func (m *\", mc.goName, \") \", Annotate(mc.message.file, f.fullPath, f.getterName), \"() \", f.goType, \" {\")\n\tg.P(\"if m != nil { return m.\", f.goName, \" }\")\n\tg.P(\"return nil\")\n\tg.P(\"}\")\n\tg.P()\n\t// Getters for each oneof\n\tfor _, sf := range f.subFields {\n\t\tif sf.deprecated != \"\" {\n\t\t\tg.P(sf.deprecated)\n\t\t}\n\t\tg.P(\"func (m *\", mc.goName, \") \", Annotate(mc.message.file, sf.fullPath, sf.getterName), \"() \"+sf.goType+\" {\")\n\t\tg.P(\"if x, ok := m.\", f.getterName, \"().(*\", sf.oneofTypeName, \"); ok {\")\n\t\tg.P(\"return x.\", sf.goName)\n\t\tg.P(\"}\")\n\t\tg.P(\"return \", sf.getterDef)\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n}\n\n// setter prints the setter method of the field.\nfunc (f *oneofField) setter(g *Generator, mc *msgCtx) {\n\t// No setters for oneof yet\n}\n\n// topLevelField interface implemented by all types of fields on the top level (not oneofSubField).\ntype topLevelField interface {\n\tdecl(g *Generator, mc *msgCtx)   // print declaration within the struct\n\tgetter(g *Generator, mc *msgCtx) // print getter\n\tsetter(g *Generator, mc *msgCtx) // print setter if applicable\n}\n\n// defField interface implemented by all types of fields that can have defaults (not oneofField, but instead oneofSubField).\ntype defField interface {\n\tgetProtoDef() string                                // default value explicitly stated in the proto file, e.g \"yoshi\" or \"5\"\n\tgetProtoName() string                               // proto name of a field, e.g. \"field_name\" or \"descriptor\"\n\tgetGoType() string                                  // go type of the field  as a string, e.g. \"*int32\"\n\tgetProtoTypeName() string                           // protobuf type name for the field, e.g. \".google.protobuf.Duration\"\n\tgetProtoType() descriptor.FieldDescriptorProto_Type // *field.Type value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64\n}\n\n// generateDefaultConstants adds constants for default values if needed, which is only if the default value is.\n// explicit in the proto.\nfunc (g *Generator) generateDefaultConstants(mc *msgCtx, topLevelFields []topLevelField) {\n\t// Collect fields that can have defaults\n\tdFields := []defField{}\n\tfor _, pf := range topLevelFields {\n\t\tif f, ok := pf.(*oneofField); ok {\n\t\t\tfor _, osf := range f.subFields {\n\t\t\t\tdFields = append(dFields, osf)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tdFields = append(dFields, pf.(defField))\n\t}\n\tfor _, df := range dFields {\n\t\tdef := df.getProtoDef()\n\t\tif def == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tfieldname := g.defaultConstantName(mc.goName, df.getProtoName())\n\t\ttypename := df.getGoType()\n\t\tif typename[0] == '*' {\n\t\t\ttypename = typename[1:]\n\t\t}\n\t\tkind := \"const \"\n\t\tswitch {\n\t\tcase typename == \"bool\":\n\t\tcase typename == \"string\":\n\t\t\tdef = strconv.Quote(def)\n\t\tcase typename == \"[]byte\":\n\t\t\tdef = \"[]byte(\" + strconv.Quote(unescape(def)) + \")\"\n\t\t\tkind = \"var \"\n\t\tcase def == \"inf\", def == \"-inf\", def == \"nan\":\n\t\t\t// These names are known to, and defined by, the protocol language.\n\t\t\tswitch def {\n\t\t\tcase \"inf\":\n\t\t\t\tdef = \"math.Inf(1)\"\n\t\t\tcase \"-inf\":\n\t\t\t\tdef = \"math.Inf(-1)\"\n\t\t\tcase \"nan\":\n\t\t\t\tdef = \"math.NaN()\"\n\t\t\t}\n\t\t\tif df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_FLOAT {\n\t\t\t\tdef = \"float32(\" + def + \")\"\n\t\t\t}\n\t\t\tkind = \"var \"\n\t\tcase df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_FLOAT:\n\t\t\tif f, err := strconv.ParseFloat(def, 32); err == nil {\n\t\t\t\tdef = fmt.Sprint(float32(f))\n\t\t\t}\n\t\tcase df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_DOUBLE:\n\t\t\tif f, err := strconv.ParseFloat(def, 64); err == nil {\n\t\t\t\tdef = fmt.Sprint(f)\n\t\t\t}\n\t\tcase df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\t\t// Must be an enum.  Need to construct the prefixed name.\n\t\t\tobj := g.ObjectNamed(df.getProtoTypeName())\n\t\t\tvar enum *EnumDescriptor\n\t\t\tif id, ok := obj.(*ImportedDescriptor); ok {\n\t\t\t\t// The enum type has been publicly imported.\n\t\t\t\tenum, _ = id.o.(*EnumDescriptor)\n\t\t\t} else {\n\t\t\t\tenum, _ = obj.(*EnumDescriptor)\n\t\t\t}\n\t\t\tif enum == nil {\n\t\t\t\tlog.Printf(\"don't know how to generate constant for %s\", fieldname)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdef = g.DefaultPackageName(obj) + enum.prefix() + def\n\t\t}\n\t\tg.P(kind, fieldname, \" \", typename, \" = \", def)\n\t\tg.file.addExport(mc.message, constOrVarSymbol{fieldname, kind, \"\"})\n\t}\n\tg.P()\n}\n\n// generateInternalStructFields just adds the XXX_<something> fields to the message struct.\nfunc (g *Generator) generateInternalStructFields(mc *msgCtx, topLevelFields []topLevelField) {\n\tg.P(\"XXX_NoUnkeyedLiteral\\tstruct{} `json:\\\"-\\\"`\") // prevent unkeyed struct literals\n\tif len(mc.message.ExtensionRange) > 0 {\n\t\tmessageset := \"\"\n\t\tif opts := mc.message.Options; opts != nil && opts.GetMessageSetWireFormat() {\n\t\t\tmessageset = \"protobuf_messageset:\\\"1\\\" \"\n\t\t}\n\t\tg.P(g.Pkg[\"proto\"], \".XXX_InternalExtensions `\", messageset, \"json:\\\"-\\\"`\")\n\t}\n\tg.P(\"XXX_unrecognized\\t[]byte `json:\\\"-\\\"`\")\n\tg.P(\"XXX_sizecache\\tint32 `json:\\\"-\\\"`\")\n\n}\n\n// generateOneofFuncs adds all the utility functions for oneof, including marshalling, unmarshalling and sizer.\nfunc (g *Generator) generateOneofFuncs(mc *msgCtx, topLevelFields []topLevelField) {\n\tofields := []*oneofField{}\n\tfor _, f := range topLevelFields {\n\t\tif o, ok := f.(*oneofField); ok {\n\t\t\tofields = append(ofields, o)\n\t\t}\n\t}\n\tif len(ofields) == 0 {\n\t\treturn\n\t}\n\n\t// OneofFuncs\n\tg.P(\"// XXX_OneofWrappers is for the internal use of the proto package.\")\n\tg.P(\"func (*\", mc.goName, \") XXX_OneofWrappers() []interface{} {\")\n\tg.P(\"return []interface{}{\")\n\tfor _, of := range ofields {\n\t\tfor _, sf := range of.subFields {\n\t\t\tsf.typedNil(g)\n\t\t}\n\t}\n\tg.P(\"}\")\n\tg.P(\"}\")\n\tg.P()\n}\n\n// generateMessageStruct adds the actual struct with it's members (but not methods) to the output.\nfunc (g *Generator) generateMessageStruct(mc *msgCtx, topLevelFields []topLevelField) {\n\tcomments := g.PrintComments(mc.message.path)\n\n\t// Guarantee deprecation comments appear after user-provided comments.\n\tif mc.message.GetOptions().GetDeprecated() {\n\t\tif comments {\n\t\t\t// Convention: Separate deprecation comments from original\n\t\t\t// comments with an empty line.\n\t\t\tg.P(\"//\")\n\t\t}\n\t\tg.P(deprecationComment)\n\t}\n\n\tg.P(\"type \", Annotate(mc.message.file, mc.message.path, mc.goName), \" struct {\")\n\tfor _, pf := range topLevelFields {\n\t\tpf.decl(g, mc)\n\t}\n\tg.generateInternalStructFields(mc, topLevelFields)\n\tg.P(\"}\")\n}\n\n// generateGetters adds getters for all fields, including oneofs and weak fields when applicable.\nfunc (g *Generator) generateGetters(mc *msgCtx, topLevelFields []topLevelField) {\n\tfor _, pf := range topLevelFields {\n\t\tpf.getter(g, mc)\n\t}\n}\n\n// generateSetters add setters for all fields, including oneofs and weak fields when applicable.\nfunc (g *Generator) generateSetters(mc *msgCtx, topLevelFields []topLevelField) {\n\tfor _, pf := range topLevelFields {\n\t\tpf.setter(g, mc)\n\t}\n}\n\n// generateCommonMethods adds methods to the message that are not on a per field basis.\nfunc (g *Generator) generateCommonMethods(mc *msgCtx) {\n\t// Reset, String and ProtoMessage methods.\n\tg.P(\"func (m *\", mc.goName, \") Reset() { *m = \", mc.goName, \"{} }\")\n\tg.P(\"func (m *\", mc.goName, \") String() string { return \", g.Pkg[\"proto\"], \".CompactTextString(m) }\")\n\tg.P(\"func (*\", mc.goName, \") ProtoMessage() {}\")\n\tvar indexes []string\n\tfor m := mc.message; m != nil; m = m.parent {\n\t\tindexes = append([]string{strconv.Itoa(m.index)}, indexes...)\n\t}\n\tg.P(\"func (*\", mc.goName, \") Descriptor() ([]byte, []int) {\")\n\tg.P(\"return \", g.file.VarName(), \", []int{\", strings.Join(indexes, \", \"), \"}\")\n\tg.P(\"}\")\n\tg.P()\n\t// TODO: Revisit the decision to use a XXX_WellKnownType method\n\t// if we change proto.MessageName to work with multiple equivalents.\n\tif mc.message.file.GetPackage() == \"google.protobuf\" && wellKnownTypes[mc.message.GetName()] {\n\t\tg.P(\"func (*\", mc.goName, `) XXX_WellKnownType() string { return \"`, mc.message.GetName(), `\" }`)\n\t\tg.P()\n\t}\n\n\t// Extension support methods\n\tif len(mc.message.ExtensionRange) > 0 {\n\t\tg.P()\n\t\tg.P(\"var extRange_\", mc.goName, \" = []\", g.Pkg[\"proto\"], \".ExtensionRange{\")\n\t\tfor _, r := range mc.message.ExtensionRange {\n\t\t\tend := fmt.Sprint(*r.End - 1) // make range inclusive on both ends\n\t\t\tg.P(\"{Start: \", r.Start, \", End: \", end, \"},\")\n\t\t}\n\t\tg.P(\"}\")\n\t\tg.P(\"func (*\", mc.goName, \") ExtensionRangeArray() []\", g.Pkg[\"proto\"], \".ExtensionRange {\")\n\t\tg.P(\"return extRange_\", mc.goName)\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\n\t// TODO: It does not scale to keep adding another method for every\n\t// operation on protos that we want to switch over to using the\n\t// table-driven approach. Instead, we should only add a single method\n\t// that allows getting access to the *InternalMessageInfo struct and then\n\t// calling Unmarshal, Marshal, Merge, Size, and Discard directly on that.\n\n\t// Wrapper for table-driven marshaling and unmarshaling.\n\tg.P(\"func (m *\", mc.goName, \") XXX_Unmarshal(b []byte) error {\")\n\tg.P(\"return xxx_messageInfo_\", mc.goName, \".Unmarshal(m, b)\")\n\tg.P(\"}\")\n\n\tg.P(\"func (m *\", mc.goName, \") XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {\")\n\tg.P(\"return xxx_messageInfo_\", mc.goName, \".Marshal(b, m, deterministic)\")\n\tg.P(\"}\")\n\n\tg.P(\"func (m *\", mc.goName, \") XXX_Merge(src \", g.Pkg[\"proto\"], \".Message) {\")\n\tg.P(\"xxx_messageInfo_\", mc.goName, \".Merge(m, src)\")\n\tg.P(\"}\")\n\n\tg.P(\"func (m *\", mc.goName, \") XXX_Size() int {\") // avoid name clash with \"Size\" field in some message\n\tg.P(\"return xxx_messageInfo_\", mc.goName, \".Size(m)\")\n\tg.P(\"}\")\n\n\tg.P(\"func (m *\", mc.goName, \") XXX_DiscardUnknown() {\")\n\tg.P(\"xxx_messageInfo_\", mc.goName, \".DiscardUnknown(m)\")\n\tg.P(\"}\")\n\n\tg.P(\"var xxx_messageInfo_\", mc.goName, \" \", g.Pkg[\"proto\"], \".InternalMessageInfo\")\n\tg.P()\n}\n\n// Generate the type, methods and default constant definitions for this Descriptor.\nfunc (g *Generator) generateMessage(message *Descriptor) {\n\ttopLevelFields := []topLevelField{}\n\toFields := make(map[int32]*oneofField)\n\t// The full type name\n\ttypeName := message.TypeName()\n\t// The full type name, CamelCased.\n\tgoTypeName := CamelCaseSlice(typeName)\n\n\tusedNames := make(map[string]bool)\n\tfor _, n := range methodNames {\n\t\tusedNames[n] = true\n\t}\n\n\t// allocNames finds a conflict-free variation of the given strings,\n\t// consistently mutating their suffixes.\n\t// It returns the same number of strings.\n\tallocNames := func(ns ...string) []string {\n\tLoop:\n\t\tfor {\n\t\t\tfor _, n := range ns {\n\t\t\t\tif usedNames[n] {\n\t\t\t\t\tfor i := range ns {\n\t\t\t\t\t\tns[i] += \"_\"\n\t\t\t\t\t}\n\t\t\t\t\tcontinue Loop\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, n := range ns {\n\t\t\t\tusedNames[n] = true\n\t\t\t}\n\t\t\treturn ns\n\t\t}\n\t}\n\n\tmapFieldTypes := make(map[*descriptor.FieldDescriptorProto]string) // keep track of the map fields to be added later\n\n\t// Build a structure more suitable for generating the text in one pass\n\tfor i, field := range message.Field {\n\t\t// Allocate the getter and the field at the same time so name\n\t\t// collisions create field/method consistent names.\n\t\t// TODO: This allocation occurs based on the order of the fields\n\t\t// in the proto file, meaning that a change in the field\n\t\t// ordering can change generated Method/Field names.\n\t\tbase := CamelCase(*field.Name)\n\t\tns := allocNames(base, \"Get\"+base)\n\t\tfieldName, fieldGetterName := ns[0], ns[1]\n\t\ttypename, wiretype := g.GoType(message, field)\n\t\tjsonName := *field.Name\n\t\ttag := fmt.Sprintf(\"protobuf:%s json:%q\", g.goTag(message, field, wiretype), jsonName+\",omitempty\")\n\n\t\toneof := field.OneofIndex != nil\n\t\tif oneof && oFields[*field.OneofIndex] == nil {\n\t\t\todp := message.OneofDecl[int(*field.OneofIndex)]\n\t\t\tbase := CamelCase(odp.GetName())\n\t\t\tnames := allocNames(base, \"Get\"+base)\n\t\t\tfname, gname := names[0], names[1]\n\n\t\t\t// This is the first field of a oneof we haven't seen before.\n\t\t\t// Generate the union field.\n\t\t\toneofFullPath := fmt.Sprintf(\"%s,%d,%d\", message.path, messageOneofPath, *field.OneofIndex)\n\t\t\tc, ok := g.makeComments(oneofFullPath)\n\t\t\tif ok {\n\t\t\t\tc += \"\\n//\\n\"\n\t\t\t}\n\t\t\tc += \"// Types that are valid to be assigned to \" + fname + \":\\n\"\n\t\t\t// Generate the rest of this comment later,\n\t\t\t// when we've computed any disambiguation.\n\n\t\t\tdname := \"is\" + goTypeName + \"_\" + fname\n\t\t\ttag := `protobuf_oneof:\"` + odp.GetName() + `\"`\n\t\t\tof := oneofField{\n\t\t\t\tfieldCommon: fieldCommon{\n\t\t\t\t\tgoName:     fname,\n\t\t\t\t\tgetterName: gname,\n\t\t\t\t\tgoType:     dname,\n\t\t\t\t\ttags:       tag,\n\t\t\t\t\tprotoName:  odp.GetName(),\n\t\t\t\t\tfullPath:   oneofFullPath,\n\t\t\t\t},\n\t\t\t\tcomment: c,\n\t\t\t}\n\t\t\ttopLevelFields = append(topLevelFields, &of)\n\t\t\toFields[*field.OneofIndex] = &of\n\t\t}\n\n\t\tif *field.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE {\n\t\t\tdesc := g.ObjectNamed(field.GetTypeName())\n\t\t\tif d, ok := desc.(*Descriptor); ok && d.GetOptions().GetMapEntry() {\n\t\t\t\t// Figure out the Go types and tags for the key and value types.\n\t\t\t\tkeyField, valField := d.Field[0], d.Field[1]\n\t\t\t\tkeyType, keyWire := g.GoType(d, keyField)\n\t\t\t\tvalType, valWire := g.GoType(d, valField)\n\t\t\t\tkeyTag, valTag := g.goTag(d, keyField, keyWire), g.goTag(d, valField, valWire)\n\n\t\t\t\t// We don't use stars, except for message-typed values.\n\t\t\t\t// Message and enum types are the only two possibly foreign types used in maps,\n\t\t\t\t// so record their use. They are not permitted as map keys.\n\t\t\t\tkeyType = strings.TrimPrefix(keyType, \"*\")\n\t\t\t\tswitch *valField.Type {\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\t\t\t\tvalType = strings.TrimPrefix(valType, \"*\")\n\t\t\t\t\tg.RecordTypeUse(valField.GetTypeName())\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_MESSAGE:\n\t\t\t\t\tg.RecordTypeUse(valField.GetTypeName())\n\t\t\t\tdefault:\n\t\t\t\t\tvalType = strings.TrimPrefix(valType, \"*\")\n\t\t\t\t}\n\n\t\t\t\ttypename = fmt.Sprintf(\"map[%s]%s\", keyType, valType)\n\t\t\t\tmapFieldTypes[field] = typename // record for the getter generation\n\n\t\t\t\ttag += fmt.Sprintf(\" protobuf_key:%s protobuf_val:%s\", keyTag, valTag)\n\t\t\t}\n\t\t}\n\n\t\tfieldDeprecated := \"\"\n\t\tif field.GetOptions().GetDeprecated() {\n\t\t\tfieldDeprecated = deprecationComment\n\t\t}\n\n\t\tdvalue := g.getterDefault(field, goTypeName)\n\t\tif oneof {\n\t\t\ttname := goTypeName + \"_\" + fieldName\n\t\t\t// It is possible for this to collide with a message or enum\n\t\t\t// nested in this message. Check for collisions.\n\t\t\tfor {\n\t\t\t\tok := true\n\t\t\t\tfor _, desc := range message.nested {\n\t\t\t\t\tif CamelCaseSlice(desc.TypeName()) == tname {\n\t\t\t\t\t\tok = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, enum := range message.enums {\n\t\t\t\t\tif CamelCaseSlice(enum.TypeName()) == tname {\n\t\t\t\t\t\tok = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !ok {\n\t\t\t\t\ttname += \"_\"\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\toneofField := oFields[*field.OneofIndex]\n\t\t\ttag := \"protobuf:\" + g.goTag(message, field, wiretype)\n\t\t\tsf := oneofSubField{\n\t\t\t\tfieldCommon: fieldCommon{\n\t\t\t\t\tgoName:     fieldName,\n\t\t\t\t\tgetterName: fieldGetterName,\n\t\t\t\t\tgoType:     typename,\n\t\t\t\t\ttags:       tag,\n\t\t\t\t\tprotoName:  field.GetName(),\n\t\t\t\t\tfullPath:   fmt.Sprintf(\"%s,%d,%d\", message.path, messageFieldPath, i),\n\t\t\t\t},\n\t\t\t\tprotoTypeName: field.GetTypeName(),\n\t\t\t\tfieldNumber:   int(*field.Number),\n\t\t\t\tprotoType:     *field.Type,\n\t\t\t\tgetterDef:     dvalue,\n\t\t\t\tprotoDef:      field.GetDefaultValue(),\n\t\t\t\toneofTypeName: tname,\n\t\t\t\tdeprecated:    fieldDeprecated,\n\t\t\t}\n\t\t\toneofField.subFields = append(oneofField.subFields, &sf)\n\t\t\tg.RecordTypeUse(field.GetTypeName())\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldFullPath := fmt.Sprintf(\"%s,%d,%d\", message.path, messageFieldPath, i)\n\t\tc, ok := g.makeComments(fieldFullPath)\n\t\tif ok {\n\t\t\tc += \"\\n\"\n\t\t}\n\t\trf := simpleField{\n\t\t\tfieldCommon: fieldCommon{\n\t\t\t\tgoName:     fieldName,\n\t\t\t\tgetterName: fieldGetterName,\n\t\t\t\tgoType:     typename,\n\t\t\t\ttags:       tag,\n\t\t\t\tprotoName:  field.GetName(),\n\t\t\t\tfullPath:   fieldFullPath,\n\t\t\t},\n\t\t\tprotoTypeName: field.GetTypeName(),\n\t\t\tprotoType:     *field.Type,\n\t\t\tdeprecated:    fieldDeprecated,\n\t\t\tgetterDef:     dvalue,\n\t\t\tprotoDef:      field.GetDefaultValue(),\n\t\t\tcomment:       c,\n\t\t}\n\t\tvar pf topLevelField = &rf\n\n\t\ttopLevelFields = append(topLevelFields, pf)\n\t\tg.RecordTypeUse(field.GetTypeName())\n\t}\n\n\tmc := &msgCtx{\n\t\tgoName:  goTypeName,\n\t\tmessage: message,\n\t}\n\n\tg.generateMessageStruct(mc, topLevelFields)\n\tg.P()\n\tg.generateCommonMethods(mc)\n\tg.P()\n\tg.generateDefaultConstants(mc, topLevelFields)\n\tg.P()\n\tg.generateGetters(mc, topLevelFields)\n\tg.P()\n\tg.generateSetters(mc, topLevelFields)\n\tg.P()\n\tg.generateOneofFuncs(mc, topLevelFields)\n\tg.P()\n\n\tvar oneofTypes []string\n\tfor _, f := range topLevelFields {\n\t\tif of, ok := f.(*oneofField); ok {\n\t\t\tfor _, osf := range of.subFields {\n\t\t\t\toneofTypes = append(oneofTypes, osf.oneofTypeName)\n\t\t\t}\n\t\t}\n\t}\n\n\topts := message.Options\n\tms := &messageSymbol{\n\t\tsym:           goTypeName,\n\t\thasExtensions: len(message.ExtensionRange) > 0,\n\t\tisMessageSet:  opts != nil && opts.GetMessageSetWireFormat(),\n\t\toneofTypes:    oneofTypes,\n\t}\n\tg.file.addExport(message, ms)\n\n\tfor _, ext := range message.ext {\n\t\tg.generateExtension(ext)\n\t}\n\n\tfullName := strings.Join(message.TypeName(), \".\")\n\tif g.file.Package != nil {\n\t\tfullName = *g.file.Package + \".\" + fullName\n\t}\n\n\tg.addInitf(\"%s.RegisterType((*%s)(nil), %q)\", g.Pkg[\"proto\"], goTypeName, fullName)\n\t// Register types for native map types.\n\tfor _, k := range mapFieldKeys(mapFieldTypes) {\n\t\tfullName := strings.TrimPrefix(*k.TypeName, \".\")\n\t\tg.addInitf(\"%s.RegisterMapType((%s)(nil), %q)\", g.Pkg[\"proto\"], mapFieldTypes[k], fullName)\n\t}\n\n}\n\ntype byTypeName []*descriptor.FieldDescriptorProto\n\nfunc (a byTypeName) Len() int           { return len(a) }\nfunc (a byTypeName) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }\nfunc (a byTypeName) Less(i, j int) bool { return *a[i].TypeName < *a[j].TypeName }\n\n// mapFieldKeys returns the keys of m in a consistent order.\nfunc mapFieldKeys(m map[*descriptor.FieldDescriptorProto]string) []*descriptor.FieldDescriptorProto {\n\tkeys := make([]*descriptor.FieldDescriptorProto, 0, len(m))\n\tfor k := range m {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Sort(byTypeName(keys))\n\treturn keys\n}\n\nvar escapeChars = [256]byte{\n\t'a': '\\a', 'b': '\\b', 'f': '\\f', 'n': '\\n', 'r': '\\r', 't': '\\t', 'v': '\\v', '\\\\': '\\\\', '\"': '\"', '\\'': '\\'', '?': '?',\n}\n\n// unescape reverses the \"C\" escaping that protoc does for default values of bytes fields.\n// It is best effort in that it effectively ignores malformed input. Seemingly invalid escape\n// sequences are conveyed, unmodified, into the decoded result.\nfunc unescape(s string) string {\n\t// NB: Sadly, we can't use strconv.Unquote because protoc will escape both\n\t// single and double quotes, but strconv.Unquote only allows one or the\n\t// other (based on actual surrounding quotes of its input argument).\n\n\tvar out []byte\n\tfor len(s) > 0 {\n\t\t// regular character, or too short to be valid escape\n\t\tif s[0] != '\\\\' || len(s) < 2 {\n\t\t\tout = append(out, s[0])\n\t\t\ts = s[1:]\n\t\t} else if c := escapeChars[s[1]]; c != 0 {\n\t\t\t// escape sequence\n\t\t\tout = append(out, c)\n\t\t\ts = s[2:]\n\t\t} else if s[1] == 'x' || s[1] == 'X' {\n\t\t\t// hex escape, e.g. \"\\x80\n\t\t\tif len(s) < 4 {\n\t\t\t\t// too short to be valid\n\t\t\t\tout = append(out, s[:2]...)\n\t\t\t\ts = s[2:]\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tv, err := strconv.ParseUint(s[2:4], 16, 8)\n\t\t\tif err != nil {\n\t\t\t\tout = append(out, s[:4]...)\n\t\t\t} else {\n\t\t\t\tout = append(out, byte(v))\n\t\t\t}\n\t\t\ts = s[4:]\n\t\t} else if '0' <= s[1] && s[1] <= '7' {\n\t\t\t// octal escape, can vary from 1 to 3 octal digits; e.g., \"\\0\" \"\\40\" or \"\\164\"\n\t\t\t// so consume up to 2 more bytes or up to end-of-string\n\t\t\tn := len(s[1:]) - len(strings.TrimLeft(s[1:], \"01234567\"))\n\t\t\tif n > 3 {\n\t\t\t\tn = 3\n\t\t\t}\n\t\t\tv, err := strconv.ParseUint(s[1:1+n], 8, 8)\n\t\t\tif err != nil {\n\t\t\t\tout = append(out, s[:1+n]...)\n\t\t\t} else {\n\t\t\t\tout = append(out, byte(v))\n\t\t\t}\n\t\t\ts = s[1+n:]\n\t\t} else {\n\t\t\t// bad escape, just propagate the slash as-is\n\t\t\tout = append(out, s[0])\n\t\t\ts = s[1:]\n\t\t}\n\t}\n\n\treturn string(out)\n}\n\nfunc (g *Generator) generateExtension(ext *ExtensionDescriptor) {\n\tccTypeName := ext.DescName()\n\n\textObj := g.ObjectNamed(*ext.Extendee)\n\tvar extDesc *Descriptor\n\tif id, ok := extObj.(*ImportedDescriptor); ok {\n\t\t// This is extending a publicly imported message.\n\t\t// We need the underlying type for goTag.\n\t\textDesc = id.o.(*Descriptor)\n\t} else {\n\t\textDesc = extObj.(*Descriptor)\n\t}\n\textendedType := \"*\" + g.TypeName(extObj) // always use the original\n\tfield := ext.FieldDescriptorProto\n\tfieldType, wireType := g.GoType(ext.parent, field)\n\ttag := g.goTag(extDesc, field, wireType)\n\tg.RecordTypeUse(*ext.Extendee)\n\tif n := ext.FieldDescriptorProto.TypeName; n != nil {\n\t\t// foreign extension type\n\t\tg.RecordTypeUse(*n)\n\t}\n\n\ttypeName := ext.TypeName()\n\n\t// Special case for proto2 message sets: If this extension is extending\n\t// proto2.bridge.MessageSet, and its final name component is \"message_set_extension\",\n\t// then drop that last component.\n\t//\n\t// TODO: This should be implemented in the text formatter rather than the generator.\n\t// In addition, the situation for when to apply this special case is implemented\n\t// differently in other languages:\n\t// https://github.com/google/protobuf/blob/aff10976/src/google/protobuf/text_format.cc#L1560\n\tif extDesc.GetOptions().GetMessageSetWireFormat() && typeName[len(typeName)-1] == \"message_set_extension\" {\n\t\ttypeName = typeName[:len(typeName)-1]\n\t}\n\n\t// For text formatting, the package must be exactly what the .proto file declares,\n\t// ignoring overrides such as the go_package option, and with no dot/underscore mapping.\n\textName := strings.Join(typeName, \".\")\n\tif g.file.Package != nil {\n\t\textName = *g.file.Package + \".\" + extName\n\t}\n\n\tg.P(\"var \", ccTypeName, \" = &\", g.Pkg[\"proto\"], \".ExtensionDesc{\")\n\tg.P(\"ExtendedType: (\", extendedType, \")(nil),\")\n\tg.P(\"ExtensionType: (\", fieldType, \")(nil),\")\n\tg.P(\"Field: \", field.Number, \",\")\n\tg.P(`Name: \"`, extName, `\",`)\n\tg.P(\"Tag: \", tag, \",\")\n\tg.P(`Filename: \"`, g.file.GetName(), `\",`)\n\n\tg.P(\"}\")\n\tg.P()\n\n\tg.addInitf(\"%s.RegisterExtension(%s)\", g.Pkg[\"proto\"], ext.DescName())\n\n\tg.file.addExport(ext, constOrVarSymbol{ccTypeName, \"var\", \"\"})\n}\n\nfunc (g *Generator) generateInitFunction() {\n\tif len(g.init) == 0 {\n\t\treturn\n\t}\n\tg.P(\"func init() {\")\n\tfor _, l := range g.init {\n\t\tg.P(l)\n\t}\n\tg.P(\"}\")\n\tg.init = nil\n}\n\nfunc (g *Generator) generateFileDescriptor(file *FileDescriptor) {\n\t// Make a copy and trim source_code_info data.\n\t// TODO: Trim this more when we know exactly what we need.\n\tpb := proto.Clone(file.FileDescriptorProto).(*descriptor.FileDescriptorProto)\n\tpb.SourceCodeInfo = nil\n\n\tb, err := proto.Marshal(pb)\n\tif err != nil {\n\t\tg.Fail(err.Error())\n\t}\n\n\tvar buf bytes.Buffer\n\tw, _ := gzip.NewWriterLevel(&buf, gzip.BestCompression)\n\tw.Write(b)\n\tw.Close()\n\tb = buf.Bytes()\n\n\tv := file.VarName()\n\tg.P()\n\tg.P(\"func init() { \", g.Pkg[\"proto\"], \".RegisterFile(\", strconv.Quote(*file.Name), \", \", v, \") }\")\n\tg.P(\"var \", v, \" = []byte{\")\n\tg.P(\"// \", len(b), \" bytes of a gzipped FileDescriptorProto\")\n\tfor len(b) > 0 {\n\t\tn := 16\n\t\tif n > len(b) {\n\t\t\tn = len(b)\n\t\t}\n\n\t\ts := \"\"\n\t\tfor _, c := range b[:n] {\n\t\t\ts += fmt.Sprintf(\"0x%02x,\", c)\n\t\t}\n\t\tg.P(s)\n\n\t\tb = b[n:]\n\t}\n\tg.P(\"}\")\n}\n\nfunc (g *Generator) generateEnumRegistration(enum *EnumDescriptor) {\n\t// // We always print the full (proto-world) package name here.\n\tpkg := enum.File().GetPackage()\n\tif pkg != \"\" {\n\t\tpkg += \".\"\n\t}\n\t// The full type name\n\ttypeName := enum.TypeName()\n\t// The full type name, CamelCased.\n\tccTypeName := CamelCaseSlice(typeName)\n\tg.addInitf(\"%s.RegisterEnum(%q, %[3]s_name, %[3]s_value)\", g.Pkg[\"proto\"], pkg+ccTypeName, ccTypeName)\n}\n\n// And now lots of helper functions.\n\n// Is c an ASCII lower-case letter?\nfunc isASCIILower(c byte) bool {\n\treturn 'a' <= c && c <= 'z'\n}\n\n// Is c an ASCII digit?\nfunc isASCIIDigit(c byte) bool {\n\treturn '0' <= c && c <= '9'\n}\n\n// CamelCase returns the CamelCased name.\n// If there is an interior underscore followed by a lower case letter,\n// drop the underscore and convert the letter to upper case.\n// There is a remote possibility of this rewrite causing a name collision,\n// but it's so remote we're prepared to pretend it's nonexistent - since the\n// C++ generator lowercases names, it's extremely unlikely to have two fields\n// with different capitalizations.\n// In short, _my_field_name_2 becomes XMyFieldName_2.\nfunc CamelCase(s string) string {\n\tif s == \"\" {\n\t\treturn \"\"\n\t}\n\tt := make([]byte, 0, 32)\n\ti := 0\n\tif s[0] == '_' {\n\t\t// Need a capital letter; drop the '_'.\n\t\tt = append(t, 'X')\n\t\ti++\n\t}\n\t// Invariant: if the next letter is lower case, it must be converted\n\t// to upper case.\n\t// That is, we process a word at a time, where words are marked by _ or\n\t// upper case letter. Digits are treated as words.\n\tfor ; i < len(s); i++ {\n\t\tc := s[i]\n\t\tif c == '_' && i+1 < len(s) && isASCIILower(s[i+1]) {\n\t\t\tcontinue // Skip the underscore in s.\n\t\t}\n\t\tif isASCIIDigit(c) {\n\t\t\tt = append(t, c)\n\t\t\tcontinue\n\t\t}\n\t\t// Assume we have a letter now - if not, it's a bogus identifier.\n\t\t// The next word is a sequence of characters that must start upper case.\n\t\tif isASCIILower(c) {\n\t\t\tc ^= ' ' // Make it a capital letter.\n\t\t}\n\t\tt = append(t, c) // Guaranteed not lower case.\n\t\t// Accept lower case sequence that follows.\n\t\tfor i+1 < len(s) && isASCIILower(s[i+1]) {\n\t\t\ti++\n\t\t\tt = append(t, s[i])\n\t\t}\n\t}\n\treturn string(t)\n}\n\n// CamelCaseSlice is like CamelCase, but the argument is a slice of strings to\n// be joined with \"_\".\nfunc CamelCaseSlice(elem []string) string { return CamelCase(strings.Join(elem, \"_\")) }\n\n// dottedSlice turns a sliced name into a dotted name.\nfunc dottedSlice(elem []string) string { return strings.Join(elem, \".\") }\n\n// Is this field optional?\nfunc isOptional(field *descriptor.FieldDescriptorProto) bool {\n\treturn field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_OPTIONAL\n}\n\n// Is this field required?\nfunc isRequired(field *descriptor.FieldDescriptorProto) bool {\n\treturn field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_REQUIRED\n}\n\n// Is this field repeated?\nfunc isRepeated(field *descriptor.FieldDescriptorProto) bool {\n\treturn field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED\n}\n\n// Is this field a scalar numeric type?\nfunc isScalar(field *descriptor.FieldDescriptorProto) bool {\n\tif field.Type == nil {\n\t\treturn false\n\t}\n\tswitch *field.Type {\n\tcase descriptor.FieldDescriptorProto_TYPE_DOUBLE,\n\t\tdescriptor.FieldDescriptorProto_TYPE_FLOAT,\n\t\tdescriptor.FieldDescriptorProto_TYPE_INT64,\n\t\tdescriptor.FieldDescriptorProto_TYPE_UINT64,\n\t\tdescriptor.FieldDescriptorProto_TYPE_INT32,\n\t\tdescriptor.FieldDescriptorProto_TYPE_FIXED64,\n\t\tdescriptor.FieldDescriptorProto_TYPE_FIXED32,\n\t\tdescriptor.FieldDescriptorProto_TYPE_BOOL,\n\t\tdescriptor.FieldDescriptorProto_TYPE_UINT32,\n\t\tdescriptor.FieldDescriptorProto_TYPE_ENUM,\n\t\tdescriptor.FieldDescriptorProto_TYPE_SFIXED32,\n\t\tdescriptor.FieldDescriptorProto_TYPE_SFIXED64,\n\t\tdescriptor.FieldDescriptorProto_TYPE_SINT32,\n\t\tdescriptor.FieldDescriptorProto_TYPE_SINT64:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\n// badToUnderscore is the mapping function used to generate Go names from package names,\n// which can be dotted in the input .proto file.  It replaces non-identifier characters such as\n// dot or dash with underscore.\nfunc badToUnderscore(r rune) rune {\n\tif unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' {\n\t\treturn r\n\t}\n\treturn '_'\n}\n\n// baseName returns the last path element of the name, with the last dotted suffix removed.\nfunc baseName(name string) string {\n\t// First, find the last element\n\tif i := strings.LastIndex(name, \"/\"); i >= 0 {\n\t\tname = name[i+1:]\n\t}\n\t// Now drop the suffix\n\tif i := strings.LastIndex(name, \".\"); i >= 0 {\n\t\tname = name[0:i]\n\t}\n\treturn name\n}\n\n// The SourceCodeInfo message describes the location of elements of a parsed\n// .proto file by way of a \"path\", which is a sequence of integers that\n// describe the route from a FileDescriptorProto to the relevant submessage.\n// The path alternates between a field number of a repeated field, and an index\n// into that repeated field. The constants below define the field numbers that\n// are used.\n//\n// See descriptor.proto for more information about this.\nconst (\n\t// tag numbers in FileDescriptorProto\n\tpackagePath = 2 // package\n\tmessagePath = 4 // message_type\n\tenumPath    = 5 // enum_type\n\t// tag numbers in DescriptorProto\n\tmessageFieldPath   = 2 // field\n\tmessageMessagePath = 3 // nested_type\n\tmessageEnumPath    = 4 // enum_type\n\tmessageOneofPath   = 8 // oneof_decl\n\t// tag numbers in EnumDescriptorProto\n\tenumValuePath = 2 // value\n)\n\nvar supportTypeAliases bool\n\nfunc init() {\n\tfor _, tag := range build.Default.ReleaseTags {\n\t\tif tag == \"go1.9\" {\n\t\t\tsupportTypeAliases = true\n\t\t\treturn\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "protoc-gen-go/generator/internal/remap/remap.go",
    "content": "// Copyright 2017 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package remap handles tracking the locations of Go tokens in a source text\n// across a rewrite by the Go formatter.\npackage remap\n\nimport (\n\t\"fmt\"\n\t\"go/scanner\"\n\t\"go/token\"\n)\n\n// A Location represents a span of byte offsets in the source text.\ntype Location struct {\n\tPos, End int // End is exclusive\n}\n\n// A Map represents a mapping between token locations in an input source text\n// and locations in the correspnding output text.\ntype Map map[Location]Location\n\n// Find reports whether the specified span is recorded by m, and if so returns\n// the new location it was mapped to. If the input span was not found, the\n// returned location is the same as the input.\nfunc (m Map) Find(pos, end int) (Location, bool) {\n\tkey := Location{\n\t\tPos: pos,\n\t\tEnd: end,\n\t}\n\tif loc, ok := m[key]; ok {\n\t\treturn loc, true\n\t}\n\treturn key, false\n}\n\nfunc (m Map) add(opos, oend, npos, nend int) {\n\tm[Location{Pos: opos, End: oend}] = Location{Pos: npos, End: nend}\n}\n\n// Compute constructs a location mapping from input to output.  An error is\n// reported if any of the tokens of output cannot be mapped.\nfunc Compute(input, output []byte) (Map, error) {\n\titok := tokenize(input)\n\totok := tokenize(output)\n\tif len(itok) != len(otok) {\n\t\treturn nil, fmt.Errorf(\"wrong number of tokens, %d ≠ %d\", len(itok), len(otok))\n\t}\n\tm := make(Map)\n\tfor i, ti := range itok {\n\t\tto := otok[i]\n\t\tif ti.Token != to.Token {\n\t\t\treturn nil, fmt.Errorf(\"token %d type mismatch: %s ≠ %s\", i+1, ti, to)\n\t\t}\n\t\tm.add(ti.pos, ti.end, to.pos, to.end)\n\t}\n\treturn m, nil\n}\n\n// tokinfo records the span and type of a source token.\ntype tokinfo struct {\n\tpos, end int\n\ttoken.Token\n}\n\nfunc tokenize(src []byte) []tokinfo {\n\tfs := token.NewFileSet()\n\tvar s scanner.Scanner\n\ts.Init(fs.AddFile(\"src\", fs.Base(), len(src)), src, nil, scanner.ScanComments)\n\tvar info []tokinfo\n\tfor {\n\t\tpos, next, lit := s.Scan()\n\t\tswitch next {\n\t\tcase token.SEMICOLON:\n\t\t\tcontinue\n\t\t}\n\t\tinfo = append(info, tokinfo{\n\t\t\tpos:   int(pos - 1),\n\t\t\tend:   int(pos + token.Pos(len(lit)) - 1),\n\t\t\tToken: next,\n\t\t})\n\t\tif next == token.EOF {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn info\n}\n"
  },
  {
    "path": "protoc-gen-go/generator/internal/remap/remap_test.go",
    "content": "// Copyright 2017 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage remap\n\nimport (\n\t\"go/format\"\n\t\"testing\"\n)\n\nfunc TestErrors(t *testing.T) {\n\ttests := []struct {\n\t\tin, out string\n\t}{\n\t\t{\"\", \"x\"},\n\t\t{\"x\", \"\"},\n\t\t{\"var x int = 5\\n\", \"var x = 5\\n\"},\n\t\t{\"these are \\\"one\\\" thing\", \"those are 'another' thing\"},\n\t}\n\tfor _, test := range tests {\n\t\tm, err := Compute([]byte(test.in), []byte(test.out))\n\t\tif err != nil {\n\t\t\tt.Logf(\"Got expected error: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tt.Errorf(\"Compute(%q, %q): got %+v, wanted error\", test.in, test.out, m)\n\t}\n}\n\nfunc TestMatching(t *testing.T) {\n\t// The input is a source text that will be rearranged by the formatter.\n\tconst input = `package foo\nvar s int\nfunc main(){}\n`\n\n\toutput, err := format.Source([]byte(input))\n\tif err != nil {\n\t\tt.Fatalf(\"Formatting failed: %v\", err)\n\t}\n\tm, err := Compute([]byte(input), output)\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error: %v\", err)\n\t}\n\n\t// Verify that the mapped locations have the same text.\n\tfor key, val := range m {\n\t\twant := input[key.Pos:key.End]\n\t\tgot := string(output[val.Pos:val.End])\n\t\tif got != want {\n\t\t\tt.Errorf(\"Token at %d:%d: got %q, want %q\", key.Pos, key.End, got, want)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "protoc-gen-go/grpc/grpc.go",
    "content": "// Copyright 2015 The Go Authors.  All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package grpc is deprecated.\n//\n// This package is excluded from the Go protocol buffer compatibility guarantee\n// and may be deleted at some point in the future.\n//\n// Deprecated: Do not use.\npackage grpc\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\n\tpb \"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n\t\"github.com/golang/protobuf/protoc-gen-go/generator\"\n)\n\n// generatedCodeVersion indicates a version of the generated code.\n// It is incremented whenever an incompatibility between the generated code and\n// the grpc package is introduced; the generated code references\n// a constant, grpc.SupportPackageIsVersionN (where N is generatedCodeVersion).\nconst generatedCodeVersion = 6\n\n// Paths for packages used by code generated in this file,\n// relative to the import_prefix of the generator.Generator.\nconst (\n\tcontextPkgPath = \"context\"\n\tgrpcPkgPath    = \"google.golang.org/grpc\"\n\tcodePkgPath    = \"google.golang.org/grpc/codes\"\n\tstatusPkgPath  = \"google.golang.org/grpc/status\"\n)\n\nfunc init() {\n\tgenerator.RegisterPlugin(new(grpc))\n}\n\n// grpc is an implementation of the Go protocol buffer compiler's\n// plugin architecture.  It generates bindings for gRPC support.\ntype grpc struct {\n\tgen *generator.Generator\n}\n\n// Name returns the name of this plugin, \"grpc\".\nfunc (g *grpc) Name() string {\n\treturn \"grpc\"\n}\n\n// The names for packages imported in the generated code.\n// They may vary from the final path component of the import path\n// if the name is used by other packages.\nvar (\n\tcontextPkg string\n\tgrpcPkg    string\n)\n\n// Init initializes the plugin.\nfunc (g *grpc) Init(gen *generator.Generator) {\n\tg.gen = gen\n}\n\n// Given a type name defined in a .proto, return its object.\n// Also record that we're using it, to guarantee the associated import.\nfunc (g *grpc) objectNamed(name string) generator.Object {\n\tg.gen.RecordTypeUse(name)\n\treturn g.gen.ObjectNamed(name)\n}\n\n// Given a type name defined in a .proto, return its name as we will print it.\nfunc (g *grpc) typeName(str string) string {\n\treturn g.gen.TypeName(g.objectNamed(str))\n}\n\n// P forwards to g.gen.P.\nfunc (g *grpc) P(args ...interface{}) { g.gen.P(args...) }\n\n// Generate generates code for the services in the given file.\nfunc (g *grpc) Generate(file *generator.FileDescriptor) {\n\tif len(file.FileDescriptorProto.Service) == 0 {\n\t\treturn\n\t}\n\n\tcontextPkg = string(g.gen.AddImport(contextPkgPath))\n\tgrpcPkg = string(g.gen.AddImport(grpcPkgPath))\n\n\tg.P(\"// Reference imports to suppress errors if they are not otherwise used.\")\n\tg.P(\"var _ \", contextPkg, \".Context\")\n\tg.P(\"var _ \", grpcPkg, \".ClientConnInterface\")\n\tg.P()\n\n\t// Assert version compatibility.\n\tg.P(\"// This is a compile-time assertion to ensure that this generated file\")\n\tg.P(\"// is compatible with the grpc package it is being compiled against.\")\n\tg.P(\"const _ = \", grpcPkg, \".SupportPackageIsVersion\", generatedCodeVersion)\n\tg.P()\n\n\tfor i, service := range file.FileDescriptorProto.Service {\n\t\tg.generateService(file, service, i)\n\t}\n}\n\n// GenerateImports generates the import declaration for this file.\nfunc (g *grpc) GenerateImports(file *generator.FileDescriptor) {\n}\n\n// reservedClientName records whether a client name is reserved on the client side.\nvar reservedClientName = map[string]bool{\n\t// TODO: do we need any in gRPC?\n}\n\nfunc unexport(s string) string { return strings.ToLower(s[:1]) + s[1:] }\n\n// deprecationComment is the standard comment added to deprecated\n// messages, fields, enums, and enum values.\nvar deprecationComment = \"// Deprecated: Do not use.\"\n\n// generateService generates all the code for the named service.\nfunc (g *grpc) generateService(file *generator.FileDescriptor, service *pb.ServiceDescriptorProto, index int) {\n\tpath := fmt.Sprintf(\"6,%d\", index) // 6 means service.\n\n\torigServName := service.GetName()\n\tfullServName := origServName\n\tif pkg := file.GetPackage(); pkg != \"\" {\n\t\tfullServName = pkg + \".\" + fullServName\n\t}\n\tservName := generator.CamelCase(origServName)\n\tdeprecated := service.GetOptions().GetDeprecated()\n\n\tg.P()\n\tg.P(fmt.Sprintf(`// %sClient is the client API for %s service.\n//\n// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.`, servName, servName))\n\n\t// Client interface.\n\tif deprecated {\n\t\tg.P(\"//\")\n\t\tg.P(deprecationComment)\n\t}\n\tg.P(\"type \", servName, \"Client interface {\")\n\tfor i, method := range service.Method {\n\t\tg.gen.PrintComments(fmt.Sprintf(\"%s,2,%d\", path, i)) // 2 means method in a service.\n\t\tif method.GetOptions().GetDeprecated() {\n\t\t\tg.P(\"//\")\n\t\t\tg.P(deprecationComment)\n\t\t}\n\t\tg.P(g.generateClientSignature(servName, method))\n\t}\n\tg.P(\"}\")\n\tg.P()\n\n\t// Client structure.\n\tg.P(\"type \", unexport(servName), \"Client struct {\")\n\tg.P(\"cc \", grpcPkg, \".ClientConnInterface\")\n\tg.P(\"}\")\n\tg.P()\n\n\t// NewClient factory.\n\tif deprecated {\n\t\tg.P(deprecationComment)\n\t}\n\tg.P(\"func New\", servName, \"Client (cc \", grpcPkg, \".ClientConnInterface) \", servName, \"Client {\")\n\tg.P(\"return &\", unexport(servName), \"Client{cc}\")\n\tg.P(\"}\")\n\tg.P()\n\n\tvar methodIndex, streamIndex int\n\tserviceDescVar := \"_\" + servName + \"_serviceDesc\"\n\t// Client method implementations.\n\tfor _, method := range service.Method {\n\t\tvar descExpr string\n\t\tif !method.GetServerStreaming() && !method.GetClientStreaming() {\n\t\t\t// Unary RPC method\n\t\t\tdescExpr = fmt.Sprintf(\"&%s.Methods[%d]\", serviceDescVar, methodIndex)\n\t\t\tmethodIndex++\n\t\t} else {\n\t\t\t// Streaming RPC method\n\t\t\tdescExpr = fmt.Sprintf(\"&%s.Streams[%d]\", serviceDescVar, streamIndex)\n\t\t\tstreamIndex++\n\t\t}\n\t\tg.generateClientMethod(servName, fullServName, serviceDescVar, method, descExpr)\n\t}\n\n\t// Server interface.\n\tserverType := servName + \"Server\"\n\tg.P(\"// \", serverType, \" is the server API for \", servName, \" service.\")\n\tif deprecated {\n\t\tg.P(\"//\")\n\t\tg.P(deprecationComment)\n\t}\n\tg.P(\"type \", serverType, \" interface {\")\n\tfor i, method := range service.Method {\n\t\tg.gen.PrintComments(fmt.Sprintf(\"%s,2,%d\", path, i)) // 2 means method in a service.\n\t\tif method.GetOptions().GetDeprecated() {\n\t\t\tg.P(\"//\")\n\t\t\tg.P(deprecationComment)\n\t\t}\n\t\tg.P(g.generateServerSignature(servName, method))\n\t}\n\tg.P(\"}\")\n\tg.P()\n\n\t// Server Unimplemented struct for forward compatibility.\n\tif deprecated {\n\t\tg.P(deprecationComment)\n\t}\n\tg.generateUnimplementedServer(servName, service)\n\n\t// Server registration.\n\tif deprecated {\n\t\tg.P(deprecationComment)\n\t}\n\tg.P(\"func Register\", servName, \"Server(s *\", grpcPkg, \".Server, srv \", serverType, \") {\")\n\tg.P(\"s.RegisterService(&\", serviceDescVar, `, srv)`)\n\tg.P(\"}\")\n\tg.P()\n\n\t// Server handler implementations.\n\tvar handlerNames []string\n\tfor _, method := range service.Method {\n\t\thname := g.generateServerMethod(servName, fullServName, method)\n\t\thandlerNames = append(handlerNames, hname)\n\t}\n\n\t// Service descriptor.\n\tg.P(\"var \", serviceDescVar, \" = \", grpcPkg, \".ServiceDesc {\")\n\tg.P(\"ServiceName: \", strconv.Quote(fullServName), \",\")\n\tg.P(\"HandlerType: (*\", serverType, \")(nil),\")\n\tg.P(\"Methods: []\", grpcPkg, \".MethodDesc{\")\n\tfor i, method := range service.Method {\n\t\tif method.GetServerStreaming() || method.GetClientStreaming() {\n\t\t\tcontinue\n\t\t}\n\t\tg.P(\"{\")\n\t\tg.P(\"MethodName: \", strconv.Quote(method.GetName()), \",\")\n\t\tg.P(\"Handler: \", handlerNames[i], \",\")\n\t\tg.P(\"},\")\n\t}\n\tg.P(\"},\")\n\tg.P(\"Streams: []\", grpcPkg, \".StreamDesc{\")\n\tfor i, method := range service.Method {\n\t\tif !method.GetServerStreaming() && !method.GetClientStreaming() {\n\t\t\tcontinue\n\t\t}\n\t\tg.P(\"{\")\n\t\tg.P(\"StreamName: \", strconv.Quote(method.GetName()), \",\")\n\t\tg.P(\"Handler: \", handlerNames[i], \",\")\n\t\tif method.GetServerStreaming() {\n\t\t\tg.P(\"ServerStreams: true,\")\n\t\t}\n\t\tif method.GetClientStreaming() {\n\t\t\tg.P(\"ClientStreams: true,\")\n\t\t}\n\t\tg.P(\"},\")\n\t}\n\tg.P(\"},\")\n\tg.P(\"Metadata: \\\"\", file.GetName(), \"\\\",\")\n\tg.P(\"}\")\n\tg.P()\n}\n\n// generateUnimplementedServer creates the unimplemented server struct\nfunc (g *grpc) generateUnimplementedServer(servName string, service *pb.ServiceDescriptorProto) {\n\tserverType := servName + \"Server\"\n\tg.P(\"// Unimplemented\", serverType, \" can be embedded to have forward compatible implementations.\")\n\tg.P(\"type Unimplemented\", serverType, \" struct {\")\n\tg.P(\"}\")\n\tg.P()\n\t// Unimplemented<service_name>Server's concrete methods\n\tfor _, method := range service.Method {\n\t\tg.generateServerMethodConcrete(servName, method)\n\t}\n\tg.P()\n}\n\n// generateServerMethodConcrete returns unimplemented methods which ensure forward compatibility\nfunc (g *grpc) generateServerMethodConcrete(servName string, method *pb.MethodDescriptorProto) {\n\theader := g.generateServerSignatureWithParamNames(servName, method)\n\tg.P(\"func (*Unimplemented\", servName, \"Server) \", header, \" {\")\n\tvar nilArg string\n\tif !method.GetServerStreaming() && !method.GetClientStreaming() {\n\t\tnilArg = \"nil, \"\n\t}\n\tmethName := generator.CamelCase(method.GetName())\n\tstatusPkg := string(g.gen.AddImport(statusPkgPath))\n\tcodePkg := string(g.gen.AddImport(codePkgPath))\n\tg.P(\"return \", nilArg, statusPkg, `.Errorf(`, codePkg, `.Unimplemented, \"method `, methName, ` not implemented\")`)\n\tg.P(\"}\")\n}\n\n// generateClientSignature returns the client-side signature for a method.\nfunc (g *grpc) generateClientSignature(servName string, method *pb.MethodDescriptorProto) string {\n\torigMethName := method.GetName()\n\tmethName := generator.CamelCase(origMethName)\n\tif reservedClientName[methName] {\n\t\tmethName += \"_\"\n\t}\n\treqArg := \", in *\" + g.typeName(method.GetInputType())\n\tif method.GetClientStreaming() {\n\t\treqArg = \"\"\n\t}\n\trespName := \"*\" + g.typeName(method.GetOutputType())\n\tif method.GetServerStreaming() || method.GetClientStreaming() {\n\t\trespName = servName + \"_\" + generator.CamelCase(origMethName) + \"Client\"\n\t}\n\treturn fmt.Sprintf(\"%s(ctx %s.Context%s, opts ...%s.CallOption) (%s, error)\", methName, contextPkg, reqArg, grpcPkg, respName)\n}\n\nfunc (g *grpc) generateClientMethod(servName, fullServName, serviceDescVar string, method *pb.MethodDescriptorProto, descExpr string) {\n\tsname := fmt.Sprintf(\"/%s/%s\", fullServName, method.GetName())\n\tmethName := generator.CamelCase(method.GetName())\n\tinType := g.typeName(method.GetInputType())\n\toutType := g.typeName(method.GetOutputType())\n\n\tif method.GetOptions().GetDeprecated() {\n\t\tg.P(deprecationComment)\n\t}\n\tg.P(\"func (c *\", unexport(servName), \"Client) \", g.generateClientSignature(servName, method), \"{\")\n\tif !method.GetServerStreaming() && !method.GetClientStreaming() {\n\t\tg.P(\"out := new(\", outType, \")\")\n\t\t// TODO: Pass descExpr to Invoke.\n\t\tg.P(`err := c.cc.Invoke(ctx, \"`, sname, `\", in, out, opts...)`)\n\t\tg.P(\"if err != nil { return nil, err }\")\n\t\tg.P(\"return out, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t\treturn\n\t}\n\tstreamType := unexport(servName) + methName + \"Client\"\n\tg.P(\"stream, err := c.cc.NewStream(ctx, \", descExpr, `, \"`, sname, `\", opts...)`)\n\tg.P(\"if err != nil { return nil, err }\")\n\tg.P(\"x := &\", streamType, \"{stream}\")\n\tif !method.GetClientStreaming() {\n\t\tg.P(\"if err := x.ClientStream.SendMsg(in); err != nil { return nil, err }\")\n\t\tg.P(\"if err := x.ClientStream.CloseSend(); err != nil { return nil, err }\")\n\t}\n\tg.P(\"return x, nil\")\n\tg.P(\"}\")\n\tg.P()\n\n\tgenSend := method.GetClientStreaming()\n\tgenRecv := method.GetServerStreaming()\n\tgenCloseAndRecv := !method.GetServerStreaming()\n\n\t// Stream auxiliary types and methods.\n\tg.P(\"type \", servName, \"_\", methName, \"Client interface {\")\n\tif genSend {\n\t\tg.P(\"Send(*\", inType, \") error\")\n\t}\n\tif genRecv {\n\t\tg.P(\"Recv() (*\", outType, \", error)\")\n\t}\n\tif genCloseAndRecv {\n\t\tg.P(\"CloseAndRecv() (*\", outType, \", error)\")\n\t}\n\tg.P(grpcPkg, \".ClientStream\")\n\tg.P(\"}\")\n\tg.P()\n\n\tg.P(\"type \", streamType, \" struct {\")\n\tg.P(grpcPkg, \".ClientStream\")\n\tg.P(\"}\")\n\tg.P()\n\n\tif genSend {\n\t\tg.P(\"func (x *\", streamType, \") Send(m *\", inType, \") error {\")\n\t\tg.P(\"return x.ClientStream.SendMsg(m)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\tif genRecv {\n\t\tg.P(\"func (x *\", streamType, \") Recv() (*\", outType, \", error) {\")\n\t\tg.P(\"m := new(\", outType, \")\")\n\t\tg.P(\"if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }\")\n\t\tg.P(\"return m, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\tif genCloseAndRecv {\n\t\tg.P(\"func (x *\", streamType, \") CloseAndRecv() (*\", outType, \", error) {\")\n\t\tg.P(\"if err := x.ClientStream.CloseSend(); err != nil { return nil, err }\")\n\t\tg.P(\"m := new(\", outType, \")\")\n\t\tg.P(\"if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }\")\n\t\tg.P(\"return m, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n}\n\n// generateServerSignatureWithParamNames returns the server-side signature for a method with parameter names.\nfunc (g *grpc) generateServerSignatureWithParamNames(servName string, method *pb.MethodDescriptorProto) string {\n\torigMethName := method.GetName()\n\tmethName := generator.CamelCase(origMethName)\n\tif reservedClientName[methName] {\n\t\tmethName += \"_\"\n\t}\n\n\tvar reqArgs []string\n\tret := \"error\"\n\tif !method.GetServerStreaming() && !method.GetClientStreaming() {\n\t\treqArgs = append(reqArgs, \"ctx \"+contextPkg+\".Context\")\n\t\tret = \"(*\" + g.typeName(method.GetOutputType()) + \", error)\"\n\t}\n\tif !method.GetClientStreaming() {\n\t\treqArgs = append(reqArgs, \"req *\"+g.typeName(method.GetInputType()))\n\t}\n\tif method.GetServerStreaming() || method.GetClientStreaming() {\n\t\treqArgs = append(reqArgs, \"srv \"+servName+\"_\"+generator.CamelCase(origMethName)+\"Server\")\n\t}\n\n\treturn methName + \"(\" + strings.Join(reqArgs, \", \") + \") \" + ret\n}\n\n// generateServerSignature returns the server-side signature for a method.\nfunc (g *grpc) generateServerSignature(servName string, method *pb.MethodDescriptorProto) string {\n\torigMethName := method.GetName()\n\tmethName := generator.CamelCase(origMethName)\n\tif reservedClientName[methName] {\n\t\tmethName += \"_\"\n\t}\n\n\tvar reqArgs []string\n\tret := \"error\"\n\tif !method.GetServerStreaming() && !method.GetClientStreaming() {\n\t\treqArgs = append(reqArgs, contextPkg+\".Context\")\n\t\tret = \"(*\" + g.typeName(method.GetOutputType()) + \", error)\"\n\t}\n\tif !method.GetClientStreaming() {\n\t\treqArgs = append(reqArgs, \"*\"+g.typeName(method.GetInputType()))\n\t}\n\tif method.GetServerStreaming() || method.GetClientStreaming() {\n\t\treqArgs = append(reqArgs, servName+\"_\"+generator.CamelCase(origMethName)+\"Server\")\n\t}\n\n\treturn methName + \"(\" + strings.Join(reqArgs, \", \") + \") \" + ret\n}\n\nfunc (g *grpc) generateServerMethod(servName, fullServName string, method *pb.MethodDescriptorProto) string {\n\tmethName := generator.CamelCase(method.GetName())\n\thname := fmt.Sprintf(\"_%s_%s_Handler\", servName, methName)\n\tinType := g.typeName(method.GetInputType())\n\toutType := g.typeName(method.GetOutputType())\n\n\tif !method.GetServerStreaming() && !method.GetClientStreaming() {\n\t\tg.P(\"func \", hname, \"(srv interface{}, ctx \", contextPkg, \".Context, dec func(interface{}) error, interceptor \", grpcPkg, \".UnaryServerInterceptor) (interface{}, error) {\")\n\t\tg.P(\"in := new(\", inType, \")\")\n\t\tg.P(\"if err := dec(in); err != nil { return nil, err }\")\n\t\tg.P(\"if interceptor == nil { return srv.(\", servName, \"Server).\", methName, \"(ctx, in) }\")\n\t\tg.P(\"info := &\", grpcPkg, \".UnaryServerInfo{\")\n\t\tg.P(\"Server: srv,\")\n\t\tg.P(\"FullMethod: \", strconv.Quote(fmt.Sprintf(\"/%s/%s\", fullServName, methName)), \",\")\n\t\tg.P(\"}\")\n\t\tg.P(\"handler := func(ctx \", contextPkg, \".Context, req interface{}) (interface{}, error) {\")\n\t\tg.P(\"return srv.(\", servName, \"Server).\", methName, \"(ctx, req.(*\", inType, \"))\")\n\t\tg.P(\"}\")\n\t\tg.P(\"return interceptor(ctx, in, info, handler)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t\treturn hname\n\t}\n\tstreamType := unexport(servName) + methName + \"Server\"\n\tg.P(\"func \", hname, \"(srv interface{}, stream \", grpcPkg, \".ServerStream) error {\")\n\tif !method.GetClientStreaming() {\n\t\tg.P(\"m := new(\", inType, \")\")\n\t\tg.P(\"if err := stream.RecvMsg(m); err != nil { return err }\")\n\t\tg.P(\"return srv.(\", servName, \"Server).\", methName, \"(m, &\", streamType, \"{stream})\")\n\t} else {\n\t\tg.P(\"return srv.(\", servName, \"Server).\", methName, \"(&\", streamType, \"{stream})\")\n\t}\n\tg.P(\"}\")\n\tg.P()\n\n\tgenSend := method.GetServerStreaming()\n\tgenSendAndClose := !method.GetServerStreaming()\n\tgenRecv := method.GetClientStreaming()\n\n\t// Stream auxiliary types and methods.\n\tg.P(\"type \", servName, \"_\", methName, \"Server interface {\")\n\tif genSend {\n\t\tg.P(\"Send(*\", outType, \") error\")\n\t}\n\tif genSendAndClose {\n\t\tg.P(\"SendAndClose(*\", outType, \") error\")\n\t}\n\tif genRecv {\n\t\tg.P(\"Recv() (*\", inType, \", error)\")\n\t}\n\tg.P(grpcPkg, \".ServerStream\")\n\tg.P(\"}\")\n\tg.P()\n\n\tg.P(\"type \", streamType, \" struct {\")\n\tg.P(grpcPkg, \".ServerStream\")\n\tg.P(\"}\")\n\tg.P()\n\n\tif genSend {\n\t\tg.P(\"func (x *\", streamType, \") Send(m *\", outType, \") error {\")\n\t\tg.P(\"return x.ServerStream.SendMsg(m)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\tif genSendAndClose {\n\t\tg.P(\"func (x *\", streamType, \") SendAndClose(m *\", outType, \") error {\")\n\t\tg.P(\"return x.ServerStream.SendMsg(m)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\tif genRecv {\n\t\tg.P(\"func (x *\", streamType, \") Recv() (*\", inType, \", error) {\")\n\t\tg.P(\"m := new(\", inType, \")\")\n\t\tg.P(\"if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err }\")\n\t\tg.P(\"return m, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\n\treturn hname\n}\n"
  },
  {
    "path": "protoc-gen-go/main.go",
    "content": "// Copyright 2010 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// protoc-gen-go is a plugin for the Google protocol buffer compiler to generate\n// Go code. Install it by building this program and making it accessible within\n// your PATH with the name:\n//\n//\tprotoc-gen-go\n//\n// The 'go' suffix becomes part of the argument for the protocol compiler,\n// such that it can be invoked as:\n//\n//\tprotoc --go_out=paths=source_relative:. path/to/file.proto\n//\n// This generates Go bindings for the protocol buffer defined by file.proto.\n// With that input, the output will be written to:\n//\n//\tpath/to/file.pb.go\n//\n// See the README and documentation for protocol buffers to learn more:\n//\n//\thttps://developers.google.com/protocol-buffers/\npackage main\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/golang/protobuf/internal/gengogrpc\"\n\tgengo \"google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo\"\n\t\"google.golang.org/protobuf/compiler/protogen\"\n)\n\nfunc main() {\n\tvar (\n\t\tflags        flag.FlagSet\n\t\tplugins      = flags.String(\"plugins\", \"\", \"list of plugins to enable (supported values: grpc)\")\n\t\timportPrefix = flags.String(\"import_prefix\", \"\", \"prefix to prepend to import paths\")\n\t)\n\timportRewriteFunc := func(importPath protogen.GoImportPath) protogen.GoImportPath {\n\t\tswitch importPath {\n\t\tcase \"context\", \"fmt\", \"math\":\n\t\t\treturn importPath\n\t\t}\n\t\tif *importPrefix != \"\" {\n\t\t\treturn protogen.GoImportPath(*importPrefix) + importPath\n\t\t}\n\t\treturn importPath\n\t}\n\tprotogen.Options{\n\t\tParamFunc:         flags.Set,\n\t\tImportRewriteFunc: importRewriteFunc,\n\t}.Run(func(gen *protogen.Plugin) error {\n\t\tgrpc := false\n\t\tfor _, plugin := range strings.Split(*plugins, \",\") {\n\t\t\tswitch plugin {\n\t\t\tcase \"grpc\":\n\t\t\t\tgrpc = true\n\t\t\tcase \"\":\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"protoc-gen-go: unknown plugin %q\", plugin)\n\t\t\t}\n\t\t}\n\t\tfor _, f := range gen.Files {\n\t\t\tif !f.Generate {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg := gengo.GenerateFile(gen, f)\n\t\t\tif grpc {\n\t\t\t\tgengogrpc.GenerateFileContent(gen, f, g)\n\t\t\t}\n\t\t}\n\t\tgen.SupportedFeatures = gengo.SupportedFeatures\n\t\treturn nil\n\t})\n}\n"
  },
  {
    "path": "protoc-gen-go/plugin/plugin.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto\n\npackage plugin_go\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\tpluginpb \"google.golang.org/protobuf/types/pluginpb\"\n\treflect \"reflect\"\n)\n\n// Symbols defined in public import of google/protobuf/compiler/plugin.proto.\n\ntype CodeGeneratorResponse_Feature = pluginpb.CodeGeneratorResponse_Feature\n\nconst CodeGeneratorResponse_FEATURE_NONE = pluginpb.CodeGeneratorResponse_FEATURE_NONE\nconst CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL = pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL\nconst CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS = pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS\n\nvar CodeGeneratorResponse_Feature_name = pluginpb.CodeGeneratorResponse_Feature_name\nvar CodeGeneratorResponse_Feature_value = pluginpb.CodeGeneratorResponse_Feature_value\n\ntype Version = pluginpb.Version\ntype CodeGeneratorRequest = pluginpb.CodeGeneratorRequest\ntype CodeGeneratorResponse = pluginpb.CodeGeneratorResponse\ntype CodeGeneratorResponse_File = pluginpb.CodeGeneratorResponse_File\n\nvar File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto protoreflect.FileDescriptor\n\nvar file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc = []byte{\n\t0x0a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c,\n\t0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f,\n\t0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69,\n\t0x6e, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x25,\n\t0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f,\n\t0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,\n\t0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67,\n\t0x6f, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x3b, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f,\n\t0x67, 0x6f, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32,\n}\n\nvar file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = []interface{}{}\nvar file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = []int32{\n\t0, // [0:0] is the sub-list for method output_type\n\t0, // [0:0] is the sub-list for method input_type\n\t0, // [0:0] is the sub-list for extension type_name\n\t0, // [0:0] is the sub-list for extension extendee\n\t0, // [0:0] is the sub-list for field type_name\n}\n\nfunc init() { file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init() }\nfunc file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_init() {\n\tif File_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto != nil {\n\t\treturn\n\t}\n\ttype x struct{}\n\tout := protoimpl.TypeBuilder{\n\t\tFile: protoimpl.DescBuilder{\n\t\t\tGoPackagePath: reflect.TypeOf(x{}).PkgPath(),\n\t\t\tRawDescriptor: file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes,\n\t\tDependencyIndexes: file_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs,\n\t}.Build()\n\tFile_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto = out.File\n\tfile_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_rawDesc = nil\n\tfile_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_goTypes = nil\n\tfile_github_com_golang_protobuf_protoc_gen_go_plugin_plugin_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "ptypes/any/any.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: github.com/golang/protobuf/ptypes/any/any.proto\n\npackage any\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\tanypb \"google.golang.org/protobuf/types/known/anypb\"\n\treflect \"reflect\"\n)\n\n// Symbols defined in public import of google/protobuf/any.proto.\n\ntype Any = anypb.Any\n\nvar File_github_com_golang_protobuf_ptypes_any_any_proto protoreflect.FileDescriptor\n\nvar file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = []byte{\n\t0x0a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c,\n\t0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79,\n\t0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74,\n\t0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,\n\t0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x2b, 0x5a, 0x29,\n\t0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e,\n\t0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65,\n\t0x73, 0x2f, 0x61, 0x6e, 0x79, 0x3b, 0x61, 0x6e, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f,\n\t0x74, 0x6f, 0x33,\n}\n\nvar file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = []interface{}{}\nvar file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{\n\t0, // [0:0] is the sub-list for method output_type\n\t0, // [0:0] is the sub-list for method input_type\n\t0, // [0:0] is the sub-list for extension type_name\n\t0, // [0:0] is the sub-list for extension extendee\n\t0, // [0:0] is the sub-list for field type_name\n}\n\nfunc init() { file_github_com_golang_protobuf_ptypes_any_any_proto_init() }\nfunc file_github_com_golang_protobuf_ptypes_any_any_proto_init() {\n\tif File_github_com_golang_protobuf_ptypes_any_any_proto != nil {\n\t\treturn\n\t}\n\ttype x struct{}\n\tout := protoimpl.TypeBuilder{\n\t\tFile: protoimpl.DescBuilder{\n\t\t\tGoPackagePath: reflect.TypeOf(x{}).PkgPath(),\n\t\t\tRawDescriptor: file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes,\n\t\tDependencyIndexes: file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs,\n\t}.Build()\n\tFile_github_com_golang_protobuf_ptypes_any_any_proto = out.File\n\tfile_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = nil\n\tfile_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = nil\n\tfile_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "ptypes/any.go",
    "content": "// Copyright 2016 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage ptypes\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/golang/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n\n\tanypb \"github.com/golang/protobuf/ptypes/any\"\n)\n\nconst urlPrefix = \"type.googleapis.com/\"\n\n// AnyMessageName returns the message name contained in an anypb.Any message.\n// Most type assertions should use the Is function instead.\n//\n// Deprecated: Call the any.MessageName method instead.\nfunc AnyMessageName(any *anypb.Any) (string, error) {\n\tname, err := anyMessageName(any)\n\treturn string(name), err\n}\nfunc anyMessageName(any *anypb.Any) (protoreflect.FullName, error) {\n\tif any == nil {\n\t\treturn \"\", fmt.Errorf(\"message is nil\")\n\t}\n\tname := protoreflect.FullName(any.TypeUrl)\n\tif i := strings.LastIndex(any.TypeUrl, \"/\"); i >= 0 {\n\t\tname = name[i+len(\"/\"):]\n\t}\n\tif !name.IsValid() {\n\t\treturn \"\", fmt.Errorf(\"message type url %q is invalid\", any.TypeUrl)\n\t}\n\treturn name, nil\n}\n\n// MarshalAny marshals the given message m into an anypb.Any message.\n//\n// Deprecated: Call the anypb.New function instead.\nfunc MarshalAny(m proto.Message) (*anypb.Any, error) {\n\tswitch dm := m.(type) {\n\tcase DynamicAny:\n\t\tm = dm.Message\n\tcase *DynamicAny:\n\t\tif dm == nil {\n\t\t\treturn nil, proto.ErrNil\n\t\t}\n\t\tm = dm.Message\n\t}\n\tb, err := proto.Marshal(m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &anypb.Any{TypeUrl: urlPrefix + proto.MessageName(m), Value: b}, nil\n}\n\n// Empty returns a new message of the type specified in an anypb.Any message.\n// It returns protoregistry.NotFound if the corresponding message type could not\n// be resolved in the global registry.\n//\n// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead\n// to resolve the message name and create a new instance of it.\nfunc Empty(any *anypb.Any) (proto.Message, error) {\n\tname, err := anyMessageName(any)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmt, err := protoregistry.GlobalTypes.FindMessageByName(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn proto.MessageV1(mt.New().Interface()), nil\n}\n\n// UnmarshalAny unmarshals the encoded value contained in the anypb.Any message\n// into the provided message m. It returns an error if the target message\n// does not match the type in the Any message or if an unmarshal error occurs.\n//\n// The target message m may be a *DynamicAny message. If the underlying message\n// type could not be resolved, then this returns protoregistry.NotFound.\n//\n// Deprecated: Call the any.UnmarshalTo method instead.\nfunc UnmarshalAny(any *anypb.Any, m proto.Message) error {\n\tif dm, ok := m.(*DynamicAny); ok {\n\t\tif dm.Message == nil {\n\t\t\tvar err error\n\t\t\tdm.Message, err = Empty(any)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tm = dm.Message\n\t}\n\n\tanyName, err := AnyMessageName(any)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmsgName := proto.MessageName(m)\n\tif anyName != msgName {\n\t\treturn fmt.Errorf(\"mismatched message type: got %q want %q\", anyName, msgName)\n\t}\n\treturn proto.Unmarshal(any.Value, m)\n}\n\n// Is reports whether the Any message contains a message of the specified type.\n//\n// Deprecated: Call the any.MessageIs method instead.\nfunc Is(any *anypb.Any, m proto.Message) bool {\n\tif any == nil || m == nil {\n\t\treturn false\n\t}\n\tname := proto.MessageName(m)\n\tif !strings.HasSuffix(any.TypeUrl, name) {\n\t\treturn false\n\t}\n\treturn len(any.TypeUrl) == len(name) || any.TypeUrl[len(any.TypeUrl)-len(name)-1] == '/'\n}\n\n// DynamicAny is a value that can be passed to UnmarshalAny to automatically\n// allocate a proto.Message for the type specified in an anypb.Any message.\n// The allocated message is stored in the embedded proto.Message.\n//\n// Example:\n//\n//\tvar x ptypes.DynamicAny\n//\tif err := ptypes.UnmarshalAny(a, &x); err != nil { ... }\n//\tfmt.Printf(\"unmarshaled message: %v\", x.Message)\n//\n// Deprecated: Use the any.UnmarshalNew method instead to unmarshal\n// the any message contents into a new instance of the underlying message.\ntype DynamicAny struct{ proto.Message }\n\nfunc (m DynamicAny) String() string {\n\tif m.Message == nil {\n\t\treturn \"<nil>\"\n\t}\n\treturn m.Message.String()\n}\nfunc (m DynamicAny) Reset() {\n\tif m.Message == nil {\n\t\treturn\n\t}\n\tm.Message.Reset()\n}\nfunc (m DynamicAny) ProtoMessage() {\n\treturn\n}\nfunc (m DynamicAny) ProtoReflect() protoreflect.Message {\n\tif m.Message == nil {\n\t\treturn nil\n\t}\n\treturn dynamicAny{proto.MessageReflect(m.Message)}\n}\n\ntype dynamicAny struct{ protoreflect.Message }\n\nfunc (m dynamicAny) Type() protoreflect.MessageType {\n\treturn dynamicAnyType{m.Message.Type()}\n}\nfunc (m dynamicAny) New() protoreflect.Message {\n\treturn dynamicAnyType{m.Message.Type()}.New()\n}\nfunc (m dynamicAny) Interface() protoreflect.ProtoMessage {\n\treturn DynamicAny{proto.MessageV1(m.Message.Interface())}\n}\n\ntype dynamicAnyType struct{ protoreflect.MessageType }\n\nfunc (t dynamicAnyType) New() protoreflect.Message {\n\treturn dynamicAny{t.MessageType.New()}\n}\nfunc (t dynamicAnyType) Zero() protoreflect.Message {\n\treturn dynamicAny{t.MessageType.Zero()}\n}\n"
  },
  {
    "path": "ptypes/any_test.go",
    "content": "// Copyright 2016 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage ptypes\n\nimport (\n\t\"reflect\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\n\tdescriptorpb \"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n\tanypb \"github.com/golang/protobuf/ptypes/any\"\n)\n\nfunc TestMarshalUnmarshal(t *testing.T) {\n\torig := &anypb.Any{Value: []byte(\"test\")}\n\n\tpacked, err := MarshalAny(orig)\n\tif err != nil {\n\t\tt.Errorf(\"MarshalAny(%+v): got: _, %v exp: _, nil\", orig, err)\n\t}\n\n\tunpacked := &anypb.Any{}\n\terr = UnmarshalAny(packed, unpacked)\n\tif err != nil || !proto.Equal(unpacked, orig) {\n\t\tt.Errorf(\"got: %v, %+v; want nil, %+v\", err, unpacked, orig)\n\t}\n}\n\nfunc TestIs(t *testing.T) {\n\ta, err := MarshalAny(&descriptorpb.FileDescriptorProto{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif Is(a, &descriptorpb.DescriptorProto{}) {\n\t\t// No spurious match for message names of different length.\n\t\tt.Error(\"FileDescriptorProto is not a DescriptorProto, but Is says it is\")\n\t}\n\tif Is(a, &descriptorpb.EnumDescriptorProto{}) {\n\t\t// No spurious match for message names of equal length.\n\t\tt.Error(\"FileDescriptorProto is not an EnumDescriptorProto, but Is says it is\")\n\t}\n\tif !Is(a, &descriptorpb.FileDescriptorProto{}) {\n\t\tt.Error(\"FileDescriptorProto is indeed a FileDescriptorProto, but Is says it is not\")\n\t}\n}\n\nfunc TestIsDifferentUrlPrefixes(t *testing.T) {\n\tm := &descriptorpb.FileDescriptorProto{}\n\ta := &anypb.Any{TypeUrl: \"foo/bar/\" + proto.MessageName(m)}\n\tif !Is(a, m) {\n\t\tt.Errorf(\"message with type url %q didn't satisfy Is for type %q\", a.TypeUrl, proto.MessageName(m))\n\t}\n}\n\nfunc TestIsCornerCases(t *testing.T) {\n\tm := &descriptorpb.FileDescriptorProto{}\n\tif Is(nil, m) {\n\t\tt.Errorf(\"message with nil type url incorrectly claimed to be %q\", proto.MessageName(m))\n\t}\n\tnoPrefix := &anypb.Any{TypeUrl: proto.MessageName(m)}\n\tif !Is(noPrefix, m) {\n\t\tt.Errorf(\"message with type url %q didn't satisfy Is for type %q\", noPrefix.TypeUrl, proto.MessageName(m))\n\t}\n\tshortPrefix := &anypb.Any{TypeUrl: \"/\" + proto.MessageName(m)}\n\tif !Is(shortPrefix, m) {\n\t\tt.Errorf(\"message with type url %q didn't satisfy Is for type %q\", shortPrefix.TypeUrl, proto.MessageName(m))\n\t}\n}\n\nfunc TestUnmarshalDynamic(t *testing.T) {\n\twant := &descriptorpb.FileDescriptorProto{Name: proto.String(\"foo\")}\n\ta, err := MarshalAny(want)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tvar got DynamicAny\n\tif err := UnmarshalAny(a, &got); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !proto.Equal(got.Message, want) {\n\t\tt.Errorf(\"invalid result from UnmarshalAny, got %q want %q\", got.Message, want)\n\t}\n}\n\nfunc TestEmpty(t *testing.T) {\n\twant := &descriptorpb.FileDescriptorProto{}\n\ta, err := MarshalAny(want)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tgot, err := Empty(a)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"unequal empty message, got %q, want %q\", got, want)\n\t}\n\n\t// that's a valid type_url for a message which shouldn't be linked into this\n\t// test binary. We want an error.\n\ta.TypeUrl = \"type.googleapis.com/google.protobuf.FieldMask\"\n\tif _, err := Empty(a); err == nil {\n\t\tt.Errorf(\"got no error for an attempt to create a message of type %q, which shouldn't be linked in\", a.TypeUrl)\n\t}\n}\n\nfunc TestEmptyCornerCases(t *testing.T) {\n\t_, err := Empty(nil)\n\tif err == nil {\n\t\tt.Error(\"expected Empty for nil to fail\")\n\t}\n\twant := &descriptorpb.FileDescriptorProto{}\n\tnoPrefix := &anypb.Any{TypeUrl: proto.MessageName(want)}\n\tgot, err := Empty(noPrefix)\n\tif err != nil {\n\t\tt.Errorf(\"Empty for any type %q failed: %s\", noPrefix.TypeUrl, err)\n\t}\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"Empty for any type %q differs, got %q, want %q\", noPrefix.TypeUrl, got, want)\n\t}\n\tshortPrefix := &anypb.Any{TypeUrl: \"/\" + proto.MessageName(want)}\n\tgot, err = Empty(shortPrefix)\n\tif err != nil {\n\t\tt.Errorf(\"Empty for any type %q failed: %s\", shortPrefix.TypeUrl, err)\n\t}\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"Empty for any type %q differs, got %q, want %q\", shortPrefix.TypeUrl, got, want)\n\t}\n}\n\nfunc TestAnyReflect(t *testing.T) {\n\twant := &descriptorpb.FileDescriptorProto{Name: proto.String(\"foo\")}\n\ta, err := MarshalAny(want)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tvar got DynamicAny\n\tif err := UnmarshalAny(a, &got); err != nil {\n\t\tt.Fatal(err)\n\t}\n\twantName := want.ProtoReflect().Descriptor().FullName()\n\tgotName := got.ProtoReflect().Descriptor().FullName()\n\tif gotName != wantName {\n\t\tt.Errorf(\"name mismatch: got %v, want %v\", gotName, wantName)\n\t}\n\twantType := reflect.TypeOf(got)\n\tgotType := reflect.TypeOf(got.ProtoReflect().Interface())\n\tif gotType != wantType {\n\t\tt.Errorf(\"ProtoReflect().Interface() round-trip type mismatch: got %v, want %v\", gotType, wantType)\n\t}\n\tgotType = reflect.TypeOf(got.ProtoReflect().New().Interface())\n\tif gotType != wantType {\n\t\tt.Errorf(\"ProtoReflect().New().Interface() type mismatch: got %v, want %v\", gotType, wantType)\n\t}\n\tgotType = reflect.TypeOf(got.ProtoReflect().Type().New().Interface())\n\tif gotType != wantType {\n\t\tt.Errorf(\"ProtoReflect().Type().New().Interface() type mismatch: got %v, want %v\", gotType, wantType)\n\t}\n\tgotType = reflect.TypeOf(got.ProtoReflect().Type().Zero().Interface())\n\tif gotType != wantType {\n\t\tt.Errorf(\"ProtoReflect().Type().Zero().Interface() type mismatch: got %v, want %v\", gotType, wantType)\n\t}\n}\n"
  },
  {
    "path": "ptypes/doc.go",
    "content": "// Copyright 2016 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package ptypes provides functionality for interacting with well-known types.\n//\n// Deprecated: Well-known types have specialized functionality directly\n// injected into the generated packages for each message type.\n// See the deprecation notice for each function for the suggested alternative.\npackage ptypes\n"
  },
  {
    "path": "ptypes/duration/duration.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: github.com/golang/protobuf/ptypes/duration/duration.proto\n\npackage duration\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\tdurationpb \"google.golang.org/protobuf/types/known/durationpb\"\n\treflect \"reflect\"\n)\n\n// Symbols defined in public import of google/protobuf/duration.proto.\n\ntype Duration = durationpb.Duration\n\nvar File_github_com_golang_protobuf_ptypes_duration_duration_proto protoreflect.FileDescriptor\n\nvar file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = []byte{\n\t0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c,\n\t0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79,\n\t0x70, 0x65, 0x73, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x64, 0x75, 0x72,\n\t0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f,\n\t0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72,\n\t0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x35, 0x5a, 0x33, 0x67,\n\t0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67,\n\t0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73,\n\t0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69,\n\t0x6f, 0x6e, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = []interface{}{}\nvar file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = []int32{\n\t0, // [0:0] is the sub-list for method output_type\n\t0, // [0:0] is the sub-list for method input_type\n\t0, // [0:0] is the sub-list for extension type_name\n\t0, // [0:0] is the sub-list for extension extendee\n\t0, // [0:0] is the sub-list for field type_name\n}\n\nfunc init() { file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() }\nfunc file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() {\n\tif File_github_com_golang_protobuf_ptypes_duration_duration_proto != nil {\n\t\treturn\n\t}\n\ttype x struct{}\n\tout := protoimpl.TypeBuilder{\n\t\tFile: protoimpl.DescBuilder{\n\t\t\tGoPackagePath: reflect.TypeOf(x{}).PkgPath(),\n\t\t\tRawDescriptor: file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes,\n\t\tDependencyIndexes: file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs,\n\t}.Build()\n\tFile_github_com_golang_protobuf_ptypes_duration_duration_proto = out.File\n\tfile_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = nil\n\tfile_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = nil\n\tfile_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "ptypes/duration.go",
    "content": "// Copyright 2016 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage ptypes\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"time\"\n\n\tdurationpb \"github.com/golang/protobuf/ptypes/duration\"\n)\n\n// Range of google.protobuf.Duration as specified in duration.proto.\n// This is about 10,000 years in seconds.\nconst (\n\tmaxSeconds = int64(10000 * 365.25 * 24 * 60 * 60)\n\tminSeconds = -maxSeconds\n)\n\n// Duration converts a durationpb.Duration to a time.Duration.\n// Duration returns an error if dur is invalid or overflows a time.Duration.\n//\n// Deprecated: Call the dur.AsDuration and dur.CheckValid methods instead.\nfunc Duration(dur *durationpb.Duration) (time.Duration, error) {\n\tif err := validateDuration(dur); err != nil {\n\t\treturn 0, err\n\t}\n\td := time.Duration(dur.Seconds) * time.Second\n\tif int64(d/time.Second) != dur.Seconds {\n\t\treturn 0, fmt.Errorf(\"duration: %v is out of range for time.Duration\", dur)\n\t}\n\tif dur.Nanos != 0 {\n\t\td += time.Duration(dur.Nanos) * time.Nanosecond\n\t\tif (d < 0) != (dur.Nanos < 0) {\n\t\t\treturn 0, fmt.Errorf(\"duration: %v is out of range for time.Duration\", dur)\n\t\t}\n\t}\n\treturn d, nil\n}\n\n// DurationProto converts a time.Duration to a durationpb.Duration.\n//\n// Deprecated: Call the durationpb.New function instead.\nfunc DurationProto(d time.Duration) *durationpb.Duration {\n\tnanos := d.Nanoseconds()\n\tsecs := nanos / 1e9\n\tnanos -= secs * 1e9\n\treturn &durationpb.Duration{\n\t\tSeconds: int64(secs),\n\t\tNanos:   int32(nanos),\n\t}\n}\n\n// validateDuration determines whether the durationpb.Duration is valid\n// according to the definition in google/protobuf/duration.proto.\n// A valid durpb.Duration may still be too large to fit into a time.Duration\n// Note that the range of durationpb.Duration is about 10,000 years,\n// while the range of time.Duration is about 290 years.\nfunc validateDuration(dur *durationpb.Duration) error {\n\tif dur == nil {\n\t\treturn errors.New(\"duration: nil Duration\")\n\t}\n\tif dur.Seconds < minSeconds || dur.Seconds > maxSeconds {\n\t\treturn fmt.Errorf(\"duration: %v: seconds out of range\", dur)\n\t}\n\tif dur.Nanos <= -1e9 || dur.Nanos >= 1e9 {\n\t\treturn fmt.Errorf(\"duration: %v: nanos out of range\", dur)\n\t}\n\t// Seconds and Nanos must have the same sign, unless d.Nanos is zero.\n\tif (dur.Seconds < 0 && dur.Nanos > 0) || (dur.Seconds > 0 && dur.Nanos < 0) {\n\t\treturn fmt.Errorf(\"duration: %v: seconds and nanos have different signs\", dur)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "ptypes/duration_test.go",
    "content": "// Copyright 2016 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage ptypes\n\nimport (\n\t\"math\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/golang/protobuf/proto\"\n\n\tdurpb \"github.com/golang/protobuf/ptypes/duration\"\n)\n\nconst (\n\tminGoSeconds = math.MinInt64 / int64(1e9)\n\tmaxGoSeconds = math.MaxInt64 / int64(1e9)\n)\n\nvar durationTests = []struct {\n\tproto   *durpb.Duration\n\tisValid bool\n\tinRange bool\n\tdur     time.Duration\n}{\n\t// The zero duration.\n\t{&durpb.Duration{Seconds: 0, Nanos: 0}, true, true, 0},\n\t// Some ordinary non-zero durations.\n\t{&durpb.Duration{Seconds: 100, Nanos: 0}, true, true, 100 * time.Second},\n\t{&durpb.Duration{Seconds: -100, Nanos: 0}, true, true, -100 * time.Second},\n\t{&durpb.Duration{Seconds: 100, Nanos: 987}, true, true, 100*time.Second + 987},\n\t{&durpb.Duration{Seconds: -100, Nanos: -987}, true, true, -(100*time.Second + 987)},\n\t// The largest duration representable in Go.\n\t{&durpb.Duration{Seconds: maxGoSeconds, Nanos: int32(math.MaxInt64 - 1e9*maxGoSeconds)}, true, true, math.MaxInt64},\n\t// The smallest duration representable in Go.\n\t{&durpb.Duration{Seconds: minGoSeconds, Nanos: int32(math.MinInt64 - 1e9*minGoSeconds)}, true, true, math.MinInt64},\n\t{nil, false, false, 0},\n\t{&durpb.Duration{Seconds: -100, Nanos: 987}, false, false, 0},\n\t{&durpb.Duration{Seconds: 100, Nanos: -987}, false, false, 0},\n\t{&durpb.Duration{Seconds: math.MinInt64, Nanos: 0}, false, false, 0},\n\t{&durpb.Duration{Seconds: math.MaxInt64, Nanos: 0}, false, false, 0},\n\t// The largest valid duration.\n\t{&durpb.Duration{Seconds: maxSeconds, Nanos: 1e9 - 1}, true, false, 0},\n\t// The smallest valid duration.\n\t{&durpb.Duration{Seconds: minSeconds, Nanos: -(1e9 - 1)}, true, false, 0},\n\t// The smallest invalid duration above the valid range.\n\t{&durpb.Duration{Seconds: maxSeconds + 1, Nanos: 0}, false, false, 0},\n\t// The largest invalid duration below the valid range.\n\t{&durpb.Duration{Seconds: minSeconds - 1, Nanos: -(1e9 - 1)}, false, false, 0},\n\t// One nanosecond past the largest duration representable in Go.\n\t{&durpb.Duration{Seconds: maxGoSeconds, Nanos: int32(math.MaxInt64-1e9*maxGoSeconds) + 1}, true, false, 0},\n\t// One nanosecond past the smallest duration representable in Go.\n\t{&durpb.Duration{Seconds: minGoSeconds, Nanos: int32(math.MinInt64-1e9*minGoSeconds) - 1}, true, false, 0},\n\t// One second past the largest duration representable in Go.\n\t{&durpb.Duration{Seconds: maxGoSeconds + 1, Nanos: int32(math.MaxInt64 - 1e9*maxGoSeconds)}, true, false, 0},\n\t// One second past the smallest duration representable in Go.\n\t{&durpb.Duration{Seconds: minGoSeconds - 1, Nanos: int32(math.MinInt64 - 1e9*minGoSeconds)}, true, false, 0},\n}\n\nfunc TestValidateDuration(t *testing.T) {\n\tfor _, test := range durationTests {\n\t\terr := validateDuration(test.proto)\n\t\tgotValid := (err == nil)\n\t\tif gotValid != test.isValid {\n\t\t\tt.Errorf(\"validateDuration(%v) = %t, want %t\", test.proto, gotValid, test.isValid)\n\t\t}\n\t}\n}\n\nfunc TestDuration(t *testing.T) {\n\tfor _, test := range durationTests {\n\t\tgot, err := Duration(test.proto)\n\t\tgotOK := (err == nil)\n\t\twantOK := test.isValid && test.inRange\n\t\tif gotOK != wantOK {\n\t\t\tt.Errorf(\"Duration(%v) ok = %t, want %t\", test.proto, gotOK, wantOK)\n\t\t}\n\t\tif err == nil && got != test.dur {\n\t\t\tt.Errorf(\"Duration(%v) = %v, want %v\", test.proto, got, test.dur)\n\t\t}\n\t}\n}\n\nfunc TestDurationProto(t *testing.T) {\n\tfor _, test := range durationTests {\n\t\tif test.isValid && test.inRange {\n\t\t\tgot := DurationProto(test.dur)\n\t\t\tif !proto.Equal(got, test.proto) {\n\t\t\t\tt.Errorf(\"DurationProto(%v) = %v, want %v\", test.dur, got, test.proto)\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "ptypes/empty/empty.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: github.com/golang/protobuf/ptypes/empty/empty.proto\n\npackage empty\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\temptypb \"google.golang.org/protobuf/types/known/emptypb\"\n\treflect \"reflect\"\n)\n\n// Symbols defined in public import of google/protobuf/empty.proto.\n\ntype Empty = emptypb.Empty\n\nvar File_github_com_golang_protobuf_ptypes_empty_empty_proto protoreflect.FileDescriptor\n\nvar file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc = []byte{\n\t0x0a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c,\n\t0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79,\n\t0x70, 0x65, 0x73, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f,\n\t0x74, 0x6f, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,\n\t0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,\n\t0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x3b, 0x65, 0x6d,\n\t0x70, 0x74, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar file_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = []interface{}{}\nvar file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = []int32{\n\t0, // [0:0] is the sub-list for method output_type\n\t0, // [0:0] is the sub-list for method input_type\n\t0, // [0:0] is the sub-list for extension type_name\n\t0, // [0:0] is the sub-list for extension extendee\n\t0, // [0:0] is the sub-list for field type_name\n}\n\nfunc init() { file_github_com_golang_protobuf_ptypes_empty_empty_proto_init() }\nfunc file_github_com_golang_protobuf_ptypes_empty_empty_proto_init() {\n\tif File_github_com_golang_protobuf_ptypes_empty_empty_proto != nil {\n\t\treturn\n\t}\n\ttype x struct{}\n\tout := protoimpl.TypeBuilder{\n\t\tFile: protoimpl.DescBuilder{\n\t\t\tGoPackagePath: reflect.TypeOf(x{}).PkgPath(),\n\t\t\tRawDescriptor: file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes,\n\t\tDependencyIndexes: file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs,\n\t}.Build()\n\tFile_github_com_golang_protobuf_ptypes_empty_empty_proto = out.File\n\tfile_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc = nil\n\tfile_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = nil\n\tfile_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "ptypes/struct/struct.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: github.com/golang/protobuf/ptypes/struct/struct.proto\n\npackage structpb\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\tstructpb \"google.golang.org/protobuf/types/known/structpb\"\n\treflect \"reflect\"\n)\n\n// Symbols defined in public import of google/protobuf/struct.proto.\n\ntype NullValue = structpb.NullValue\n\nconst NullValue_NULL_VALUE = structpb.NullValue_NULL_VALUE\n\nvar NullValue_name = structpb.NullValue_name\nvar NullValue_value = structpb.NullValue_value\n\ntype Struct = structpb.Struct\ntype Value = structpb.Value\ntype Value_NullValue = structpb.Value_NullValue\ntype Value_NumberValue = structpb.Value_NumberValue\ntype Value_StringValue = structpb.Value_StringValue\ntype Value_BoolValue = structpb.Value_BoolValue\ntype Value_StructValue = structpb.Value_StructValue\ntype Value_ListValue = structpb.Value_ListValue\ntype ListValue = structpb.ListValue\n\nvar File_github_com_golang_protobuf_ptypes_struct_struct_proto protoreflect.FileDescriptor\n\nvar file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc = []byte{\n\t0x0a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c,\n\t0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79,\n\t0x70, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63,\n\t0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,\n\t0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63,\n\t0x74, 0x3b, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x70, 0x62, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar file_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = []interface{}{}\nvar file_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = []int32{\n\t0, // [0:0] is the sub-list for method output_type\n\t0, // [0:0] is the sub-list for method input_type\n\t0, // [0:0] is the sub-list for extension type_name\n\t0, // [0:0] is the sub-list for extension extendee\n\t0, // [0:0] is the sub-list for field type_name\n}\n\nfunc init() { file_github_com_golang_protobuf_ptypes_struct_struct_proto_init() }\nfunc file_github_com_golang_protobuf_ptypes_struct_struct_proto_init() {\n\tif File_github_com_golang_protobuf_ptypes_struct_struct_proto != nil {\n\t\treturn\n\t}\n\ttype x struct{}\n\tout := protoimpl.TypeBuilder{\n\t\tFile: protoimpl.DescBuilder{\n\t\t\tGoPackagePath: reflect.TypeOf(x{}).PkgPath(),\n\t\t\tRawDescriptor: file_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes,\n\t\tDependencyIndexes: file_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs,\n\t}.Build()\n\tFile_github_com_golang_protobuf_ptypes_struct_struct_proto = out.File\n\tfile_github_com_golang_protobuf_ptypes_struct_struct_proto_rawDesc = nil\n\tfile_github_com_golang_protobuf_ptypes_struct_struct_proto_goTypes = nil\n\tfile_github_com_golang_protobuf_ptypes_struct_struct_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "ptypes/timestamp/timestamp.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: github.com/golang/protobuf/ptypes/timestamp/timestamp.proto\n\npackage timestamp\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\ttimestamppb \"google.golang.org/protobuf/types/known/timestamppb\"\n\treflect \"reflect\"\n)\n\n// Symbols defined in public import of google/protobuf/timestamp.proto.\n\ntype Timestamp = timestamppb.Timestamp\n\nvar File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto protoreflect.FileDescriptor\n\nvar file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = []byte{\n\t0x0a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c,\n\t0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79,\n\t0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2f, 0x74, 0x69,\n\t0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67,\n\t0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74,\n\t0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x37,\n\t0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c,\n\t0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79,\n\t0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x3b, 0x74, 0x69,\n\t0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x33,\n}\n\nvar file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = []interface{}{}\nvar file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = []int32{\n\t0, // [0:0] is the sub-list for method output_type\n\t0, // [0:0] is the sub-list for method input_type\n\t0, // [0:0] is the sub-list for extension type_name\n\t0, // [0:0] is the sub-list for extension extendee\n\t0, // [0:0] is the sub-list for field type_name\n}\n\nfunc init() { file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() }\nfunc file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() {\n\tif File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto != nil {\n\t\treturn\n\t}\n\ttype x struct{}\n\tout := protoimpl.TypeBuilder{\n\t\tFile: protoimpl.DescBuilder{\n\t\t\tGoPackagePath: reflect.TypeOf(x{}).PkgPath(),\n\t\t\tRawDescriptor: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes,\n\t\tDependencyIndexes: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs,\n\t}.Build()\n\tFile_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto = out.File\n\tfile_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = nil\n\tfile_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = nil\n\tfile_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "ptypes/timestamp.go",
    "content": "// Copyright 2016 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage ptypes\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"time\"\n\n\ttimestamppb \"github.com/golang/protobuf/ptypes/timestamp\"\n)\n\n// Range of google.protobuf.Duration as specified in timestamp.proto.\nconst (\n\t// Seconds field of the earliest valid Timestamp.\n\t// This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix().\n\tminValidSeconds = -62135596800\n\t// Seconds field just after the latest valid Timestamp.\n\t// This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix().\n\tmaxValidSeconds = 253402300800\n)\n\n// Timestamp converts a timestamppb.Timestamp to a time.Time.\n// It returns an error if the argument is invalid.\n//\n// Unlike most Go functions, if Timestamp returns an error, the first return\n// value is not the zero time.Time. Instead, it is the value obtained from the\n// time.Unix function when passed the contents of the Timestamp, in the UTC\n// locale. This may or may not be a meaningful time; many invalid Timestamps\n// do map to valid time.Times.\n//\n// A nil Timestamp returns an error. The first return value in that case is\n// undefined.\n//\n// Deprecated: Call the ts.AsTime and ts.CheckValid methods instead.\nfunc Timestamp(ts *timestamppb.Timestamp) (time.Time, error) {\n\t// Don't return the zero value on error, because corresponds to a valid\n\t// timestamp. Instead return whatever time.Unix gives us.\n\tvar t time.Time\n\tif ts == nil {\n\t\tt = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp\n\t} else {\n\t\tt = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC()\n\t}\n\treturn t, validateTimestamp(ts)\n}\n\n// TimestampNow returns a google.protobuf.Timestamp for the current time.\n//\n// Deprecated: Call the timestamppb.Now function instead.\nfunc TimestampNow() *timestamppb.Timestamp {\n\tts, err := TimestampProto(time.Now())\n\tif err != nil {\n\t\tpanic(\"ptypes: time.Now() out of Timestamp range\")\n\t}\n\treturn ts\n}\n\n// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto.\n// It returns an error if the resulting Timestamp is invalid.\n//\n// Deprecated: Call the timestamppb.New function instead.\nfunc TimestampProto(t time.Time) (*timestamppb.Timestamp, error) {\n\tts := &timestamppb.Timestamp{\n\t\tSeconds: t.Unix(),\n\t\tNanos:   int32(t.Nanosecond()),\n\t}\n\tif err := validateTimestamp(ts); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ts, nil\n}\n\n// TimestampString returns the RFC 3339 string for valid Timestamps.\n// For invalid Timestamps, it returns an error message in parentheses.\n//\n// Deprecated: Call the ts.AsTime method instead,\n// followed by a call to the Format method on the time.Time value.\nfunc TimestampString(ts *timestamppb.Timestamp) string {\n\tt, err := Timestamp(ts)\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"(%v)\", err)\n\t}\n\treturn t.Format(time.RFC3339Nano)\n}\n\n// validateTimestamp determines whether a Timestamp is valid.\n// A valid timestamp represents a time in the range [0001-01-01, 10000-01-01)\n// and has a Nanos field in the range [0, 1e9).\n//\n// If the Timestamp is valid, validateTimestamp returns nil.\n// Otherwise, it returns an error that describes the problem.\n//\n// Every valid Timestamp can be represented by a time.Time,\n// but the converse is not true.\nfunc validateTimestamp(ts *timestamppb.Timestamp) error {\n\tif ts == nil {\n\t\treturn errors.New(\"timestamp: nil Timestamp\")\n\t}\n\tif ts.Seconds < minValidSeconds {\n\t\treturn fmt.Errorf(\"timestamp: %v before 0001-01-01\", ts)\n\t}\n\tif ts.Seconds >= maxValidSeconds {\n\t\treturn fmt.Errorf(\"timestamp: %v after 10000-01-01\", ts)\n\t}\n\tif ts.Nanos < 0 || ts.Nanos >= 1e9 {\n\t\treturn fmt.Errorf(\"timestamp: %v: nanos not in range [0, 1e9)\", ts)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "ptypes/timestamp_test.go",
    "content": "// Copyright 2016 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage ptypes\n\nimport (\n\t\"math\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/golang/protobuf/proto\"\n\n\ttspb \"github.com/golang/protobuf/ptypes/timestamp\"\n)\n\nvar tests = []struct {\n\tts    *tspb.Timestamp\n\tvalid bool\n\tt     time.Time\n}{\n\t// The timestamp representing the Unix epoch date.\n\t{&tspb.Timestamp{Seconds: 0, Nanos: 0}, true, utcDate(1970, 1, 1)},\n\t// The smallest representable timestamp.\n\t{&tspb.Timestamp{Seconds: math.MinInt64, Nanos: math.MinInt32}, false,\n\t\ttime.Unix(math.MinInt64, math.MinInt32).UTC()},\n\t// The smallest representable timestamp with non-negative nanos.\n\t{&tspb.Timestamp{Seconds: math.MinInt64, Nanos: 0}, false, time.Unix(math.MinInt64, 0).UTC()},\n\t// The earliest valid timestamp.\n\t{&tspb.Timestamp{Seconds: minValidSeconds, Nanos: 0}, true, utcDate(1, 1, 1)},\n\t//\"0001-01-01T00:00:00Z\"},\n\t// The largest representable timestamp.\n\t{&tspb.Timestamp{Seconds: math.MaxInt64, Nanos: math.MaxInt32}, false,\n\t\ttime.Unix(math.MaxInt64, math.MaxInt32).UTC()},\n\t// The largest representable timestamp with nanos in range.\n\t{&tspb.Timestamp{Seconds: math.MaxInt64, Nanos: 1e9 - 1}, false,\n\t\ttime.Unix(math.MaxInt64, 1e9-1).UTC()},\n\t// The largest valid timestamp.\n\t{&tspb.Timestamp{Seconds: maxValidSeconds - 1, Nanos: 1e9 - 1}, true,\n\t\ttime.Date(9999, 12, 31, 23, 59, 59, 1e9-1, time.UTC)},\n\t// The smallest invalid timestamp that is larger than the valid range.\n\t{&tspb.Timestamp{Seconds: maxValidSeconds, Nanos: 0}, false, time.Unix(maxValidSeconds, 0).UTC()},\n\t// A date before the epoch.\n\t{&tspb.Timestamp{Seconds: -281836800, Nanos: 0}, true, utcDate(1961, 1, 26)},\n\t// A date after the epoch.\n\t{&tspb.Timestamp{Seconds: 1296000000, Nanos: 0}, true, utcDate(2011, 1, 26)},\n\t// A date after the epoch, in the middle of the day.\n\t{&tspb.Timestamp{Seconds: 1296012345, Nanos: 940483}, true,\n\t\ttime.Date(2011, 1, 26, 3, 25, 45, 940483, time.UTC)},\n}\n\nfunc TestValidateTimestamp(t *testing.T) {\n\tfor _, s := range tests {\n\t\tgot := validateTimestamp(s.ts)\n\t\tif (got == nil) != s.valid {\n\t\t\tt.Errorf(\"validateTimestamp(%v) = %v, want %v\", s.ts, got, s.valid)\n\t\t}\n\t}\n}\n\nfunc TestTimestamp(t *testing.T) {\n\tfor _, s := range tests {\n\t\tgot, err := Timestamp(s.ts)\n\t\tif (err == nil) != s.valid {\n\t\t\tt.Errorf(\"Timestamp(%v) error = %v, but valid = %t\", s.ts, err, s.valid)\n\t\t} else if s.valid && got != s.t {\n\t\t\tt.Errorf(\"Timestamp(%v) = %v, want %v\", s.ts, got, s.t)\n\t\t}\n\t}\n\t// Special case: a nil Timestamp is an error, but returns the 0 Unix time.\n\tgot, err := Timestamp(nil)\n\twant := time.Unix(0, 0).UTC()\n\tif got != want {\n\t\tt.Errorf(\"Timestamp(nil) = %v, want %v\", got, want)\n\t}\n\tif err == nil {\n\t\tt.Errorf(\"Timestamp(nil) error = nil, expected error\")\n\t}\n}\n\nfunc TestTimestampProto(t *testing.T) {\n\tfor _, s := range tests {\n\t\tgot, err := TimestampProto(s.t)\n\t\tif (err == nil) != s.valid {\n\t\t\tt.Errorf(\"TimestampProto(%v) error = %v, but valid = %t\", s.t, err, s.valid)\n\t\t} else if s.valid && !proto.Equal(got, s.ts) {\n\t\t\tt.Errorf(\"TimestampProto(%v) = %v, want %v\", s.t, got, s.ts)\n\t\t}\n\t}\n\t// No corresponding special case here: no time.Time results in a nil Timestamp.\n}\n\nfunc TestTimestampString(t *testing.T) {\n\tfor _, test := range []struct {\n\t\tts   *tspb.Timestamp\n\t\twant string\n\t}{\n\t\t// Not much testing needed because presumably time.Format is\n\t\t// well-tested.\n\t\t{&tspb.Timestamp{Seconds: 0, Nanos: 0}, \"1970-01-01T00:00:00Z\"},\n\t} {\n\t\tgot := TimestampString(test.ts)\n\t\tif got != test.want {\n\t\t\tt.Errorf(\"TimestampString(%v) = %q, want %q\", test.ts, got, test.want)\n\t\t}\n\t}\n}\n\nfunc utcDate(year, month, day int) time.Time {\n\treturn time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.UTC)\n}\n\nfunc TestTimestampNow(t *testing.T) {\n\t// Bracket the expected time.\n\tbefore := time.Now()\n\tts := TimestampNow()\n\tafter := time.Now()\n\n\ttm, err := Timestamp(ts)\n\tif err != nil {\n\t\tt.Errorf(\"between %v and %v\\nTimestampNow() = %v\\nwhich is invalid (%v)\", before, after, ts, err)\n\t}\n\tif tm.Before(before) || tm.After(after) {\n\t\tt.Errorf(\"between %v and %v\\nTimestamp(TimestampNow()) = %v\", before, after, tm)\n\t}\n}\n"
  },
  {
    "path": "ptypes/wrappers/wrappers.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: github.com/golang/protobuf/ptypes/wrappers/wrappers.proto\n\npackage wrappers\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\twrapperspb \"google.golang.org/protobuf/types/known/wrapperspb\"\n\treflect \"reflect\"\n)\n\n// Symbols defined in public import of google/protobuf/wrappers.proto.\n\ntype DoubleValue = wrapperspb.DoubleValue\ntype FloatValue = wrapperspb.FloatValue\ntype Int64Value = wrapperspb.Int64Value\ntype UInt64Value = wrapperspb.UInt64Value\ntype Int32Value = wrapperspb.Int32Value\ntype UInt32Value = wrapperspb.UInt32Value\ntype BoolValue = wrapperspb.BoolValue\ntype StringValue = wrapperspb.StringValue\ntype BytesValue = wrapperspb.BytesValue\n\nvar File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto protoreflect.FileDescriptor\n\nvar file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc = []byte{\n\t0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c,\n\t0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79,\n\t0x70, 0x65, 0x73, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2f, 0x77, 0x72, 0x61,\n\t0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f,\n\t0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61,\n\t0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x35, 0x5a, 0x33, 0x67,\n\t0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67,\n\t0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73,\n\t0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x3b, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65,\n\t0x72, 0x73, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = []interface{}{}\nvar file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = []int32{\n\t0, // [0:0] is the sub-list for method output_type\n\t0, // [0:0] is the sub-list for method input_type\n\t0, // [0:0] is the sub-list for extension type_name\n\t0, // [0:0] is the sub-list for extension extendee\n\t0, // [0:0] is the sub-list for field type_name\n}\n\nfunc init() { file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() }\nfunc file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_init() {\n\tif File_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto != nil {\n\t\treturn\n\t}\n\ttype x struct{}\n\tout := protoimpl.TypeBuilder{\n\t\tFile: protoimpl.DescBuilder{\n\t\t\tGoPackagePath: reflect.TypeOf(x{}).PkgPath(),\n\t\t\tRawDescriptor: file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes,\n\t\tDependencyIndexes: file_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs,\n\t}.Build()\n\tFile_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto = out.File\n\tfile_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_rawDesc = nil\n\tfile_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_goTypes = nil\n\tfile_github_com_golang_protobuf_ptypes_wrappers_wrappers_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "regenerate.bash",
    "content": "#!/bin/bash\n# Copyright 2018 The Go Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style\n# license that can be found in the LICENSE file.\n\ncd \"$(git rev-parse --show-toplevel)\"\nset -e\ngo run ./internal/cmd/generate-alias -execute\ngo test ./protoc-gen-go -regenerate\n"
  },
  {
    "path": "test.bash",
    "content": "#!/bin/bash\n# Copyright 2018 The Go Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style\n# license that can be found in the LICENSE file.\n\ncd \"$(git rev-parse --show-toplevel)\"\n\nBOLD=\"\\x1b[1mRunning: \"\nPASS=\"\\x1b[32mPASS\"\nFAIL=\"\\x1b[31mFAIL\"\nRESET=\"\\x1b[0m\"\n\necho -e \"${BOLD}go test ./...${RESET}\"\nRET_TEST0=$(go test ./... | egrep -v \"^(ok|[?])\\s+\")\nif [[ ! -z \"$RET_TEST0\" ]]; then echo \"$RET_TEST0\"; echo; fi\n\necho -e \"${BOLD}go test -tags purego ./...${RESET}\"\nRET_TEST1=$(go test -tags purego ./... | egrep -v \"^(ok|[?])\\s+\")\nif [[ ! -z \"$RET_TEST1\" ]]; then echo \"$RET_TEST1\"; echo; fi\n\necho -e \"${BOLD}go generate${RESET}\"\nRET_GEN=$(go run ./internal/cmd/generate-alias 2>&1)\nif [[ ! -z \"$RET_GEN\" ]]; then echo \"$RET_GEN\"; echo; fi\n\necho -e \"${BOLD}go fmt${RESET}\"\nRET_FMT=$(gofmt -d $(git ls-files *.go) 2>&1)\nif [[ ! -z \"$RET_FMT\" ]]; then echo \"$RET_FMT\"; echo; fi\n\necho -e \"${BOLD}git diff${RESET}\"\nRET_DIFF=$(git diff --no-prefix HEAD 2>&1)\nif [[ ! -z \"$RET_DIFF\" ]]; then echo \"$RET_DIFF\"; echo; fi\n\necho -e \"${BOLD}git ls-files${RESET}\"\nRET_FILES=$(git ls-files --others --exclude-standard 2>&1)\nif [[ ! -z \"$RET_FILES\" ]]; then echo \"$RET_FILES\"; echo; fi\n\nif [[ ! -z \"$RET_TEST0\" ]] || [[ ! -z \"$RET_TEST1\" ]] || [[ ! -z \"$RET_GEN\" ]] || [ ! -z \"$RET_FMT\" ] || [[ ! -z \"$RET_DIFF\" ]] || [[ ! -z \"$RET_FILES\" ]]; then\n\techo -e \"${FAIL}${RESET}\"; exit 1\nelse\n\techo -e \"${PASS}${RESET}\"; exit 0\nfi\n"
  }
]